@suilend/sdk 2.0.3 → 3.0.1
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 +7 -11
- package/_generated/_dependencies/source/0x1/ascii/structs.js +6 -63
- package/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -9
- package/_generated/_dependencies/source/0x1/option/structs.js +4 -42
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -7
- package/_generated/_dependencies/source/0x1/type-name/structs.js +3 -32
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -9
- package/_generated/_dependencies/source/0x2/bag/structs.js +3 -31
- package/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -11
- package/_generated/_dependencies/source/0x2/balance/structs.js +7 -82
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -12
- package/_generated/_dependencies/source/0x2/object/structs.js +7 -61
- package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +7 -9
- package/_generated/_dependencies/source/0x2/object-table/structs.js +4 -44
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +5 -7
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +3 -31
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +11 -13
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +3 -32
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +23 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +3 -32
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +4 -6
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +3 -33
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +55 -59
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +6 -64
- package/_generated/_framework/reified.d.ts +2 -4
- package/_generated/_framework/vector.d.ts +2 -12
- package/_generated/suilend/cell/structs.d.ts +4 -10
- package/_generated/suilend/cell/structs.js +4 -42
- package/_generated/suilend/decimal/structs.d.ts +4 -6
- package/_generated/suilend/decimal/structs.js +3 -32
- package/_generated/suilend/lending-market/structs.d.ts +152 -392
- package/_generated/suilend/lending-market/structs.js +50 -548
- package/_generated/suilend/liquidity-mining/structs.d.ts +50 -158
- package/_generated/suilend/liquidity-mining/structs.js +16 -169
- package/_generated/suilend/obligation/structs.d.ts +108 -148
- package/_generated/suilend/obligation/structs.js +23 -232
- package/_generated/suilend/rate-limiter/structs.d.ts +15 -19
- package/_generated/suilend/rate-limiter/structs.js +6 -64
- package/_generated/suilend/reserve/structs.d.ts +138 -362
- package/_generated/suilend/reserve/structs.js +29 -327
- package/_generated/suilend/reserve-config/structs.d.ts +33 -37
- package/_generated/suilend/reserve-config/structs.js +6 -65
- package/client.d.ts +8 -8
- package/client.js +55 -88
- package/lib/initialize.d.ts +29 -28
- package/lib/initialize.js +16 -12
- package/lib/liquidityMining.d.ts +3 -3
- package/lib/pythAdapter.d.ts +9 -0
- package/lib/pythAdapter.js +121 -0
- package/lib/strategyOwnerCap.d.ts +12 -7
- package/lib/strategyOwnerCap.js +159 -156
- package/margin/margin/admin_cap.d.ts +2 -2
- package/margin/margin/deps/std/type_name.d.ts +1 -1
- package/margin/margin/deps/sui/vec_set.d.ts +3 -5
- package/margin/margin/deps/suilend/lending_market.d.ts +2 -2
- package/margin/margin/market.d.ts +21 -38
- package/margin/margin/position.d.ts +47 -47
- package/margin/margin/router.d.ts +5 -5
- package/margin/margin/version.d.ts +1 -1
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +6 -6
- package/parsers/obligation.d.ts +8 -8
- package/parsers/reserve.d.ts +8 -8
- package/strategies.d.ts +38 -21
- package/strategies.js +239 -79
- package/swap/quote.d.ts +1 -9
- package/swap/quote.js +1 -52
- package/swap/transaction.d.ts +2 -4
- package/swap/transaction.js +9 -25
- package/utils/events.d.ts +6 -5
- package/utils/events.js +11 -8
- package/utils/obligation.d.ts +6 -5
- package/utils/obligation.js +118 -117
|
@@ -12,14 +12,14 @@ import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
|
|
|
12
12
|
import { ObjectTable } from "../../_dependencies/source/0x2/object-table/structs";
|
|
13
13
|
import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
|
|
14
14
|
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified";
|
|
15
|
-
import { composeSuiType, compressSuiType,
|
|
15
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
16
16
|
import { Decimal } from "../decimal/structs";
|
|
17
17
|
import { PKG_V1, PKG_V10 } from "../index";
|
|
18
18
|
import { Obligation } from "../obligation/structs";
|
|
19
19
|
import { RateLimiter } from "../rate-limiter/structs";
|
|
20
20
|
import { Reserve } from "../reserve/structs";
|
|
21
21
|
import { bcs } from "@mysten/sui/bcs";
|
|
22
|
-
import {
|
|
22
|
+
import { fromHex, toHex } from "@mysten/sui/utils";
|
|
23
23
|
/* ============================== MintEvent =============================== */
|
|
24
24
|
export function isMintEvent(type) {
|
|
25
25
|
type = compressSuiType(type);
|
|
@@ -51,8 +51,6 @@ export class MintEvent {
|
|
|
51
51
|
bcs: MintEvent.bcs,
|
|
52
52
|
fromJSONField: (field) => MintEvent.fromJSONField(field),
|
|
53
53
|
fromJSON: (json) => MintEvent.fromJSON(json),
|
|
54
|
-
fromSuiParsedData: (content) => MintEvent.fromSuiParsedData(content),
|
|
55
|
-
fromSuiObjectData: (content) => MintEvent.fromSuiObjectData(content),
|
|
56
54
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return MintEvent.fetch(client, id); }),
|
|
57
55
|
new: (fields) => {
|
|
58
56
|
return new MintEvent([], fields);
|
|
@@ -139,39 +137,13 @@ export class MintEvent {
|
|
|
139
137
|
}
|
|
140
138
|
return MintEvent.fromJSONField(json);
|
|
141
139
|
}
|
|
142
|
-
static fromSuiParsedData(content) {
|
|
143
|
-
if (content.dataType !== "moveObject") {
|
|
144
|
-
throw new Error("not an object");
|
|
145
|
-
}
|
|
146
|
-
if (!isMintEvent(content.type)) {
|
|
147
|
-
throw new Error(`object at ${content.fields.id} is not a MintEvent object`);
|
|
148
|
-
}
|
|
149
|
-
return MintEvent.fromFieldsWithTypes(content);
|
|
150
|
-
}
|
|
151
|
-
static fromSuiObjectData(data) {
|
|
152
|
-
if (data.bcs) {
|
|
153
|
-
if (data.bcs.dataType !== "moveObject" || !isMintEvent(data.bcs.type)) {
|
|
154
|
-
throw new Error(`object at is not a MintEvent object`);
|
|
155
|
-
}
|
|
156
|
-
return MintEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
157
|
-
}
|
|
158
|
-
if (data.content) {
|
|
159
|
-
return MintEvent.fromSuiParsedData(data.content);
|
|
160
|
-
}
|
|
161
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
162
|
-
}
|
|
163
140
|
static fetch(client, id) {
|
|
164
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (res.error) {
|
|
168
|
-
throw new Error(`error fetching MintEvent object at id ${id}: ${res.error.code}`);
|
|
169
|
-
}
|
|
170
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
171
|
-
!isMintEvent(res.data.bcs.type)) {
|
|
142
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
143
|
+
if (!isMintEvent(object.type)) {
|
|
172
144
|
throw new Error(`object at id ${id} is not a MintEvent object`);
|
|
173
145
|
}
|
|
174
|
-
return MintEvent.
|
|
146
|
+
return MintEvent.fromBcs(object.content);
|
|
175
147
|
});
|
|
176
148
|
}
|
|
177
149
|
}
|
|
@@ -209,8 +181,6 @@ export class RedeemEvent {
|
|
|
209
181
|
bcs: RedeemEvent.bcs,
|
|
210
182
|
fromJSONField: (field) => RedeemEvent.fromJSONField(field),
|
|
211
183
|
fromJSON: (json) => RedeemEvent.fromJSON(json),
|
|
212
|
-
fromSuiParsedData: (content) => RedeemEvent.fromSuiParsedData(content),
|
|
213
|
-
fromSuiObjectData: (content) => RedeemEvent.fromSuiObjectData(content),
|
|
214
184
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RedeemEvent.fetch(client, id); }),
|
|
215
185
|
new: (fields) => {
|
|
216
186
|
return new RedeemEvent([], fields);
|
|
@@ -297,39 +267,13 @@ export class RedeemEvent {
|
|
|
297
267
|
}
|
|
298
268
|
return RedeemEvent.fromJSONField(json);
|
|
299
269
|
}
|
|
300
|
-
static fromSuiParsedData(content) {
|
|
301
|
-
if (content.dataType !== "moveObject") {
|
|
302
|
-
throw new Error("not an object");
|
|
303
|
-
}
|
|
304
|
-
if (!isRedeemEvent(content.type)) {
|
|
305
|
-
throw new Error(`object at ${content.fields.id} is not a RedeemEvent object`);
|
|
306
|
-
}
|
|
307
|
-
return RedeemEvent.fromFieldsWithTypes(content);
|
|
308
|
-
}
|
|
309
|
-
static fromSuiObjectData(data) {
|
|
310
|
-
if (data.bcs) {
|
|
311
|
-
if (data.bcs.dataType !== "moveObject" || !isRedeemEvent(data.bcs.type)) {
|
|
312
|
-
throw new Error(`object at is not a RedeemEvent object`);
|
|
313
|
-
}
|
|
314
|
-
return RedeemEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
315
|
-
}
|
|
316
|
-
if (data.content) {
|
|
317
|
-
return RedeemEvent.fromSuiParsedData(data.content);
|
|
318
|
-
}
|
|
319
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
320
|
-
}
|
|
321
270
|
static fetch(client, id) {
|
|
322
271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (res.error) {
|
|
326
|
-
throw new Error(`error fetching RedeemEvent object at id ${id}: ${res.error.code}`);
|
|
327
|
-
}
|
|
328
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
329
|
-
!isRedeemEvent(res.data.bcs.type)) {
|
|
272
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
273
|
+
if (!isRedeemEvent(object.type)) {
|
|
330
274
|
throw new Error(`object at id ${id} is not a RedeemEvent object`);
|
|
331
275
|
}
|
|
332
|
-
return RedeemEvent.
|
|
276
|
+
return RedeemEvent.fromBcs(object.content);
|
|
333
277
|
});
|
|
334
278
|
}
|
|
335
279
|
}
|
|
@@ -368,8 +312,6 @@ export class BorrowEvent {
|
|
|
368
312
|
bcs: BorrowEvent.bcs,
|
|
369
313
|
fromJSONField: (field) => BorrowEvent.fromJSONField(field),
|
|
370
314
|
fromJSON: (json) => BorrowEvent.fromJSON(json),
|
|
371
|
-
fromSuiParsedData: (content) => BorrowEvent.fromSuiParsedData(content),
|
|
372
|
-
fromSuiObjectData: (content) => BorrowEvent.fromSuiObjectData(content),
|
|
373
315
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return BorrowEvent.fetch(client, id); }),
|
|
374
316
|
new: (fields) => {
|
|
375
317
|
return new BorrowEvent([], fields);
|
|
@@ -466,39 +408,13 @@ export class BorrowEvent {
|
|
|
466
408
|
}
|
|
467
409
|
return BorrowEvent.fromJSONField(json);
|
|
468
410
|
}
|
|
469
|
-
static fromSuiParsedData(content) {
|
|
470
|
-
if (content.dataType !== "moveObject") {
|
|
471
|
-
throw new Error("not an object");
|
|
472
|
-
}
|
|
473
|
-
if (!isBorrowEvent(content.type)) {
|
|
474
|
-
throw new Error(`object at ${content.fields.id} is not a BorrowEvent object`);
|
|
475
|
-
}
|
|
476
|
-
return BorrowEvent.fromFieldsWithTypes(content);
|
|
477
|
-
}
|
|
478
|
-
static fromSuiObjectData(data) {
|
|
479
|
-
if (data.bcs) {
|
|
480
|
-
if (data.bcs.dataType !== "moveObject" || !isBorrowEvent(data.bcs.type)) {
|
|
481
|
-
throw new Error(`object at is not a BorrowEvent object`);
|
|
482
|
-
}
|
|
483
|
-
return BorrowEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
484
|
-
}
|
|
485
|
-
if (data.content) {
|
|
486
|
-
return BorrowEvent.fromSuiParsedData(data.content);
|
|
487
|
-
}
|
|
488
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
489
|
-
}
|
|
490
411
|
static fetch(client, id) {
|
|
491
412
|
return __awaiter(this, void 0, void 0, function* () {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
if (res.error) {
|
|
495
|
-
throw new Error(`error fetching BorrowEvent object at id ${id}: ${res.error.code}`);
|
|
496
|
-
}
|
|
497
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
498
|
-
!isBorrowEvent(res.data.bcs.type)) {
|
|
413
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
414
|
+
if (!isBorrowEvent(object.type)) {
|
|
499
415
|
throw new Error(`object at id ${id} is not a BorrowEvent object`);
|
|
500
416
|
}
|
|
501
|
-
return BorrowEvent.
|
|
417
|
+
return BorrowEvent.fromBcs(object.content);
|
|
502
418
|
});
|
|
503
419
|
}
|
|
504
420
|
}
|
|
@@ -538,8 +454,6 @@ export class ClaimRewardEvent {
|
|
|
538
454
|
bcs: ClaimRewardEvent.bcs,
|
|
539
455
|
fromJSONField: (field) => ClaimRewardEvent.fromJSONField(field),
|
|
540
456
|
fromJSON: (json) => ClaimRewardEvent.fromJSON(json),
|
|
541
|
-
fromSuiParsedData: (content) => ClaimRewardEvent.fromSuiParsedData(content),
|
|
542
|
-
fromSuiObjectData: (content) => ClaimRewardEvent.fromSuiObjectData(content),
|
|
543
457
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ClaimRewardEvent.fetch(client, id); }),
|
|
544
458
|
new: (fields) => {
|
|
545
459
|
return new ClaimRewardEvent([], fields);
|
|
@@ -646,40 +560,13 @@ export class ClaimRewardEvent {
|
|
|
646
560
|
}
|
|
647
561
|
return ClaimRewardEvent.fromJSONField(json);
|
|
648
562
|
}
|
|
649
|
-
static fromSuiParsedData(content) {
|
|
650
|
-
if (content.dataType !== "moveObject") {
|
|
651
|
-
throw new Error("not an object");
|
|
652
|
-
}
|
|
653
|
-
if (!isClaimRewardEvent(content.type)) {
|
|
654
|
-
throw new Error(`object at ${content.fields.id} is not a ClaimRewardEvent object`);
|
|
655
|
-
}
|
|
656
|
-
return ClaimRewardEvent.fromFieldsWithTypes(content);
|
|
657
|
-
}
|
|
658
|
-
static fromSuiObjectData(data) {
|
|
659
|
-
if (data.bcs) {
|
|
660
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
661
|
-
!isClaimRewardEvent(data.bcs.type)) {
|
|
662
|
-
throw new Error(`object at is not a ClaimRewardEvent object`);
|
|
663
|
-
}
|
|
664
|
-
return ClaimRewardEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
665
|
-
}
|
|
666
|
-
if (data.content) {
|
|
667
|
-
return ClaimRewardEvent.fromSuiParsedData(data.content);
|
|
668
|
-
}
|
|
669
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
670
|
-
}
|
|
671
563
|
static fetch(client, id) {
|
|
672
564
|
return __awaiter(this, void 0, void 0, function* () {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
if (res.error) {
|
|
676
|
-
throw new Error(`error fetching ClaimRewardEvent object at id ${id}: ${res.error.code}`);
|
|
677
|
-
}
|
|
678
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
679
|
-
!isClaimRewardEvent(res.data.bcs.type)) {
|
|
565
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
566
|
+
if (!isClaimRewardEvent(object.type)) {
|
|
680
567
|
throw new Error(`object at id ${id} is not a ClaimRewardEvent object`);
|
|
681
568
|
}
|
|
682
|
-
return ClaimRewardEvent.
|
|
569
|
+
return ClaimRewardEvent.fromBcs(object.content);
|
|
683
570
|
});
|
|
684
571
|
}
|
|
685
572
|
}
|
|
@@ -717,8 +604,6 @@ export class DepositEvent {
|
|
|
717
604
|
bcs: DepositEvent.bcs,
|
|
718
605
|
fromJSONField: (field) => DepositEvent.fromJSONField(field),
|
|
719
606
|
fromJSON: (json) => DepositEvent.fromJSON(json),
|
|
720
|
-
fromSuiParsedData: (content) => DepositEvent.fromSuiParsedData(content),
|
|
721
|
-
fromSuiObjectData: (content) => DepositEvent.fromSuiObjectData(content),
|
|
722
607
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return DepositEvent.fetch(client, id); }),
|
|
723
608
|
new: (fields) => {
|
|
724
609
|
return new DepositEvent([], fields);
|
|
@@ -810,40 +695,13 @@ export class DepositEvent {
|
|
|
810
695
|
}
|
|
811
696
|
return DepositEvent.fromJSONField(json);
|
|
812
697
|
}
|
|
813
|
-
static fromSuiParsedData(content) {
|
|
814
|
-
if (content.dataType !== "moveObject") {
|
|
815
|
-
throw new Error("not an object");
|
|
816
|
-
}
|
|
817
|
-
if (!isDepositEvent(content.type)) {
|
|
818
|
-
throw new Error(`object at ${content.fields.id} is not a DepositEvent object`);
|
|
819
|
-
}
|
|
820
|
-
return DepositEvent.fromFieldsWithTypes(content);
|
|
821
|
-
}
|
|
822
|
-
static fromSuiObjectData(data) {
|
|
823
|
-
if (data.bcs) {
|
|
824
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
825
|
-
!isDepositEvent(data.bcs.type)) {
|
|
826
|
-
throw new Error(`object at is not a DepositEvent object`);
|
|
827
|
-
}
|
|
828
|
-
return DepositEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
829
|
-
}
|
|
830
|
-
if (data.content) {
|
|
831
|
-
return DepositEvent.fromSuiParsedData(data.content);
|
|
832
|
-
}
|
|
833
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
834
|
-
}
|
|
835
698
|
static fetch(client, id) {
|
|
836
699
|
return __awaiter(this, void 0, void 0, function* () {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
if (res.error) {
|
|
840
|
-
throw new Error(`error fetching DepositEvent object at id ${id}: ${res.error.code}`);
|
|
841
|
-
}
|
|
842
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
843
|
-
!isDepositEvent(res.data.bcs.type)) {
|
|
700
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
701
|
+
if (!isDepositEvent(object.type)) {
|
|
844
702
|
throw new Error(`object at id ${id} is not a DepositEvent object`);
|
|
845
703
|
}
|
|
846
|
-
return DepositEvent.
|
|
704
|
+
return DepositEvent.fromBcs(object.content);
|
|
847
705
|
});
|
|
848
706
|
}
|
|
849
707
|
}
|
|
@@ -879,8 +737,6 @@ export class FeeReceivers {
|
|
|
879
737
|
bcs: FeeReceivers.bcs,
|
|
880
738
|
fromJSONField: (field) => FeeReceivers.fromJSONField(field),
|
|
881
739
|
fromJSON: (json) => FeeReceivers.fromJSON(json),
|
|
882
|
-
fromSuiParsedData: (content) => FeeReceivers.fromSuiParsedData(content),
|
|
883
|
-
fromSuiObjectData: (content) => FeeReceivers.fromSuiObjectData(content),
|
|
884
740
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return FeeReceivers.fetch(client, id); }),
|
|
885
741
|
new: (fields) => {
|
|
886
742
|
return new FeeReceivers([], fields);
|
|
@@ -952,40 +808,13 @@ export class FeeReceivers {
|
|
|
952
808
|
}
|
|
953
809
|
return FeeReceivers.fromJSONField(json);
|
|
954
810
|
}
|
|
955
|
-
static fromSuiParsedData(content) {
|
|
956
|
-
if (content.dataType !== "moveObject") {
|
|
957
|
-
throw new Error("not an object");
|
|
958
|
-
}
|
|
959
|
-
if (!isFeeReceivers(content.type)) {
|
|
960
|
-
throw new Error(`object at ${content.fields.id} is not a FeeReceivers object`);
|
|
961
|
-
}
|
|
962
|
-
return FeeReceivers.fromFieldsWithTypes(content);
|
|
963
|
-
}
|
|
964
|
-
static fromSuiObjectData(data) {
|
|
965
|
-
if (data.bcs) {
|
|
966
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
967
|
-
!isFeeReceivers(data.bcs.type)) {
|
|
968
|
-
throw new Error(`object at is not a FeeReceivers object`);
|
|
969
|
-
}
|
|
970
|
-
return FeeReceivers.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
971
|
-
}
|
|
972
|
-
if (data.content) {
|
|
973
|
-
return FeeReceivers.fromSuiParsedData(data.content);
|
|
974
|
-
}
|
|
975
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
976
|
-
}
|
|
977
811
|
static fetch(client, id) {
|
|
978
812
|
return __awaiter(this, void 0, void 0, function* () {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
if (res.error) {
|
|
982
|
-
throw new Error(`error fetching FeeReceivers object at id ${id}: ${res.error.code}`);
|
|
983
|
-
}
|
|
984
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
985
|
-
!isFeeReceivers(res.data.bcs.type)) {
|
|
813
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
814
|
+
if (!isFeeReceivers(object.type)) {
|
|
986
815
|
throw new Error(`object at id ${id} is not a FeeReceivers object`);
|
|
987
816
|
}
|
|
988
|
-
return FeeReceivers.
|
|
817
|
+
return FeeReceivers.fromBcs(object.content);
|
|
989
818
|
});
|
|
990
819
|
}
|
|
991
820
|
}
|
|
@@ -1019,8 +848,6 @@ export class FeeReceiversKey {
|
|
|
1019
848
|
bcs: FeeReceiversKey.bcs,
|
|
1020
849
|
fromJSONField: (field) => FeeReceiversKey.fromJSONField(field),
|
|
1021
850
|
fromJSON: (json) => FeeReceiversKey.fromJSON(json),
|
|
1022
|
-
fromSuiParsedData: (content) => FeeReceiversKey.fromSuiParsedData(content),
|
|
1023
|
-
fromSuiObjectData: (content) => FeeReceiversKey.fromSuiObjectData(content),
|
|
1024
851
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return FeeReceiversKey.fetch(client, id); }),
|
|
1025
852
|
new: (fields) => {
|
|
1026
853
|
return new FeeReceiversKey([], fields);
|
|
@@ -1077,40 +904,13 @@ export class FeeReceiversKey {
|
|
|
1077
904
|
}
|
|
1078
905
|
return FeeReceiversKey.fromJSONField(json);
|
|
1079
906
|
}
|
|
1080
|
-
static fromSuiParsedData(content) {
|
|
1081
|
-
if (content.dataType !== "moveObject") {
|
|
1082
|
-
throw new Error("not an object");
|
|
1083
|
-
}
|
|
1084
|
-
if (!isFeeReceiversKey(content.type)) {
|
|
1085
|
-
throw new Error(`object at ${content.fields.id} is not a FeeReceiversKey object`);
|
|
1086
|
-
}
|
|
1087
|
-
return FeeReceiversKey.fromFieldsWithTypes(content);
|
|
1088
|
-
}
|
|
1089
|
-
static fromSuiObjectData(data) {
|
|
1090
|
-
if (data.bcs) {
|
|
1091
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1092
|
-
!isFeeReceiversKey(data.bcs.type)) {
|
|
1093
|
-
throw new Error(`object at is not a FeeReceiversKey object`);
|
|
1094
|
-
}
|
|
1095
|
-
return FeeReceiversKey.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
1096
|
-
}
|
|
1097
|
-
if (data.content) {
|
|
1098
|
-
return FeeReceiversKey.fromSuiParsedData(data.content);
|
|
1099
|
-
}
|
|
1100
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1101
|
-
}
|
|
1102
907
|
static fetch(client, id) {
|
|
1103
908
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
if (res.error) {
|
|
1107
|
-
throw new Error(`error fetching FeeReceiversKey object at id ${id}: ${res.error.code}`);
|
|
1108
|
-
}
|
|
1109
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1110
|
-
!isFeeReceiversKey(res.data.bcs.type)) {
|
|
909
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
910
|
+
if (!isFeeReceiversKey(object.type)) {
|
|
1111
911
|
throw new Error(`object at id ${id} is not a FeeReceiversKey object`);
|
|
1112
912
|
}
|
|
1113
|
-
return FeeReceiversKey.
|
|
913
|
+
return FeeReceiversKey.fromBcs(object.content);
|
|
1114
914
|
});
|
|
1115
915
|
}
|
|
1116
916
|
}
|
|
@@ -1148,8 +948,6 @@ export class ForgiveEvent {
|
|
|
1148
948
|
bcs: ForgiveEvent.bcs,
|
|
1149
949
|
fromJSONField: (field) => ForgiveEvent.fromJSONField(field),
|
|
1150
950
|
fromJSON: (json) => ForgiveEvent.fromJSON(json),
|
|
1151
|
-
fromSuiParsedData: (content) => ForgiveEvent.fromSuiParsedData(content),
|
|
1152
|
-
fromSuiObjectData: (content) => ForgiveEvent.fromSuiObjectData(content),
|
|
1153
951
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ForgiveEvent.fetch(client, id); }),
|
|
1154
952
|
new: (fields) => {
|
|
1155
953
|
return new ForgiveEvent([], fields);
|
|
@@ -1241,40 +1039,13 @@ export class ForgiveEvent {
|
|
|
1241
1039
|
}
|
|
1242
1040
|
return ForgiveEvent.fromJSONField(json);
|
|
1243
1041
|
}
|
|
1244
|
-
static fromSuiParsedData(content) {
|
|
1245
|
-
if (content.dataType !== "moveObject") {
|
|
1246
|
-
throw new Error("not an object");
|
|
1247
|
-
}
|
|
1248
|
-
if (!isForgiveEvent(content.type)) {
|
|
1249
|
-
throw new Error(`object at ${content.fields.id} is not a ForgiveEvent object`);
|
|
1250
|
-
}
|
|
1251
|
-
return ForgiveEvent.fromFieldsWithTypes(content);
|
|
1252
|
-
}
|
|
1253
|
-
static fromSuiObjectData(data) {
|
|
1254
|
-
if (data.bcs) {
|
|
1255
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1256
|
-
!isForgiveEvent(data.bcs.type)) {
|
|
1257
|
-
throw new Error(`object at is not a ForgiveEvent object`);
|
|
1258
|
-
}
|
|
1259
|
-
return ForgiveEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
1260
|
-
}
|
|
1261
|
-
if (data.content) {
|
|
1262
|
-
return ForgiveEvent.fromSuiParsedData(data.content);
|
|
1263
|
-
}
|
|
1264
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1265
|
-
}
|
|
1266
1042
|
static fetch(client, id) {
|
|
1267
1043
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
if (res.error) {
|
|
1271
|
-
throw new Error(`error fetching ForgiveEvent object at id ${id}: ${res.error.code}`);
|
|
1272
|
-
}
|
|
1273
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1274
|
-
!isForgiveEvent(res.data.bcs.type)) {
|
|
1044
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1045
|
+
if (!isForgiveEvent(object.type)) {
|
|
1275
1046
|
throw new Error(`object at id ${id} is not a ForgiveEvent object`);
|
|
1276
1047
|
}
|
|
1277
|
-
return ForgiveEvent.
|
|
1048
|
+
return ForgiveEvent.fromBcs(object.content);
|
|
1278
1049
|
});
|
|
1279
1050
|
}
|
|
1280
1051
|
}
|
|
@@ -1308,8 +1079,6 @@ export class LENDING_MARKET {
|
|
|
1308
1079
|
bcs: LENDING_MARKET.bcs,
|
|
1309
1080
|
fromJSONField: (field) => LENDING_MARKET.fromJSONField(field),
|
|
1310
1081
|
fromJSON: (json) => LENDING_MARKET.fromJSON(json),
|
|
1311
|
-
fromSuiParsedData: (content) => LENDING_MARKET.fromSuiParsedData(content),
|
|
1312
|
-
fromSuiObjectData: (content) => LENDING_MARKET.fromSuiObjectData(content),
|
|
1313
1082
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LENDING_MARKET.fetch(client, id); }),
|
|
1314
1083
|
new: (fields) => {
|
|
1315
1084
|
return new LENDING_MARKET([], fields);
|
|
@@ -1366,40 +1135,13 @@ export class LENDING_MARKET {
|
|
|
1366
1135
|
}
|
|
1367
1136
|
return LENDING_MARKET.fromJSONField(json);
|
|
1368
1137
|
}
|
|
1369
|
-
static fromSuiParsedData(content) {
|
|
1370
|
-
if (content.dataType !== "moveObject") {
|
|
1371
|
-
throw new Error("not an object");
|
|
1372
|
-
}
|
|
1373
|
-
if (!isLENDING_MARKET(content.type)) {
|
|
1374
|
-
throw new Error(`object at ${content.fields.id} is not a LENDING_MARKET object`);
|
|
1375
|
-
}
|
|
1376
|
-
return LENDING_MARKET.fromFieldsWithTypes(content);
|
|
1377
|
-
}
|
|
1378
|
-
static fromSuiObjectData(data) {
|
|
1379
|
-
if (data.bcs) {
|
|
1380
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1381
|
-
!isLENDING_MARKET(data.bcs.type)) {
|
|
1382
|
-
throw new Error(`object at is not a LENDING_MARKET object`);
|
|
1383
|
-
}
|
|
1384
|
-
return LENDING_MARKET.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
1385
|
-
}
|
|
1386
|
-
if (data.content) {
|
|
1387
|
-
return LENDING_MARKET.fromSuiParsedData(data.content);
|
|
1388
|
-
}
|
|
1389
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1390
|
-
}
|
|
1391
1138
|
static fetch(client, id) {
|
|
1392
1139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
if (res.error) {
|
|
1396
|
-
throw new Error(`error fetching LENDING_MARKET object at id ${id}: ${res.error.code}`);
|
|
1397
|
-
}
|
|
1398
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1399
|
-
!isLENDING_MARKET(res.data.bcs.type)) {
|
|
1140
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1141
|
+
if (!isLENDING_MARKET(object.type)) {
|
|
1400
1142
|
throw new Error(`object at id ${id} is not a LENDING_MARKET object`);
|
|
1401
1143
|
}
|
|
1402
|
-
return LENDING_MARKET.
|
|
1144
|
+
return LENDING_MARKET.fromBcs(object.content);
|
|
1403
1145
|
});
|
|
1404
1146
|
}
|
|
1405
1147
|
}
|
|
@@ -1440,8 +1182,6 @@ export class LendingMarket {
|
|
|
1440
1182
|
bcs: LendingMarket.bcs,
|
|
1441
1183
|
fromJSONField: (field) => LendingMarket.fromJSONField(P, field),
|
|
1442
1184
|
fromJSON: (json) => LendingMarket.fromJSON(P, json),
|
|
1443
|
-
fromSuiParsedData: (content) => LendingMarket.fromSuiParsedData(P, content),
|
|
1444
|
-
fromSuiObjectData: (content) => LendingMarket.fromSuiObjectData(P, content),
|
|
1445
1185
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LendingMarket.fetch(client, P, id); }),
|
|
1446
1186
|
new: (fields) => {
|
|
1447
1187
|
return new LendingMarket([extractType(P)], fields);
|
|
@@ -1540,49 +1280,13 @@ export class LendingMarket {
|
|
|
1540
1280
|
assertReifiedTypeArgsMatch(composeSuiType(LendingMarket.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
1541
1281
|
return LendingMarket.fromJSONField(typeArg, json);
|
|
1542
1282
|
}
|
|
1543
|
-
static fromSuiParsedData(typeArg, content) {
|
|
1544
|
-
if (content.dataType !== "moveObject") {
|
|
1545
|
-
throw new Error("not an object");
|
|
1546
|
-
}
|
|
1547
|
-
if (!isLendingMarket(content.type)) {
|
|
1548
|
-
throw new Error(`object at ${content.fields.id} is not a LendingMarket object`);
|
|
1549
|
-
}
|
|
1550
|
-
return LendingMarket.fromFieldsWithTypes(typeArg, content);
|
|
1551
|
-
}
|
|
1552
|
-
static fromSuiObjectData(typeArg, data) {
|
|
1553
|
-
if (data.bcs) {
|
|
1554
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1555
|
-
!isLendingMarket(data.bcs.type)) {
|
|
1556
|
-
throw new Error(`object at is not a LendingMarket object`);
|
|
1557
|
-
}
|
|
1558
|
-
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
1559
|
-
if (gotTypeArgs.length !== 1) {
|
|
1560
|
-
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
1561
|
-
}
|
|
1562
|
-
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
1563
|
-
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
1564
|
-
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
1565
|
-
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
1566
|
-
}
|
|
1567
|
-
return LendingMarket.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
1568
|
-
}
|
|
1569
|
-
if (data.content) {
|
|
1570
|
-
return LendingMarket.fromSuiParsedData(typeArg, data.content);
|
|
1571
|
-
}
|
|
1572
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1573
|
-
}
|
|
1574
1283
|
static fetch(client, typeArg, id) {
|
|
1575
1284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
if (res.error) {
|
|
1579
|
-
throw new Error(`error fetching LendingMarket object at id ${id}: ${res.error.code}`);
|
|
1580
|
-
}
|
|
1581
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1582
|
-
!isLendingMarket(res.data.bcs.type)) {
|
|
1285
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1286
|
+
if (!isLendingMarket(object.type)) {
|
|
1583
1287
|
throw new Error(`object at id ${id} is not a LendingMarket object`);
|
|
1584
1288
|
}
|
|
1585
|
-
return LendingMarket.
|
|
1289
|
+
return LendingMarket.fromBcs(typeArg, object.content);
|
|
1586
1290
|
});
|
|
1587
1291
|
}
|
|
1588
1292
|
}
|
|
@@ -1617,8 +1321,6 @@ export class LendingMarketOwnerCap {
|
|
|
1617
1321
|
bcs: LendingMarketOwnerCap.bcs,
|
|
1618
1322
|
fromJSONField: (field) => LendingMarketOwnerCap.fromJSONField(P, field),
|
|
1619
1323
|
fromJSON: (json) => LendingMarketOwnerCap.fromJSON(P, json),
|
|
1620
|
-
fromSuiParsedData: (content) => LendingMarketOwnerCap.fromSuiParsedData(P, content),
|
|
1621
|
-
fromSuiObjectData: (content) => LendingMarketOwnerCap.fromSuiObjectData(P, content),
|
|
1622
1324
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LendingMarketOwnerCap.fetch(client, P, id); }),
|
|
1623
1325
|
new: (fields) => {
|
|
1624
1326
|
return new LendingMarketOwnerCap([extractType(P)], fields);
|
|
@@ -1682,49 +1384,13 @@ export class LendingMarketOwnerCap {
|
|
|
1682
1384
|
assertReifiedTypeArgsMatch(composeSuiType(LendingMarketOwnerCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
1683
1385
|
return LendingMarketOwnerCap.fromJSONField(typeArg, json);
|
|
1684
1386
|
}
|
|
1685
|
-
static fromSuiParsedData(typeArg, content) {
|
|
1686
|
-
if (content.dataType !== "moveObject") {
|
|
1687
|
-
throw new Error("not an object");
|
|
1688
|
-
}
|
|
1689
|
-
if (!isLendingMarketOwnerCap(content.type)) {
|
|
1690
|
-
throw new Error(`object at ${content.fields.id} is not a LendingMarketOwnerCap object`);
|
|
1691
|
-
}
|
|
1692
|
-
return LendingMarketOwnerCap.fromFieldsWithTypes(typeArg, content);
|
|
1693
|
-
}
|
|
1694
|
-
static fromSuiObjectData(typeArg, data) {
|
|
1695
|
-
if (data.bcs) {
|
|
1696
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1697
|
-
!isLendingMarketOwnerCap(data.bcs.type)) {
|
|
1698
|
-
throw new Error(`object at is not a LendingMarketOwnerCap object`);
|
|
1699
|
-
}
|
|
1700
|
-
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
1701
|
-
if (gotTypeArgs.length !== 1) {
|
|
1702
|
-
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
1703
|
-
}
|
|
1704
|
-
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
1705
|
-
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
1706
|
-
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
1707
|
-
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
1708
|
-
}
|
|
1709
|
-
return LendingMarketOwnerCap.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
1710
|
-
}
|
|
1711
|
-
if (data.content) {
|
|
1712
|
-
return LendingMarketOwnerCap.fromSuiParsedData(typeArg, data.content);
|
|
1713
|
-
}
|
|
1714
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1715
|
-
}
|
|
1716
1387
|
static fetch(client, typeArg, id) {
|
|
1717
1388
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
if (res.error) {
|
|
1721
|
-
throw new Error(`error fetching LendingMarketOwnerCap object at id ${id}: ${res.error.code}`);
|
|
1722
|
-
}
|
|
1723
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1724
|
-
!isLendingMarketOwnerCap(res.data.bcs.type)) {
|
|
1389
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1390
|
+
if (!isLendingMarketOwnerCap(object.type)) {
|
|
1725
1391
|
throw new Error(`object at id ${id} is not a LendingMarketOwnerCap object`);
|
|
1726
1392
|
}
|
|
1727
|
-
return LendingMarketOwnerCap.
|
|
1393
|
+
return LendingMarketOwnerCap.fromBcs(typeArg, object.content);
|
|
1728
1394
|
});
|
|
1729
1395
|
}
|
|
1730
1396
|
}
|
|
@@ -1767,8 +1433,6 @@ export class LiquidateEvent {
|
|
|
1767
1433
|
bcs: LiquidateEvent.bcs,
|
|
1768
1434
|
fromJSONField: (field) => LiquidateEvent.fromJSONField(field),
|
|
1769
1435
|
fromJSON: (json) => LiquidateEvent.fromJSON(json),
|
|
1770
|
-
fromSuiParsedData: (content) => LiquidateEvent.fromSuiParsedData(content),
|
|
1771
|
-
fromSuiObjectData: (content) => LiquidateEvent.fromSuiObjectData(content),
|
|
1772
1436
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LiquidateEvent.fetch(client, id); }),
|
|
1773
1437
|
new: (fields) => {
|
|
1774
1438
|
return new LiquidateEvent([], fields);
|
|
@@ -1890,40 +1554,13 @@ export class LiquidateEvent {
|
|
|
1890
1554
|
}
|
|
1891
1555
|
return LiquidateEvent.fromJSONField(json);
|
|
1892
1556
|
}
|
|
1893
|
-
static fromSuiParsedData(content) {
|
|
1894
|
-
if (content.dataType !== "moveObject") {
|
|
1895
|
-
throw new Error("not an object");
|
|
1896
|
-
}
|
|
1897
|
-
if (!isLiquidateEvent(content.type)) {
|
|
1898
|
-
throw new Error(`object at ${content.fields.id} is not a LiquidateEvent object`);
|
|
1899
|
-
}
|
|
1900
|
-
return LiquidateEvent.fromFieldsWithTypes(content);
|
|
1901
|
-
}
|
|
1902
|
-
static fromSuiObjectData(data) {
|
|
1903
|
-
if (data.bcs) {
|
|
1904
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1905
|
-
!isLiquidateEvent(data.bcs.type)) {
|
|
1906
|
-
throw new Error(`object at is not a LiquidateEvent object`);
|
|
1907
|
-
}
|
|
1908
|
-
return LiquidateEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
1909
|
-
}
|
|
1910
|
-
if (data.content) {
|
|
1911
|
-
return LiquidateEvent.fromSuiParsedData(data.content);
|
|
1912
|
-
}
|
|
1913
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1914
|
-
}
|
|
1915
1557
|
static fetch(client, id) {
|
|
1916
1558
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
if (res.error) {
|
|
1920
|
-
throw new Error(`error fetching LiquidateEvent object at id ${id}: ${res.error.code}`);
|
|
1921
|
-
}
|
|
1922
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1923
|
-
!isLiquidateEvent(res.data.bcs.type)) {
|
|
1559
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1560
|
+
if (!isLiquidateEvent(object.type)) {
|
|
1924
1561
|
throw new Error(`object at id ${id} is not a LiquidateEvent object`);
|
|
1925
1562
|
}
|
|
1926
|
-
return LiquidateEvent.
|
|
1563
|
+
return LiquidateEvent.fromBcs(object.content);
|
|
1927
1564
|
});
|
|
1928
1565
|
}
|
|
1929
1566
|
}
|
|
@@ -1958,8 +1595,6 @@ export class ObligationOwnerCap {
|
|
|
1958
1595
|
bcs: ObligationOwnerCap.bcs,
|
|
1959
1596
|
fromJSONField: (field) => ObligationOwnerCap.fromJSONField(P, field),
|
|
1960
1597
|
fromJSON: (json) => ObligationOwnerCap.fromJSON(P, json),
|
|
1961
|
-
fromSuiParsedData: (content) => ObligationOwnerCap.fromSuiParsedData(P, content),
|
|
1962
|
-
fromSuiObjectData: (content) => ObligationOwnerCap.fromSuiObjectData(P, content),
|
|
1963
1598
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ObligationOwnerCap.fetch(client, P, id); }),
|
|
1964
1599
|
new: (fields) => {
|
|
1965
1600
|
return new ObligationOwnerCap([extractType(P)], fields);
|
|
@@ -2023,49 +1658,13 @@ export class ObligationOwnerCap {
|
|
|
2023
1658
|
assertReifiedTypeArgsMatch(composeSuiType(ObligationOwnerCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
2024
1659
|
return ObligationOwnerCap.fromJSONField(typeArg, json);
|
|
2025
1660
|
}
|
|
2026
|
-
static fromSuiParsedData(typeArg, content) {
|
|
2027
|
-
if (content.dataType !== "moveObject") {
|
|
2028
|
-
throw new Error("not an object");
|
|
2029
|
-
}
|
|
2030
|
-
if (!isObligationOwnerCap(content.type)) {
|
|
2031
|
-
throw new Error(`object at ${content.fields.id} is not a ObligationOwnerCap object`);
|
|
2032
|
-
}
|
|
2033
|
-
return ObligationOwnerCap.fromFieldsWithTypes(typeArg, content);
|
|
2034
|
-
}
|
|
2035
|
-
static fromSuiObjectData(typeArg, data) {
|
|
2036
|
-
if (data.bcs) {
|
|
2037
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
2038
|
-
!isObligationOwnerCap(data.bcs.type)) {
|
|
2039
|
-
throw new Error(`object at is not a ObligationOwnerCap object`);
|
|
2040
|
-
}
|
|
2041
|
-
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
2042
|
-
if (gotTypeArgs.length !== 1) {
|
|
2043
|
-
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
2044
|
-
}
|
|
2045
|
-
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
2046
|
-
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
2047
|
-
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
2048
|
-
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
2049
|
-
}
|
|
2050
|
-
return ObligationOwnerCap.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
2051
|
-
}
|
|
2052
|
-
if (data.content) {
|
|
2053
|
-
return ObligationOwnerCap.fromSuiParsedData(typeArg, data.content);
|
|
2054
|
-
}
|
|
2055
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
2056
|
-
}
|
|
2057
1661
|
static fetch(client, typeArg, id) {
|
|
2058
1662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
if (res.error) {
|
|
2062
|
-
throw new Error(`error fetching ObligationOwnerCap object at id ${id}: ${res.error.code}`);
|
|
2063
|
-
}
|
|
2064
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
2065
|
-
!isObligationOwnerCap(res.data.bcs.type)) {
|
|
1663
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1664
|
+
if (!isObligationOwnerCap(object.type)) {
|
|
2066
1665
|
throw new Error(`object at id ${id} is not a ObligationOwnerCap object`);
|
|
2067
1666
|
}
|
|
2068
|
-
return ObligationOwnerCap.
|
|
1667
|
+
return ObligationOwnerCap.fromBcs(typeArg, object.content);
|
|
2069
1668
|
});
|
|
2070
1669
|
}
|
|
2071
1670
|
}
|
|
@@ -2099,8 +1698,6 @@ export class RateLimiterExemption {
|
|
|
2099
1698
|
bcs: RateLimiterExemption.bcs,
|
|
2100
1699
|
fromJSONField: (field) => RateLimiterExemption.fromJSONField([P, T], field),
|
|
2101
1700
|
fromJSON: (json) => RateLimiterExemption.fromJSON([P, T], json),
|
|
2102
|
-
fromSuiParsedData: (content) => RateLimiterExemption.fromSuiParsedData([P, T], content),
|
|
2103
|
-
fromSuiObjectData: (content) => RateLimiterExemption.fromSuiObjectData([P, T], content),
|
|
2104
1701
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RateLimiterExemption.fetch(client, [P, T], id); }),
|
|
2105
1702
|
new: (fields) => {
|
|
2106
1703
|
return new RateLimiterExemption([extractType(P), extractType(T)], fields);
|
|
@@ -2159,51 +1756,13 @@ export class RateLimiterExemption {
|
|
|
2159
1756
|
assertReifiedTypeArgsMatch(composeSuiType(RateLimiterExemption.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
|
|
2160
1757
|
return RateLimiterExemption.fromJSONField(typeArgs, json);
|
|
2161
1758
|
}
|
|
2162
|
-
static fromSuiParsedData(typeArgs, content) {
|
|
2163
|
-
if (content.dataType !== "moveObject") {
|
|
2164
|
-
throw new Error("not an object");
|
|
2165
|
-
}
|
|
2166
|
-
if (!isRateLimiterExemption(content.type)) {
|
|
2167
|
-
throw new Error(`object at ${content.fields.id} is not a RateLimiterExemption object`);
|
|
2168
|
-
}
|
|
2169
|
-
return RateLimiterExemption.fromFieldsWithTypes(typeArgs, content);
|
|
2170
|
-
}
|
|
2171
|
-
static fromSuiObjectData(typeArgs, data) {
|
|
2172
|
-
if (data.bcs) {
|
|
2173
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
2174
|
-
!isRateLimiterExemption(data.bcs.type)) {
|
|
2175
|
-
throw new Error(`object at is not a RateLimiterExemption object`);
|
|
2176
|
-
}
|
|
2177
|
-
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
2178
|
-
if (gotTypeArgs.length !== 2) {
|
|
2179
|
-
throw new Error(`type argument mismatch: expected 2 type arguments but got ${gotTypeArgs.length}`);
|
|
2180
|
-
}
|
|
2181
|
-
for (let i = 0; i < 2; i++) {
|
|
2182
|
-
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
2183
|
-
const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
|
|
2184
|
-
if (gotTypeArg !== expectedTypeArg) {
|
|
2185
|
-
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
return RateLimiterExemption.fromBcs(typeArgs, fromBase64(data.bcs.bcsBytes));
|
|
2189
|
-
}
|
|
2190
|
-
if (data.content) {
|
|
2191
|
-
return RateLimiterExemption.fromSuiParsedData(typeArgs, data.content);
|
|
2192
|
-
}
|
|
2193
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
2194
|
-
}
|
|
2195
1759
|
static fetch(client, typeArgs, id) {
|
|
2196
1760
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
if (res.error) {
|
|
2200
|
-
throw new Error(`error fetching RateLimiterExemption object at id ${id}: ${res.error.code}`);
|
|
2201
|
-
}
|
|
2202
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
2203
|
-
!isRateLimiterExemption(res.data.bcs.type)) {
|
|
1761
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1762
|
+
if (!isRateLimiterExemption(object.type)) {
|
|
2204
1763
|
throw new Error(`object at id ${id} is not a RateLimiterExemption object`);
|
|
2205
1764
|
}
|
|
2206
|
-
return RateLimiterExemption.
|
|
1765
|
+
return RateLimiterExemption.fromBcs(typeArgs, object.content);
|
|
2207
1766
|
});
|
|
2208
1767
|
}
|
|
2209
1768
|
}
|
|
@@ -2241,8 +1800,6 @@ export class RepayEvent {
|
|
|
2241
1800
|
bcs: RepayEvent.bcs,
|
|
2242
1801
|
fromJSONField: (field) => RepayEvent.fromJSONField(field),
|
|
2243
1802
|
fromJSON: (json) => RepayEvent.fromJSON(json),
|
|
2244
|
-
fromSuiParsedData: (content) => RepayEvent.fromSuiParsedData(content),
|
|
2245
|
-
fromSuiObjectData: (content) => RepayEvent.fromSuiObjectData(content),
|
|
2246
1803
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RepayEvent.fetch(client, id); }),
|
|
2247
1804
|
new: (fields) => {
|
|
2248
1805
|
return new RepayEvent([], fields);
|
|
@@ -2334,39 +1891,13 @@ export class RepayEvent {
|
|
|
2334
1891
|
}
|
|
2335
1892
|
return RepayEvent.fromJSONField(json);
|
|
2336
1893
|
}
|
|
2337
|
-
static fromSuiParsedData(content) {
|
|
2338
|
-
if (content.dataType !== "moveObject") {
|
|
2339
|
-
throw new Error("not an object");
|
|
2340
|
-
}
|
|
2341
|
-
if (!isRepayEvent(content.type)) {
|
|
2342
|
-
throw new Error(`object at ${content.fields.id} is not a RepayEvent object`);
|
|
2343
|
-
}
|
|
2344
|
-
return RepayEvent.fromFieldsWithTypes(content);
|
|
2345
|
-
}
|
|
2346
|
-
static fromSuiObjectData(data) {
|
|
2347
|
-
if (data.bcs) {
|
|
2348
|
-
if (data.bcs.dataType !== "moveObject" || !isRepayEvent(data.bcs.type)) {
|
|
2349
|
-
throw new Error(`object at is not a RepayEvent object`);
|
|
2350
|
-
}
|
|
2351
|
-
return RepayEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
2352
|
-
}
|
|
2353
|
-
if (data.content) {
|
|
2354
|
-
return RepayEvent.fromSuiParsedData(data.content);
|
|
2355
|
-
}
|
|
2356
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
2357
|
-
}
|
|
2358
1894
|
static fetch(client, id) {
|
|
2359
1895
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
if (res.error) {
|
|
2363
|
-
throw new Error(`error fetching RepayEvent object at id ${id}: ${res.error.code}`);
|
|
2364
|
-
}
|
|
2365
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
2366
|
-
!isRepayEvent(res.data.bcs.type)) {
|
|
1896
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
1897
|
+
if (!isRepayEvent(object.type)) {
|
|
2367
1898
|
throw new Error(`object at id ${id} is not a RepayEvent object`);
|
|
2368
1899
|
}
|
|
2369
|
-
return RepayEvent.
|
|
1900
|
+
return RepayEvent.fromBcs(object.content);
|
|
2370
1901
|
});
|
|
2371
1902
|
}
|
|
2372
1903
|
}
|
|
@@ -2404,8 +1935,6 @@ export class WithdrawEvent {
|
|
|
2404
1935
|
bcs: WithdrawEvent.bcs,
|
|
2405
1936
|
fromJSONField: (field) => WithdrawEvent.fromJSONField(field),
|
|
2406
1937
|
fromJSON: (json) => WithdrawEvent.fromJSON(json),
|
|
2407
|
-
fromSuiParsedData: (content) => WithdrawEvent.fromSuiParsedData(content),
|
|
2408
|
-
fromSuiObjectData: (content) => WithdrawEvent.fromSuiObjectData(content),
|
|
2409
1938
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return WithdrawEvent.fetch(client, id); }),
|
|
2410
1939
|
new: (fields) => {
|
|
2411
1940
|
return new WithdrawEvent([], fields);
|
|
@@ -2497,40 +2026,13 @@ export class WithdrawEvent {
|
|
|
2497
2026
|
}
|
|
2498
2027
|
return WithdrawEvent.fromJSONField(json);
|
|
2499
2028
|
}
|
|
2500
|
-
static fromSuiParsedData(content) {
|
|
2501
|
-
if (content.dataType !== "moveObject") {
|
|
2502
|
-
throw new Error("not an object");
|
|
2503
|
-
}
|
|
2504
|
-
if (!isWithdrawEvent(content.type)) {
|
|
2505
|
-
throw new Error(`object at ${content.fields.id} is not a WithdrawEvent object`);
|
|
2506
|
-
}
|
|
2507
|
-
return WithdrawEvent.fromFieldsWithTypes(content);
|
|
2508
|
-
}
|
|
2509
|
-
static fromSuiObjectData(data) {
|
|
2510
|
-
if (data.bcs) {
|
|
2511
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
2512
|
-
!isWithdrawEvent(data.bcs.type)) {
|
|
2513
|
-
throw new Error(`object at is not a WithdrawEvent object`);
|
|
2514
|
-
}
|
|
2515
|
-
return WithdrawEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
2516
|
-
}
|
|
2517
|
-
if (data.content) {
|
|
2518
|
-
return WithdrawEvent.fromSuiParsedData(data.content);
|
|
2519
|
-
}
|
|
2520
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
2521
|
-
}
|
|
2522
2029
|
static fetch(client, id) {
|
|
2523
2030
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
if (res.error) {
|
|
2527
|
-
throw new Error(`error fetching WithdrawEvent object at id ${id}: ${res.error.code}`);
|
|
2528
|
-
}
|
|
2529
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
2530
|
-
!isWithdrawEvent(res.data.bcs.type)) {
|
|
2031
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
2032
|
+
if (!isWithdrawEvent(object.type)) {
|
|
2531
2033
|
throw new Error(`object at id ${id} is not a WithdrawEvent object`);
|
|
2532
2034
|
}
|
|
2533
|
-
return WithdrawEvent.
|
|
2035
|
+
return WithdrawEvent.fromBcs(object.content);
|
|
2534
2036
|
});
|
|
2535
2037
|
}
|
|
2536
2038
|
}
|