TriggerConstantContract

POST: http://172.104.51.182:16667/wallet/triggerconstantcontract

Trigger the constant of the smart contract, the transaction is off the blockchain. Returns the Transaction Object. The corresponding method must be marked view or pure.

BODY PARAMS {

owner_address string

contract_address string

function_selector string

parameter string

visible boolean (Optional)

}

Note:

  • owner address that triggers the contract. If visible=true, use base58check format, otherwise use hex format. For constant call you can use the all-zero address.

  • contract address is smart contract address. If visible=true, use base58check format, otherwise use hex format.

  • function_selector is function call, must not be left blank.

  • parameter encoding needs to be in accordance with the ABI rules, the rules are more complicated, users can use the ethers library to encode,For details, please refer to the document-Guide-Smart Contract-Best Practice-Parameter Encoding and Decoding..

  • visible: whehter the address is in base58check format.

Example:

curl --request POST --url http://172.104.51.182:16667/wallet/triggerconstantcontract --header 'Accept: application/json' --header 'Content-Type: application/json' --data ' { "owner_address": "410000000000000000000000000000000000000000", "contract_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c", "function_selector": "balanceOf(address)", "parameter": "000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c" }

Input:

{

"owner_address": "WFzFXoQCgUeoApjejKM9B46NgFGHXvUyKz", "contract_address": "WV27cVbuGmTv9q6qgtPxsLUkuG9ohUUVPd", "function_selector": "balanceOf(address)", "parameter": "0000000000000000000000004203485a535a4072c9fbfaaddfe2a010ad0bcdb0", "visible": true

}

Response:

{

"result": { "result": true }, "constant_result": [ "0000000000000000000000000000000000000000000000000000000000000001" ], "transaction": { "ret": [ {} ], "visible": true, "txID": "65acb81ca6fddf5ddb36ce6f70f59055f54e9d1be7a8c914e09ab64861ad618b", "raw_data": { "contract": [ { "parameter": { "value": { "data": "70a082310000000000000000000000004203485a535a4072c9fbfaaddfe2a010ad0bcdb0", "owner_address": "WFzFXoQCgUeoApjejKM9B46NgFGHXvUyKz", "contract_address": "WV27cVbuGmTv9q6qgtPxsLUkuG9ohUUVPd" }, "type_url": "type.googleapis.com/protocol.TriggerSmartContract" }, "type": "TriggerSmartContract" } ], "ref_block_bytes": "610a", "ref_block_hash": "29c5bc3adde0b6e8", "expiration": 1639969011000, "timestamp": 1639968952474 }, "raw_data_hex": "0a02610a220829c5bc3adde0b6e840b8ea94aedd2f5a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a15414203485a535a4072c9fbfaaddfe2a010ad0bcdb0121541d0f723a417a54e5629d865e05db8a45b79f0a9c3222470a082310000000000000000000000004203485a535a4072c9fbfaaddfe2a010ad0bcdb0709aa191aedd2f" }

}

Last updated