fix: make docs not output confusing information in xrpl client (#2337)

* fix: make docs not output confusing information in xrpl client

---------

Co-authored-by: Jackson Mills <jmills@ripple.com>
Co-authored-by: Caleb Kniffen <ckniffen@ripple.com>
This commit is contained in:
justinr1234
2023-08-14 19:11:41 -05:00
committed by Caleb Kniffen
parent 21c2423bac
commit 3b70a3b919
28 changed files with 1718 additions and 879 deletions

View File

@@ -1,10 +1,10 @@
import { Client, LedgerResponse, TxResponse } from '../../src'
import { Client } from '../../src'
const client = new Client('wss://s2.ripple.com:51233')
async function getTransaction(): Promise<void> {
await client.connect()
const ledger: LedgerResponse = await client.request({
const ledger = await client.request({
command: 'ledger',
transactions: true,
ledger_index: 'validated',
@@ -12,8 +12,8 @@ async function getTransaction(): Promise<void> {
console.log(ledger)
const transactions = ledger.result.ledger.transactions
if (transactions) {
const tx: TxResponse = await client.request({
if (transactions && transactions.length > 0) {
const tx = await client.request({
command: 'tx',
transaction: transactions[0],
})

View File

@@ -1,4 +1,4 @@
import { Client, Payment, RipplePathFindResponse } from '../../src'
import { Client, Payment } from '../../src'
const client = new Client('wss://s.altnet.rippletest.net:51233')
@@ -15,7 +15,8 @@ async function createTxWithPaths(): Promise<void> {
issuer: 'rVnYNK9yuxBz4uP8zC8LEFokM2nqH3poc',
}
const request = {
const resp = await client.request({
// TOOD: Replace with path_find - https://github.com/XRPLF/xrpl.js/issues/2385
command: 'ripple_path_find',
source_account: wallet.classicAddress,
source_currencies: [
@@ -25,9 +26,7 @@ async function createTxWithPaths(): Promise<void> {
],
destination_account,
destination_amount,
}
const resp: RipplePathFindResponse = await client.request(request)
})
console.log(resp)
const paths = resp.result.alternatives[0].paths_computed