/** * @file Compound * @desc This file defines the constructor of the `Compound` class. * @hidden */ import { ethers } from 'ethers'; import * as comet from './comet'; import * as comp from './comp'; import * as eth from './eth'; import * as util from './util'; import { Provider, CompoundOptions, CompoundInstance } from './types'; /** * Creates an instance of the Compound.js SDK. * * @param {Provider | string} [provider] Optional Ethereum network provider. * Defaults to Ethers.js fallback mainnet provider. * @param {object} [options] Optional provider options. * * @example * * ``` * var compound = new Compound(window.ethereum); // web browser * * var compound = new Compound('http://127.0.0.1:8545'); // HTTP provider * * var compound = new Compound(); // Uses Ethers.js fallback mainnet (for testing only) * * var compound = new Compound('goerli'); // Uses Ethers.js fallback (for testing only) * * // Init with private key (server side) * var compound = new Compound('https://mainnet.infura.io/v3/_your_project_id_', { * privateKey: '0x_your_private_key_', // preferably with environment variable * }); * * // Init with HD mnemonic (server side) * var compound = new Compound('mainnet' { * mnemonic: 'clutch captain shoe...', // preferably with environment variable * }); * ``` * * Compound III (Comet) Object Initialization. This accepts the same parameters * as the `Compound` constructor. An error will be thrown initially and * whenever a method is called if the provider does not match the network of * the specific Comet deployment. The SDK constants as well as a method in * the Comet documentation note the Comet deployments that Compound.js * supports. * * ``` * var compound = new Compound(window.ethereum); * var comet = compound.comet.MAINNET_USDC(); // provider from `compound` will be used unless on is explicitly passed * ``` * * @returns {object} Returns an instance of the Compound.js SDK. */ declare const Compound: { (provider?: Provider | string, options?: CompoundOptions): CompoundInstance; eth: typeof eth; util: typeof util; _ethers: typeof ethers; decimals: { cAAVE: number; cBAT: number; cCOMP: number; cDAI: number; cETH: number; cFEI: number; cLINK: number; cMKR: number; cREP: number; cSAI: number; cSUSHI: number; cTUSD: number; cUNI: number; cUSDC: number; cUSDP: number; cUSDT: number; cWBTC: number; cYFI: number; cZRX: number; AAVE: number; BAT: number; BTC: number; COMP: number; DAI: number; ETH: number; FEI: number; LINK: number; MKR: number; REP: number; SAI: number; SUSHI: number; TUSD: number; UNI: number; USDC: number; USDP: number; USDT: number; WBTC: number; YFI: number; ZRX: number; }; comp: { getCompAccrued: typeof comp.getCompAccrued; getCompBalance: typeof comp.getCompBalance; }; comet: { getSupportedDeployments: typeof comet.getSupportedDeployments; getSupportedCollaterals: typeof comet.getSupportedCollaterals; getBaseAssetName: typeof comet.getBaseAssetName; }; }; export = Compound;