/** * @file Ethereum * @desc These methods facilitate interactions with the Ethereum blockchain. */ import { CallOptions, Provider, ProviderNetwork } from './types'; /** * This is a generic method for invoking JSON RPC's `eth_call` with Ethers.js. * Use this method to execute a smart contract's constant or non-constant * member without using gas. This is a read-only method intended to read a * value or test a transaction for valid parameters. It does not create a * transaction on the block chain. * * @param {string} address The Ethereum address the transaction is directed to. * @param {string} method The smart contract member in which to invoke. * @param {any[]} [parameters] Parameters of the method to invoke. * @param {CallOptions} [options] Options to set for `eth_call`, optional ABI * (as JSON object), and Ethers.js method overrides. The ABI can be a string * of the single intended method, an array of many methods, or a JSON object * of the ABI generated by a Solidity compiler. * * @returns {Promise} Return value of the invoked smart contract member or an error * object if the call failed. * * @example * ``` * const cEthAddress = Rifi.util.getAddress(Rifi.rETH); * * (async function() { * * const srpb = await Rifi.eth.read( * cEthAddress, * 'function supplyRatePerBlock() returns (uint256)', * // [], // [optional] parameters * // {} // [optional] call options, provider, network, plus Ethers.js "overrides" * ); * * console.log('rETH market supply rate per block:', srpb.toString()); * * })().catch(console.error); * ``` */ export declare function read(address: string, method: string, parameters?: any[], options?: CallOptions): Promise; /** * This is a generic method for invoking JSON RPC's `eth_sendTransaction` with * Ethers.js. Use this method to create a transaction that invokes a smart * contract method. Returns an Ethers.js `TransactionResponse` object. * * @param {string} address The Ethereum address the transaction is directed to. * @param {string} method The smart contract member in which to invoke. * @param {any[]} [parameters] Parameters of the method to invoke. * @param {CallOptions} [options] Options to set for `eth_sendTransaction`, * (as JSON object), and Ethers.js method overrides. The ABI can be a string * optional ABI of the single intended method, an array of many methods, or * a JSON object of the ABI generated by a Solidity compiler. * * @returns {Promise} Returns an Ethers.js `TransactionResponse` object or an error * object if the transaction failed. * * @example * ``` * const oneEthInWei = '1000000000000000000'; * const cEthAddress = '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5'; * const provider = window.ethereum; * * (async function() { * console.log('Supplying ETH to the Rifi Protocol...'); * * // Mint some rETH by supplying ETH to the Rifi Protocol * const trx = await Rifi.eth.trx( * cEthAddress, * 'function mint() payable', * [], * { * provider, * value: oneEthInWei * } * ); * * // const result = await trx.wait(1); // JSON object of trx info, once mined * * console.log('Ethers.js transaction object', trx); * })().catch(console.error); * ``` */ export declare function trx(address: string, method: string, parameters?: any[], options?: CallOptions): Promise; /** * This helps the Rifi.js constructor discover which Ethereum network the * developer wants to use. * * @param {Provider | string} [provider] Optional Ethereum network provider. * Defaults to Ethers.js fallback mainnet provider. * * @hidden * * @returns {object} Returns a metadata object containing the Ethereum network * name and ID. */ export declare function getProviderNetwork(provider: Provider): Promise; /** * Fetches the current Ether balance of a provided Ethereum address. * * @param {string} address The Ethereum address in which to get the ETH balance. * @param {Provider | string} [provider] Optional Ethereum network provider. * Defaults to Ethers.js fallback mainnet provider. * * @returns {BigNumber} Returns a BigNumber hexadecimal value of the ETH balance * of the address. * * @example * ``` * (async function () { * * balance = await Rifi.eth.getBalance(myAddress, provider); * console.log('My ETH Balance', +balance); * * })().catch(console.error); * ``` */ export declare function getBalance(address: string, provider: Provider | string): Promise; /** * Creates an Ethereum network provider object. * * @param {CallOptions} options The call options of a pending Ethereum * transaction. * * @hidden * * @returns {object} Returns a valid Ethereum network provider object. */ export declare function _createProvider(options?: CallOptions): Provider;