Quick Start

This section shows code examples on how to get started in different languages using Defire's libraries.
JavaScript & Node
JavaScript & Node

1. Install the library.

npm install defire

2. Create an Ethereum account and fund it with some Rinkeby ethers.

3. Initialize Defire library with that Ethereum account.

const defire = Defire({
address: "[INSERT ADDRESS OF ETHEREUM ACCOUNT]" ,
web3js: web3
}, { network: "rinkeby" }
);

4. Buy Some DAI in Uniswap

const operationBuy = new defire.Operations.Uniswap.Trade.ETH.For.DAI({
amountETH: "500000000000000000" // 0.5 ETH
});
await defire.actions.execute(operationBuy);

5. Get your current DAI balance

const balance = await defire.query.balance(defire.Assets.DAI);

6. Lend all your DAI in Compound

const operationLend = new defire.Operations.Compound.Lend.DAI({
amountDAI: balance // 100% of DAI balance
});
await defire.actions.execute(operationLend);

Congrats! You have bought DAI and lent it with a few lines of code. 😃

Consider using a portfolio. Check why they are safer.