import { ethers } from 'ethers'; import { CBR_Address } from './CBR'; import { AnyBackendTy, MaybeRep } from './shared_backend'; import type { MapRefT } from './shared_backend'; export { hexlify } from './shared_backend'; import type { Arith } from './interfaces'; declare type BigNumber = ethers.BigNumber; export declare type CurrencyAmount = string | number | BigNumber | bigint; export type { Connector } from './ConnectorMode'; export declare const hasProp: (o: unknown, p: string) => unknown; export declare const j2sf: (x: any) => string; export declare const j2s: (x: any) => string; export declare const setDEBUG: (b: boolean) => void; export declare const hideWarnings: () => boolean; export declare const getDEBUG: () => boolean; export declare const debug: (...msgs: any) => void; export declare type IBackendViewInfo = { ty: ConnectorTy; decode: (i: number, svs: Array, args: Array) => Promise; }; export declare type IBackendViewsInfo = { [viewi: number]: Array; }; export declare type TaggedBackendView = { [keyn: string]: IBackendViewInfo; }; export declare type IBackendViews = { views: IBackendViewsInfo; infos: { [viewn: string]: TaggedBackendView | IBackendViewInfo; }; }; export declare type IBackendMaps = { mapDataTy: ConnectorTy; }; export declare type IViewLib = { viewMapRef: any; }; export declare type IBackend = { _backendVersion: number; _getViews: (stdlib: Object, viewlib: IViewLib) => IBackendViews; _getMaps: (stdlib: Object) => IBackendMaps; _Participants: { [n: string]: any; }; _APIs: { [n: string]: any | { [n: string]: any; }; }; _stateSourceMap: { [key: number]: any; }; _getEvents: (stdlib: Object) => ({ [n: string]: [any]; }); }; export declare type OnProgress = (obj: { current: BigNumber; target: BigNumber; }) => any; export declare type WPArgs = { host: string | undefined; port: number; output: 'silent'; timeout: number; }; export declare type MkPayAmt = [ BigNumber, Array<[BigNumber, Token]> ]; export declare type IRecvNoTimeout = { didTimeout: false; didSend: boolean; data: Array; from: RawAddress; time: BigNumber; secs: BigNumber; getOutput: (o_mode: string, o_lab: string, o_ctc: any, o_val: any) => Promise; }; export declare type IRecv = IRecvNoTimeout | { didTimeout: true; }; export declare type TimeArg = [('time' | 'secs'), BigNumber]; export declare type ISendRecvArgs = { funcNum: number; evt_cnt: number; tys: Array; args: Array; pay: MkPayAmt; out_tys: Array; onlyIf: boolean; soloSend: boolean; timeoutAt: TimeArg | undefined; lct: BigNumber; sim_p: (fake: IRecv) => Promise>; }; export declare type IRecvArgs = { funcNum: number; evt_cnt: number; out_tys: Array; didSend: boolean; waitIfNotPresent: boolean; timeoutAt: TimeArg | undefined; }; export declare type ParticipantVal = (io: any) => Promise; export declare type ParticipantMap = { [key: string]: ParticipantVal; }; export declare type ViewVal = (...args: any) => Promise; export declare type ViewFunMap = { [key: string]: ViewVal; }; export declare type ViewMap = { [key: string]: ViewVal | ViewFunMap; }; export declare type APIMap = ViewMap; export declare type EventMap = { [key: string]: any; }; export declare type IContractCompiled = { getContractCompanion: () => Promise>; getContractInfo: () => Promise; getContractAddress: () => Promise; getBalance: () => Promise; waitUntilTime: (v: BigNumber) => Promise; waitUntilSecs: (v: BigNumber) => Promise; selfAddress: () => CBR_Address; iam: (some_addr: RawAddress) => RawAddress; stdlib: Object; sendrecv: (args: ISendRecvArgs) => Promise>; recv: (args: IRecvArgs) => Promise>; getState: (v: BigNumber, ctcs: Array) => Promise>; getCurrentStep: () => Promise; apiMapRef: (i: number, ty: ConnectorTy) => MapRefT; }; export declare type ISetupArgs = { setInfo: (info: ContractInfo) => void; getInfo: () => Promise; setTrustedVerifyResult: (vr: VerifyResult) => void; getTrustedVerifyResult: () => (VerifyResult | undefined); }; export declare type ISetupViewArgs = Omit, ("setInfo")>; export declare type ISetupEventArgs = Omit, ("setInfo")>; declare type SpecificKeys = ("getContractInfo" | "getContractAddress" | "getContractCompanion" | "getBalance" | "sendrecv" | "recv" | "getState" | "getCurrentStep" | "apiMapRef"); export declare type ISetupRes = Pick, (SpecificKeys)>; export declare type IStdContractArgs = { bin: IBackend; getABI: (x?: boolean) => unknown; setupView: ISetupView; setupEvents: ISetupEvent; givenInfoP: (Promise | undefined); _setup: (args: ISetupArgs) => ISetupRes; } & Omit, (SpecificKeys)>; export declare type IContract = { getInfo: () => Promise; getViews: () => ViewMap; getContractAddress: () => Promise; getABI: (x?: boolean) => unknown; participants: ParticipantMap; p: ParticipantMap; views: ViewMap; v: ViewMap; unsafeViews: ViewMap; apis: APIMap; a: APIMap; safeApis: APIMap; e: EventMap; events: EventMap; _initialize: () => IContractCompiled; }; export declare type ISetupView = (args: ISetupViewArgs) => { viewLib: IViewLib; getView1: ((views: IBackendViewsInfo, v: string, k: string | undefined, vi: IBackendViewInfo, isSafe: boolean) => ViewVal); }; export declare type ISetupEvent = (args: ISetupEventArgs) => { createEventStream: (event: string, tys: any[]) => { lastTime: () => Promise