Skip to content

Commit

Permalink
fix: wrong sorted signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
trung2891 committed Sep 5, 2024
1 parent 39b813e commit 300348d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/relayer/src/actions/orai-to-xrpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CwXrplInterface } from "@oraichain/xrpl-bridge-contracts-sdk";
import { Operation } from "@oraichain/xrpl-bridge-contracts-sdk/build/CwXrpl.types";
import { time, WebhookClient } from "discord.js";
import { decode } from "ripple-binary-codec";
import { Signer, SubmittableTransaction } from "xrpl";
import { multisign, Signer, SubmittableTransaction } from "xrpl";
import { XRPL_ERROR_CODE, XRPLTxResult } from "../constants";
import { BridgeSigners, RelayerAction, XrplClient } from "../type";
import XRPLRpcClient from "../xrpl/xrpl_rpc";
Expand Down Expand Up @@ -157,7 +157,7 @@ export default class OraiToXrpl implements RelayerAction {
}

// submit tx to XRPL chain
const txRes = await this.xrplClient.client.submit(tx);
const txRes = await this.xrplClient.client.submit(multisign([tx]));
if (txRes.result.engine_result == XRPLTxResult.Success) {
let res = `XRPL multi-sign transaction has been successfully submitted, txHash: ${txRes.result.tx_json.hash}`;
return res;
Expand Down Expand Up @@ -288,10 +288,6 @@ export default class OraiToXrpl implements RelayerAction {
// build tx one more time to be sure that it is not affected
const tx = this.buildXRPLTxFromOperation(operation);

// add signer into tx and validate
// Optimized code for sorting string values
txSigners.sort((a, b) => b.Signer.Account.localeCompare(a.Signer.Account));

tx.Signers = txSigners;

return [tx, true];
Expand Down

0 comments on commit 300348d

Please sign in to comment.