@celo/contractkit
Version:
Celo's ContractKit to interact with Celo network
49 lines (48 loc) • 2.17 kB
TypeScript
import { Connection, ReadOnlyWallet } from '@celo/connect';
import { BigNumber } from 'bignumber.js';
import Web3 from 'web3';
import { AddressRegistry } from './address-registry';
import { CeloTokens, EachCeloToken } from './celo-tokens';
import { MiniContractCache } from './mini-contract-cache';
import { HttpProviderOptions } from './setupForKits';
/**
* Creates a new instance of `MiniMiniContractKit` 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): MiniContractKit;
/**
* Creates a new instance of `MiniContractKit` 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): MiniContractKit;
/**
* Creates a new instance of the `MiniContractKit` with a web3 instance
* @param web3 Web3 instance
*/
export declare function newKitFromWeb3(web3: Web3, wallet?: ReadOnlyWallet): MiniContractKit;
/**
* MiniContractKit provides a core subset of {@link ContractKit}'s functionality
*
* @remarks
*
* It is recommended to use this over ContractKit for dApps as it is lighter
*
* @param connection – an instance of @celo/connect {@link Connection}
*/
export declare class MiniContractKit {
readonly connection: Connection;
/** core contract's address registry */
readonly registry: AddressRegistry;
/** factory for subset of core contract's kit wrappers */
readonly contracts: MiniContractCache;
/** helper for interacting with CELO & stable tokens */
readonly celoTokens: CeloTokens;
constructor(connection: Connection);
getWallet(): ReadOnlyWallet | undefined;
getTotalBalance(address: string): Promise<EachCeloToken<BigNumber>>;
}
export declare const ContractKit: typeof MiniContractKit;