-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce1e788
commit 92e6ce5
Showing
3 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# @liquity/lib-base | ||
|
||
Shared interfaces and classes of the Liquity SDK. | ||
|
||
Needs to be installed in order to use other Liquity SDK packages, for example [@liquity/lib-ethers](https://www.npmjs.com/package/@liquity/lib-ethers). | ||
|
||
## API Reference | ||
|
||
For now, it can be found in the public Liquity [repo](https://github.com/liquity/liquity/blob/master/docs/sdk/lib-base.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# @liquity/lib-ethers | ||
|
||
[Ethers](https://www.npmjs.com/package/ethers)-based library for reading Liquity protocol state and sending transactions. | ||
|
||
## Quickstart | ||
|
||
Install in your project: | ||
|
||
``` | ||
npm install --save @liquity/lib-base @liquity/lib-ethers ethers@^5.0.0 | ||
``` | ||
|
||
Connecting to an Ethereum node and sending a transaction: | ||
|
||
```javascript | ||
const { Wallet, providers } = require("ethers"); | ||
const { EthersLiquity } = require("@liquity/lib-ethers"); | ||
|
||
async function example() { | ||
const provider = new providers.JsonRpcProvider("http://localhost:8545"); | ||
const wallet = new Wallet(process.env.PRIVATE_KEY).connect(provider); | ||
const liquity = await EthersLiquity.connect(wallet); | ||
|
||
const { newTrove } = await liquity.openTrove({ | ||
depositCollateral: 1, // ETH | ||
borrowLUSD: 200 | ||
}); | ||
|
||
console.log(`Successfully opened a Liquity Trove (${newTrove})!`); | ||
} | ||
``` | ||
|
||
## More examples | ||
|
||
See [packages/examples](https://github.com/liquity/liquity/tree/master/packages/examples) in the repo. | ||
|
||
Liquity's [Dev UI](https://github.com/liquity/liquity/tree/master/packages/dev-frontend) itself contains many examples of `@liquity/lib-ethers` use. | ||
|
||
## API Reference | ||
|
||
For now, it can be found in the public Liquity [repo](https://github.com/liquity/liquity/blob/master/docs/sdk/lib-ethers.md). |