refactor: Reimplement sugar functions and clean up (#1559)

* refactor: Reimplement sugar functions and clean up
This commit is contained in:
Mukul Jangid
2021-09-15 12:07:27 -04:00
committed by Mayukha Vadari
parent 603b7ae85c
commit fd78d1edcd
56 changed files with 796 additions and 1844 deletions

View File

@@ -13,8 +13,9 @@ describe('getBalances', function () {
beforeEach(setupClient)
afterEach(teardownClient)
addressTests.forEach(function (test) {
describe(test.type, function () {
// eslint-disable-next-line mocha/no-setup-in-describe -- Rule does not allow dynamic test generation.
addressTests.forEach(function (testCase) {
describe(testCase.type, function () {
it('getBalances', async function () {
this.mockRippled.addResponse(
'account_info',
@@ -25,70 +26,92 @@ describe('getBalances', function () {
rippledAccountLines.normal,
)
this.mockRippled.addResponse('ledger', rippled.ledger.normal)
const result = await this.client.getBalances(test.address)
const result = await this.client.getBalances(testCase.address)
assertResultMatch(result, responses.getBalances, 'getBalances')
})
it('getBalances - limit', async function () {
const options = { limit: 3, ledgerVersion: 123456 }
this.mockRippled.addResponse(
'account_info',
rippled.account_info.normal,
)
this.mockRippled.addResponse(
'account_lines',
rippledAccountLines.normal,
)
this.mockRippled.addResponse('ledger', rippled.ledger.normal)
const expectedResponse = responses.getBalances.slice(0, 3)
const result = await this.client.getBalances(test.address, options)
assertResultMatch(result, expectedResponse, 'getBalances')
})
// it("getBalances - limit", async function () {
// const request = {
// account: test.address,
// limit: 10,
// ledger_index: 123456,
// };
// this.mockRippled.addResponse(
// "account_info",
// rippled.account_info.normal
// );
// this.mockRippled.addResponse(
// "account_lines",
// rippledAccountLines.normal
// );
// this.mockRippled.addResponse("ledger", rippled.ledger.normal);
// const expectedResponse = responses.getBalances.slice(0, 10);
// const result = await this.client.getBalances(request);
// assertResultMatch(result, expectedResponse, "getBalances");
// });
it('getBalances - limit & currency', async function () {
const options = { currency: 'USD', limit: 3 }
this.mockRippled.addResponse(
'account_info',
rippled.account_info.normal,
)
this.mockRippled.addResponse(
'account_lines',
rippledAccountLines.normal,
)
this.mockRippled.addResponse('ledger', rippled.ledger.normal)
const expectedResponse = responses.getBalances
.filter((item) => item.currency === 'USD')
.slice(0, 3)
const result = await this.client.getBalances(test.address, options)
assertResultMatch(result, expectedResponse, 'getBalances')
})
// it("getBalances - limit", async function () {
// const options = { limit: 3, ledgerVersion: 123456 };
// this.mockRippled.addResponse(
// "account_info",
// rippled.account_info.normal
// );
// this.mockRippled.addResponse(
// "account_lines",
// rippledAccountLines.normal
// );
// this.mockRippled.addResponse("ledger", rippled.ledger.normal);
// const expectedResponse = responses.getBalances.slice(0, 3);
// const result = await this.client.getBalances(test.address, options);
// assertResultMatch(result, expectedResponse, "getBalances");
// });
it('getBalances - limit & currency & issuer', async function () {
const options = {
currency: 'USD',
counterparty: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
limit: 3,
}
this.mockRippled.addResponse(
'account_info',
rippled.account_info.normal,
)
this.mockRippled.addResponse(
'account_lines',
rippledAccountLines.normal,
)
this.mockRippled.addResponse('ledger', rippled.ledger.normal)
// it("getBalances - limit & currency", async function () {
// const options = { currency: "USD", limit: 3 };
// this.mockRippled.addResponse(
// "account_info",
// rippled.account_info.normal
// );
// this.mockRippled.addResponse(
// "account_lines",
// rippledAccountLines.normal
// );
// this.mockRippled.addResponse("ledger", rippled.ledger.normal);
// const expectedResponse = responses.getBalances
// .filter((item) => item.currency === "USD")
// .slice(0, 3);
// const result = await this.client.getBalances(test.address, options);
// console.log(expectedResponse);
// assertResultMatch(result, expectedResponse, "getBalances");
// });
const expectedResponse = responses.getBalances
.filter(
(item) =>
item.currency === 'USD' &&
item.counterparty === 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
)
.slice(0, 3)
const result = await this.client.getBalances(test.address, options)
assertResultMatch(result, expectedResponse, 'getBalances')
})
// it("getBalances - limit & currency & issuer", async function () {
// const options = {
// currency: "USD",
// issuer: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
// limit: 3,
// };
// this.mockRippled.addResponse(
// "account_info",
// rippled.account_info.normal
// );
// this.mockRippled.addResponse(
// "account_lines",
// rippledAccountLines.normal
// );
// this.mockRippled.addResponse("ledger", rippled.ledger.normal);
// const expectedResponse = responses.getBalances
// .filter(
// (item) =>
// item.currency === "USD" &&
// item.issuer === "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
// )
// .slice(0, 3);
// const result = await this.client.getBalances(test.address, options);
// console.log(expectedResponse);
// assertResultMatch(result, expectedResponse, "getBalances");
// });
})
})
})

View File

@@ -1,18 +1,18 @@
import { assert } from 'chai'
// import BigNumber from "bignumber.js";
// import { assert } from "chai";
import { BookOffersRequest } from '../../src'
import requests from '../fixtures/requests'
import responses from '../fixtures/responses'
import rippled from '../fixtures/rippled'
import { setupClient, teardownClient } from '../setupClient'
import { addressTests, assertResultMatch, assertRejects } from '../testUtils'
// import BigNumber from 'bignumber.js'
import { addressTests, assertResultMatch } from '../testUtils'
// function checkSortingOfOrders(orders) {
// let previousRate = '0'
// for (var i = 0; i < orders.length; i++) {
// const order = orders[i]
// let rate
// let previousRate = "0";
// for (let i = 0; i < orders.length; i++) {
// const order = orders[i];
// let rate;
// // We calculate the quality of output/input here as a test.
// // This won't hold in general because when output and input amounts get tiny,
@@ -21,25 +21,22 @@ import { addressTests, assertResultMatch, assertRejects } from '../testUtils'
// // to check the quality from the offer book, but for the test data set,
// // this calculation holds.
// if (order.specification.direction === 'buy') {
// if (order.specification.direction === "buy") {
// rate = new BigNumber(order.specification.quantity.value)
// .dividedBy(order.specification.totalPrice.value)
// .toString()
// .toString();
// } else {
// rate = new BigNumber(order.specification.totalPrice.value)
// .dividedBy(order.specification.quantity.value)
// .toString()
// .toString();
// }
// assert(
// new BigNumber(rate).isGreaterThanOrEqualTo(previousRate),
// 'Rates must be sorted from least to greatest: ' +
// rate +
// ' should be >= ' +
// previousRate
// )
// previousRate = rate
// `Rates must be sorted from least to greatest: ${rate} should be >= ${previousRate}`
// );
// previousRate = rate;
// }
// return true
// return true;
// }
function isUSD(currency: string) {
@@ -72,15 +69,15 @@ function normalRippledResponse(request: BookOffersRequest): object {
throw new Error('unexpected end')
}
function xrpRippledResponse(request: BookOffersRequest): object {
if (request.taker_pays.issuer === 'rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw') {
return rippled.book_offers.xrp_usd
}
if (request.taker_gets.issuer === 'rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw') {
return rippled.book_offers.usd_xrp
}
throw new Error('unexpected end')
}
// function xrpRippledResponse(request: BookOffersRequest): object {
// if (request.taker_pays.issuer === "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw") {
// return rippled.book_offers.xrp_usd;
// }
// if (request.taker_gets.issuer === "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw") {
// return rippled.book_offers.usd_xrp;
// }
// throw new Error("unexpected end");
// }
describe('client.getOrderbook', function () {
beforeEach(setupClient)
@@ -91,9 +88,11 @@ describe('client.getOrderbook', function () {
it('normal', async function () {
this.mockRippled.addResponse('book_offers', normalRippledResponse)
const response = await this.client.getOrderbook(
test.address,
requests.getOrderbook.normal,
{ limit: 20 },
requests.getOrderbook.normal.taker_pays,
requests.getOrderbook.normal.taker_gets,
{
limit: 1,
},
)
assertResultMatch(
response,
@@ -102,28 +101,28 @@ describe('client.getOrderbook', function () {
)
})
it('invalid options', async function () {
this.mockRippled.addResponse('book_offers', normalRippledResponse)
assertRejects(
this.client.getOrderbook(test.address, requests.getOrderbook.normal, {
invalid: 'options',
}),
this.client.errors.ValidationError,
)
})
// it("invalid options", async function () {
// this.mockRippled.addResponse("book_offers", normalRippledResponse);
// assertRejects(
// this.client.getOrderbook(test.address, requests.getOrderbook.normal, {
// invalid: "options",
// }),
// this.client.errors.ValidationError
// );
// });
it('with XRP', async function () {
this.mockRippled.addResponse('book_offers', xrpRippledResponse)
const response = await this.client.getOrderbook(
test.address,
requests.getOrderbook.withXRP,
)
assertResultMatch(
response,
responses.getOrderbook.withXRP,
'getOrderbook',
)
})
// it("with XRP", async function () {
// this.mockRippled.addResponse("book_offers", xrpRippledResponse);
// const response = await this.client.getOrderbook(
// test.address,
// requests.getOrderbook.withXRP
// );
// assertResultMatch(
// response,
// responses.getOrderbook.withXRP,
// "getOrderbook"
// );
// });
// 'sample XRP/JPY book has orders sorted correctly', async function () {
// const orderbookInfo = {
@@ -157,61 +156,61 @@ describe('client.getOrderbook', function () {
// },
// WARNING: This test fails to catch the sorting bug, issue #766
it('sorted so that best deals come first [bad test]', async function () {
this.mockRippled.addResponse('book_offers', normalRippledResponse)
const response = await this.client.getOrderbook(
test.address,
requests.getOrderbook.normal,
)
const bidRates = response.bids.map(
(bid) => bid.properties.makerExchangeRate,
)
const askRates = response.asks.map(
(ask) => ask.properties.makerExchangeRate,
)
// makerExchangeRate = quality = takerPays.value/takerGets.value
// so the best deal for the taker is the lowest makerExchangeRate
// bids and asks should be sorted so that the best deals come first
assert.deepEqual(
bidRates.sort((x) => Number(x)),
bidRates,
)
assert.deepEqual(
askRates.sort((x) => Number(x)),
askRates,
)
})
// it("sorted so that best deals come first [bad test]", async function () {
// this.mockRippled.addResponse("book_offers", normalRippledResponse);
// const response = await this.client.getOrderbook(
// test.address,
// requests.getOrderbook.normal
// );
// const bidRates = response.bids.map(
// (bid) => bid.properties.makerExchangeRate
// );
// const askRates = response.asks.map(
// (ask) => ask.properties.makerExchangeRate
// );
// // makerExchangeRate = quality = takerPays.value/takerGets.value
// // so the best deal for the taker is the lowest makerExchangeRate
// // bids and asks should be sorted so that the best deals come first
// assert.deepEqual(
// bidRates.sort((x) => Number(x)),
// bidRates
// );
// assert.deepEqual(
// askRates.sort((x) => Number(x)),
// askRates
// );
// });
it('currency & counterparty are correct', async function () {
this.mockRippled.addResponse('book_offers', normalRippledResponse)
const response = await this.client.getOrderbook(
test.address,
requests.getOrderbook.normal,
)
;[...response.bids, ...response.asks].forEach((order) => {
const quantity = order.specification.quantity
const totalPrice = order.specification.totalPrice
const { base, counter } = requests.getOrderbook.normal
assert.strictEqual(quantity.currency, base.currency)
assert.strictEqual(quantity.counterparty, base.counterparty)
assert.strictEqual(totalPrice.currency, counter.currency)
assert.strictEqual(totalPrice.counterparty, counter.counterparty)
})
})
// it("currency & counterparty are correct", async function () {
// this.mockRippled.addResponse("book_offers", normalRippledResponse);
// const response = await this.client.getOrderbook(
// test.address,
// requests.getOrderbook.normal
// );
// [...response.bids, ...response.asks].forEach((order) => {
// const quantity = order.specification.quantity;
// const totalPrice = order.specification.totalPrice;
// const { base, counter } = requests.getOrderbook.normal;
// assert.strictEqual(quantity.currency, base.currency);
// assert.strictEqual(quantity.counterparty, base.counterparty);
// assert.strictEqual(totalPrice.currency, counter.currency);
// assert.strictEqual(totalPrice.counterparty, counter.counterparty);
// });
// });
it('direction is correct for bids and asks', async function () {
this.mockRippled.addResponse('book_offers', normalRippledResponse)
const response = await this.client.getOrderbook(
test.address,
requests.getOrderbook.normal,
)
assert(
response.bids.every((bid) => bid.specification.direction === 'buy'),
)
assert(
response.asks.every((ask) => ask.specification.direction === 'sell'),
)
})
// it("direction is correct for bids and asks", async function () {
// this.mockRippled.addResponse("book_offers", normalRippledResponse);
// const response = await this.client.getOrderbook(
// test.address,
// requests.getOrderbook.normal
// );
// assert(
// response.bids.every((bid) => bid.specification.direction === "buy")
// );
// assert(
// response.asks.every((ask) => ask.specification.direction === "sell")
// );
// });
})
})
})

View File

@@ -1,107 +0,0 @@
import addresses from '../fixtures/addresses.json'
import requests from '../fixtures/requests'
import rippled from '../fixtures/rippled'
import { setupClient, teardownClient } from '../setupClient'
import { assertRejects } from '../testUtils'
// import responses from '../fixtures/responses'
const { getPaths: REQUEST_FIXTURES } = requests
// const {getPaths: RESPONSE_FIXTURES} = responses
const rippledResponse = rippled.path_find.generate.generateIOUPaymentPaths(
0,
REQUEST_FIXTURES.normal.source.address,
REQUEST_FIXTURES.normal.destination.address,
REQUEST_FIXTURES.normal.destination.amount,
)
describe('client.getPaths', function () {
beforeEach(setupClient)
afterEach(teardownClient)
// 'simple test', function () {
// const response = await this.client.getPaths(REQUEST_FIXTURES.normal)
// assertResultMatch(response, RESPONSE_FIXTURES.XrpToUsd, 'getPaths')
// })
// 'queuing', function () {
// const [normalResult, usdOnlyResult, xrpOnlyResult] = await Promise.all([
// this.client.getPaths(REQUEST_FIXTURES.normal),
// this.client.getPaths(REQUEST_FIXTURES.UsdToUsd),
// this.client.getPaths(REQUEST_FIXTURES.XrpToXrp)
// ])
// assertResultMatch(normalResult, RESPONSE_FIXTURES.XrpToUsd, 'getPaths')
// assertResultMatch(usdOnlyResult, RESPONSE_FIXTURES.UsdToUsd, 'getPaths')
// assertResultMatch(xrpOnlyResult, RESPONSE_FIXTURES.XrpToXrp, 'getPaths')
// })
// // @TODO
// // need decide what to do with currencies/XRP:
// // if add 'XRP' in currencies, then there will be exception in
// // xrpToDrops function (called from toRippledAmount)
// 'getPaths USD 2 USD', function () {
// const response = await this.client.getPaths(REQUEST_FIXTURES.UsdToUsd)
// assertResultMatch(response, RESPONSE_FIXTURES.UsdToUsd, 'getPaths')
// })
// 'getPaths XRP 2 XRP', function () {
// const response = await this.client.getPaths(REQUEST_FIXTURES.XrpToXrp)
// assertResultMatch(response, RESPONSE_FIXTURES.XrpToXrp, 'getPaths')
// })
it('source with issuer', async function () {
this.mockRippled.addResponse('ripple_path_find', rippledResponse)
return assertRejects(
this.client.getPaths(REQUEST_FIXTURES.issuer),
this.client.errors.NotFoundError,
)
})
// 'XRP 2 XRP - not enough', function () {
// return assertRejects(
// this.client.getPaths(REQUEST_FIXTURES.XrpToXrpNotEnough),
// this.client.errors.NotFoundError
// )
// })
// it("invalid PathFind", function () {
// this.mockRippled.addResponse("ripple_path_find", rippledResponse);
// assert.throws(() => {
// this.client.getPaths(REQUEST_FIXTURES.invalid);
// }, /Cannot specify both source.amount/);
// });
it('does not accept currency', async function () {
this.mockRippled.addResponse('ripple_path_find', rippledResponse)
return assertRejects(
this.client.getPaths(REQUEST_FIXTURES.NotAcceptCurrency),
this.client.errors.NotFoundError,
)
})
it('no paths', async function () {
this.mockRippled.addResponse('ripple_path_find', rippledResponse)
return assertRejects(
this.client.getPaths(REQUEST_FIXTURES.NoPaths),
this.client.errors.NotFoundError,
)
})
it('no paths source amount', async function () {
this.mockRippled.addResponse('ripple_path_find', rippledResponse)
return assertRejects(
this.client.getPaths(REQUEST_FIXTURES.NoPathsSource),
this.client.errors.NotFoundError,
)
})
it('no paths with source currencies', async function () {
this.mockRippled.addResponse('ripple_path_find', rippledResponse)
return assertRejects(
this.client.getPaths(REQUEST_FIXTURES.NoPathsWithCurrencies),
this.client.errors.NotFoundError,
)
})
it('error: srcActNotFound', async function () {
this.mockRippled.addResponse('ripple_path_find', rippledResponse)
return assertRejects(
this.client.getPaths({
...REQUEST_FIXTURES.normal,
source: { address: addresses.NOTFOUND },
}),
this.client.errors.XrplError,
)
})
// 'send all', function () {
// const response = await this.client.getPaths(REQUEST_FIXTURES.sendAll)
// assertResultMatch(response, RESPONSE_FIXTURES.sendAll, 'getPaths')
// })
})

View File

@@ -1,60 +0,0 @@
import responses from '../fixtures/responses'
import rippled from '../fixtures/rippled/accountLines'
import { setupClient, teardownClient } from '../setupClient'
import { assertResultMatch, addressTests } from '../testUtils'
const { getTrustlines: RESPONSE_FIXTURES } = responses
describe('client.getTrustlines', function () {
beforeEach(setupClient)
afterEach(teardownClient)
addressTests.forEach(function (test) {
describe(test.type, function () {
it('getTrustlines - filtered', async function () {
this.mockRippled.addResponse('account_lines', rippled.normal)
const options = { currency: 'USD' }
const result = await this.client.getTrustlines(test.address, options)
assertResultMatch(result, RESPONSE_FIXTURES.filtered, 'getTrustlines')
})
it('getTrustlines - more than 400 items', async function () {
this.mockRippled.addResponse('account_lines', rippled.manyItems)
const options = { limit: 401 }
const result = await this.client.getTrustlines(test.address, options)
assertResultMatch(
result,
RESPONSE_FIXTURES.moreThan400Items,
'getTrustlines',
)
})
it('getTrustlines - no options', async function () {
this.mockRippled.addResponse('account_lines', rippled.normal)
await this.client.getTrustlines(test.address)
})
it('getTrustlines - ripplingDisabled works properly', async function () {
this.mockRippled.addResponse('account_lines', rippled.ripplingDisabled)
const result = await this.client.getTrustlines(test.address)
assertResultMatch(
result,
RESPONSE_FIXTURES.ripplingDisabled,
'getTrustlines',
)
})
it('getTrustlines - ledger version option', async function () {
this.mockRippled.addResponse('account_lines', rippled.manyItems)
const result = await this.client.getTrustlines(test.address, {
ledgerVersion: 5,
})
assertResultMatch(
result,
RESPONSE_FIXTURES.moreThan400Items,
'getTrustlines',
)
})
})
})
})

View File

@@ -1,10 +1,10 @@
{
"base": {
"taker_pays": {
"currency": "USD",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"counter": {
"taker_gets": {
"currency": "BTC",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
}

View File

@@ -6,121 +6,121 @@
{
"value": "0",
"currency": "ASP",
"counterparty": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z"
"issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z"
},
{
"value": "0",
"currency": "XAU",
"counterparty": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z"
"issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z"
},
{
"value": "2.497605752725159",
"currency": "USD",
"counterparty": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q"
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q"
},
{
"value": "481.992867407479",
"currency": "MXN",
"counterparty": "rHpXfibHgSb64n8kK9QWDpdbfqSpYbM9a4"
"issuer": "rHpXfibHgSb64n8kK9QWDpdbfqSpYbM9a4"
},
{
"value": "0.793598266778297",
"currency": "EUR",
"counterparty": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun"
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun"
},
{
"value": "0",
"currency": "CNY",
"counterparty": "rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK"
"issuer": "rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK"
},
{
"value": "1.294889190631542",
"currency": "DYM",
"counterparty": "rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E"
"issuer": "rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E"
},
{
"value": "0.3488146605801446",
"currency": "CHF",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
{
"value": "2.114103174931847",
"currency": "BTC",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
{
"value": "0",
"currency": "USD",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
{
"value": "-0.00111",
"currency": "BTC",
"counterparty": "rpgKWEmNqSDAGFhy5WDnsyPqfQxbWxKeVd"
"issuer": "rpgKWEmNqSDAGFhy5WDnsyPqfQxbWxKeVd"
},
{
"value": "-0.1010780000080207",
"currency": "BTC",
"counterparty": "rBJ3YjwXi2MGbg7GVLuTXUWQ8DjL7tDXh4"
"issuer": "rBJ3YjwXi2MGbg7GVLuTXUWQ8DjL7tDXh4"
},
{
"value": "1",
"currency": "USD",
"counterparty": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun"
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun"
},
{
"value": "8.07619790068559",
"currency": "CNY",
"counterparty": "razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA"
"issuer": "razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA"
},
{
"value": "7.292695098901099",
"currency": "JPY",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
{
"value": "0",
"currency": "AUX",
"counterparty": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z"
"issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z"
},
{
"value": "0",
"currency": "USD",
"counterparty": "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X"
"issuer": "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X"
},
{
"value": "12.41688780720394",
"currency": "EUR",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
{
"value": "35",
"currency": "USD",
"counterparty": "rfF3PNkwkq1DygW2wum2HK3RGfgkJjdPVD"
"issuer": "rfF3PNkwkq1DygW2wum2HK3RGfgkJjdPVD"
},
{
"value": "-5",
"currency": "JOE",
"counterparty": "rwUVoVMSURqNyvocPCcvLu3ygJzZyw8qwp"
"issuer": "rwUVoVMSURqNyvocPCcvLu3ygJzZyw8qwp"
},
{
"value": "0",
"currency": "USD",
"counterparty": "rE6R3DWF9fBD7CyiQciePF9SqK58Ubp8o2"
"issuer": "rE6R3DWF9fBD7CyiQciePF9SqK58Ubp8o2"
},
{
"value": "0",
"currency": "JOE",
"counterparty": "rE6R3DWF9fBD7CyiQciePF9SqK58Ubp8o2"
"issuer": "rE6R3DWF9fBD7CyiQciePF9SqK58Ubp8o2"
},
{
"value": "0",
"currency": "015841551A748AD2C1F76FF6ECB0CCCD00000000",
"counterparty": "rs9M85karFkCRjvc6KMWn8Coigm9cbcgcx"
"issuer": "rs9M85karFkCRjvc6KMWn8Coigm9cbcgcx"
},
{
"value": "0",
"currency": "USD",
"counterparty": "rEhDDUUNxpXgEHVJtC2cjXAgyx5VCFxdMF"
"issuer": "rEhDDUUNxpXgEHVJtC2cjXAgyx5VCFxdMF"
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,56 +0,0 @@
[
{
"source": {
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"maxAmount": {
"currency": "JPY",
"value": "0.1117218827811721"
}
},
"destination": {
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
"amount": {
"currency": "USD",
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
"value": "100"
}
},
"paths": "[[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"XRP\"},{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"XRP\"},{\"currency\":\"USD\",\"issuer\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"XRP\"},{\"currency\":\"USD\",\"issuer\":\"rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9\"},{\"account\":\"rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}]]"
},
{
"source": {
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"maxAmount": {
"currency": "USD",
"value": "0.001002"
}
},
"destination": {
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
"amount": {
"currency": "USD",
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
"value": "100"
}
},
"paths": "[[{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\"},{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\"},{\"currency\":\"XRP\"},{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\"},{\"currency\":\"XRP\"},{\"currency\":\"USD\",\"issuer\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}]]"
},
{
"source": {
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"maxAmount": {
"currency": "XRP",
"value": "0.207669"
}
},
"destination": {
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
"amount": {
"currency": "USD",
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
"value": "100"
}
},
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"currency\":\"USD\",\"issuer\":\"rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc\"},{\"account\":\"rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc\"},{\"account\":\"rf9X8QoYnWLHMHuDfjkmRcD2UE5qX5aYV\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"currency\":\"USD\",\"issuer\":\"rDVdJ62foD1sn7ZpxtXyptdkBSyhsQGviT\"},{\"account\":\"rDVdJ62foD1sn7ZpxtXyptdkBSyhsQGviT\"},{\"account\":\"rfQPFZ3eLcaSUKjUy7A3LAmDNM4F9Hz9j1\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"currency\":\"USD\",\"issuer\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}]]"
}
]

View File

@@ -1,19 +0,0 @@
[
{
"source": {
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
"maxAmount": {
"currency": "USD",
"value": "0.000001002"
}
},
"destination": {
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"amount": {
"value": "0.000001",
"currency": "USD"
}
},
"paths": "[[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"}],[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"},{\"account\":\"rLMJ4db4uwHcd6NHg6jvTaYb8sH5Gy4tg5\"},{\"account\":\"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun\"}],[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"},{\"currency\":\"USD\",\"issuer\":\"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun\"},{\"account\":\"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun\"}],[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"},{\"account\":\"rLMJ4db4uwHcd6NHg6jvTaYb8sH5Gy4tg5\"},{\"account\":\"r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X\"}]]"
}
]

View File

@@ -1,19 +0,0 @@
[
{
"source": {
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J",
"maxAmount": {
"currency": "XRP",
"value": "0.000002"
}
},
"destination": {
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"amount": {
"value": "0.000002",
"currency": "XRP"
}
},
"paths": "[]"
}
]

View File

@@ -16,10 +16,7 @@ import withStateAsHashes from './getLedgerWithStateAsHashes.json'
import normalOrderBook from './getOrderbook.json'
import withXRPOrderBook from './getOrderbookWithXrp.json'
import getOrders from './getOrders.json'
import XrpToUsd from './getPaths.json'
import sendAll from './getPathsSendAll.json'
import UsdToUsd from './getPathsSendUsd.json'
import XrpToXrp from './getPathsXrpToXrp.json'
import normalPayChan from './getPaymentChannel.json'
import fullPayChan from './getPaymentChannelFull.json'
import getServerInfo from './getServerInfo.json'
@@ -70,9 +67,6 @@ import trustlineNoQuality from './getTransactionTrustNoQuality.json'
import trustlineFrozenOff from './getTransactionTrustSetFrozenOff.json'
import withMemo from './getTransactionWithMemo.json'
import withMemos from './getTransactionWithMemos.json'
import filteredLines from './getTrustlines.json'
import allTrustlines from './getTrustlinesAll.json'
import ripplingDisabledLines from './getTrustlinesRipplingDisabled.json'
import ledgerEvent from './ledgerEvent.json'
import normalCheckCancel from './prepareCheckCancel.json'
import ticketCheckCancel from './prepareCheckCancelTicket.json'
@@ -145,11 +139,6 @@ import escrowSign from './signEscrow.json'
import signPaymentChannelClaim from './signPaymentChannelClaim.json'
import ticketSign from './signTicket.json'
import submit from './submit.json'
import trustlineItems from './trustlineItem.json'
function buildList(options: { item: any; count: number }): any[] {
return new Array(options.count).fill(options.item)
}
const getPaymentChannel = {
normal: normalPayChan,
@@ -162,9 +151,6 @@ const getOrderbook = {
}
const getPaths = {
XrpToUsd,
XrpToXrp,
UsdToUsd,
sendAll,
}
@@ -220,16 +206,6 @@ const getTransactions = {
one: oneTransaction,
}
const getTrustlines = {
filtered: filteredLines,
moreThan400Items: buildList({
item: trustlineItems,
count: 401,
}),
all: allTrustlines,
ripplingDisabled: ripplingDisabledLines,
}
const getLedger = {
header,
headerByHash,
@@ -377,7 +353,6 @@ const responses = {
getPaths,
getTransaction,
getTransactions,
getTrustlines,
getLedger,
prepareOrder,
prepareOrderCancellation,