Secure infrastructure for enterprise digital asset operations.

UDun Wallet API development interface document

1、Generate addresses

1.1 Scenario description

Request the address of the designated tokens. Tokens must be saved in the wallet and supported by the wallet in order to get the address successfully, For more information, please refer to

1.2 Interface details

1.2.1 Interface addresses
Interface details
URL【/mch/address/create】
Application methodPOST
1.2.2 Parameters
1.2.2.1 Parameter description
ParametersTypeRequired or notDescriptionNote
timestampStringisTimestampSee Verification description
nonceStringisRandom numberSee Verification description
signStringisSignSee Verification description
bodyStringisMessagejson string, in the following format
[
    {
     "merchantId":"300015",
     "mainCoinType":520,
     "callUrl":"http://localhost:8080/callBack"
    }
]
1.2.2.2 Body parameter field
Body parameter nameTypeRequired or notDescription
merchantIdStringisMerchant ID
mainCoinTypeIntegerisMain coin number. Use the interface to get merchant coin information.
callUrlStringisThe deposit information about the callback address created through the interface will be notified to you through the callback address you specified. See the trade callback interface for specific examples.
walletIdStringNoWallet number. By default, the address is generated according to the main wallet.
aliasStringNoAddress alias
1.2.2.3 Examples
{
    "timestamp": 1535005047,
    "nonce": 10000,
    "sign": "a230def43c1a12b14393880a28d4e005",
    "body": "[{\"merchantId\":\"300015\",\"mainCoinType\":520,\"callUrl\":\"http://localhost:8080/callBack\"}]"}
1.2.3 Return to status code
codeExplain
-1Failed to generate addresses
200Generate addresses successfully
4001No merchant
4005Illegal parameters
4045Wrong coin information
4162Abnormal signature
4163Wrong signature
4166The merchant has no configuration package
4168The merchant address reaches the upper limit
4169The merchant has disabled
4175Wrong wallet number
4017The merchant does not create a wallet
4176The coin is not added to the wallet
4188Not supported now
4226The merchant's general account is banned
4261The merchant's administrator account is banned
4262The account does not exist

1.3 Call examples

1.3.1 Success
{
    "data":{
        "coinType":520,
        "address":"0xbe4e3699cb870bc95365fe04a187dd279a651a58"
    },
    "message":"SUCCESS",
    "code":200
}
1.3.2 Failure
{
    "code": "4101",
    "message": "SIGN_MSG_ERROR"}

2、Send withdrawal application

2.1 Scenario description

Withdrawal application

2.2 Interface details

2.2.1 Interface addresses
Interface details
URL【/mch/withdraw】
Application methodPOST
2.2.2 Parameters
2.2.2.1 Parameter description
ParametersTypeRequired or notDescriptionNote
timestampStringisTimestampSee Verification description
nonceStringisRandom numberSee Verification description
signStringisSignSee Verification description
bodyStringisMessagejson string, in the following format
[
    {
        "address":"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s",
        "amount":"0.11",
        "merchantId":"100109",
        "mainCoinType":"144",
        "coinType":"144",
        "callUrl":"http://localhost:8080/mch/callBack",
        "businessId":"15",
        "memo":"10112"
    }
]
2.2.2.2 Body parameter field
Body parameter nameRequired or notTypeDescription
addressisStringWithdrawal address
amountisStringWithdrawal amount
merchantIdisStringMerchant ID
mainCoinTypeisStringMain coin number. Use the interface to get merchant coin information.
coinTypeisStringChild coin number. Use the interface to get merchant coin information.
callUrlisStringCallback address. You are informed of the status of the coin withdrawal transaction through the callUrl. For specific examples, See the trade callback interface for specific examples.
businessIdisStringBusiness id must be ensured that this field is unique in the system. If it is duplicated, the withdrawal will not be received by the wallet.
memoNoStringPlease note that this field is optional for withdrawal applications for XRP and EOS and other types of coins are not filled in.
2.2.2.3 Examples
{
  "timestamp": 1535005047,
  "nonce": 100000,
  "sign": "6df1512ee650431632ce1541a6b064e1",
  "body": "[{\"address\":\"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s\",\"amount\":\"0.11\",\"merchantId\":\"100109\",\"mainCoinType\":\"144\",\"coinType\":\"144\",\"callUrl\":\"http://localhost:8080/callBack\",\"businessId\":\"15\",\"memo\":\"10112\"}]"}
2.2.3 Return to status code
codeExplain
200Withdrawal success
523The parameter is null
581Invalid withdrawal amount
4005Illegal parameters
4014Coin type is null
4034The coin information is not found
4162Abnormal signature
4163Wrong signature
4169The merchant has been banned
4183Abnormal arrival address
4193EOS amount exceeds 4 decimal places in length
4214No available coins now
4226The merchant's general account is banned
4261The merchant's administrator account is banned
4284No merchant
4288Business ID is duplicate. Please do not apply repeatedly
4598All the merchant ID in the list passed into the body must be consistent
4001No merchant
2.3.1 Success
{
    "message":"SUCCESS",
    "code":200
}
2.3.2 Failure
{
    "code": "4101",
    "message": "SIGN_MSG_ERROR"
}

