Skip to main content

CloseDelegatedWallet

warning

This API endpoint is being deprecated in favor of TransferTokens which have the new "max" parameter.

Close the balance of a DeCash asset of a Delegated Wallet, sending the remaining funds to another (regular or delegated) wallet.

Request Parameters

NameTypeDescription
assetIdstringThe ID of the DeCash asset that is being closed.
sender{address:string}Object containing the address of the Delegated Wallet that is being closed. Note that this account must have enough funds to cover the fee.
receiverstringThe address of the account that is receiving the remaining funds present in the sender wallet. Note that, if this account is not a Delegated Wallet, then it must be opted into the token that is being sent.

Responses

Regular response

NameTypeDescription
txnsArray<{txn:string, signers:string[]}>Array of objects each containing a transaction (in msgpack) and an array of signers (a list of addresses of the accounts that must sign the transaction). Transactions with an empty signers array shall not be signed.
info{fee:number}An object containing fee, the amount of DeCash that is being spent on fees in this transaction. (e.g. 1.05 USDD)

Validation errors

Returned when the parameters are invalid.

NameContent
Status code400
errorIdINVALID_PARAMS
messageValidation errors in CloseDelegatedWallet request.
errorsArray of strings containing additional informations.

Sender not opted in

Returned when the sender has not yet opted into the token that is being sent.

NameContent
Status code400
errorIdSENDER_NOT_OPTED_IN
messageSender must opt in to the asset before sending funds.

Sender not enough funds

Returned when the sender does not have enough funds to pay both the transfer of the funds and the fee.

NameContent
Status code400
errorIdSENDER_NOT_ENOUGH_FUNDS
messageSender does not have enough funds to send the requested amount.

Receiver not opted in

Returned when a user is sending funds to a non-Delegated Wallet account that has not yet opted into the token that is being sent.

NameContent
Status code400
errorIdRECEIVER_NOT_OPTED_IN
messageReceiver must opt in to the asset before receiving funds.

Example Usage

const response = await fetch('https://delegator-dev01b.arringo.co/api-test/CloseDelegatedWallet', {
method: 'POST',
body: JSON.stringify({
'assetId': 'USDD',
'sender': {
'address': 'NBGKLNZDHMHCL7UPDMQBZPUF3JGQI3355WD5JPDB3U2ODNLAW6SDPO67JE',
},
'receiver': 'CNIOPGMZ3OSZLPEO7POGMVUEQVDV2RT3G4MSKGHRBX2SOPOEIOGBIFIMVQ'
}),
});
const data = await response.json();

Example Success Response

{
"txns": [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