XDR (3.3.1)

This repo defines structures used to communicate with Core of TokenD based networks.

Transaction

Transactions are commands that modify the ledger state. If you think of the ledger as a database, then Operations are SQL commands and Trannsactions are SQL transactions.

Transactions allows you to combine several operations (even from different sources) into one atomic command (if one operation fails, whole transaction rollbacks). What is more, it's possible to specify different source account for different operation. This can be used to implement features like over-the-counter exchange (include into transaction two operations: one sending assets from A to B; one sending assets from B to A; such transaction requires signatures from both A and B).

Transaction Envelope

Account Role Requirements

Account Resource Type Action
source TRANSACTION SEND

Signer Role Requirements

Signers rules required on operation level.

TransactionEnvelope
Tx
object

Transaction is a container for a set of operations

  • is executed by an account
  • operations are executed in order as one ACID transaction (either all operations are applied or none are if any returns a failing code)
Signatures
Array of objects

list of signatures used to authorize transaction

Response Schema result
FeeCharged
long
Result
One of multiple values
Ext
TransactionResultExtArmEmptyVersion (object)

Accounts

Defines operations to manage Accounts

Create Account

Allows creating account with specific role and signers. Balances for assets with policy BASE_ASSET will be created for the account automatically.

Account Role Requirements

Account Resource Type Action
source ACCOUNT CREATE

Signer Role Requirements

Resource Type Rule Action
ACCOUNT CREATE
CreateAccountOp

CreateAccountOp is used to create new account

Destination
AccountId

ID of account to be created

Referrer
AccountId

ID of an another account that introduced this account into the system. If account with such ID does not exist or it's Admin Account. Referrer won't be set.

RoleId
uint64

ID of the role that will be attached to an account

SignersData
Array of objects

Array of data about 'destination' account signers to be created

Ext
CreateAccountOpExtArmEmptyVersion (object)

reserved for future use

Response Schema
One of
  • Success
  • InvalidSignerData
  • InvalidDestination
  • AlreadyExists
  • InvalidWeight
  • NoSuchRole
  • NoSignerData
code
string
Value: "SUCCESS"

Means that destination account has been successfully created with signers specified in signersData

success
object (CreateAccountSuccess)

Result of successful application of CreateAccount operation

Assets

Defines operations to manage Assets

Create Request For Asset Creation

Allows to create or update CREATE_ASSET reviewable request CREATE_ASSET request is used to create asset entry

Account Role Requirements

Account Resource Type Rule Action Condition
source ASSET CREATE allTasks == null
source ASSET CREATE_WITH_TASKS allTasks != null

Signer Role Requirements

Resource Type Rule Action Details
ASSET CREATE Resource includes code and type of asset
ManageAssetOp

ManageAssetOp is used to:

  • create or update CREATE_ASSET request;
  • create or update UPDATE_ASSET request;
  • cancel CREATE_ASSET or UPDATE_ASSET request
  • change asset pre issuer
  • update max issuance of an asset
RequestId
uint64

ID of a reviewable request If requestID == 0, operation creates a new reviewable request; otherwise, it updates the existing one

Request
One of multiple values

data is used to pass one of ManageAssetAction with required params

Ext
ManageAssetOpExtArmEmptyVersion (object)

reserved for future use

Response Schema
One of
  • Success
  • RequestNotFound
  • InvalidSignature
  • AssetAlreadyExists
  • InvalidMaxIssuanceAmount
  • InvalidCode
  • InvalidPreIssuer
  • InvalidPolicies
  • AssetNotFound
  • RequestAlreadyExists
  • StatsAssetAlreadyExists
  • InitialPreissuedExceedsMaxIssuance
  • InvalidCreatorDetails
  • InvalidTrailingDigitsCount
  • InvalidPreissuedAmountPrecision
  • InvalidMaxIssuanceAmountPrecision
  • AssetCreateTasksNotFound
  • AssetUpdateTasksNotFound
  • NotAllowedToSetTasksOnUpdate
code
string
Value: "SUCCESS"

Specified action in data of ManageSignerOp was successfully performed

success
object (ManageAssetSuccess)

Is used to pass useful params after the successful operation application

Asset Resources

Describes the asset pairs as a set of properties and policies for two particular assets (i.e. base and quote assets).

AssetEntry
Code
string

Code of the asset

Owner
AccountId

Owner(creator) of the asset

PreissuedAssetSigner
AccountId

Account responsible for preissuance of the asset

Details
string

Arbitrary stringified JSON object that can be used to attach data to asset

MaxIssuanceAmount
uint64

Maximal amount of tokens that can be issued

AvailableForIssueance
uint64

Amount of tokens available for issuance

Issued
uint64

Amount of tokens issued already

PendingIssuance
uint64

Amount of tokens to be issued which is locked. pendingIssuance+issued <= maxIssuanceAmount

Policies
uint32

Policies of the asset

Type
uint64

Used to restrict usage. Used in account rules

TrailingDigitsCount
uint32

Number of decimal places. Must be <= 6

