diff --git a/src/handlers/evm/index.ts b/src/handlers/evm/index.ts index 085c525f..f49cbb1a 100644 --- a/src/handlers/evm/index.ts +++ b/src/handlers/evm/index.ts @@ -35,7 +35,7 @@ export function evmHandler({ ); return await contract.getAddress(); }, - async mintNft(signer, ma) { + async mintNft(signer, ma, gas) { const minter = ERC721Royalty__factory.connect(ma.contract, signer); const response = await minter.mint( await signer.getAddress(), @@ -43,6 +43,9 @@ export function evmHandler({ ma.royalty, ma.royaltyReceiver, ma.uri, + { + ...gas, + }, ); await response.wait(); return response; diff --git a/src/handlers/evm/types.ts b/src/handlers/evm/types.ts index af104fcf..d46d05d2 100644 --- a/src/handlers/evm/types.ts +++ b/src/handlers/evm/types.ts @@ -7,6 +7,7 @@ import { } from "ethers"; import { Bridge, BridgeStorage } from "../../contractsTypes/evm"; +import { PayableOverrides } from "../../contractsTypes/evm/common"; import { DeployCollection, MintNft, TNftChain } from "../types"; export type TEvmHandler = TNftChain< @@ -25,6 +26,7 @@ export type TEvmHandler = TNftChain< royalty: bigint; royaltyReceiver: string; }, + PayableOverrides, ContractTransactionResponse > & DeployCollection< diff --git a/src/handlers/multiversx/index.ts b/src/handlers/multiversx/index.ts index f10a895e..9d7462f5 100644 --- a/src/handlers/multiversx/index.ts +++ b/src/handlers/multiversx/index.ts @@ -148,7 +148,7 @@ export function multiversxHandler({ getStorageContract() { return storage; }, - async mintNft(signer, ma) { + async mintNft(signer, ma, gasArgs) { const args: TypedValue[] = [ BytesValue.fromUTF8(ma.ticker), new BigUIntValue(1), @@ -169,12 +169,13 @@ export function multiversxHandler({ const tx = new Transaction({ data, gasLimit: + gasArgs?.gasLimit ?? 3_000_000 + - data.length() * 1500 + - (ma.attrs?.length || 0 + (ma.hash?.length ?? 0) || 0) * 50000, + data.length() * 1500 + + (ma.attrs?.length || 0 + (ma.hash?.length ?? 0) || 0) * 50000, receiver: signer.getAddress(), sender: signer.getAddress(), - value: 0, + value: gasArgs?.value ?? 0, chainID: chainId, }); diff --git a/src/handlers/multiversx/types.ts b/src/handlers/multiversx/types.ts index 40eb52a7..90656f28 100644 --- a/src/handlers/multiversx/types.ts +++ b/src/handlers/multiversx/types.ts @@ -48,7 +48,12 @@ export type TMultiversXHandler = TSingularNftChain< string, INetworkProvider > & - MintNft & + MintNft< + TMultiversXSigner, + NftIssueArgs, + { gasLimit: number; value: number }, + string + > & DeployCollection< TMultiversXSigner, { name: string; ticker: string }, diff --git a/src/handlers/secret/index.ts b/src/handlers/secret/index.ts index e1b79ed1..75621ea2 100644 --- a/src/handlers/secret/index.ts +++ b/src/handlers/secret/index.ts @@ -89,20 +89,23 @@ export function secretHandler({ )?.value; return contractAddress ?? raise("Contract not found"); }, - mintNft(signer, ma) { - const mint = signer.tx.snip721.mint({ - contract_address: ma.contractAddress, - msg: { - mint_nft: { - public_metadata: { - token_uri: ma.uri, + mintNft(signer, ma, gasArgs) { + const mint = signer.tx.snip721.mint( + { + contract_address: ma.contractAddress, + msg: { + mint_nft: { + public_metadata: { + token_uri: ma.uri, + }, + token_id: ma.tokenId, + owner: signer.address, }, - token_id: ma.tokenId, - owner: signer.address, }, + sender: signer.address, }, - sender: signer.address, - }); + gasArgs, + ); return mint; }, transform(input) { diff --git a/src/handlers/secret/types.ts b/src/handlers/secret/types.ts index df556699..5710dc2c 100644 --- a/src/handlers/secret/types.ts +++ b/src/handlers/secret/types.ts @@ -32,7 +32,7 @@ export type TSecretHandler = TNftChain< TxResponse, SecretNetworkClient > & - MintNft & + MintNft & DeployCollection< SecretNetworkClient, { name: string; symbol: string }, diff --git a/src/handlers/tezos/index.ts b/src/handlers/tezos/index.ts index 29515c67..bbea2bd3 100644 --- a/src/handlers/tezos/index.ts +++ b/src/handlers/tezos/index.ts @@ -121,7 +121,7 @@ export function tezosHandler({ metadata: nft.metadata, }; }, - async mintNft(signer, ma) { + async mintNft(signer, ma, gasArgs) { Tezos.setSignerProvider(signer); const contract = await Tezos.contract.at(ma.contract); const tx = contract.methods @@ -133,7 +133,7 @@ export function tezosHandler({ token_uri: ma.uri, }, ]) - .send(); + .send(gasArgs); return tx; }, async deployCollection(signer, _da, ga) { diff --git a/src/handlers/tezos/types.ts b/src/handlers/tezos/types.ts index 8657ae59..82086c6d 100644 --- a/src/handlers/tezos/types.ts +++ b/src/handlers/tezos/types.ts @@ -40,8 +40,8 @@ export type TTezosHandler = TSingularNftChain< TransactionOperation, TezosToolkit > & - MintNft & - DeployCollection; + MintNft, TransactionOperation> & + DeployCollection, string>; export type TTezosParams = { Tezos: TezosToolkit; diff --git a/src/handlers/ton/types.ts b/src/handlers/ton/types.ts index e70c0ade..e6ae2ac7 100644 --- a/src/handlers/ton/types.ts +++ b/src/handlers/ton/types.ts @@ -14,7 +14,7 @@ export type TTonHandler = TSingularNftChain< undefined, TonClient > & - MintNft & + MintNft & DeployCollection; export type TTonParams = { diff --git a/src/handlers/types/chain.ts b/src/handlers/types/chain.ts index 5ba7193e..5a6317a4 100644 --- a/src/handlers/types/chain.ts +++ b/src/handlers/types/chain.ts @@ -1,15 +1,15 @@ import { BridgeStorage } from "../../contractsTypes/evm"; import { TSupportedChain, TSupportedSftChain } from "../../factory/types/utils"; -export type MintNft = { - mintNft: (signer: Signer, ma: MintArgs) => Promise; +export type MintNft = { + mintNft: (signer: Signer, ma: MintArgs, gasArgs?: GasArgs) => Promise; }; export type DeployCollection = { deployCollection: ( signer: Signer, da: DeployArgs, - ga: GasArgs | undefined, + ga?: GasArgs, ) => Promise; };