Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Paths snippet test #2765

Merged
merged 5 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading