/// import { ICeloVersionedContract } from '@celo/abis/web3/ICeloVersionedContract'; import { StrongAddress } from '@celo/base/lib/address'; import { CeloTransactionObject, CeloTxObject, Connection, Contract, EventLog, PastEventOptions } from '@celo/connect'; import BigNumber from 'bignumber.js'; import { ContractVersion } from '../versions'; /** Represents web3 native contract Method */ type Method = (...args: I) => CeloTxObject; type Events = keyof T['events']; type EventsEnum = { [event in Events]: event; }; /** * @internal -- use its children */ export declare abstract class BaseWrapper { protected readonly connection: Connection; protected readonly contract: T; protected _version?: T['methods'] extends ICeloVersionedContract['methods'] ? ContractVersion : never; constructor(connection: Connection, contract: T); /** Contract address */ get address(): StrongAddress; version(): Promise; } ? ContractVersion : never>; protected onlyVersionOrGreater(version: ContractVersion): Promise; /** Contract getPastEvents */ getPastEvents(event: Events, options: PastEventOptions): Promise; events: T['events']; eventTypes: EventsEnum; methodIds: Record; } export declare const valueToBigNumber: (input: BigNumber.Value) => BigNumber; export declare const fixidityValueToBigNumber: (input: BigNumber.Value) => BigNumber; export declare const valueToString: (input: BigNumber.Value) => string; export declare const valueToFixidityString: (input: BigNumber.Value) => string; export declare const valueToInt: (input: BigNumber.Value) => number; export declare const valueToFrac: (numerator: BigNumber.Value, denominator: BigNumber.Value) => BigNumber; declare enum TimeDurations { millennium = 31536000000000, century = 3153600000000, decade = 315360000000, year = 31536000000, quarter = 7776000000, month = 2592000000, week = 604800000, day = 86400000, hour = 3600000, minute = 60000, second = 1000, millisecond = 1 } type TimeUnit = keyof typeof TimeDurations; export declare function secondsToDurationString(durationSeconds: BigNumber.Value, outputUnits?: TimeUnit[]): string; export declare const blocksToDurationString: (input: BigNumber.Value) => string; export declare const unixSecondsTimestampToDateString: (input: BigNumber.Value) => string; type SolidityBytes = string | number[]; export declare const stringToSolidityBytes: (input: string) => SolidityBytes; export declare const bufferToSolidityBytes: (input: Buffer) => SolidityBytes; export declare const solidityBytesToString: (input: SolidityBytes) => string; type Parser = (input: A) => B; /** Identity Parser */ export declare const identity: (a: A) => A; export declare const stringIdentity: (x: string) => string; /** * Tuple parser * Useful to map different input arguments */ export declare function tupleParser(parser0: Parser): (...args: [A0]) => [B0]; export declare function tupleParser(parser0: Parser, parser1: Parser): (...args: [A0, A1]) => [B0, B1]; export declare function tupleParser(parser0: Parser, parser1: Parser, parser2: Parser): (...args: [A0, A1, A2]) => [B0, B1, B2]; export declare function tupleParser(parser0: Parser, parser1: Parser, parser2: Parser, parser3: Parser): (...args: [A0, A1, A2, A3]) => [B0, B1, B2, B3]; /** * Creates a proxy to call a web3 native contract method. * * There are 4 cases: * - methodFn * - parseInputArgs => methodFn * - parseInputArgs => methodFn => parseOutput * - methodFn => parseOutput * * @param methodFn Web3 methods function * @param parseInputArgs [optional] parseInputArgs function, tranforms arguments into `methodFn` expected inputs * @param parseOutput [optional] parseOutput function, transforms `methodFn` output into proxy return */ export declare function proxyCall(methodFn: Method, parseInputArgs: (...args: InputArgs) => ParsedInputArgs, parseOutput: (o: PreParsedOutput) => Output): (...args: InputArgs) => Promise; export declare function proxyCall(methodFn: Method, x: undefined, parseOutput: (o: PreParsedOutput) => Output): (...args: InputArgs) => Promise; export declare function proxyCall(methodFn: Method, parseInputArgs: (...args: InputArgs) => ParsedInputArgs): (...args: InputArgs) => Promise; export declare function proxyCall(methodFn: Method): (...args: InputArgs) => Promise; /** * Specifies all different possible proxySend arguments so that * it always return a function of type: (...args:InputArgs) => CeloTransactionObject * * cases: * - methodFn * - parseInputArgs => methodFn */ type ProxySendArgs = [Method, (...arg: InputArgs) => ParsedInputArgs] | [Method]; /** * Creates a proxy to send a tx on a web3 native contract method. * * There are 2 cases: * - call methodFn (no pre or post parsing) * - preParse arguments & call methodFn * * @param methodFn Web3 methods function * @param preParse [optional] preParse function, tranforms arguments into `methodFn` expected inputs */ export declare function proxySend(connection: Connection, ...sendArgs: ProxySendArgs): (...args: InputArgs) => CeloTransactionObject; export {};