Ext
EmptyExtArmEmptyVersion (object)

Reserved for future use

Code samples

Copy

enum AssetPolicy
{
  //: Defines whether or not asset can be transfered using payments
	TRANSFERABLE = 1,
	//: Defines whether or not asset is considered base
	BASE_ASSET = 2,
	//: [[Deprecated]]
	STATS_QUOTE_ASSET = 4,
	//: Defines whether or not asset can be withdrawed from the system
	WITHDRAWABLE = 8,
	//: Defines whether or not manual review for issuance of asset is required
	ISSUANCE_MANUAL_REVIEW_REQUIRED = 16,
	//: Defines whether or not asset can be base in atomic swap
	CAN_BE_BASE_IN_ATOMIC_SWAP = 32,
	//: Defines whether or not asset can be quote in atomic swap
	CAN_BE_QUOTE_IN_ATOMIC_SWAP = 64
};


struct AssetEntry
{
  //: Code of the asset
  AssetCode code;
  //: Owner(creator) of the asset
	AccountID owner;
	//: Account responsible for preissuance of the asset
	AccountID preissuedAssetSigner;
    //: Arbitrary stringified JSON object that can be used to attach data to asset
	longstring details;
	//: Maximal amount of tokens that can be issued
	uint64 maxIssuanceAmount;
	//: Amount of tokens available for issuance
	uint64 availableForIssueance;
	//: Amount of tokens issued already
	uint64 issued;
	//: Amount of tokens to be issued which is locked. `pendingIssuance+issued <= maxIssuanceAmount`
	uint64 pendingIssuance;
	//: Policies of the asset
  uint32 policies;
  //: Used to restrict usage. Used in account rules
  uint64 type;
  //: Number of decimal places. Must be <= 6
  uint32 trailingDigitsCount;

  //: Reserved for future use
  EmptyExt ext;
};

Create Request To Update Asset

Allows to create or update UPDATE_ASSET reviewable request UPDATE_ASSET request is used to update asset entry

Account Role Requirements

Account Resource Type Reviewable Request Type Action Condition
source REVIEWABLE_REQUEST UPDATE_ASSET CREATE allTasks == null
source REVIEWABLE_REQUEST UPDATE_ASSET CREATE_WITH_TASKS allTasks != null

Signer Role Requirements

Resource Type Rule Action Details
ASSET UPDATE Resource includes code and type of asset
ManageAssetOp

ManageAssetOp is used to:

  • create or update CREATE_ASSET request;
  • create or update UPDATE_ASSET request;
  • cancel CREATE_ASSET or UPDATE_ASSET request
  • change asset pre issuer
  • update max issuance of an asset
RequestId
uint64

ID of a reviewable request If requestID == 0, operation creates a new reviewable request; otherwise, it updates the existing one

Request
One of multiple values

data is used to pass one of ManageAssetAction with required params

Ext
ManageAssetOpExtArmEmptyVersion (object)

reserved for future use

Response Schema
One of
  • Success
  • RequestNotFound
  • InvalidSignature
  • AssetAlreadyExists
  • InvalidMaxIssuanceAmount
  • InvalidCode
  • InvalidPreIssuer
  • InvalidPolicies
  • AssetNotFound
  • RequestAlreadyExists
  • StatsAssetAlreadyExists
  • InitialPreissuedExceedsMaxIssuance
  • InvalidCreatorDetails
  • InvalidTrailingDigitsCount
  • InvalidPreissuedAmountPrecision
  • InvalidMaxIssuanceAmountPrecision
  • AssetCreateTasksNotFound
  • AssetUpdateTasksNotFound
  • NotAllowedToSetTasksOnUpdate
code
string
Value: "SUCCESS"

Specified action in data of ManageSignerOp was successfully performed

success
object (ManageAssetSuccess)

Is used to pass useful params after the successful operation application

Cancel Asset Request

Allows to cancel CREATE_ASSET or UPDATE_ASSET reviewable request

Account Role Requirements

No account rule required because only requestor can remove own request

Signer Role Requirements

Resource Type Rule Action Details
ASSET CANCEL Resource includes code and type of asset
ManageAssetOp

ManageAssetOp is used to:

  • create or update CREATE_ASSET request;
  • create or update UPDATE_ASSET request;
  • cancel CREATE_ASSET or UPDATE_ASSET request
  • change asset pre issuer
  • update max issuance of an asset
RequestId
uint64

ID of a reviewable request If requestID == 0, operation creates a new reviewable request; otherwise, it updates the existing one

Request
One of multiple values

data is used to pass one of ManageAssetAction with required params

Ext
ManageAssetOpExtArmEmptyVersion (object)

reserved for future use

