Skip to main content

CreateTransactionGroup

Create a generic transaction group.

Request Parameters

NameTypeDescription
feePayerstringThe address of the account that is paying the fee.
feeAssetstringThe asset in which the fee is being paid.
txnsArray<TxnObject>Array containing the description of each transaction to be sent.

TxnObject

Each txnObject must have one of the following forms.

NameTypeDescription
type"assetTransfer"Field indicating that this txnObject describes an asset transfer.
fromstringThe address of the account that is sending the funds.
tostringThe address of the account that is receiving the funds.
assetstring|numberThe ID of the asset that is being sent. Can be either a string (i.e. USDD, EURD) or a number (i.e. 51987792, 51987793).
amountnumberThe amount that is being sent.
closeTostringOPTIONAL. If set, after sending the funds to the to account, sends the rest of the remaining funds to the closeTo account.
NameTypeDescription
type"algoTransfer"Field indicating that this txnObject describes an ALGO transfer.
fromstringThe address of the account that is sending the funds.
tostringThe address of the account that is receiving the funds.
amountnumberThe amount that is being sent.
closeTostringOPTIONAL. If set, after sending the funds to the to account, sends the rest of the remaining funds to the closeTo account.
NameTypeDescription
type"applicationCall"Field indicating that this txnObject describes an application call.
fromstringThe address of the account that is calling the application.
appstringThe ID of the application that is being called.
onComplete"NoOp"|"OptIn"|
"CloseOut"|"Update"|
"Delete"
OPTIONAL. Describes the action that must be done after the call execution. By default is set to "NoOp".
argsArray<string|number>OPTIONAL. The arguments that must be passed to the application. By default is set to the empty list.
accountsArray<string>OPTIONAL. A list of accounts that this application call will have access to.
assetsArray<number>OPTIONAL. A list of assets that this application call will have access to.
applicationsArray<number>OPTIONAL. A list of applications that this application call will have access to.
approvalProgramstringOPTIONAL. Must be set if the onComplete field is set to update. Must be equal to the new approval program, encoded in base64.
clearProgramstringOPTIONAL. Must be set if the onComplete field is set to update. Must be equal to the new clear program, encoded in base64.
maxSubTxnsnumberOPTIONAL. If the contract that is being called needs to call other contracts, this value must be set to the maximum number of sub calls that the contract can make.
NameTypeDescription
type"applicationCreate"Field indicating that this txnObject describes the creation of a new application.
fromstringThe address of the account that is creating the application.
approvalProgramstringThe approval program of the contract, encoded in base64.
clearProgramstringThe clear program of the contract, encoded in base64.
globalIntsnumberThe number of uint64s that the global storage is composed of.
globalByteSlicesnumberThe number of byte strings that the global storage is composed of.
localIntsnumberThe number of uint64s that each local storage is composed of.
localByteSlicesnumberThe number of byte strings that each local storage is composed of.
extraPagesnumberThe number of extra 2kb pages that the application requires.
onComplete"NoOp"|"OptIn"|
"CloseOut"|"Update"|
"Delete"
OPTIONAL. Describes the action that must be done after the call execution. By default is set to "NoOp".
argsArray<string|number>OPTIONAL. The arguments that must be passed to the application. By default is set to the empty list.
accountsArray<string>OPTIONAL. A list of accounts that this application call will have access to.
assetsArray<number>OPTIONAL. A list of assets that this application call will have access to.
applicationsArray<number>OPTIONAL. A list of applications that this application call will have access to.
maxSubTxnsnumberOPTIONAL. If the contract that is being called needs to call other contracts, this value must be set to the maximum number of sub calls that the contract can make.
NameTypeDescription
type"raw"Field indicating that this is a raw txnObject.
txnstringThe Algorand txn object encoded in base64.

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 CreateTransactionGroup request.
errorsArray of strings containing additional informations.

Example Usage

const response = await fetch('https://api.preprod.decash.com/v1/CreateTransactionGroup', {
method: 'POST',
body: JSON.stringify({
'feePayer': 'LX2XVJP7F5TQVOJ6DL4NPR5RH77XEG5US76WL7LIJL7OW6YPXDNPGIFWPM',
'feeAsset': 'USDD',
'txns': [
{
'type': 'assetTransfer',
'from': 'LX2XVJP7F5TQVOJ6DL4NPR5RH77XEG5US76WL7LIJL7OW6YPXDNPGIFWPM',
'to': 'YLCY7SE2XBY52EMOIBZAMXTSXPFVVECIQOHVBIWIR2Z5NT2QLLN2ADZZSE',
'amount': 12.99,
'asset': 'USDD',
}, {
'type': 'applicationCall',
'from': 'LX2XVJP7F5TQVOJ6DL4NPR5RH77XEG5US76WL7LIJL7OW6YPXDNPGIFWPM',
'app': 1337,
'args': ['stake'],
}
]
})
});
const data = await response.json();

Example Success Response

{
"txns": [
{
"txn": "iqRhcGFhlMQEdmdlbsQBWMQBWMQBWKRhcGlkzgQ7lWCjZmVlzQ+gomZ2zgFK5j6jZ2VurHRlc3RuZXQtdjEuMKJnaMQgSGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiKjZ3JwxCB+X/1xrzIH1pNbuFQEL619bPx/dbYaqFrg13nlZVV7Y6Jsds4BSuomo3NuZMQgnu6hJOJLh9rTBj7efGmBjFWHYA8DKF4VJ/IzOYImWD2kdHlwZaRhcHBs",
"signers": []
}, {
"txn": "iqRhYW10FKRhcmN2xCBr5CIUPJMmRSusjz6sT4DqcqoKtw1E03+tlgl8zDXHj6Jmds4BSuY+o2dlbqx0ZXN0bmV0LXYxLjCiZ2jEIEhjtRiks8hOyBDyLU8QgcsPcfBZp6wg3sYvf3DlCToio2dycMQgfl/9ca8yB9aTW7hUBC+tfWz8f3W2Gqha4Nd55WVVe2OibHbOAUrqJqNzbmTEIF31eqX/L2cKuT4a+NfHsT//chu0l/1l/WhK/ut7D7japHR5cGWlYXhmZXKkeGFpZM4DGUVQ",
"signers": ["LX2XVJP7F5TQVOJ6DL4NPR5RH77XEG5US76WL7LIJL7OW6YPXDNPGIFWPM"]
}, {
"txn": "iqRhYW10zQUTpGFyY3bEIMLFj8iauHHdEY5AcgZecrvLWpBIg49QosiOs9bPUFrbomZ2zgFK5j6jZ2VurHRlc3RuZXQtdjEuMKJnaMQgSGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiKjZ3JwxCB+X/1xrzIH1pNbuFQEL619bPx/dbYaqFrg13nlZVV7Y6Jsds4BSuomo3NuZMQgXfV6pf8vZwq5Phr418exP/9yG7SX/WX9aEr+63sPuNqkdHlwZaVheGZlcqR4YWlkzgMZRVA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