diff --git a/LICENSE b/LICENSE index 50b2d26..0544dbb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2020 Compound Labs, Inc. +Copyright 2020 Venus Labs, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index c1c7bec..7d7009f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Compound.js +# Venus.js -A JavaScript SDK for Ethereum and the Compound Protocol. Wraps around [Ethers.js](https://github.com/ethers-io/ethers.js/). Works in the **web browser** and **Node.js**. +A JavaScript SDK for Ethereum and the Venus Protocol. Wraps around [Ethers.js](https://github.com/ethers-io/ethers.js/). Works in the **web browser** and **Node.js**. -[Compound.js Documentation](https://compound.finance/docs/compound-js) +[Venus.js Documentation](https://docs927beta.venus.io) This SDK is in **open beta**, and is constantly under development. **USE AT YOUR OWN RISK**. @@ -13,12 +13,12 @@ JSON RPC based Ethereum **read** and **write**. ### Read ```js -const Compound = require('@compound-finance/compound-js'); // in Node.js -const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT); +const Venus = require('@swipewallet/venus-js'); // in Node.js +const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT); (async function() { - let supplyRatePerBlock = await Compound.eth.read( + let supplyRatePerBlock = await Venus.eth.read( cUsdtAddress, 'function supplyRatePerBlock() returns (uint)', [], // [optional] parameters @@ -37,35 +37,35 @@ const toAddress = '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'; (async function() { - const trx = await Compound.eth.trx( + const trx = await Venus.eth.trx( toAddress, 'function send() external payable', [], { - value: Compound._ethers.utils.parseEther('1.0'), // 1 ETH + value: Venus._ethers.utils.parseEther('1.0'), // 1 ETH provider: window.ethereum, // in a web browser } ); - const toAddressEthBalance = await Compound.eth.getBalance(toAddress); + const toAddressEthBalance = await Venus.eth.getBalance(toAddress); })().catch(console.error); ``` -## Compound Protocol +## Venus Protocol -Simple methods for using the Compound protocol. +Simple methods for using the Venus protocol. ```js -const compound = new Compound(window.ethereum); // in a web browser +const venus = new Venus(window.ethereum); // in a web browser // Ethers.js overrides are an optional 3rd parameter for `supply` // const trxOptions = { gasLimit: 250000, mantissa: false }; (async function() { - console.log('Supplying ETH to the Compound protocol...'); - const trx = await compound.supply(Compound.ETH, 1); + console.log('Supplying ETH to the Venus protocol...'); + const trx = await venus.supply(Venus.ETH, 1); console.log('Ethers.js transaction object', trx); })().catch(console.error); @@ -76,54 +76,54 @@ const compound = new Compound(window.ethereum); // in a web browser Web Browser ```html - + ``` Node.js ``` -npm install @compound-finance/compound-js +npm install @swipewallet/venus-js ``` ```js -const Compound = require('@compound-finance/compound-js'); +const Venus = require('@swipewallet/venus-js'); // or, when using ES6 -import Compound from '@compound-finance/compound-js'; +import Venus from '@swipewallet/venus-js'; ``` ## More Code Examples -- [Node.js](https://github.com/compound-finance/compound-js/tree/master/examples) -- [Web Browser](https://compound-finance.github.io/compound-js/examples/web/) +- [Node.js](https://github.com/SwipeWallet/venus-js/tree/master/examples) +- [Web Browser](https://github.com/SwipeWallet/venus-js/examples/web/) -[To run, boot Ganache fork of mainnet locally](https://github.com/compound-finance/compound-js/tree/master/examples) +[To run, boot Ganache fork of mainnet locally](https://github.com/SwipeWallet/venus-js/tree/master/examples) ## Instance Creation The following are valid Ethereum providers for initialization of the SDK. ```js -var compound = new Compound(window.ethereum); // web browser +var venus = new Venus(window.ethereum); // web browser -var compound = new Compound('http://127.0.0.1:8545'); // HTTP provider +var venus = new Venus('http://127.0.0.1:8545'); // HTTP provider -var compound = new Compound(); // Uses Ethers.js fallback mainnet (for testing only) +var venus = new Venus(); // Uses Ethers.js fallback mainnet (for testing only) -var compound = new Compound('ropsten'); // Uses Ethers.js fallback (for testing only) +var venus = new Venus('ropsten'); // 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_', { +var venus = new Venus('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' { +var venus = new Venus('mainnet' { mnemonic: 'clutch captain shoe...', // preferably with environment variable }); ``` @@ -133,10 +133,10 @@ var compound = new Compound('mainnet' { Names of contracts, their addresses, ABIs, token decimals, and more can be found in `/src/constants.ts`. Addresses, for all networks, can be easily fetched using the `getAddress` function, combined with contract name constants. ```js -console.log(Compound.DAI, Compound.ETH, Compound.cETH); -// DAI, ETH, cETH +console.log(Venus.DAI, Venus.BNB, Venus.vSXP); +// DAI, BNB, vSXP -const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT); +const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT); // Mainnet cUSDT address. Second parameter can be a network like 'ropsten'. ``` @@ -146,10 +146,10 @@ Parameters of number values can be plain numbers or their scaled up mantissa val ```js // 1 Dai -await compound.borrow(Compound.DAI, '1000000000000000000', { mantissa: true }); +await venus.borrow(Venus.DAI, '1000000000000000000', { mantissa: true }); // `mantissa` defaults to false if it is not specified or if an options object is not passed -await compound.borrow(Compound.DAI, 1, { mantissa: false }); +await venus.borrow(Venus.DAI, 1, { mantissa: false }); ``` ## Transaction Options @@ -163,27 +163,27 @@ const trxOptions = { provider, // JSON RPC string, Web3 object, or Ethers.js fallback network (string) network, // Ethers.js fallback network provider, "provider" has precedence over "network" from, // Address that the Ethereum transaction is send from - gasPrice, // Ethers.js override `Compound._ethers.utils.parseUnits('10.0', 'gwei')` + gasPrice, // Ethers.js override `Venus._ethers.utils.parseUnits('10.0', 'gwei')` gasLimit, // Ethers.js override - see https://docs.ethers.io/ethers.js/v5-beta/api-contract.html#overrides value, // Number or string data, // Number or string chainId, // Number nonce, // Number - privateKey, // String, meant to be used with `Compound.eth.trx` (server side) - mnemonic, // String, meant to be used with `Compound.eth.trx` (server side) + privateKey, // String, meant to be used with `Venus.eth.trx` (server side) + mnemonic, // String, meant to be used with `Venus.eth.trx` (server side) }; ``` ## API -The [Compound API](https://compound.finance/docs/api) is accessible from Compound.js. The corresponding services are defined in the `api` namespace on the class. +The [Venus API](https://docs927beta.venus.io/docs/api) is accessible from Venus.js. The corresponding services are defined in the `api` namespace on the class. -- `Compound.api.account` -- `Compound.api.cToken` -- `Compound.api.marketHistory` -- `Compound.api.governance` +- `Venus.api.account` +- `Venus.api.cToken` +- `Venus.api.marketHistory` +- `Venus.api.governance` -The governance method requires a second parameter (string) for the corresponding endpoint shown in the [documentation](https://compound.finance/docs/api#GovernanceService). +The governance method requires a second parameter (string) for the corresponding endpoint shown in the [documentation](https://docs927beta.venus.io/docs/venus-js/api#GovernanceService). - `proposals` - `voteReceipts` @@ -193,23 +193,23 @@ Here is an example for using the `account` endpoint. The `network` parameter in ```js const main = async () => { - const account = await Compound.api.account({ + const account = await Venus.api.account({ "addresses": "0xB61C5971d9c0472befceFfbE662555B78284c307", "network": "ropsten" }); - let daiBorrowBalance = 0; + let sxpBorrowBalance = 0; if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Compound.cDAI) { + if (tok.symbol === Venus.vSXP) { daiBorrowBalance = +tok.borrow_balance_underlying.value; } }); }); } - console.log('daiBorrowBalance', daiBorrowBalance); + console.log('sxpBorrowBalance', sxpBorrowBalance); } main().catch(console.error); @@ -218,8 +218,8 @@ main().catch(console.error); ## Build for Node.js & Web Browser ``` -git clone git@github.com:compound-finance/compound-js.git -cd compound-js/ +git clone git@github.com:SwipeWallet/venus-js.git +cd venus-js/ npm install npm run build ``` @@ -227,17 +227,17 @@ npm run build ### Web Browser Build ```html - + - + ``` ### Node.js Build ```js // Local build (do `npm install` first) -const Compound = require('./dist/nodejs/index.js'); +const Venus = require('./dist/nodejs/index.js'); // Public NPM build -const Compound = require('@compound-finance/compound-js'); +const Venus = require('@swipewallet/venus-js'); ``` diff --git a/docs/assets/js/search.json b/docs/assets/js/search.json index a0491bb..d431613 100644 --- a/docs/assets/js/search.json +++ b/docs/assets/js/search.json @@ -1 +1 @@ -{"kinds":{"1":"Module","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"EIP712\"","url":"modules/_eip712_.html","classes":"tsd-kind-module"},{"id":1,"kind":1,"name":"\"constants\"","url":"modules/_constants_.html","classes":"tsd-kind-module"},{"id":2,"kind":1,"name":"\"util\"","url":"modules/_util_.html","classes":"tsd-kind-module"},{"id":3,"kind":64,"name":"getAddress","url":"modules/_util_.html#getaddress","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":4,"kind":64,"name":"getAbi","url":"modules/_util_.html#getabi","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":5,"kind":64,"name":"getNetNameWithChainId","url":"modules/_util_.html#getnetnamewithchainid","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":6,"kind":1,"name":"\"api\"","url":"modules/_api_.html","classes":"tsd-kind-module"},{"id":7,"kind":64,"name":"account","url":"modules/_api_.html#account","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":8,"kind":64,"name":"cToken","url":"modules/_api_.html#ctoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":9,"kind":64,"name":"marketHistory","url":"modules/_api_.html#markethistory","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":10,"kind":64,"name":"governance","url":"modules/_api_.html#governance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":11,"kind":1,"name":"\"eth\"","url":"modules/_eth_.html","classes":"tsd-kind-module"},{"id":12,"kind":64,"name":"read","url":"modules/_eth_.html#read","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":13,"kind":64,"name":"trx","url":"modules/_eth_.html#trx","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":14,"kind":64,"name":"getBalance","url":"modules/_eth_.html#getbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":15,"kind":1,"name":"\"helpers\"","url":"modules/_helpers_.html","classes":"tsd-kind-module"},{"id":16,"kind":1,"name":"\"cToken\"","url":"modules/_ctoken_.html","classes":"tsd-kind-module"},{"id":17,"kind":64,"name":"supply","url":"modules/_ctoken_.html#supply","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":18,"kind":64,"name":"redeem","url":"modules/_ctoken_.html#redeem","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":19,"kind":64,"name":"borrow","url":"modules/_ctoken_.html#borrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":20,"kind":64,"name":"repayBorrow","url":"modules/_ctoken_.html#repayborrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":21,"kind":1,"name":"\"comp\"","url":"modules/_comp_.html","classes":"tsd-kind-module"},{"id":22,"kind":64,"name":"toChecksumAddress","url":"modules/_comp_.html#tochecksumaddress","classes":"tsd-kind-function tsd-parent-kind-module tsd-is-not-exported","parent":"\"comp\""},{"id":23,"kind":64,"name":"getCompBalance","url":"modules/_comp_.html#getcompbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":24,"kind":64,"name":"getCompAccrued","url":"modules/_comp_.html#getcompaccrued","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":25,"kind":64,"name":"claimComp","url":"modules/_comp_.html#claimcomp","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":26,"kind":64,"name":"delegate","url":"modules/_comp_.html#delegate","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":27,"kind":64,"name":"delegateBySig","url":"modules/_comp_.html#delegatebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":28,"kind":64,"name":"createDelegateSignature","url":"modules/_comp_.html#createdelegatesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":29,"kind":1,"name":"\"comptroller\"","url":"modules/_comptroller_.html","classes":"tsd-kind-module"},{"id":30,"kind":64,"name":"enterMarkets","url":"modules/_comptroller_.html#entermarkets","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":31,"kind":64,"name":"exitMarket","url":"modules/_comptroller_.html#exitmarket","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":32,"kind":1,"name":"\"gov\"","url":"modules/_gov_.html","classes":"tsd-kind-module"},{"id":33,"kind":64,"name":"castVote","url":"modules/_gov_.html#castvote","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":34,"kind":64,"name":"castVoteBySig","url":"modules/_gov_.html#castvotebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":35,"kind":64,"name":"createVoteSignature","url":"modules/_gov_.html#createvotesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":36,"kind":1,"name":"\"priceFeed\"","url":"modules/_pricefeed_.html","classes":"tsd-kind-module"},{"id":37,"kind":64,"name":"getPrice","url":"modules/_pricefeed_.html#getprice","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"priceFeed\""},{"id":38,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-module"},{"id":39,"kind":64,"name":"Compound","url":"modules/_index_.html#compound","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"index\""}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,33.081]],["parent/0",[]],["name/1",[1,33.081]],["parent/1",[]],["name/2",[2,22.095]],["parent/2",[]],["name/3",[3,33.081]],["parent/3",[2,1.88]],["name/4",[4,33.081]],["parent/4",[2,1.88]],["name/5",[5,33.081]],["parent/5",[2,1.88]],["name/6",[6,20.088]],["parent/6",[]],["name/7",[7,33.081]],["parent/7",[6,1.709]],["name/8",[8,18.418]],["parent/8",[6,1.709]],["name/9",[9,33.081]],["parent/9",[6,1.709]],["name/10",[10,33.081]],["parent/10",[6,1.709]],["name/11",[11,22.095]],["parent/11",[]],["name/12",[12,33.081]],["parent/12",[11,1.88]],["name/13",[13,33.081]],["parent/13",[11,1.88]],["name/14",[14,33.081]],["parent/14",[11,1.88]],["name/15",[15,33.081]],["parent/15",[]],["name/16",[8,18.418]],["parent/16",[]],["name/17",[16,33.081]],["parent/17",[8,1.567]],["name/18",[17,33.081]],["parent/18",[8,1.567]],["name/19",[18,33.081]],["parent/19",[8,1.567]],["name/20",[19,33.081]],["parent/20",[8,1.567]],["name/21",[20,15.735]],["parent/21",[]],["name/22",[21,33.081]],["parent/22",[20,1.339]],["name/23",[22,33.081]],["parent/23",[20,1.339]],["name/24",[23,33.081]],["parent/24",[20,1.339]],["name/25",[24,33.081]],["parent/25",[20,1.339]],["name/26",[25,33.081]],["parent/26",[20,1.339]],["name/27",[26,33.081]],["parent/27",[20,1.339]],["name/28",[27,33.081]],["parent/28",[20,1.339]],["name/29",[28,24.608]],["parent/29",[]],["name/30",[29,33.081]],["parent/30",[28,2.094]],["name/31",[30,33.081]],["parent/31",[28,2.094]],["name/32",[31,22.095]],["parent/32",[]],["name/33",[32,33.081]],["parent/33",[31,1.88]],["name/34",[33,33.081]],["parent/34",[31,1.88]],["name/35",[34,33.081]],["parent/35",[31,1.88]],["name/36",[35,27.973]],["parent/36",[]],["name/37",[36,33.081]],["parent/37",[35,2.38]],["name/38",[37,27.973]],["parent/38",[]],["name/39",[38,33.081]],["parent/39",[37,2.38]]],"invertedIndex":[["account",{"_index":7,"name":{"7":{}},"parent":{}}],["api",{"_index":6,"name":{"6":{}},"parent":{"7":{},"8":{},"9":{},"10":{}}}],["borrow",{"_index":18,"name":{"19":{}},"parent":{}}],["castvote",{"_index":32,"name":{"33":{}},"parent":{}}],["castvotebysig",{"_index":33,"name":{"34":{}},"parent":{}}],["claimcomp",{"_index":24,"name":{"25":{}},"parent":{}}],["comp",{"_index":20,"name":{"21":{}},"parent":{"22":{},"23":{},"24":{},"25":{},"26":{},"27":{},"28":{}}}],["compound",{"_index":38,"name":{"39":{}},"parent":{}}],["comptroller",{"_index":28,"name":{"29":{}},"parent":{"30":{},"31":{}}}],["constants",{"_index":1,"name":{"1":{}},"parent":{}}],["createdelegatesignature",{"_index":27,"name":{"28":{}},"parent":{}}],["createvotesignature",{"_index":34,"name":{"35":{}},"parent":{}}],["ctoken",{"_index":8,"name":{"8":{},"16":{}},"parent":{"17":{},"18":{},"19":{},"20":{}}}],["delegate",{"_index":25,"name":{"26":{}},"parent":{}}],["delegatebysig",{"_index":26,"name":{"27":{}},"parent":{}}],["eip712",{"_index":0,"name":{"0":{}},"parent":{}}],["entermarkets",{"_index":29,"name":{"30":{}},"parent":{}}],["eth",{"_index":11,"name":{"11":{}},"parent":{"12":{},"13":{},"14":{}}}],["exitmarket",{"_index":30,"name":{"31":{}},"parent":{}}],["getabi",{"_index":4,"name":{"4":{}},"parent":{}}],["getaddress",{"_index":3,"name":{"3":{}},"parent":{}}],["getbalance",{"_index":14,"name":{"14":{}},"parent":{}}],["getcompaccrued",{"_index":23,"name":{"24":{}},"parent":{}}],["getcompbalance",{"_index":22,"name":{"23":{}},"parent":{}}],["getnetnamewithchainid",{"_index":5,"name":{"5":{}},"parent":{}}],["getprice",{"_index":36,"name":{"37":{}},"parent":{}}],["gov",{"_index":31,"name":{"32":{}},"parent":{"33":{},"34":{},"35":{}}}],["governance",{"_index":10,"name":{"10":{}},"parent":{}}],["helpers",{"_index":15,"name":{"15":{}},"parent":{}}],["index",{"_index":37,"name":{"38":{}},"parent":{"39":{}}}],["markethistory",{"_index":9,"name":{"9":{}},"parent":{}}],["pricefeed",{"_index":35,"name":{"36":{}},"parent":{"37":{}}}],["read",{"_index":12,"name":{"12":{}},"parent":{}}],["redeem",{"_index":17,"name":{"18":{}},"parent":{}}],["repayborrow",{"_index":19,"name":{"20":{}},"parent":{}}],["supply",{"_index":16,"name":{"17":{}},"parent":{}}],["tochecksumaddress",{"_index":21,"name":{"22":{}},"parent":{}}],["trx",{"_index":13,"name":{"13":{}},"parent":{}}],["util",{"_index":2,"name":{"2":{}},"parent":{"3":{},"4":{},"5":{}}}]],"pipeline":[]}} \ No newline at end of file +{"kinds":{"1":"Module","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"types/index\"","url":"modules/_types_index_.html","classes":"tsd-kind-module"},{"id":1,"kind":1,"name":"\"EIP712\"","url":"modules/_eip712_.html","classes":"tsd-kind-module"},{"id":2,"kind":1,"name":"\"constants\"","url":"modules/_constants_.html","classes":"tsd-kind-module"},{"id":3,"kind":1,"name":"\"util\"","url":"modules/_util_.html","classes":"tsd-kind-module"},{"id":4,"kind":64,"name":"getAddress","url":"modules/_util_.html#getaddress","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":5,"kind":64,"name":"getAbi","url":"modules/_util_.html#getabi","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":6,"kind":64,"name":"getNetNameWithChainId","url":"modules/_util_.html#getnetnamewithchainid","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":7,"kind":1,"name":"\"api\"","url":"modules/_api_.html","classes":"tsd-kind-module"},{"id":8,"kind":64,"name":"account","url":"modules/_api_.html#account","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":9,"kind":64,"name":"vToken","url":"modules/_api_.html#vtoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":10,"kind":64,"name":"marketHistory","url":"modules/_api_.html#markethistory","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":11,"kind":64,"name":"governance","url":"modules/_api_.html#governance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":12,"kind":1,"name":"\"eth\"","url":"modules/_eth_.html","classes":"tsd-kind-module"},{"id":13,"kind":64,"name":"read","url":"modules/_eth_.html#read","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":14,"kind":64,"name":"trx","url":"modules/_eth_.html#trx","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":15,"kind":64,"name":"getBalance","url":"modules/_eth_.html#getbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":16,"kind":1,"name":"\"helpers\"","url":"modules/_helpers_.html","classes":"tsd-kind-module"},{"id":17,"kind":1,"name":"\"cToken\"","url":"modules/_ctoken_.html","classes":"tsd-kind-module"},{"id":18,"kind":64,"name":"supply","url":"modules/_ctoken_.html#supply","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":19,"kind":64,"name":"redeem","url":"modules/_ctoken_.html#redeem","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":20,"kind":64,"name":"borrow","url":"modules/_ctoken_.html#borrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":21,"kind":64,"name":"repayBorrow","url":"modules/_ctoken_.html#repayborrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":22,"kind":1,"name":"\"comp\"","url":"modules/_comp_.html","classes":"tsd-kind-module"},{"id":23,"kind":64,"name":"toChecksumAddress","url":"modules/_comp_.html#tochecksumaddress","classes":"tsd-kind-function tsd-parent-kind-module tsd-is-not-exported","parent":"\"comp\""},{"id":24,"kind":64,"name":"getVenusBalance","url":"modules/_comp_.html#getvenusbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":25,"kind":64,"name":"getVenusAccrued","url":"modules/_comp_.html#getvenusaccrued","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":26,"kind":64,"name":"claimVenus","url":"modules/_comp_.html#claimvenus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":27,"kind":64,"name":"delegate","url":"modules/_comp_.html#delegate","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":28,"kind":64,"name":"delegateBySig","url":"modules/_comp_.html#delegatebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":29,"kind":64,"name":"createDelegateSignature","url":"modules/_comp_.html#createdelegatesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":30,"kind":1,"name":"\"comptroller\"","url":"modules/_comptroller_.html","classes":"tsd-kind-module"},{"id":31,"kind":64,"name":"enterMarkets","url":"modules/_comptroller_.html#entermarkets","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":32,"kind":64,"name":"exitMarket","url":"modules/_comptroller_.html#exitmarket","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":33,"kind":1,"name":"\"gov\"","url":"modules/_gov_.html","classes":"tsd-kind-module"},{"id":34,"kind":64,"name":"castVote","url":"modules/_gov_.html#castvote","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":35,"kind":64,"name":"castVoteBySig","url":"modules/_gov_.html#castvotebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":36,"kind":64,"name":"createVoteSignature","url":"modules/_gov_.html#createvotesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":37,"kind":1,"name":"\"priceFeed\"","url":"modules/_pricefeed_.html","classes":"tsd-kind-module"},{"id":38,"kind":64,"name":"getPrice","url":"modules/_pricefeed_.html#getprice","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"priceFeed\""},{"id":39,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-module"},{"id":40,"kind":64,"name":"Venus","url":"modules/_index_.html#venus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"index\""}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,33.322]],["parent/0",[]],["name/1",[1,33.322]],["parent/1",[]],["name/2",[2,33.322]],["parent/2",[]],["name/3",[3,22.336]],["parent/3",[]],["name/4",[4,33.322]],["parent/4",[3,1.877]],["name/5",[5,33.322]],["parent/5",[3,1.877]],["name/6",[6,33.322]],["parent/6",[3,1.877]],["name/7",[7,20.329]],["parent/7",[]],["name/8",[8,33.322]],["parent/8",[7,1.708]],["name/9",[9,33.322]],["parent/9",[7,1.708]],["name/10",[10,33.322]],["parent/10",[7,1.708]],["name/11",[11,33.322]],["parent/11",[7,1.708]],["name/12",[12,22.336]],["parent/12",[]],["name/13",[13,33.322]],["parent/13",[12,1.877]],["name/14",[14,33.322]],["parent/14",[12,1.877]],["name/15",[15,33.322]],["parent/15",[12,1.877]],["name/16",[16,33.322]],["parent/16",[]],["name/17",[17,20.329]],["parent/17",[]],["name/18",[18,33.322]],["parent/18",[17,1.708]],["name/19",[19,33.322]],["parent/19",[17,1.708]],["name/20",[20,33.322]],["parent/20",[17,1.708]],["name/21",[21,33.322]],["parent/21",[17,1.708]],["name/22",[22,15.976]],["parent/22",[]],["name/23",[23,33.322]],["parent/23",[22,1.343]],["name/24",[24,33.322]],["parent/24",[22,1.343]],["name/25",[25,33.322]],["parent/25",[22,1.343]],["name/26",[26,33.322]],["parent/26",[22,1.343]],["name/27",[27,33.322]],["parent/27",[22,1.343]],["name/28",[28,33.322]],["parent/28",[22,1.343]],["name/29",[29,33.322]],["parent/29",[22,1.343]],["name/30",[30,24.849]],["parent/30",[]],["name/31",[31,33.322]],["parent/31",[30,2.088]],["name/32",[32,33.322]],["parent/32",[30,2.088]],["name/33",[33,22.336]],["parent/33",[]],["name/34",[34,33.322]],["parent/34",[33,1.877]],["name/35",[35,33.322]],["parent/35",[33,1.877]],["name/36",[36,33.322]],["parent/36",[33,1.877]],["name/37",[37,28.214]],["parent/37",[]],["name/38",[38,33.322]],["parent/38",[37,2.371]],["name/39",[39,28.214]],["parent/39",[]],["name/40",[40,33.322]],["parent/40",[39,2.371]]],"invertedIndex":[["account",{"_index":8,"name":{"8":{}},"parent":{}}],["api",{"_index":7,"name":{"7":{}},"parent":{"8":{},"9":{},"10":{},"11":{}}}],["borrow",{"_index":20,"name":{"20":{}},"parent":{}}],["castvote",{"_index":34,"name":{"34":{}},"parent":{}}],["castvotebysig",{"_index":35,"name":{"35":{}},"parent":{}}],["claimvenus",{"_index":26,"name":{"26":{}},"parent":{}}],["comp",{"_index":22,"name":{"22":{}},"parent":{"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{}}}],["comptroller",{"_index":30,"name":{"30":{}},"parent":{"31":{},"32":{}}}],["constants",{"_index":2,"name":{"2":{}},"parent":{}}],["createdelegatesignature",{"_index":29,"name":{"29":{}},"parent":{}}],["createvotesignature",{"_index":36,"name":{"36":{}},"parent":{}}],["ctoken",{"_index":17,"name":{"17":{}},"parent":{"18":{},"19":{},"20":{},"21":{}}}],["delegate",{"_index":27,"name":{"27":{}},"parent":{}}],["delegatebysig",{"_index":28,"name":{"28":{}},"parent":{}}],["eip712",{"_index":1,"name":{"1":{}},"parent":{}}],["entermarkets",{"_index":31,"name":{"31":{}},"parent":{}}],["eth",{"_index":12,"name":{"12":{}},"parent":{"13":{},"14":{},"15":{}}}],["exitmarket",{"_index":32,"name":{"32":{}},"parent":{}}],["getabi",{"_index":5,"name":{"5":{}},"parent":{}}],["getaddress",{"_index":4,"name":{"4":{}},"parent":{}}],["getbalance",{"_index":15,"name":{"15":{}},"parent":{}}],["getnetnamewithchainid",{"_index":6,"name":{"6":{}},"parent":{}}],["getprice",{"_index":38,"name":{"38":{}},"parent":{}}],["getvenusaccrued",{"_index":25,"name":{"25":{}},"parent":{}}],["getvenusbalance",{"_index":24,"name":{"24":{}},"parent":{}}],["gov",{"_index":33,"name":{"33":{}},"parent":{"34":{},"35":{},"36":{}}}],["governance",{"_index":11,"name":{"11":{}},"parent":{}}],["helpers",{"_index":16,"name":{"16":{}},"parent":{}}],["index",{"_index":39,"name":{"39":{}},"parent":{"40":{}}}],["markethistory",{"_index":10,"name":{"10":{}},"parent":{}}],["pricefeed",{"_index":37,"name":{"37":{}},"parent":{"38":{}}}],["read",{"_index":13,"name":{"13":{}},"parent":{}}],["redeem",{"_index":19,"name":{"19":{}},"parent":{}}],["repayborrow",{"_index":21,"name":{"21":{}},"parent":{}}],["supply",{"_index":18,"name":{"18":{}},"parent":{}}],["tochecksumaddress",{"_index":23,"name":{"23":{}},"parent":{}}],["trx",{"_index":14,"name":{"14":{}},"parent":{}}],["types/index",{"_index":0,"name":{"0":{}},"parent":{}}],["util",{"_index":3,"name":{"3":{}},"parent":{"4":{},"5":{},"6":{}}}],["venus",{"_index":40,"name":{"40":{}},"parent":{}}],["vtoken",{"_index":9,"name":{"9":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file diff --git a/docs/globals.html b/docs/globals.html index 34fb0fb..d735c3c 100644 --- a/docs/globals.html +++ b/docs/globals.html @@ -3,8 +3,8 @@
-A JavaScript SDK for Ethereum and the Compound Protocol. Wraps around Ethers.js. Works in the web browser and Node.js.
- +A JavaScript SDK for Ethereum and the Venus Protocol. Wraps around Ethers.js. Works in the web browser and Node.js.
+This SDK is in open beta, and is constantly under development. USE AT YOUR OWN RISK.
const Compound = require('@compound-finance/compound-js'); // in Node.js
-const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT);
+ const Venus = require('@swipewallet/venus-js'); // in Node.js
+const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT);
(async function() {
- let supplyRatePerBlock = await Compound.eth.read(
+ let supplyRatePerBlock = await Venus.eth.read(
cUsdtAddress,
'function supplyRatePerBlock() returns (uint)',
[], // [optional] parameters
@@ -97,32 +97,32 @@ Write
(async function() {
- const trx = await Compound.eth.trx(
+ const trx = await Venus.eth.trx(
toAddress,
'function send() external payable',
[],
{
- value: Compound._ethers.utils.parseEther('1.0'), // 1 ETH
+ value: Venus._ethers.utils.parseEther('1.0'), // 1 ETH
provider: window.ethereum, // in a web browser
}
);
- const toAddressEthBalance = await Compound.eth.getBalance(toAddress);
+ const toAddressEthBalance = await Venus.eth.getBalance(toAddress);
})().catch(console.error);
-
- Compound Protocol
+
+ Venus Protocol
- Simple methods for using the Compound protocol.
- const compound = new Compound(window.ethereum); // in a web browser
+ Simple methods for using the Venus protocol.
+ const venus = new Venus(window.ethereum); // in a web browser
// Ethers.js overrides are an optional 3rd parameter for `supply`
// const trxOptions = { gasLimit: 250000, mantissa: false };
(async function() {
- console.log('Supplying ETH to the Compound protocol...');
- const trx = await compound.supply(Compound.ETH, 1);
+ console.log('Supplying ETH to the Venus protocol...');
+ const trx = await venus.supply(Venus.ETH, 1);
console.log('Ethers.js transaction object', trx);
})().catch(console.error);
@@ -130,61 +130,65 @@ Compound Protocol
Install / Import
Web Browser
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@compound-finance/compound-js@latest/dist/browser/compound.min.js"></script>
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@swipewallet/venus-js@latest/dist/browser/venus.min.js"></script>
<script type="text/javascript">
- window.Compound; // or `Compound`
+ window.Venus; // or `Venus`
</script>
Node.js
- npm install @compound-finance/compound-js
- const Compound = require('@compound-finance/compound-js');
+ npm install @swipewallet/venus-js
+ const Venus = require('@swipewallet/venus-js');
+
+// or, when using ES6
+
+import Venus from '@swipewallet/venus-js';
More Code Examples
- - Node.js
- - Web Browser
+ - Node.js
+ - Web Browser
- To run, boot Ganache fork of mainnet locally
+ To run, boot Ganache fork of mainnet locally
Instance Creation
The following are valid Ethereum providers for initialization of the SDK.
- var compound = new Compound(window.ethereum); // web browser
+ var venus = new Venus(window.ethereum); // web browser
-var compound = new Compound('http://127.0.0.1:8545'); // HTTP provider
+var venus = new Venus('http://127.0.0.1:8545'); // HTTP provider
-var compound = new Compound(); // Uses Ethers.js fallback mainnet (for testing only)
+var venus = new Venus(); // Uses Ethers.js fallback mainnet (for testing only)
-var compound = new Compound('ropsten'); // Uses Ethers.js fallback (for testing only)
+var venus = new Venus('ropsten'); // 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_', {
+var venus = new Venus('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' {
+var venus = new Venus('mainnet' {
mnemonic: 'clutch captain shoe...', // preferably with environment variable
});
Constants and Contract Addresses
Names of contracts, their addresses, ABIs, token decimals, and more can be found in /src/constants.ts
. Addresses, for all networks, can be easily fetched using the getAddress
function, combined with contract name constants.
- console.log(Compound.DAI, Compound.ETH, Compound.cETH);
-// DAI, ETH, cETH
+ console.log(Venus.DAI, Venus.BNB, Venus.vSXP);
+// DAI, BNB, vSXP
-const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT);
+const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT);
// Mainnet cUSDT address. Second parameter can be a network like 'ropsten'.
Mantissas
Parameters of number values can be plain numbers or their scaled up mantissa values. There is a transaction option boolean to tell the SDK what the developer is passing.
// 1 Dai
-await compound.borrow(Compound.DAI, '1000000000000000000', { mantissa: true });
+await venus.borrow(Venus.DAI, '1000000000000000000', { mantissa: true });
// `mantissa` defaults to false if it is not specified or if an options object is not passed
-await compound.borrow(Compound.DAI, 1, { mantissa: false });
+await venus.borrow(Venus.DAI, 1, { mantissa: false });
Transaction Options
@@ -196,26 +200,26 @@ Transaction Options
provider, // JSON RPC string, Web3 object, or Ethers.js fallback network (string)
network, // Ethers.js fallback network provider, "provider" has precedence over "network"
from, // Address that the Ethereum transaction is send from
- gasPrice, // Ethers.js override `Compound_ethers.utils.parseUnits('10.0', 'gwei')`
+ gasPrice, // Ethers.js override `Venus._ethers.utils.parseUnits('10.0', 'gwei')`
gasLimit, // Ethers.js override - see https://docs.ethers.io/ethers.js/v5-beta/api-contract.html#overrides
value, // Number or string
data, // Number or string
chainId, // Number
nonce, // Number
- privateKey, // String, meant to be used with `Compound.eth.trx` (server side)
- mnemonic, // String, meant to be used with `Compound.eth.trx` (server side)
+ privateKey, // String, meant to be used with `Venus.eth.trx` (server side)
+ mnemonic, // String, meant to be used with `Venus.eth.trx` (server side)
};
API
- The Compound API is accessible from Compound.js. The corresponding services are defined in the api
namespace on the class.
+ The Venus API is accessible from Venus.js. The corresponding services are defined in the api
namespace on the class.
- Compound.api.account
- Compound.api.cToken
- Compound.api.marketHistory
- Compound.api.governance
+ Venus.api.account
+ Venus.api.cToken
+ Venus.api.marketHistory
+ Venus.api.governance
- The governance method requires a second parameter (string) for the corresponding endpoint shown in the documentation.
+ The governance method requires a second parameter (string) for the corresponding endpoint shown in the documentation.
proposals
voteReceipts
@@ -223,49 +227,49 @@ API
Here is an example for using the account
endpoint. The network
parameter in the request body is optional and defaults to mainnet
.
const main = async () => {
- const account = await Compound.api.account({
+ const account = await Venus.api.account({
"addresses": "0xB61C5971d9c0472befceFfbE662555B78284c307",
"network": "ropsten"
});
- let daiBorrowBalance = 0;
+ let sxpBorrowBalance = 0;
if (Object.isExtensible(account) && account.accounts) {
account.accounts.forEach((acc) => {
acc.tokens.forEach((tok) => {
- if (tok.symbol === Compound.cDAI) {
+ if (tok.symbol === Venus.vSXP) {
daiBorrowBalance = +tok.borrow_balance_underlying.value;
}
});
});
}
- console.log('daiBorrowBalance', daiBorrowBalance);
+ console.log('sxpBorrowBalance', sxpBorrowBalance);
}
main().catch(console.error);
Build for Node.js & Web Browser
- git clone git@github.com:compound-finance/compound-js.git
-cd compound-js/
-npm install
-npm run build
+ git clone git@github.com:SwipeWallet/venus-js.git
+cd venus-js/
+npm install
+npm run build
Web Browser Build
<!-- Local build (do `npm install` first) -->
-<script type="text/javascript" src="./dist/browser/compound.min.js"></script>
+<script type="text/javascript" src="./dist/browser/venus.min.js"></script>
<!-- Public NPM -> jsdeliver build -->
-<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@compound-finance/compound-js@latest/dist/browser/compound.min.js"></script>
+<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@swipewallet/venus-js@latest/dist/browser/venus.min.js"></script>
Node.js Build
// Local build (do `npm install` first)
-const Compound = require('./dist/nodejs/index.js');
+const Venus = require('./dist/nodejs/index.js');
// Public NPM build
-const Compound = require('@compound-finance/compound-js');
+const Venus = require('@swipewallet/venus-js');
Makes a request to the AccountService API. The Account API retrieves information for various accounts which have interacted with the protocol. - For more details, see the Compound API documentation.
+ For more details, see the Venus API documentation.(async function() { - const account = await Compound.api.account({ + const account = await Venus.api.account({ "addresses": "0xB61C5971d9c0472befceFfbE662555B78284c307", "network": "ropsten" }); - let daiBorrowBalance = 0; + let sxpBorrowBalance = 0; if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Compound.cDAI) { - daiBorrowBalance = +tok.borrow_balance_underlying.value; + if (tok.symbol === Venus.vSXP) { + sxpBorrowBalance = +tok.borrow_balance_underlying.value; } }); }); } - console.log('daiBorrowBalance', daiBorrowBalance); + console.log('sxpBorrowBalance', sxpBorrowBalance); })().catch(console.error);
account
Parameters
options: object
+options: AccountServiceRequest
A JavaScript object of API request parameters.
Returns Promise<unknown>
+Returns Promise<APIResponse>
Returns the HTTP response body or error.
cToken
+ +governance
-- c
Token(options: object): Promise<unknown>
+ - governance(options: GovernanceServiceRequest, endpoint: string): Promise<APIResponse>
Makes a request to the CTokenService API. The cToken API retrieves - information about cToken contract interaction. For more details, see the - Compound API documentation.
+Makes a request to the GovernanceService API. The Governance Service includes + three endpoints to retrieve information about COMP accounts. For more + details, see the Venus API documentation.
(async function() { - const cDaiData = await Compound.api.cToken({ - "addresses": Compound.util.getAddress(Compound.cDAI) - }); + const proposal = await Venus.api.governance( + { "proposal_ids": [ 20 ] }, 'proposals' + ); - console.log('cDaiData', cDaiData); // JavaScript Object + console.log('proposal', proposal); // JavaScript Object })().catch(console.error);
cToken
Parameters
options: object
+options: GovernanceServiceRequest
A JavaScript object of API request parameters.
endpoint: string
+A string of the name of the corresponding governance + service endpoint. Valid values are
+proposals
,voteReceipts
, or +accounts
.Returns Promise<unknown>
+Returns Promise<APIResponse>
Returns the HTTP response body or error.
governance
+ +marketHistory
-- governance(options: object, endpoint: string): Promise<unknown>
+ - market
History(options: MarketHistoryServiceRequest): Promise<APIResponse>
Makes a request to the GovernanceService API. The Governance Service includes - three endpoints to retrieve information about COMP accounts. For more - details, see the Compound API documentation.
+Makes a request to the MarketHistoryService API. The market history service + retrieves information about a market. For more details, see the Venus + API documentation.
(async function() { - const proposal = await Compound.api.governance( - { "proposal_ids": [ 20 ] }, 'proposals' - ); + const vUsdcMarketData = await Venus.api.marketHistory({ + "asset": Venus.util.getAddress(Venus.vUSDC), + "min_block_timestamp": 1559339900, + "max_block_timestamp": 1598320674, + "num_buckets": 10, + }); - console.log('proposal', proposal); // JavaScript Object + console.log('vUsdcMarketData', vUsdcMarketData); // JavaScript Object })().catch(console.error);
governance
Parameters
options: object
+options: MarketHistoryServiceRequest
A JavaScript object of API request parameters.
endpoint: string
-A string of the name of the corresponding governance - service endpoint. Valid values are
-proposals
,voteReceipts
, or -accounts
.Returns Promise<unknown>
+Returns Promise<APIResponse>
Returns the HTTP response body or error.
marketHistory
+ +vToken
-- market
History(options: object): Promise<unknown>
+ - v
Token(options: CTokenServiceRequest): Promise<APIResponse>
Makes a request to the MarketHistoryService API. The market history service - retrieves information about a market. For more details, see the Compound - API documentation.
+Makes a request to the CTokenService API. The vToken API retrieves + information about vToken contract interaction. For more details, see the + Venus API documentation.
(async function() { - const cUsdcMarketData = await Compound.api.marketHistory({ - "asset": Compound.util.getAddress(Compound.cUSDC), - "min_block_timestamp": 1559339900, - "max_block_timestamp": 1598320674, - "num_buckets": 10, + const vSxpData = await Venus.api.vToken({ + "addresses": Venus.util.getAddress(Venus.vSXP) }); - console.log('cUsdcMarketData', cUsdcMarketData); // JavaScript Object + console.log('vSxpData', vSxpData); // JavaScript Object })().catch(console.error);
marketHistory
Parameters
options: object
+options: CTokenServiceRequest
A JavaScript object of API request parameters.
Returns Promise<unknown>
+Returns Promise<APIResponse>
Returns the HTTP response body or error.
@@ -327,15 +327,15 @@Returns Promise-
account
- -
- c
Token
-
-
governance
-
market
History
+ -
+ v
Token
+
Index
Functions
-- claim
Comp
+ - claim
Venus
- create
DelegateSignature
- delegate
- delegate
BySig
- - get
CompAccrued
- - get
CompBalance
+ - get
VenusAccrued
+ - get
VenusBalance
- to
ChecksumAddress
Functions
Functions
claimComp
+ +claimVenus
-- claim
Comp(options?: any): Promise<any>
+ - claim
Venus(options?: CallOptions): Promise<TrxResponse>
Create a transaction to claim accrued COMP tokens for the user.
+Create a transaction to claim accrued VENUS tokens for the user.
const compound = new Compound(window.ethereum); +-
-
-
@@ -119,10 +119,10 @@
claimComp
Parameters
Default value options: any = {}
+Default value options: CallOptions = {}
Returns Promise<any>
+Returns Promise<TrxResponse>
Returns an Ethers.js transaction object of the vote transaction.
@@ -132,28 +132,28 @@Returns Promise-
-
- example
-
createDelegateSignature
-- create
DelegateSignature(delegatee: string, expiry?: number): Promise<any>
+ - create
DelegateSignature(delegatee: string, expiry?: number): Promise<Signature>
Create a delegate signature for Compound Governance using EIP-712. The +
Create a delegate signature for Venus Governance using EIP-712. The signature can be created without burning gas. Anyone can post it to the blockchain using the
delegateBySig
method, which does have gas costs.