UNPKG

@celo/contractkit

Version:

Celo's ContractKit to interact with Celo network

65 lines (64 loc) 2.65 kB
import { newAccounts } from '@celo/abis/web3/Accounts'; import { newGoldToken } from '@celo/abis/web3/GoldToken'; import { newStableToken } from '@celo/abis/web3/mento/StableToken'; import { newStableTokenBRL } from '@celo/abis/web3/mento/StableTokenBRL'; import { newStableTokenEUR } from '@celo/abis/web3/mento/StableTokenEUR'; import { StableToken } from '@celo/base'; import { Connection } from '@celo/connect'; import { AddressRegistry } from './address-registry'; import { ContractCacheType } from './basic-contract-cache-type'; import { AccountsWrapper } from './wrappers/Accounts'; import { GoldTokenWrapper } from './wrappers/GoldTokenWrapper'; import { StableTokenWrapper } from './wrappers/StableTokenWrapper'; declare const MINIMUM_CONTRACTS: { Accounts: { newInstance: typeof newAccounts; wrapper: typeof AccountsWrapper; }; CeloToken: { newInstance: typeof newGoldToken; wrapper: typeof GoldTokenWrapper; }; StableToken: { newInstance: typeof newStableToken; wrapper: typeof StableTokenWrapper; }; StableTokenBRL: { newInstance: typeof newStableTokenBRL; wrapper: typeof StableTokenWrapper; }; StableTokenEUR: { newInstance: typeof newStableTokenEUR; wrapper: typeof StableTokenWrapper; }; }; export type ContractsBroughtBase = typeof MINIMUM_CONTRACTS; type Keys = keyof ContractsBroughtBase; type Wrappers<T extends Keys> = InstanceType<ContractsBroughtBase[T]['wrapper']>; /** * Alternative Contract Cache with Minimal Contracts * * Provides access to a subset of wrappers: {@link AccountsWrapper}, {@link GasPriceMinimumWrapper} and Celo Token contracts * Used internally by {@link MiniContractKit} * * @param connection – {@link Connection} * @param registry – {@link AddressRegistry} */ export declare class MiniContractCache implements ContractCacheType { readonly connection: Connection; readonly registry: AddressRegistry; private readonly contractClasses; private cache; constructor(connection: Connection, registry: AddressRegistry, contractClasses?: ContractsBroughtBase); getAccounts(): Promise<AccountsWrapper>; getGoldToken(): Promise<GoldTokenWrapper>; getStableToken(stableToken?: StableToken): Promise<StableTokenWrapper>; /** * Get Contract wrapper */ getContract<ContractKey extends keyof ContractsBroughtBase>(contract: ContractKey, address?: string): Promise<Wrappers<ContractKey>>; private setContract; invalidateContract<C extends keyof ContractsBroughtBase>(contract: C): void; private isContractAvailable; } export {};