Supply
Supplies the user's Ethereum asset to the Onyx Protocol.
asset(string) A string of the asset to supply.amount(number | string | BigNumber) A string, number, or BigNumber object of the amount of an asset to supply. Use themantissaboolean in theoptionsparameter to indicate if this value is scaled up (so there are no decimals) or in its natural scale.noApprove(boolean) Explicitly prevent this method from attempting an ERC-20approvetransaction prior to sending theminttransaction.[options](CallOptions) Call options and Ethers.js overrides for the transaction. A passedgasLimitwill be used in both theapprove(if not supressed) andminttransactions.RETURN(object) Returns an Ethers.js transaction object of the supply transaction.
const onyx = new Onyx(window.ethereum);
// Ethers.js overrides are an optional 3rd parameter for `supply`
// const trxOptions = { gasLimit: 250000, mantissa: false };
(async function() {
console.log('Supplying ETH to the Onyx Protocol...');
const trx = await onyx.supply(Onyx.ETH, 1);
console.log('Ethers.js transaction object', trx);
})().catch(console.error);Last updated