TRXMarket
Search…
TRC10 撤单
步骤说明
步骤一:通过 TronGrid 提供的接口服务触发智能合约创建取消订单事务(获取transaction)
步骤二:对事务进行签名
步骤三:广播事务
详细文档见 触发合约、签名和广播。
合约地址
基础币种为 TRC10 且报价币种为 TRX:4155ac3875ceaf0dfe45fe3ee7312b0994a8894097
合约方法
cancelOrder(uint256)
参数说明
parameter
该字段为合约方法 cancelOrder 需要传入的参数。
cancelOrder 合约方法有一个参数需要传入,这个参数是一个长度为64的字符串parameter字段。
参数:用户想要取消的订单ID(可通过订单查询接口获取),将该订单ID值转换为16进制的数字字符串后,把该字符串之前不足64位字符的部分用0补齐。
示例
用户 TLva2m6sx2Ya44kHUN2GZUF2PT5KcCNNUQ 将之前提交的一笔价格为0.54,数量为20的TSY卖单撤销
步骤一:调用 https://api.trongrid.io/wallet/triggersmartcontract 接口触发合约
Bodydata:
1
{
2
"contract_address": "4155ac3875ceaf0dfe45fe3ee7312b0994a8894097",
3
"owner_address": "417829b0adcb34405331a9910c646b5b71aeddc564",
4
"function_selector": "cancelOrder(uint256)",
5
"fee_limit": 1000000000,
6
"call_value": 0,
7
"parameter": "000000000000000000000000000000000000000000000000000000e8d4a6a95f"
8
}
Copied!
Response:
1
{
2
"result": {
3
"result": true
4
},
5
"transaction": {
6
"txID": "83ddfa7aae3945f3aac3ef19e864e9322ae568991d377f9c4957b495d074002f",
7
"raw_data": {
8
"contract": [{
9
"parameter": {
10
"value": {
11
"data": "514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a95f",
12
"owner_address": "417829b0adcb34405331a9910c646b5b71aeddc564",
13
"contract_address": "4155ac3875ceaf0dfe45fe3ee7312b0994a8894097"
14
},
15
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
16
},
17
"type": "TriggerSmartContract"
18
}],
19
"ref_block_bytes": "8be6",
20
"ref_block_hash": "96ad71060d05c018",
21
"expiration": 1559186685000,
22
"fee_limit": 1000000000,
23
"timestamp": 1559186626338
24
},
25
"raw_data_hex": "0a028be6220896ad71060d05c01840c8f892b6b02d5a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a15417829b0adcb34405331a9910c646b5b71aeddc56412154155ac3875ceaf0dfe45fe3ee7312b0994a88940972224514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a95f70a2ae8fb6b02d90018094ebdc03"
26
}
27
}
Copied!
步骤二:调用 https://api.trongrid.io/wallet/gettransactionsign 接口获取签名
Bodydata:
1
{
2
"transaction": {
3
"txID": "83ddfa7aae3945f3aac3ef19e864e9322ae568991d377f9c4957b495d074002f",
4
"raw_data": {
5
"contract": [{
6
"parameter": {
7
"value": {
8
"data": "514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a95f",
9
"owner_address": "417829b0adcb34405331a9910c646b5b71aeddc564",
10
"contract_address": "4155ac3875ceaf0dfe45fe3ee7312b0994a8894097"
11
},
12
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
13
},
14
"type": "TriggerSmartContract"
15
}],
16
"ref_block_bytes": "8be6",
17
"ref_block_hash": "96ad71060d05c018",
18
"expiration": 1559186685000,
19
"fee_limit": 1000000000,
20
"timestamp": 1559186626338
21
},
22
"raw_data_hex": "0a028be6220896ad71060d05c01840c8f892b6b02d5a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a15417829b0adcb34405331a9910c646b5b71aeddc56412154155ac3875ceaf0dfe45fe3ee7312b0994a88940972224514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a95f70a2ae8fb6b02d90018094ebdc03"
23
},
24
"privateKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
25
}
Copied!
Response:
1
{
2
"txID": "83ddfa7aae3945f3aac3ef19e864e9322ae568991d377f9c4957b495d074002f",
3
"raw_data": {
4
"contract": [{
5
"parameter": {
6
"value": {
7
"data": "514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a96c",
8
"owner_address": "417829b0adcb34405331a9910c646b5b71aeddc564",
9
"contract_address": "4155ac3875ceaf0dfe45fe3ee7312b0994a8894097"
10
},
11
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
12
},
13
"type": "TriggerSmartContract"
14
}],
15
"ref_block_bytes": "8cfc",
16
"ref_block_hash": "760cf585539cf343",
17
"expiration": 1559187525000,
18
"fee_limit": 1000000000,
19
"timestamp": 1559187465976
20
},
21
"raw_data_hex": "0a028cfc2208760cf585539cf34340889bc6b6b02d5a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a15417829b0adcb34405331a9910c646b5b71aeddc56412154155ac3875ceaf0dfe45fe3ee7312b0994a88940972224514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a96c70f8cdc2b6b02d90018094ebdc03",
22
"signature": ["26dcddcbd0f5d42eb19b6628fd151061c11c7059413423a17378e2938b5001080176bf5812c451995ea070cff49b3bd43881b43bc804f08bc9d03452dba81fa801"]
23
}
Copied!
步骤三:调用 https://api.trongrid.io/wallet/broadcasttransaction 对交易进行广播
Bodydata:
1
{
2
"txID": "83ddfa7aae3945f3aac3ef19e864e9322ae568991d377f9c4957b495d074002f",
3
"raw_data": {
4
"contract": [{
5
"parameter": {
6
"value": {
7
"data": "514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a96c",
8
"owner_address": "417829b0adcb34405331a9910c646b5b71aeddc564",
9
"contract_address": "4155ac3875ceaf0dfe45fe3ee7312b0994a8894097"
10
},
11
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
12
},
13
"type": "TriggerSmartContract"
14
}],
15
"ref_block_bytes": "8cfc",
16
"ref_block_hash": "760cf585539cf343",
17
"expiration": 1559187525000,
18
"fee_limit": 1000000000,
19
"timestamp": 1559187465976
20
},
21
"raw_data_hex": "0a028cfc2208760cf585539cf34340889bc6b6b02d5a8e01081f1289010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412540a15417829b0adcb34405331a9910c646b5b71aeddc56412154155ac3875ceaf0dfe45fe3ee7312b0994a88940972224514fcac7000000000000000000000000000000000000000000000000000000e8d4a6a96c70f8cdc2b6b02d90018094ebdc03",
22
"signature": ["26dcddcbd0f5d42eb19b6628fd151061c11c7059413423a17378e2938b5001080176bf5812c451995ea070cff49b3bd43881b43bc804f08bc9d03452dba81fa801"]
23
}
Copied!
Response:
1
{
2
"result": true
3
}
Copied!
Last modified 2yr ago
Copy link