钱包 API

交易广播#

将交易广播到链上。

请求路径#

POST https://www.okx.com/api/v5/wallet/pre-transaction/broadcast-transaction

请求参数#

ParameterTypeRequiredDescription
signedTxStringYes完成签名的交易字符串
chainIndexStringYes链唯一标识, e.g. ETH=3 详情见 链的唯一标识整理
accountIdString可选钱包账户Id,地址或账户 ID 需要必填一项。后续可用于查看账户下发的交易
addressString可选地址,地址或账户 ID 需要必填一项。后续可用于查看账户下发的交易

响应参数#

ParameterTypeDescription
orderIdString交易唯一标识

请求示例#

shell
curl --location --request POST 'https://www.okx.com/api/v5/wallet/pre-transaction/broadcast-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 '{
  "accountId": "5f45a951-4a8b-4cd9-b20a-3b337b71efcc",
  "chainIndex": "1",
  "address": "0x238193be9e80e68eace3588b45d8cf4a7eae0fa3",
  "signedTx": "0x02f8720182029f8411e1a3008504bbe2e94682520894d73c5e36d47eed32f0327f9d3f04b49384e90fab85e8d4a5100080c080a0ba380a9be31efabc4c8cfccbb555f8af3c21073d6eca01f180ebebb8942c6f30a0779e6e16a504c413cb9902ceb33ab7e89a533bc13b74477dfa6b6c76dc41fac2"
}'

响应示例#

200
{
    "code": "0",
    "data": [
        {
            "orderId": "0e1d79837afce1e149b6ab54b6e2edce8130c3f8"          
        }
    ],
    "msg": ""
}