impermax-sdk 1.2.18 → 1.2.19
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/lib/config/subgraphs.js +1 -1
- package/lib/offchain/account/offchainAccount.js +0 -2
- package/lib/offchain/offchain.js +0 -4
- package/lib/onchain/account/onchainAccount.js +0 -2
- package/lib/onchain/impermaxFactory/onchainImpermaxFactory.js +0 -1
- package/lib/onchain/interactions/onchainInteractions.js +0 -2
- package/lib/onchain/onchain.js +0 -3
- package/package.json +33 -33
package/lib/config/subgraphs.js
CHANGED
|
@@ -67,7 +67,7 @@ exports.IMPERMAX_CHEF_SUBGRAPH_URL = {
|
|
|
67
67
|
exports.LENDING_VAULT_SUBGRAPH_URL = {
|
|
68
68
|
[types_1.Networks.Ropsten]: '',
|
|
69
69
|
[types_1.Networks.Mainnet]: '',
|
|
70
|
-
[types_1.Networks.Polygon]: '',
|
|
70
|
+
[types_1.Networks.Polygon]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/lending-vault-polygon',
|
|
71
71
|
[types_1.Networks.Arbitrum]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/lending-vault-arbitrum',
|
|
72
72
|
[types_1.Networks.Avalanche]: '',
|
|
73
73
|
[types_1.Networks.Moonriver]: '',
|
|
@@ -31,7 +31,6 @@ class OffchainAccount {
|
|
|
31
31
|
}
|
|
32
32
|
getLendingPool(factory, pair) {
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
pair = pair.toLowerCase();
|
|
35
34
|
if (!this.lendingPools[factory])
|
|
36
35
|
this.lendingPools[factory] = {};
|
|
37
36
|
const lendingPoolsOfFactory = this.lendingPools[factory];
|
|
@@ -48,7 +47,6 @@ class OffchainAccount {
|
|
|
48
47
|
}
|
|
49
48
|
getLendingVault(vaultAddress) {
|
|
50
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
vaultAddress = vaultAddress.toLowerCase();
|
|
52
50
|
if (!this.lendingVaults[vaultAddress])
|
|
53
51
|
this.lendingVaults[vaultAddress] = this.initializeLendingVault(vaultAddress);
|
|
54
52
|
return this.lendingVaults[vaultAddress];
|
package/lib/offchain/offchain.js
CHANGED
|
@@ -109,14 +109,12 @@ class Offchain {
|
|
|
109
109
|
}
|
|
110
110
|
getLendingPool(factory, pairAddress) {
|
|
111
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
pairAddress = pairAddress.toLowerCase();
|
|
113
112
|
yield this.getLendingPoolsData(); // make sure that lending pools are initialized
|
|
114
113
|
return this.lendingPools[factory][pairAddress];
|
|
115
114
|
});
|
|
116
115
|
}
|
|
117
116
|
getLendingVault(vaultAddress) {
|
|
118
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
vaultAddress = vaultAddress.toLowerCase();
|
|
120
118
|
yield this.getLendingVaultsData(); // make sure that lending vaults are initialized
|
|
121
119
|
if (!this.lendingVaults)
|
|
122
120
|
this.lendingVaults = {};
|
|
@@ -126,7 +124,6 @@ class Offchain {
|
|
|
126
124
|
});
|
|
127
125
|
}
|
|
128
126
|
getAccount(accountAddress) {
|
|
129
|
-
accountAddress = accountAddress.toLowerCase();
|
|
130
127
|
if (!this.accounts[accountAddress])
|
|
131
128
|
this.accounts[accountAddress] = new account_1.default(this, accountAddress);
|
|
132
129
|
return this.accounts[accountAddress];
|
|
@@ -150,7 +147,6 @@ class Offchain {
|
|
|
150
147
|
}
|
|
151
148
|
getPairData(factory, pairAddress) {
|
|
152
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
pairAddress = pairAddress.toLowerCase();
|
|
154
150
|
const lendingPool = yield this.getLendingPool(factory, pairAddress);
|
|
155
151
|
const totalBorrowsUSD = yield lendingPool.getTotalBorrowsUSD();
|
|
156
152
|
return { pairAddress, factory, totalBorrowsUSD };
|
|
@@ -46,7 +46,6 @@ class OnchainAccount {
|
|
|
46
46
|
return new lendingPool_1.default(this, lendingPool);
|
|
47
47
|
}
|
|
48
48
|
getLendingPool(factory, pair) {
|
|
49
|
-
pair = pair.toLowerCase();
|
|
50
49
|
if (!this.lendingPools[factory])
|
|
51
50
|
this.lendingPools[factory] = {};
|
|
52
51
|
const accountLendingPools = this.lendingPools[factory];
|
|
@@ -59,7 +58,6 @@ class OnchainAccount {
|
|
|
59
58
|
return new onchainAccountLendingVault_1.default(this, lendingPool);
|
|
60
59
|
}
|
|
61
60
|
getLendingVault(vaultAddress) {
|
|
62
|
-
vaultAddress = vaultAddress.toLowerCase();
|
|
63
61
|
if (!this.lendingVaults[vaultAddress])
|
|
64
62
|
this.lendingVaults[vaultAddress] = this.initializeLendingVault(vaultAddress);
|
|
65
63
|
return this.lendingVaults[vaultAddress];
|
|
@@ -44,7 +44,6 @@ class OnchainImpermaxFactory {
|
|
|
44
44
|
return this.cache.routerContract;
|
|
45
45
|
}
|
|
46
46
|
getLendingPool(uniswapV2PairAddress) {
|
|
47
|
-
uniswapV2PairAddress = uniswapV2PairAddress.toLowerCase();
|
|
48
47
|
if (!this.lendingPools[uniswapV2PairAddress])
|
|
49
48
|
this.lendingPools[uniswapV2PairAddress] = new lendingPool_1.default(this, uniswapV2PairAddress);
|
|
50
49
|
return this.lendingPools[uniswapV2PairAddress];
|
|
@@ -43,7 +43,6 @@ class OnchainInteractions {
|
|
|
43
43
|
return new lendingPool_1.default(this, lendingPool);
|
|
44
44
|
}
|
|
45
45
|
getLendingPool(factory, pair) {
|
|
46
|
-
pair = pair.toLowerCase();
|
|
47
46
|
if (!this.lendingPools[factory])
|
|
48
47
|
this.lendingPools[factory] = {};
|
|
49
48
|
const interactionsLendingPools = this.lendingPools[factory];
|
|
@@ -52,7 +51,6 @@ class OnchainInteractions {
|
|
|
52
51
|
return interactionsLendingPools[pair];
|
|
53
52
|
}
|
|
54
53
|
initializeLendingVault(vaultAddress) {
|
|
55
|
-
vaultAddress = vaultAddress.toLowerCase();
|
|
56
54
|
const lendingVault = this.onchain.getLendingVault(vaultAddress);
|
|
57
55
|
return new onchainInteractionsLendingVault_1.default(this, lendingVault);
|
|
58
56
|
}
|
package/lib/onchain/onchain.js
CHANGED
|
@@ -52,19 +52,16 @@ class Onchain {
|
|
|
52
52
|
return this.factories[factory];
|
|
53
53
|
}
|
|
54
54
|
getLendingVault(vaultAddress) {
|
|
55
|
-
vaultAddress = vaultAddress.toLowerCase();
|
|
56
55
|
if (!this.lendingVaults[vaultAddress])
|
|
57
56
|
this.lendingVaults[vaultAddress] = new onchainLendingVault_1.default(this, vaultAddress);
|
|
58
57
|
return this.lendingVaults[vaultAddress];
|
|
59
58
|
}
|
|
60
59
|
getAccount(address) {
|
|
61
|
-
address = address.toLowerCase();
|
|
62
60
|
if (!this.accounts[address])
|
|
63
61
|
this.accounts[address] = new account_1.default(this, address);
|
|
64
62
|
return this.accounts[address];
|
|
65
63
|
}
|
|
66
64
|
getInteractions(address) {
|
|
67
|
-
address = address.toLowerCase();
|
|
68
65
|
if (!this.interactions[address])
|
|
69
66
|
this.interactions[address] = new interactions_1.default(this, address);
|
|
70
67
|
return this.interactions[address];
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "impermax-sdk",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"module": "./lib/index.js",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib/"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"test": "mocha --timeout 15000",
|
|
12
|
-
"tsc": "tsc -p tsconfig.json",
|
|
13
|
-
"prepublishOnly": "npm run tsc"
|
|
14
|
-
},
|
|
15
|
-
"author": "",
|
|
16
|
-
"license": "ISC",
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"ts-loader": "^8.0.14",
|
|
19
|
-
"typescript": "^4.0.3",
|
|
20
|
-
"@truffle/hdwallet-provider": "^2.1.15"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"apollo-cache-inmemory": "^1.6.6",
|
|
24
|
-
"apollo-client": "^2.6.10",
|
|
25
|
-
"apollo-link-http": "^1.5.17",
|
|
26
|
-
"chai": "^4.3.8",
|
|
27
|
-
"ethers": "^5.0.26",
|
|
28
|
-
"graphql": "^15.4.0",
|
|
29
|
-
"graphql-tag": "^2.11.0",
|
|
30
|
-
"mocha": "^10.2.0",
|
|
31
|
-
"web3": "^1.3.1"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "impermax-sdk",
|
|
3
|
+
"version": "1.2.19",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib/"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "mocha --timeout 15000",
|
|
12
|
+
"tsc": "tsc -p tsconfig.json",
|
|
13
|
+
"prepublishOnly": "npm run tsc"
|
|
14
|
+
},
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"ts-loader": "^8.0.14",
|
|
19
|
+
"typescript": "^4.0.3",
|
|
20
|
+
"@truffle/hdwallet-provider": "^2.1.15"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"apollo-cache-inmemory": "^1.6.6",
|
|
24
|
+
"apollo-client": "^2.6.10",
|
|
25
|
+
"apollo-link-http": "^1.5.17",
|
|
26
|
+
"chai": "^4.3.8",
|
|
27
|
+
"ethers": "^5.0.26",
|
|
28
|
+
"graphql": "^15.4.0",
|
|
29
|
+
"graphql-tag": "^2.11.0",
|
|
30
|
+
"mocha": "^10.2.0",
|
|
31
|
+
"web3": "^1.3.1"
|
|
32
|
+
}
|
|
33
|
+
}
|