交易广播到链上, 只支持用户钱包使用。
当前接口,除了广播交易,还包含交易余额检测、交易记录展示、交易加速等功能。
除签名交易字符串外,其余参数会在查询交易记录时进行返回,若需要加速,可根据nonce、gasPrice等参数再发起新的交易。
若广播BTC等UTXO账户模型的交易时,不需要展示部分参数,传空即可。
GET https://www.okx.com/api/waas/wallet/pre-transaction/send-transaction
Parameter | Type | Required | Description |
---|---|---|---|
signedTx | String | Yes | 完成签名的交易字符串 |
chainIndex | String | Yes | 链唯一标识, e.g. ETH=3 详情见 链的唯一标识整理 |
accountId | String | Yes | 钱包账户Id |
fromAddr | String | Yes | From地址 |
toAddr | String | Yes | To地址 |
txHash | String | Yes | 交易哈希 |
txAmount | String | Yes | 转账主链币金额,余额不足判断 |
serviceCharge | String | Yes | 手续费(主网币最小单位,例如 ETH wei) |
tokenAddress | String | Yes | 代币地址 |
txType | String | Yes | 交易类型 (TRANSFER ,CONTRACT_CALL ) |
tag | String | No | 客户自定义标签 |
extJson | Object | Yes | 扩展参数 |
>gasLimit | String | No | gasLimit |
>nonce | String | No | nonce |
>gasPrice | String | No | gasPrice |
Parameter | Type | Description |
---|---|---|
orderId | String | 交易唯一标识 |
以 ETH 为例
curl --location --request POST 'https://www.okx.com/api/v5/waas/wallet/pre-transaction/send-transaction' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \
--data-raw '{
"signedTx":"0x08b47112567534ad041bbc6fa102394773c6d8f6d634320773af4da55efa",
"accountId":"44486e05-3235-2f8e-5fe2-a8ab46217863",
"fromAddr": "0x383c8208b4711256753b70729ba0cf0cda55efad",
"toAddr": "0x4ad041bbc6fa102394773c6d8f6d634320773af4",
"txHash": "0x238193be9e80e68eace3588b45d8cf4a7eae0fa3",
"txAmount": "31600000000000000",
"chainIndex": "3",
"txType": "transfer",
"serviceCharge":"186865801413",
"tokenAddress":""
"extJson": {
"gasPrice":"",
"gasLimit":"",
"nonce": "nonce",
"callData": ""
}
}'
以 BTC 为例
curl --location --request POST 'https://www.okx.com/api/v5/waas/transaction/send-transaction' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \
--data-raw '{
"signedTx":"0x08b47112567534ad041bbc6fa102394773c6d8f6d634320773af4da55efa",
"accountId":"44486e05-3235-2f8e-5fe2-a8ab46217863",
"fromAddr": "",
"toAddr": "",
"txHash": "264e479f4955a1beeaac9bf9fc9b0200c42a7965bff7708109b696b35a5a53fe",
"txAmount": "31600000000000000",
"chainIndex": "0",
"txType": "BRC20_SEND",
"tokenAddress":""
"extJson": {
"gasPrice":"",
"gasLimit":"",
"nonce": "",
"callData": ""
}
}'
ETH 响应示例
{
"code": "0",
"data": [
{
"orderId": "0x383c8208b4711256753b70729ba0cf0cda55efad"
}
],
"msg": ""
}
BTC 响应示例
{
"code": "0",
"data": [
{
"orderId": "0x383c8208b4711256753b70729ba0cf0cda55efad"
}
],
"msg": ""
}