encodeTransaction
Converts transaction intent in Adamik JSON format into an encoded transaction for a specific blockchain, ready for signing. Supports staking, transfers, and other operations with required parameters like chainId, mode, senderAddress, and amount.
Instructions
Turns a transaction intent in Adamik JSON format into an encoded transaction for the given chain (ready to sign). For staking transaction on babylon chain, stakeId is mandatory and amount is optional. Otherwise, amount is mandatory and stakeId is to be omitted.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
body | Yes | ||
chainId | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"body": {
"additionalProperties": false,
"properties": {
"transaction": {
"additionalProperties": false,
"properties": {
"data": {
"allOf": [
{
"properties": {
"memo": {
"type": "string"
}
},
"type": "object"
},
{
"anyOf": [
{
"additionalProperties": false,
"properties": {
"contractType": {
"const": "argentx",
"default": "argentx",
"type": "string"
},
"mode": {
"const": "deployAccount",
"type": "string"
},
"senderPubKey": {
"type": "string"
}
},
"required": [
"mode",
"senderPubKey"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"amount": {
"type": "string"
},
"mode": {
"const": "transfer",
"type": "string"
},
"recipientAddress": {
"type": "string"
},
"senderAddress": {
"type": "string"
},
"senderPubKey": {
"type": "string"
},
"useMaxAmount": {
"default": false,
"type": "boolean"
}
},
"required": [
"mode",
"senderAddress",
"recipientAddress"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"amount": {
"type": "string"
},
"mode": {
"const": "transferToken",
"type": "string"
},
"recipientAddress": {
"type": "string"
},
"senderAddress": {
"type": "string"
},
"senderPubKey": {
"type": "string"
},
"tokenId": {
"type": "string"
},
"useMaxAmount": {
"default": false,
"type": "boolean"
}
},
"required": [
"mode",
"tokenId",
"senderAddress",
"recipientAddress"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"amount": {
"type": "string"
},
"mode": {
"const": "stake",
"type": "string"
},
"senderAddress": {
"type": "string"
},
"senderPubKey": {
"type": "string"
},
"sourceValidatorAddress": {
"type": "string"
},
"targetValidatorAddress": {
"type": "string"
},
"useMaxAmount": {
"default": false,
"type": "boolean"
}
},
"required": [
"mode",
"senderAddress",
"targetValidatorAddress"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"amount": {
"type": "string"
},
"mode": {
"const": "unstake",
"type": "string"
},
"senderAddress": {
"type": "string"
},
"senderPubKey": {
"type": "string"
},
"stakeId": {
"type": "string"
},
"useMaxAmount": {
"default": false,
"type": "boolean"
},
"validatorAddress": {
"type": "string"
}
},
"required": [
"mode",
"senderAddress",
"validatorAddress"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"compound": {
"default": false,
"type": "boolean"
},
"mode": {
"const": "claimRewards",
"type": "string"
},
"senderAddress": {
"type": "string"
},
"senderPubKey": {
"type": "string"
},
"stakeId": {
"type": "string"
},
"validatorAddress": {
"type": "string"
}
},
"required": [
"mode",
"senderAddress",
"validatorAddress"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"amount": {
"type": "string"
},
"mode": {
"const": "withdraw",
"type": "string"
},
"recipientAddress": {
"type": "string"
},
"senderAddress": {
"type": "string"
},
"senderPubKey": {
"type": "string"
},
"stakeId": {
"type": "string"
},
"validatorAddress": {
"type": "string"
}
},
"required": [
"mode",
"senderAddress",
"senderPubKey",
"recipientAddress"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"amount": {
"type": "string"
},
"mode": {
"const": "registerStake",
"type": "string"
},
"proofOfPossession": {
"type": "string"
},
"senderAddress": {
"type": "string"
},
"senderForeignPubKey": {
"type": "string"
},
"senderPubKey": {
"type": "string"
},
"signedSlashingTransaction": {
"type": "string"
},
"signedStakingTransaction": {
"type": "string"
},
"signedUnbondingSlashingTransaction": {
"type": "string"
},
"unsignedUnbondingTransaction": {
"type": "string"
},
"validatorPubKey": {
"type": "string"
}
},
"required": [
"mode",
"senderAddress",
"senderPubKey",
"senderForeignPubKey",
"proofOfPossession",
"amount",
"validatorPubKey",
"unsignedUnbondingTransaction",
"signedStakingTransaction",
"signedSlashingTransaction",
"signedUnbondingSlashingTransaction"
],
"type": "object"
}
]
}
]
}
},
"required": [
"data"
],
"type": "object"
}
},
"required": [
"transaction"
],
"type": "object"
},
"chainId": {
"type": "string"
}
},
"required": [
"chainId",
"body"
],
"type": "object"
}