TRON — SolidityNode API (2/4)
API reference for TRON. All methods ->
wallet/listproposals
Retrieves all proposals.
Parameters
None.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/listproposals'
Response example
{
"proposals": [
{
"proposal_id": 84,
"proposer_address": "41456798cb4ab28109d8cc643cd7da7bd6069ceae9",
"parameters": [
{
"key": 70,
"value": 14
},
{
"key": 59,
"value": 1
}
],
"expiration_time": 1680847200000,
"create_time": 1680581727000,
"approvals": [
"41456798cb4ab28109d8cc643cd7da7bd6069ceae9",
"418440ffd578f7a5abf3537b5f46a6980d382db581",
"4167e39013be3cdd3814bed152d7439fb5b6791409",
"414ce8225c8ea6c8e1e0a483132211610c765fc6df",
"41c189fa6fc9ed7a3580c3fe291915d5c6a6259be7"
]
}
]
}
wallet/proposalapprove
Approves a proposal.
Parameters
owner_address(string; hex; required): the address that makes the approvalproposal_id(integer; required): a proposal ID.is_add_approval(boolean; required): whether to approve or not.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/proposalapprove' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844F7600E018FD0D710E2145351D607B3316CE9",
"proposal_id": 1,
"is_add_approval": true
}'
wallet/proposaldelete
Deletes a proposal.
Parameters
owner_address(string; hex; required): a proposal's owner address.proposal_id(integer; required): a proposal ID.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/proposaldelete' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844F7600E018FD0D710E2145351D607B3316CE9",
"proposal_id": 1
}'
wallet/getaccountresource
Retrieves the resource information of an account.
Parameters
address(string; hex; required): an account address.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getaccountresource' \
-H 'Content-Type: application/json' \
-d '{
"address": "419844f7600e018fd0d710e2145351d607b3316ce9"
}'
wallet/exchangecreate
Creates an exchange pair.
Parameters
owner_address(string; hex; required): an owner address.first_token_id(string; hex; required): the first token's ID.first_token_balance(integer; required): the first token's balance.second_token_id(string; hex; required): the second token's ID.second_token_balance(integer; required): the second token's balance.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/exchangecreate' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9",
"first_token_id": "token_a",
"first_token_balance": 100,
"second_token_id": "token_b",
"second_token_balance": 200
}'
wallet/exchangeinject
Injects funds for an exchange pair.
Parameters
owner_address(string; hex; required): an owner address of the exchange pair.exchange_id(integer; required): an exchange pair.token_id(string; hex; required): a token ID.quant(integer; required): a token inject amount.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/exchangeinject' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9",
"exchange_id": 1,
"token_id": "74726f6e6e616d65",
"quant": 100
}'
wallet/exchangewithdraw
Withdraws from an exchange pair.
Parameters
owner_address(string; hex; required): an owner address of the exchange pair.exchange_id(integer; required): an exchange pair.token_id(string; hex; required): a token ID.quant(integer; required): a token inject amount.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/exchangewithdraw' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9",
"exchange_id": 1,
"token_id": "74726f6e6e616d65",
"quant": 100
}'
wallet/exchangetransaction
Participates the transaction of exchange pair.
Parameters
owner_address(string; hex; required): an owner address of the exchange pair.exchange_id(integer; required): an exchange pair.token_id(string; hex; required): a token ID.quant(integer; required): a token inject amount.expected(integer; required): an expected token amount to get.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/exchangetransaction' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9",
"exchange_id": 1,
"token_id": "74726f6e6e616d65",
"quant": 100,
"expected": 10
}'
wallet/getexchangebyid
Retrieves an exchange pair by exchange pair ID.
Parameters
id(integer; required): an exchange pair ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getexchangebyid' \
-H 'Content-Type: application/json' \
-d '{
"id": 1
}'
Response example
{
"exchange_id": 1,
"creator_address": "41f596e85bfd042744f76880979a133da0728679d9",
"create_time": 1539673398000,
"first_token_id": "31303030353634",
"first_token_balance": 5,
"second_token_id": "5f",
"second_token_balance": 4326459
}
wallet/listexchanges
Retrieves the list of all exchange pairs.
Parameters
None.
Request example
curl -X GET 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/listexchanges'
Response example
{
"exchanges": [
{
"exchange_id": 184,
"creator_address": "4165b29b92cb5f33342647c4cc32b6efcb59eb3f45",
"create_time": 1615538445000,
"first_token_id": "31303033333934",
"first_token_balance": 100000000000000,
"second_token_id": "31303032393232",
"second_token_balance": 1341470000000
},
{
"exchange_id": 183,
"creator_address": "41f55075d3c88b65d65e0f4cb19881182adce446b8",
"create_time": 1602234009000,
"first_token_id": "31303032373537",
"second_token_id": "5f"
},
{
"exchange_id": 182,
"creator_address": "41d4af469119bab46909222e77e277c655f0de9054",
"create_time": 1600277286000,
"first_token_id": "31303033333031",
"first_token_balance": 115545377,
"second_token_id": "31303032303030",
"second_token_balance": 86546095
},
{
"exchange_id": 181,
"creator_address": "41d4af469119bab46909222e77e277c655f0de9054",
"create_time": 1600208667000,
"first_token_id": "5f",
"first_token_balance": 37777779,
"second_token_id": "31303033333031",
"second_token_balance": 66176472
}
]
}
wallet/getchainparameters
Retrieves the parameters of the blockchain used for witnesses to create a proposal.
Parameters
None.
Request example
curl -X GET 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getchainparameters'
Response example
{
"chainParameter": [
{
"key": "getMaintenanceTimeInterval",
"value": 21600000
},
{
"key": "getAccountUpgradeCost",
"value": 9999000000
},
{
"key": "getCreateAccountFee",
"value": 100000
},
{
"key": "getTransactionFee",
"value": 1000
},
{
"key": "getAssetIssueFee",
"value": 1024000000
},
{
"key": "getWitnessPayPerBlock",
"value": 16000000
},
{
"key": "getWitnessStandbyAllowance",
"value": 115200000000
},
{
"key": "getCreateNewAccountFeeInSystemContract",
"value": 1000000
}
]
}
wallet/updatesetting
Updates the
consume_user_resource_percentparameter of a smart contract.
Parameters
owner_address(string; hex; required): an owner address of the smart contract.contract_address(string; hex; required): a smart contract address.consume_user_resource_percent(integer; required): a percentage of user resource consumption.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/updatesetting' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9",
"contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f",
"consume_user_resource_percent": 7
}'
wallet/updateenergylimit
Updates the
origin_energy_limitparameter of a smart contract.
Parameters
owner_address(string; hex; required): an owner address of the smart contract.contract_address(string; hex; required): a smart contract address.origin_energy_limit(integer; required): the maximum resource consumption of the creator in one execution or creation.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/updateenergylimit' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9",
"contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f",
"origin_energy_limit": 7
}'
wallet/getdelegatedresource
Retrieves the energy delegation information.
Parameters
fromAddress(string; hex; required): the energy "from" address.toAddress(string; hex; required): the energy "to" address.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getdelegatedresource' \
-H 'Content-Type: application/json' \
-d '{
"fromAddress": "419844f7600e018fd0d710e2145351d607b3316ce9",
"toAddress": "41c6600433381c731f22fc2b9f864b14fe518b322f"
}'
wallet/getdelegatedresourceaccountindex
Retrieves the energy delegation index by an account.
Parameters
value(string; hex; required): an account address.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getdelegatedresourceaccountindex' \
-H 'Content-Type: application/json' \
-d '{
"value": "419844f7600e018fd0d710e2145351d607b3316ce9"
}'
Response example
{
"account": "419844f7600e018fd0d710e2145351d607b3316ce9"
}
wallet/setaccountid
Sets an account ID for an account.
Parameters
owner_address(string; hex; required): an owner address.account_id(string; hex; required): an account ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/setaccountid' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41a7d8a35b260395c14aa456297662092ba3b76fc0",
"account_id": "6161616162626262"
}'
Response example
{
"visible": false,
"txID": "5e0bec70e545e1ec197d580ae90d2d4a105409d99f7666d33e31d1b05512794a",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"account_id": "6161616162626262",
"owner_address": "41a7d8a35b260395c14aa456297662092ba3b76fc0"
},
"type_url": "type.googleapis.com/protocol.SetAccountIdContract"
},
"type": "SetAccountIdContract"
}
],
"ref_block_bytes": "444a",
"ref_block_hash": "5078253a302d67ab",
"expiration": 1680677295000,
"timestamp": 1680677235852
},
"raw_data_hex": "0a02444a22085078253a302d67ab4098a7b181f5305a5a081312560a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5365744163636f756e744964436f6e747261637412210a086161616162626262121541a7d8a35b260395c14aa456297662092ba3b76fc0708cd9ad81f530"
}
wallet/getaccountbyid
Retrieves account information by account ID.
Parameters
account_id(string; hex; required): an account ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getaccountbyid' \
-H 'Content-Type: application/json' \
-d '{
"account_id": "6161616162626262"
}'
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getdeferredtransactionbyid' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/canceldeferredtransactionbyid' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getdeferredtransactioninfobyid' )
//: # (-H 'Content-Type: application/json' )
wallet/triggerconstantcontract
Triggers the constant of the smart contract, the transaction is off the blockchain.
Parameters
contract_address(string; hex; required): a smart contract address.function_selector(string; required): a function call; must not leave any blank space.parameter(string; required): the parameter passed tofunction_selector; the format must match with the VM's requirements; you can use a tool provided by remix to convert a parameter [1,2] into the format required by VM.fee_limit(integer; required): the maximum TRX burns for resource consumption.call_value(integer; required): the TRX transfer to the contract for each call.owner_address(string; hex; required): an owner address that triggers the contract.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/triggerconstantcontract' \
-H 'Content-Type: application/json' \
-d '{
"contract_address": "4189139CB1387AF85E3D24E212A008AC974967E561",
"function_selector": "set(uint256,uint256)",
"parameter": "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
"fee_limit": 10,
"call_value": 100,
"owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292"
}'
Response example
{
"result": {
"code": "CONTRACT_VALIDATE_ERROR",
"message": "536d61727420636f6e7472616374206973206e6f742065786973742e"
}
}
wallet/clearabi
Clears the abi of a smart contract.
Parameters
owner_address(string; hex; required): an owner address of the smart contract.contract_address(string; hex; required): a smart contract address.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/clearabi' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41a7d8a35b260395c14aa456297662092ba3b76fc0",
"contract_address": "417bcb781f4743afaacf9f9528f3ea903b3782339f"
}'
wallet/getsignweight
Retrieves the current signatures total weight of a transaction after signing.
Parameters
A transaction object after signing.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getsignweight' \
-H 'Content-Type: application/json' \
-d '{
"visible": true,
"signature": [
"36c9d227b9dd6b6f377d018bb2df784be884f28c743dc97edfdaa8bd64b2ffb058bca24a4eb8b4543a052a4f353fee8cb9e606ff739c74d22f9451c7a35c8f5200"
],
"txID": "4d928f7adfbad5c82f5b8518a6f7b7c5e459d06d1cb5306c61fad8a793587d2d",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"amount": 1000000,
"owner_address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
"to_address": "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW"
},
"type_url": "type.googleapis.com/protocol.TransferContract"
},
"type": "TransferContract",
"Permission_id": 2
}
],
"ref_block_bytes": "0380",
"ref_block_hash": "6cdc8193f096be0f",
"expiration": 1556249055000,
"timestamp": 1556248995694
},
"raw_data_hex": "0a02038022086cdc8193f096be0f40989eb0bda52d5a69080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541a7d8a35b260395c14aa456297662092ba3b76fc01215415a523b449890854c8fc460ab602df9f31fe4293f18c0843d280270eeceacbda52d"
}'
Response example
{
"result": {
"code": "PERMISSION_ERROR",
"message": "36c9d227b9dd6b6f377d018bb2df784be884f28c743dc97edfdaa8bd64b2ffb058bca24a4eb8b4543a052a4f353fee8cb9e606ff739c74d22f9451c7a35c8f5200 is signed by TNhXo1GbRNCuorvYu5JFWN3m2NYr9QQpVR but it is not contained of permission."
},
"permission": {
"operations": "7fff1fc0033e0300000000000000000000000000000000000000000000000000",
"keys": [
{
"address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
"weight": 1
},
{
"address": "TGsy6W3T4fs3nAMk4E6ohfXXsosbHXRLvK",
"weight": 10
}
],
"threshold": 10,
"id": 2,
"type": "Active",
"permission_name": "active"
},
"transaction": {
"result": {
"result": true
},
"txid": "4d928f7adfbad5c82f5b8518a6f7b7c5e459d06d1cb5306c61fad8a793587d2d",
"transaction": {
"signature": [
"36c9d227b9dd6b6f377d018bb2df784be884f28c743dc97edfdaa8bd64b2ffb058bca24a4eb8b4543a052a4f353fee8cb9e606ff739c74d22f9451c7a35c8f5200"
],
"txID": "4d928f7adfbad5c82f5b8518a6f7b7c5e459d06d1cb5306c61fad8a793587d2d",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"amount": 1000000,
"owner_address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
"to_address": "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW"
},
"type_url": "type.googleapis.com/protocol.TransferContract"
},
"type": "TransferContract",
"Permission_id": 2
}
],
"ref_block_bytes": "0380",
"ref_block_hash": "6cdc8193f096be0f",
"expiration": 1556249055000,
"timestamp": 1556248995694
},
"raw_data_hex": "0a02038022086cdc8193f096be0f40989eb0bda52d5a69080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541a7d8a35b260395c14aa456297662092ba3b76fc01215415a523b449890854c8fc460ab602df9f31fe4293f18c0843d280270eeceacbda52d"
}
}
}