UNPKG

locklift

Version:

Node JS framework for working with Ever contracts. Inspired by Truffle and Hardhat. Helps you to build, test, run and maintain your smart contracts.

52 lines (51 loc) 2.34 kB
import { Address, Contract, GetExpectedAddressParams, ProviderRpcClient } from "everscale-inpage-provider"; import { ConstructorParams, ContractWithArtifacts, DeployTransaction, Optional } from "../../types"; import { Giver } from "./giver"; import { AccountFactory2 } from "./account2"; import { SimpleAccountsStorage } from "everscale-standalone-client"; export * from "./giver"; export * from "./deployer"; export type ContractData<Abi> = { code: string; tvc: string; abi: Abi; codeHash: string; map: ReturnType<typeof JSON.parse>; }; export type FactoryType = Record<string, any>; export type DeployContractParams<T extends FactoryType, ContractName extends keyof T> = { contract: ContractName; constructorParams: ConstructorParams<T[ContractName]>; value: string; } & Optional<DeployParams<T[ContractName]>, "tvc">; export type DeployParams<Abi> = GetExpectedAddressParams<Abi> & { publicKey: string; }; export declare class Factory<T extends FactoryType> { private readonly ever; private readonly giver; private readonly factoryCache; accounts: AccountFactory2<T>; private constructor(); static setup<T extends FactoryType>(ever: ProviderRpcClient, giver: () => Giver, accountsStorage: SimpleAccountsStorage, preloadedAccounts?: Array<{ contractName: keyof T; abi: any; codeHash: string; }>): Promise<Factory<T>>; private get deployer(); deployContract: <ContractName extends keyof T>(args: DeployContractParams<T, ContractName> & { giver?: Giver; }) => Promise<{ contract: Contract<T[ContractName]>; } & DeployTransaction>; getDeployedContract: <ContractName extends keyof T>(name: ContractName, address: Address) => Contract<T[ContractName]>; initializeContract: <key extends keyof T>(name: keyof T, resolvedPath: string) => Promise<ContractData<T[key]>>; getContractArtifacts: <key extends keyof T>(name: key) => ContractData<T[key]>; getAllArtifacts: () => Array<{ contractName: string; artifacts: ContractData<T[keyof T]>; }>; getContractByCodeHash: (codeHash: string | undefined, address: Address) => ContractWithArtifacts | undefined; getContractByCodeHashOrDefault: (codeHash: string, address: Address) => ContractWithArtifacts; private getContractsArtifacts; }