@suilend/sdk 3.0.2 → 3.0.4
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/client.js +19 -37
- package/lib/initialize.js +4 -10
- package/lib/pythAdapter.d.ts +1 -2
- package/lib/pythAdapter.js +72 -16
- package/margin/margin/admin_cap.d.ts +1 -4
- package/margin/margin/admin_cap.js +15 -9
- package/margin/margin/deps/std/type_name.d.ts +9 -10
- package/margin/margin/deps/std/type_name.js +17 -14
- package/margin/margin/deps/sui/vec_set.d.ts +3 -5
- package/margin/margin/deps/sui/vec_set.js +9 -6
- package/margin/margin/deps/suilend/lending_market.d.ts +1 -4
- package/margin/margin/deps/suilend/lending_market.js +9 -6
- package/margin/margin/market.d.ts +22 -67
- package/margin/margin/market.js +86 -108
- package/margin/margin/permissions.d.ts +9 -16
- package/margin/margin/permissions.js +29 -29
- package/margin/margin/position.d.ts +12 -35
- package/margin/margin/position.js +84 -67
- package/margin/margin/router.d.ts +10 -50
- package/margin/margin/router.js +102 -71
- package/margin/margin/version.d.ts +1 -4
- package/margin/margin/version.js +7 -4
- package/margin/utils/index.d.ts +9 -9
- package/margin/utils/index.js +32 -29
- package/package.json +1 -1
- package/strategies.js +95 -36
- package/swap/transaction.js +4 -13
- package/utils/obligation.js +36 -27
package/client.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
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
|
-
import { extractCTokenCoinType, getAllCoins,
|
|
12
|
+
import { extractCTokenCoinType, getAllCoins, getSpendableCoin, } from "@suilend/sui-fe";
|
|
13
13
|
import { PriceInfoObject } from "./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs";
|
|
14
14
|
import { phantom } from "./_generated/_framework/reified";
|
|
15
15
|
import { PKG_V10, setPublishedAt } from "./_generated/suilend";
|
|
@@ -86,7 +86,7 @@ export class SuilendClient {
|
|
|
86
86
|
}
|
|
87
87
|
static getFeeReceivers(suiGrpcClient, lendingMarketId) {
|
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
var _a, _b
|
|
89
|
+
var _a, _b;
|
|
90
90
|
const { dynamicField } = yield suiGrpcClient.getDynamicField({
|
|
91
91
|
parentId: lendingMarketId,
|
|
92
92
|
name: {
|
|
@@ -94,9 +94,13 @@ export class SuilendClient {
|
|
|
94
94
|
bcs: new Uint8Array([0]),
|
|
95
95
|
},
|
|
96
96
|
});
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const { object } = yield suiGrpcClient.getObject({
|
|
98
|
+
objectId: dynamicField.fieldId,
|
|
99
|
+
include: { json: true },
|
|
100
|
+
});
|
|
101
|
+
const json = object.json;
|
|
102
|
+
const receivers = (_a = json === null || json === void 0 ? void 0 : json.value) === null || _a === void 0 ? void 0 : _a.receivers;
|
|
103
|
+
const weights = (_b = json === null || json === void 0 ? void 0 : json.value) === null || _b === void 0 ? void 0 : _b.weights;
|
|
100
104
|
return { receivers, weights };
|
|
101
105
|
});
|
|
102
106
|
}
|
|
@@ -104,7 +108,7 @@ export class SuilendClient {
|
|
|
104
108
|
const [ownerCap, lendingMarket] = createLendingMarket(transaction, lendingMarketType, transaction.object(registryId));
|
|
105
109
|
transaction.moveCall({
|
|
106
110
|
target: `0x2::transfer::public_share_object`,
|
|
107
|
-
typeArguments: [`${LendingMarket.$typeName}<${lendingMarketType}
|
|
111
|
+
typeArguments: [`${LendingMarket.$typeName}<${lendingMarketType}>`],
|
|
108
112
|
arguments: [lendingMarket],
|
|
109
113
|
});
|
|
110
114
|
return ownerCap;
|
|
@@ -188,16 +192,7 @@ export class SuilendClient {
|
|
|
188
192
|
}
|
|
189
193
|
addReward(ownerId_1, lendingMarketOwnerCapId_1, reserveArrayIndex_1, isDepositReward_1, rewardCoinType_1, rewardValue_1, startTimeMs_1, endTimeMs_1, transaction_1) {
|
|
190
194
|
return __awaiter(this, arguments, void 0, function* (ownerId, lendingMarketOwnerCapId, reserveArrayIndex, isDepositReward, rewardCoinType, rewardValue, startTimeMs, endTimeMs, transaction, mergeCoins = true) {
|
|
191
|
-
const
|
|
192
|
-
owner: ownerId,
|
|
193
|
-
coinType: rewardCoinType,
|
|
194
|
-
})).objects;
|
|
195
|
-
if (coins.length > 1 && !isSui(rewardCoinType) && mergeCoins) {
|
|
196
|
-
transaction.mergeCoins(transaction.object(coins[0].objectId), coins.map((c) => transaction.object(c.objectId)).slice(1));
|
|
197
|
-
}
|
|
198
|
-
const [rewardCoin] = transaction.splitCoins(isSui(rewardCoinType)
|
|
199
|
-
? transaction.gas
|
|
200
|
-
: transaction.object(coins[0].objectId), [rewardValue]);
|
|
195
|
+
const rewardCoin = yield getSpendableCoin(this.suiGrpcClient, ownerId, rewardCoinType, rewardValue, transaction, mergeCoins);
|
|
201
196
|
return addPoolReward(transaction, [this.lendingMarket.$typeArgs[0], rewardCoinType], {
|
|
202
197
|
lendingMarketOwnerCap: transaction.object(lendingMarketOwnerCapId),
|
|
203
198
|
lendingMarket: transaction.object(this.lendingMarket.id),
|
|
@@ -421,21 +416,13 @@ export class SuilendClient {
|
|
|
421
416
|
}
|
|
422
417
|
depositIntoObligation(ownerId, coinType, value, transaction, obligationOwnerCap) {
|
|
423
418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
424
|
-
const
|
|
425
|
-
const mergeCoin = mergeAllCoins(coinType, transaction, coins);
|
|
426
|
-
const [sendCoin] = transaction.splitCoins(isSui(coinType)
|
|
427
|
-
? transaction.gas
|
|
428
|
-
: transaction.object(mergeCoin.objectId), [value]);
|
|
419
|
+
const sendCoin = yield getSpendableCoin(this.suiGrpcClient, ownerId, coinType, value, transaction);
|
|
429
420
|
this.deposit(sendCoin, coinType, obligationOwnerCap, transaction);
|
|
430
421
|
});
|
|
431
422
|
}
|
|
432
423
|
depositLiquidityAndGetCTokens(ownerId, coinType, value, transaction) {
|
|
433
424
|
return __awaiter(this, void 0, void 0, function* () {
|
|
434
|
-
const
|
|
435
|
-
const mergeCoin = mergeAllCoins(coinType, transaction, coins);
|
|
436
|
-
const [sendCoin] = transaction.splitCoins(isSui(coinType)
|
|
437
|
-
? transaction.gas
|
|
438
|
-
: transaction.object(mergeCoin.objectId), [value]);
|
|
425
|
+
const sendCoin = yield getSpendableCoin(this.suiGrpcClient, ownerId, coinType, value, transaction);
|
|
439
426
|
const [ctokens] = depositLiquidityAndMintCtokens(transaction, [this.lendingMarket.$typeArgs[0], coinType], {
|
|
440
427
|
lendingMarket: transaction.object(this.lendingMarket.id),
|
|
441
428
|
reserveArrayIndex: transaction.pure.u64(this.findReserveArrayIndex(coinType)),
|
|
@@ -545,11 +532,7 @@ export class SuilendClient {
|
|
|
545
532
|
}
|
|
546
533
|
repayIntoObligation(ownerId, obligationId, coinType, value, transaction) {
|
|
547
534
|
return __awaiter(this, void 0, void 0, function* () {
|
|
548
|
-
const
|
|
549
|
-
const mergeCoin = mergeAllCoins(coinType, transaction, coins);
|
|
550
|
-
const [sendCoin] = transaction.splitCoins(isSui(coinType)
|
|
551
|
-
? transaction.gas
|
|
552
|
-
: transaction.object(mergeCoin.objectId), [value]);
|
|
535
|
+
const sendCoin = yield getSpendableCoin(this.suiGrpcClient, ownerId, coinType, value, transaction);
|
|
553
536
|
const result = this.repay(obligationId, coinType, sendCoin, transaction);
|
|
554
537
|
transaction.transferObjects([sendCoin], transaction.pure.address(ownerId));
|
|
555
538
|
return result;
|
|
@@ -604,13 +587,12 @@ export class SuilendClient {
|
|
|
604
587
|
}
|
|
605
588
|
redeemCtokensAndWithdrawLiquidity(ownerId, ctokenCoinTypes, transaction) {
|
|
606
589
|
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
-
const mergeCoinMap = {};
|
|
608
590
|
for (const ctokenCoinType of ctokenCoinTypes) {
|
|
609
591
|
const coins = yield getAllCoins(this.suiGrpcClient, ownerId, ctokenCoinType);
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
592
|
+
const totalBalance = coins.reduce((sum, c) => sum + BigInt(c.balance), BigInt(0));
|
|
593
|
+
if (totalBalance === BigInt(0))
|
|
594
|
+
throw new Error(`No ${ctokenCoinType} coins found for redeem`);
|
|
595
|
+
const ctokenCoin = yield getSpendableCoin(this.suiGrpcClient, ownerId, ctokenCoinType, totalBalance.toString(), transaction);
|
|
614
596
|
const coinType = extractCTokenCoinType(ctokenCoinType);
|
|
615
597
|
const [exemption] = transaction.moveCall({
|
|
616
598
|
target: `0x1::option::none`,
|
|
@@ -619,7 +601,7 @@ export class SuilendClient {
|
|
|
619
601
|
],
|
|
620
602
|
arguments: [],
|
|
621
603
|
});
|
|
622
|
-
const [redeemCoin] = this.redeem(
|
|
604
|
+
const [redeemCoin] = this.redeem(ctokenCoin, coinType, exemption, transaction);
|
|
623
605
|
transaction.transferObjects([redeemCoin], transaction.pure.address(ownerId));
|
|
624
606
|
}
|
|
625
607
|
});
|
package/lib/initialize.js
CHANGED
|
@@ -236,18 +236,12 @@ export const initializeObligations = (suiGrpcClient, suilendClient, refreshedRaw
|
|
|
236
236
|
if (!hasStrategies)
|
|
237
237
|
return [];
|
|
238
238
|
const objects = yield getAllOwnedObjects(suiGrpcClient, address, `${STRATEGY_WRAPPER_PACKAGE_ID_V1}::strategy_wrapper::StrategyOwnerCap<${suilendClient.lendingMarket.$typeArgs[0]}>`);
|
|
239
|
-
|
|
240
|
-
objectIds: objects.map((o) => o.objectId),
|
|
241
|
-
include: { json: true },
|
|
242
|
-
});
|
|
243
|
-
return objectsWithJson.objects
|
|
244
|
-
.filter((obj) => !(obj instanceof Error))
|
|
245
|
-
.map((obj) => {
|
|
239
|
+
return objects.map((obj) => {
|
|
246
240
|
const json = obj.json;
|
|
247
|
-
const id = json.id
|
|
241
|
+
const id = json.id;
|
|
248
242
|
const strategyType = json.strategy_type;
|
|
249
|
-
const obligationOwnerCapId = json.inner_cap.
|
|
250
|
-
const obligationId = json.inner_cap.
|
|
243
|
+
const obligationOwnerCapId = json.inner_cap.id;
|
|
244
|
+
const obligationId = json.inner_cap.obligation_id;
|
|
251
245
|
const result = {
|
|
252
246
|
id,
|
|
253
247
|
strategyType: `${strategyType}`,
|
package/lib/pythAdapter.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
2
2
|
/**
|
|
3
3
|
* Adapter that wraps SuiGrpcClient to provide the legacy SuiClient (JSON-RPC)
|
|
4
|
-
* interface expected by third-party SDKs like @pythnetwork/pyth-sui-js
|
|
5
|
-
* @flowx-finance/sdk.
|
|
4
|
+
* interface expected by third-party SDKs like @pythnetwork/pyth-sui-js.
|
|
6
5
|
*
|
|
7
6
|
* Maps old JSON-RPC method signatures to the new gRPC equivalents.
|
|
8
7
|
*/
|
package/lib/pythAdapter.js
CHANGED
|
@@ -7,10 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
|
|
11
|
+
const PYTH_PRICE_TABLE_ID = "0x234c9ffca44613ab87a2711325b6e17bad9ece0449b917c8bd9c0ad7a0506cc2";
|
|
12
|
+
const PYTH_PACKAGE = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e";
|
|
10
13
|
/**
|
|
11
14
|
* Adapter that wraps SuiGrpcClient to provide the legacy SuiClient (JSON-RPC)
|
|
12
|
-
* interface expected by third-party SDKs like @pythnetwork/pyth-sui-js
|
|
13
|
-
* @flowx-finance/sdk.
|
|
15
|
+
* interface expected by third-party SDKs like @pythnetwork/pyth-sui-js.
|
|
14
16
|
*
|
|
15
17
|
* Maps old JSON-RPC method signatures to the new gRPC equivalents.
|
|
16
18
|
*/
|
|
@@ -57,7 +59,24 @@ export function createJsonRpcAdapter(suiGrpcClient) {
|
|
|
57
59
|
},
|
|
58
60
|
getDynamicFieldObject(_a) {
|
|
59
61
|
return __awaiter(this, arguments, void 0, function* ({ parentId, name, }) {
|
|
60
|
-
var _b, _c
|
|
62
|
+
var _b, _c;
|
|
63
|
+
// The gRPC node may not have dynamic field wrapper objects indexed.
|
|
64
|
+
// For known lookups (Pyth price table), use hardcoded values.
|
|
65
|
+
if (parentId === PYTH_STATE_ID &&
|
|
66
|
+
name.type === "vector<u8>" &&
|
|
67
|
+
name.value === "price_info") {
|
|
68
|
+
return {
|
|
69
|
+
data: {
|
|
70
|
+
objectId: PYTH_PRICE_TABLE_ID,
|
|
71
|
+
type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
|
|
72
|
+
content: {
|
|
73
|
+
dataType: "moveObject",
|
|
74
|
+
fields: null,
|
|
75
|
+
type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
61
80
|
const { dynamicField } = yield suiGrpcClient.getDynamicField({
|
|
62
81
|
parentId,
|
|
63
82
|
name: {
|
|
@@ -65,24 +84,61 @@ export function createJsonRpcAdapter(suiGrpcClient) {
|
|
|
65
84
|
bcs: dynamicField_encodeName(name),
|
|
66
85
|
},
|
|
67
86
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
if (dynamicField.$kind === "DynamicObject" && dynamicField.childId) {
|
|
88
|
+
try {
|
|
89
|
+
const childObject = yield suiGrpcClient
|
|
90
|
+
.getObject({
|
|
91
|
+
objectId: dynamicField.childId,
|
|
92
|
+
include: { json: true },
|
|
93
|
+
})
|
|
94
|
+
.then((r) => r.object);
|
|
95
|
+
return {
|
|
96
|
+
data: {
|
|
97
|
+
objectId: childObject.objectId,
|
|
98
|
+
type: childObject.type,
|
|
99
|
+
content: {
|
|
100
|
+
dataType: "moveObject",
|
|
101
|
+
fields: childObject.json,
|
|
102
|
+
type: childObject.type,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (_d) {
|
|
108
|
+
return {
|
|
109
|
+
data: {
|
|
110
|
+
objectId: dynamicField.childId,
|
|
111
|
+
type: dynamicField.valueType,
|
|
112
|
+
content: {
|
|
113
|
+
dataType: "moveObject",
|
|
114
|
+
fields: null,
|
|
115
|
+
type: dynamicField.valueType,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const valueBcs = (_b = dynamicField.value) === null || _b === void 0 ? void 0 : _b.bcs;
|
|
122
|
+
const type = (_c = dynamicField.valueType) !== null && _c !== void 0 ? _c : dynamicField.type;
|
|
123
|
+
let fields = null;
|
|
124
|
+
if (valueBcs && valueBcs.length > 0) {
|
|
125
|
+
if (type === "0x2::object::ID" ||
|
|
126
|
+
type.endsWith("::object::ID") ||
|
|
127
|
+
valueBcs.length === 32) {
|
|
128
|
+
const id = "0x" +
|
|
129
|
+
Array.from(valueBcs)
|
|
130
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
131
|
+
.join("");
|
|
132
|
+
fields = { value: id };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
79
135
|
return {
|
|
80
136
|
data: {
|
|
81
|
-
objectId:
|
|
137
|
+
objectId: dynamicField.fieldId,
|
|
82
138
|
type,
|
|
83
139
|
content: {
|
|
84
140
|
dataType: "moveObject",
|
|
85
|
-
fields
|
|
141
|
+
fields,
|
|
86
142
|
type,
|
|
87
143
|
},
|
|
88
144
|
},
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import { MoveStruct } from '../utils/index.js';
|
|
1
|
+
import { MoveStruct } from "../utils/index.js";
|
|
5
2
|
export declare const AdminCap: MoveStruct<{
|
|
6
3
|
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
7
4
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap::AdminCap">;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const $moduleName =
|
|
7
|
-
export const AdminCap = new MoveStruct({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
5
|
+
import { MoveStruct } from "../utils/index.js";
|
|
6
|
+
const $moduleName = "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap";
|
|
7
|
+
export const AdminCap = new MoveStruct({
|
|
8
|
+
name: `${$moduleName}::AdminCap`,
|
|
9
|
+
fields: {
|
|
10
|
+
id: bcs.Address,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export const InitEvent = new MoveStruct({
|
|
14
|
+
name: `${$moduleName}::InitEvent`,
|
|
15
|
+
fields: {
|
|
16
|
+
admin_cap_id: bcs.Address,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
|
|
5
|
-
import { MoveStruct } from '../../../utils/index.js';
|
|
4
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
5
|
export declare const TypeName: MoveStruct<{
|
|
7
6
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
* String representation of the type. All types are represented using their source
|
|
8
|
+
* syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
|
|
9
|
+
* Struct types are represented as fully qualified type names; e.g.
|
|
10
|
+
* `00000000000000000000000000000001::string::String` or
|
|
11
|
+
* `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
|
|
12
|
+
* Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
|
|
13
|
+
* 32 depending on the Move platform)
|
|
14
|
+
*/
|
|
16
15
|
name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
17
16
|
}, "std::type_name::TypeName">;
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
4
|
/** Functionality for converting Move types into values. Use with care! */
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
const $moduleName =
|
|
8
|
-
export const TypeName = new MoveStruct({
|
|
5
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
6
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
7
|
+
const $moduleName = "std::type_name";
|
|
8
|
+
export const TypeName = new MoveStruct({
|
|
9
|
+
name: `${$moduleName}::TypeName`,
|
|
10
|
+
fields: {
|
|
9
11
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
name: bcs.string()
|
|
19
|
-
}
|
|
12
|
+
* String representation of the type. All types are represented using their source
|
|
13
|
+
* syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
|
|
14
|
+
* Struct types are represented as fully qualified type names; e.g.
|
|
15
|
+
* `00000000000000000000000000000001::string::String` or
|
|
16
|
+
* `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
|
|
17
|
+
* Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
|
|
18
|
+
* 32 depending on the Move platform)
|
|
19
|
+
*/
|
|
20
|
+
name: bcs.string(),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
import { type BcsType, bcs } from
|
|
5
|
-
import { MoveStruct } from
|
|
4
|
+
import { type BcsType, bcs } from "@mysten/sui/bcs";
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* A set data structure backed by a vector. The set is guaranteed not to contain
|
|
8
8
|
* duplicate keys. All operations are O(N) in the size of the set
|
|
@@ -11,8 +11,6 @@ import { MoveStruct } from '../../../utils/index.js';
|
|
|
11
11
|
* programming against a set API. Sets that need sorted iteration rather than
|
|
12
12
|
* insertion order iteration should be handwritten.
|
|
13
13
|
*/
|
|
14
|
-
export declare function VecSet<K extends BcsType<any>>(...typeParameters: [
|
|
15
|
-
K
|
|
16
|
-
]): MoveStruct<{
|
|
14
|
+
export declare function VecSet<K extends BcsType<any>>(...typeParameters: [K]): MoveStruct<{
|
|
17
15
|
contents: ReturnType<typeof bcs.vector<K>>;
|
|
18
16
|
}>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
import { bcs } from
|
|
5
|
-
import { MoveStruct } from
|
|
6
|
-
const $moduleName =
|
|
4
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
const $moduleName = "0x2::vec_set";
|
|
7
7
|
/**
|
|
8
8
|
* A set data structure backed by a vector. The set is guaranteed not to contain
|
|
9
9
|
* duplicate keys. All operations are O(N) in the size of the set
|
|
@@ -13,7 +13,10 @@ const $moduleName = '0x2::vec_set';
|
|
|
13
13
|
* insertion order iteration should be handwritten.
|
|
14
14
|
*/
|
|
15
15
|
export function VecSet(...typeParameters) {
|
|
16
|
-
return new MoveStruct({
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return new MoveStruct({
|
|
17
|
+
name: `${$moduleName}::VecSet<${typeParameters[0].name}>`,
|
|
18
|
+
fields: {
|
|
19
|
+
contents: bcs.vector(typeParameters[0]),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
19
22
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import { MoveStruct } from '../../../utils/index.js';
|
|
1
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
5
2
|
export declare const ObligationOwnerCap: MoveStruct<{
|
|
6
3
|
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
7
4
|
obligation_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const $moduleName =
|
|
7
|
-
export const ObligationOwnerCap = new MoveStruct({
|
|
4
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
5
|
+
import { MoveStruct } from "../../../utils/index.js";
|
|
6
|
+
const $moduleName = "suilend::lending_market";
|
|
7
|
+
export const ObligationOwnerCap = new MoveStruct({
|
|
8
|
+
name: `${$moduleName}::ObligationOwnerCap<phantom P>`,
|
|
9
|
+
fields: {
|
|
8
10
|
id: bcs.Address,
|
|
9
|
-
obligation_id: bcs.Address
|
|
10
|
-
}
|
|
11
|
+
obligation_id: bcs.Address,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { type
|
|
7
|
-
import * as
|
|
8
|
-
import * as
|
|
4
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
5
|
+
import { type Transaction } from "@mysten/sui/transactions";
|
|
6
|
+
import { MoveStruct, type RawTransactionArgument } from "../utils/index.js";
|
|
7
|
+
import * as vec_set from "./deps/sui/vec_set.js";
|
|
8
|
+
import * as version from "./version.js";
|
|
9
9
|
export declare const Market: MoveStruct<{
|
|
10
10
|
id: typeof bcs.Address;
|
|
11
11
|
version: typeof version.Version;
|
|
@@ -49,13 +49,8 @@ export interface CheckVersionArguments {
|
|
|
49
49
|
}
|
|
50
50
|
export interface CheckVersionOptions {
|
|
51
51
|
package?: string;
|
|
52
|
-
arguments: CheckVersionArguments | [
|
|
53
|
-
|
|
54
|
-
];
|
|
55
|
-
typeArguments: [
|
|
56
|
-
string,
|
|
57
|
-
string
|
|
58
|
-
];
|
|
52
|
+
arguments: CheckVersionArguments | [market: RawTransactionArgument<string>];
|
|
53
|
+
typeArguments: [string, string];
|
|
59
54
|
}
|
|
60
55
|
export declare function checkVersion(options: CheckVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
61
56
|
export interface UpgradeVersionArguments {
|
|
@@ -68,10 +63,7 @@ export interface UpgradeVersionOptions {
|
|
|
68
63
|
_: RawTransactionArgument<string>,
|
|
69
64
|
market: RawTransactionArgument<string>
|
|
70
65
|
];
|
|
71
|
-
typeArguments: [
|
|
72
|
-
string,
|
|
73
|
-
string
|
|
74
|
-
];
|
|
66
|
+
typeArguments: [string, string];
|
|
75
67
|
}
|
|
76
68
|
export declare function upgradeVersion(options: UpgradeVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
77
69
|
export interface CreateMarketArguments {
|
|
@@ -88,10 +80,7 @@ export interface CreateMarketOptions {
|
|
|
88
80
|
openFeeRate: RawTransactionArgument<number | bigint>,
|
|
89
81
|
closeFeeRate: RawTransactionArgument<number | bigint>
|
|
90
82
|
];
|
|
91
|
-
typeArguments: [
|
|
92
|
-
string,
|
|
93
|
-
string
|
|
94
|
-
];
|
|
83
|
+
typeArguments: [string, string];
|
|
95
84
|
}
|
|
96
85
|
export declare function createMarket(options: CreateMarketOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
97
86
|
export interface UpdateMarketPermissionArguments {
|
|
@@ -108,10 +97,7 @@ export interface UpdateMarketPermissionOptions {
|
|
|
108
97
|
permission: RawTransactionArgument<string>,
|
|
109
98
|
pause: RawTransactionArgument<boolean>
|
|
110
99
|
];
|
|
111
|
-
typeArguments: [
|
|
112
|
-
string,
|
|
113
|
-
string
|
|
114
|
-
];
|
|
100
|
+
typeArguments: [string, string];
|
|
115
101
|
}
|
|
116
102
|
/** Update a market permission */
|
|
117
103
|
export declare function updateMarketPermission(options: UpdateMarketPermissionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -129,10 +115,7 @@ export interface SetFeeRateOptions {
|
|
|
129
115
|
openFee: RawTransactionArgument<number | bigint>,
|
|
130
116
|
closeFee: RawTransactionArgument<number | bigint>
|
|
131
117
|
];
|
|
132
|
-
typeArguments: [
|
|
133
|
-
string,
|
|
134
|
-
string
|
|
135
|
-
];
|
|
118
|
+
typeArguments: [string, string];
|
|
136
119
|
}
|
|
137
120
|
/** Set fee rates */
|
|
138
121
|
export declare function setFeeRate(options: SetFeeRateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -148,10 +131,7 @@ export interface SetFeeRecipientOptions {
|
|
|
148
131
|
market: RawTransactionArgument<string>,
|
|
149
132
|
feeRecipient: RawTransactionArgument<string>
|
|
150
133
|
];
|
|
151
|
-
typeArguments: [
|
|
152
|
-
string,
|
|
153
|
-
string
|
|
154
|
-
];
|
|
134
|
+
typeArguments: [string, string];
|
|
155
135
|
}
|
|
156
136
|
/** Set fee recipient address */
|
|
157
137
|
export declare function setFeeRecipient(options: SetFeeRecipientOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -160,13 +140,8 @@ export interface MarketIdArguments {
|
|
|
160
140
|
}
|
|
161
141
|
export interface MarketIdOptions {
|
|
162
142
|
package?: string;
|
|
163
|
-
arguments: MarketIdArguments | [
|
|
164
|
-
|
|
165
|
-
];
|
|
166
|
-
typeArguments: [
|
|
167
|
-
string,
|
|
168
|
-
string
|
|
169
|
-
];
|
|
143
|
+
arguments: MarketIdArguments | [market: RawTransactionArgument<string>];
|
|
144
|
+
typeArguments: [string, string];
|
|
170
145
|
}
|
|
171
146
|
/** Get market ID */
|
|
172
147
|
export declare function marketId(options: MarketIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -175,13 +150,8 @@ export interface OpenFeeRateArguments {
|
|
|
175
150
|
}
|
|
176
151
|
export interface OpenFeeRateOptions {
|
|
177
152
|
package?: string;
|
|
178
|
-
arguments: OpenFeeRateArguments | [
|
|
179
|
-
|
|
180
|
-
];
|
|
181
|
-
typeArguments: [
|
|
182
|
-
string,
|
|
183
|
-
string
|
|
184
|
-
];
|
|
153
|
+
arguments: OpenFeeRateArguments | [market: RawTransactionArgument<string>];
|
|
154
|
+
typeArguments: [string, string];
|
|
185
155
|
}
|
|
186
156
|
/** Get open fee rate */
|
|
187
157
|
export declare function openFeeRate(options: OpenFeeRateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -190,13 +160,8 @@ export interface CloseFeeRateArguments {
|
|
|
190
160
|
}
|
|
191
161
|
export interface CloseFeeRateOptions {
|
|
192
162
|
package?: string;
|
|
193
|
-
arguments: CloseFeeRateArguments | [
|
|
194
|
-
|
|
195
|
-
];
|
|
196
|
-
typeArguments: [
|
|
197
|
-
string,
|
|
198
|
-
string
|
|
199
|
-
];
|
|
163
|
+
arguments: CloseFeeRateArguments | [market: RawTransactionArgument<string>];
|
|
164
|
+
typeArguments: [string, string];
|
|
200
165
|
}
|
|
201
166
|
/** Get close fee rate */
|
|
202
167
|
export declare function closeFeeRate(options: CloseFeeRateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -205,13 +170,8 @@ export interface FeeRecipientArguments {
|
|
|
205
170
|
}
|
|
206
171
|
export interface FeeRecipientOptions {
|
|
207
172
|
package?: string;
|
|
208
|
-
arguments: FeeRecipientArguments | [
|
|
209
|
-
|
|
210
|
-
];
|
|
211
|
-
typeArguments: [
|
|
212
|
-
string,
|
|
213
|
-
string
|
|
214
|
-
];
|
|
173
|
+
arguments: FeeRecipientArguments | [market: RawTransactionArgument<string>];
|
|
174
|
+
typeArguments: [string, string];
|
|
215
175
|
}
|
|
216
176
|
/** Get fee recipient address */
|
|
217
177
|
export declare function feeRecipient(options: FeeRecipientOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -220,12 +180,7 @@ export interface PermissionsArguments {
|
|
|
220
180
|
}
|
|
221
181
|
export interface PermissionsOptions {
|
|
222
182
|
package?: string;
|
|
223
|
-
arguments: PermissionsArguments | [
|
|
224
|
-
|
|
225
|
-
];
|
|
226
|
-
typeArguments: [
|
|
227
|
-
string,
|
|
228
|
-
string
|
|
229
|
-
];
|
|
183
|
+
arguments: PermissionsArguments | [market: RawTransactionArgument<string>];
|
|
184
|
+
typeArguments: [string, string];
|
|
230
185
|
}
|
|
231
186
|
export declare function permissions(options: PermissionsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|