Skip to content

Commit

Permalink
update Paths snippet test (#2765)
Browse files Browse the repository at this point in the history
* update Paths snippet test: perform prerequisite test setup within the test, remove dependence on theexternal state of testnet

* fix lint errors

* remove bridge snippet test, the sidechain has been shut down

* [FIX] Update paths snippet. Replace RipplePathFind with PathFind RPC (fixes #2385)
  • Loading branch information
ckeshava authored Sep 19, 2024
1 parent f3960c3 commit 385a56a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 180 deletions.
170 changes: 0 additions & 170 deletions packages/xrpl/snippets/src/bridgeTransfer.ts

This file was deleted.

21 changes: 11 additions & 10 deletions packages/xrpl/snippets/src/paths.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Client, Payment } from '../../src'

// Prerequisites for this snippet. Please verify these conditions after a reset of the
// test network:
// - destination_account must have a trust line with the destination_amount.issuer
// - There must be appropriate DEX Offers or XRP/TST AMM for the cross-currency exchange

// PathFind RPC requires the use of a Websocket client only
const client = new Client('wss://s.altnet.rippletest.net:51233')

async function createTxWithPaths(): Promise<void> {
Expand All @@ -8,22 +14,17 @@ async function createTxWithPaths(): Promise<void> {
const { wallet } = await client.fundWallet(null, {
usageContext: 'code snippets',
})
const destination_account = 'rKT4JX4cCof6LcDYRz8o3rGRu7qxzZ2Zwj'
const destination_account = 'rJPeZVPty1bXXbDR9oKscg2irqABr7sP3t'
const destination_amount = {
value: '0.001',
currency: 'USD',
issuer: 'rVnYNK9yuxBz4uP8zC8LEFokM2nqH3poc',
currency: 'TST',
issuer: 'rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd',
}

const resp = await client.request({
// TOOD: Replace with path_find - https://github.com/XRPLF/xrpl.js/issues/2385
command: 'ripple_path_find',
command: 'path_find',
subcommand: 'create',
source_account: wallet.classicAddress,
source_currencies: [
{
currency: 'XRP',
},
],
destination_account,
destination_amount,
})
Expand Down

0 comments on commit 385a56a

Please sign in to comment.