mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
Return instructions in prepare responses
This commit is contained in:
16
npm-shrinkwrap.json
generated
16
npm-shrinkwrap.json
generated
@@ -13,8 +13,8 @@
|
||||
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.20.tgz",
|
||||
"dependencies": {
|
||||
"core-js": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.0.1.tgz"
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.1.2.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -23,8 +23,8 @@
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.0.7.tgz"
|
||||
},
|
||||
"bn.js": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-3.1.1.tgz"
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-3.1.2.tgz"
|
||||
},
|
||||
"es6-promisify": {
|
||||
"version": "2.0.0",
|
||||
@@ -81,8 +81,8 @@
|
||||
}
|
||||
},
|
||||
"is-my-json-valid": {
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.1.tgz",
|
||||
"version": "2.12.2",
|
||||
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.2.tgz",
|
||||
"dependencies": {
|
||||
"generate-function": {
|
||||
"version": "2.0.0",
|
||||
@@ -99,8 +99,8 @@
|
||||
}
|
||||
},
|
||||
"jsonpointer": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-1.1.0.tgz"
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz"
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.0",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"babel-eslint": "^4.0.5",
|
||||
"babel-loader": "^5.3.2",
|
||||
"coveralls": "~2.10.0",
|
||||
"eslint": "^1.2.0",
|
||||
"eslint": "^1.3.0",
|
||||
"eslint-plugin-flowtype": "^1.0.0",
|
||||
"eventemitter2": "^0.4.14",
|
||||
"flow-bin": "^0.14",
|
||||
|
||||
21
src/api/common/schemas/prepare.json
Normal file
21
src/api/common/schemas/prepare.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "prepare",
|
||||
"description": "Result of prepare function",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"txJSON": {"type": "string"},
|
||||
"instructions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fee": {"$ref": "value"},
|
||||
"sequence": {"$ref": "sequence"},
|
||||
"maxLedgerVersion": {"$ref": "ledgerVersion"}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["fee", "sequence"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["txJSON", "instructions"]
|
||||
}
|
||||
@@ -32,10 +32,10 @@ function createOrderTransaction(account, order) {
|
||||
|
||||
function prepareOrderAsync(account, order, instructions, callback) {
|
||||
const transaction = createOrderTransaction(account, order);
|
||||
utils.createTxJSON(transaction, this.remote, instructions, callback);
|
||||
utils.prepareTransaction(transaction, this.remote, instructions, callback);
|
||||
}
|
||||
|
||||
function prepareOrder(account: string, order: Object, instructions={}) {
|
||||
function prepareOrder(account: string, order: Object, instructions = {}) {
|
||||
return utils.promisify(prepareOrderAsync.bind(this))(
|
||||
account, order, instructions);
|
||||
}
|
||||
|
||||
@@ -14,13 +14,15 @@ function createOrderCancellationTransaction(account, sequence) {
|
||||
}
|
||||
|
||||
function prepareOrderCancellationAsync(account, sequence, instructions,
|
||||
callback) {
|
||||
callback
|
||||
) {
|
||||
const transaction = createOrderCancellationTransaction(account, sequence);
|
||||
utils.createTxJSON(transaction, this.remote, instructions, callback);
|
||||
utils.prepareTransaction(transaction, this.remote, instructions, callback);
|
||||
}
|
||||
|
||||
function prepareOrderCancellation(account: string, sequence: number,
|
||||
instructions={}) {
|
||||
instructions = {}
|
||||
) {
|
||||
return utils.promisify(prepareOrderCancellationAsync.bind(this))(
|
||||
account, sequence, instructions);
|
||||
}
|
||||
|
||||
@@ -83,10 +83,10 @@ function createPaymentTransaction(account, payment) {
|
||||
|
||||
function preparePaymentAsync(account, payment, instructions, callback) {
|
||||
const transaction = createPaymentTransaction(account, payment);
|
||||
utils.createTxJSON(transaction, this.remote, instructions, callback);
|
||||
utils.prepareTransaction(transaction, this.remote, instructions, callback);
|
||||
}
|
||||
|
||||
function preparePayment(account: string, payment: Object, instructions={}) {
|
||||
function preparePayment(account: string, payment: Object, instructions = {}) {
|
||||
return utils.promisify(preparePaymentAsync.bind(this))(
|
||||
account, payment, instructions);
|
||||
}
|
||||
|
||||
@@ -92,10 +92,10 @@ function createSettingsTransaction(account, settings) {
|
||||
|
||||
function prepareSettingsAsync(account, settings, instructions, callback) {
|
||||
const transaction = createSettingsTransaction(account, settings);
|
||||
utils.createTxJSON(transaction, this.remote, instructions, callback);
|
||||
utils.prepareTransaction(transaction, this.remote, instructions, callback);
|
||||
}
|
||||
|
||||
function prepareSettings(account: string, settings: Object, instructions={}) {
|
||||
function prepareSettings(account: string, settings: Object, instructions = {}) {
|
||||
return utils.promisify(prepareSettingsAsync.bind(this))(
|
||||
account, settings, instructions);
|
||||
}
|
||||
|
||||
@@ -40,18 +40,18 @@ function computeSignature(txJSON, keypair) {
|
||||
return keypair.signHex(signingData(txJSON));
|
||||
}
|
||||
|
||||
function sign(txJSON: {Account: string; SigningPubKey: string,
|
||||
TxnSignature: string}, secret: string):
|
||||
{signedTransaction: string; id: string} {
|
||||
validate.txJSON(txJSON);
|
||||
function sign(txJSON: string, secret: string
|
||||
): {signedTransaction: string; id: string} {
|
||||
const tx = JSON.parse(txJSON);
|
||||
validate.txJSON(tx);
|
||||
validate.secret(secret);
|
||||
|
||||
const keypair = getKeyPair(secret);
|
||||
if (txJSON.SigningPubKey === undefined) {
|
||||
txJSON.SigningPubKey = getPublicKeyHex(keypair);
|
||||
if (tx.SigningPubKey === undefined) {
|
||||
tx.SigningPubKey = getPublicKeyHex(keypair);
|
||||
}
|
||||
txJSON.TxnSignature = computeSignature(txJSON, keypair);
|
||||
const serialized = serialize(txJSON);
|
||||
tx.TxnSignature = computeSignature(tx, keypair);
|
||||
const serialized = serialize(tx);
|
||||
return {
|
||||
signedTransaction: serialized.to_hex(),
|
||||
id: hashSerialization(serialized, HASH_TX_ID)
|
||||
|
||||
@@ -35,10 +35,11 @@ function createTrustlineTransaction(account, trustline) {
|
||||
|
||||
function prepareTrustlineAsync(account, trustline, instructions, callback) {
|
||||
const transaction = createTrustlineTransaction(account, trustline);
|
||||
utils.createTxJSON(transaction, this.remote, instructions, callback);
|
||||
utils.prepareTransaction(transaction, this.remote, instructions, callback);
|
||||
}
|
||||
|
||||
function prepareTrustline(account: string, trustline: Object, instructions={}) {
|
||||
function prepareTrustline(account: string, trustline: Object, instructions = {}
|
||||
) {
|
||||
return utils.promisify(prepareTrustlineAsync.bind(this))(
|
||||
account, trustline, instructions);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* @flow */
|
||||
'use strict';
|
||||
const _ = require('lodash');
|
||||
const BigNumber = require('bignumber.js');
|
||||
const common = require('../common');
|
||||
|
||||
function setTransactionBitFlags(transaction: any, values: any, flags: any):
|
||||
void {
|
||||
function setTransactionBitFlags(transaction: any, values: any, flags: any
|
||||
): void {
|
||||
for (const flagName in flags) {
|
||||
const flagValue = values[flagName];
|
||||
const flagConversions = flags[flagName];
|
||||
@@ -23,8 +24,22 @@ function getFeeDrops(remote) {
|
||||
return remote.feeTx(feeUnits).to_text();
|
||||
}
|
||||
|
||||
function createTxJSON(transaction: any, remote: any, instructions: any,
|
||||
callback: (err: ?(typeof Error), data: {tx_json: any}) => void): void {
|
||||
function formatPrepareResponse(txJSON) {
|
||||
const instructions = {
|
||||
fee: txJSON.Fee,
|
||||
sequence: txJSON.Sequence,
|
||||
maxLedgerVersion: txJSON.LastLedgerSequence
|
||||
};
|
||||
return {
|
||||
txJSON: JSON.stringify(txJSON),
|
||||
instructions: _.omit(instructions, _.isUndefined)
|
||||
};
|
||||
}
|
||||
|
||||
type Callback = (err: ?(typeof Error),
|
||||
data: {txJSON: string, instructions: any}) => void;
|
||||
function prepareTransaction(transaction: any, remote: any, instructions: any,
|
||||
callback: Callback): void {
|
||||
common.validate.instructions(instructions);
|
||||
|
||||
transaction.complete();
|
||||
@@ -53,18 +68,18 @@ function createTxJSON(transaction: any, remote: any, instructions: any,
|
||||
|
||||
if (instructions.sequence !== undefined) {
|
||||
txJSON.Sequence = parseInt(instructions.sequence, 10);
|
||||
callback(null, txJSON);
|
||||
callback(null, formatPrepareResponse(txJSON));
|
||||
} else {
|
||||
remote.findAccount(account).getNextSequence(function(error, sequence) {
|
||||
txJSON.Sequence = sequence;
|
||||
callback(null, txJSON);
|
||||
callback(error, formatPrepareResponse(txJSON));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setTransactionBitFlags: setTransactionBitFlags,
|
||||
createTxJSON: createTxJSON,
|
||||
common: common,
|
||||
setTransactionBitFlags,
|
||||
prepareTransaction,
|
||||
common,
|
||||
promisify: common.promisify
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('RippleAPI', function() {
|
||||
}, instructions);
|
||||
return this.api.preparePayment(
|
||||
address, requests.preparePayment, localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePayment, 'tx'));
|
||||
_.partial(checkResult, responses.preparePayment, 'prepare'));
|
||||
});
|
||||
|
||||
it('preparePayment with all options specified', function() {
|
||||
@@ -58,72 +58,73 @@ describe('RippleAPI', function() {
|
||||
};
|
||||
return this.api.preparePayment(
|
||||
address, requests.preparePaymentAllOptions, localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePaymentAllOptions, 'tx'));
|
||||
_.partial(checkResult, responses.preparePaymentAllOptions, 'prepare'));
|
||||
});
|
||||
|
||||
it('preparePayment without counterparty set', function() {
|
||||
const localInstructions = _.defaults({sequence: 23}, instructions);
|
||||
return this.api.preparePayment(
|
||||
address, requests.preparePaymentNoCounterparty, localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePaymentNoCounterparty, 'tx'));
|
||||
_.partial(checkResult, responses.preparePaymentNoCounterparty,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('prepareOrder - buy order', function() {
|
||||
return this.api.prepareOrder(address, requests.prepareOrder, instructions)
|
||||
.then(_.partial(checkResult, responses.prepareOrder, 'tx'));
|
||||
.then(_.partial(checkResult, responses.prepareOrder, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareOrder - sell order', function() {
|
||||
return this.api.prepareOrder(
|
||||
address, requests.prepareOrderSell, instructions).then(
|
||||
_.partial(checkResult, responses.prepareOrderSell, 'tx'));
|
||||
_.partial(checkResult, responses.prepareOrderSell, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareOrderCancellation', function() {
|
||||
return this.api.prepareOrderCancellation(address, 23, instructions).then(
|
||||
_.partial(checkResult, responses.prepareOrderCancellation, 'tx'));
|
||||
_.partial(checkResult, responses.prepareOrderCancellation, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareTrustline - simple', function() {
|
||||
return this.api.prepareTrustline(
|
||||
address, requests.prepareTrustline.simple, instructions).then(
|
||||
_.partial(checkResult, responses.prepareTrustline.simple, 'tx'));
|
||||
_.partial(checkResult, responses.prepareTrustline.simple, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareTrustline - complex', function() {
|
||||
return this.api.prepareTrustline(
|
||||
address, requests.prepareTrustline.complex, instructions).then(
|
||||
_.partial(checkResult, responses.prepareTrustline.complex, 'tx'));
|
||||
_.partial(checkResult, responses.prepareTrustline.complex, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings', function() {
|
||||
return this.api.prepareSettings(
|
||||
address, requests.prepareSettings, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.flags, 'tx'));
|
||||
_.partial(checkResult, responses.prepareSettings.flags, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - regularKey', function() {
|
||||
const regularKey = {regularKey: 'rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD'};
|
||||
return this.api.prepareSettings(address, regularKey, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.regularKey, 'tx'));
|
||||
_.partial(checkResult, responses.prepareSettings.regularKey, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - flag set', function() {
|
||||
const settings = {requireDestinationTag: true};
|
||||
return this.api.prepareSettings(address, settings, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.flagSet, 'tx'));
|
||||
_.partial(checkResult, responses.prepareSettings.flagSet, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - flag clear', function() {
|
||||
const settings = {requireDestinationTag: false};
|
||||
return this.api.prepareSettings(address, settings, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.flagClear, 'tx'));
|
||||
_.partial(checkResult, responses.prepareSettings.flagClear, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - string field clear', function() {
|
||||
const settings = {walletLocator: null};
|
||||
return this.api.prepareSettings(address, settings, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.fieldClear, 'tx'));
|
||||
_.partial(checkResult, responses.prepareSettings.fieldClear, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - integer field clear', function() {
|
||||
@@ -131,19 +132,20 @@ describe('RippleAPI', function() {
|
||||
return this.api.prepareSettings(address, settings, instructions)
|
||||
.then(data => {
|
||||
assert(data);
|
||||
assert.strictEqual(data.WalletSize, 0);
|
||||
assert.strictEqual(JSON.parse(data.txJSON).WalletSize, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it('prepareSettings - set transferRate', function() {
|
||||
const settings = {transferRate: 1};
|
||||
return this.api.prepareSettings(address, settings, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.setTransferRate, 'tx'));
|
||||
_.partial(checkResult, responses.prepareSettings.setTransferRate,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('sign', function() {
|
||||
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV';
|
||||
const result = this.api.sign(requests.sign, secret);
|
||||
const result = this.api.sign(requests.sign.txJSON, secret);
|
||||
assert.deepEqual(result, responses.sign);
|
||||
schemaValidator.schemaValidate('sign', result);
|
||||
});
|
||||
@@ -775,9 +777,9 @@ describe('RippleAPI - offline', function() {
|
||||
maxLedgerVersion: 8820051,
|
||||
fee: '0.000012'
|
||||
};
|
||||
return api.prepareSettings(address, settings, instructions).then(txJSON => {
|
||||
assert.deepEqual(txJSON, responses.prepareSettings.flags);
|
||||
assert.deepEqual(api.sign(txJSON, secret), responses.sign);
|
||||
return api.prepareSettings(address, settings, instructions).then(data => {
|
||||
assert.deepEqual(data, responses.prepareSettings.flags);
|
||||
assert.deepEqual(api.sign(data.txJSON, secret), responses.sign);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
13
test/fixtures/api/requests/sign.json
vendored
13
test/fixtures/api/requests/sign.json
vendored
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Domain": "726970706C652E636F6D",
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Domain\":\"726970706C652E636F6D\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "OfferCancel",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"OfferSequence": 23,
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"OfferCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":23,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
{
|
||||
"Flags": 655360,
|
||||
"TransactionType": "OfferCreate",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"TakerGets": {
|
||||
"value": "10.1",
|
||||
"currency": "USD",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
},
|
||||
"TakerPays": "2000000",
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
}
|
||||
"txJSON": "{\"Flags\":655360,\"TransactionType\":\"OfferCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TakerGets\":{\"value\":\"10.1\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"TakerPays\":\"2000000\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
18
test/fixtures/api/responses/prepare-order.json
vendored
18
test/fixtures/api/responses/prepare-order.json
vendored
@@ -1,14 +1,8 @@
|
||||
{
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Fee": "12",
|
||||
"Flags": 131072,
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Sequence": 23,
|
||||
"TakerGets": "2000000",
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||
"value": "10.1"
|
||||
},
|
||||
"TransactionType": "OfferCreate"
|
||||
"txJSON": "{\"Flags\":131072,\"TransactionType\":\"OfferCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TakerGets\":\"2000000\",\"TakerPays\":{\"value\":\"10.1\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,8 @@
|
||||
{
|
||||
"Flags": 458752,
|
||||
"TransactionType": "Payment",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Destination": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"Amount": "10000",
|
||||
"InvoiceID": "A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A",
|
||||
"SourceTag": 14,
|
||||
"DestinationTag": 58,
|
||||
"Memos": [
|
||||
{
|
||||
"Memo": {
|
||||
"MemoType": "74657374",
|
||||
"MemoFormat": "706C61696E2F74657874",
|
||||
"MemoData": "7465787465642064617461"
|
||||
}
|
||||
}
|
||||
],
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":458752,\"TransactionType\":\"Payment\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":\"10000\",\"InvoiceID\":\"A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A\",\"SourceTag\":14,\"DestinationTag\":58,\"Memos\":[{\"Memo\":{\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\",\"MemoData\":\"7465787465642064617461\"}}],\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +1,8 @@
|
||||
{
|
||||
"Flags": 458752,
|
||||
"TransactionType": "Payment",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Destination": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"Amount": {
|
||||
"value": "0.01",
|
||||
"currency": "LTC",
|
||||
"issuer": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo"
|
||||
},
|
||||
"InvoiceID": "A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A",
|
||||
"SourceTag": 14,
|
||||
"DestinationTag": 58,
|
||||
"Paths": [
|
||||
[
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"currency": "USD",
|
||||
"type_hex": "0000000000000031"
|
||||
},
|
||||
{
|
||||
"issuer": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX",
|
||||
"currency": "LTC",
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX",
|
||||
"issuer": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX",
|
||||
"currency": "LTC",
|
||||
"type_hex": "0000000000000031"
|
||||
}
|
||||
]
|
||||
],
|
||||
"Memos": [
|
||||
{
|
||||
"Memo": {
|
||||
"MemoType": "74657374",
|
||||
"MemoFormat": "706C61696E2F74657874",
|
||||
"MemoData": "7465787465642064617461"
|
||||
}
|
||||
}
|
||||
],
|
||||
"SendMax": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||
},
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
}
|
||||
"txJSON": "{\"Flags\":458752,\"TransactionType\":\"Payment\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"LTC\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"},\"InvoiceID\":\"A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A\",\"SourceTag\":14,\"DestinationTag\":58,\"Memos\":[{\"Memo\":{\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\",\"MemoData\":\"7465787465642064617461\"}}],\"SendMax\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\"},\"Paths\":[[{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\",\"issuer\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\",\"currency\":\"USD\",\"type_hex\":\"0000000000000031\"},{\"issuer\":\"rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX\",\"currency\":\"LTC\",\"type_hex\":\"0000000000000030\"},{\"account\":\"rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX\",\"issuer\":\"rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX\",\"currency\":\"LTC\",\"type_hex\":\"0000000000000031\"}]],\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
23
test/fixtures/api/responses/prepare-payment.json
vendored
23
test/fixtures/api/responses/prepare-payment.json
vendored
@@ -1,19 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "Payment",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Destination": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"Amount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
},
|
||||
"LastLedgerSequence": 8820051,
|
||||
"SendMax": {
|
||||
"currency": "USD",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||
"value": "0.01"
|
||||
},
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"Payment\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"SendMax\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"WalletLocator": "0",
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
}
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"WalletLocator\":\"0\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"ClearFlag": 1,
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"ClearFlag\":1,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"SetFlag": 1,
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"SetFlag\":1,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "SetRegularKey",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"RegularKey": "rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD",
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"SetRegularKey\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"RegularKey\":\"rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"TransferRate": 1000000000,
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
}
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransferRate\":1000000000,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
{
|
||||
"Flags": 1048576,
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Domain": "726970706C652E636F6D",
|
||||
"Flags": 0,
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Domain\":\"726970706C652E636F6D\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
{
|
||||
"Flags": 0,
|
||||
"TransactionType": "TrustSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"LimitAmount": {
|
||||
"value": "0.1",
|
||||
"currency": "BTC",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
},
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":0,\"TransactionType\":\"TrustSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"LimitAmount\":{\"value\":\"0.1\",\"currency\":\"BTC\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
{
|
||||
"Flags": 2228224,
|
||||
"TransactionType": "TrustSet",
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"LimitAmount": {
|
||||
"value": "10000",
|
||||
"currency": "USD",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
},
|
||||
"QualityIn": 910000000,
|
||||
"QualityOut": 870000000,
|
||||
"LastLedgerSequence": 8820051,
|
||||
"Fee": "12",
|
||||
"Sequence": 23
|
||||
"txJSON": "{\"Flags\":2228224,\"TransactionType\":\"TrustSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"LimitAmount\":{\"value\":\"10000\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"QualityIn\":910000000,\"QualityOut\":870000000,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "12",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user