@compound-finance/compound-js
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -297,2 +297,121 @@ export declare const constants: { | ||
})[]; | ||
COMP: ({ | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
payable: boolean; | ||
stateMutability: string; | ||
type: string; | ||
signature: string; | ||
anonymous?: undefined; | ||
name?: undefined; | ||
constant?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
anonymous: boolean; | ||
inputs: { | ||
indexed: boolean; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
type: string; | ||
signature: string; | ||
payable?: undefined; | ||
stateMutability?: undefined; | ||
constant?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
constant: boolean; | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
outputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
payable: boolean; | ||
stateMutability: string; | ||
type: string; | ||
signature: string; | ||
anonymous?: undefined; | ||
})[]; | ||
GovernorAlpha: ({ | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
payable: boolean; | ||
stateMutability: string; | ||
type: string; | ||
signature: string; | ||
anonymous?: undefined; | ||
name?: undefined; | ||
constant?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
anonymous: boolean; | ||
inputs: { | ||
indexed: boolean; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
type: string; | ||
signature: string; | ||
payable?: undefined; | ||
stateMutability?: undefined; | ||
constant?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
constant: boolean; | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
outputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
payable: boolean; | ||
stateMutability: string; | ||
type: string; | ||
signature: string; | ||
anonymous?: undefined; | ||
} | { | ||
constant: boolean; | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
outputs: { | ||
components: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
payable: boolean; | ||
stateMutability: string; | ||
type: string; | ||
signature: string; | ||
anonymous?: undefined; | ||
})[]; | ||
Comptroller: ({ | ||
@@ -383,2 +502,24 @@ constant: boolean; | ||
PriceFeed: string[]; | ||
CompoundLens: { | ||
constant: boolean; | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
outputs: { | ||
components: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
payable: boolean; | ||
stateMutability: string; | ||
type: string; | ||
}[]; | ||
}; | ||
@@ -385,0 +526,0 @@ export declare const cTokens: string[]; |
import { ethers } from 'ethers'; | ||
import * as eth from './eth'; | ||
import * as util from './util'; | ||
import * as comp from './comp'; | ||
/** | ||
@@ -39,3 +40,7 @@ * Creates an instance of the Compound.js SDK. | ||
}; | ||
comp: { | ||
getCompBalance: typeof comp.getCompBalance; | ||
getCompAccrued: typeof comp.getCompAccrued; | ||
}; | ||
}; | ||
export = Compound; |
@@ -19,2 +19,4 @@ "use strict"; | ||
var priceFeed = require("./priceFeed"); | ||
var comp = require("./comp"); | ||
var gov = require("./gov"); | ||
var constants_1 = require("./constants"); | ||
@@ -37,3 +39,3 @@ // Turn off Ethers.js warnings | ||
provider = eth.createProvider(options); | ||
var instance = __assign(__assign(__assign({ _provider: provider }, comptroller), cToken), priceFeed); | ||
var instance = __assign(__assign(__assign(__assign({ _provider: provider }, comptroller), cToken), priceFeed), gov); | ||
// Instance needs to know which network the provider connects to, so it can | ||
@@ -51,4 +53,8 @@ // use the correct contract addresses. | ||
Compound.decimals = constants_1.decimals; | ||
Compound.comp = { | ||
getCompBalance: comp.getCompBalance, | ||
getCompAccrued: comp.getCompAccrued | ||
}; | ||
Object.assign(Compound, constants_1.constants); | ||
module.exports = Compound; | ||
//# sourceMappingURL=index.js.map |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @returns {string} Returns a string of the numerical value of the asset. | ||
* @returns {string} Returns a string of the numeric value of the asset. | ||
*/ | ||
export declare function getPrice(asset: string, inAsset?: string): Promise<any>; |
@@ -93,3 +93,3 @@ "use strict"; | ||
* | ||
* @returns {string} Returns a string of the numerical value of the asset. | ||
* @returns {string} Returns a string of the numeric value of the asset. | ||
*/ | ||
@@ -96,0 +96,0 @@ function getPrice(asset, inAsset) { |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare function getAddress(contract: any, network?: string): any; | ||
export declare function getAddress(contract: string, network?: string): any; |
{ | ||
"name": "@compound-finance/compound-js", | ||
"browser": "dist/browser/compound.min.js", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "A JavaScript SDK for Ethereum and the Compound Protocol.", | ||
@@ -6,0 +6,0 @@ "main": "dist/nodejs/index.js", |
@@ -15,3 +15,3 @@ # Compound.js [Alpha] | ||
const Compound = require('@compound-finance/compound-js'); // in Node.js | ||
const cUsdtAddress = '0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9'; | ||
const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT); | ||
@@ -18,0 +18,0 @@ (async function() { |
@@ -7,2 +7,4 @@ import { ethers } from 'ethers'; | ||
import * as priceFeed from './priceFeed'; | ||
import * as comp from './comp'; | ||
import * as gov from './gov'; | ||
import { constants, decimals } from './constants'; | ||
@@ -31,2 +33,3 @@ | ||
...priceFeed, | ||
...gov, | ||
}; | ||
@@ -48,4 +51,8 @@ | ||
Compound.decimals = decimals; | ||
Compound.comp = { | ||
getCompBalance: comp.getCompBalance, | ||
getCompAccrued: comp.getCompAccrued, | ||
}; | ||
Object.assign(Compound, constants); | ||
export = Compound; |
@@ -58,3 +58,3 @@ import { ethers } from 'ethers'; | ||
* | ||
* @returns {string} Returns a string of the numerical value of the asset. | ||
* @returns {string} Returns a string of the numeric value of the asset. | ||
*/ | ||
@@ -61,0 +61,0 @@ export async function getPrice(asset: string, inAsset: string=constants.USDC) { |
@@ -13,4 +13,4 @@ import { address } from './constants'; | ||
*/ | ||
export function getAddress(contract, network='mainnet') { | ||
export function getAddress(contract: string, network: string='mainnet') { | ||
return address[network][contract]; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1070916
61
6795