UNPKG

@verified-network/verified-sdk

Version:

An SDK to develop applications on the Verified Network

80 lines (79 loc) 2.67 kB
import { Signer } from "ethers"; import { VerifiedWallet } from "../wallet"; declare enum STATUS { SUCCESS = 0, ERROR = 1 } interface SCResponse { response: object; status: STATUS; message: string; reason: string; code: number; } export declare enum DATATYPES { NUMBER = "number", STRING = "string", ADDRESS = "address", BOOLEAN = "boolean", BYTE32 = "byte32", BYTE16 = "byte16", BIGNUMBER = "bignumber" } export type Options = { gasPrice?: number; gasLimit?: number; paymentToken?: string; apiKey?: string; rpcUrl?: string; isReactNative?: boolean; }; export declare class VerifiedContract { private signer; private contract; private abiInterface; constructor(address: string, abi: string, signer: VerifiedWallet | Signer); protected validateInput(type: DATATYPES, data: any): Promise<boolean>; protected sanitiseInput(type: DATATYPES, data: any): any; protected sanitiseOutput(type: DATATYPES, data: any): any; /** * gets a function state mutability to differenciate between read and write functions * @param functionName * @returns true or false */ private isReadFunction; /** * Parses output to standard response * @param data * @returns */ private tempOutput; /** Converts any datatype to array */ private convertToArray; /** Checks if a contract support gasless transaction */ supportsGasless(chainId?: number): boolean; /** Constructs and call function with ethers.js */ callFunctionWithEthers(functionName: string, ...args: any): Promise<SCResponse>; /** Constructs and call function using Alchemy client that allows gassless sponsorship and payment in ERC20 tokens */ callFunctionWithAlchemyClient(chainId: number, tx: any, functionName: string, paymentToken: `0x${string}`, pk: string, isSponsor?: boolean, ...args: any): Promise<SCResponse>; callContract(functionName: string, ...args: any): Promise<SCResponse | undefined>; getQuote(paymentTokenAddress: string, functionName: string, args: any[], rpc?: string, _apiKey?: string, isReactNative?: boolean): Promise<{ tokenAddress: string; amount: any; amountInWei: any; amountValue: any; chainId: number; functionName: string; amouuntValue?: undefined; } | { tokenAddress: string; amount: string; amountInWei: string; amouuntValue: string; chainId: number; functionName: string; amountValue?: undefined; }>; protected getEvent(eventName: string, callback: any): void; } export {};