UNPKG

@pendulum-chain/api-solang

Version:

Interface to interact with smart contracts compiled via Solang

45 lines (44 loc) 1.44 kB
import { ApiPromise } from "@polkadot/api"; import { Abi } from "@polkadot/api-contract"; import { Weight } from "@polkadot/types/interfaces"; import { Address, Limits } from "./index.js"; export interface QueryContractOptions { api: ApiPromise; abi: Abi; contractAddress: Address; callerAddress: Address; messageName: string; limits: Limits; messageArguments: unknown[]; } export type PanicCode = number; export declare function explainPanicError(errorCode: PanicCode): string; export type QueryContractOutput = { type: "success"; value: any; } | { type: "reverted"; description: string; } | { type: "panic"; errorCode: PanicCode; explanation: string; } | { type: "error"; description?: string; }; export interface QueryContractResult { gasRequired: Weight; gasConsumed: Weight; output: QueryContractOutput; } export declare function rpcCall({ api, abi, callerAddress, messageName, contractAddress, limits, messageArguments, }: QueryContractOptions): Promise<QueryContractResult>; export interface QueryInstantiateContractOptions { api: ApiPromise; abi: Abi; callerAddress: Address; constructorName: string; limits: Limits; constructorArguments: unknown[]; } export declare function rpcInstantiate({ api, abi, callerAddress, constructorName, limits, constructorArguments, }: QueryInstantiateContractOptions): Promise<QueryContractResult>;