import { StrongAddress } from '@celo/base'; import { CeloTx, CeloTxObject, Connection, ReadOnlyWallet, TransactionResult } from '@celo/connect'; import { EIP712TypedData } from '@celo/utils/lib/sign-typed-data-utils'; import { Signature } from '@celo/utils/lib/signatureUtils'; import { BigNumber } from 'bignumber.js'; import Web3 from 'web3'; import { AddressRegistry } from './address-registry'; import { CeloContract } from './base'; import { CeloTokens, EachCeloToken } from './celo-tokens'; import { WrapperCache } from './contract-cache'; import { HttpProviderOptions } from './setupForKits'; import { Web3ContractCache } from './web3-contract-cache'; import { AttestationsConfig } from './wrappers/Attestations'; import { ElectionConfig } from './wrappers/Election'; import { GovernanceConfig } from './wrappers/Governance'; import { LockedGoldConfig } from './wrappers/LockedGold'; import { ReserveConfig } from './wrappers/Reserve'; import { SortedOraclesConfig } from './wrappers/SortedOracles'; import { StableTokenConfig } from './wrappers/StableTokenWrapper'; import { ValidatorsConfig } from './wrappers/Validators'; export { API_KEY_HEADER_KEY, HttpProviderOptions } from './setupForKits'; /** * Creates a new instance of `ContractKit` given a nodeUrl * @param url CeloBlockchain node url * @param wallet to reuse or add a wallet different than the default (example ledger-wallet) * @param options to pass to the Web3 HttpProvider constructor */ export declare function newKit(url: string, wallet?: ReadOnlyWallet, options?: HttpProviderOptions): ContractKit; /** * Creates a new instance of `ContractKit` given a nodeUrl and apiKey * @param url CeloBlockchain node url * @param apiKey to include in the http request header * @param wallet to reuse or add a wallet different than the default (example ledger-wallet) */ export declare function newKitWithApiKey(url: string, apiKey: string, wallet?: ReadOnlyWallet): ContractKit; /** * Creates a new instance of the `ContractKit` with a web3 instance * @param web3 Web3 instance */ export declare function newKitFromWeb3(web3: Web3, wallet?: ReadOnlyWallet): ContractKit; export interface NetworkConfig { stableTokens: EachCeloToken; election: ElectionConfig; attestations: AttestationsConfig; governance: GovernanceConfig; lockedGold: LockedGoldConfig; sortedOracles: SortedOraclesConfig; reserve: ReserveConfig; validators: ValidatorsConfig; } interface AccountBalance extends EachCeloToken { lockedCELO: BigNumber; pending: BigNumber; } export declare class ContractKit { readonly connection: Connection; /** core contract's address registry */ readonly registry: AddressRegistry; /** factory for core contract's native web3 wrappers */ readonly _web3Contracts: Web3ContractCache; /** factory for core contract's kit wrappers */ readonly contracts: WrapperCache; /** helper for interacting with CELO & stable tokens */ readonly celoTokens: CeloTokens; /** @deprecated no longer needed since gasPrice is available on node rpc */ gasPriceSuggestionMultiplier: number; constructor(connection: Connection); getWallet(): ReadOnlyWallet | undefined; getTotalBalance(address: string): Promise; getNetworkConfig(humanReadable?: boolean): Promise>; getHumanReadableNetworkConfig: () => Promise>; /** * Set an addressed to use to pay for gas fees * @param address any hexadecimal address * @dev Throws if supplied address is not a valid hexadecimal address */ setFeeCurrency(address: StrongAddress): void; /** * @returns epoch duration (in seconds) */ getEpochSize(): Promise; getFirstBlockNumberForEpoch(epochNumber: number): Promise; getLastBlockNumberForEpoch(epochNumber: number): Promise; getEpochNumberOfBlock(blockNumber: number): Promise; addAccount(privateKey: string): void; set defaultAccount(address: StrongAddress | undefined); get defaultAccount(): StrongAddress | undefined; set gasInflationFactor(factor: number); get gasInflationFactor(): number; set defaultFeeCurrency(address: StrongAddress | undefined); get defaultFeeCurrency(): StrongAddress | undefined; isListening(): Promise; isSyncing(): Promise; sendTransaction(tx: CeloTx): Promise; sendTransactionObject(txObj: CeloTxObject, tx?: Omit): Promise; signTypedData(signer: string, typedData: EIP712TypedData): Promise; stop(): void; get web3(): Web3; }