Call Contract Read ABI
Executes a contract read ABI call.
Request
VIEW
GET /v1/sofa/wallets/WALLET_ID/contract/read?contract=contract_address&data=data
Withdrawal Wallet
Deposit-withdrawal Wallet
Delegated Wallet
Query Parameters
Field | Type | Note | Description |
---|---|---|---|
contract | string | requried | Representing the contract to interact with |
data | string | required | The hash of the method signature and encoded parameters |
The
Response Body
data
must be encoded by web3.eth.abi.encodeFunctionCall() of web3.js.
Field | Type | Description |
---|---|---|
output | string | The output of read ABI call |
The
output
must be decoded by web3.eth.abi.encodeFunctionCall() of web3.js.
Error Code
HTTP Code | Error Code | Error | Message | Description |
---|---|---|---|---|
403 | - | Forbidden. Invalid wallet ID | - | No wallet ID found |
403 | - | Forbidden. Header not found | - | Missing X-API-CODE , X-CHECKSUM header or query param t |
403 | - | Forbidden. Invalid timestamp | - | The timestamp t is not in the valid time range |
403 | - | Forbidden. Invalid checksum | - | The request is considered a replay request |
403 | - | Forbidden. Invalid API code | - | X-API-CODE header contains invalid API code |
403 | - | Invalid API code for wallet {WALLET_ID} | - | The API code mismatched |
403 | - | Forbidden. Checksum unmatch | - | X-CHECKSUM header contains wrong checksum |
403 | - | Forbidden. Call too frequently ({THROTTLING_COUNT} calls/minute) | - | Send requests too frequently |
403 | 385 | API Secret not valid | - | Invalid API code permission |
400 | 112 | Invalid parameter | - | Missing necessary parameters |
400 | 112 | Operation failed | invalid address: {contract_address} | The contract address does not conform to the cryptocurrency format |
400 | 112 | Invalid parameter | no contract policy | There is no contract policy of the given wallet |
400 | 112 | Invalid parameter | unsupported contract | There is no contract policy of the given contract address |
400 | 303 | Invalid currency | - | Not supported cryptocurrency to call contract read ABI |
Sample Request
API
/v1/sofa/wallets/345312/contract/read?contract=0xad6d458402f60fd3bd25163575031acdce07538d&data=0xdd62ed3e000000000000000000000000d11bd6e308b8dc1c5243d54cf41a427ca0f46943000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Response Body
{
"output": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
Sample cURL Command
Designed for the mock server
curl http://localhost:8889/v1/mock/wallets/{WALLET_ID}/contract/read?contract=0xad6d458402f60fd3bd25163575031acdce07538d&data=0xdd62ed3e000000000000000000000000d11bd6e308b8dc1c5243d54cf41a427ca0f46943000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564