From f5fb3e6ae39818c73195acc22276554e431e749a Mon Sep 17 00:00:00 2001 From: JayJay1024 Date: Fri, 29 Mar 2024 11:02:09 +0800 Subject: [PATCH] fix: update unlock original token --- src/bridges/xtoken-next.ts | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/bridges/xtoken-next.ts b/src/bridges/xtoken-next.ts index 74419afe..4d18d2f6 100644 --- a/src/bridges/xtoken-next.ts +++ b/src/bridges/xtoken-next.ts @@ -208,35 +208,28 @@ export class XTokenNextBridge extends BaseBridge { const originalSender = this.convertor?.source ?? sender; const { recipient: pRecipient, extData } = await this._getExtDataAndRecipient(recipient); + const args = [ + BigInt(this.sourceChain.id), + this.sourceToken.inner, + originalSender, + pRecipient, + sender, + amount, + nonce, + extData, + ] as const; + if (this.crossInfo?.action === "issue") { message = encodeFunctionData({ abi: (await import("@/abi/xtoken-issuing-next")).default, functionName: "issue", - args: [ - BigInt(this.sourceChain.id), - this.sourceToken.inner, - originalSender, - pRecipient, - sender, - amount, - nonce, - extData, - ], + args, }); } else if (this.crossInfo?.action === "redeem") { message = encodeFunctionData({ abi: (await import("@/abi/xtoken-backing-next")).default, functionName: "unlock", - args: [ - BigInt(this.sourceChain.id), - this.targetToken.inner, - originalSender, - pRecipient, - sender, - amount, - nonce, - extData, - ], + args, }); }