UNPKG

@crtxio/bproto-contract-call

Version:

@crtxio/bproto-contract-call is a Nuxt3 layer which provides a Nuxt 3 component to purchase and register BProto domains and Nuxt 3 composables to call BProto standard and bridged zone contracts.

13 lines (10 loc) 445 B
import { InterfaceAbi, ethers } from "ethers"; export const callMethod = async (args: Array<String>, contractAddress: string, functionName: string, abi: InterfaceAbi, provider: ethers.Provider | ethers.Signer) => { const contract = new ethers.Contract(contractAddress, abi, provider); try { const result = await contract[functionName](...args); return result; } catch (error) { return error.reason; } }