mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
Removes methods that were just rippled wrappers (#1550)
* remove getAccountInfo * remove getAccountObjects * remove getBalanceSheet (gateway_balances) * remove getLedger * remove getOrders (account_orders) * remove getPaymentChannel (ledger_entry) * remove getTransaction(s) (tx/account_tx) * remove getSettings (account_info) * remove getServerInfo (server_info) * fix integ tests * remove submit (also deprecated) * fix integ tests * add TODO
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {Client} from '../../dist/npm'
|
||||
import { TransactionMetadata } from '../../src/models/common/transaction'
|
||||
|
||||
const client = new Client('wss://s.altnet.rippletest.net:51233')
|
||||
|
||||
@@ -6,10 +7,13 @@ getTransaction()
|
||||
|
||||
async function getTransaction() {
|
||||
await client.connect()
|
||||
const ledger = await client.getLedger({includeTransactions: true})
|
||||
const ledger = await client.request({command: 'ledger', transactions: true})
|
||||
console.log(ledger)
|
||||
const tx = await client.getTransaction(ledger.transactionHashes[0])
|
||||
const tx = await client.request({
|
||||
command: 'tx',
|
||||
transaction: ledger.result.ledger.transactions[0] as string
|
||||
})
|
||||
console.log(tx)
|
||||
console.log('deliveredAmount:', tx.outcome.deliveredAmount)
|
||||
console.log('deliveredAmount:', (tx.result.meta as TransactionMetadata).DeliveredAmount)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Client} from '../../dist/npm'
|
||||
import { AccountFlags } from '../../dist/npm/common/constants'
|
||||
|
||||
const client = new Client('wss://s.altnet.rippletest.net:51233')
|
||||
|
||||
@@ -7,7 +8,11 @@ parseAccountFlags()
|
||||
async function parseAccountFlags() {
|
||||
await client.connect()
|
||||
const account_info = await client.request({command: 'account_info', account: 'rKsdkGhyZH6b2Zzd5hNnEqSv2wpznn4n6N'})
|
||||
const flags = client.parseAccountFlags(account_info.result.account_data.Flags)
|
||||
console.log(JSON.stringify(flags, null, 2))
|
||||
const flags = account_info.result.account_data.Flags
|
||||
for (const flagName in AccountFlags) {
|
||||
if (flags & AccountFlags[flagName]) {
|
||||
console.log(`${flagName} enabled`)
|
||||
}
|
||||
}
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
@@ -100,16 +100,16 @@ async function performPayments(payments) {
|
||||
finalResults.push({
|
||||
id: signed.id
|
||||
})
|
||||
const result = await client.submit(signed.signedTransaction)
|
||||
const response = await client.request({command: 'submit', tx_blob: signed.signedTransaction})
|
||||
|
||||
// Most of the time we'll get 'tesSUCCESS' or (after many submissions) 'terQUEUED'
|
||||
console.log(`tx ${i} - tentative: ${result.resultCode}`)
|
||||
console.log(`tx ${i} - tentative: ${response.result.engine_result}`)
|
||||
|
||||
const txFinalizedPromise = new Promise<void>((resolve) => {
|
||||
const ledgerClosedCallback = async (event: LedgerClosedEvent) => {
|
||||
let status
|
||||
try {
|
||||
status = await client.getTransaction(signed.id)
|
||||
status = await client.request({command: 'tx', transaction: signed.id})
|
||||
} catch (e) {
|
||||
// Typical error when the tx hasn't been validated yet:
|
||||
if (e.name !== 'MissingLedgerHistoryError') {
|
||||
|
||||
Reference in New Issue
Block a user