@morpho-org/blue-sdk 1.0.2 → 1.0.3
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/index.js +62 -0
- package/package.json +5 -6
- package/src/addresses.ts +22 -36
- package/src/user/user.types.ts +3 -1
package/lib/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.vault = exports.ethers = exports.helpers = exports.user = exports.signatures = exports.notifications = exports.maths = exports.types = exports.holding = exports.position = exports.token = exports.chain = exports.market = exports.errors = exports.constants = exports.evm = void 0;
|
|
30
|
+
__exportStar(require("./addresses"), exports);
|
|
31
|
+
__exportStar(require("./evm"), exports);
|
|
32
|
+
__exportStar(require("./constants"), exports);
|
|
33
|
+
__exportStar(require("./errors"), exports);
|
|
34
|
+
__exportStar(require("./market"), exports);
|
|
35
|
+
__exportStar(require("./chain"), exports);
|
|
36
|
+
__exportStar(require("./token"), exports);
|
|
37
|
+
__exportStar(require("./types"), exports);
|
|
38
|
+
__exportStar(require("./maths"), exports);
|
|
39
|
+
__exportStar(require("./notifications"), exports);
|
|
40
|
+
__exportStar(require("./signatures"), exports);
|
|
41
|
+
__exportStar(require("./user"), exports);
|
|
42
|
+
__exportStar(require("./holding"), exports);
|
|
43
|
+
__exportStar(require("./position"), exports);
|
|
44
|
+
__exportStar(require("./helpers"), exports);
|
|
45
|
+
__exportStar(require("./ethers"), exports);
|
|
46
|
+
__exportStar(require("./vault"), exports);
|
|
47
|
+
exports.evm = __importStar(require("./evm"));
|
|
48
|
+
exports.constants = __importStar(require("./constants"));
|
|
49
|
+
exports.errors = __importStar(require("./errors"));
|
|
50
|
+
exports.market = __importStar(require("./market"));
|
|
51
|
+
exports.chain = __importStar(require("./chain"));
|
|
52
|
+
exports.token = __importStar(require("./token"));
|
|
53
|
+
exports.position = __importStar(require("./position"));
|
|
54
|
+
exports.holding = __importStar(require("./holding"));
|
|
55
|
+
exports.types = __importStar(require("./types"));
|
|
56
|
+
exports.maths = __importStar(require("./maths"));
|
|
57
|
+
exports.notifications = __importStar(require("./notifications"));
|
|
58
|
+
exports.signatures = __importStar(require("./signatures"));
|
|
59
|
+
exports.user = __importStar(require("./user"));
|
|
60
|
+
exports.helpers = __importStar(require("./helpers"));
|
|
61
|
+
exports.ethers = __importStar(require("./ethers"));
|
|
62
|
+
exports.vault = __importStar(require("./vault"));
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/blue-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"author": "Morpho Association <contact@morpho.org>",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "lib/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"test:blue-sdk": "yarn test"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@morpho-org/morpho-ts": "1.0.
|
|
18
|
+
"@morpho-org/morpho-ts": "1.0.3",
|
|
19
19
|
"ethers": "^6.12.1",
|
|
20
20
|
"ethers-multicall-provider": "^6.3.0",
|
|
21
21
|
"ethers-types": "^3.15.1",
|
|
22
22
|
"rxjs": "^7.8.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@morpho-org/morpho-test": "1.0.
|
|
25
|
+
"@morpho-org/morpho-test": "1.0.3",
|
|
26
26
|
"@types/jest": "^29.5.12",
|
|
27
27
|
"jest": "^29.6.2",
|
|
28
28
|
"ts-jest": "^29.1.1",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public",
|
|
33
|
-
"main": "lib/index.js",
|
|
34
33
|
"files": [
|
|
35
34
|
"lib"
|
|
36
35
|
]
|
|
@@ -54,5 +53,5 @@
|
|
|
54
53
|
],
|
|
55
54
|
"preset": "ts-jest"
|
|
56
55
|
},
|
|
57
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "6543ef5906fe8315fc6af0dc16ad64f60dd95831"
|
|
58
57
|
}
|
package/src/addresses.ts
CHANGED
|
@@ -163,54 +163,40 @@ export const getChainAddresses = (chainId: number): ChainAddresses => {
|
|
|
163
163
|
return chainAddresses;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
export const
|
|
166
|
+
export const unwrappedTokensMapping: {
|
|
167
167
|
[n in ChainId]: {
|
|
168
|
-
[
|
|
168
|
+
[wrapped: string]: string;
|
|
169
169
|
};
|
|
170
170
|
} = {
|
|
171
171
|
[ChainId.EthGoerliTestnet]: {
|
|
172
|
-
[
|
|
173
|
-
[addresses[ChainId.EthGoerliTestnet].
|
|
174
|
-
addresses[ChainId.EthGoerliTestnet].
|
|
172
|
+
[addresses[ChainId.EthGoerliTestnet].wNative]: NATIVE_ADDRESS,
|
|
173
|
+
[addresses[ChainId.EthGoerliTestnet].wstEth]:
|
|
174
|
+
addresses[ChainId.EthGoerliTestnet].stEth,
|
|
175
175
|
},
|
|
176
176
|
[ChainId.EthMainnet]: {
|
|
177
|
-
[addresses[ChainId.EthMainnet].
|
|
178
|
-
[addresses[ChainId.EthMainnet].
|
|
179
|
-
[
|
|
180
|
-
[addresses[ChainId.EthMainnet].stEth]:
|
|
181
|
-
[addresses[ChainId.EthMainnet].
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
177
|
+
[addresses[ChainId.EthMainnet].wbIB01]: addresses[ChainId.EthMainnet].bIB01,
|
|
178
|
+
[addresses[ChainId.EthMainnet].wbC3M]: addresses[ChainId.EthMainnet].bC3M,
|
|
179
|
+
[addresses[ChainId.EthMainnet].wNative]: NATIVE_ADDRESS,
|
|
180
|
+
[addresses[ChainId.EthMainnet].stEth]: NATIVE_ADDRESS,
|
|
181
|
+
[addresses[ChainId.EthMainnet].wstEth]: addresses[ChainId.EthMainnet].stEth,
|
|
182
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvUSDTWBTCWETH-morpho"]]:
|
|
183
|
+
addresses[ChainId.EthMainnet].crvUSDTWBTCWETH,
|
|
184
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvUSDCWBTCWETH-morpho"]]:
|
|
185
|
+
addresses[ChainId.EthMainnet].crvUSDCWBTCWETH,
|
|
186
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvCRVUSDTBTCWSTETH-morpho"]]:
|
|
187
|
+
addresses[ChainId.EthMainnet].crvCRVUSDTBTCWSTETH,
|
|
188
|
+
[addresses[ChainId.EthMainnet]["stkcvxTryLSD-morpho"]]:
|
|
189
|
+
addresses[ChainId.EthMainnet].tryLSD,
|
|
190
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvUSDETHCRV-morpho"]]:
|
|
191
|
+
addresses[ChainId.EthMainnet].crvUSDETHCRV,
|
|
191
192
|
},
|
|
192
193
|
[ChainId.BaseMainnet]: {
|
|
193
|
-
[
|
|
194
|
+
[addresses[ChainId.BaseMainnet].wNative]: NATIVE_ADDRESS,
|
|
194
195
|
},
|
|
195
196
|
};
|
|
196
197
|
|
|
197
|
-
export const reverseWrapping = Object.fromEntries(
|
|
198
|
-
Object.entries(wrapping).map(([n, chainWrapping]) => [
|
|
199
|
-
n,
|
|
200
|
-
Object.fromEntries(
|
|
201
|
-
Object.entries(chainWrapping)
|
|
202
|
-
.map((w) => [...w].reverse())
|
|
203
|
-
.filter(([add, wAdd]) => !!add && !!wAdd)
|
|
204
|
-
),
|
|
205
|
-
])
|
|
206
|
-
) as typeof wrapping;
|
|
207
|
-
|
|
208
198
|
export function getUnwrappedToken(wrappedToken: Address, chainId: ChainId) {
|
|
209
|
-
return
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export function getWrappedToken(unWrappedToken: Address, chainId: ChainId) {
|
|
213
|
-
return wrapping[chainId][unWrappedToken];
|
|
199
|
+
return unwrappedTokensMapping[chainId][wrappedToken];
|
|
214
200
|
}
|
|
215
201
|
|
|
216
202
|
export const erc20WrapperTokens: {
|
package/src/user/user.types.ts
CHANGED
|
@@ -11,7 +11,9 @@ export type PeripheralTokenType =
|
|
|
11
11
|
| "base"
|
|
12
12
|
| "wrapped"
|
|
13
13
|
| "erc4626"
|
|
14
|
-
| "wrapped-erc4626"
|
|
14
|
+
| "wrapped-erc4626"
|
|
15
|
+
| "staked-wrapped"
|
|
16
|
+
| "unwrapped-staked-wrapped";
|
|
15
17
|
export interface PeripheralToken {
|
|
16
18
|
token: Token;
|
|
17
19
|
type: PeripheralTokenType;
|