From f6582dde26c1e7d5b9140daf30607d6a85b46824 Mon Sep 17 00:00:00 2001 From: imsk17 Date: Thu, 29 Feb 2024 15:37:30 +0530 Subject: [PATCH] Chains: ExtraArgs: Make It Optional --- src/handlers/evm/index.ts | 10 +++++++--- src/handlers/multiversx/index.ts | 2 +- src/handlers/secret/index.ts | 3 ++- src/handlers/tezos/index.ts | 2 +- src/handlers/ton/index.ts | 2 +- src/handlers/types/chain.ts | 14 +++++++------- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/handlers/evm/index.ts b/src/handlers/evm/index.ts index f49cbb1a..7fd553ea 100644 --- a/src/handlers/evm/index.ts +++ b/src/handlers/evm/index.ts @@ -12,7 +12,7 @@ export function evmHandler({ storage, }: TEvmParams): TEvmHandler { return { - claimNft(wallet, claimData, extraArgs, sigs) { + claimNft(wallet, claimData, sigs, extraArgs) { const contract = Bridge__factory.connect(bridge, wallet); return contract.claimNFT721( claimData, @@ -140,7 +140,9 @@ export function evmHandler({ to, sourceNftAddress, amt, - extraArgs, + { + ...extraArgs, + }, ); return { tx, @@ -183,7 +185,9 @@ export function evmHandler({ destinationChain, to, sourceNftAddress, - extraArgs, + { + ...extraArgs, + }, ); return { tx, diff --git a/src/handlers/multiversx/index.ts b/src/handlers/multiversx/index.ts index 9d7462f5..e891130d 100644 --- a/src/handlers/multiversx/index.ts +++ b/src/handlers/multiversx/index.ts @@ -305,7 +305,7 @@ export function multiversxHandler({ }, }; }, - async claimNft(signer, claimData, _, sig) { + async claimNft(signer, claimData, sig) { const userAddress = new Address(signer.getAddress().bech32()); const userAccount = new Account(userAddress); const userOnNetwork = await provider.getAccount(userAddress); diff --git a/src/handlers/secret/index.ts b/src/handlers/secret/index.ts index 75621ea2..992f1d11 100644 --- a/src/handlers/secret/index.ts +++ b/src/handlers/secret/index.ts @@ -14,7 +14,7 @@ export function secretHandler({ getProvider() { return provider; }, - async claimNft(signer, claimData, extraArgs, sigs) { + async claimNft(signer, claimData, sigs, extraArgs) { const claim721 = { claim721: { data: { @@ -306,6 +306,7 @@ export function secretHandler({ sender: signer.address, }, { + ..._, gasLimit: 200_000, }, ); diff --git a/src/handlers/tezos/index.ts b/src/handlers/tezos/index.ts index bbea2bd3..648a395e 100644 --- a/src/handlers/tezos/index.ts +++ b/src/handlers/tezos/index.ts @@ -151,7 +151,7 @@ export function tezosHandler({ }); return tx.contractAddress ?? raise("No contract address found"); }, - async claimNft(signer, data, extraArgs, sigs) { + async claimNft(signer, data, sigs, extraArgs) { const isTezosAddr = validateAddress(data.source_nft_contract_address) === 3; diff --git a/src/handlers/ton/index.ts b/src/handlers/ton/index.ts index 6912c06c..4dad18b9 100644 --- a/src/handlers/ton/index.ts +++ b/src/handlers/ton/index.ts @@ -36,7 +36,7 @@ export function tonHandler({ signer.address ?? raise("No Address present in signer"), ); }, - async claimNft(signer, claimData, _, sig) { + async claimNft(signer, claimData, sig, _) { const sigs: SignerAndSignature[] = sig.map((e) => { return { $$type: "SignerAndSignature", diff --git a/src/handlers/types/chain.ts b/src/handlers/types/chain.ts index 5a6317a4..e9bf2354 100644 --- a/src/handlers/types/chain.ts +++ b/src/handlers/types/chain.ts @@ -36,7 +36,7 @@ export type TLockNFT = { destinationChain: TSupportedChain, to: string, tokenId: bigint, - extraArgs: ExtraArgs, + extraArgs?: ExtraArgs, ) => Promise<{ tx: RetTx; hash: () => string }>; }; @@ -59,7 +59,7 @@ export type TApproveNFT = { signer: Signer, tokenId: string, contract: string, - extraArgs: ExtraArgs, + extraArgs?: ExtraArgs, ): Promise; }; @@ -92,8 +92,8 @@ export type TClaimNFT = { claimNft: ( signer: Signer, claimData: ClaimData, - extraArgs: ExtraArgs, sig: TSignerAndSignature[], + extraArgs?: ExtraArgs, ) => Promise; }; @@ -109,7 +109,7 @@ export type TGetBalance = { * @param extraArgs The extra arguments required for a chain. * @returns A promise that resolves to the balance as a bigint. */ - getBalance: (signer: Signer, extraArgs: ExtraArgs) => Promise; + getBalance: (signer: Signer, extraArgs?: ExtraArgs) => Promise; }; /** @@ -142,7 +142,7 @@ export type TGetNFTData = { nftData: ( tokenId: string, contract: string, - extraArgs: ExtraArgs, + extraArgs?: ExtraArgs, ) => Promise; }; @@ -203,7 +203,7 @@ export type TLockSFT = { to: string, tokenId: bigint, amt: bigint, - extraArgs: ExtraArgs, + extraArgs?: ExtraArgs, ) => Promise<{ tx: RetTx; hash: () => string }>; }; @@ -227,7 +227,7 @@ export type TClaimSFT = { signer: Signer, claimData: ClaimData, sigs: TSignerAndSignature[], - extraArgs: ExtraArgs, + extraArgs?: ExtraArgs, ) => Promise; };