mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Remove ledger methods from Connection (#1543)
* remove ledger subscription from connection * remove more client ledger stuff * resolve TS concerns * fix all tests except broadcast tests * fix broadcast tests * clean up more ledger stuff in testing * respond to comments
This commit is contained in:
@@ -240,7 +240,11 @@ function suiteSetup(this: any) {
|
||||
// two times to give time to server to send `ledgerClosed` event
|
||||
// so getLedgerVersion will return right value
|
||||
.then(() => ledgerAccept(this.client))
|
||||
.then(() => this.client.getLedgerVersion())
|
||||
.then(() => this.client.request({
|
||||
command: 'ledger',
|
||||
ledger_index: 'validated'
|
||||
})
|
||||
.then(response => response.result.ledger_index))
|
||||
.then((ledgerVersion) => {
|
||||
this.startLedgerVersion = ledgerVersion
|
||||
})
|
||||
@@ -259,7 +263,12 @@ describe('integration tests', function () {
|
||||
afterEach(teardown)
|
||||
|
||||
it('trustline', function () {
|
||||
return this.client.getLedgerVersion().then((ledgerVersion) => {
|
||||
return this.client.request({
|
||||
command: 'ledger',
|
||||
ledger_index: 'validated'
|
||||
})
|
||||
.then(response => response.result.ledger_index)
|
||||
.then((ledgerVersion) => {
|
||||
return this.client
|
||||
.prepareTrustline(
|
||||
address,
|
||||
@@ -284,7 +293,12 @@ describe('integration tests', function () {
|
||||
amount: amount
|
||||
}
|
||||
}
|
||||
return this.client.getLedgerVersion().then((ledgerVersion) => {
|
||||
return this.client.request({
|
||||
command: 'ledger',
|
||||
ledger_index: 'validated'
|
||||
})
|
||||
.then(response => response.result.ledger_index)
|
||||
.then((ledgerVersion) => {
|
||||
return this.client
|
||||
.preparePayment(address, paymentSpecification, instructions)
|
||||
.then((prepared) =>
|
||||
@@ -316,7 +330,12 @@ describe('integration tests', function () {
|
||||
issuer: 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q'
|
||||
}
|
||||
}
|
||||
return this.client.getLedgerVersion().then((ledgerVersion) => {
|
||||
return this.client.request({
|
||||
command: 'ledger',
|
||||
ledger_index: 'validated'
|
||||
})
|
||||
.then(response => response.result.ledger_index)
|
||||
.then((ledgerVersion) => {
|
||||
return this.client
|
||||
.prepareOrder(address, orderSpecification, instructions)
|
||||
.then((prepared) =>
|
||||
@@ -372,13 +391,6 @@ describe('integration tests', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('getLedgerVersion', function () {
|
||||
return this.client.getLedgerVersion().then((ledgerVersion) => {
|
||||
assert.strictEqual(typeof ledgerVersion, 'number')
|
||||
assert(ledgerVersion >= this.startLedgerVersion)
|
||||
})
|
||||
})
|
||||
|
||||
it('getTrustlines', function () {
|
||||
const fixture = requests.prepareTrustline.simple
|
||||
const { currency, counterparty } = fixture
|
||||
@@ -520,7 +532,12 @@ describe('integration tests - standalone rippled', function () {
|
||||
let minLedgerVersion = null
|
||||
return payTo(this.client, address)
|
||||
.then(() => {
|
||||
return this.client.getLedgerVersion().then((ledgerVersion) => {
|
||||
return this.client.request({
|
||||
command: 'ledger',
|
||||
ledger_index: 'validated'
|
||||
})
|
||||
.then(response => response.result.ledger_index)
|
||||
.then((ledgerVersion) => {
|
||||
minLedgerVersion = ledgerVersion
|
||||
return this.client
|
||||
.prepareSettings(address, {signers}, instructions)
|
||||
|
||||
Reference in New Issue
Block a user