There are no events emitting if I call remotely

Greetings,

I am trying to call a method query:

 payable stateful entrypoint query(args: string) : bytes(32) =
         if(Map.lookup(Call.caller, state.reqc) == None)
            put(state{reqc[Call.caller] = 0})
         put(state{reqc[Call.caller] = state.reqc[Call.caller] + 1})
         // Required, so queries can be mapped with unique key
         let uniq_id : bytes(32) = Crypto.sha3(String.concat(String.concat(Address.to_str(Contract.address), Address.to_str(Call.caller)), Int.to_str(state.reqc[Call.caller])))
         require(state.base_fee =< Call.value, "insufficient value for qfee") 
         put(state{queries[uniq_id] = Oracle.query(state.source_oracle, args, state.base_fee, RelativeTTL(state.qttl), RelativeTTL(state.rttl))})
         Chain.event(QueryCreated(state.source_oracle, uniq_id, Chain.timestamp, args))
         uniq_id

If I call it directly, It emits an event that I can listen to with a WebSocket connection.

connection.send(JSON.stringify({
    op: "Subscribe",
    payload: "Object",
    target: contract_address.replace(/^.{2}/g, 'ok')
  }));

But if I try to call query from another contract then it do gives bytes(32) in the end but there are no events emitting in this case and further, I don’t see any call that is done from a contract but I did many calls to query and it successfully gave the results from another contract: https://testnet.aeternity.io/middleware/contracts/transactions/address/ct_2Br7hTDyfgemSF4Jj12bkvdZPx9L237H8LJgu25h3y1j2Z7RFE

2 Likes

copy/paste from discord:

@jeevanjot when I understand correctly your tx is successful right? I see that you are trying to access the frontend of the “old buggy middleware”
[22:05]
let me check your tx with die API of the new middleware
[22:06]
here the endpoints: GitHub - aeternity/ae_mdw: Aeternity Middleware in Elixir
[22:08]
@jeevanjot https://testnet.aeternity.io/mdw/contracts/logs/backward?contract_id=ct_2Br7hTDyfgemSF4Jj12bkvdZPx9L237H8LJgu25h3y1j2Z7RFE
[22:08]
does that help you?

1 Like

Thank you @marco.chain New endpoints helps to find my call But not from another contract. So I am trying another but this endpoint https://testnet.aeternity.io/mdw/contracts/calls?contract_id=ct_2Br7hTDyfgemSF4Jj12bkvdZPx9L237H8LJgu25h3y1j2Z7RFE but it returns

from here: GitHub - aeternity/ae_mdw: Aeternity Middleware in Elixir

And Is it also possible to listen to the event. I am using newer mdw endpoint now. If it is not, I can work with it.

@karol.chain @Arthur can you help out? :sweat_smile:

1 Like

The latest version with this endpoint isn’t yet deployed on our infra, if you need it urgently the best is to have middleware running locally.

We are focusing on identifying of potential issues related to Iris hard fork and once that is complete we will deploy the latest version which will be Iris compatible for smooth transition.

Should be all there in week or two, sorry for delay!

3 Likes

Thank you Karol, What I am looking for is to list queries or events, Can you please help me out.

For events emitted explicitly from your contract, take a look at contracts/logs endpoint:

Since middleware doesn’t have the source code of your contract, the user experience isn’t exactly great, but that endpoint is still useful.

3 Likes

oh ok, I can take value from the event arg. Thank you @marco.chain @karol.chain

2 Likes