Skip to content

Commit

Permalink
use a withXrplConnection context for functions that need a connection
Browse files Browse the repository at this point in the history
  • Loading branch information
sosaucily committed Oct 27, 2024
1 parent a8c2ca8 commit 3159e78
Show file tree
Hide file tree
Showing 2 changed files with 442 additions and 416 deletions.
7 changes: 3 additions & 4 deletions src/functions/ripple/ripple.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,12 @@ export function getRippleWallet(seedPhrase: string): Wallet {
return Wallet.fromSeed(seedPhrase);
}

export async function connectRippleClient(rippleClient: Client): Promise<void> {
export async function connectRippleClient(rippleClient: Client): Promise<boolean> {
if (rippleClient.isConnected()) {
return;
return false;
}
await rippleClient.connect();
return true;
}

export function formatRippleVaultUUID(vaultUUID: string): string {
Expand Down Expand Up @@ -199,8 +200,6 @@ export async function getRippleVault(
try {
await connectRippleClient(rippleClient);

// let formattedUUID = vaultUUID.substring(0, 2) === '0x' ? vaultUUID.slice(2) : vaultUUID;
// formattedUUID = formattedUUID.toUpperCase();
const formattedUUID = vaultUUID.substring(0, 2) === '0x' ? vaultUUID : `0x${vaultUUID}`;

const allVaults = await getAllRippleVaults(rippleClient, issuerAddress);
Expand Down
Loading

0 comments on commit 3159e78

Please sign in to comment.