3、Payment on behalf

3.1 Scenario description

Withdrawal. It works the same as the withdrawal interface. You can directly use the withdrawal interface, and this interface can be ignored.。

3.2 Interface details

3.2.1 Interface addresses
Interface details
URL【/mch/withdraw/proxypay】
Application methodPOST
3.2.2 Parameters
3.2.2.1 Parameter description
ParametersTypeRequired or notDescriptionNote
timestampStringisTimestampSee Verification description
nonceStringisRandom numberSee Verification description
signStringisSignSee Verification description
bodyStringisMessagejson string, in the following format
[
  {
      "address":"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s",
      "amount":"0.1",
      "merchantId":"100146",
      "mainCoinType":"144",
      "coinType":"144",
      "callUrl":"http://localhost:8080/callBack",
      "businessId":"571001",
      "memo":"10112"
  }
]
3.2.2.2 Body parameter description
Body parameter nameTypeRequired or notDescription
merchantIdStringisMerchant ID
addressStringisWithdrawal address
mainCoinTypeStringisMain coin number. Use the interface to get merchant coin information.
coinTypeStringisChild coin number. Use the interface to get merchant coin information.
amountStringisTrade amount
callUrlStringisCallback address. The results of withdrawal (review and transaction) will be notified through this callback address. For specific examples, See the trade callback interface for specific examples.
businessIdStringisBusiness id must be ensured that this field is unique in the system. If it is duplicated, the withdrawal will not be received by the wallet.
memoStringNoPlease note that this field is optional for withdrawal applications for XRP and EOS and other types of coins are not filled in.
3.2.2.2 Examples
{
    "timestamp": 1535005047,
    "nonce": 100000,
    "sign": "e1bee3a417b9c606ba6cedda26db761a",
    "body": "[{\"address\":\"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s\",\"amount\":\"0.1\",\"merchantId\":\"100146\",\"mainCoinType\":\"144\",\"coinType\":\"144\",\"callUrl\":\"http://localhost:8080/callBack\",\"businessId\":\"571001\",\"memo\":\"10112\"}]"
}
3.2.3 Return to status code
codeExplain
200Success
4005Illegal parameters
4001No merchant
4166The merchant has no configuration package
4169The merchant has been banned
4612Abnormal signature
4163Wrong signature
569Invalid address
571Audit records already exist and will not be processed
581Illegal withdrawal amount
554The merchant does not support this coin
4183Abnormal arrival address
4193EOS amount exceeds 4 decimal places in length
4214No available coins now
4261The merchant's administrator account is banned
4226The merchant's general account is banned
4284No merchant

3.3 Call examples

3.3.1 Success
{
    "message":"SUCCESS",
    "code":200
}
3.3.2 Failure
{
    "code": "4101",
    "message": "SIGN_MSG_ERROR"
}

4、Trade callback interface

4.1 Scenario description

The gateway receives the transaction processing result and calls the callback interface provided by the merchant to notify the merchant of the specific change information. The interface gateway sends you the content of the callback address specified by you to process your business information. There are callbacks for deposit and withdrawal, of which up to two callbacks will be made for withdrawals (audit callback and transaction result callback)

4.2 Interface details

4.2.1 Interface addresses
Interface details
URLProvided by the address generation interface or the withdrawal interface callUrl
Application methodPOST / Form
4.2.2 Parameters
4.2.2.1 Parameter description
ParametersTypeRequired or notDescriptionNote
timestampStringisTimestampSee Verification description
nonceStringisRandom numberSee Verification description
signStringisSignSee Verification description
bodyStringisMessagejson string, in the following format
{
    "address":"DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW",
    "amount":"12345678",
    "blockHigh":"102419",
    "coinType":"206",
    "decimals":"8",
    "fee":"452000",
    "mainCoinType":"206",
    "status":3,
    "tradeId":"20181024175416907",
    "tradeType":1,
    "txId":"31689c332536b56a2246347e206fbed2d04d461a3d668c4c1de32a75a8d436f0",
    "businessId":"",// The coin withdrawal callback is the business id passed from the coin withdrawal interface, and the coin has no value.
    "memo":""
}
4.2.2.2 Body parameter description
Body parameter nameTypeDescription
addressString地址
amountStringTrade amount. The actual amount is obtained according to the precision of the coins. The actual amount=amount/pow(10,decimals), that is, the actual amount is equal to amount divided by 10 decimals times
feeStringMiner's fee. The actual amount is obtained according to the precision of the coins. The actual amount is obtained as above.
decimalsStringCoin precision
coinTypeStringChild coin number. Use the interface to get merchant coin information.
mainCoinTypeStringMain coin number. Use the interface to get merchant coin information.
businessIdStringBusiness number is passed in for the coin withdrawal request at the time of the coin withdrawal callback. No value for the coin withdrawal callback.
blockHighStringBlock height
statusIntegerStatus, see Callback interface status description
tradeIdStringTransaction serial number
tradeTypeIntegerTransaction type, see Callback interface transaction type description
txidStringBlockchain transaction hash
memoStringPlease note that XRP and EOS using the interface to obtain merchant coin information may have values for coin deposit and withdrawal.
4.2.2.2 Examples

    "timestamp": 1535005047,
    "nonce": 100000,
    "sign": "e1bee3a417b9c606ba6cedda26db761a",
    "body": "{\"address\":\"DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW\",\"amount\":\"12345678\",\"blockHigh\":\"102419\",\"coinType\":\"206\",\"decimals\":\"8\",\"fee\":\"452000\",\"mainCoinType\":\"206\",\"status\":3,\"tradeId\":\"20181024175416907\",\"tradeType\":1,\"txId\":\"31689c332536b56a2246347e206fbed2d04d461a3d668c4c1de32a75a8d436f0\"}"

5、Verify address legality

5.1 Scenario description

Check the legality of the address. You can check the legality of the address first when adding addresses, withdrawing coins and other scenarios, see Verification rule

5.2 Interface details

5.2.1 Interface addresses
Interface details
URL【/mch/check/address】
Application methodPost
5.2.2 Parameters
5.2.2.1 Parameter description
ParametersTypeRequired or notDescriptionNote
timestampStringisTimestamp
nonceStringisRandom number
signStringisSign
bodyStringisMessagejson string, in the following format
[
{
    "merchantId":200000,
    "mainCoinType":"206",
    "address":"DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW"
}
]
5.2.2.2 Body parameter description
Body parameter nameTypeRequired or notDescription
merchantIdLongisMerchant ID
mainCoinTypeStringisMain coin number. Use the interface to get merchant coin information.
addressStringisAddresses to be verified
5.2.2.3 Examples
{
    "timestamp": 1535005047,
    "nonce": 100000,
    "sign": "e1bee3a417b9c606ba6cedda26db761a",
    "body": "[{\"merchantId\":200000,\"mainCoinType\":\"206\",\"address\":\"DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW\"}]"
}
5.2.3 Return to status code
codeExplain
200Success
4005Illegal parameters
4162Abnormal signature
4163Wrong signature
4165Address is not legal

5.3 Call examples

5.3.1 Success
{
    "code":200,
    "message":"SUCCESS"
}
5.3.2 Failure
{
    "code":4005,
    "message":"PARAM_ERROR"
}

6、Obtain the information of tokens supported by merchants

6.1 Scenario description

Obtain the tokens supported by merchants and the balance

6.2 Interface details

6.2.1 Interface addresses
Interface details
URL【/mch/support-coins】
Application methodPOST
6.2.2 Parameters
6.2.2.1 Parameter description
ParametersTypeRequired or notDescription
timestampStringisTimestamp
nonceStringisRandom number
signStringisSign
bodyStringisMessage
6.2.2.2 Body parameter description
Body parameter nameTypeRequired or notDescription
merchantIdLongisMerchant ID
showBalanceBooleanisWhether to check the balance. False is not to get it and true is to get it.
6.2.2.3 Examples
{
    "timestamp": 1535005047,
    "nonce": 100000,
    "sign": "e1bee3a417b9c606ba6cedda26db761a",
    "body": "{\"merchantId\":\"200032\",\"showBalance\":true}"
}
6.2.3 Return to status code
Status codeExplain
-1Query failed
200Query successfully
4005Illegal parameters

6.3 Call examples

6.3.1 Success
{
    "code": 200,
    "message": "SUCCESS",
    "data":[
        {
            "name": "BTC", Coin alias
            "coinName":"Bitcoin", Full name of the coin
            "symbol":"BTC", Coin unit
            "mainCoinType":"0", Main coin type
            "coinType":"0", Coin type
            "decimals":"8", Coin precision
            "tokenStatus":"0", 0: Main coin 1:Token
            "mainSymbol":"BTC", Main coin unit
            "balance":"0", Balance 
            "logo":"" Coin log address
        },
        {
            "name": "ETH", Coin alias
            "coinName":"Ethereum", Full name of the coin
            "symbol":"ETH", Coin unit
            "mainCoinType":"60", Main coin type
            "coinType":"60", Coin type
            "decimals":"18", Coin precision
            "tokenStatus":"0", 0: Main coin 1:Token
            "mainSymbol":"ETH", Main coin unit
            "balance":"0", Balance 
            "logo":"" Coin log address
        }
    ]
}
6.3.2 Failure
{
    "code":4005,
    "message":"BGS_ILLEGAL_PARAMETER"
}