diff --git a/src/handlers/near/index.ts b/src/handlers/near/index.ts index 5585631a..bdbff99e 100644 --- a/src/handlers/near/index.ts +++ b/src/handlers/near/index.ts @@ -102,7 +102,8 @@ export async function nearHandler({ getStorageContract() { return storage; }, - async mintNft(signer, ma, gasArgs) { + async mintNft(connection, ma, gasArgs) { + const signer = connection.account(); const call = await signer.functionCall({ contractId: ma.contract, methodName: "nft_mint", @@ -139,7 +140,8 @@ export async function nearHandler({ lock_tx_chain: input.lockTxChain, }; }, - async approveNft(signer, tokenId, contract) { + async approveNft(connection, tokenId, contract) { + const signer = connection.account(); const approve = await signer.functionCall({ contractId: contract, methodName: "nft_approve", @@ -184,13 +186,14 @@ export async function nearHandler({ }; }, async lockNft( - signer, + connection, sourceNft, destinationChain, to, tokenId, metadata_uri, ) { + const signer = connection.account(); const locked = await signer.functionCall({ contractId: bridge, methodName: "lock_nft", @@ -211,7 +214,8 @@ export async function nearHandler({ }, }; }, - async claimNft(signer, claimData, sig) { + async claimNft(connection, claimData, sig) { + const signer = connection.account(); const claimed = await signer.functionCall({ contractId: bridge, methodName: "claim_nft", @@ -228,7 +232,8 @@ export async function nearHandler({ }); return { hash: () => claimed.transaction.hash, ret: claimed }; }, - async getBalance(signer, _) { + async getBalance(connection, _) { + const signer = connection.account(); const ab = await signer.getAccountBalance(); return BigInt(ab.available); }, diff --git a/src/handlers/near/types.ts b/src/handlers/near/types.ts index 2dde207a..46c14f0f 100644 --- a/src/handlers/near/types.ts +++ b/src/handlers/near/types.ts @@ -1,4 +1,4 @@ -import { Account, Near } from "near-api-js"; +import { Near, WalletConnection } from "near-api-js"; import { FinalExecutionOutcome } from "near-api-js/lib/providers"; import { BridgeStorage } from "../../contractsTypes/evm"; import { @@ -40,15 +40,20 @@ export type NftIssueArgs = { }; export type TNearHandler = TSingularNftChain< - Account, + WalletConnection, TNearClaimArgs, unknown, FinalExecutionOutcome, Near > & - MintNft & + MintNft< + WalletConnection, + NftIssueArgs, + { gasLimit: number; value: number }, + string + > & DeployNFTCollection< - Account, + WalletConnection, { name: string; ticker: string }, { gasLimit: number }, string