@meterio/sumer-js 0.2.163 → 0.2.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/sumer.min.js +1 -1
- package/dist/nodejs/cToken.d.ts +11 -11
- package/dist/nodejs/cToken.js.map +1 -1
- package/dist/nodejs/comptroller.d.ts +9 -7
- package/dist/nodejs/comptroller.js.map +1 -1
- package/dist/nodejs/constants/basetest.d.ts +73 -0
- package/dist/nodejs/constants/basetest.js +144 -0
- package/dist/nodejs/constants/basetest.js.map +1 -0
- package/dist/nodejs/index.d.ts +83 -52
- package/dist/nodejs/index.js +31 -52
- package/dist/nodejs/index.js.map +1 -1
- package/package.json +1 -1
package/dist/nodejs/index.d.ts
CHANGED
|
@@ -3,46 +3,37 @@
|
|
|
3
3
|
* @desc This file defines the constructor of the `Sumer` class.
|
|
4
4
|
* @hidden
|
|
5
5
|
*/
|
|
6
|
-
import { ethers, JsonRpcSigner } from 'ethers';
|
|
6
|
+
import { ContractTransactionResponse, ethers, JsonRpcSigner } from 'ethers';
|
|
7
7
|
import * as eth from './eth';
|
|
8
8
|
import * as util from './util';
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
* @returns {object} Returns an instance of the Sumer.js SDK.
|
|
39
|
-
*/
|
|
40
|
-
declare const Sumer: {
|
|
41
|
-
(provider: JsonRpcSigner, options: SumerOptions): SumerInstance;
|
|
42
|
-
eth: typeof eth;
|
|
43
|
-
util: typeof util;
|
|
44
|
-
_ethers: typeof ethers;
|
|
45
|
-
abi: {
|
|
9
|
+
import * as comptroller from './comptroller';
|
|
10
|
+
import { SumerOptions, CallOptions } from './types';
|
|
11
|
+
declare class Sumer {
|
|
12
|
+
_provider: JsonRpcSigner;
|
|
13
|
+
_network: {
|
|
14
|
+
id: string | number;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
supply: (asset: string, amount: string | number, noApprove?: boolean, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
18
|
+
supplyWithPermit: (asset: string, amount: string | number, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
19
|
+
redeem: (asset: string, amount: string | number, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
20
|
+
borrow: (asset: string, amount: string | number, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
21
|
+
repayBorrow: (asset: string, amount: string | number, borrower: string, noApprove?: false, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
22
|
+
repayBorrowWithPermit: (asset: string, amount: string | number, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
23
|
+
liquidateBorrow: (repayToken: string, borrower: string, amount: string, cTokenCollateral: string) => Promise<ContractTransactionResponse>;
|
|
24
|
+
calcBorrowAmountForProtectedMint: (asset: string, collateral: string, mintAmount: string | number, options?: CallOptions) => Promise<[bigint, bigint]>;
|
|
25
|
+
protectedMint: (asset: string, collateral: string, cBorrowAmount: string | number, mintAmount: string | number, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
26
|
+
enterMarkets: (markets: string | string[], options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
27
|
+
exitMarket: (market: string, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
28
|
+
redeemFaceValue: (market: string, amount: string | number, providers: string[], deadline: string, signature: string, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
29
|
+
redeemFaceValueWithPermit: (market: string, amount: string | number, providers: string[], providersDeadline: BigInt, providersSignature: string, options?: CallOptions) => Promise<ContractTransactionResponse>;
|
|
30
|
+
redeemFaceValuePreview: (chainId: string, redeemer: string, market: string, amount: string | number) => Promise<comptroller.SignedRedeemPreview>;
|
|
31
|
+
calcPlan: (account: string, seizeTokenAddress: string, repayTokenAddress: string) => Promise<comptroller.Plan>;
|
|
32
|
+
constructor(provider: JsonRpcSigner, options: SumerOptions);
|
|
33
|
+
static eth: typeof eth;
|
|
34
|
+
static util: typeof util;
|
|
35
|
+
static _ethers: typeof ethers;
|
|
36
|
+
static abi: {
|
|
46
37
|
Multicall2: {
|
|
47
38
|
inputs: ({
|
|
48
39
|
internalType: string;
|
|
@@ -2867,7 +2858,7 @@ declare const Sumer: {
|
|
|
2867
2858
|
type: string;
|
|
2868
2859
|
})[];
|
|
2869
2860
|
};
|
|
2870
|
-
errorABIs: ({
|
|
2861
|
+
static errorABIs: ({
|
|
2871
2862
|
inputs: {
|
|
2872
2863
|
internalType: string;
|
|
2873
2864
|
name: string;
|
|
@@ -2889,10 +2880,52 @@ declare const Sumer: {
|
|
|
2889
2880
|
name: string;
|
|
2890
2881
|
type: string;
|
|
2891
2882
|
})[];
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2883
|
+
static constants: {
|
|
2884
|
+
CompoundLens: string;
|
|
2885
|
+
GovernorBravo: string;
|
|
2886
|
+
Comptroller: string;
|
|
2887
|
+
PriceOracle: string;
|
|
2888
|
+
WhitepaperInterestRate: string;
|
|
2889
|
+
};
|
|
2890
|
+
static getDecimals: (networkName: string, tokenSym: string) => number;
|
|
2891
|
+
static getAddress: (networkName: string, tokenSym: string) => any;
|
|
2892
|
+
static getName: (networkName: string, tokenAddress: string) => any;
|
|
2893
|
+
static getTokenPairs: (networkName: string) => {
|
|
2894
|
+
ctokenSym: string;
|
|
2895
|
+
ctokenAddr: string;
|
|
2896
|
+
ctokenDecimal: number;
|
|
2897
|
+
underlySym: string;
|
|
2898
|
+
underlyAddr: string;
|
|
2899
|
+
underlyDecimal: number;
|
|
2900
|
+
ctokenIsEther: boolean;
|
|
2901
|
+
permitEnabled: boolean;
|
|
2902
|
+
assetGroupId: number;
|
|
2903
|
+
}[];
|
|
2904
|
+
static getNetworkBlocksPerYear: (networkName: string) => any;
|
|
2905
|
+
static getRateModals: (networkName: string) => any;
|
|
2906
|
+
static getTokenPairByAddress: (networkName: string, tokenAddress: string) => {
|
|
2907
|
+
ctokenSym: string;
|
|
2908
|
+
ctokenAddr: string;
|
|
2909
|
+
ctokenDecimal: number;
|
|
2910
|
+
underlySym: string;
|
|
2911
|
+
underlyAddr: string;
|
|
2912
|
+
underlyDecimal: number;
|
|
2913
|
+
ctokenIsEther: boolean;
|
|
2914
|
+
permitEnabled: boolean;
|
|
2915
|
+
assetGroupId: number;
|
|
2916
|
+
};
|
|
2917
|
+
static getTokenPairBySymbol: (networkName: string, symbol: string) => {
|
|
2918
|
+
ctokenSym: string;
|
|
2919
|
+
ctokenAddr: string;
|
|
2920
|
+
ctokenDecimal: number;
|
|
2921
|
+
underlySym: string;
|
|
2922
|
+
underlyAddr: string;
|
|
2923
|
+
underlyDecimal: number;
|
|
2924
|
+
ctokenIsEther: boolean;
|
|
2925
|
+
permitEnabled: boolean;
|
|
2926
|
+
assetGroupId: number;
|
|
2927
|
+
};
|
|
2928
|
+
static getTokenPairsByGroupId: (networkName: string, assetGroupId: number) => {
|
|
2896
2929
|
ctokenSym: string;
|
|
2897
2930
|
ctokenAddr: string;
|
|
2898
2931
|
ctokenDecimal: number;
|
|
@@ -2903,9 +2936,10 @@ declare const Sumer: {
|
|
|
2903
2936
|
permitEnabled: boolean;
|
|
2904
2937
|
assetGroupId: number;
|
|
2905
2938
|
}[];
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2939
|
+
static isUnderlyAllowed: (networkName: string, underlyName: string) => boolean;
|
|
2940
|
+
static isCTokenAllowed: (networkName: string, cToken: string) => boolean;
|
|
2941
|
+
static isEther: (networkName: string, ctokenSym: string) => boolean;
|
|
2942
|
+
getTokenPairBySymbol(symbol: string): {
|
|
2909
2943
|
ctokenSym: string;
|
|
2910
2944
|
ctokenAddr: string;
|
|
2911
2945
|
ctokenDecimal: number;
|
|
@@ -2916,7 +2950,7 @@ declare const Sumer: {
|
|
|
2916
2950
|
permitEnabled: boolean;
|
|
2917
2951
|
assetGroupId: number;
|
|
2918
2952
|
};
|
|
2919
|
-
|
|
2953
|
+
getTokenPairByAddress(tokenAddress: string): {
|
|
2920
2954
|
ctokenSym: string;
|
|
2921
2955
|
ctokenAddr: string;
|
|
2922
2956
|
ctokenDecimal: number;
|
|
@@ -2927,7 +2961,7 @@ declare const Sumer: {
|
|
|
2927
2961
|
permitEnabled: boolean;
|
|
2928
2962
|
assetGroupId: number;
|
|
2929
2963
|
};
|
|
2930
|
-
getTokenPairsByGroupId
|
|
2964
|
+
getTokenPairsByGroupId(assetGroupId: number): {
|
|
2931
2965
|
ctokenSym: string;
|
|
2932
2966
|
ctokenAddr: string;
|
|
2933
2967
|
ctokenDecimal: number;
|
|
@@ -2938,8 +2972,5 @@ declare const Sumer: {
|
|
|
2938
2972
|
permitEnabled: boolean;
|
|
2939
2973
|
assetGroupId: number;
|
|
2940
2974
|
}[];
|
|
2941
|
-
|
|
2942
|
-
isCTokenAllowed: (networkName: string, cToken: string) => boolean;
|
|
2943
|
-
isEther: (networkName: string, ctokenSym: string) => boolean;
|
|
2944
|
-
};
|
|
2975
|
+
}
|
|
2945
2976
|
export = Sumer;
|
package/dist/nodejs/index.js
CHANGED
|
@@ -33,60 +33,44 @@ const util = __importStar(require("./util"));
|
|
|
33
33
|
const comptroller = __importStar(require("./comptroller"));
|
|
34
34
|
const cToken = __importStar(require("./cToken"));
|
|
35
35
|
const errorABIs_1 = require("./errorABIs");
|
|
36
|
-
// import * as comp from './comp'
|
|
37
|
-
// import * as gov from './gov'
|
|
38
36
|
const abi_1 = require("./abi");
|
|
39
37
|
const constants_1 = require("./constants");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* @returns {object} Returns an instance of the Sumer.js SDK.
|
|
71
|
-
*/
|
|
72
|
-
const Sumer = function (provider, options) {
|
|
73
|
-
const instance = Object.assign(Object.assign(Object.assign({ _provider: provider }, comptroller), cToken), { _network: {
|
|
74
|
-
id: options.networkId,
|
|
75
|
-
name: options.networkName,
|
|
76
|
-
}, getTokenPairBySymbol: (symbol) => {
|
|
77
|
-
return (0, constants_1.getTokenPairBySymbol)(options.networkName, symbol);
|
|
78
|
-
}, getTokenPairByAddress: (tokenAddress) => {
|
|
79
|
-
return (0, constants_1.getTokenPairBySymbol)(options.networkName, tokenAddress);
|
|
80
|
-
}, getTokenPairsByGroupId: (assetGroupId) => {
|
|
81
|
-
return (0, constants_1.getTokenPairsByGroupId)(options.networkName, assetGroupId);
|
|
82
|
-
} });
|
|
83
|
-
return instance;
|
|
84
|
-
};
|
|
38
|
+
class Sumer {
|
|
39
|
+
constructor(provider, options) {
|
|
40
|
+
this._provider = provider;
|
|
41
|
+
this._network = { id: options.networkId, name: options.networkName };
|
|
42
|
+
this.supply = cToken.supply.bind(this);
|
|
43
|
+
this.supplyWithPermit = cToken.supplyWithPermit.bind(this);
|
|
44
|
+
this.redeem = cToken.redeem.bind(this);
|
|
45
|
+
this.borrow = cToken.borrow.bind(this);
|
|
46
|
+
this.repayBorrow = cToken.repayBorrow.bind(this);
|
|
47
|
+
this.repayBorrowWithPermit = cToken.repayBorrowWithPermit.bind(this);
|
|
48
|
+
this.liquidateBorrow = cToken.liquidateBorrow.bind(this);
|
|
49
|
+
this.calcBorrowAmountForProtectedMint = cToken.calcBorrowAmountForProtectedMint.bind(this);
|
|
50
|
+
this.protectedMint = cToken.protectedMint.bind(this);
|
|
51
|
+
this.enterMarkets = comptroller.enterMarkets.bind(this);
|
|
52
|
+
this.exitMarket = comptroller.exitMarket.bind(this);
|
|
53
|
+
this.redeemFaceValue = comptroller.redeemFaceValue.bind(this);
|
|
54
|
+
this.redeemFaceValueWithPermit = comptroller.redeemFaceValueWithPermit.bind(this);
|
|
55
|
+
this.redeemFaceValuePreview = comptroller.redeemFaceValuePreview.bind(this);
|
|
56
|
+
this.calcPlan = comptroller.calcPlan.bind(this);
|
|
57
|
+
}
|
|
58
|
+
getTokenPairBySymbol(symbol) {
|
|
59
|
+
return (0, constants_1.getTokenPairBySymbol)(this._network.name, symbol);
|
|
60
|
+
}
|
|
61
|
+
getTokenPairByAddress(tokenAddress) {
|
|
62
|
+
return (0, constants_1.getTokenPairByAddress)(this._network.name, tokenAddress);
|
|
63
|
+
}
|
|
64
|
+
getTokenPairsByGroupId(assetGroupId) {
|
|
65
|
+
return (0, constants_1.getTokenPairsByGroupId)(this._network.name, assetGroupId);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
85
68
|
Sumer.eth = eth;
|
|
86
69
|
Sumer.util = util;
|
|
87
70
|
Sumer._ethers = ethers_1.ethers;
|
|
88
71
|
Sumer.abi = abi_1.abi;
|
|
89
72
|
Sumer.errorABIs = errorABIs_1.errorABIs;
|
|
73
|
+
Sumer.constants = constants_1.constants;
|
|
90
74
|
Sumer.getDecimals = constants_1.getDecimals;
|
|
91
75
|
Sumer.getAddress = constants_1.getAddress;
|
|
92
76
|
Sumer.getName = constants_1.getName;
|
|
@@ -99,10 +83,5 @@ Sumer.getTokenPairsByGroupId = constants_1.getTokenPairsByGroupId;
|
|
|
99
83
|
Sumer.isUnderlyAllowed = constants_1.isUnderlyAllowed;
|
|
100
84
|
Sumer.isCTokenAllowed = constants_1.isCTokenAllowed;
|
|
101
85
|
Sumer.isEther = constants_1.isEther;
|
|
102
|
-
// Sumer.comp = {
|
|
103
|
-
// getCompBalance: comp.getCompBalance,
|
|
104
|
-
// getCompAccrued: comp.getCompAccrued,
|
|
105
|
-
// }
|
|
106
|
-
Object.assign(Sumer, constants_1.constants);
|
|
107
86
|
module.exports = Sumer;
|
|
108
87
|
//# sourceMappingURL=index.js.map
|
package/dist/nodejs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mCAA2E;AAC3E,2CAA4B;AAC5B,6CAA8B;AAC9B,2DAA4C;AAC5C,iDAAkC;AAClC,2CAAuC;AACvC,+BAA2B;AAC3B,2CAcoB;AAGpB,MAAM,KAAK;IAqBT,YAAY,QAAuB,EAAE,OAAqB;QACxD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,EAAE,EAAE,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,CAAA;QAEpE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,I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