创建订单

1. 接口调用:

https://{host}/api/v2/accountExchange

2. 请求参数实例

参数是否必须说明

depositCoinCode

eg:ETH

receiveCoinCode

eg:BTC

depositCoinAmt

eg:0.01

receiveCoinAmt

期待接收数量

destinationAddr

"eg: 18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY 如有memo,请讲memo放到地址后,用#分隔,例如:18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY#1927632"

refundAddr

"eg:18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY 如有memo,请讲memo放到地址后,用#分隔,例如:18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY#1927632"

equipmentNo

设备唯一编号

sourceType

ANDROID,IOS,H5

sourceFlag

用于标识是哪个平台创建的订单,请联系我们沟通

isNoGas

是否开启免 gas true/false

slippage

滑点 输入小数 0.01 = 10%

3.请求参数示例

{
    "depositCoinCode": "ETHF",

    "receiveCoinCode": "USDT(BSC)",
    
"depositCoinAmt": "42.207403",
    
"receiveCoinAmt": "46.367529",

    "destinationAddr": "0x19b9918f...f85ad08ba0",

    "refundAddr": "0x19b9918f...f85ad08ba0",
    
"equipmentNo":"zfgryh918f93a19fdg6918a68cf5",

    "sourceType": "H5",

    "sourceFlag":"widget",
    "isNoGas":true,
    "slippage": "0.02"


}

4.返回结果示例

{
    "data": {
        "chainFee": "0.001",//兑换完成后发币旷工费
        "changeType": "advanced",//去中心化兑换
        "choiseFeeType": "3",
        "createTime": "2022-03-10 18:44:21",
        "dealFinishTime": null,
        "depositCoinAmt": "2",
        "depositCoinCode": "ETH",
        "depositCoinFeeAmt": "0.004",//兑换手续费
        "depositCoinFeeRate": "0.002",//兑换手续费率
        "depositCoinState": "wait_send",
        "depositFeeRate": "0.002",
        "depositTxid": "",
        "destinationAddr": "0xAE93FA34f728855cE663cf9FcF8e32148F079071",//用户接收币种地址
        "detailState": "wait_deposit_send",//订单状态(详见高级兑换接口)
        "developerId": "",
        "instantRate": "6.856554564172",//汇率
        "isDiscount": "N",
        "kycUrl": "",//超过当日限额的kyc路径(详见高级兑换接口)
        "orderId": "f94e631b-d99b-4dd5-98f7-09bf99d16d94",//订单号
        "orderState": "wait_deposits",
        "platformAddr": "0x3181af4f7cc7251a6a4eda75526c8abe10106db8",//存币地址(用户创建订单后需向此地址转币,转币币种depositCoinCode,转币数量depositCoinAmt)
        "receiveCoinAmt": "13.713109",
        "receiveCoinCode": "BNB(BSC)",
        "refundAddr": "0xAE93FA34f728855cE663cf9FcF8e32148F079071",//退币地址(兑换失败退回存币币种到此地址)
        "refundCoinAmt": "",//兑换失败时的退币数量
        "refundCoinMinerFee": "",
        "refundDepositTxid": "",//兑换失败时的退币哈希
        "transactionId": "",//发币哈希
        "xrpInfo": "",
        //开启免 gas 后返回的代签名交易数据
        "noGasTxInfo": "{\"gasLimit\":37920,\"data\":\"0xxxxx\",\"chainId\":56,\"to\":\"0xxxxx\",\"nonce\":51,\"gasPrice\":\"3150000000\"}",
    
    },
    "resCode": "800",
    "resMsg": "成功",
    "resMsgEn": ""
}

5.返回参数说明

字段名称字段数据类型备注

订单号

orderId

String

eg:d47e8b9b-c17f-432b-9285-a46c0a3ceb9a

存币币种

depositCoinCode

String

eg:ETH

接收币币种

receiveCoinCode

String

eg:BTC

存币数量

depositCoinAmt

String

eg:1

接收币数量

receiveCoinAmt

String

eg:0.1

存币地址

platformAddr

String

eg:123123123-232-1231232

目标币接收地址

destinationAddr

String

"eg: 18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY, 如有memo,请讲memo放到地址后,用#分隔,例如:18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY#1927632"

退原币的地址

refundAddr

String

"eg: 18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY 如有memo,请讲memo放到地址后,用#分隔,例如:18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY#1927632"

存币的手续费率

depositCoinFeeRate

String

eg:手续费率

存币的手续费金额

depositCoinFeeAmt

String

eg:手续费收取的原币的数量

退币金额

refundCoinAmt

String

eg: 0.98

兑换成功交易id

transactionId

String

链上交易id,在兑换完成并已发币之后,该字段才会有值

兑换失败交易id

refundDepositTxid

String

链上交易id,在兑换失败退币情况下,已退币之后,该字段才会有值

订单状态

detailState

String

"(1)wait_deposit_send:等待存币发送 (2)timeout:超时; (3)wait_exchange_push:等待交换信息推送; (4)wait_exchange_return:等待交换信息返回; (5.1)wait_receive_send:等待接收币种发送, wait_receive_confirm:等待接收币种确认, receive_complete:接收币种确认完成. (5.2)wait_refund_send:等待退原币币种发送, wait_refund_confirm:等待退原币币种确认, refund_complete:退原币币种确认完成; (6)ERROR/error:正在处理的订单 (7)WAIT_KYC: 等待进行KYC或联系客服提供链接"

kyc的路径

kycUrl

String

当返回码是311时,需要跳转到该链接。 {host}/swft-v3/swft-v3-m/kyc/kyc.html?lang=cn&equipmentNo=pls_input_your_real_equipmentno_ok 请更新equipmentNo的值用户的设备号(公共请求参数),lang取值:cn、en

开启免gas兑换返回的待签名数据

noGasTxInfo

String

需要对这个交易对象进行签名

兑换BTC时返回的Memo

btcMemo

String

兑换BTC时返回的MEMO,详情请看(7.兑换BTC相关事项)

6.Postman示例

7. 关于BTC兑换的注意事项

7.1. 默认api并不支持BTC兑换,请联系我们开通渠道白名单api才支持BTC兑换。支持后,创建订单接口将会新返回字段:btcMemo,该字段值为链上转账BTC时需要携带该值。客户端对接BTC兑换需要集成到钱包中,memo以OP_RETURN的形式携带上链(链上形式请见7.3)。如果未携带memo,直接将BTC转入我们的地址,将无法完成兑换

7.2. memo举例说明:以0.1BTC->USDT(BSC)为例,返回的memo为: "btcMemo":"to:USDT(BSC):0x242Ea2A8C4a3377A738ed8a0d8cC0Fe8B4D6C36E" 拼接方式:to:币种:地址

7.3 BTC兑换后需手动上传存币hash,详情请见(上传hash接口)

上传交易hash批量上传交易hash

7.4. 链上hash示例: https://mempool.space/tx/e8a7259a335e8488005b72dab98dd3087d52e0a94842d2d1a81262ebf8c3ef51

Last updated