Installation and usage of the platform

gRPC: obtaining information on a smart contract

The ContractPublicService gRPC service is used to retrieve information about a smart contract.

Note

The ContractPublicService returns information about both Docker smart contracts and WASM smart contracts.

The service has one method described in the contract/contract_public_service.proto protobuf file:

  • GetContractBalances.

Important

The field data types for the request and response are specified in the protobuf file.

Use the GetContractBalances method to get the contract balances: the balance in WEST system token as well as in other tokens (assets).

The method accepts a ContractBalancesByIdRequest that requires the following parameters:

  • contract_id – the identifier of the smart contract the balance information of which you want to obtain,

  • assets_ids – the asset identifier; to get the WEST system token balance, pass {"value":null} or {"value":""} in the assets_ids field

Note

You can also use the contracts group REST methods to retrieve the same data as with the GetContractBalances gRPC method:

See also