Each of the operations sent in the request of the /construction/preprocess
and /construction/payloads
endpoints will have a type which is a string value that could be any of the following:
- 'input'
- 'output'
- 'stakeKeyRegistration'
- 'stakeKeyDeregistration'
- 'stakeDelegation'
- 'withdrawal'
The order of these operations is important since they are going to be processed in the transaction body in the following order:
- inputs and outputs
- operations that require a certificate, i.e., stake key registration, stake key deregistration and stake delegation
- withdrawals
Some of these operations require an amount and a staking credential as metadata as described as follows:
{
"operation_identifier": {
"index": 0,
"network_index": 0
},
"type": "input",
"status": "success",
"account": {
"address": "addr1vxa5pudxg77g3sdaddecmw8tvc6hmynywn49lltt4fmvn7cpnkcpx"
},
"amount": {
"value": "-9000000",
"currency": {
"symbol": "ADA",
"decimals": 6
}
},
"coin_change": {
"coin_identifier": {
"identifier": "2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f:1"
},
"coin_action": "coin_spent"
}
}
{
"operation_identifier": {
"index": 1
},
"related_operations": [
{
"index": 0
}
],
"type": "output",
"status": "success",
"account": {
"address": "addr1vxa5pudxg77g3sdaddecmw8tvc6hmynywn49lltt4fmvn7cpnkcpx"
},
"amount": {
"value": "10000",
"currency": {
"symbol": "ADA",
"decimals": 6
}
}
}
A staking key should be sent as metadata, which should be of the same type of the public key. This is mandatory for this kind of operation.
No amount is needed for this operation since the deposit will be calculated with the fixed min key deposit value times the amount of stake key registrations received.
{
"operation_identifier": {
"index": 3
},
"type": "stakeKeyRegistration",
"status": "success",
"metadata": {
"staking_credential": {
"hex_bytes": "1B400D60AAF34EAF6DCBAB9BBA46001A23497886CF11066F7846933D30E5AD3F",
"curve_type": "edwards25519"
}
}
}
A staking key should be sent as metadata, which should be of the same type of the public key and also a pool key hash. Both of them are mandatory for this kind of operation.
{
"operation_identifier": {
"index": 3
},
"type": "stakeDelegation",
"status": "success",
"metadata": {
"staking_credential": {
"hex_bytes": "1B400D60AAF34EAF6DCBAB9BBA46001A23497886CF11066F7846933D30E5AD3F",
"curve_type": "edwards25519"
},
"pool_key_hash": "1b268f4cba3faa7e36d8a0cc4adca2096fb856119412ee7330f692b5"
}
}
A staking key should be sent as metadata, which should be of the same type of the public key. This is mandatory for this kind of operation.
No amount is needed for this operation since the refund will be calculated with the fixed min key deposit value times the amount of stake key deregistrations received.
{
"operation_identifier": {
"index": 3
},
"type": "stakeKeyDeregistration",
"status": "success",
"metadata": {
"staking_credential": {
"hex_bytes": "1B400D60AAF34EAF6DCBAB9BBA46001A23497886CF11066F7846933D30E5AD3F",
"curve_type": "edwards25519"
}
}
}
A staking key should be sent as metadata, which should be of the same type of the public key. This is mandatory for this kind of operation. The amount that is to be withdrawn is also mandatory.
{
"operation_identifier": {
"index": 4
},
"type": "withdrawal",
"status": "success",
"amount": {
"value": "10000",
"currency": {
"symbol": "ADA",
"decimals": 6
}
},
"metadata": {
"staking_credential": {
"hex_bytes": "1B400D60AAF34EAF6DCBAB9BBA46001A23497886CF11066F7846933D30E5AD3F",
"curve_type": "edwards25519"
}
}
}