@suilend/sdk 3.0.4 → 3.0.5
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/_generated/_dependencies/source/0x1/ascii/structs.js +4 -4
- package/_generated/_dependencies/source/0x1/option/structs.js +4 -4
- package/_generated/_dependencies/source/0x1/type-name/structs.js +4 -4
- package/_generated/_dependencies/source/0x2/bag/structs.js +4 -4
- package/_generated/_dependencies/source/0x2/balance/structs.js +3 -3
- package/_generated/_dependencies/source/0x2/object/structs.js +3 -3
- package/_generated/_dependencies/source/0x2/object-table/structs.js +4 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +3 -3
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +4 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +5 -5
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +4 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +5 -5
- package/_generated/_framework/reified.js +2 -2
- package/_generated/_framework/vector.js +2 -2
- package/_generated/suilend/cell/structs.js +4 -4
- package/_generated/suilend/decimal/structs.js +3 -3
- package/_generated/suilend/lending-market/functions.js +4 -4
- package/_generated/suilend/lending-market/structs.js +11 -11
- package/_generated/suilend/lending-market-registry/functions.js +2 -2
- package/_generated/suilend/liquidity-mining/structs.js +9 -9
- package/_generated/suilend/obligation/structs.js +8 -8
- package/_generated/suilend/rate-limiter/functions.js +2 -2
- package/_generated/suilend/rate-limiter/structs.js +4 -4
- package/_generated/suilend/reserve/structs.js +12 -12
- package/_generated/suilend/reserve-config/functions.js +2 -2
- package/_generated/suilend/reserve-config/structs.js +5 -5
- package/api/index.js +1 -1
- package/client.js +13 -13
- package/index.js +7 -7
- package/lib/index.js +5 -5
- package/lib/initialize.js +6 -6
- package/lib/liquidityMining.js +3 -3
- package/lib/pythAdapter.js +24 -1
- package/lib/strategyOwnerCap.js +2 -2
- package/package.json +1 -1
- package/parsers/apiReserveAssetDataEvent.js +1 -1
- package/parsers/index.js +5 -5
- package/parsers/lendingMarket.js +2 -2
- package/parsers/obligation.js +1 -1
- package/parsers/rateLimiter.js +1 -1
- package/parsers/reserve.js +3 -3
- package/strategies.js +6 -6
- package/swap/index.js +2 -2
- package/swap/transaction.js +1 -1
- package/utils/index.js +3 -3
- package/utils/obligation.js +3 -3
- package/utils/simulate.js +4 -4
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../../../_framework/reified";
|
|
11
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../../../_framework/reified";
|
|
12
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
13
|
-
import { PKG_V13 } from "../index";
|
|
10
|
+
import * as reified from "../../../../_framework/reified.js";
|
|
11
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../../../_framework/reified.js";
|
|
12
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
13
|
+
import { PKG_V13 } from "../index.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== Char =============================== */
|
|
16
16
|
export function isChar(type) {
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../../../_framework/reified";
|
|
11
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs, } from "../../../../_framework/reified";
|
|
12
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
13
|
-
import { PKG_V13 } from "../index";
|
|
10
|
+
import * as reified from "../../../../_framework/reified.js";
|
|
11
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs, } from "../../../../_framework/reified.js";
|
|
12
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
13
|
+
import { PKG_V13 } from "../index.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== Option =============================== */
|
|
16
16
|
export function isOption(type) {
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { String } from "../ascii/structs";
|
|
13
|
-
import { PKG_V13 } from "../index";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { String } from "../ascii/structs.js";
|
|
13
|
+
import { PKG_V13 } from "../index.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== TypeName =============================== */
|
|
16
16
|
export function isTypeName(type) {
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { PKG_V30 } from "../index";
|
|
13
|
-
import { UID } from "../object/structs";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { PKG_V30 } from "../index.js";
|
|
13
|
+
import { UID } from "../object/structs.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== Bag =============================== */
|
|
16
16
|
export function isBag(type) {
|
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { PKG_V30 } from "../index";
|
|
10
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { PKG_V30 } from "../index.js";
|
|
13
13
|
import { bcs } from "@mysten/sui/bcs";
|
|
14
14
|
/* ============================== Balance =============================== */
|
|
15
15
|
export function isBalance(type) {
|
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { PKG_V30 } from "../index";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { PKG_V30 } from "../index.js";
|
|
13
13
|
import { bcs } from "@mysten/sui/bcs";
|
|
14
14
|
import { fromHex, toHex } from "@mysten/sui/utils";
|
|
15
15
|
/* ============================== ID =============================== */
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { PKG_V30 } from "../index";
|
|
13
|
-
import { UID } from "../object/structs";
|
|
10
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { PKG_V30 } from "../index.js";
|
|
13
|
+
import { UID } from "../object/structs.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== ObjectTable =============================== */
|
|
16
16
|
export function isObjectTable(type) {
|
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { PKG_V1 } from "../index.js";
|
|
13
13
|
import { bcs } from "@mysten/sui/bcs";
|
|
14
14
|
/* ============================== I64 =============================== */
|
|
15
15
|
export function isI64(type) {
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { I64 } from "../i64/structs";
|
|
13
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { I64 } from "../i64/structs.js";
|
|
13
|
+
import { PKG_V1 } from "../index.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== Price =============================== */
|
|
16
16
|
export function isPrice(type) {
|
|
@@ -7,11 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { PKG_V1 } from "../index";
|
|
13
|
-
import { PriceIdentifier } from "../price-identifier/structs";
|
|
14
|
-
import { Price } from "../price/structs";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { PKG_V1 } from "../index.js";
|
|
13
|
+
import { PriceIdentifier } from "../price-identifier/structs.js";
|
|
14
|
+
import { Price } from "../price/structs.js";
|
|
15
15
|
import { bcs } from "@mysten/sui/bcs";
|
|
16
16
|
/* ============================== PriceFeed =============================== */
|
|
17
17
|
export function isPriceFeed(type) {
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../../../_framework/reified";
|
|
11
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../../../_framework/reified";
|
|
12
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
13
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import * as reified from "../../../../_framework/reified.js";
|
|
11
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../../../_framework/reified.js";
|
|
12
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
13
|
+
import { PKG_V1 } from "../index.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== PriceIdentifier =============================== */
|
|
16
16
|
export function isPriceIdentifier(type) {
|
|
@@ -7,11 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
-
import { UID } from "../../0x2/object/structs";
|
|
13
|
-
import { PKG_V1 } from "../index";
|
|
14
|
-
import { PriceFeed } from "../price-feed/structs";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util.js";
|
|
12
|
+
import { UID } from "../../0x2/object/structs.js";
|
|
13
|
+
import { PKG_V1 } from "../index.js";
|
|
14
|
+
import { PriceFeed } from "../price-feed/structs.js";
|
|
15
15
|
import { bcs } from "@mysten/sui/bcs";
|
|
16
16
|
/* ============================== PriceInfo =============================== */
|
|
17
17
|
export function isPriceInfo(type) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { bcs } from "@mysten/sui/bcs";
|
|
2
2
|
import { fromHex, toHex } from "@mysten/sui/utils";
|
|
3
|
-
import { compressSuiType, parseTypeName } from "./util";
|
|
3
|
+
import { compressSuiType, parseTypeName } from "./util.js";
|
|
4
4
|
// for backwards compatibility
|
|
5
|
-
export { vector } from "./vector";
|
|
5
|
+
export { vector } from "./vector.js";
|
|
6
6
|
export function phantom(type) {
|
|
7
7
|
if (typeof type === "string") {
|
|
8
8
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, toBcs, fieldToJSON, } from "./reified";
|
|
3
|
-
import { composeSuiType } from "./util";
|
|
2
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, toBcs, fieldToJSON, } from "./reified.js";
|
|
3
|
+
import { composeSuiType } from "./util.js";
|
|
4
4
|
export class Vector {
|
|
5
5
|
constructor(typeArgs, elements) {
|
|
6
6
|
this.__VectorClass = true;
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Option } from "../../_dependencies/source/0x1/option/structs";
|
|
11
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs, } from "../../_framework/reified";
|
|
12
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
13
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import { Option } from "../../_dependencies/source/0x1/option/structs.js";
|
|
11
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs, } from "../../_framework/reified.js";
|
|
12
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
13
|
+
import { PKG_V1 } from "../index.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== Cell =============================== */
|
|
16
16
|
export function isCell(type) {
|
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
12
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
12
|
+
import { PKG_V1 } from "../index.js";
|
|
13
13
|
import { bcs } from "@mysten/sui/bcs";
|
|
14
14
|
/* ============================== Decimal =============================== */
|
|
15
15
|
export function isDecimal(type) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PUBLISHED_AT } from "
|
|
2
|
-
import { ID } from "../../_dependencies/source/0x2/object/structs";
|
|
3
|
-
import { obj, option, pure } from "../../_framework/util";
|
|
4
|
-
import { RateLimiterExemption } from "./structs";
|
|
1
|
+
import { PUBLISHED_AT } from "../index.js";
|
|
2
|
+
import { ID } from "../../_dependencies/source/0x2/object/structs.js";
|
|
3
|
+
import { obj, option, pure } from "../../_framework/util.js";
|
|
4
|
+
import { RateLimiterExemption } from "./structs.js";
|
|
5
5
|
export function borrow(tx, typeArgs, args) {
|
|
6
6
|
return tx.moveCall({
|
|
7
7
|
target: `${PUBLISHED_AT}::lending_market::borrow`,
|
|
@@ -7,17 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../_framework/reified";
|
|
11
|
-
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
|
|
12
|
-
import { ObjectTable } from "../../_dependencies/source/0x2/object-table/structs";
|
|
13
|
-
import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
|
|
14
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified";
|
|
15
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
16
|
-
import { Decimal } from "../decimal/structs";
|
|
17
|
-
import { PKG_V1, PKG_V10 } from "../index";
|
|
18
|
-
import { Obligation } from "../obligation/structs";
|
|
19
|
-
import { RateLimiter } from "../rate-limiter/structs";
|
|
20
|
-
import { Reserve } from "../reserve/structs";
|
|
10
|
+
import * as reified from "../../_framework/reified.js";
|
|
11
|
+
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs.js";
|
|
12
|
+
import { ObjectTable } from "../../_dependencies/source/0x2/object-table/structs.js";
|
|
13
|
+
import { ID, UID } from "../../_dependencies/source/0x2/object/structs.js";
|
|
14
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified.js";
|
|
15
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
16
|
+
import { Decimal } from "../decimal/structs.js";
|
|
17
|
+
import { PKG_V1, PKG_V10 } from "../index.js";
|
|
18
|
+
import { Obligation } from "../obligation/structs.js";
|
|
19
|
+
import { RateLimiter } from "../rate-limiter/structs.js";
|
|
20
|
+
import { Reserve } from "../reserve/structs.js";
|
|
21
21
|
import { bcs } from "@mysten/sui/bcs";
|
|
22
22
|
import { fromHex, toHex } from "@mysten/sui/utils";
|
|
23
23
|
/* ============================== MintEvent =============================== */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PUBLISHED_AT } from "
|
|
2
|
-
import { obj } from "../../_framework/util";
|
|
1
|
+
import { PUBLISHED_AT } from "../index.js";
|
|
2
|
+
import { obj } from "../../_framework/util.js";
|
|
3
3
|
export function init(tx) {
|
|
4
4
|
return tx.moveCall({
|
|
5
5
|
target: `${PUBLISHED_AT}::lending_market_registry::init`,
|
|
@@ -7,15 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../_framework/reified";
|
|
11
|
-
import { Option } from "../../_dependencies/source/0x1/option/structs";
|
|
12
|
-
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
|
|
13
|
-
import { Bag } from "../../_dependencies/source/0x2/bag/structs";
|
|
14
|
-
import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
|
|
15
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified";
|
|
16
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
17
|
-
import { Decimal } from "../decimal/structs";
|
|
18
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import * as reified from "../../_framework/reified.js";
|
|
11
|
+
import { Option } from "../../_dependencies/source/0x1/option/structs.js";
|
|
12
|
+
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs.js";
|
|
13
|
+
import { Bag } from "../../_dependencies/source/0x2/bag/structs.js";
|
|
14
|
+
import { ID, UID } from "../../_dependencies/source/0x2/object/structs.js";
|
|
15
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified.js";
|
|
16
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
17
|
+
import { Decimal } from "../decimal/structs.js";
|
|
18
|
+
import { PKG_V1 } from "../index.js";
|
|
19
19
|
import { bcs } from "@mysten/sui/bcs";
|
|
20
20
|
/* ============================== PoolReward =============================== */
|
|
21
21
|
export function isPoolReward(type) {
|
|
@@ -7,14 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../_framework/reified";
|
|
11
|
-
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
|
|
12
|
-
import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
|
|
13
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified";
|
|
14
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
15
|
-
import { Decimal } from "../decimal/structs";
|
|
16
|
-
import { PKG_V1, PKG_V11 } from "../index";
|
|
17
|
-
import { UserRewardManager } from "../liquidity-mining/structs";
|
|
10
|
+
import * as reified from "../../_framework/reified.js";
|
|
11
|
+
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs.js";
|
|
12
|
+
import { ID, UID } from "../../_dependencies/source/0x2/object/structs.js";
|
|
13
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified.js";
|
|
14
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
15
|
+
import { Decimal } from "../decimal/structs.js";
|
|
16
|
+
import { PKG_V1, PKG_V11 } from "../index.js";
|
|
17
|
+
import { UserRewardManager } from "../liquidity-mining/structs.js";
|
|
18
18
|
import { bcs } from "@mysten/sui/bcs";
|
|
19
19
|
import { fromHex, toHex } from "@mysten/sui/utils";
|
|
20
20
|
/* ============================== Borrow =============================== */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PUBLISHED_AT } from "
|
|
2
|
-
import { obj, pure } from "../../_framework/util";
|
|
1
|
+
import { PUBLISHED_AT } from "../index.js";
|
|
2
|
+
import { obj, pure } from "../../_framework/util.js";
|
|
3
3
|
export function new_(tx, args) {
|
|
4
4
|
return tx.moveCall({
|
|
5
5
|
target: `${PUBLISHED_AT}::rate_limiter::new`,
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../_framework/reified";
|
|
11
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
12
|
-
import { Decimal } from "../decimal/structs";
|
|
13
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../_framework/reified.js";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
12
|
+
import { Decimal } from "../decimal/structs.js";
|
|
13
|
+
import { PKG_V1 } from "../index.js";
|
|
14
14
|
import { bcs } from "@mysten/sui/bcs";
|
|
15
15
|
/* ============================== RateLimiter =============================== */
|
|
16
16
|
export function isRateLimiter(type) {
|
|
@@ -7,18 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../_framework/reified";
|
|
11
|
-
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
|
|
12
|
-
import { Balance, Supply, } from "../../_dependencies/source/0x2/balance/structs";
|
|
13
|
-
import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
|
|
14
|
-
import { PriceIdentifier } from "../../_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs";
|
|
15
|
-
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../_framework/reified";
|
|
16
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
17
|
-
import { Cell } from "../cell/structs";
|
|
18
|
-
import { Decimal } from "../decimal/structs";
|
|
19
|
-
import { PKG_V1, PKG_V8 } from "../index";
|
|
20
|
-
import { PoolRewardManager } from "../liquidity-mining/structs";
|
|
21
|
-
import { ReserveConfig } from "../reserve-config/structs";
|
|
10
|
+
import * as reified from "../../_framework/reified.js";
|
|
11
|
+
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs.js";
|
|
12
|
+
import { Balance, Supply, } from "../../_dependencies/source/0x2/balance/structs.js";
|
|
13
|
+
import { ID, UID } from "../../_dependencies/source/0x2/object/structs.js";
|
|
14
|
+
import { PriceIdentifier } from "../../_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js";
|
|
15
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../_framework/reified.js";
|
|
16
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
17
|
+
import { Cell } from "../cell/structs.js";
|
|
18
|
+
import { Decimal } from "../decimal/structs.js";
|
|
19
|
+
import { PKG_V1, PKG_V8 } from "../index.js";
|
|
20
|
+
import { PoolRewardManager } from "../liquidity-mining/structs.js";
|
|
21
|
+
import { ReserveConfig } from "../reserve-config/structs.js";
|
|
22
22
|
import { bcs } from "@mysten/sui/bcs";
|
|
23
23
|
import { fromHex, toHex } from "@mysten/sui/utils";
|
|
24
24
|
/* ============================== BalanceKey =============================== */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PUBLISHED_AT } from "
|
|
2
|
-
import { generic, obj, pure } from "../../_framework/util";
|
|
1
|
+
import { PUBLISHED_AT } from "../index.js";
|
|
2
|
+
import { generic, obj, pure } from "../../_framework/util.js";
|
|
3
3
|
export function set(tx, typeArgs, args) {
|
|
4
4
|
return tx.moveCall({
|
|
5
5
|
target: `${PUBLISHED_AT}::reserve_config::set`,
|
|
@@ -7,11 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as reified from "../../_framework/reified";
|
|
11
|
-
import { Bag } from "../../_dependencies/source/0x2/bag/structs";
|
|
12
|
-
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../_framework/reified";
|
|
13
|
-
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
14
|
-
import { PKG_V1 } from "../index";
|
|
10
|
+
import * as reified from "../../_framework/reified.js";
|
|
11
|
+
import { Bag } from "../../_dependencies/source/0x2/bag/structs.js";
|
|
12
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../_framework/reified.js";
|
|
13
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util.js";
|
|
14
|
+
import { PKG_V1 } from "../index.js";
|
|
15
15
|
import { bcs } from "@mysten/sui/bcs";
|
|
16
16
|
/* ============================== ReserveConfig =============================== */
|
|
17
17
|
export function isReserveConfig(type) {
|
package/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./events";
|
|
1
|
+
export * from "./events.js";
|
package/client.js
CHANGED
|
@@ -10,19 +10,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { SUI_CLOCK_OBJECT_ID, SUI_SYSTEM_STATE_OBJECT_ID, normalizeStructTag, toHex, } from "@mysten/sui/utils";
|
|
11
11
|
import { SuiPriceServiceConnection, SuiPythClient, } from "@pythnetwork/pyth-sui-js";
|
|
12
12
|
import { extractCTokenCoinType, getAllCoins, getSpendableCoin, } from "@suilend/sui-fe";
|
|
13
|
-
import { PriceInfoObject } from "./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs";
|
|
14
|
-
import { phantom } from "./_generated/_framework/reified";
|
|
15
|
-
import { PKG_V10, setPublishedAt } from "./_generated/suilend";
|
|
16
|
-
import { PACKAGE_ID, PUBLISHED_AT } from "./_generated/suilend";
|
|
17
|
-
import { addPoolReward, addReserve, addReserveV2, borrowRequest, cancelPoolReward, changeReservePriceFeed, claimFees, claimRewards, claimRewardsAndDeposit, closePoolReward, depositCtokensIntoObligation, depositLiquidityAndMintCtokens, fulfillLiquidityRequest, liquidate, migrate, newObligationOwnerCap, rebalanceStaker, redeemCtokensAndWithdrawLiquidityRequest, refreshReservePrice, repay, setFeeReceivers, unstakeSuiFromStaker, updateRateLimiterConfig, updateReserveConfig, withdrawCtokens, } from "./_generated/suilend/lending-market/functions";
|
|
18
|
-
import { LendingMarket, ObligationOwnerCap, } from "./_generated/suilend/lending-market/structs";
|
|
19
|
-
import { createLendingMarket } from "./_generated/suilend/lending-market-registry/functions";
|
|
20
|
-
import { Obligation } from "./_generated/suilend/obligation/structs";
|
|
21
|
-
import { newConfig as createRateLimiterConfig, } from "./_generated/suilend/rate-limiter/functions";
|
|
22
|
-
import { createReserveConfig, } from "./_generated/suilend/reserve-config/functions";
|
|
23
|
-
import { PRIMARY_PYTH_ENDPOINT } from "./lib/pyth";
|
|
24
|
-
import { createJsonRpcAdapter } from "./lib/pythAdapter";
|
|
25
|
-
import { Side } from "./lib/types";
|
|
13
|
+
import { PriceInfoObject } from "./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js";
|
|
14
|
+
import { phantom } from "./_generated/_framework/reified.js";
|
|
15
|
+
import { PKG_V10, setPublishedAt } from "./_generated/suilend/index.js";
|
|
16
|
+
import { PACKAGE_ID, PUBLISHED_AT } from "./_generated/suilend/index.js";
|
|
17
|
+
import { addPoolReward, addReserve, addReserveV2, borrowRequest, cancelPoolReward, changeReservePriceFeed, claimFees, claimRewards, claimRewardsAndDeposit, closePoolReward, depositCtokensIntoObligation, depositLiquidityAndMintCtokens, fulfillLiquidityRequest, liquidate, migrate, newObligationOwnerCap, rebalanceStaker, redeemCtokensAndWithdrawLiquidityRequest, refreshReservePrice, repay, setFeeReceivers, unstakeSuiFromStaker, updateRateLimiterConfig, updateReserveConfig, withdrawCtokens, } from "./_generated/suilend/lending-market/functions.js";
|
|
18
|
+
import { LendingMarket, ObligationOwnerCap, } from "./_generated/suilend/lending-market/structs.js";
|
|
19
|
+
import { createLendingMarket } from "./_generated/suilend/lending-market-registry/functions.js";
|
|
20
|
+
import { Obligation } from "./_generated/suilend/obligation/structs.js";
|
|
21
|
+
import { newConfig as createRateLimiterConfig, } from "./_generated/suilend/rate-limiter/functions.js";
|
|
22
|
+
import { createReserveConfig, } from "./_generated/suilend/reserve-config/functions.js";
|
|
23
|
+
import { PRIMARY_PYTH_ENDPOINT } from "./lib/pyth.js";
|
|
24
|
+
import { createJsonRpcAdapter } from "./lib/pythAdapter.js";
|
|
25
|
+
import { Side } from "./lib/types.js";
|
|
26
26
|
const SUI_COINTYPE = "0x2::sui::SUI";
|
|
27
27
|
const NORMALIZED_SUI_COINTYPE = normalizeStructTag(SUI_COINTYPE);
|
|
28
28
|
const isSui = (coinType) => normalizeStructTag(coinType) === NORMALIZED_SUI_COINTYPE;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./lib";
|
|
3
|
-
export * from "./parsers";
|
|
4
|
-
export * from "./strategies";
|
|
5
|
-
export * from "./swap";
|
|
6
|
-
export * from "./utils";
|
|
7
|
-
export * from "./client";
|
|
1
|
+
export * from "./api/index.js";
|
|
2
|
+
export * from "./lib/index.js";
|
|
3
|
+
export * from "./parsers/index.js";
|
|
4
|
+
export * from "./strategies.js";
|
|
5
|
+
export * from "./swap/index.js";
|
|
6
|
+
export * from "./utils/index.js";
|
|
7
|
+
export * from "./client.js";
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./constants";
|
|
2
|
-
export * from "./initialize";
|
|
3
|
-
export * from "./liquidityMining";
|
|
4
|
-
export * from "./transactions";
|
|
5
|
-
export * from "./types";
|
|
1
|
+
export * from "./constants.js";
|
|
2
|
+
export * from "./initialize.js";
|
|
3
|
+
export * from "./liquidityMining.js";
|
|
4
|
+
export * from "./transactions.js";
|
|
5
|
+
export * from "./types.js";
|
package/lib/initialize.js
CHANGED
|
@@ -11,12 +11,12 @@ import { normalizeStructTag } from "@mysten/sui/utils";
|
|
|
11
11
|
import { SuiPriceServiceConnection } from "@pythnetwork/pyth-sui-js";
|
|
12
12
|
import BigNumber from "bignumber.js";
|
|
13
13
|
import { NORMALIZED_ALKIMI_COINTYPE, NORMALIZED_AUSD_COINTYPE, NORMALIZED_BLUE_COINTYPE, NORMALIZED_BUCK_COINTYPE, NORMALIZED_DEEP_COINTYPE, NORMALIZED_DMC_COINTYPE, NORMALIZED_FUD_COINTYPE, NORMALIZED_HAEDAL_COINTYPE, NORMALIZED_HIPPO_COINTYPE, NORMALIZED_IKA_COINTYPE, NORMALIZED_KOBAN_COINTYPE, NORMALIZED_LBTC_COINTYPE, NORMALIZED_NS_COINTYPE, NORMALIZED_SEND_COINTYPE, NORMALIZED_SEND_POINTS_S1_COINTYPE, NORMALIZED_SEND_POINTS_S2_COINTYPE, NORMALIZED_SOL_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_UP_COINTYPE, NORMALIZED_USDB_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_USDsui_COINTYPE, NORMALIZED_WAL_COINTYPE, NORMALIZED_WBTC_COINTYPE, NORMALIZED_WETH_COINTYPE, NORMALIZED_XAUm_COINTYPE, NORMALIZED_eEARN_COINTYPE, NORMALIZED_eTHIRD_COINTYPE, NORMALIZED_flSUI_COINTYPE, NORMALIZED_fpSUI_COINTYPE, NORMALIZED_fudSUI_COINTYPE, NORMALIZED_iSUI_COINTYPE, NORMALIZED_jugSUI_COINTYPE, NORMALIZED_kSUI_COINTYPE, NORMALIZED_mSUI_COINTYPE, NORMALIZED_mUSD_COINTYPE, NORMALIZED_oshiSUI_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_sdeUSD_COINTYPE, NORMALIZED_stratSUI_COINTYPE, NORMALIZED_suiETH_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiUSDe_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_trevinSUI_COINTYPE, NORMALIZED_upSUI_COINTYPE, NORMALIZED_wUSDC_COINTYPE, NORMALIZED_wUSDT_COINTYPE, NORMALIZED_xBTC_COINTYPE, NORMALIZED_yapSUI_COINTYPE, TEMPORARY_PYTH_PRICE_FEED_COINTYPES, getAllOwnedObjects, getCoinMetadataMap, getPrice, isSendPoints, isSteammPoints, } from "@suilend/sui-fe";
|
|
14
|
-
import { LENDING_MARKET_ID, SuilendClient } from "../client";
|
|
15
|
-
import { parseLendingMarket, parseObligation } from "../parsers";
|
|
16
|
-
import * as simulate from "../utils/simulate";
|
|
17
|
-
import { WAD } from "./constants";
|
|
18
|
-
import { getWorkingPythEndpoint } from "./pyth";
|
|
19
|
-
import { STRATEGY_TYPE_INFO_MAP, STRATEGY_WRAPPER_PACKAGE_ID_V1, } from "./strategyOwnerCap";
|
|
14
|
+
import { LENDING_MARKET_ID, SuilendClient } from "../client.js";
|
|
15
|
+
import { parseLendingMarket, parseObligation } from "../parsers/index.js";
|
|
16
|
+
import * as simulate from "../utils/simulate.js";
|
|
17
|
+
import { WAD } from "./constants.js";
|
|
18
|
+
import { getWorkingPythEndpoint } from "./pyth.js";
|
|
19
|
+
import { STRATEGY_TYPE_INFO_MAP, STRATEGY_WRAPPER_PACKAGE_ID_V1, } from "./strategyOwnerCap.js";
|
|
20
20
|
export const RESERVES_CUSTOM_ORDER = {
|
|
21
21
|
[LENDING_MARKET_ID]: [
|
|
22
22
|
// MAIN ASSETS
|
package/lib/liquidityMining.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
|
-
import
|
|
2
|
+
import cloneDeep from "lodash/cloneDeep.js";
|
|
3
3
|
import { MS_PER_YEAR, NORMALIZED_eEARN_COINTYPE, NORMALIZED_eTHIRD_COINTYPE, NORMALIZED_sdeUSD_COINTYPE, isSendPoints, } from "@suilend/sui-fe";
|
|
4
|
-
import { WAD } from "./constants";
|
|
5
|
-
import { Side } from "./types";
|
|
4
|
+
import { WAD } from "./constants.js";
|
|
5
|
+
import { Side } from "./types.js";
|
|
6
6
|
export const getDepositShare = (reserve, share) => share.div(10 ** reserve.mintDecimals).times(reserve.cTokenExchangeRate);
|
|
7
7
|
const getDepositShareUsd = (reserve, share) => getDepositShare(reserve, share).times(reserve.price);
|
|
8
8
|
export const getBorrowShare = (reserve, share) => share.div(10 ** reserve.mintDecimals).times(reserve.cumulativeBorrowRate);
|
package/lib/pythAdapter.js
CHANGED
|
@@ -30,7 +30,7 @@ export function createJsonRpcAdapter(suiGrpcClient) {
|
|
|
30
30
|
type: object.type,
|
|
31
31
|
content: {
|
|
32
32
|
dataType: "moveObject",
|
|
33
|
-
fields: object.json,
|
|
33
|
+
fields: wrapNestedObjects(object.json),
|
|
34
34
|
type: object.type,
|
|
35
35
|
},
|
|
36
36
|
},
|
|
@@ -174,3 +174,26 @@ function dynamicField_encodeName(name) {
|
|
|
174
174
|
}
|
|
175
175
|
throw new Error(`jsonRpcAdapter: unsupported dynamic field name type "${name.type}"`);
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* gRPC Value.toJson() returns flat objects, but the JSON-RPC format wraps
|
|
179
|
+
* nested struct fields in { fields: { ... } }. This recursively wraps any
|
|
180
|
+
* nested plain object values so legacy SDKs (e.g. Pyth) can traverse them.
|
|
181
|
+
*/
|
|
182
|
+
function wrapNestedObjects(obj) {
|
|
183
|
+
if (obj === null || obj === undefined)
|
|
184
|
+
return obj;
|
|
185
|
+
if (Array.isArray(obj))
|
|
186
|
+
return obj.map(wrapNestedObjects);
|
|
187
|
+
if (typeof obj !== "object")
|
|
188
|
+
return obj;
|
|
189
|
+
const result = {};
|
|
190
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
191
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
192
|
+
result[key] = { fields: wrapNestedObjects(value) };
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
result[key] = value;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
}
|
package/lib/strategyOwnerCap.js
CHANGED
|
@@ -11,8 +11,8 @@ import { SUI_CLOCK_OBJECT_ID, SUI_SYSTEM_STATE_OBJECT_ID, } from "@mysten/sui/ut
|
|
|
11
11
|
import BigNumber from "bignumber.js";
|
|
12
12
|
import BN from "bn.js";
|
|
13
13
|
import { MAX_U64, NORMALIZED_AUSD_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_USDsui_COINTYPE, NORMALIZED_eEARN_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_stratSUI_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_xBTC_COINTYPE, isSui, } from "@suilend/sui-fe";
|
|
14
|
-
import { LENDING_MARKET_ID, LENDING_MARKET_TYPE, } from "../client";
|
|
15
|
-
import { Side } from "./types";
|
|
14
|
+
import { LENDING_MARKET_ID, LENDING_MARKET_TYPE, } from "../client.js";
|
|
15
|
+
import { Side } from "./types.js";
|
|
16
16
|
export const STRATEGY_WRAPPER_PACKAGE_ID_V1 = "0xba97dc73a07638d03d77ad2161484eb21db577edc9cadcd7035fef4b4f2f6fa1";
|
|
17
17
|
const STRATEGY_WRAPPER_PACKAGE_ID_V7 = "0x864b66441e95323c320ee7584592769930a2d236b45d731011ee7a98eb785b35";
|
|
18
18
|
export var StrategyType;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sdk","version":"3.0.
|
|
1
|
+
{"name":"@suilend/sdk","version":"3.0.5","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","./mmt":"./mmt.js","./strategies":"./strategies.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers/obligation":"./parsers/obligation.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./swap/transaction":"./swap/transaction.js","./swap/quote":"./swap/quote.js","./swap":"./swap/index.js","./utils/simulate":"./utils/simulate.js","./utils/events":"./utils/events.js","./utils/obligation":"./utils/obligation.js","./utils":"./utils/index.js","./lib/constants":"./lib/constants.js","./lib/pythAdapter":"./lib/pythAdapter.js","./lib/transactions":"./lib/transactions.js","./lib/types":"./lib/types.js","./lib/initialize":"./lib/initialize.js","./lib":"./lib/index.js","./lib/liquidityMining":"./lib/liquidityMining.js","./lib/strategyOwnerCap":"./lib/strategyOwnerCap.js","./lib/pyth":"./lib/pyth.js","./api/events":"./api/events.js","./api":"./api/index.js","./margin":"./margin/index.js","./margin/utils":"./margin/utils/index.js","./margin/margin/market":"./margin/margin/market.js","./margin/margin/version":"./margin/margin/version.js","./margin/margin/router":"./margin/margin/router.js","./margin/margin/admin_cap":"./margin/margin/admin_cap.js","./margin/margin/permissions":"./margin/margin/permissions.js","./margin/margin/position":"./margin/margin/position.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/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/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/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/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./margin/margin/deps/sui/vec_set":"./margin/margin/deps/sui/vec_set.js","./margin/margin/deps/std/type_name":"./margin/margin/deps/std/type_name.js","./margin/margin/deps/suilend/lending_market":"./margin/margin/deps/suilend/lending_market.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":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/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/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.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"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc && node ./fix-esm-imports.js","eslint":"eslint --fix src/","prettier":"prettier --write src/","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ./release.js && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/suilend-fe-public.git"},"bugs":{"url":"https://github.com/suilend/suilend-fe-public/issues"},"dependencies":{"@bluefin-exchange/bluefin7k-aggregator-sdk":"^7.3.0","@cetusprotocol/aggregator-sdk":"^1.5.7","@flowx-finance/sdk":"^2.1.0","@suilend/springsui-sdk":"^3.0.4","bignumber.js":"^9.1.2","bn.js":"^5.2.2","crypto-js":"^4.2.0","lodash":"^4.17.21","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"@types/bn.js":"^5.2.0","@types/lodash":"^4.17.20","ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"2.0.1","@mysten/sui":"2.17.0","@suilend/sui-fe":"^3.0.14","@pythnetwork/pyth-sui-js":"2.2.0"},"overrides":{"chalk":"5.3.0","strip-ansi":"7.1.0","color-convert":"2.0.1","color-name":"1.1.4","is-core-module":"2.13.1","error-ex":"1.3.2","has-ansi":"5.0.1","axios":"<=1.11.0"},"type":"module"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeStructTag } from "@mysten/sui/utils";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
|
-
import { WAD } from "../lib/constants";
|
|
3
|
+
import { WAD } from "../lib/constants.js";
|
|
4
4
|
export const parseReserveAssetDataEvent = (event, reserve) => {
|
|
5
5
|
const availableAmount = new BigNumber(event.availableAmount)
|
|
6
6
|
.div(WAD)
|
package/parsers/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./apiReserveAssetDataEvent";
|
|
2
|
-
export * from "./lendingMarket";
|
|
3
|
-
export * from "./obligation";
|
|
4
|
-
export * from "./rateLimiter";
|
|
5
|
-
export * from "./reserve";
|
|
1
|
+
export * from "./apiReserveAssetDataEvent.js";
|
|
2
|
+
export * from "./lendingMarket.js";
|
|
3
|
+
export * from "./obligation.js";
|
|
4
|
+
export * from "./rateLimiter.js";
|
|
5
|
+
export * from "./reserve.js";
|
package/parsers/lendingMarket.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
|
-
import { parseRateLimiter } from "./rateLimiter";
|
|
3
|
-
import { parseReserve } from "./reserve";
|
|
2
|
+
import { parseRateLimiter } from "./rateLimiter.js";
|
|
3
|
+
import { parseReserve } from "./reserve.js";
|
|
4
4
|
export const parseLendingMarket = (lendingMarket, reserves, coinMetadataMap, nowS, lendingMarketMetadata) => {
|
|
5
5
|
var _a, _b, _c;
|
|
6
6
|
const id = lendingMarket.id;
|
package/parsers/obligation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeStructTag } from "@mysten/sui/utils";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
|
-
import { WAD } from "../lib/constants";
|
|
3
|
+
import { WAD } from "../lib/constants.js";
|
|
4
4
|
export const parseObligation = (obligation, parsedReserveMap, isStrategy) => {
|
|
5
5
|
let totalDepositedAmountUsd = new BigNumber(0);
|
|
6
6
|
let totalBorrowedAmountUsd = new BigNumber(0);
|
package/parsers/rateLimiter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
|
-
import { WAD } from "../lib/constants";
|
|
2
|
+
import { WAD } from "../lib/constants.js";
|
|
3
3
|
export const parseRateLimiter = (rateLimiter, nowS) => {
|
|
4
4
|
const config = parseRateLimiterConfig(rateLimiter);
|
|
5
5
|
const $typeName = rateLimiter.$typeName;
|
package/parsers/reserve.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { normalizeStructTag } from "@mysten/sui/utils";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
|
-
import { WAD } from "../lib/constants";
|
|
5
|
-
import { toHexString } from "../utils";
|
|
6
|
-
import * as simulate from "../utils/simulate";
|
|
4
|
+
import { WAD } from "../lib/constants.js";
|
|
5
|
+
import { toHexString } from "../utils/index.js";
|
|
6
|
+
import * as simulate from "../utils/simulate.js";
|
|
7
7
|
export const parseReserve = (reserve, coinMetadataMap) => {
|
|
8
8
|
const config = parseReserveConfig(reserve);
|
|
9
9
|
const $typeName = reserve.$typeName;
|
package/strategies.js
CHANGED
|
@@ -12,14 +12,14 @@ import { Transaction, } from "@mysten/sui/transactions";
|
|
|
12
12
|
import { SUI_DECIMALS } from "@mysten/sui/utils";
|
|
13
13
|
import BigNumber from "bignumber.js";
|
|
14
14
|
import { BN } from "bn.js";
|
|
15
|
-
import
|
|
15
|
+
import cloneDeep from "lodash/cloneDeep.js";
|
|
16
16
|
import { LstClient, SPRING_SUI_UPGRADE_CAP_ID, getLatestPackageId as getLatestSpringSuiPackageId, } from "@suilend/springsui-sdk";
|
|
17
17
|
import { API_URL, MAX_U64, MS_PER_YEAR, NORMALIZED_AUSD_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_xBTC_COINTYPE, getSpendableCoin, isSui, } from "@suilend/sui-fe";
|
|
18
|
-
import { getNetAprPercent } from "./lib";
|
|
19
|
-
import { getRewardsMap } from "./lib/liquidityMining";
|
|
20
|
-
import { STRATEGY_TYPE_INFO_MAP, StrategyType, strategyBorrow, strategyClaimRewardsAndMergeCoins, strategyDeposit, strategyWithdraw, } from "./lib/strategyOwnerCap";
|
|
21
|
-
import { MMT_CONTRACT_PACKAGE_ID, MMT_VERSION_OBJECT_ID } from "./mmt";
|
|
22
|
-
import { getWeightedBorrowsUsd } from "./utils";
|
|
18
|
+
import { getNetAprPercent } from "./lib/index.js";
|
|
19
|
+
import { getRewardsMap } from "./lib/liquidityMining.js";
|
|
20
|
+
import { STRATEGY_TYPE_INFO_MAP, StrategyType, strategyBorrow, strategyClaimRewardsAndMergeCoins, strategyDeposit, strategyWithdraw, } from "./lib/strategyOwnerCap.js";
|
|
21
|
+
import { MMT_CONTRACT_PACKAGE_ID, MMT_VERSION_OBJECT_ID } from "./mmt.js";
|
|
22
|
+
import { getWeightedBorrowsUsd } from "./utils/index.js";
|
|
23
23
|
export const STRATEGY_E = 10 ** -7;
|
|
24
24
|
export const LST_DECIMALS = 9;
|
|
25
25
|
export var StrategyFlashLoanProvider;
|
package/swap/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./quote";
|
|
2
|
-
export * from "./transaction";
|
|
1
|
+
export * from "./quote.js";
|
|
2
|
+
export * from "./transaction.js";
|
package/swap/transaction.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { BluefinXTx, buildTx as buildBluefin7kTransaction, } from "@bluefin-exchange/bluefin7k-aggregator-sdk";
|
|
11
11
|
import { Coin as FlowXCoin, Commission as FlowXCommission, CommissionType as FlowXCommissionType, TradeBuilder as FlowXTradeBuilder, } from "@flowx-finance/sdk";
|
|
12
12
|
import { getSpendableCoin } from "@suilend/sui-fe";
|
|
13
|
-
import { QuoteProvider } from "./quote";
|
|
13
|
+
import { QuoteProvider } from "./quote.js";
|
|
14
14
|
const getSwapTransactionWrapper = (provider, getSwapTransaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
console.log(`[getSwapTransactionWrapper] fetching transaction for ${provider} quote`);
|
|
16
16
|
try {
|
package/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
|
-
export * from "./events";
|
|
3
|
-
export * from "./obligation";
|
|
4
|
-
export * from "./simulate";
|
|
2
|
+
export * from "./events.js";
|
|
3
|
+
export * from "./obligation.js";
|
|
4
|
+
export * from "./simulate.js";
|
|
5
5
|
export const toHexString = (bytes) => Array.from(bytes, function (byte) {
|
|
6
6
|
return ("0" + (byte & 0xff).toString(16)).slice(-2);
|
|
7
7
|
}).join("");
|
package/utils/obligation.js
CHANGED
|
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { normalizeSuiAddress } from "@mysten/sui/utils";
|
|
11
11
|
import { BigNumber } from "bignumber.js";
|
|
12
12
|
import pLimit from "p-limit";
|
|
13
|
-
import { phantom } from "../_generated/_framework/reified";
|
|
14
|
-
import { PACKAGE_ID } from "../_generated/suilend";
|
|
15
|
-
import { Obligation } from "../_generated/suilend/obligation/structs";
|
|
13
|
+
import { phantom } from "../_generated/_framework/reified.js";
|
|
14
|
+
import { PACKAGE_ID } from "../_generated/suilend/index.js";
|
|
15
|
+
import { Obligation } from "../_generated/suilend/obligation/structs.js";
|
|
16
16
|
const NORMALIZED_PACKAGE_ID = normalizeSuiAddress(PACKAGE_ID);
|
|
17
17
|
export function fetchAllObligationsForMarketWithHandler(suiGrpcClient, lendingMarketId, lendingMarketType, chunkHandler) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
package/utils/simulate.js
CHANGED
|
@@ -11,10 +11,10 @@ import { bcs } from "@mysten/sui/bcs";
|
|
|
11
11
|
import { toHex } from "@mysten/sui/utils";
|
|
12
12
|
import BigNumber from "bignumber.js";
|
|
13
13
|
import { v4 as uuidv4 } from "uuid";
|
|
14
|
-
import { Decimal } from "../_generated/suilend/decimal/structs";
|
|
15
|
-
import { UserReward, } from "../_generated/suilend/liquidity-mining/structs";
|
|
16
|
-
import { WAD } from "../lib/constants";
|
|
17
|
-
import { linearlyInterpolate } from "../utils";
|
|
14
|
+
import { Decimal } from "../_generated/suilend/decimal/structs.js";
|
|
15
|
+
import { UserReward, } from "../_generated/suilend/liquidity-mining/structs.js";
|
|
16
|
+
import { WAD } from "../lib/constants.js";
|
|
17
|
+
import { linearlyInterpolate } from "../utils/index.js";
|
|
18
18
|
/**
|
|
19
19
|
* @deprecated since version 1.0.8. Use `calculateUtilizationPercent` instead.
|
|
20
20
|
*/
|