mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
refactor: migrate fixtures to use typescript (#1565)
* refactor: migrate fixtures to typescript
This commit is contained in:
committed by
Mayukha Vadari
parent
6268b9ea26
commit
75f0bb4617
109
test/fixtures/requests/index.js
vendored
109
test/fixtures/requests/index.js
vendored
@@ -1,109 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
prepareOrder: {
|
||||
buy: require('./prepareOrder'),
|
||||
sell: require('./prepareOrderSell'),
|
||||
expiration: require('./prepareOrderExpiration')
|
||||
},
|
||||
prepareOrderCancellation: {
|
||||
simple: require('./prepareOrderCancellation'),
|
||||
withMemos: require('./prepareOrderCancellationMemos')
|
||||
},
|
||||
preparePayment: {
|
||||
normal: require('./preparePayment'),
|
||||
minAmountXRP: require('./preparePaymentMinXrp'),
|
||||
minAmount: require('./preparePaymentMin'),
|
||||
wrongAddress: require('./preparePaymentWrongAddress'),
|
||||
wrongAmount: require('./preparePaymentWrongAmount'),
|
||||
wrongPartial: require('./preparePaymentWrongPartial'),
|
||||
allOptions: require('./preparePaymentAllOptions'),
|
||||
noCounterparty: require('./preparePaymentNoCounterparty')
|
||||
},
|
||||
prepareSettings: {
|
||||
domain: require('./prepareSettings'),
|
||||
noSignerEntries: require('./prepareSettingsNoSignerEntries'),
|
||||
signers: {
|
||||
normal: require('./prepareSettingsSigners'),
|
||||
noThreshold: require('./prepareSettingsSignersNoThreshold'),
|
||||
noWeights: require('./prepareSettingsSignersNoWeights')
|
||||
}
|
||||
},
|
||||
prepareEscrowCreation: {
|
||||
normal: require('./prepareEscrowCreation'),
|
||||
full: require('./prepareEscrowCreationFull')
|
||||
},
|
||||
prepareEscrowExecution: {
|
||||
normal: require('./prepareEscrowExecution'),
|
||||
simple: require('./prepareEscrowExecutionSimple'),
|
||||
noCondition: require('./prepareEscrowExecutionNoCondition'),
|
||||
noFulfillment: require('./prepareEscrowExecutionNoFulfillment')
|
||||
},
|
||||
prepareEscrowCancellation: {
|
||||
normal: require('./prepareEscrowCancellation'),
|
||||
memos: require('./prepareEscrowCancellationMemos')
|
||||
},
|
||||
prepareCheckCreate: {
|
||||
normal: require('./prepareCheckCreate'),
|
||||
full: require('./prepareCheckCreateFull')
|
||||
},
|
||||
prepareCheckCash: {
|
||||
amount: require('./prepareCheckCashAmount'),
|
||||
deliverMin: require('./prepareCheckCashDelivermin')
|
||||
},
|
||||
prepareCheckCancel: {
|
||||
normal: require('./prepareCheckCancel')
|
||||
},
|
||||
preparePaymentChannelCreate: {
|
||||
normal: require('./preparePaymentChannelCreate'),
|
||||
full: require('./preparePaymentChannelCreateFull')
|
||||
},
|
||||
preparePaymentChannelFund: {
|
||||
normal: require('./preparePaymentChannelFund'),
|
||||
full: require('./preparePaymentChannelFundFull')
|
||||
},
|
||||
preparePaymentChannelClaim: {
|
||||
normal: require('./preparePaymentChannelClaim'),
|
||||
full: require('./preparePaymentChannelClaimFull'),
|
||||
close: require('./preparePaymentChannelClaimClose'),
|
||||
renew: require('./preparePaymentChannelClaimRenew'),
|
||||
noSignature: require('./preparePaymentChannelClaimNoSignature')
|
||||
},
|
||||
prepareTrustline: {
|
||||
simple: require('./prepareTrustlineSimple'),
|
||||
complex: require('./prepareTrustline'),
|
||||
frozen: require('./prepareTrustlineFrozen.json'),
|
||||
issuedXAddress: require('./prepareTrustlineIssuerXaddress.json')
|
||||
},
|
||||
sign: {
|
||||
normal: require('./sign'),
|
||||
ticket: require('./signTicket'),
|
||||
escrow: require('./signEscrow.json'),
|
||||
signAs: require('./signAs')
|
||||
},
|
||||
signPaymentChannelClaim: require('./signPaymentChannelClaim'),
|
||||
getPaths: {
|
||||
normal: require('./getpaths/normal'),
|
||||
UsdToUsd: require('./getpaths/usd2usd'),
|
||||
XrpToXrp: require('./getpaths/xrp2xrp'),
|
||||
XrpToXrpNotEnough: require('./getpaths/xrp2xrpNotEnough'),
|
||||
NotAcceptCurrency: require('./getpaths/notAcceptCurrency'),
|
||||
NoPaths: require('./getpaths/noPaths'),
|
||||
NoPathsSource: require('./getpaths/noPathsSourceAmount'),
|
||||
NoPathsWithCurrencies: require('./getpaths/noPathsWithCurrencies'),
|
||||
sendAll: require('./getpaths/sendAll'),
|
||||
invalid: require('./getpaths/invalid'),
|
||||
issuer: require('./getpaths/issuer')
|
||||
},
|
||||
getOrderbook: {
|
||||
normal: require('./getOrderbook'),
|
||||
withXRP: require('./getOrderbookWithXrp')
|
||||
},
|
||||
computeLedgerHash: {
|
||||
header: require('./computeLedgerHash'),
|
||||
transactions: require('./computeLedgerHashTransactions')
|
||||
},
|
||||
combine: {
|
||||
setDomain: require('./combine.json')
|
||||
}
|
||||
};
|
||||
212
test/fixtures/requests/index.ts
vendored
Normal file
212
test/fixtures/requests/index.ts
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
import setDomain from './combine.json'
|
||||
import transactions from './computeLedgerHashTransactions.json'
|
||||
import header from './computeLedgerHash.json'
|
||||
import withXRPOrderBook from './getOrderbookWithXrp.json'
|
||||
import normalOrderBook from './getOrderbook.json'
|
||||
import invalid from './getpaths/invalid.json'
|
||||
import issuer from './getpaths/issuer.json'
|
||||
import NoPathsSource from './getpaths/noPathsSourceAmount.json'
|
||||
import NoPathsWithCurrencies from './getpaths/noPathsWithCurrencies.json'
|
||||
import NoPaths from './getpaths/noPaths.json'
|
||||
import normalPaths from './getpaths/normal.json'
|
||||
import NotAcceptCurrency from './getpaths/notAcceptCurrency.json'
|
||||
import sendAll from './getpaths/sendAll.json'
|
||||
import UsdToUsd from './getpaths/usd2usd.json'
|
||||
import XrpToXrpNotEnough from './getpaths/xrp2xrpNotEnough.json'
|
||||
import XrpToXrp from './getpaths/xrp2xrp.json'
|
||||
import normalCheckCancel from './prepareCheckCancel.json'
|
||||
import amountCheckCash from './prepareCheckCashAmount.json'
|
||||
import deliverMinCheckCash from './prepareCheckCashDelivermin.json'
|
||||
import fullCheckCreate from './prepareCheckCreateFull.json'
|
||||
import normalCheckCreate from './prepareCheckCreate.json'
|
||||
import memosEscrowCancel from './prepareEscrowCancellationMemos.json'
|
||||
import normalEscrowCancel from './prepareEscrowCancellation.json'
|
||||
import fullEscrowCreate from './prepareEscrowCreationFull.json'
|
||||
import normalEscrowCreate from './prepareEscrowCreation.json'
|
||||
import noConditionEscrowExec from './prepareEscrowExecutionNoCondition.json'
|
||||
import noFulfillmentEscrowExec from './prepareEscrowExecutionNoFulfillment.json'
|
||||
import simpleEscrowExec from './prepareEscrowExecutionSimple.json'
|
||||
import normalEscrowExec from './prepareEscrowExecution.json'
|
||||
import withMemosCancel from './prepareOrderCancellationMemos.json'
|
||||
import simpleCancel from './prepareOrderCancellation.json'
|
||||
import expirationOrder from './prepareOrderExpiration.json'
|
||||
import sellOrder from './prepareOrderSell.json'
|
||||
import buyOrder from './prepareOrder.json'
|
||||
import allOptions from './preparePaymentAllOptions.json'
|
||||
import closePayChanClaim from './preparePaymentChannelClaimClose.json'
|
||||
import fullPayChanClaim from './preparePaymentChannelClaimFull.json'
|
||||
import noSignaturePayChanClaim from './preparePaymentChannelClaimNoSignature.json'
|
||||
import renewPayChanClaim from './preparePaymentChannelClaimRenew.json'
|
||||
import normalPayChanClaim from './preparePaymentChannelClaim.json'
|
||||
import fullPayChanCreate from './preparePaymentChannelCreateFull.json'
|
||||
import normalPayChanCreate from './preparePaymentChannelCreate.json'
|
||||
import fullPayChanFund from './preparePaymentChannelFundFull.json'
|
||||
import normalPayChanFund from './preparePaymentChannelFund.json'
|
||||
import minAmountXRP from './preparePaymentMinXrp.json'
|
||||
import minAmount from './preparePaymentMin.json'
|
||||
import noCounterparty from './preparePaymentNoCounterparty.json'
|
||||
import wrongAddress from './preparePaymentWrongAddress.json'
|
||||
import wrongAmount from './preparePaymentWrongAmount.json'
|
||||
import wrongPartial from './preparePaymentWrongPartial.json'
|
||||
import normalPayment from './preparePayment.json'
|
||||
import noSignerEntries from './prepareSettingsNoSignerEntries.json'
|
||||
import noThresholdSigners from './prepareSettingsSignersNoThreshold.json'
|
||||
import noWeightsSigners from './prepareSettingsSignersNoWeights.json'
|
||||
import normalSigners from './prepareSettingsSigners.json'
|
||||
import domain from './prepareSettings.json'
|
||||
import frozenTrustline from './prepareTrustlineFrozen.json'
|
||||
import issuedXAddressTrustline from './prepareTrustlineIssuerXaddress.json'
|
||||
import simpleTrustline from './prepareTrustlineSimple.json'
|
||||
import complexTrustline from './prepareTrustline.json'
|
||||
import signAsSign from './signAs.json'
|
||||
import escrowSign from './signEscrow.json'
|
||||
import signPaymentChannelClaim from './signPaymentChannelClaim.json'
|
||||
import ticketSign from './signTicket.json'
|
||||
import normalSign from './sign.json'
|
||||
|
||||
const prepareOrder = {
|
||||
buy: buyOrder,
|
||||
sell: sellOrder,
|
||||
expiration: expirationOrder
|
||||
}
|
||||
|
||||
const prepareOrderCancellation = {
|
||||
simple: simpleCancel,
|
||||
withMemos: withMemosCancel
|
||||
}
|
||||
|
||||
const preparePayment = {
|
||||
normal: normalPayment,
|
||||
minAmountXRP,
|
||||
minAmount,
|
||||
wrongAddress,
|
||||
wrongAmount,
|
||||
wrongPartial,
|
||||
allOptions,
|
||||
noCounterparty
|
||||
}
|
||||
|
||||
const prepareSettings = {
|
||||
domain,
|
||||
noSignerEntries,
|
||||
signers: {
|
||||
normal: normalSigners,
|
||||
noThreshold: noThresholdSigners,
|
||||
noWeights: noWeightsSigners
|
||||
}
|
||||
}
|
||||
const prepareEscrowCreation = {
|
||||
normal: normalEscrowCreate,
|
||||
full: fullEscrowCreate
|
||||
}
|
||||
|
||||
const prepareEscrowExecution = {
|
||||
normal: normalEscrowExec,
|
||||
simple: simpleEscrowExec,
|
||||
noCondition: noConditionEscrowExec,
|
||||
noFulfillment: noFulfillmentEscrowExec
|
||||
}
|
||||
|
||||
const prepareEscrowCancellation = {
|
||||
normal: normalEscrowCancel,
|
||||
memos: memosEscrowCancel
|
||||
}
|
||||
|
||||
const prepareCheckCreate = {
|
||||
normal: normalCheckCreate,
|
||||
full: fullCheckCreate
|
||||
}
|
||||
|
||||
const prepareCheckCash = {
|
||||
amount: amountCheckCash,
|
||||
deliverMin: deliverMinCheckCash
|
||||
}
|
||||
|
||||
const prepareCheckCancel = {
|
||||
normal: normalCheckCancel
|
||||
}
|
||||
|
||||
const preparePaymentChannelCreate = {
|
||||
normal: normalPayChanCreate,
|
||||
full: fullPayChanCreate
|
||||
}
|
||||
|
||||
const preparePaymentChannelFund = {
|
||||
normal: normalPayChanFund,
|
||||
full: fullPayChanFund
|
||||
}
|
||||
|
||||
const preparePaymentChannelClaim = {
|
||||
normal: normalPayChanClaim,
|
||||
full: fullPayChanClaim,
|
||||
close: closePayChanClaim,
|
||||
renew: renewPayChanClaim,
|
||||
noSignature: noSignaturePayChanClaim
|
||||
}
|
||||
|
||||
const prepareTrustline = {
|
||||
simple: simpleTrustline,
|
||||
complex: complexTrustline,
|
||||
frozen: frozenTrustline,
|
||||
issuedXAddress: issuedXAddressTrustline
|
||||
}
|
||||
|
||||
const sign = {
|
||||
normal: normalSign,
|
||||
ticket: ticketSign,
|
||||
escrow: escrowSign,
|
||||
signAs: signAsSign
|
||||
}
|
||||
|
||||
const getPaths = {
|
||||
normal: normalPaths,
|
||||
UsdToUsd,
|
||||
XrpToXrp,
|
||||
XrpToXrpNotEnough,
|
||||
NotAcceptCurrency,
|
||||
NoPaths,
|
||||
NoPathsSource,
|
||||
NoPathsWithCurrencies,
|
||||
sendAll,
|
||||
invalid,
|
||||
issuer
|
||||
}
|
||||
|
||||
const getOrderbook = {
|
||||
normal: normalOrderBook,
|
||||
withXRP: withXRPOrderBook
|
||||
}
|
||||
|
||||
const computeLedgerHash = {
|
||||
header: {...header, rawTransactions: JSON.stringify(transactions)},
|
||||
transactions
|
||||
}
|
||||
|
||||
const combine = {
|
||||
setDomain
|
||||
}
|
||||
|
||||
const requests = {
|
||||
combine,
|
||||
computeLedgerHash,
|
||||
getOrderbook,
|
||||
getPaths,
|
||||
prepareCheckCash,
|
||||
prepareCheckCancel,
|
||||
prepareCheckCreate,
|
||||
prepareEscrowCancellation,
|
||||
prepareEscrowCreation,
|
||||
prepareEscrowExecution,
|
||||
prepareOrder,
|
||||
prepareOrderCancellation,
|
||||
preparePayment,
|
||||
preparePaymentChannelClaim,
|
||||
preparePaymentChannelCreate,
|
||||
preparePaymentChannelFund,
|
||||
prepareTrustline,
|
||||
prepareSettings,
|
||||
sign,
|
||||
signPaymentChannelClaim
|
||||
}
|
||||
|
||||
export default requests
|
||||
223
test/fixtures/responses/index.js
vendored
223
test/fixtures/responses/index.js
vendored
@@ -1,223 +0,0 @@
|
||||
'use strict'; // eslint-disable-line strict
|
||||
|
||||
function buildList(options) {
|
||||
return new Array(options.count).fill(options.item);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateXAddress: require('./generateXAddress.json'),
|
||||
generateAddress: require('./generateAddress.json'),
|
||||
getAccountInfo: require('./getAccountInfo.json'),
|
||||
getAccountObjects: require('./getAccountObjects.json'),
|
||||
getBalances: require('./getBalances.json'),
|
||||
getBalanceSheet: require('./getBalanceSheet.json'),
|
||||
getOrderbook: {
|
||||
normal: require('./getOrderbook.json'),
|
||||
withXRP: require('./getOrderbookWithXrp.json')
|
||||
},
|
||||
getOrders: require('./getOrders.json'),
|
||||
getPaths: {
|
||||
XrpToUsd: require('./getPaths.json'),
|
||||
UsdToUsd: require('./getPathsSendUsd.json'),
|
||||
XrpToXrp: require('./getPathsXrpToXrp.json'),
|
||||
sendAll: require('./getPathsSendAll.json')
|
||||
},
|
||||
getPaymentChannel: {
|
||||
normal: require('./getPaymentChannel.json'),
|
||||
full: require('./getPaymentChannelFull.json')
|
||||
},
|
||||
getServerInfo: require('./getServerInfo.json'),
|
||||
getSettings: require('./getSettings.json'),
|
||||
getTransaction: {
|
||||
orderCancellation: require('./getTransactionOrderCancellation.json'),
|
||||
orderCancellationWithMemo: require('./getTransactionOrderCancellationWithMemo.json'),
|
||||
orderWithExpirationCancellation:
|
||||
require('./getTransactionOrderWithExpirationCancellation.json'),
|
||||
order: require('./getTransactionOrder.json'),
|
||||
orderWithMemo: require('./getTransactionOrderWithMemo.json'),
|
||||
orderSell: require('./getTransactionOrderSell.json'),
|
||||
noMeta: require('./getTransactionNoMeta.json'),
|
||||
payment: require('./getTransactionPayment.json'),
|
||||
paymentIncludeRawTransaction: require('./getTransactionPaymentIncludeRawTransaction.json'),
|
||||
settings: require('./getTransactionSettings.json'),
|
||||
trustline: require('./getTransactionTrustlineSet.json'),
|
||||
trackingOn: require('./getTransactionSettingsTrackingOn.json'),
|
||||
trackingOff: require('./getTransactionSettingsTrackingOff.json'),
|
||||
setRegularKey: require('./getTransactionSettingsSetRegularKey.json'),
|
||||
trustlineFrozenOff: require('./getTransactionTrustSetFrozenOff.json'),
|
||||
trustlineNoQuality: require('./getTransactionTrustNoQuality.json'),
|
||||
trustlineAddMemo: require('./getTransactionTrustAddMemo.json'),
|
||||
notValidated: require('./getTransactionNotValidated.json'),
|
||||
checkCreate:
|
||||
require('./getTransactionCheckCreate.json'),
|
||||
checkCreateWithMemo:
|
||||
require('./getTransactionCheckCreateWithMemo.json'),
|
||||
checkCancel:
|
||||
require('./getTransactionCheckCancel.json'),
|
||||
checkCancelWithMemo:
|
||||
require('./getTransactionCheckCancelWithMemo.json'),
|
||||
checkCash:
|
||||
require('./getTransactionCheckCash.json'),
|
||||
checkCashWithMemo:
|
||||
require('./getTransactionCheckCashWithMemo.json'),
|
||||
depositPreauthWithMemo:
|
||||
require('./getTransactionDepositPreauthWithMemo.json'),
|
||||
escrowCreation:
|
||||
require('./getTransactionEscrowCreation.json'),
|
||||
escrowCancellation:
|
||||
require('./getTransactionEscrowCancellation.json'),
|
||||
escrowExecution:
|
||||
require('./getTransactionEscrowExecution.json'),
|
||||
escrowExecutionSimple:
|
||||
require('./getTransactionEscrowExecutionSimple.json'),
|
||||
paymentChannelCreate:
|
||||
require('./getTransactionPaymentChannelCreate.json'),
|
||||
paymentChannelCreateWithMemo:
|
||||
require('./getTransactionPaymentChannelCreateWithMemo.json'),
|
||||
paymentChannelFund:
|
||||
require('./getTransactionPaymentChannelFund.json'),
|
||||
paymentChannelFundWithMemo:
|
||||
require('./getTransactionPaymentChannelFundWithMemo.json'),
|
||||
paymentChannelClaim:
|
||||
require('./getTransactionPaymentChannelClaim.json'),
|
||||
paymentChannelClaimWithMemo:
|
||||
require('./getTransactionPaymentChannelClaimWithMemo.json'),
|
||||
amendment: require('./getTransactionAmendment.json'),
|
||||
feeUpdate: require('./getTransactionFeeUpdate.json'),
|
||||
feeUpdateWithMemo: require('./getTransactionFeeUpdateWithMemo.json'),
|
||||
accountDelete: require('./getTransactionAccountDelete.json'),
|
||||
accountDeleteWithMemo: require('./getTransactionAccountDeleteWithMemo.json'),
|
||||
ticketCreateWithMemo: require('./getTransactionTicketCreateWithMemo.json'),
|
||||
withMemo: require('./getTransactionWithMemo.json'),
|
||||
withMemos: require('./getTransactionWithMemos.json')
|
||||
},
|
||||
getTransactions: {
|
||||
normal: require('./getTransactions.json'),
|
||||
includeRawTransactions: require('./getTransactionsIncludeRawTransactions.json'),
|
||||
one: require('./getTransactionsOne.json')
|
||||
},
|
||||
getTrustlines: {
|
||||
filtered: require('./getTrustlines.json'),
|
||||
moreThan400Items: buildList({
|
||||
item: require('./trustlineItem.json'),
|
||||
count: 401
|
||||
}),
|
||||
all: require('./getTrustlinesAll.json'),
|
||||
ripplingDisabled: require('./getTrustlinesRipplingDisabled.json')
|
||||
},
|
||||
getLedger: {
|
||||
header: require('./getLedger'),
|
||||
headerByHash: require('./getLedgerByHash'),
|
||||
full: require('./getLedgerFull'),
|
||||
withSettingsTx: require('./getLedgerWithSettingsTx'),
|
||||
withStateAsHashes: require('./getLedgerWithStateAsHashes'),
|
||||
withPartial: require('./getLedgerWithPartialPayment'),
|
||||
pre2014withPartial: require('./getLedgerPre2014WithPartial')
|
||||
},
|
||||
prepareOrder: {
|
||||
buy: require('./prepareOrder.json'),
|
||||
ticket: require('./prepareOrderTicket.json'),
|
||||
sell: require('./prepareOrderSell.json'),
|
||||
expiration: require('./prepareOrderExpiration')
|
||||
},
|
||||
prepareOrderCancellation: {
|
||||
normal: require('./prepareOrderCancellation.json'),
|
||||
ticket: require('./prepareOrderCancellationTicket.json'),
|
||||
withMemos: require('./prepareOrderCancellationMemos.json'),
|
||||
noInstructions: require('./prepareOrderCancellationNoInstructions.json')
|
||||
},
|
||||
preparePayment: {
|
||||
normal: require('./preparePayment.json'),
|
||||
ticket: require('./preparePaymentTicket'),
|
||||
minAmountXRP: require('./preparePaymentMinAmountXrp.json'),
|
||||
minAmountXRPXRP: require('./preparePaymentMinAmountXrpXrp.json'),
|
||||
allOptions: require('./preparePaymentAllOptions.json'),
|
||||
noCounterparty: require('./preparePaymentNoCounterparty.json'),
|
||||
minAmount: require('./preparePaymentMinAmount.json'),
|
||||
ticketSequence: require('./preparePaymentTicketSequence.json')
|
||||
},
|
||||
prepareSettings: {
|
||||
regularKey: require('./prepareSettingsRegularKey.json'),
|
||||
removeRegularKey: require('./prepareSettingsRemoveRegularKey.json'),
|
||||
flags: require('./prepareSettings.json'),
|
||||
ticket: require('./prepareSettingsTicket.json'),
|
||||
flagsMultisign: require('./prepareSettingsMultisign.json'),
|
||||
flagSet: require('./prepareSettingsFlagSet.json'),
|
||||
flagClear: require('./prepareSettingsFlagClear.json'),
|
||||
flagSetDepositAuth: require('./prepareSettingsFlagSetDepositAuth.json'),
|
||||
flagClearDepositAuth: require('./prepareSettingsFlagClearDepositAuth.json'),
|
||||
setTransferRate: require('./prepareSettingsSetTransferRate.json'),
|
||||
fieldClear: require('./prepareSettingsFieldClear.json'),
|
||||
noInstructions: require('./prepareSettingsNoInstructions.json'),
|
||||
signed: require('./prepareSettingsSigned.json'),
|
||||
noMaxLedgerVersion: require('./prepareSettingsNoMaxledgerversion.json'),
|
||||
signers: require('./prepareSettingsSigners.json'),
|
||||
noSignerList: require('./prepareSettingsNoSignerList.json'),
|
||||
noWeights: require('./prepareSettingsNoWeight.json')
|
||||
},
|
||||
prepareCheckCreate: {
|
||||
normal: require('./prepareCheckCreate'),
|
||||
ticket: require('./prepareCheckCreateTicket'),
|
||||
full: require('./prepareCheckCreateFull')
|
||||
},
|
||||
prepareCheckCash: {
|
||||
amount: require('./prepareCheckCashAmount'),
|
||||
ticket: require('./prepareCheckCashTicket'),
|
||||
deliverMin: require('./prepareCheckCashDelivermin')
|
||||
},
|
||||
prepareCheckCancel: {
|
||||
normal: require('./prepareCheckCancel'),
|
||||
ticket: require('./prepareCheckCancelTicket')
|
||||
},
|
||||
prepareEscrowCreation: {
|
||||
normal: require('./prepareEscrowCreation'),
|
||||
ticket: require('./prepareEscrowCreationTicket'),
|
||||
full: require('./prepareEscrowCreationFull')
|
||||
},
|
||||
prepareEscrowExecution: {
|
||||
normal: require('./prepareEscrowExecution'),
|
||||
ticket: require('./prepareEscrowExecutionTicket'),
|
||||
simple: require('./prepareEscrowExecutionSimple')
|
||||
},
|
||||
prepareEscrowCancellation: {
|
||||
normal: require('./prepareEscrowCancellation'),
|
||||
ticket: require('./prepareEscrowCancellationTicket'),
|
||||
memos: require('./prepareEscrowCancellationMemos')
|
||||
},
|
||||
preparePaymentChannelCreate: {
|
||||
normal: require('./preparePaymentChannelCreate'),
|
||||
ticket: require('./preparePaymentChannelCreateTicket'),
|
||||
full: require('./preparePaymentChannelCreateFull')
|
||||
},
|
||||
preparePaymentChannelFund: {
|
||||
normal: require('./preparePaymentChannelFund'),
|
||||
ticket: require('./preparePaymentChannelFundTicket'),
|
||||
full: require('./preparePaymentChannelFundFull')
|
||||
},
|
||||
preparePaymentChannelClaim: {
|
||||
normal: require('./preparePaymentChannelClaim'),
|
||||
ticket: require('./preparePaymentChannelClaimTicket'),
|
||||
renew: require('./preparePaymentChannelClaimRenew'),
|
||||
close: require('./preparePaymentChannelClaimClose')
|
||||
},
|
||||
prepareTrustline: {
|
||||
simple: require('./prepareTrustlineSimple'),
|
||||
ticket: require('./prepareTrustlineTicket'),
|
||||
frozen: require('./prepareTrustlineFrozen'),
|
||||
issuedXAddress: require('./prepareTrustlineIssuerXaddress.json'),
|
||||
complex: require('./prepareTrustline')
|
||||
},
|
||||
sign: {
|
||||
normal: require('./sign'),
|
||||
ticket: require('./signTicket'),
|
||||
escrow: require('./signEscrow'),
|
||||
signAs: require('./signAs')
|
||||
},
|
||||
signPaymentChannelClaim: require('./signPaymentChannelClaim'),
|
||||
combine: {
|
||||
single: require('./combine')
|
||||
},
|
||||
submit: require('./submit'),
|
||||
ledgerEvent: require('./ledgerEvent'),
|
||||
generateFaucetWallet: require('./generateFaucetWallet.json')
|
||||
};
|
||||
400
test/fixtures/responses/index.ts
vendored
Normal file
400
test/fixtures/responses/index.ts
vendored
Normal file
@@ -0,0 +1,400 @@
|
||||
import singleCombine from './combine.json'
|
||||
import generateAddress from './generateAddress.json'
|
||||
import generateFaucetWallet from './generateFaucetWallet.json'
|
||||
import generateXAddress from './generateXAddress.json'
|
||||
import getAccountInfo from './getAccountInfo.json'
|
||||
import getAccountObjects from './getAccountObjects.json'
|
||||
import getBalanceSheet from './getBalanceSheet.json'
|
||||
import getBalances from './getBalances.json'
|
||||
import headerByHash from './getLedgerByHash.json'
|
||||
import fullLedger from './getLedgerFull.json'
|
||||
import pre2014withPartial from './getLedgerPre2014WithPartial.json'
|
||||
import withPartial from './getLedgerWithPartialPayment.json'
|
||||
import withSettingsTx from './getLedgerWithSettingsTx.json'
|
||||
import withStateAsHashes from './getLedgerWithStateAsHashes.json'
|
||||
import header from './getLedger.json'
|
||||
import withXRPOrderBook from './getOrderbookWithXrp.json'
|
||||
import normalOrderBook from './getOrderbook.json'
|
||||
import getOrders from './getOrders.json'
|
||||
import sendAll from './getPathsSendAll.json'
|
||||
import UsdToUsd from './getPathsSendUsd.json'
|
||||
import XrpToXrp from './getPathsXrpToXrp.json'
|
||||
import XrpToUsd from './getPaths.json'
|
||||
import fullPayChan from './getPaymentChannelFull.json'
|
||||
import normalPayChan from './getPaymentChannel.json'
|
||||
import getServerInfo from './getServerInfo.json'
|
||||
import getSettings from './getSettings.json'
|
||||
import accountDeleteWithMemo from './getTransactionAccountDeleteWithMemo.json'
|
||||
import accountDelete from './getTransactionAccountDelete.json'
|
||||
import amendment from './getTransactionAmendment.json'
|
||||
import checkCancelWithMemo from './getTransactionCheckCancelWithMemo.json'
|
||||
import checkCancel from './getTransactionCheckCancel.json'
|
||||
import checkCashWithMemo from './getTransactionCheckCashWithMemo.json'
|
||||
import checkCash from './getTransactionCheckCash.json'
|
||||
import checkCreateWithMemo from './getTransactionCheckCreateWithMemo.json'
|
||||
import checkCreate from './getTransactionCheckCreate.json'
|
||||
import depositPreauthWithMemo from './getTransactionDepositPreauthWithMemo.json'
|
||||
import escrowCancellation from './getTransactionEscrowCancellation.json'
|
||||
import escrowCreation from './getTransactionEscrowCreation.json'
|
||||
import escrowExecutionSimple from './getTransactionEscrowExecutionSimple.json'
|
||||
import escrowExecution from './getTransactionEscrowExecution.json'
|
||||
import feeUpdateWithMemo from './getTransactionFeeUpdateWithMemo.json'
|
||||
import feeUpdate from './getTransactionFeeUpdate.json'
|
||||
import noMeta from './getTransactionNoMeta.json'
|
||||
import notValidated from './getTransactionNotValidated.json'
|
||||
import orderCancellationWithMemo from './getTransactionOrderCancellationWithMemo.json'
|
||||
import orderCancellation from './getTransactionOrderCancellation.json'
|
||||
import orderSell from './getTransactionOrderSell.json'
|
||||
import orderWithExpirationCancellation from './getTransactionOrderWithExpirationCancellation.json'
|
||||
import orderWithMemo from './getTransactionOrderWithMemo.json'
|
||||
import order from './getTransactionOrder.json'
|
||||
import paymentChannelClaimWithMemo from './getTransactionPaymentChannelClaimWithMemo.json'
|
||||
import paymentChannelClaim from './getTransactionPaymentChannelClaim.json'
|
||||
import paymentChannelCreateWithMemo from './getTransactionPaymentChannelCreateWithMemo.json'
|
||||
import paymentChannelCreate from './getTransactionPaymentChannelCreate.json'
|
||||
import paymentChannelFundWithMemo from './getTransactionPaymentChannelFundWithMemo.json'
|
||||
import paymentChannelFund from './getTransactionPaymentChannelFund.json'
|
||||
import paymentIncludeRawTransaction from './getTransactionPaymentIncludeRawTransaction.json'
|
||||
import payment from './getTransactionPayment.json'
|
||||
import setRegularKey from './getTransactionSettingsSetRegularKey.json'
|
||||
import trackingOff from './getTransactionSettingsTrackingOff.json'
|
||||
import trackingOn from './getTransactionSettingsTrackingOn.json'
|
||||
import settings from './getTransactionSettings.json'
|
||||
import ticketCreateWithMemo from './getTransactionTicketCreateWithMemo.json'
|
||||
import trustlineAddMemo from './getTransactionTrustAddMemo.json'
|
||||
import trustlineNoQuality from './getTransactionTrustNoQuality.json'
|
||||
import trustlineFrozenOff from './getTransactionTrustSetFrozenOff.json'
|
||||
import trustline from './getTransactionTrustlineSet.json'
|
||||
import withMemo from './getTransactionWithMemo.json'
|
||||
import withMemos from './getTransactionWithMemos.json'
|
||||
import includeRawTransactions from './getTransactionsIncludeRawTransactions.json'
|
||||
import oneTransaction from './getTransactionsOne.json'
|
||||
import normalTransactions from './getTransactions.json'
|
||||
import allTrustlines from './getTrustlinesAll.json'
|
||||
import ripplingDisabledLines from './getTrustlinesRipplingDisabled.json'
|
||||
import filteredLines from './getTrustlines.json'
|
||||
import ledgerEvent from './ledgerEvent.json'
|
||||
import ticketCheckCancel from './prepareCheckCancelTicket.json'
|
||||
import normalCheckCancel from './prepareCheckCancel.json'
|
||||
import amountCheckCash from './prepareCheckCashAmount.json'
|
||||
import deliverMinCheckCash from './prepareCheckCashDelivermin.json'
|
||||
import ticketCheckCash from './prepareCheckCashTicket.json'
|
||||
import fullCheckCreate from './prepareCheckCreateFull.json'
|
||||
import ticketCheckCreate from './prepareCheckCreateTicket.json'
|
||||
import normalCheckCreate from './prepareCheckCreate.json'
|
||||
import memosEscrowCancel from './prepareEscrowCancellationMemos.json'
|
||||
import ticketEscrowCancel from './prepareEscrowCancellationTicket.json'
|
||||
import normalEscrowCancel from './prepareEscrowCancellation.json'
|
||||
import fullEscrowCreate from './prepareEscrowCreationFull.json'
|
||||
import ticketEscrowCreate from './prepareEscrowCreationTicket.json'
|
||||
import normalEscrowCreate from './prepareEscrowCreation.json'
|
||||
import simpleEscrowExec from './prepareEscrowExecutionSimple.json'
|
||||
import ticketEscrowExec from './prepareEscrowExecutionTicket.json'
|
||||
import normalEscrowExec from './prepareEscrowExecution.json'
|
||||
import withMemosCancel from './prepareOrderCancellationMemos.json'
|
||||
import noInstructionsCancel from './prepareOrderCancellationNoInstructions.json'
|
||||
import ticketCancel from './prepareOrderCancellationTicket.json'
|
||||
import normalCancel from './prepareOrderCancellation.json'
|
||||
import expirationOrder from './prepareOrderExpiration.json'
|
||||
import sellOrder from './prepareOrderSell.json'
|
||||
import ticketOrder from './prepareOrderTicket.json'
|
||||
import buyOrder from './prepareOrder.json'
|
||||
import allOptionsPayment from './preparePaymentAllOptions.json'
|
||||
import closePayChanClaim from './preparePaymentChannelClaimClose.json'
|
||||
import renewPayChanClaim from './preparePaymentChannelClaimRenew.json'
|
||||
import ticketPayChanClaim from './preparePaymentChannelClaimTicket.json'
|
||||
import normalPayChanClaim from './preparePaymentChannelClaim.json'
|
||||
import fullPayChanCreate from './preparePaymentChannelCreateFull.json'
|
||||
import ticketPayChanCreate from './preparePaymentChannelCreateTicket.json'
|
||||
import normalPayChanCreate from './preparePaymentChannelCreate.json'
|
||||
import fullPayChanFund from './preparePaymentChannelFundFull.json'
|
||||
import ticketPayChanFund from './preparePaymentChannelFundTicket.json'
|
||||
import normalPayChanFund from './preparePaymentChannelFund.json'
|
||||
import minAmountXRPXRPPayment from './preparePaymentMinAmountXrpXrp.json'
|
||||
import minAmountXRPPayment from './preparePaymentMinAmountXrp.json'
|
||||
import minAmountPayment from './preparePaymentMinAmount.json'
|
||||
import noCounterpartyPayment from './preparePaymentNoCounterparty.json'
|
||||
import ticketSequencePayment from './preparePaymentTicketSequence.json'
|
||||
import ticketPayment from './preparePaymentTicket.json'
|
||||
import normalPayment from './preparePayment.json'
|
||||
import fieldClear from './prepareSettingsFieldClear.json'
|
||||
import flagClearDepositAuth from './prepareSettingsFlagClearDepositAuth.json'
|
||||
import flagClear from './prepareSettingsFlagClear.json'
|
||||
import flagSetDepositAuth from './prepareSettingsFlagSetDepositAuth.json'
|
||||
import flagSet from './prepareSettingsFlagSet.json'
|
||||
import flagsMultisign from './prepareSettingsMultisign.json'
|
||||
import noInstructions from './prepareSettingsNoInstructions.json'
|
||||
import noMaxLedgerVersion from './prepareSettingsNoMaxledgerversion.json'
|
||||
import noSignerList from './prepareSettingsNoSignerList.json'
|
||||
import noWeights from './prepareSettingsNoWeight.json'
|
||||
import regularKey from './prepareSettingsRegularKey.json'
|
||||
import removeRegularKey from './prepareSettingsRemoveRegularKey.json'
|
||||
import setTransferRate from './prepareSettingsSetTransferRate.json'
|
||||
import signedSettings from './prepareSettingsSigned.json'
|
||||
import signersSettings from './prepareSettingsSigners.json'
|
||||
import ticketSettings from './prepareSettingsTicket.json'
|
||||
import flagsSettings from './prepareSettings.json'
|
||||
import frozenTrustline from './prepareTrustlineFrozen.json'
|
||||
import issuedXAddressTrustline from './prepareTrustlineIssuerXaddress.json'
|
||||
import simpleTrustline from './prepareTrustlineSimple.json'
|
||||
import ticketTrustline from './prepareTrustlineTicket.json'
|
||||
import complexTrustline from './prepareTrustline.json'
|
||||
import signAsSign from './signAs.json'
|
||||
import escrowSign from './signEscrow.json'
|
||||
import signPaymentChannelClaim from './signPaymentChannelClaim.json'
|
||||
import ticketSign from './signTicket.json'
|
||||
import normalSign from './sign.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,
|
||||
full: fullPayChan
|
||||
}
|
||||
|
||||
const getOrderbook = {
|
||||
normal: normalOrderBook,
|
||||
withXRP: withXRPOrderBook
|
||||
}
|
||||
|
||||
const getPaths = {
|
||||
XrpToUsd,
|
||||
XrpToXrp,
|
||||
UsdToUsd,
|
||||
sendAll
|
||||
}
|
||||
|
||||
const getTransaction = {
|
||||
orderCancellation,
|
||||
orderCancellationWithMemo,
|
||||
orderWithExpirationCancellation,
|
||||
order,
|
||||
orderWithMemo,
|
||||
orderSell,
|
||||
noMeta,
|
||||
payment,
|
||||
paymentIncludeRawTransaction,
|
||||
settings,
|
||||
trustline,
|
||||
trackingOn,
|
||||
trackingOff,
|
||||
setRegularKey,
|
||||
trustlineFrozenOff,
|
||||
trustlineNoQuality,
|
||||
trustlineAddMemo,
|
||||
notValidated,
|
||||
checkCreate,
|
||||
checkCreateWithMemo,
|
||||
checkCancel,
|
||||
checkCancelWithMemo,
|
||||
checkCash,
|
||||
checkCashWithMemo,
|
||||
depositPreauthWithMemo,
|
||||
escrowCreation,
|
||||
escrowCancellation,
|
||||
escrowExecution,
|
||||
escrowExecutionSimple,
|
||||
paymentChannelCreate,
|
||||
paymentChannelCreateWithMemo,
|
||||
paymentChannelFund,
|
||||
paymentChannelFundWithMemo,
|
||||
paymentChannelClaim,
|
||||
paymentChannelClaimWithMemo,
|
||||
amendment,
|
||||
feeUpdate,
|
||||
feeUpdateWithMemo,
|
||||
accountDelete,
|
||||
accountDeleteWithMemo,
|
||||
ticketCreateWithMemo,
|
||||
withMemo,
|
||||
withMemos
|
||||
}
|
||||
|
||||
const getTransactions = {
|
||||
normal: normalTransactions,
|
||||
includeRawTransactions,
|
||||
one: oneTransaction
|
||||
}
|
||||
|
||||
const getTrustlines = {
|
||||
filtered: filteredLines,
|
||||
moreThan400Items: buildList({
|
||||
item: trustlineItems,
|
||||
count: 401
|
||||
}),
|
||||
all: allTrustlines,
|
||||
ripplingDisabled: ripplingDisabledLines
|
||||
}
|
||||
|
||||
const getLedger = {
|
||||
header,
|
||||
headerByHash,
|
||||
full: fullLedger,
|
||||
withSettingsTx,
|
||||
withStateAsHashes,
|
||||
withPartial,
|
||||
pre2014withPartial
|
||||
}
|
||||
|
||||
const prepareOrder = {
|
||||
buy: buyOrder,
|
||||
ticket: ticketOrder,
|
||||
sell: sellOrder,
|
||||
expiration: expirationOrder
|
||||
}
|
||||
|
||||
const prepareOrderCancellation = {
|
||||
normal: normalCancel,
|
||||
ticket: ticketCancel,
|
||||
withMemos: withMemosCancel,
|
||||
noInstructions: noInstructionsCancel
|
||||
}
|
||||
|
||||
const preparePayment = {
|
||||
normal: normalPayment,
|
||||
ticket: ticketPayment,
|
||||
minAmountXRP: minAmountXRPPayment,
|
||||
minAmountXRPXRP: minAmountXRPXRPPayment,
|
||||
allOptions: allOptionsPayment,
|
||||
noCounterparty: noCounterpartyPayment,
|
||||
minAmount: minAmountPayment,
|
||||
ticketSequence: ticketSequencePayment
|
||||
}
|
||||
|
||||
const prepareSettings = {
|
||||
regularKey,
|
||||
removeRegularKey,
|
||||
flags: flagsSettings,
|
||||
ticket: ticketSettings,
|
||||
flagsMultisign,
|
||||
flagSet,
|
||||
flagClear,
|
||||
flagSetDepositAuth,
|
||||
flagClearDepositAuth,
|
||||
setTransferRate,
|
||||
fieldClear,
|
||||
noInstructions,
|
||||
signed: signedSettings,
|
||||
noMaxLedgerVersion,
|
||||
signers: signersSettings,
|
||||
noSignerList,
|
||||
noWeights
|
||||
}
|
||||
|
||||
const prepareCheckCreate = {
|
||||
normal: normalCheckCreate,
|
||||
ticket: ticketCheckCreate,
|
||||
full: fullCheckCreate
|
||||
}
|
||||
|
||||
const prepareCheckCash = {
|
||||
amount: amountCheckCash,
|
||||
ticket: ticketCheckCash,
|
||||
deliverMin: deliverMinCheckCash
|
||||
}
|
||||
|
||||
const prepareCheckCancel = {
|
||||
normal: normalCheckCancel,
|
||||
ticket: ticketCheckCancel
|
||||
}
|
||||
|
||||
const prepareEscrowCreation = {
|
||||
normal: normalEscrowCreate,
|
||||
ticket: ticketEscrowCreate,
|
||||
full: fullEscrowCreate
|
||||
}
|
||||
|
||||
const prepareEscrowExecution = {
|
||||
normal: normalEscrowExec,
|
||||
ticket: ticketEscrowExec,
|
||||
simple: simpleEscrowExec
|
||||
}
|
||||
|
||||
const prepareEscrowCancellation = {
|
||||
normal: normalEscrowCancel,
|
||||
ticket: ticketEscrowCancel,
|
||||
memos: memosEscrowCancel
|
||||
}
|
||||
|
||||
const preparePaymentChannelCreate = {
|
||||
normal: normalPayChanCreate,
|
||||
ticket: ticketPayChanCreate,
|
||||
full: fullPayChanCreate
|
||||
}
|
||||
|
||||
const preparePaymentChannelFund = {
|
||||
normal: normalPayChanFund,
|
||||
ticket: ticketPayChanFund,
|
||||
full: fullPayChanFund
|
||||
}
|
||||
|
||||
const preparePaymentChannelClaim = {
|
||||
normal: normalPayChanClaim,
|
||||
ticket: ticketPayChanClaim,
|
||||
renew: renewPayChanClaim,
|
||||
close: closePayChanClaim
|
||||
}
|
||||
|
||||
const prepareTrustline = {
|
||||
simple: simpleTrustline,
|
||||
ticket: ticketTrustline,
|
||||
frozen: frozenTrustline,
|
||||
issuedXAddress: issuedXAddressTrustline,
|
||||
complex: complexTrustline
|
||||
}
|
||||
|
||||
const sign = {
|
||||
normal: normalSign,
|
||||
ticket: ticketSign,
|
||||
escrow: escrowSign,
|
||||
signAs: signAsSign
|
||||
}
|
||||
|
||||
const combine = {
|
||||
single: singleCombine
|
||||
}
|
||||
|
||||
const responses = {
|
||||
generateAddress,
|
||||
generateFaucetWallet,
|
||||
generateXAddress,
|
||||
getAccountInfo,
|
||||
getAccountObjects,
|
||||
getBalanceSheet,
|
||||
getBalances,
|
||||
getOrders,
|
||||
getServerInfo,
|
||||
getSettings,
|
||||
ledgerEvent,
|
||||
signPaymentChannelClaim,
|
||||
submit,
|
||||
getPaymentChannel,
|
||||
getOrderbook,
|
||||
getPaths,
|
||||
getTransaction,
|
||||
getTransactions,
|
||||
getTrustlines,
|
||||
getLedger,
|
||||
prepareOrder,
|
||||
prepareOrderCancellation,
|
||||
preparePayment,
|
||||
prepareSettings,
|
||||
prepareCheckCreate,
|
||||
prepareCheckCash,
|
||||
prepareCheckCancel,
|
||||
prepareEscrowCreation,
|
||||
prepareEscrowExecution,
|
||||
prepareEscrowCancellation,
|
||||
preparePaymentChannelCreate,
|
||||
preparePaymentChannelFund,
|
||||
preparePaymentChannelClaim,
|
||||
prepareTrustline,
|
||||
sign,
|
||||
combine
|
||||
}
|
||||
|
||||
export default responses
|
||||
125
test/fixtures/rippled/index.js
vendored
125
test/fixtures/rippled/index.js
vendored
@@ -1,125 +0,0 @@
|
||||
'use strict'; // eslint-disable-line
|
||||
|
||||
module.exports = {
|
||||
submit: {
|
||||
success: require('./submit'),
|
||||
failure: require('./submitFailed')
|
||||
},
|
||||
ledger: {
|
||||
normal: require('./ledger'),
|
||||
normalByHash: require('./ledgerByHash'),
|
||||
notFound: require('./ledgerNotFound'),
|
||||
withoutCloseTime: require('./ledgerWithoutCloseTime'),
|
||||
withSettingsTx: require('./ledgerWithSettingsTx'),
|
||||
withStateAsHashes: require('./ledgerWithStateAsHashes'),
|
||||
withPartialPayment: require('./ledgerWithPartialPayment'),
|
||||
pre2014withPartial: require('./ledgerPre2014WithPartial')
|
||||
},
|
||||
fee: require('./fee'),
|
||||
empty: require('./empty'),
|
||||
subscribe: {
|
||||
success: require('./subscribe'),
|
||||
error: require('./subscribeError')
|
||||
},
|
||||
unsubscribe: require('./unsubscribe'),
|
||||
account_objects: {
|
||||
normal: require('./accountObjectsNormal'),
|
||||
// notfound: require('./accountObjectsNotFound')
|
||||
},
|
||||
account_info: {
|
||||
normal: require('./accountInfo'),
|
||||
notfound: require('./accountInfoNotFound')
|
||||
},
|
||||
account_offers: require('./accountOffers'),
|
||||
account_tx: {
|
||||
normal: require('./accountTx'),
|
||||
one: require('./getTransactionsOne')
|
||||
},
|
||||
escrow: require('./escrow'),
|
||||
gateway_balances: require('./gatewayBalances'),
|
||||
book_offers: {
|
||||
fabric: require('./bookOffers'),
|
||||
usd_xrp: require('./bookOffersUsdXrp'),
|
||||
xrp_usd: require('./bookOffersXrpUsd')
|
||||
},
|
||||
ledger_current: require('./ledgerCurrent'),
|
||||
ledger_data: {
|
||||
first_page: require('./ledgerDataFirstPage'),
|
||||
last_page: require('./ledgerDataLastPage')
|
||||
},
|
||||
ledger_entry: {
|
||||
error: require('./ledgerEntryError')
|
||||
},
|
||||
server_info: {
|
||||
normal: require('./serverInfo'),
|
||||
noValidated: require('./serverInfoNoValidated'),
|
||||
syncing: require('./serverInfoSyncing'),
|
||||
error: require('./serverInfoError'),
|
||||
reporting: require('./serverInfoReporting'),
|
||||
highLoadFactor: require('./serverInfoHighLoadFactor')
|
||||
},
|
||||
path_find: {
|
||||
generate: require('./pathFind'),
|
||||
sendUSD: require('./pathFindSendUsd'),
|
||||
sendAll: require('./pathFindSendAll'),
|
||||
XrpToXrp: require('./pathFindXrpToXrp'),
|
||||
srcActNotFound: require('./pathFindSrcActNotFound'),
|
||||
sourceAmountLow: require('./pathFindSrcAmtLow')
|
||||
},
|
||||
payment_channel: {
|
||||
normal: require('./paymentChannel'),
|
||||
full: require('./paymentChannelFull')
|
||||
},
|
||||
tx: {
|
||||
Payment: require('./tx/payment.json'),
|
||||
AccountSet: require('./tx/accountSet.json'),
|
||||
AccountSetTrackingOn: require('./tx/accountSetTrackingOn.json'),
|
||||
AccountSetTrackingOff: require('./tx/accountSetTrackingOff.json'),
|
||||
RegularKey: require('./tx/setRegularKey.json'),
|
||||
OfferCreate: require('./tx/offerCreate.json'),
|
||||
OfferCreateWithMemo: require('./tx/offerCreateWithMemo.json'),
|
||||
OfferCreateSell: require('./tx/offerCreateSell.json'),
|
||||
OfferCancel: require('./tx/offerCancel.json'),
|
||||
OfferCancelWithMemo: require('./tx/offerCancelWithMemo.json'),
|
||||
TrustSet: require('./tx/trustSet.json'),
|
||||
TrustSetFrozenOff: require('./tx/trustSetFrozenOff.json'),
|
||||
TrustSetNoQuality: require('./tx/trustSetNoQuality.json'),
|
||||
TrustSetAddMemo: require('./tx/trustSetAddMemo.json'),
|
||||
NotFound: require('./tx/notFound.json'),
|
||||
NoLedgerIndex: require('./tx/noLedgerIndex.json'),
|
||||
NoLedgerFound: require('./tx/noLedgerFound.json'),
|
||||
LedgerWithoutTime: require('./tx/ledgerWithoutTime.json'),
|
||||
NotValidated: require('./tx/notValidated.json'),
|
||||
OfferWithExpiration: require('./tx/orderWithExpiration.json'),
|
||||
CheckCreate: require('./tx/checkCreate.json'),
|
||||
CheckCreateWithMemo: require('./tx/checkCreateWithMemo.json'),
|
||||
CheckCancel: require('./tx/checkCancel.json'),
|
||||
CheckCancelWithMemo: require('./tx/checkCancelWithMemo.json'),
|
||||
CheckCash: require('./tx/checkCash.json'),
|
||||
CheckCashWithMemo: require('./tx/checkCashWithMemo.json'),
|
||||
EscrowCreation: require('./tx/escrowCreation.json'),
|
||||
EscrowCancellation:
|
||||
require('./tx/escrowCancellation.json'),
|
||||
EscrowExecution: require('./tx/escrowExecution.json'),
|
||||
EscrowExecutionSimple:
|
||||
require('./tx/escrowExecutionSimple.json'),
|
||||
PaymentChannelCreate: require('./tx/paymentChannelCreate.json'),
|
||||
PaymentChannelCreateWithMemo: require('./tx/paymentChannelCreateWithMemo.json'),
|
||||
PaymentChannelFund: require('./tx/paymentChannelFund.json'),
|
||||
PaymentChannelFundWithMemo: require('./tx/paymentChannelFundWithMemo.json'),
|
||||
PaymentChannelClaim: require('./tx/paymentChannelClaim.json'),
|
||||
PaymentChannelClaimWithMemo: require('./tx/paymentChannelClaimWithMemo.json'),
|
||||
Unrecognized: require('./tx/unrecognized.json'),
|
||||
NoMeta: require('./tx/noMeta.json'),
|
||||
LedgerZero: require('./tx/ledgerZero.json'),
|
||||
Amendment: require('./tx/amendment.json'),
|
||||
SetFee: require('./tx/setFee.json'),
|
||||
SetFeeWithMemo: require('./tx/setFeeWithMemo.json'),
|
||||
TicketCreateWithMemo: require('./tx/ticketCreateWithMemo.json'),
|
||||
DepositPreauthWithMemo: require('./tx/depositPreauthWithMemo.json'),
|
||||
AccountDelete: require('./tx/accountDelete.json'),
|
||||
AccountDeleteWithMemo: require('./tx/accountDeleteWithMemo.json'),
|
||||
WithMemo: require('./tx/withMemo.json'),
|
||||
WithMemos: require('./tx/withMemos.json')
|
||||
}
|
||||
};
|
||||
242
test/fixtures/rippled/index.ts
vendored
Normal file
242
test/fixtures/rippled/index.ts
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
import normalAccountInfo from "./accountInfo.json";
|
||||
import notfoundAccountInfo from "./accountInfoNotFound.json";
|
||||
import normalAccountObjects from "./accountObjectsNormal.json";
|
||||
import account_offers from "./accountOffers";
|
||||
import normalAccountTx from "./accountTx";
|
||||
import fabric from "./bookOffers";
|
||||
import usd_xrp from "./bookOffersUsdXrp.json";
|
||||
import empty from "./empty.json";
|
||||
import fee from "./fee.json";
|
||||
import normalLedger from "./ledger.json";
|
||||
import normalByHash from "./ledgerByHash.json";
|
||||
import notFound from "./ledgerNotFound.json";
|
||||
import withoutCloseTime from "./ledgerWithoutCloseTime.json";
|
||||
import withSettingsTx from "./ledgerWithSettingsTx.json";
|
||||
import withStateAsHashes from "./ledgerWithStateAsHashes.json";
|
||||
import withPartialPayment from "./ledgerWithPartialPayment.json";
|
||||
import pre2014withPartial from "./ledgerPre2014WithPartial.json";
|
||||
import normalServerInfo from "./serverInfo.json";
|
||||
import noValidated from "./serverInfoNoValidated.json";
|
||||
import successSubscribe from "./subscribe.json";
|
||||
import errorSubscribe from "./subscribeError.json";
|
||||
import unsubscribe from "./unsubscribe.json";
|
||||
import escrow from "./escrow.json";
|
||||
import gateway_balances from "./gatewayBalances.json";
|
||||
import Payment from "./tx/payment.json";
|
||||
import AccountSet from "./tx/accountSet.json";
|
||||
import AccountSetTrackingOn from "./tx/accountSetTrackingOn.json";
|
||||
import AccountSetTrackingOff from "./tx/accountSetTrackingOff.json";
|
||||
import RegularKey from "./tx/setRegularKey.json";
|
||||
import OfferCreate from "./tx/offerCreate.json";
|
||||
import OfferCreateWithMemo from "./tx/offerCreateWithMemo.json";
|
||||
import OfferCreateSell from "./tx/offerCreateSell.json";
|
||||
import OfferCancel from "./tx/offerCancel.json";
|
||||
import OfferCancelWithMemo from "./tx/offerCancelWithMemo.json";
|
||||
import TrustSet from "./tx/trustSet.json";
|
||||
import TrustSetFrozenOff from "./tx/trustSetFrozenOff.json";
|
||||
import TrustSetNoQuality from "./tx/trustSetNoQuality.json";
|
||||
import TrustSetAddMemo from "./tx/trustSetAddMemo.json";
|
||||
import NotFound from "./tx/notFound.json";
|
||||
import NoLedgerIndex from "./tx/noLedgerIndex.json";
|
||||
import NoLedgerFound from "./tx/noLedgerFound.json";
|
||||
import LedgerWithoutTime from "./tx/ledgerWithoutTime.json";
|
||||
import NotValidated from "./tx/notValidated.json";
|
||||
import OfferWithExpiration from "./tx/orderWithExpiration.json";
|
||||
import CheckCreate from "./tx/checkCreate.json";
|
||||
import CheckCreateWithMemo from "./tx/checkCreateWithMemo.json";
|
||||
import CheckCancel from "./tx/checkCancel.json";
|
||||
import CheckCancelWithMemo from "./tx/checkCancelWithMemo.json";
|
||||
import CheckCash from "./tx/checkCash.json";
|
||||
import CheckCashWithMemo from "./tx/checkCashWithMemo.json";
|
||||
import EscrowCreation from "./tx/escrowCreation.json";
|
||||
import EscrowCancellation from "./tx/escrowCancellation.json";
|
||||
import EscrowExecution from "./tx/escrowExecution.json";
|
||||
import EscrowExecutionSimple from "./tx/escrowExecutionSimple.json";
|
||||
import PaymentChannelCreate from "./tx/paymentChannelCreate.json";
|
||||
import PaymentChannelCreateWithMemo from "./tx/paymentChannelCreateWithMemo.json";
|
||||
import PaymentChannelFund from "./tx/paymentChannelFund.json";
|
||||
import PaymentChannelFundWithMemo from "./tx/paymentChannelFundWithMemo.json";
|
||||
import PaymentChannelClaim from "./tx/paymentChannelClaim.json";
|
||||
import PaymentChannelClaimWithMemo from "./tx/paymentChannelClaimWithMemo.json";
|
||||
import Unrecognized from "./tx/unrecognized.json";
|
||||
import NoMeta from "./tx/noMeta.json";
|
||||
import LedgerZero from "./tx/ledgerZero.json";
|
||||
import Amendment from "./tx/amendment.json";
|
||||
import SetFee from "./tx/setFee.json";
|
||||
import SetFeeWithMemo from "./tx/setFeeWithMemo.json";
|
||||
import TicketCreateWithMemo from "./tx/ticketCreateWithMemo.json";
|
||||
import DepositPreauthWithMemo from "./tx/depositPreauthWithMemo.json";
|
||||
import AccountDelete from "./tx/accountDelete.json";
|
||||
import AccountDeleteWithMemo from "./tx/accountDeleteWithMemo.json";
|
||||
import WithMemo from "./tx/withMemo.json";
|
||||
import WithMemos from "./tx/withMemos.json";
|
||||
import oneAccountTx from "./getTransactionsOne.json";
|
||||
import xrp_usd from "./bookOffersXrpUsd.json";
|
||||
import first_page from "./ledgerDataFirstPage.json";
|
||||
import last_page from "./ledgerDataLastPage.json";
|
||||
import errorLedgerEntry from "./ledgerEntryError.json";
|
||||
import syncing from "./serverInfoSyncing.json";
|
||||
import errorServerInfo from "./serverInfoError.json";
|
||||
import reporting from "./serverInfoReporting.json";
|
||||
import highLoadFactor from "./serverInfoHighLoadFactor.json";
|
||||
import normalPayChan from "./paymentChannel.json";
|
||||
import fullPayChan from "./paymentChannelFull.json";
|
||||
import generate from "./pathFind";
|
||||
import sendUSD from "./pathFindSendUsd.json";
|
||||
import sendAll from "./pathFindSendAll.json";
|
||||
import XrpToXrp from "./pathFindXrpToXrp.json";
|
||||
import srcActNotFound from "./pathFindSrcActNotFound.json";
|
||||
import sourceAmountLow from "./pathFindSrcAmtLow.json";
|
||||
import ledger_current from "./ledgerCurrent.json";
|
||||
import successSubmit from "./submit.json";
|
||||
import failureSubmit from "./submitFailed.json";
|
||||
|
||||
const submit = {
|
||||
success: successSubmit,
|
||||
failure: failureSubmit,
|
||||
};
|
||||
|
||||
const ledger = {
|
||||
normal: normalLedger,
|
||||
normalByHash,
|
||||
notFound,
|
||||
withoutCloseTime,
|
||||
withSettingsTx,
|
||||
withStateAsHashes,
|
||||
withPartialPayment,
|
||||
pre2014withPartial,
|
||||
};
|
||||
|
||||
const subscribe = {
|
||||
success: successSubscribe,
|
||||
error: errorSubscribe,
|
||||
};
|
||||
|
||||
const account_objects = {
|
||||
normal: normalAccountObjects,
|
||||
// notfound: notfoundAccountObjects
|
||||
};
|
||||
|
||||
const account_info = {
|
||||
normal: normalAccountInfo,
|
||||
notfound: notfoundAccountInfo,
|
||||
};
|
||||
|
||||
const account_tx = {
|
||||
normal: normalAccountTx,
|
||||
one: oneAccountTx,
|
||||
};
|
||||
|
||||
const book_offers = {
|
||||
fabric,
|
||||
usd_xrp,
|
||||
xrp_usd,
|
||||
};
|
||||
|
||||
const ledger_data = {
|
||||
first_page,
|
||||
last_page,
|
||||
};
|
||||
|
||||
const ledger_entry = {
|
||||
error: errorLedgerEntry,
|
||||
};
|
||||
|
||||
const server_info = {
|
||||
normal: normalServerInfo,
|
||||
noValidated,
|
||||
syncing,
|
||||
error: errorServerInfo,
|
||||
reporting,
|
||||
highLoadFactor,
|
||||
};
|
||||
|
||||
const path_find = {
|
||||
generate,
|
||||
sendUSD,
|
||||
sendAll,
|
||||
XrpToXrp,
|
||||
srcActNotFound,
|
||||
sourceAmountLow,
|
||||
};
|
||||
|
||||
const payment_channel = {
|
||||
normal: normalPayChan,
|
||||
full: fullPayChan,
|
||||
};
|
||||
|
||||
const tx = {
|
||||
Payment,
|
||||
AccountSet,
|
||||
AccountSetTrackingOn,
|
||||
AccountSetTrackingOff,
|
||||
RegularKey,
|
||||
OfferCreate,
|
||||
OfferCreateWithMemo,
|
||||
OfferCreateSell,
|
||||
OfferCancel,
|
||||
OfferCancelWithMemo,
|
||||
TrustSet,
|
||||
TrustSetFrozenOff,
|
||||
TrustSetNoQuality,
|
||||
TrustSetAddMemo,
|
||||
NotFound,
|
||||
NoLedgerIndex,
|
||||
NoLedgerFound,
|
||||
LedgerWithoutTime,
|
||||
NotValidated,
|
||||
OfferWithExpiration,
|
||||
CheckCreate,
|
||||
CheckCreateWithMemo,
|
||||
CheckCancel,
|
||||
CheckCancelWithMemo,
|
||||
CheckCash,
|
||||
CheckCashWithMemo,
|
||||
EscrowCreation,
|
||||
EscrowCancellation,
|
||||
EscrowExecution,
|
||||
EscrowExecutionSimple,
|
||||
PaymentChannelCreate,
|
||||
PaymentChannelCreateWithMemo,
|
||||
PaymentChannelFund,
|
||||
PaymentChannelFundWithMemo,
|
||||
PaymentChannelClaim,
|
||||
PaymentChannelClaimWithMemo,
|
||||
Unrecognized,
|
||||
NoMeta,
|
||||
LedgerZero,
|
||||
Amendment,
|
||||
SetFee,
|
||||
SetFeeWithMemo,
|
||||
TicketCreateWithMemo,
|
||||
DepositPreauthWithMemo,
|
||||
AccountDelete,
|
||||
AccountDeleteWithMemo,
|
||||
WithMemo,
|
||||
WithMemos,
|
||||
};
|
||||
|
||||
const rippled = {
|
||||
account_info,
|
||||
account_objects,
|
||||
account_offers,
|
||||
account_tx,
|
||||
book_offers,
|
||||
empty,
|
||||
escrow,
|
||||
fee,
|
||||
gateway_balances,
|
||||
ledger,
|
||||
ledger_data,
|
||||
ledger_entry,
|
||||
ledger_current,
|
||||
path_find,
|
||||
payment_channel,
|
||||
server_info,
|
||||
submit,
|
||||
subscribe,
|
||||
tx,
|
||||
unsubscribe,
|
||||
};
|
||||
|
||||
export default rippled;
|
||||
542
test/fixtures/rippled/pathFind.js
vendored
542
test/fixtures/rippled/pathFind.js
vendored
@@ -1,414 +1,416 @@
|
||||
'use strict';
|
||||
|
||||
module.exports.generateIOUPaymentPaths =
|
||||
function(request_id, sendingAccount, destinationAccount, destinationAmount) {
|
||||
module.exports.generateIOUPaymentPaths = function (
|
||||
request_id,
|
||||
sendingAccount,
|
||||
destinationAccount,
|
||||
destinationAmount
|
||||
) {
|
||||
return {
|
||||
'id': request_id,
|
||||
'status': 'success',
|
||||
'type': 'response',
|
||||
'result': {
|
||||
'full_reply': true,
|
||||
'source_account': sendingAccount,
|
||||
'destination_amount': destinationAmount,
|
||||
'alternatives': [
|
||||
id: request_id,
|
||||
status: "success",
|
||||
type: "response",
|
||||
result: {
|
||||
full_reply: true,
|
||||
source_account: sendingAccount,
|
||||
destination_amount: destinationAmount,
|
||||
alternatives: [
|
||||
{
|
||||
'paths_canonical': [],
|
||||
'paths_computed': [
|
||||
paths_canonical: [],
|
||||
paths_computed: [
|
||||
[
|
||||
{
|
||||
'account': 'rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': destinationAmount.issuer,
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: destinationAmount.issuer,
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': destinationAmount.issuer,
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: destinationAmount.issuer,
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': 'rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT',
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': 'rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': 'rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9',
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: "rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9",
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': 'rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
]
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
],
|
||||
'source_amount': {
|
||||
'currency': 'JPY',
|
||||
'issuer': sendingAccount,
|
||||
'value': '0.1117218827811721'
|
||||
}
|
||||
source_amount: {
|
||||
currency: "JPY",
|
||||
issuer: sendingAccount,
|
||||
value: "0.1117218827811721",
|
||||
},
|
||||
},
|
||||
{
|
||||
'paths_canonical': [],
|
||||
'paths_computed': [
|
||||
paths_canonical: [],
|
||||
paths_computed: [
|
||||
[
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': destinationAmount.issuer,
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: destinationAmount.issuer,
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': destinationAmount.issuer,
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: destinationAmount.issuer,
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': 'rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT',
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': 'rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
]
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
],
|
||||
'source_amount': {
|
||||
'currency': 'USD',
|
||||
'issuer': sendingAccount,
|
||||
'value': '0.001002'
|
||||
}
|
||||
source_amount: {
|
||||
currency: "USD",
|
||||
issuer: sendingAccount,
|
||||
value: "0.001002",
|
||||
},
|
||||
},
|
||||
{
|
||||
'paths_canonical': [],
|
||||
'paths_computed': [
|
||||
paths_canonical: [],
|
||||
paths_computed: [
|
||||
[
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': destinationAmount.issuer,
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: destinationAmount.issuer,
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': 'rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc',
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: "rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc",
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': 'rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': 'rf9X8QoYnWLHMHuDfjkmRcD2UE5qX5aYV',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rf9X8QoYnWLHMHuDfjkmRcD2UE5qX5aYV",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': 'rDVdJ62foD1sn7ZpxtXyptdkBSyhsQGviT',
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: "rDVdJ62foD1sn7ZpxtXyptdkBSyhsQGviT",
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': 'rDVdJ62foD1sn7ZpxtXyptdkBSyhsQGviT',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rDVdJ62foD1sn7ZpxtXyptdkBSyhsQGviT",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': 'rfQPFZ3eLcaSUKjUy7A3LAmDNM4F9Hz9j1',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rfQPFZ3eLcaSUKjUy7A3LAmDNM4F9Hz9j1",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'currency': destinationAmount.currency,
|
||||
'issuer': 'rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT',
|
||||
'type': 48,
|
||||
'type_hex': '0000000000000030'
|
||||
currency: destinationAmount.currency,
|
||||
issuer: "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
type: 48,
|
||||
type_hex: "0000000000000030",
|
||||
},
|
||||
{
|
||||
'account': 'rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': destinationAmount.issuer,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
}
|
||||
]
|
||||
account: destinationAmount.issuer,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
],
|
||||
],
|
||||
'source_amount': '207669'
|
||||
}
|
||||
source_amount: "207669",
|
||||
},
|
||||
],
|
||||
'destination_account': destinationAccount,
|
||||
'destination_currencies': [
|
||||
'USD',
|
||||
'JOE',
|
||||
'BTC',
|
||||
'DYM',
|
||||
'CNY',
|
||||
'EUR',
|
||||
'015841551A748AD2C1F76FF6ECB0CCCD00000000',
|
||||
'MXN',
|
||||
'XRP'
|
||||
]
|
||||
}
|
||||
destination_account: destinationAccount,
|
||||
destination_currencies: [
|
||||
"USD",
|
||||
"JOE",
|
||||
"BTC",
|
||||
"DYM",
|
||||
"CNY",
|
||||
"EUR",
|
||||
"015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||
"MXN",
|
||||
"XRP",
|
||||
],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.generateXRPPaymentPaths =
|
||||
function(request_id, sendingAccount, destinationAccount) {
|
||||
module.exports.generateXRPPaymentPaths = function (
|
||||
request_id,
|
||||
sendingAccount,
|
||||
destinationAccount
|
||||
) {
|
||||
return {
|
||||
'id': request_id,
|
||||
'status': 'success',
|
||||
'type': 'response',
|
||||
'result': {
|
||||
'full_reply': true,
|
||||
'alternatives': [
|
||||
id: request_id,
|
||||
status: "success",
|
||||
type: "response",
|
||||
result: {
|
||||
full_reply: true,
|
||||
alternatives: [
|
||||
{
|
||||
'paths_canonical': [],
|
||||
'paths_computed': [
|
||||
paths_canonical: [],
|
||||
paths_computed: [
|
||||
[
|
||||
{
|
||||
'account': 'rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
}
|
||||
]
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
],
|
||||
],
|
||||
'source_amount': {
|
||||
'currency': 'JPY',
|
||||
'issuer': sendingAccount,
|
||||
'value': '0.00005460001'
|
||||
}
|
||||
source_amount: {
|
||||
currency: "JPY",
|
||||
issuer: sendingAccount,
|
||||
value: "0.00005460001",
|
||||
},
|
||||
},
|
||||
{
|
||||
'paths_canonical': [],
|
||||
'paths_computed': [
|
||||
paths_canonical: [],
|
||||
paths_computed: [
|
||||
[
|
||||
{
|
||||
'account': 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
}
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
}
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': destinationAccount,
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: destinationAccount,
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
}
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'account': 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'account': 'r3MeEnYZY9fAd5pGjAWf4dfJsQBVY9FZRL',
|
||||
'type': 1,
|
||||
'type_hex': '0000000000000001'
|
||||
account: "r3MeEnYZY9fAd5pGjAWf4dfJsQBVY9FZRL",
|
||||
type: 1,
|
||||
type_hex: "0000000000000001",
|
||||
},
|
||||
{
|
||||
'currency': 'XRP',
|
||||
'type': 16,
|
||||
'type_hex': '0000000000000010'
|
||||
}
|
||||
]
|
||||
currency: "XRP",
|
||||
type: 16,
|
||||
type_hex: "0000000000000010",
|
||||
},
|
||||
],
|
||||
],
|
||||
'source_amount': {
|
||||
'currency': 'USD',
|
||||
'issuer': sendingAccount,
|
||||
'value': '0.0000005158508428100899'
|
||||
}
|
||||
}
|
||||
source_amount: {
|
||||
currency: "USD",
|
||||
issuer: sendingAccount,
|
||||
value: "0.0000005158508428100899",
|
||||
},
|
||||
},
|
||||
],
|
||||
'destination_account': destinationAccount,
|
||||
'destination_currencies': [
|
||||
'USD',
|
||||
'XRP'
|
||||
]
|
||||
}
|
||||
destination_account: destinationAccount,
|
||||
destination_currencies: ["USD", "XRP"],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -141,7 +141,6 @@ describe("Compute Ledger Hash", function () {
|
||||
transactionHash:
|
||||
"325EACC5271322539EEEC2D6A5292471EF1B3E72AE7180533EFC3B8F0AD435C9",
|
||||
};
|
||||
header.rawTransactions = JSON.stringify(REQUEST_FIXTURES.transactions);
|
||||
assert.throws(() => computeLedgerHeaderHash(header));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user