I'm using ReactJs and ContractPromise object can't/don't access contract query and txs object.

const contract = new ContractPromise(api,metadata( in json even string format), address);

The object instantiated it seems don't actually access the metadata.

contract.query // wont access the queries, 
contract.address // will access the address
contract.abi // will access the abi
contract.tx // wont access the transactions
  • what do you mean won't access the queries and transactions? do you get an error? how did you try to access them? for the flip method on the flipper contract you would do contract.tx["flip"] or contract.tx.flip Commented Apr 25, 2023 at 11:27
  • The issue is the query, txn and other objects are marked as private in the api metadata. Commented Apr 25, 2023 at 12:57
  • yes, that is a design decision and very unlikely to change. unless you provide more info on what you are trying to achieve, I am unable to help Commented Apr 26, 2023 at 13:04

1 Answer 1


Would you please provide more information? For your second argument you can try using an ABI instance. This works for me.

new Abi(metadata, api.registry.getChainProperties())

Here is a full example from useink, a React hooks library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.