Skip to content

Commit

Permalink
chore: allow config last_ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
trung2891 committed Aug 26, 2024
1 parent 207bdcf commit 736a61b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/relayer/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
XRPL_RPC=
MNEMONIC_ENCRYPTED=
XRPL_SEED_ENCRYPTED=
XRPL_SEED_ENCRYPTED=
LAST_LEDGER=
4 changes: 2 additions & 2 deletions packages/relayer/src/actions/orai-to-xrpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ export default class OraiToXrpl implements RelayerAction {
operation
)}, got error: ${error}`
);
// try reconnect
await this.xrplClient.client.connect();
}
}
} catch (error) {
console.error(
"error querying unprocessed transactions orai to xrpl: ",
error
);
// try reconnect
await this.xrplClient.client.connect();
return;
}
}
Expand Down
13 changes: 9 additions & 4 deletions packages/relayer/src/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ export class XrplBridgeRelayer {

async relay() {
while (true) {
for (const relayerAction of this.relayerActions) {
await relayerAction.takeAction();
try {
for (const relayerAction of this.relayerActions) {
await relayerAction.takeAction();
}
await setTimeout(PROCESS_INTERVAL);
} catch (err) {
console.log(err);
}
await setTimeout(PROCESS_INTERVAL);
}
}
}
Expand All @@ -71,6 +75,7 @@ export default async (yargs: Argv) => {
const oraiRpcUrl = process.env.RPC_URL ?? "https://rpc.orai.io";
const xrplServer =
process.env.XRPL_SERVER || "wss://s.altnet.rippletest.net:51233";
const lastLedger = Number(process.env.LAST_LEDGER) || -1;
console.log(xrplServer);

const discordWebhookUrl = process.env.DISCORD_WEBHOOK_URL;
Expand Down Expand Up @@ -110,7 +115,7 @@ export default async (yargs: Argv) => {
bridgeAdapter.cwClient,
bridgeAdapter.xrplClient,
xrplBridgeAddr,
-1,
lastLedger,
webhookClient
);

Expand Down

0 comments on commit 736a61b

Please sign in to comment.