Skip to content

Commit

Permalink
Chains: ExtraArgs: Make It Optional
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Feb 29, 2024
1 parent 6869fa5 commit f6582dd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
10 changes: 7 additions & 3 deletions src/handlers/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -140,7 +140,9 @@ export function evmHandler({
to,
sourceNftAddress,
amt,
extraArgs,
{
...extraArgs,
},
);
return {
tx,
Expand Down Expand Up @@ -183,7 +185,9 @@ export function evmHandler({
destinationChain,
to,
sourceNftAddress,
extraArgs,
{
...extraArgs,
},
);
return {
tx,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/multiversx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/handlers/secret/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -306,6 +306,7 @@ export function secretHandler({
sender: signer.address,
},
{
..._,
gasLimit: 200_000,
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/tezos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/handlers/ton/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions src/handlers/types/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type TLockNFT<Signer, ExtraArgs, RetTx> = {
destinationChain: TSupportedChain,
to: string,
tokenId: bigint,
extraArgs: ExtraArgs,
extraArgs?: ExtraArgs,
) => Promise<{ tx: RetTx; hash: () => string }>;
};

Expand All @@ -59,7 +59,7 @@ export type TApproveNFT<Signer, ExtraArgs, RetTx> = {
signer: Signer,
tokenId: string,
contract: string,
extraArgs: ExtraArgs,
extraArgs?: ExtraArgs,
): Promise<RetTx>;
};

Expand Down Expand Up @@ -92,8 +92,8 @@ export type TClaimNFT<Signer, ClaimData, ExtraArgs, Ret> = {
claimNft: (
signer: Signer,
claimData: ClaimData,
extraArgs: ExtraArgs,
sig: TSignerAndSignature[],
extraArgs?: ExtraArgs,
) => Promise<Ret>;
};

Expand All @@ -109,7 +109,7 @@ export type TGetBalance<Signer, ExtraArgs> = {
* @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<bigint>;
getBalance: (signer: Signer, extraArgs?: ExtraArgs) => Promise<bigint>;
};

/**
Expand Down Expand Up @@ -142,7 +142,7 @@ export type TGetNFTData<ExtraArgs> = {
nftData: (
tokenId: string,
contract: string,
extraArgs: ExtraArgs,
extraArgs?: ExtraArgs,
) => Promise<TNFTData>;
};

Expand Down Expand Up @@ -203,7 +203,7 @@ export type TLockSFT<Signer, ExtraArgs, RetTx> = {
to: string,
tokenId: bigint,
amt: bigint,
extraArgs: ExtraArgs,
extraArgs?: ExtraArgs,
) => Promise<{ tx: RetTx; hash: () => string }>;
};

Expand All @@ -227,7 +227,7 @@ export type TClaimSFT<Signer, ClaimData, ExtraArgs, Ret> = {
signer: Signer,
claimData: ClaimData,
sigs: TSignerAndSignature[],
extraArgs: ExtraArgs,
extraArgs?: ExtraArgs,
) => Promise<Ret>;
};

Expand Down

0 comments on commit f6582dd

Please sign in to comment.