fix: set ledger_index to validated (#1675)

* fix: adds ledger_index: validated
This commit is contained in:
Nathan Nichols
2021-09-28 16:42:40 -07:00
committed by Mayukha Vadari
parent 02fd0ce323
commit c3e68cc83f
6 changed files with 7 additions and 3 deletions

View File

@@ -127,6 +127,7 @@ async function setNextValidSequenceNumber(
const request: AccountInfoRequest = { const request: AccountInfoRequest = {
command: 'account_info', command: 'account_info',
account: tx.Account, account: tx.Account,
ledger_index: 'validated',
} }
const data = await client.request(request) const data = await client.request(request)
// eslint-disable-next-line no-param-reassign, require-atomic-updates -- param reassign is safe with no race condition // eslint-disable-next-line no-param-reassign, require-atomic-updates -- param reassign is safe with no race condition

View File

@@ -54,7 +54,7 @@ async function getOrderbook(
command: 'book_offers', command: 'book_offers',
taker_pays: takerPays, taker_pays: takerPays,
taker_gets: takerGets, taker_gets: takerGets,
ledger_index: options.ledger_index, ledger_index: options.ledger_index ?? 'validated',
ledger_hash: options.ledger_hash, ledger_hash: options.ledger_hash,
limit: options.limit ?? DEFAULT_LIMIT, limit: options.limit ?? DEFAULT_LIMIT,
taker: options.taker, taker: options.taker,

View File

@@ -213,6 +213,7 @@ async function getAddressXrpBalance(
const balances = await client.request({ const balances = await client.request({
command: 'account_info', command: 'account_info',
account: address, account: address,
ledger_index: 'validated',
}) })
return balances.result.account_data.Balance return balances.result.account_data.Balance

View File

@@ -13,7 +13,7 @@ import { generateFundedWallet, testTransaction } from '../utils'
// how long before each test case times out // how long before each test case times out
const TIMEOUT = 20000 const TIMEOUT = 20000
describe('PaymentChannelFund', function () { describe('PaymentChannelClaim', function () {
this.timeout(TIMEOUT) this.timeout(TIMEOUT)
before(suiteClientSetup) before(suiteClientSetup)

View File

@@ -35,7 +35,6 @@ describe('PaymentChannelFund', function () {
this.wallet, this.wallet,
paymentChannelCreate, paymentChannelCreate,
) )
await testTransaction(this.client, paymentChannelCreate, this.wallet) await testTransaction(this.client, paymentChannelCreate, this.wallet)
const paymentChannelFund: PaymentChannelFund = { const paymentChannelFund: PaymentChannelFund = {

View File

@@ -83,6 +83,9 @@ export async function testTransaction(
transaction: Transaction, transaction: Transaction,
wallet: Wallet, wallet: Wallet,
): Promise<void> { ): Promise<void> {
// Accept any un-validated changes.
await ledgerAccept(client)
// sign/submit the transaction // sign/submit the transaction
const response = await client.submitTransaction(wallet, transaction) const response = await client.submitTransaction(wallet, transaction)