Response Schema
One of
  • Success
  • RequestNotFound
  • InvalidSignature
  • AssetAlreadyExists
  • InvalidMaxIssuanceAmount
  • InvalidCode
  • InvalidPreIssuer
  • InvalidPolicies
  • AssetNotFound
  • RequestAlreadyExists
  • StatsAssetAlreadyExists
  • InitialPreissuedExceedsMaxIssuance
  • InvalidCreatorDetails
  • InvalidTrailingDigitsCount
  • InvalidPreissuedAmountPrecision
  • InvalidMaxIssuanceAmountPrecision
  • AssetCreateTasksNotFound
  • AssetUpdateTasksNotFound
  • NotAllowedToSetTasksOnUpdate
code
string
Value: "SUCCESS"

Specified action in data of ManageSignerOp was successfully performed

success
object (ManageAssetSuccess)

Is used to pass useful params after the successful operation application

Change current pre issuer of asset

Allows to change asset pre issuer

Account Role Requirements

No account rule required because only current asset pre issuer can change asset pre issuer

Signer Role Requirements

No signer rule required because only current asset pre issuer can change asset pre issuer

ManageAssetOp

ManageAssetOp is used to:

  • create or update CREATE_ASSET request;
  • create or update UPDATE_ASSET request;
  • cancel CREATE_ASSET or UPDATE_ASSET request
  • change asset pre issuer
  • update max issuance of an asset
RequestId
uint64

ID of a reviewable request If requestID == 0, operation creates a new reviewable request; otherwise, it updates the existing one

Request
One of multiple values

data is used to pass one of ManageAssetAction with required params

Ext
ManageAssetOpExtArmEmptyVersion (object)

reserved for future use

Response Schema
One of
  • Success
  • RequestNotFound
  • InvalidSignature
  • AssetAlreadyExists
  • InvalidMaxIssuanceAmount
  • InvalidCode
  • InvalidPreIssuer
  • InvalidPolicies
  • AssetNotFound
  • RequestAlreadyExists
  • StatsAssetAlreadyExists
  • InitialPreissuedExceedsMaxIssuance
  • InvalidCreatorDetails
  • InvalidTrailingDigitsCount
  • InvalidPreissuedAmountPrecision
  • InvalidMaxIssuanceAmountPrecision
  • AssetCreateTasksNotFound
  • AssetUpdateTasksNotFound
  • NotAllowedToSetTasksOnUpdate
code
string
Value: "SUCCESS"

Specified action in data of ManageSignerOp was successfully performed

success
object (ManageAssetSuccess)

Is used to pass useful params after the successful operation application

Remove Asset

Removes asset.

Account Role Requirements

Account Resource Type Action Condition
source ASSET REMOVE source == assetOwner
source ASSET REMOVE_FOR_OTHER source != assetOwner

Signer Role Requirements

Resource Type Rule Action
ASSET REMOVE
ASSET REMOVE_FOR_OTHER
RemoveAssetOp

RemoveAssetOp changes the state of specified asset to removed

Code
string

Defines an asset

Ext
RemoveAssetOpExtArmEmptyVersion (object)

reserved for future use

Response Schema
One of
  • Success
  • InvalidAssetCode
  • HasPair
  • HasActiveOffers
  • HasActiveSales
  • HasActiveAtomicSwaps
  • HasActiveSwaps
  • CannotRemoveStatsQuoteAsset
  • HasPendingMovements
code
string
Value: "SUCCESS"

Operation is successfully applied

success
object (RemoveAssetSuccess)

Result of successful RemoveAssetOp application

Update Max Issuance

Allows to change max issuance of asset

Account Role Requirements

Account Resource Type Rule Action Details
source ASSET UPDATE_MAX_ISSUANCE Only asset owner can update max issuance of asset

Signer Role Requirements

Resource Type Rule Action
ASSET UPDATE_MAX_ISSUANCE
ManageAssetOp

ManageAssetOp is used to:

  • create or update CREATE_ASSET request;
  • create or update UPDATE_ASSET request;
  • cancel CREATE_ASSET or UPDATE_ASSET request
  • change asset pre issuer
  • update max issuance of an asset
RequestId
uint64

ID of a reviewable request If requestID == 0, operation creates a new reviewable request; otherwise, it updates the existing one

Request
One of multiple values

data is used to pass one of ManageAssetAction with required params

Ext
ManageAssetOpExtArmEmptyVersion (object)

reserved for future use

Response Schema
One of
  • Success
  • RequestNotFound
  • InvalidSignature
  • AssetAlreadyExists
  • InvalidMaxIssuanceAmount
  • InvalidCode
  • InvalidPreIssuer
  • InvalidPolicies
  • AssetNotFound
  • RequestAlreadyExists
  • StatsAssetAlreadyExists
  • InitialPreissuedExceedsMaxIssuance
  • InvalidCreatorDetails
  • InvalidTrailingDigitsCount
  • InvalidPreissuedAmountPrecision
  • InvalidMaxIssuanceAmountPrecision
  • AssetCreateTasksNotFound
  • AssetUpdateTasksNotFound
  • NotAllowedToSetTasksOnUpdate
code
string
Value: "SUCCESS"

Specified action in data of ManageSignerOp was successfully performed

success
object (ManageAssetSuccess)

Is used to pass useful params after the successful operation application

Payment

Defines access points to get Payments