xdr/Stellar-transaction.x in stellar-base-0.0.7 vs xdr/Stellar-transaction.x in stellar-base-0.0.8
- old
+ new
@@ -13,39 +13,74 @@
uint512 signature; // actual signature
};
enum OperationType
{
- PAYMENT = 0,
- CREATE_OFFER = 1,
- SET_OPTIONS = 2,
- CHANGE_TRUST = 3,
- ALLOW_TRUST = 4,
- ACCOUNT_MERGE = 5,
- INFLATION = 6
+ CREATE_ACCOUNT = 0,
+ PAYMENT = 1,
+ PATH_PAYMENT = 2,
+ CREATE_OFFER = 3,
+ SET_OPTIONS = 4,
+ CHANGE_TRUST = 5,
+ ALLOW_TRUST = 6,
+ ACCOUNT_MERGE = 7,
+ INFLATION = 8
};
+/* CreateAccount
+Funds a new account with the specified starting balance
+
+Threshold: med
+
+Result: CreateAccountResult
+
+*/
+
+struct CreateAccountOp
+{
+ AccountID destination; // account to create
+ int64 startingBalance; // amount they end up with
+};
+
/* Payment
- send an amount to a destination account, optionally through a path.
- XLM payments create the destination account if it does not exist
+ send an amount to a destination account.
Threshold: med
Result: PaymentResult
*/
struct PaymentOp
{
AccountID destination; // recipient of the payment
Currency currency; // what they end up with
int64 amount; // amount they end up with
+};
- // payment over path
- Currency path<5>; // what hops it must go through to get there
- int64 sendMax; // the maximum amount of the source currency (==path[0]) to
- // send (excluding fees).
- // The operation will fail if can't be met
+/* PathPayment
+
+send an amount to a destination account through a path.
+(up to sendMax, sendCurrency)
+(X0, Path[0]) .. (Xn, Path[n])
+(destAmount, destCurrency)
+
+Threshold: med
+
+Result: PathPaymentResult
+*/
+struct PathPaymentOp
+{
+ Currency sendCurrency; // currency we pay with
+ int64 sendMax; // the maximum amount of sendCurrency to
+ // send (excluding fees).
+ // The operation will fail if can't be met
+
+ AccountID destination; // recipient of the payment
+ Currency destCurrency; // what they end up with
+ int64 destAmount; // amount they end up with
+
+ Currency path<5>; // additional hops it must go through to get there
};
/* Creates, updates or deletes an offer
Threshold: med
@@ -153,12 +188,16 @@
// the transaction level
AccountID* sourceAccount;
union switch (OperationType type)
{
+ case CREATE_ACCOUNT:
+ CreateAccountOp createAccountOp;
case PAYMENT:
PaymentOp paymentOp;
+ case PATH_PAYMENT:
+ PathPaymentOp pathPaymentOp;
case CREATE_OFFER:
CreateOfferOp createOfferOp;
case SET_OPTIONS:
SetOptionsOp setOptionsOp;
case CHANGE_TRUST:
@@ -173,31 +212,37 @@
body;
};
enum MemoType
{
- MEMO_TYPE_NONE = 0,
- MEMO_TYPE_TEXT = 1,
- MEMO_TYPE_ID = 2,
- MEMO_TYPE_HASH = 3,
- MEMO_TYPE_RETURN = 4
+ MEMO_NONE = 0,
+ MEMO_TEXT = 1,
+ MEMO_ID = 2,
+ MEMO_HASH = 3,
+ MEMO_RETURN = 4
};
union Memo switch (MemoType type)
{
-case MEMO_TYPE_NONE:
+case MEMO_NONE:
void;
-case MEMO_TYPE_TEXT:
+case MEMO_TEXT:
string text<28>;
-case MEMO_TYPE_ID:
+case MEMO_ID:
uint64 id;
-case MEMO_TYPE_HASH:
+case MEMO_HASH:
Hash hash; // the hash of what to pull from the content server
-case MEMO_TYPE_RETURN:
+case MEMO_RETURN:
Hash retHash; // the hash of the tx you are rejecting
};
+struct TimeBounds
+{
+ uint64 minTime;
+ uint64 maxTime;
+};
+
/* a transaction is a container for a set of operations
- is executed by an account
- fees are collected from the account
- operations are executed in order as one ACID transaction
either all operations are applied or none are
@@ -207,19 +252,18 @@
struct Transaction
{
// account used to run the transaction
AccountID sourceAccount;
- // the fee the sourceAccount will pay
+ // the fee the sourceAccount will pay
int32 fee;
// sequence number to consume in the account
SequenceNumber seqNum;
- // validity range (inclusive) for the ledger sequence number
- uint32 minLedger;
- uint32 maxLedger;
+ // validity range (inclusive) for the last ledger close time
+ TimeBounds* timeBounds;
Memo memo;
Operation operations<100>;
};
@@ -245,49 +289,91 @@
int64 amountClaimed;
// should we also include the amount that the owner gets in return?
};
+/******* CreateAccount Result ********/
+
+enum CreateAccountResultCode
+{
+ // codes considered as "success" for the operation
+ CREATE_ACCOUNT_SUCCESS = 0, // account was created
+
+ // codes considered as "failure" for the operation
+ CREATE_ACCOUNT_MALFORMED = 1, // invalid destination
+ CREATE_ACCOUNT_UNDERFUNDED = 2, // not enough funds in source account
+ CREATE_ACCOUNT_LOW_RESERVE =
+ 3, // would create an account below the min reserve
+ CREATE_ACCOUNT_ALREADY_EXIST = 4 // account already exists
+};
+
+union CreateAccountResult switch (CreateAccountResultCode code)
+{
+case CREATE_ACCOUNT_SUCCESS:
+ void;
+default:
+ void;
+};
+
/******* Payment Result ********/
enum PaymentResultCode
{
// codes considered as "success" for the operation
- PAYMENT_SUCCESS = 0, // simple payment success
- PAYMENT_SUCCESS_MULTI = 1, // multi-path payment success
+ PAYMENT_SUCCESS = 0, // payment successfuly completed
// codes considered as "failure" for the operation
PAYMENT_MALFORMED = -1, // bad input
PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
PAYMENT_NO_DESTINATION = -3, // destination account does not exist
PAYMENT_NO_TRUST = -4, // destination missing a trust line for currency
PAYMENT_NOT_AUTHORIZED = -5, // destination not authorized to hold currency
- PAYMENT_LINE_FULL = -6, // destination would go above their limit
- PAYMENT_TOO_FEW_OFFERS = -7, // not enough offers to satisfy path payment
- PAYMENT_OVER_SENDMAX = -8, // multi-path payment could not satisfy sendmax
- PAYMENT_LOW_RESERVE = -9 // would create an account below the min reserve
+ PAYMENT_LINE_FULL = -6 // destination would go above their limit
};
+union PaymentResult switch (PaymentResultCode code)
+{
+case PAYMENT_SUCCESS:
+ void;
+default:
+ void;
+};
+
+/******* Payment Result ********/
+
+enum PathPaymentResultCode
+{
+ // codes considered as "success" for the operation
+ PATH_PAYMENT_SUCCESS = 0, // success
+
+ // codes considered as "failure" for the operation
+ PATH_PAYMENT_MALFORMED = -1, // bad input
+ PATH_PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
+ PATH_PAYMENT_NO_DESTINATION = -3, // destination account does not exist
+ PATH_PAYMENT_NO_TRUST = -4, // destination missing a trust line for currency
+ PATH_PAYMENT_NOT_AUTHORIZED =
+ -5, // destination not authorized to hold currency
+ PATH_PAYMENT_LINE_FULL = -6, // destination would go above their limit
+ PATH_PAYMENT_TOO_FEW_OFFERS = -7, // not enough offers to satisfy path
+ PATH_PAYMENT_OVER_SENDMAX = -8 // could not satisfy sendmax
+};
+
struct SimplePaymentResult
{
AccountID destination;
Currency currency;
int64 amount;
};
-struct PaymentSuccessMultiResult
+union PathPaymentResult switch (PathPaymentResultCode code)
{
- ClaimOfferAtom offers<>;
- SimplePaymentResult last;
-};
-
-union PaymentResult switch (PaymentResultCode code)
-{
-case PAYMENT_SUCCESS:
- void;
-case PAYMENT_SUCCESS_MULTI:
- PaymentSuccessMultiResult multi;
+case PATH_PAYMENT_SUCCESS:
+ struct
+ {
+ ClaimOfferAtom offers<>;
+ SimplePaymentResult last;
+ } success;
default:
void;
};
/******* CreateOffer Result ********/
@@ -466,12 +552,16 @@
union OperationResult switch (OperationResultCode code)
{
case opINNER:
union switch (OperationType type)
{
+ case CREATE_ACCOUNT:
+ CreateAccountResult createAccountResult;
case PAYMENT:
PaymentResult paymentResult;
+ case PATH_PAYMENT:
+ PathPaymentResult pathPaymentResult;
case CREATE_OFFER:
CreateOfferResult createOfferResult;
case SET_OPTIONS:
SetOptionsResult setOptionsResult;
case CHANGE_TRUST:
@@ -494,19 +584,20 @@
txDUPLICATE = -1, // transaction was already submited
txFAILED = -2, // one of the operations failed (but none were applied)
- txBAD_LEDGER = -3, // ledger is not in range [minLeder; maxLedger]
- txMISSING_OPERATION = -4, // no operation was specified
- txBAD_SEQ = -5, // sequence number does not match source account
+ txTOO_EARLY = -3, // ledger closeTime before minTime
+ txTOO_LATE = -4, // ledger closeTime after maxTime
+ txMISSING_OPERATION = -5, // no operation was specified
+ txBAD_SEQ = -6, // sequence number does not match source account
- txBAD_AUTH = -6, // not enough signatures to perform transaction
- txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
- txNO_ACCOUNT = -8, // source account not found
- txINSUFFICIENT_FEE = -9, // max fee is too small
- txBAD_AUTH_EXTRA = -10, // too many signatures on transaction
- txINTERNAL_ERROR = -11 // an unknown error occured
+ txBAD_AUTH = -7, // not enough signatures to perform transaction
+ txINSUFFICIENT_BALANCE = -8, // fee would bring account below reserve
+ txNO_ACCOUNT = -9, // source account not found
+ txINSUFFICIENT_FEE = -10, // fee is too small
+ txBAD_AUTH_EXTRA = -11, // too many signatures on transaction
+ txINTERNAL_ERROR = -12 // an unknown error occured
};
struct TransactionResult
{
int64 feeCharged; // actual fee charged for the transaction