@suilend/sdk 3.0.8 → 5.0.0
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.d.ts +4 -4
- package/_generated/_dependencies/source/0x1/ascii/structs.js +42 -41
- package/_generated/_dependencies/source/0x1/option/structs.js +22 -26
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x1/type-name/structs.js +21 -25
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +5 -5
- package/_generated/_dependencies/source/0x2/bag/structs.js +22 -25
- package/_generated/_dependencies/source/0x2/balance/structs.d.ts +4 -4
- package/_generated/_dependencies/source/0x2/balance/structs.js +42 -41
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +5 -5
- package/_generated/_dependencies/source/0x2/object/structs.js +42 -41
- package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +5 -5
- package/_generated/_dependencies/source/0x2/object-table/structs.js +22 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +22 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +9 -9
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +24 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +21 -21
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +23 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +2 -2
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +21 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +52 -52
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +45 -41
- package/_generated/_framework/vector.js +9 -6
- package/_generated/suilend/cell/structs.d.ts +1 -1
- package/_generated/suilend/cell/structs.js +21 -25
- package/_generated/suilend/decimal/structs.d.ts +2 -2
- package/_generated/suilend/decimal/structs.js +21 -25
- package/_generated/suilend/lending-market/structs.d.ts +129 -129
- package/_generated/suilend/lending-market/structs.js +391 -265
- package/_generated/suilend/liquidity-mining/structs.d.ts +44 -44
- package/_generated/suilend/liquidity-mining/structs.js +122 -89
- package/_generated/suilend/obligation/structs.d.ts +98 -98
- package/_generated/suilend/obligation/structs.js +194 -121
- package/_generated/suilend/rate-limiter/structs.d.ts +12 -12
- package/_generated/suilend/rate-limiter/structs.js +46 -41
- package/_generated/suilend/reserve/structs.d.ts +128 -128
- package/_generated/suilend/reserve/structs.js +243 -153
- package/_generated/suilend/reserve-config/structs.d.ts +30 -30
- package/_generated/suilend/reserve-config/structs.js +60 -41
- package/api/events.js +5 -14
- package/client.js +267 -319
- package/lib/initialize.d.ts +85 -3
- package/lib/initialize.js +119 -52
- package/lib/liquidityMining.js +15 -19
- package/lib/pyth.d.ts +16 -0
- package/lib/pyth.js +30 -15
- package/lib/pythAdapter.js +96 -112
- package/lib/strategyOwnerCap.js +8 -17
- package/margin/margin/admin_cap.d.ts +2 -2
- package/margin/margin/deps/std/type_name.d.ts +1 -1
- package/margin/margin/deps/suilend/lending_market.d.ts +2 -2
- package/margin/margin/market.d.ts +11 -11
- package/margin/margin/market.js +22 -22
- package/margin/margin/permissions.js +14 -14
- package/margin/margin/position.d.ts +47 -47
- package/margin/margin/position.js +10 -10
- package/margin/margin/router.d.ts +5 -5
- package/margin/margin/router.js +16 -16
- package/margin/margin/version.d.ts +1 -1
- package/margin/utils/index.js +22 -36
- package/package.json +1 -1
- package/parsers/apiReserveAssetDataEvent.js +4 -1
- package/parsers/lendingMarket.js +3 -4
- package/parsers/reserve.js +4 -1
- package/strategies.js +188 -204
- package/swap/quote.d.ts +1 -1
- package/swap/quote.js +28 -39
- package/swap/transaction.js +17 -26
- package/utils/events.js +20 -32
- package/utils/obligation.js +111 -135
- package/utils/simulate.d.ts +68 -1
- package/utils/simulate.js +149 -31
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import * as reified from "../../_framework/reified.js";
|
|
11
2
|
import { TypeName } from "../../_dependencies/source/0x1/type-name/structs.js";
|
|
12
3
|
import { ID, UID } from "../../_dependencies/source/0x2/object/structs.js";
|
|
@@ -23,10 +14,21 @@ export function isBorrow(type) {
|
|
|
23
14
|
return type === `${PKG_V1}::obligation::Borrow`;
|
|
24
15
|
}
|
|
25
16
|
export class Borrow {
|
|
17
|
+
__StructClass = true;
|
|
18
|
+
static $typeName = `${PKG_V1}::obligation::Borrow`;
|
|
19
|
+
static $numTypeParams = 0;
|
|
20
|
+
static $isPhantom = [];
|
|
21
|
+
$typeName = Borrow.$typeName;
|
|
22
|
+
$fullTypeName;
|
|
23
|
+
$typeArgs;
|
|
24
|
+
$isPhantom = Borrow.$isPhantom;
|
|
25
|
+
coinType;
|
|
26
|
+
reserveArrayIndex;
|
|
27
|
+
borrowedAmount;
|
|
28
|
+
cumulativeBorrowRate;
|
|
29
|
+
marketValue;
|
|
30
|
+
userRewardManagerIndex;
|
|
26
31
|
constructor(typeArgs, fields) {
|
|
27
|
-
this.__StructClass = true;
|
|
28
|
-
this.$typeName = Borrow.$typeName;
|
|
29
|
-
this.$isPhantom = Borrow.$isPhantom;
|
|
30
32
|
this.$fullTypeName = composeSuiType(Borrow.$typeName, ...typeArgs);
|
|
31
33
|
this.$typeArgs = typeArgs;
|
|
32
34
|
this.coinType = fields.coinType;
|
|
@@ -49,7 +51,7 @@ export class Borrow {
|
|
|
49
51
|
bcs: Borrow.bcs,
|
|
50
52
|
fromJSONField: (field) => Borrow.fromJSONField(field),
|
|
51
53
|
fromJSON: (json) => Borrow.fromJSON(json),
|
|
52
|
-
fetch: (client, id) =>
|
|
54
|
+
fetch: async (client, id) => Borrow.fetch(client, id),
|
|
53
55
|
new: (fields) => {
|
|
54
56
|
return new Borrow([], fields);
|
|
55
57
|
},
|
|
@@ -112,7 +114,11 @@ export class Borrow {
|
|
|
112
114
|
};
|
|
113
115
|
}
|
|
114
116
|
toJSON() {
|
|
115
|
-
return
|
|
117
|
+
return {
|
|
118
|
+
$typeName: this.$typeName,
|
|
119
|
+
$typeArgs: this.$typeArgs,
|
|
120
|
+
...this.toJSONField(),
|
|
121
|
+
};
|
|
116
122
|
}
|
|
117
123
|
static fromJSONField(field) {
|
|
118
124
|
return Borrow.reified().new({
|
|
@@ -130,29 +136,35 @@ export class Borrow {
|
|
|
130
136
|
}
|
|
131
137
|
return Borrow.fromJSONField(json);
|
|
132
138
|
}
|
|
133
|
-
static fetch(client, id) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return Borrow.fromBcs(object.content);
|
|
140
|
-
});
|
|
139
|
+
static async fetch(client, id) {
|
|
140
|
+
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
141
|
+
if (!isBorrow(object.type)) {
|
|
142
|
+
throw new Error(`object at id ${id} is not a Borrow object`);
|
|
143
|
+
}
|
|
144
|
+
return Borrow.fromBcs(object.content);
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
|
-
Borrow.$typeName = `${PKG_V1}::obligation::Borrow`;
|
|
144
|
-
Borrow.$numTypeParams = 0;
|
|
145
|
-
Borrow.$isPhantom = [];
|
|
146
147
|
/* ============================== BorrowRecord =============================== */
|
|
147
148
|
export function isBorrowRecord(type) {
|
|
148
149
|
type = compressSuiType(type);
|
|
149
150
|
return type === `${PKG_V1}::obligation::BorrowRecord`;
|
|
150
151
|
}
|
|
151
152
|
export class BorrowRecord {
|
|
153
|
+
__StructClass = true;
|
|
154
|
+
static $typeName = `${PKG_V1}::obligation::BorrowRecord`;
|
|
155
|
+
static $numTypeParams = 0;
|
|
156
|
+
static $isPhantom = [];
|
|
157
|
+
$typeName = BorrowRecord.$typeName;
|
|
158
|
+
$fullTypeName;
|
|
159
|
+
$typeArgs;
|
|
160
|
+
$isPhantom = BorrowRecord.$isPhantom;
|
|
161
|
+
coinType;
|
|
162
|
+
reserveArrayIndex;
|
|
163
|
+
borrowedAmount;
|
|
164
|
+
cumulativeBorrowRate;
|
|
165
|
+
marketValue;
|
|
166
|
+
userRewardManagerIndex;
|
|
152
167
|
constructor(typeArgs, fields) {
|
|
153
|
-
this.__StructClass = true;
|
|
154
|
-
this.$typeName = BorrowRecord.$typeName;
|
|
155
|
-
this.$isPhantom = BorrowRecord.$isPhantom;
|
|
156
168
|
this.$fullTypeName = composeSuiType(BorrowRecord.$typeName, ...typeArgs);
|
|
157
169
|
this.$typeArgs = typeArgs;
|
|
158
170
|
this.coinType = fields.coinType;
|
|
@@ -175,7 +187,7 @@ export class BorrowRecord {
|
|
|
175
187
|
bcs: BorrowRecord.bcs,
|
|
176
188
|
fromJSONField: (field) => BorrowRecord.fromJSONField(field),
|
|
177
189
|
fromJSON: (json) => BorrowRecord.fromJSON(json),
|
|
178
|
-
fetch: (client, id) =>
|
|
190
|
+
fetch: async (client, id) => BorrowRecord.fetch(client, id),
|
|
179
191
|
new: (fields) => {
|
|
180
192
|
return new BorrowRecord([], fields);
|
|
181
193
|
},
|
|
@@ -238,7 +250,11 @@ export class BorrowRecord {
|
|
|
238
250
|
};
|
|
239
251
|
}
|
|
240
252
|
toJSON() {
|
|
241
|
-
return
|
|
253
|
+
return {
|
|
254
|
+
$typeName: this.$typeName,
|
|
255
|
+
$typeArgs: this.$typeArgs,
|
|
256
|
+
...this.toJSONField(),
|
|
257
|
+
};
|
|
242
258
|
}
|
|
243
259
|
static fromJSONField(field) {
|
|
244
260
|
return BorrowRecord.reified().new({
|
|
@@ -256,29 +272,35 @@ export class BorrowRecord {
|
|
|
256
272
|
}
|
|
257
273
|
return BorrowRecord.fromJSONField(json);
|
|
258
274
|
}
|
|
259
|
-
static fetch(client, id) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return BorrowRecord.fromBcs(object.content);
|
|
266
|
-
});
|
|
275
|
+
static async fetch(client, id) {
|
|
276
|
+
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
277
|
+
if (!isBorrowRecord(object.type)) {
|
|
278
|
+
throw new Error(`object at id ${id} is not a BorrowRecord object`);
|
|
279
|
+
}
|
|
280
|
+
return BorrowRecord.fromBcs(object.content);
|
|
267
281
|
}
|
|
268
282
|
}
|
|
269
|
-
BorrowRecord.$typeName = `${PKG_V1}::obligation::BorrowRecord`;
|
|
270
|
-
BorrowRecord.$numTypeParams = 0;
|
|
271
|
-
BorrowRecord.$isPhantom = [];
|
|
272
283
|
/* ============================== Deposit =============================== */
|
|
273
284
|
export function isDeposit(type) {
|
|
274
285
|
type = compressSuiType(type);
|
|
275
286
|
return type === `${PKG_V1}::obligation::Deposit`;
|
|
276
287
|
}
|
|
277
288
|
export class Deposit {
|
|
289
|
+
__StructClass = true;
|
|
290
|
+
static $typeName = `${PKG_V1}::obligation::Deposit`;
|
|
291
|
+
static $numTypeParams = 0;
|
|
292
|
+
static $isPhantom = [];
|
|
293
|
+
$typeName = Deposit.$typeName;
|
|
294
|
+
$fullTypeName;
|
|
295
|
+
$typeArgs;
|
|
296
|
+
$isPhantom = Deposit.$isPhantom;
|
|
297
|
+
coinType;
|
|
298
|
+
reserveArrayIndex;
|
|
299
|
+
depositedCtokenAmount;
|
|
300
|
+
marketValue;
|
|
301
|
+
userRewardManagerIndex;
|
|
302
|
+
attributedBorrowValue;
|
|
278
303
|
constructor(typeArgs, fields) {
|
|
279
|
-
this.__StructClass = true;
|
|
280
|
-
this.$typeName = Deposit.$typeName;
|
|
281
|
-
this.$isPhantom = Deposit.$isPhantom;
|
|
282
304
|
this.$fullTypeName = composeSuiType(Deposit.$typeName, ...typeArgs);
|
|
283
305
|
this.$typeArgs = typeArgs;
|
|
284
306
|
this.coinType = fields.coinType;
|
|
@@ -301,7 +323,7 @@ export class Deposit {
|
|
|
301
323
|
bcs: Deposit.bcs,
|
|
302
324
|
fromJSONField: (field) => Deposit.fromJSONField(field),
|
|
303
325
|
fromJSON: (json) => Deposit.fromJSON(json),
|
|
304
|
-
fetch: (client, id) =>
|
|
326
|
+
fetch: async (client, id) => Deposit.fetch(client, id),
|
|
305
327
|
new: (fields) => {
|
|
306
328
|
return new Deposit([], fields);
|
|
307
329
|
},
|
|
@@ -364,7 +386,11 @@ export class Deposit {
|
|
|
364
386
|
};
|
|
365
387
|
}
|
|
366
388
|
toJSON() {
|
|
367
|
-
return
|
|
389
|
+
return {
|
|
390
|
+
$typeName: this.$typeName,
|
|
391
|
+
$typeArgs: this.$typeArgs,
|
|
392
|
+
...this.toJSONField(),
|
|
393
|
+
};
|
|
368
394
|
}
|
|
369
395
|
static fromJSONField(field) {
|
|
370
396
|
return Deposit.reified().new({
|
|
@@ -382,29 +408,35 @@ export class Deposit {
|
|
|
382
408
|
}
|
|
383
409
|
return Deposit.fromJSONField(json);
|
|
384
410
|
}
|
|
385
|
-
static fetch(client, id) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
return Deposit.fromBcs(object.content);
|
|
392
|
-
});
|
|
411
|
+
static async fetch(client, id) {
|
|
412
|
+
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
413
|
+
if (!isDeposit(object.type)) {
|
|
414
|
+
throw new Error(`object at id ${id} is not a Deposit object`);
|
|
415
|
+
}
|
|
416
|
+
return Deposit.fromBcs(object.content);
|
|
393
417
|
}
|
|
394
418
|
}
|
|
395
|
-
Deposit.$typeName = `${PKG_V1}::obligation::Deposit`;
|
|
396
|
-
Deposit.$numTypeParams = 0;
|
|
397
|
-
Deposit.$isPhantom = [];
|
|
398
419
|
/* ============================== DepositRecord =============================== */
|
|
399
420
|
export function isDepositRecord(type) {
|
|
400
421
|
type = compressSuiType(type);
|
|
401
422
|
return type === `${PKG_V1}::obligation::DepositRecord`;
|
|
402
423
|
}
|
|
403
424
|
export class DepositRecord {
|
|
425
|
+
__StructClass = true;
|
|
426
|
+
static $typeName = `${PKG_V1}::obligation::DepositRecord`;
|
|
427
|
+
static $numTypeParams = 0;
|
|
428
|
+
static $isPhantom = [];
|
|
429
|
+
$typeName = DepositRecord.$typeName;
|
|
430
|
+
$fullTypeName;
|
|
431
|
+
$typeArgs;
|
|
432
|
+
$isPhantom = DepositRecord.$isPhantom;
|
|
433
|
+
coinType;
|
|
434
|
+
reserveArrayIndex;
|
|
435
|
+
depositedCtokenAmount;
|
|
436
|
+
marketValue;
|
|
437
|
+
userRewardManagerIndex;
|
|
438
|
+
attributedBorrowValue;
|
|
404
439
|
constructor(typeArgs, fields) {
|
|
405
|
-
this.__StructClass = true;
|
|
406
|
-
this.$typeName = DepositRecord.$typeName;
|
|
407
|
-
this.$isPhantom = DepositRecord.$isPhantom;
|
|
408
440
|
this.$fullTypeName = composeSuiType(DepositRecord.$typeName, ...typeArgs);
|
|
409
441
|
this.$typeArgs = typeArgs;
|
|
410
442
|
this.coinType = fields.coinType;
|
|
@@ -427,7 +459,7 @@ export class DepositRecord {
|
|
|
427
459
|
bcs: DepositRecord.bcs,
|
|
428
460
|
fromJSONField: (field) => DepositRecord.fromJSONField(field),
|
|
429
461
|
fromJSON: (json) => DepositRecord.fromJSON(json),
|
|
430
|
-
fetch: (client, id) =>
|
|
462
|
+
fetch: async (client, id) => DepositRecord.fetch(client, id),
|
|
431
463
|
new: (fields) => {
|
|
432
464
|
return new DepositRecord([], fields);
|
|
433
465
|
},
|
|
@@ -490,7 +522,11 @@ export class DepositRecord {
|
|
|
490
522
|
};
|
|
491
523
|
}
|
|
492
524
|
toJSON() {
|
|
493
|
-
return
|
|
525
|
+
return {
|
|
526
|
+
$typeName: this.$typeName,
|
|
527
|
+
$typeArgs: this.$typeArgs,
|
|
528
|
+
...this.toJSONField(),
|
|
529
|
+
};
|
|
494
530
|
}
|
|
495
531
|
static fromJSONField(field) {
|
|
496
532
|
return DepositRecord.reified().new({
|
|
@@ -508,29 +544,30 @@ export class DepositRecord {
|
|
|
508
544
|
}
|
|
509
545
|
return DepositRecord.fromJSONField(json);
|
|
510
546
|
}
|
|
511
|
-
static fetch(client, id) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
return DepositRecord.fromBcs(object.content);
|
|
518
|
-
});
|
|
547
|
+
static async fetch(client, id) {
|
|
548
|
+
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
549
|
+
if (!isDepositRecord(object.type)) {
|
|
550
|
+
throw new Error(`object at id ${id} is not a DepositRecord object`);
|
|
551
|
+
}
|
|
552
|
+
return DepositRecord.fromBcs(object.content);
|
|
519
553
|
}
|
|
520
554
|
}
|
|
521
|
-
DepositRecord.$typeName = `${PKG_V1}::obligation::DepositRecord`;
|
|
522
|
-
DepositRecord.$numTypeParams = 0;
|
|
523
|
-
DepositRecord.$isPhantom = [];
|
|
524
555
|
/* ============================== ExistStaleOracles =============================== */
|
|
525
556
|
export function isExistStaleOracles(type) {
|
|
526
557
|
type = compressSuiType(type);
|
|
527
558
|
return type === `${PKG_V11}::obligation::ExistStaleOracles`;
|
|
528
559
|
}
|
|
529
560
|
export class ExistStaleOracles {
|
|
561
|
+
__StructClass = true;
|
|
562
|
+
static $typeName = `${PKG_V11}::obligation::ExistStaleOracles`;
|
|
563
|
+
static $numTypeParams = 0;
|
|
564
|
+
static $isPhantom = [];
|
|
565
|
+
$typeName = ExistStaleOracles.$typeName;
|
|
566
|
+
$fullTypeName;
|
|
567
|
+
$typeArgs;
|
|
568
|
+
$isPhantom = ExistStaleOracles.$isPhantom;
|
|
569
|
+
dummyField;
|
|
530
570
|
constructor(typeArgs, fields) {
|
|
531
|
-
this.__StructClass = true;
|
|
532
|
-
this.$typeName = ExistStaleOracles.$typeName;
|
|
533
|
-
this.$isPhantom = ExistStaleOracles.$isPhantom;
|
|
534
571
|
this.$fullTypeName = composeSuiType(ExistStaleOracles.$typeName, ...typeArgs);
|
|
535
572
|
this.$typeArgs = typeArgs;
|
|
536
573
|
this.dummyField = fields.dummyField;
|
|
@@ -548,7 +585,7 @@ export class ExistStaleOracles {
|
|
|
548
585
|
bcs: ExistStaleOracles.bcs,
|
|
549
586
|
fromJSONField: (field) => ExistStaleOracles.fromJSONField(field),
|
|
550
587
|
fromJSON: (json) => ExistStaleOracles.fromJSON(json),
|
|
551
|
-
fetch: (client, id) =>
|
|
588
|
+
fetch: async (client, id) => ExistStaleOracles.fetch(client, id),
|
|
552
589
|
new: (fields) => {
|
|
553
590
|
return new ExistStaleOracles([], fields);
|
|
554
591
|
},
|
|
@@ -591,7 +628,11 @@ export class ExistStaleOracles {
|
|
|
591
628
|
};
|
|
592
629
|
}
|
|
593
630
|
toJSON() {
|
|
594
|
-
return
|
|
631
|
+
return {
|
|
632
|
+
$typeName: this.$typeName,
|
|
633
|
+
$typeArgs: this.$typeArgs,
|
|
634
|
+
...this.toJSONField(),
|
|
635
|
+
};
|
|
595
636
|
}
|
|
596
637
|
static fromJSONField(field) {
|
|
597
638
|
return ExistStaleOracles.reified().new({
|
|
@@ -604,29 +645,44 @@ export class ExistStaleOracles {
|
|
|
604
645
|
}
|
|
605
646
|
return ExistStaleOracles.fromJSONField(json);
|
|
606
647
|
}
|
|
607
|
-
static fetch(client, id) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
return ExistStaleOracles.fromBcs(object.content);
|
|
614
|
-
});
|
|
648
|
+
static async fetch(client, id) {
|
|
649
|
+
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
650
|
+
if (!isExistStaleOracles(object.type)) {
|
|
651
|
+
throw new Error(`object at id ${id} is not a ExistStaleOracles object`);
|
|
652
|
+
}
|
|
653
|
+
return ExistStaleOracles.fromBcs(object.content);
|
|
615
654
|
}
|
|
616
655
|
}
|
|
617
|
-
ExistStaleOracles.$typeName = `${PKG_V11}::obligation::ExistStaleOracles`;
|
|
618
|
-
ExistStaleOracles.$numTypeParams = 0;
|
|
619
|
-
ExistStaleOracles.$isPhantom = [];
|
|
620
656
|
/* ============================== Obligation =============================== */
|
|
621
657
|
export function isObligation(type) {
|
|
622
658
|
type = compressSuiType(type);
|
|
623
659
|
return type.startsWith(`${PKG_V1}::obligation::Obligation` + "<");
|
|
624
660
|
}
|
|
625
661
|
export class Obligation {
|
|
662
|
+
__StructClass = true;
|
|
663
|
+
static $typeName = `${PKG_V1}::obligation::Obligation`;
|
|
664
|
+
static $numTypeParams = 1;
|
|
665
|
+
static $isPhantom = [true];
|
|
666
|
+
$typeName = Obligation.$typeName;
|
|
667
|
+
$fullTypeName;
|
|
668
|
+
$typeArgs;
|
|
669
|
+
$isPhantom = Obligation.$isPhantom;
|
|
670
|
+
id;
|
|
671
|
+
lendingMarketId;
|
|
672
|
+
deposits;
|
|
673
|
+
borrows;
|
|
674
|
+
depositedValueUsd;
|
|
675
|
+
allowedBorrowValueUsd;
|
|
676
|
+
unhealthyBorrowValueUsd;
|
|
677
|
+
superUnhealthyBorrowValueUsd;
|
|
678
|
+
unweightedBorrowedValueUsd;
|
|
679
|
+
weightedBorrowedValueUsd;
|
|
680
|
+
weightedBorrowedValueUpperBoundUsd;
|
|
681
|
+
borrowingIsolatedAsset;
|
|
682
|
+
userRewardManagers;
|
|
683
|
+
badDebtUsd;
|
|
684
|
+
closable;
|
|
626
685
|
constructor(typeArgs, fields) {
|
|
627
|
-
this.__StructClass = true;
|
|
628
|
-
this.$typeName = Obligation.$typeName;
|
|
629
|
-
this.$isPhantom = Obligation.$isPhantom;
|
|
630
686
|
this.$fullTypeName = composeSuiType(Obligation.$typeName, ...typeArgs);
|
|
631
687
|
this.$typeArgs = typeArgs;
|
|
632
688
|
this.id = fields.id;
|
|
@@ -659,7 +715,7 @@ export class Obligation {
|
|
|
659
715
|
bcs: Obligation.bcs,
|
|
660
716
|
fromJSONField: (field) => Obligation.fromJSONField(P, field),
|
|
661
717
|
fromJSON: (json) => Obligation.fromJSON(P, json),
|
|
662
|
-
fetch: (client, id) =>
|
|
718
|
+
fetch: async (client, id) => Obligation.fetch(client, P, id),
|
|
663
719
|
new: (fields) => {
|
|
664
720
|
return new Obligation([extractType(P)], fields);
|
|
665
721
|
},
|
|
@@ -759,7 +815,11 @@ export class Obligation {
|
|
|
759
815
|
};
|
|
760
816
|
}
|
|
761
817
|
toJSON() {
|
|
762
|
-
return
|
|
818
|
+
return {
|
|
819
|
+
$typeName: this.$typeName,
|
|
820
|
+
$typeArgs: this.$typeArgs,
|
|
821
|
+
...this.toJSONField(),
|
|
822
|
+
};
|
|
763
823
|
}
|
|
764
824
|
static fromJSONField(typeArg, field) {
|
|
765
825
|
return Obligation.reified(typeArg).new({
|
|
@@ -787,29 +847,43 @@ export class Obligation {
|
|
|
787
847
|
assertReifiedTypeArgsMatch(composeSuiType(Obligation.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
788
848
|
return Obligation.fromJSONField(typeArg, json);
|
|
789
849
|
}
|
|
790
|
-
static fetch(client, typeArg, id) {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return Obligation.fromBcs(typeArg, object.content);
|
|
797
|
-
});
|
|
850
|
+
static async fetch(client, typeArg, id) {
|
|
851
|
+
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
852
|
+
if (!isObligation(object.type)) {
|
|
853
|
+
throw new Error(`object at id ${id} is not a Obligation object`);
|
|
854
|
+
}
|
|
855
|
+
return Obligation.fromBcs(typeArg, object.content);
|
|
798
856
|
}
|
|
799
857
|
}
|
|
800
|
-
Obligation.$typeName = `${PKG_V1}::obligation::Obligation`;
|
|
801
|
-
Obligation.$numTypeParams = 1;
|
|
802
|
-
Obligation.$isPhantom = [true];
|
|
803
858
|
/* ============================== ObligationDataEvent =============================== */
|
|
804
859
|
export function isObligationDataEvent(type) {
|
|
805
860
|
type = compressSuiType(type);
|
|
806
861
|
return type === `${PKG_V1}::obligation::ObligationDataEvent`;
|
|
807
862
|
}
|
|
808
863
|
export class ObligationDataEvent {
|
|
864
|
+
__StructClass = true;
|
|
865
|
+
static $typeName = `${PKG_V1}::obligation::ObligationDataEvent`;
|
|
866
|
+
static $numTypeParams = 0;
|
|
867
|
+
static $isPhantom = [];
|
|
868
|
+
$typeName = ObligationDataEvent.$typeName;
|
|
869
|
+
$fullTypeName;
|
|
870
|
+
$typeArgs;
|
|
871
|
+
$isPhantom = ObligationDataEvent.$isPhantom;
|
|
872
|
+
lendingMarketId;
|
|
873
|
+
obligationId;
|
|
874
|
+
deposits;
|
|
875
|
+
borrows;
|
|
876
|
+
depositedValueUsd;
|
|
877
|
+
allowedBorrowValueUsd;
|
|
878
|
+
unhealthyBorrowValueUsd;
|
|
879
|
+
superUnhealthyBorrowValueUsd;
|
|
880
|
+
unweightedBorrowedValueUsd;
|
|
881
|
+
weightedBorrowedValueUsd;
|
|
882
|
+
weightedBorrowedValueUpperBoundUsd;
|
|
883
|
+
borrowingIsolatedAsset;
|
|
884
|
+
badDebtUsd;
|
|
885
|
+
closable;
|
|
809
886
|
constructor(typeArgs, fields) {
|
|
810
|
-
this.__StructClass = true;
|
|
811
|
-
this.$typeName = ObligationDataEvent.$typeName;
|
|
812
|
-
this.$isPhantom = ObligationDataEvent.$isPhantom;
|
|
813
887
|
this.$fullTypeName = composeSuiType(ObligationDataEvent.$typeName, ...typeArgs);
|
|
814
888
|
this.$typeArgs = typeArgs;
|
|
815
889
|
this.lendingMarketId = fields.lendingMarketId;
|
|
@@ -841,7 +915,7 @@ export class ObligationDataEvent {
|
|
|
841
915
|
bcs: ObligationDataEvent.bcs,
|
|
842
916
|
fromJSONField: (field) => ObligationDataEvent.fromJSONField(field),
|
|
843
917
|
fromJSON: (json) => ObligationDataEvent.fromJSON(json),
|
|
844
|
-
fetch: (client, id) =>
|
|
918
|
+
fetch: async (client, id) => ObligationDataEvent.fetch(client, id),
|
|
845
919
|
new: (fields) => {
|
|
846
920
|
return new ObligationDataEvent([], fields);
|
|
847
921
|
},
|
|
@@ -946,7 +1020,11 @@ export class ObligationDataEvent {
|
|
|
946
1020
|
};
|
|
947
1021
|
}
|
|
948
1022
|
toJSON() {
|
|
949
|
-
return
|
|
1023
|
+
return {
|
|
1024
|
+
$typeName: this.$typeName,
|
|
1025
|
+
$typeArgs: this.$typeArgs,
|
|
1026
|
+
...this.toJSONField(),
|
|
1027
|
+
};
|
|
950
1028
|
}
|
|
951
1029
|
static fromJSONField(field) {
|
|
952
1030
|
return ObligationDataEvent.reified().new({
|
|
@@ -972,16 +1050,11 @@ export class ObligationDataEvent {
|
|
|
972
1050
|
}
|
|
973
1051
|
return ObligationDataEvent.fromJSONField(json);
|
|
974
1052
|
}
|
|
975
|
-
static fetch(client, id) {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
return ObligationDataEvent.fromBcs(object.content);
|
|
982
|
-
});
|
|
1053
|
+
static async fetch(client, id) {
|
|
1054
|
+
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
1055
|
+
if (!isObligationDataEvent(object.type)) {
|
|
1056
|
+
throw new Error(`object at id ${id} is not a ObligationDataEvent object`);
|
|
1057
|
+
}
|
|
1058
|
+
return ObligationDataEvent.fromBcs(object.content);
|
|
983
1059
|
}
|
|
984
1060
|
}
|
|
985
|
-
ObligationDataEvent.$typeName = `${PKG_V1}::obligation::ObligationDataEvent`;
|
|
986
|
-
ObligationDataEvent.$numTypeParams = 0;
|
|
987
|
-
ObligationDataEvent.$isPhantom = [];
|
|
@@ -29,17 +29,17 @@ export declare class RateLimiter implements StructClass {
|
|
|
29
29
|
static get r(): import("../../_framework/reified").StructClassReified<RateLimiter, RateLimiterFields>;
|
|
30
30
|
static phantom(): PhantomReified<ToTypeStr<RateLimiter>>;
|
|
31
31
|
static get p(): PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::rate_limiter::RateLimiter" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::rate_limiter::RateLimiter">;
|
|
32
|
-
static get bcs(): import("@mysten/
|
|
33
|
-
config: import("@mysten/
|
|
34
|
-
window_duration: import("@mysten/
|
|
35
|
-
max_outflow: import("@mysten/
|
|
32
|
+
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
33
|
+
config: import("@mysten/bcs").BcsStruct<{
|
|
34
|
+
window_duration: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
35
|
+
max_outflow: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
36
36
|
}, string>;
|
|
37
|
-
prev_qty: import("@mysten/
|
|
38
|
-
value: import("@mysten/
|
|
37
|
+
prev_qty: import("@mysten/bcs").BcsStruct<{
|
|
38
|
+
value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
39
39
|
}, string>;
|
|
40
|
-
window_start: import("@mysten/
|
|
41
|
-
cur_qty: import("@mysten/
|
|
42
|
-
value: import("@mysten/
|
|
40
|
+
window_start: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
41
|
+
cur_qty: import("@mysten/bcs").BcsStruct<{
|
|
42
|
+
value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
43
43
|
}, string>;
|
|
44
44
|
}, string>;
|
|
45
45
|
static fromFields(fields: Record<string, any>): RateLimiter;
|
|
@@ -99,9 +99,9 @@ export declare class RateLimiterConfig implements StructClass {
|
|
|
99
99
|
static get r(): import("../../_framework/reified").StructClassReified<RateLimiterConfig, RateLimiterConfigFields>;
|
|
100
100
|
static phantom(): PhantomReified<ToTypeStr<RateLimiterConfig>>;
|
|
101
101
|
static get p(): PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::rate_limiter::RateLimiterConfig" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::rate_limiter::RateLimiterConfig">;
|
|
102
|
-
static get bcs(): import("@mysten/
|
|
103
|
-
window_duration: import("@mysten/
|
|
104
|
-
max_outflow: import("@mysten/
|
|
102
|
+
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
103
|
+
window_duration: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
104
|
+
max_outflow: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
105
105
|
}, string>;
|
|
106
106
|
static fromFields(fields: Record<string, any>): RateLimiterConfig;
|
|
107
107
|
static fromFieldsWithTypes(item: FieldsWithTypes): RateLimiterConfig;
|