OneToManyTransfer
warning
Consider using CreateTransactionGroup endpoint for combining transfers.
Send funds from a Delegated Wallet, to multiple other (regular or delegated) wallets, allowing to save a bit on the transfer fees.
Request Parameters
| Name | Type | Description |
|---|---|---|
assetId | string | The ID of the DeCash asset that is being sent. |
sender | string | The address of the account that is sending the funds. Note that this account must have enough funds to cover both all the amounts, and the fees. |
receivers | Array<{address:string, amount:number}> | Array of objects containing the address of the accounts that are receiving the funds, and the respective amounts that are being sent to them. Note that, if any of these accounts is not a Delegated Wallet, then it must be opted into the token that is being sent. This array can be 4 addresses at max. |
Responses
Regular response
| Name | Type | Description |
|---|---|---|
txns | Array<{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.
| Name | Content |
|---|---|
| Status code | 400 |
errorId | INVALID_PARAMS |
message | Validation errors in OneToManyTransfer request. |
errors | Array of strings containing additional informations. |
Sender not opted in
Returned when one the senders has not yet opted into the token that is being sent.
| Name | Content |
|---|---|
| Status code | 400 |
errorId | SENDER_NOT_OPTED_IN |
message | Sender must opt in to the asset before sending funds. |
Sender not enough funds
Returned when one the senders does not have enough funds to pay both the transfer of the funds and the fee.
| Name | Content |
|---|---|
| Status code | 400 |
errorId | SENDER_NOT_ENOUGH_FUNDS |
message | Sender 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.
| Name | Content |
|---|---|
| Status code | 400 |
errorId | RECEIVER_NOT_OPTED_IN |
message | Receiver must opt in to the asset before receiving funds. |
Example Usage
const response = await fetch('https://delegator-dev01b.arringo.co/api-test/OneToManyTransfer', {
method: 'POST',
body: JSON.stringify({
'assetId': 'USDD',
'sender': 'NBGKLNZDHMHCL7UPDMQBZPUF3JGQI3355WD5JPDB3U2ODNLAW6SDPO67JE',
'receivers': [{
'address': 'LX2XVJP7F5TQVOJ6DL4NPR5RH77XEG5US76WL7LIJL7OW6YPXDNPGIFWPM',
'amount': 5
}, {
'address': 'CNIOPGMZ3OSZLPEO7POGMVUEQVDV2RT3G4MSKGHRBX2SOPOEIOGBIFIMVQ',
'amount': 2.5
}],
})
});
const data = await response.json();
Example Success Response
{
"txns": [
{
"txn": "iqNhbXTOAAGGoKNmZWXNE4iiZnbOASGEMaNnZW6sdGVzdG5ldC12MS4womdoxCBIY7UYpLPITsgQ8i1PEIHLD3HwWaesIN7GL39w5Qk6IqNncnDEIOyNx/20OVnkJfQubF7NLmSoacz8Br4xOtIpEONvUKmmomx2zgEhiBmjcmN2xCDM12b3NSoTfJdJSzDDROUq3CiWPHHdXRqae4X/G6GZuqNzbmTEIGvkIhQ8kyZFK6yPPqxPgOpyqgq3DUTTf62WCXzMNcePpHR5cGWjcGF5",
"signers": []
},
{
"txn": "iqRhYW10AqRhcmN2xCBr5CIUPJMmRSusjz6sT4DqcqoKtw1E03+tlgl8zDXHj6Jmds4BIYQxo2dlbqx0ZXN0bmV0LXYxLjCiZ2jEIEhjtRiks8hOyBDyLU8QgcsPcfBZp6wg3sYvf3DlCToio2dycMQg7I3H/bQ5WeQl9C5sXs0uZKhpzPwGvjE60ikQ429QqaaibHbOASGIGaNzbmTEIGhMpbcjOw4l/o8bIBy+hdpNBG997YfUvGHdNOG1YLekpHR5cGWlYXhmZXKkeGFpZM4DGUVQ",
"signers": []
},
{
"txn": "iqRhYW10zQH0pGFyY3bEIF31eqX/L2cKuT4a+NfHsT//chu0l/1l/WhK/ut7D7jaomZ2zgEhhDGjZ2VurHRlc3RuZXQtdjEuMKJnaMQgSGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiKjZ3JwxCDsjcf9tDlZ5CX0LmxezS5kqGnM/Aa+MTrSKRDjb1CppqJsds4BIYgZo3NuZMQgaEyltyM7DiX+jxsgHL6F2k0Eb33th9S8Yd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