@suilend/sdk 1.1.54 → 1.1.55
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/initialize.d.ts +3 -3
- package/lib/initialize.js +10 -14
- package/package.json +1 -1
package/lib/initialize.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const RESERVES_CUSTOM_ORDER: string[];
|
|
|
7
7
|
export declare const NORMALIZED_MAYA_COINTYPE: string;
|
|
8
8
|
export declare const NORMALIZED_mPOINTS_COINTYPE: string;
|
|
9
9
|
export declare const NORMALIZED_TREATS_COINTYPE: string;
|
|
10
|
-
export declare const initializeSuilend: (suiClient: SuiClient, suilendClient: SuilendClient
|
|
10
|
+
export declare const initializeSuilend: (suiClient: SuiClient, suilendClient: SuilendClient) => Promise<{
|
|
11
11
|
lendingMarket: {
|
|
12
12
|
id: string;
|
|
13
13
|
type: string;
|
|
@@ -255,10 +255,10 @@ export declare const initializeSuilend: (suiClient: SuiClient, suilendClient: Su
|
|
|
255
255
|
totalDeposits: BigNumber;
|
|
256
256
|
}>;
|
|
257
257
|
reserveCoinTypes: string[];
|
|
258
|
-
reserveCoinMetadataMap: Record<string,
|
|
258
|
+
reserveCoinMetadataMap: Record<string, import("@suilend/frontend-sui").Token>;
|
|
259
259
|
rewardCoinTypes: string[];
|
|
260
260
|
activeRewardCoinTypes: string[];
|
|
261
|
-
rewardCoinMetadataMap: Record<string,
|
|
261
|
+
rewardCoinMetadataMap: Record<string, import("@suilend/frontend-sui").Token>;
|
|
262
262
|
}>;
|
|
263
263
|
export declare const initializeSuilendRewards: (reserveMap: Record<string, ParsedReserve>, activeRewardCoinTypes: string[]) => Promise<{
|
|
264
264
|
rewardPriceMap: Record<string, BigNumber | undefined>;
|
package/lib/initialize.js
CHANGED
|
@@ -65,6 +65,7 @@ exports.RESERVES_CUSTOM_ORDER = [
|
|
|
65
65
|
frontend_sui_1.NORMALIZED_trevinSUI_COINTYPE,
|
|
66
66
|
frontend_sui_1.NORMALIZED_upSUI_COINTYPE,
|
|
67
67
|
frontend_sui_1.NORMALIZED_yapSUI_COINTYPE,
|
|
68
|
+
frontend_sui_1.NORMALIZED_flSUI_COINTYPE,
|
|
68
69
|
frontend_sui_1.NORMALIZED_SUI_COINTYPE,
|
|
69
70
|
frontend_sui_1.NORMALIZED_USDC_COINTYPE,
|
|
70
71
|
frontend_sui_1.NORMALIZED_wUSDC_COINTYPE,
|
|
@@ -80,8 +81,11 @@ exports.RESERVES_CUSTOM_ORDER = [
|
|
|
80
81
|
frontend_sui_1.NORMALIZED_SEND_COINTYPE,
|
|
81
82
|
frontend_sui_1.NORMALIZED_DEEP_COINTYPE,
|
|
82
83
|
frontend_sui_1.NORMALIZED_WAL_COINTYPE,
|
|
84
|
+
frontend_sui_1.NORMALIZED_HAEDAL_COINTYPE,
|
|
83
85
|
frontend_sui_1.NORMALIZED_BLUE_COINTYPE,
|
|
84
86
|
frontend_sui_1.NORMALIZED_NS_COINTYPE,
|
|
87
|
+
frontend_sui_1.NORMALIZED_UP_COINTYPE,
|
|
88
|
+
frontend_sui_1.NORMALIZED_KOBAN_COINTYPE,
|
|
85
89
|
frontend_sui_1.NORMALIZED_mUSD_COINTYPE,
|
|
86
90
|
frontend_sui_1.NORMALIZED_BUCK_COINTYPE,
|
|
87
91
|
// ISOLATED ASSETS - Memecoins
|
|
@@ -95,7 +99,7 @@ const TREATS_COINTYPE = "0x0dadb7fa2771c2952f96161fc1f0c105d1f22d53926b9ff2498a8
|
|
|
95
99
|
exports.NORMALIZED_MAYA_COINTYPE = (0, utils_1.normalizeStructTag)(MAYA_COINTYPE);
|
|
96
100
|
exports.NORMALIZED_mPOINTS_COINTYPE = (0, utils_1.normalizeStructTag)(mPOINTS_COINTYPE);
|
|
97
101
|
exports.NORMALIZED_TREATS_COINTYPE = (0, utils_1.normalizeStructTag)(TREATS_COINTYPE);
|
|
98
|
-
const initializeSuilend = (suiClient, suilendClient
|
|
102
|
+
const initializeSuilend = (suiClient, suilendClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
103
|
const nowMs = Date.now();
|
|
100
104
|
const nowS = Math.floor(nowMs / 1000);
|
|
101
105
|
const refreshedRawReserves = yield simulate.refreshReservePrice(suilendClient.lendingMarket.reserves.map((r) => simulate.compoundReserveInterest(r, nowS)), new pyth_sui_js_1.SuiPriceServiceConnection("https://hermes.pyth.network"));
|
|
@@ -119,24 +123,16 @@ const initializeSuilend = (suiClient, suilendClient, existingCoinMetadataMap) =>
|
|
|
119
123
|
const uniqueReserveCoinTypes = Array.from(new Set(reserveCoinTypes));
|
|
120
124
|
const uniqueRewardCoinTypes = Array.from(new Set(rewardCoinTypes));
|
|
121
125
|
const uniqueActiveRewardsCoinTypes = Array.from(new Set(activeRewardCoinTypes));
|
|
122
|
-
const [
|
|
123
|
-
(0, frontend_sui_1.getCoinMetadataMap)(uniqueReserveCoinTypes
|
|
124
|
-
(0, frontend_sui_1.getCoinMetadataMap)(uniqueRewardCoinTypes
|
|
126
|
+
const [reserveCoinMetadataMap, rewardCoinMetadataMap] = yield Promise.all([
|
|
127
|
+
(0, frontend_sui_1.getCoinMetadataMap)(uniqueReserveCoinTypes),
|
|
128
|
+
(0, frontend_sui_1.getCoinMetadataMap)(uniqueRewardCoinTypes),
|
|
125
129
|
]);
|
|
126
|
-
const reserveCoinMetadataMap = uniqueReserveCoinTypes.reduce((acc, coinType) => {
|
|
127
|
-
var _a;
|
|
128
|
-
return (Object.assign(Object.assign({}, acc), { [coinType]: (_a = existingCoinMetadataMap === null || existingCoinMetadataMap === void 0 ? void 0 : existingCoinMetadataMap[coinType]) !== null && _a !== void 0 ? _a : _reserveCoinMetadataMap[coinType] }));
|
|
129
|
-
}, {});
|
|
130
|
-
const rewardCoinMetadataMap = uniqueRewardCoinTypes.reduce((acc, coinType) => {
|
|
131
|
-
var _a;
|
|
132
|
-
return (Object.assign(Object.assign({}, acc), { [coinType]: (_a = existingCoinMetadataMap === null || existingCoinMetadataMap === void 0 ? void 0 : existingCoinMetadataMap[coinType]) !== null && _a !== void 0 ? _a : _rewardCoinMetadataMap[coinType] }));
|
|
133
|
-
}, {});
|
|
134
130
|
const coinMetadataMap = Object.assign(Object.assign({}, reserveCoinMetadataMap), rewardCoinMetadataMap);
|
|
135
131
|
const reservesWithTemporaryPythPriceFeeds = refreshedRawReserves.filter((r) => frontend_sui_1.TEMPORARY_PYTH_PRICE_FEED_COINTYPES.includes((0, utils_1.normalizeStructTag)(r.coinType.name)));
|
|
136
132
|
for (const reserve of reservesWithTemporaryPythPriceFeeds) {
|
|
137
|
-
|
|
133
|
+
let birdeyePrice = yield (0, frontend_sui_1.getPrice)((0, utils_1.normalizeStructTag)(reserve.coinType.name));
|
|
138
134
|
if (birdeyePrice === undefined)
|
|
139
|
-
|
|
135
|
+
birdeyePrice = 0.0001; // Non-zero price override for coinTypes with price feed overrides
|
|
140
136
|
const parsedBirdeyePrice = BigInt(+new bignumber_js_1.default(birdeyePrice)
|
|
141
137
|
.times(constants_1.WAD)
|
|
142
138
|
.integerValue(bignumber_js_1.default.ROUND_DOWN));
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sdk","version":"1.1.
|
|
1
|
+
{"name":"@suilend/sdk","version":"1.1.55","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./api/events":"./api/events.js","./api":"./api/index.js","./lib/constants":"./lib/constants.js","./lib":"./lib/index.js","./lib/initialize":"./lib/initialize.js","./lib/liquidityMining":"./lib/liquidityMining.js","./lib/transactions":"./lib/transactions.js","./lib/types":"./lib/types.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/obligation":"./parsers/obligation.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./utils/events":"./utils/events.js","./utils":"./utils/index.js","./utils/obligation":"./utils/obligation.js","./utils/simulate":"./utils/simulate.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/solendprotocol/suilend-public.git"},"bugs":{"url":"https://github.com/solendprotocol/suilend-public/issues"},"dependencies":{"@pythnetwork/pyth-sui-js":"^2.1.0","bignumber.js":"^9.1.2","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"1.6.0","@mysten/sui":"1.28.2","@suilend/frontend-sui":"^0.2.69"}}
|