@suilend/sdk 3.0.7 → 4.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.
Files changed (71) hide show
  1. package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +4 -4
  2. package/_generated/_dependencies/source/0x1/ascii/structs.js +42 -41
  3. package/_generated/_dependencies/source/0x1/option/structs.js +22 -26
  4. package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +3 -3
  5. package/_generated/_dependencies/source/0x1/type-name/structs.js +21 -25
  6. package/_generated/_dependencies/source/0x2/bag/structs.d.ts +5 -5
  7. package/_generated/_dependencies/source/0x2/bag/structs.js +22 -25
  8. package/_generated/_dependencies/source/0x2/balance/structs.d.ts +4 -4
  9. package/_generated/_dependencies/source/0x2/balance/structs.js +42 -41
  10. package/_generated/_dependencies/source/0x2/object/structs.d.ts +5 -5
  11. package/_generated/_dependencies/source/0x2/object/structs.js +42 -41
  12. package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +5 -5
  13. package/_generated/_dependencies/source/0x2/object-table/structs.js +22 -25
  14. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +3 -3
  15. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +22 -25
  16. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +9 -9
  17. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +24 -25
  18. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +21 -21
  19. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +23 -25
  20. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +2 -2
  21. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +21 -25
  22. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +52 -52
  23. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +45 -41
  24. package/_generated/_framework/vector.js +9 -6
  25. package/_generated/suilend/cell/structs.d.ts +1 -1
  26. package/_generated/suilend/cell/structs.js +21 -25
  27. package/_generated/suilend/decimal/structs.d.ts +2 -2
  28. package/_generated/suilend/decimal/structs.js +21 -25
  29. package/_generated/suilend/lending-market/structs.d.ts +129 -129
  30. package/_generated/suilend/lending-market/structs.js +391 -265
  31. package/_generated/suilend/liquidity-mining/structs.d.ts +44 -44
  32. package/_generated/suilend/liquidity-mining/structs.js +122 -89
  33. package/_generated/suilend/obligation/structs.d.ts +98 -98
  34. package/_generated/suilend/obligation/structs.js +194 -121
  35. package/_generated/suilend/rate-limiter/structs.d.ts +12 -12
  36. package/_generated/suilend/rate-limiter/structs.js +46 -41
  37. package/_generated/suilend/reserve/structs.d.ts +128 -128
  38. package/_generated/suilend/reserve/structs.js +243 -153
  39. package/_generated/suilend/reserve-config/structs.d.ts +30 -30
  40. package/_generated/suilend/reserve-config/structs.js +60 -41
  41. package/api/events.js +5 -14
  42. package/client.js +267 -319
  43. package/lib/initialize.d.ts +2 -2
  44. package/lib/initialize.js +26 -31
  45. package/lib/liquidityMining.js +15 -19
  46. package/lib/pyth.js +6 -15
  47. package/lib/pythAdapter.js +96 -112
  48. package/lib/strategyOwnerCap.js +8 -17
  49. package/margin/margin/admin_cap.d.ts +2 -2
  50. package/margin/margin/deps/std/type_name.d.ts +1 -1
  51. package/margin/margin/deps/suilend/lending_market.d.ts +2 -2
  52. package/margin/margin/market.d.ts +11 -11
  53. package/margin/margin/market.js +22 -22
  54. package/margin/margin/permissions.js +14 -14
  55. package/margin/margin/position.d.ts +47 -47
  56. package/margin/margin/position.js +10 -10
  57. package/margin/margin/router.d.ts +5 -5
  58. package/margin/margin/router.js +16 -16
  59. package/margin/margin/version.d.ts +1 -1
  60. package/margin/utils/index.js +22 -36
  61. package/package.json +1 -1
  62. package/parsers/apiReserveAssetDataEvent.js +4 -1
  63. package/parsers/lendingMarket.js +3 -4
  64. package/parsers/reserve.js +4 -1
  65. package/strategies.js +188 -204
  66. package/swap/quote.d.ts +1 -1
  67. package/swap/quote.js +28 -39
  68. package/swap/transaction.js +17 -26
  69. package/utils/events.js +20 -32
  70. package/utils/obligation.js +111 -135
  71. package/utils/simulate.js +16 -24
@@ -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 { ObjectTable } from "../../_dependencies/source/0x2/object-table/structs.js";
@@ -26,10 +17,20 @@ export function isMintEvent(type) {
26
17
  return type === `${PKG_V1}::lending_market::MintEvent`;
27
18
  }
28
19
  export class MintEvent {
20
+ __StructClass = true;
21
+ static $typeName = `${PKG_V1}::lending_market::MintEvent`;
22
+ static $numTypeParams = 0;
23
+ static $isPhantom = [];
24
+ $typeName = MintEvent.$typeName;
25
+ $fullTypeName;
26
+ $typeArgs;
27
+ $isPhantom = MintEvent.$isPhantom;
28
+ lendingMarketId;
29
+ coinType;
30
+ reserveId;
31
+ liquidityAmount;
32
+ ctokenAmount;
29
33
  constructor(typeArgs, fields) {
30
- this.__StructClass = true;
31
- this.$typeName = MintEvent.$typeName;
32
- this.$isPhantom = MintEvent.$isPhantom;
33
34
  this.$fullTypeName = composeSuiType(MintEvent.$typeName, ...typeArgs);
34
35
  this.$typeArgs = typeArgs;
35
36
  this.lendingMarketId = fields.lendingMarketId;
@@ -51,7 +52,7 @@ export class MintEvent {
51
52
  bcs: MintEvent.bcs,
52
53
  fromJSONField: (field) => MintEvent.fromJSONField(field),
53
54
  fromJSON: (json) => MintEvent.fromJSON(json),
54
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return MintEvent.fetch(client, id); }),
55
+ fetch: async (client, id) => MintEvent.fetch(client, id),
55
56
  new: (fields) => {
56
57
  return new MintEvent([], fields);
57
58
  },
@@ -120,7 +121,11 @@ export class MintEvent {
120
121
  };
121
122
  }
122
123
  toJSON() {
123
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
124
+ return {
125
+ $typeName: this.$typeName,
126
+ $typeArgs: this.$typeArgs,
127
+ ...this.toJSONField(),
128
+ };
124
129
  }
125
130
  static fromJSONField(field) {
126
131
  return MintEvent.reified().new({
@@ -137,29 +142,34 @@ export class MintEvent {
137
142
  }
138
143
  return MintEvent.fromJSONField(json);
139
144
  }
140
- static fetch(client, id) {
141
- return __awaiter(this, void 0, void 0, function* () {
142
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
143
- if (!isMintEvent(object.type)) {
144
- throw new Error(`object at id ${id} is not a MintEvent object`);
145
- }
146
- return MintEvent.fromBcs(object.content);
147
- });
145
+ static async fetch(client, id) {
146
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
147
+ if (!isMintEvent(object.type)) {
148
+ throw new Error(`object at id ${id} is not a MintEvent object`);
149
+ }
150
+ return MintEvent.fromBcs(object.content);
148
151
  }
149
152
  }
150
- MintEvent.$typeName = `${PKG_V1}::lending_market::MintEvent`;
151
- MintEvent.$numTypeParams = 0;
152
- MintEvent.$isPhantom = [];
153
153
  /* ============================== RedeemEvent =============================== */
154
154
  export function isRedeemEvent(type) {
155
155
  type = compressSuiType(type);
156
156
  return type === `${PKG_V1}::lending_market::RedeemEvent`;
157
157
  }
158
158
  export class RedeemEvent {
159
+ __StructClass = true;
160
+ static $typeName = `${PKG_V1}::lending_market::RedeemEvent`;
161
+ static $numTypeParams = 0;
162
+ static $isPhantom = [];
163
+ $typeName = RedeemEvent.$typeName;
164
+ $fullTypeName;
165
+ $typeArgs;
166
+ $isPhantom = RedeemEvent.$isPhantom;
167
+ lendingMarketId;
168
+ coinType;
169
+ reserveId;
170
+ ctokenAmount;
171
+ liquidityAmount;
159
172
  constructor(typeArgs, fields) {
160
- this.__StructClass = true;
161
- this.$typeName = RedeemEvent.$typeName;
162
- this.$isPhantom = RedeemEvent.$isPhantom;
163
173
  this.$fullTypeName = composeSuiType(RedeemEvent.$typeName, ...typeArgs);
164
174
  this.$typeArgs = typeArgs;
165
175
  this.lendingMarketId = fields.lendingMarketId;
@@ -181,7 +191,7 @@ export class RedeemEvent {
181
191
  bcs: RedeemEvent.bcs,
182
192
  fromJSONField: (field) => RedeemEvent.fromJSONField(field),
183
193
  fromJSON: (json) => RedeemEvent.fromJSON(json),
184
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RedeemEvent.fetch(client, id); }),
194
+ fetch: async (client, id) => RedeemEvent.fetch(client, id),
185
195
  new: (fields) => {
186
196
  return new RedeemEvent([], fields);
187
197
  },
@@ -250,7 +260,11 @@ export class RedeemEvent {
250
260
  };
251
261
  }
252
262
  toJSON() {
253
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
263
+ return {
264
+ $typeName: this.$typeName,
265
+ $typeArgs: this.$typeArgs,
266
+ ...this.toJSONField(),
267
+ };
254
268
  }
255
269
  static fromJSONField(field) {
256
270
  return RedeemEvent.reified().new({
@@ -267,29 +281,35 @@ export class RedeemEvent {
267
281
  }
268
282
  return RedeemEvent.fromJSONField(json);
269
283
  }
270
- static fetch(client, id) {
271
- return __awaiter(this, void 0, void 0, function* () {
272
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
273
- if (!isRedeemEvent(object.type)) {
274
- throw new Error(`object at id ${id} is not a RedeemEvent object`);
275
- }
276
- return RedeemEvent.fromBcs(object.content);
277
- });
284
+ static async fetch(client, id) {
285
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
286
+ if (!isRedeemEvent(object.type)) {
287
+ throw new Error(`object at id ${id} is not a RedeemEvent object`);
288
+ }
289
+ return RedeemEvent.fromBcs(object.content);
278
290
  }
279
291
  }
280
- RedeemEvent.$typeName = `${PKG_V1}::lending_market::RedeemEvent`;
281
- RedeemEvent.$numTypeParams = 0;
282
- RedeemEvent.$isPhantom = [];
283
292
  /* ============================== BorrowEvent =============================== */
284
293
  export function isBorrowEvent(type) {
285
294
  type = compressSuiType(type);
286
295
  return type === `${PKG_V1}::lending_market::BorrowEvent`;
287
296
  }
288
297
  export class BorrowEvent {
298
+ __StructClass = true;
299
+ static $typeName = `${PKG_V1}::lending_market::BorrowEvent`;
300
+ static $numTypeParams = 0;
301
+ static $isPhantom = [];
302
+ $typeName = BorrowEvent.$typeName;
303
+ $fullTypeName;
304
+ $typeArgs;
305
+ $isPhantom = BorrowEvent.$isPhantom;
306
+ lendingMarketId;
307
+ coinType;
308
+ reserveId;
309
+ obligationId;
310
+ liquidityAmount;
311
+ originationFeeAmount;
289
312
  constructor(typeArgs, fields) {
290
- this.__StructClass = true;
291
- this.$typeName = BorrowEvent.$typeName;
292
- this.$isPhantom = BorrowEvent.$isPhantom;
293
313
  this.$fullTypeName = composeSuiType(BorrowEvent.$typeName, ...typeArgs);
294
314
  this.$typeArgs = typeArgs;
295
315
  this.lendingMarketId = fields.lendingMarketId;
@@ -312,7 +332,7 @@ export class BorrowEvent {
312
332
  bcs: BorrowEvent.bcs,
313
333
  fromJSONField: (field) => BorrowEvent.fromJSONField(field),
314
334
  fromJSON: (json) => BorrowEvent.fromJSON(json),
315
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return BorrowEvent.fetch(client, id); }),
335
+ fetch: async (client, id) => BorrowEvent.fetch(client, id),
316
336
  new: (fields) => {
317
337
  return new BorrowEvent([], fields);
318
338
  },
@@ -390,7 +410,11 @@ export class BorrowEvent {
390
410
  };
391
411
  }
392
412
  toJSON() {
393
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
413
+ return {
414
+ $typeName: this.$typeName,
415
+ $typeArgs: this.$typeArgs,
416
+ ...this.toJSONField(),
417
+ };
394
418
  }
395
419
  static fromJSONField(field) {
396
420
  return BorrowEvent.reified().new({
@@ -408,29 +432,36 @@ export class BorrowEvent {
408
432
  }
409
433
  return BorrowEvent.fromJSONField(json);
410
434
  }
411
- static fetch(client, id) {
412
- return __awaiter(this, void 0, void 0, function* () {
413
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
414
- if (!isBorrowEvent(object.type)) {
415
- throw new Error(`object at id ${id} is not a BorrowEvent object`);
416
- }
417
- return BorrowEvent.fromBcs(object.content);
418
- });
435
+ static async fetch(client, id) {
436
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
437
+ if (!isBorrowEvent(object.type)) {
438
+ throw new Error(`object at id ${id} is not a BorrowEvent object`);
439
+ }
440
+ return BorrowEvent.fromBcs(object.content);
419
441
  }
420
442
  }
421
- BorrowEvent.$typeName = `${PKG_V1}::lending_market::BorrowEvent`;
422
- BorrowEvent.$numTypeParams = 0;
423
- BorrowEvent.$isPhantom = [];
424
443
  /* ============================== ClaimRewardEvent =============================== */
425
444
  export function isClaimRewardEvent(type) {
426
445
  type = compressSuiType(type);
427
446
  return type === `${PKG_V1}::lending_market::ClaimRewardEvent`;
428
447
  }
429
448
  export class ClaimRewardEvent {
449
+ __StructClass = true;
450
+ static $typeName = `${PKG_V1}::lending_market::ClaimRewardEvent`;
451
+ static $numTypeParams = 0;
452
+ static $isPhantom = [];
453
+ $typeName = ClaimRewardEvent.$typeName;
454
+ $fullTypeName;
455
+ $typeArgs;
456
+ $isPhantom = ClaimRewardEvent.$isPhantom;
457
+ lendingMarketId;
458
+ reserveId;
459
+ obligationId;
460
+ isDepositReward;
461
+ poolRewardId;
462
+ coinType;
463
+ liquidityAmount;
430
464
  constructor(typeArgs, fields) {
431
- this.__StructClass = true;
432
- this.$typeName = ClaimRewardEvent.$typeName;
433
- this.$isPhantom = ClaimRewardEvent.$isPhantom;
434
465
  this.$fullTypeName = composeSuiType(ClaimRewardEvent.$typeName, ...typeArgs);
435
466
  this.$typeArgs = typeArgs;
436
467
  this.lendingMarketId = fields.lendingMarketId;
@@ -454,7 +485,7 @@ export class ClaimRewardEvent {
454
485
  bcs: ClaimRewardEvent.bcs,
455
486
  fromJSONField: (field) => ClaimRewardEvent.fromJSONField(field),
456
487
  fromJSON: (json) => ClaimRewardEvent.fromJSON(json),
457
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ClaimRewardEvent.fetch(client, id); }),
488
+ fetch: async (client, id) => ClaimRewardEvent.fetch(client, id),
458
489
  new: (fields) => {
459
490
  return new ClaimRewardEvent([], fields);
460
491
  },
@@ -541,7 +572,11 @@ export class ClaimRewardEvent {
541
572
  };
542
573
  }
543
574
  toJSON() {
544
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
575
+ return {
576
+ $typeName: this.$typeName,
577
+ $typeArgs: this.$typeArgs,
578
+ ...this.toJSONField(),
579
+ };
545
580
  }
546
581
  static fromJSONField(field) {
547
582
  return ClaimRewardEvent.reified().new({
@@ -560,29 +595,34 @@ export class ClaimRewardEvent {
560
595
  }
561
596
  return ClaimRewardEvent.fromJSONField(json);
562
597
  }
563
- static fetch(client, id) {
564
- return __awaiter(this, void 0, void 0, function* () {
565
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
566
- if (!isClaimRewardEvent(object.type)) {
567
- throw new Error(`object at id ${id} is not a ClaimRewardEvent object`);
568
- }
569
- return ClaimRewardEvent.fromBcs(object.content);
570
- });
598
+ static async fetch(client, id) {
599
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
600
+ if (!isClaimRewardEvent(object.type)) {
601
+ throw new Error(`object at id ${id} is not a ClaimRewardEvent object`);
602
+ }
603
+ return ClaimRewardEvent.fromBcs(object.content);
571
604
  }
572
605
  }
573
- ClaimRewardEvent.$typeName = `${PKG_V1}::lending_market::ClaimRewardEvent`;
574
- ClaimRewardEvent.$numTypeParams = 0;
575
- ClaimRewardEvent.$isPhantom = [];
576
606
  /* ============================== DepositEvent =============================== */
577
607
  export function isDepositEvent(type) {
578
608
  type = compressSuiType(type);
579
609
  return type === `${PKG_V1}::lending_market::DepositEvent`;
580
610
  }
581
611
  export class DepositEvent {
612
+ __StructClass = true;
613
+ static $typeName = `${PKG_V1}::lending_market::DepositEvent`;
614
+ static $numTypeParams = 0;
615
+ static $isPhantom = [];
616
+ $typeName = DepositEvent.$typeName;
617
+ $fullTypeName;
618
+ $typeArgs;
619
+ $isPhantom = DepositEvent.$isPhantom;
620
+ lendingMarketId;
621
+ coinType;
622
+ reserveId;
623
+ obligationId;
624
+ ctokenAmount;
582
625
  constructor(typeArgs, fields) {
583
- this.__StructClass = true;
584
- this.$typeName = DepositEvent.$typeName;
585
- this.$isPhantom = DepositEvent.$isPhantom;
586
626
  this.$fullTypeName = composeSuiType(DepositEvent.$typeName, ...typeArgs);
587
627
  this.$typeArgs = typeArgs;
588
628
  this.lendingMarketId = fields.lendingMarketId;
@@ -604,7 +644,7 @@ export class DepositEvent {
604
644
  bcs: DepositEvent.bcs,
605
645
  fromJSONField: (field) => DepositEvent.fromJSONField(field),
606
646
  fromJSON: (json) => DepositEvent.fromJSON(json),
607
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return DepositEvent.fetch(client, id); }),
647
+ fetch: async (client, id) => DepositEvent.fetch(client, id),
608
648
  new: (fields) => {
609
649
  return new DepositEvent([], fields);
610
650
  },
@@ -678,7 +718,11 @@ export class DepositEvent {
678
718
  };
679
719
  }
680
720
  toJSON() {
681
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
721
+ return {
722
+ $typeName: this.$typeName,
723
+ $typeArgs: this.$typeArgs,
724
+ ...this.toJSONField(),
725
+ };
682
726
  }
683
727
  static fromJSONField(field) {
684
728
  return DepositEvent.reified().new({
@@ -695,29 +739,32 @@ export class DepositEvent {
695
739
  }
696
740
  return DepositEvent.fromJSONField(json);
697
741
  }
698
- static fetch(client, id) {
699
- return __awaiter(this, void 0, void 0, function* () {
700
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
701
- if (!isDepositEvent(object.type)) {
702
- throw new Error(`object at id ${id} is not a DepositEvent object`);
703
- }
704
- return DepositEvent.fromBcs(object.content);
705
- });
742
+ static async fetch(client, id) {
743
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
744
+ if (!isDepositEvent(object.type)) {
745
+ throw new Error(`object at id ${id} is not a DepositEvent object`);
746
+ }
747
+ return DepositEvent.fromBcs(object.content);
706
748
  }
707
749
  }
708
- DepositEvent.$typeName = `${PKG_V1}::lending_market::DepositEvent`;
709
- DepositEvent.$numTypeParams = 0;
710
- DepositEvent.$isPhantom = [];
711
750
  /* ============================== FeeReceivers =============================== */
712
751
  export function isFeeReceivers(type) {
713
752
  type = compressSuiType(type);
714
753
  return type === `${PKG_V10}::lending_market::FeeReceivers`;
715
754
  }
716
755
  export class FeeReceivers {
756
+ __StructClass = true;
757
+ static $typeName = `${PKG_V10}::lending_market::FeeReceivers`;
758
+ static $numTypeParams = 0;
759
+ static $isPhantom = [];
760
+ $typeName = FeeReceivers.$typeName;
761
+ $fullTypeName;
762
+ $typeArgs;
763
+ $isPhantom = FeeReceivers.$isPhantom;
764
+ receivers;
765
+ weights;
766
+ totalWeight;
717
767
  constructor(typeArgs, fields) {
718
- this.__StructClass = true;
719
- this.$typeName = FeeReceivers.$typeName;
720
- this.$isPhantom = FeeReceivers.$isPhantom;
721
768
  this.$fullTypeName = composeSuiType(FeeReceivers.$typeName, ...typeArgs);
722
769
  this.$typeArgs = typeArgs;
723
770
  this.receivers = fields.receivers;
@@ -737,7 +784,7 @@ export class FeeReceivers {
737
784
  bcs: FeeReceivers.bcs,
738
785
  fromJSONField: (field) => FeeReceivers.fromJSONField(field),
739
786
  fromJSON: (json) => FeeReceivers.fromJSON(json),
740
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return FeeReceivers.fetch(client, id); }),
787
+ fetch: async (client, id) => FeeReceivers.fetch(client, id),
741
788
  new: (fields) => {
742
789
  return new FeeReceivers([], fields);
743
790
  },
@@ -793,7 +840,11 @@ export class FeeReceivers {
793
840
  };
794
841
  }
795
842
  toJSON() {
796
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
843
+ return {
844
+ $typeName: this.$typeName,
845
+ $typeArgs: this.$typeArgs,
846
+ ...this.toJSONField(),
847
+ };
797
848
  }
798
849
  static fromJSONField(field) {
799
850
  return FeeReceivers.reified().new({
@@ -808,29 +859,30 @@ export class FeeReceivers {
808
859
  }
809
860
  return FeeReceivers.fromJSONField(json);
810
861
  }
811
- static fetch(client, id) {
812
- return __awaiter(this, void 0, void 0, function* () {
813
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
814
- if (!isFeeReceivers(object.type)) {
815
- throw new Error(`object at id ${id} is not a FeeReceivers object`);
816
- }
817
- return FeeReceivers.fromBcs(object.content);
818
- });
862
+ static async fetch(client, id) {
863
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
864
+ if (!isFeeReceivers(object.type)) {
865
+ throw new Error(`object at id ${id} is not a FeeReceivers object`);
866
+ }
867
+ return FeeReceivers.fromBcs(object.content);
819
868
  }
820
869
  }
821
- FeeReceivers.$typeName = `${PKG_V10}::lending_market::FeeReceivers`;
822
- FeeReceivers.$numTypeParams = 0;
823
- FeeReceivers.$isPhantom = [];
824
870
  /* ============================== FeeReceiversKey =============================== */
825
871
  export function isFeeReceiversKey(type) {
826
872
  type = compressSuiType(type);
827
873
  return type === `${PKG_V10}::lending_market::FeeReceiversKey`;
828
874
  }
829
875
  export class FeeReceiversKey {
876
+ __StructClass = true;
877
+ static $typeName = `${PKG_V10}::lending_market::FeeReceiversKey`;
878
+ static $numTypeParams = 0;
879
+ static $isPhantom = [];
880
+ $typeName = FeeReceiversKey.$typeName;
881
+ $fullTypeName;
882
+ $typeArgs;
883
+ $isPhantom = FeeReceiversKey.$isPhantom;
884
+ dummyField;
830
885
  constructor(typeArgs, fields) {
831
- this.__StructClass = true;
832
- this.$typeName = FeeReceiversKey.$typeName;
833
- this.$isPhantom = FeeReceiversKey.$isPhantom;
834
886
  this.$fullTypeName = composeSuiType(FeeReceiversKey.$typeName, ...typeArgs);
835
887
  this.$typeArgs = typeArgs;
836
888
  this.dummyField = fields.dummyField;
@@ -848,7 +900,7 @@ export class FeeReceiversKey {
848
900
  bcs: FeeReceiversKey.bcs,
849
901
  fromJSONField: (field) => FeeReceiversKey.fromJSONField(field),
850
902
  fromJSON: (json) => FeeReceiversKey.fromJSON(json),
851
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return FeeReceiversKey.fetch(client, id); }),
903
+ fetch: async (client, id) => FeeReceiversKey.fetch(client, id),
852
904
  new: (fields) => {
853
905
  return new FeeReceiversKey([], fields);
854
906
  },
@@ -891,7 +943,11 @@ export class FeeReceiversKey {
891
943
  };
892
944
  }
893
945
  toJSON() {
894
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
946
+ return {
947
+ $typeName: this.$typeName,
948
+ $typeArgs: this.$typeArgs,
949
+ ...this.toJSONField(),
950
+ };
895
951
  }
896
952
  static fromJSONField(field) {
897
953
  return FeeReceiversKey.reified().new({
@@ -904,29 +960,34 @@ export class FeeReceiversKey {
904
960
  }
905
961
  return FeeReceiversKey.fromJSONField(json);
906
962
  }
907
- static fetch(client, id) {
908
- return __awaiter(this, void 0, void 0, function* () {
909
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
910
- if (!isFeeReceiversKey(object.type)) {
911
- throw new Error(`object at id ${id} is not a FeeReceiversKey object`);
912
- }
913
- return FeeReceiversKey.fromBcs(object.content);
914
- });
963
+ static async fetch(client, id) {
964
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
965
+ if (!isFeeReceiversKey(object.type)) {
966
+ throw new Error(`object at id ${id} is not a FeeReceiversKey object`);
967
+ }
968
+ return FeeReceiversKey.fromBcs(object.content);
915
969
  }
916
970
  }
917
- FeeReceiversKey.$typeName = `${PKG_V10}::lending_market::FeeReceiversKey`;
918
- FeeReceiversKey.$numTypeParams = 0;
919
- FeeReceiversKey.$isPhantom = [];
920
971
  /* ============================== ForgiveEvent =============================== */
921
972
  export function isForgiveEvent(type) {
922
973
  type = compressSuiType(type);
923
974
  return type === `${PKG_V1}::lending_market::ForgiveEvent`;
924
975
  }
925
976
  export class ForgiveEvent {
977
+ __StructClass = true;
978
+ static $typeName = `${PKG_V1}::lending_market::ForgiveEvent`;
979
+ static $numTypeParams = 0;
980
+ static $isPhantom = [];
981
+ $typeName = ForgiveEvent.$typeName;
982
+ $fullTypeName;
983
+ $typeArgs;
984
+ $isPhantom = ForgiveEvent.$isPhantom;
985
+ lendingMarketId;
986
+ coinType;
987
+ reserveId;
988
+ obligationId;
989
+ liquidityAmount;
926
990
  constructor(typeArgs, fields) {
927
- this.__StructClass = true;
928
- this.$typeName = ForgiveEvent.$typeName;
929
- this.$isPhantom = ForgiveEvent.$isPhantom;
930
991
  this.$fullTypeName = composeSuiType(ForgiveEvent.$typeName, ...typeArgs);
931
992
  this.$typeArgs = typeArgs;
932
993
  this.lendingMarketId = fields.lendingMarketId;
@@ -948,7 +1009,7 @@ export class ForgiveEvent {
948
1009
  bcs: ForgiveEvent.bcs,
949
1010
  fromJSONField: (field) => ForgiveEvent.fromJSONField(field),
950
1011
  fromJSON: (json) => ForgiveEvent.fromJSON(json),
951
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ForgiveEvent.fetch(client, id); }),
1012
+ fetch: async (client, id) => ForgiveEvent.fetch(client, id),
952
1013
  new: (fields) => {
953
1014
  return new ForgiveEvent([], fields);
954
1015
  },
@@ -1022,7 +1083,11 @@ export class ForgiveEvent {
1022
1083
  };
1023
1084
  }
1024
1085
  toJSON() {
1025
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1086
+ return {
1087
+ $typeName: this.$typeName,
1088
+ $typeArgs: this.$typeArgs,
1089
+ ...this.toJSONField(),
1090
+ };
1026
1091
  }
1027
1092
  static fromJSONField(field) {
1028
1093
  return ForgiveEvent.reified().new({
@@ -1039,29 +1104,30 @@ export class ForgiveEvent {
1039
1104
  }
1040
1105
  return ForgiveEvent.fromJSONField(json);
1041
1106
  }
1042
- static fetch(client, id) {
1043
- return __awaiter(this, void 0, void 0, function* () {
1044
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1045
- if (!isForgiveEvent(object.type)) {
1046
- throw new Error(`object at id ${id} is not a ForgiveEvent object`);
1047
- }
1048
- return ForgiveEvent.fromBcs(object.content);
1049
- });
1107
+ static async fetch(client, id) {
1108
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1109
+ if (!isForgiveEvent(object.type)) {
1110
+ throw new Error(`object at id ${id} is not a ForgiveEvent object`);
1111
+ }
1112
+ return ForgiveEvent.fromBcs(object.content);
1050
1113
  }
1051
1114
  }
1052
- ForgiveEvent.$typeName = `${PKG_V1}::lending_market::ForgiveEvent`;
1053
- ForgiveEvent.$numTypeParams = 0;
1054
- ForgiveEvent.$isPhantom = [];
1055
1115
  /* ============================== LENDING_MARKET =============================== */
1056
1116
  export function isLENDING_MARKET(type) {
1057
1117
  type = compressSuiType(type);
1058
1118
  return type === `${PKG_V1}::lending_market::LENDING_MARKET`;
1059
1119
  }
1060
1120
  export class LENDING_MARKET {
1121
+ __StructClass = true;
1122
+ static $typeName = `${PKG_V1}::lending_market::LENDING_MARKET`;
1123
+ static $numTypeParams = 0;
1124
+ static $isPhantom = [];
1125
+ $typeName = LENDING_MARKET.$typeName;
1126
+ $fullTypeName;
1127
+ $typeArgs;
1128
+ $isPhantom = LENDING_MARKET.$isPhantom;
1129
+ dummyField;
1061
1130
  constructor(typeArgs, fields) {
1062
- this.__StructClass = true;
1063
- this.$typeName = LENDING_MARKET.$typeName;
1064
- this.$isPhantom = LENDING_MARKET.$isPhantom;
1065
1131
  this.$fullTypeName = composeSuiType(LENDING_MARKET.$typeName, ...typeArgs);
1066
1132
  this.$typeArgs = typeArgs;
1067
1133
  this.dummyField = fields.dummyField;
@@ -1079,7 +1145,7 @@ export class LENDING_MARKET {
1079
1145
  bcs: LENDING_MARKET.bcs,
1080
1146
  fromJSONField: (field) => LENDING_MARKET.fromJSONField(field),
1081
1147
  fromJSON: (json) => LENDING_MARKET.fromJSON(json),
1082
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LENDING_MARKET.fetch(client, id); }),
1148
+ fetch: async (client, id) => LENDING_MARKET.fetch(client, id),
1083
1149
  new: (fields) => {
1084
1150
  return new LENDING_MARKET([], fields);
1085
1151
  },
@@ -1122,7 +1188,11 @@ export class LENDING_MARKET {
1122
1188
  };
1123
1189
  }
1124
1190
  toJSON() {
1125
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1191
+ return {
1192
+ $typeName: this.$typeName,
1193
+ $typeArgs: this.$typeArgs,
1194
+ ...this.toJSONField(),
1195
+ };
1126
1196
  }
1127
1197
  static fromJSONField(field) {
1128
1198
  return LENDING_MARKET.reified().new({
@@ -1135,29 +1205,37 @@ export class LENDING_MARKET {
1135
1205
  }
1136
1206
  return LENDING_MARKET.fromJSONField(json);
1137
1207
  }
1138
- static fetch(client, id) {
1139
- return __awaiter(this, void 0, void 0, function* () {
1140
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1141
- if (!isLENDING_MARKET(object.type)) {
1142
- throw new Error(`object at id ${id} is not a LENDING_MARKET object`);
1143
- }
1144
- return LENDING_MARKET.fromBcs(object.content);
1145
- });
1208
+ static async fetch(client, id) {
1209
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1210
+ if (!isLENDING_MARKET(object.type)) {
1211
+ throw new Error(`object at id ${id} is not a LENDING_MARKET object`);
1212
+ }
1213
+ return LENDING_MARKET.fromBcs(object.content);
1146
1214
  }
1147
1215
  }
1148
- LENDING_MARKET.$typeName = `${PKG_V1}::lending_market::LENDING_MARKET`;
1149
- LENDING_MARKET.$numTypeParams = 0;
1150
- LENDING_MARKET.$isPhantom = [];
1151
1216
  /* ============================== LendingMarket =============================== */
1152
1217
  export function isLendingMarket(type) {
1153
1218
  type = compressSuiType(type);
1154
1219
  return type.startsWith(`${PKG_V1}::lending_market::LendingMarket` + "<");
1155
1220
  }
1156
1221
  export class LendingMarket {
1222
+ __StructClass = true;
1223
+ static $typeName = `${PKG_V1}::lending_market::LendingMarket`;
1224
+ static $numTypeParams = 1;
1225
+ static $isPhantom = [true];
1226
+ $typeName = LendingMarket.$typeName;
1227
+ $fullTypeName;
1228
+ $typeArgs;
1229
+ $isPhantom = LendingMarket.$isPhantom;
1230
+ id;
1231
+ version;
1232
+ reserves;
1233
+ obligations;
1234
+ rateLimiter;
1235
+ feeReceiver;
1236
+ badDebtUsd;
1237
+ badDebtLimitUsd;
1157
1238
  constructor(typeArgs, fields) {
1158
- this.__StructClass = true;
1159
- this.$typeName = LendingMarket.$typeName;
1160
- this.$isPhantom = LendingMarket.$isPhantom;
1161
1239
  this.$fullTypeName = composeSuiType(LendingMarket.$typeName, ...typeArgs);
1162
1240
  this.$typeArgs = typeArgs;
1163
1241
  this.id = fields.id;
@@ -1182,7 +1260,7 @@ export class LendingMarket {
1182
1260
  bcs: LendingMarket.bcs,
1183
1261
  fromJSONField: (field) => LendingMarket.fromJSONField(P, field),
1184
1262
  fromJSON: (json) => LendingMarket.fromJSON(P, json),
1185
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LendingMarket.fetch(client, P, id); }),
1263
+ fetch: async (client, id) => LendingMarket.fetch(client, P, id),
1186
1264
  new: (fields) => {
1187
1265
  return new LendingMarket([extractType(P)], fields);
1188
1266
  },
@@ -1259,7 +1337,11 @@ export class LendingMarket {
1259
1337
  };
1260
1338
  }
1261
1339
  toJSON() {
1262
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1340
+ return {
1341
+ $typeName: this.$typeName,
1342
+ $typeArgs: this.$typeArgs,
1343
+ ...this.toJSONField(),
1344
+ };
1263
1345
  }
1264
1346
  static fromJSONField(typeArg, field) {
1265
1347
  return LendingMarket.reified(typeArg).new({
@@ -1280,29 +1362,31 @@ export class LendingMarket {
1280
1362
  assertReifiedTypeArgsMatch(composeSuiType(LendingMarket.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
1281
1363
  return LendingMarket.fromJSONField(typeArg, json);
1282
1364
  }
1283
- static fetch(client, typeArg, id) {
1284
- return __awaiter(this, void 0, void 0, function* () {
1285
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1286
- if (!isLendingMarket(object.type)) {
1287
- throw new Error(`object at id ${id} is not a LendingMarket object`);
1288
- }
1289
- return LendingMarket.fromBcs(typeArg, object.content);
1290
- });
1365
+ static async fetch(client, typeArg, id) {
1366
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1367
+ if (!isLendingMarket(object.type)) {
1368
+ throw new Error(`object at id ${id} is not a LendingMarket object`);
1369
+ }
1370
+ return LendingMarket.fromBcs(typeArg, object.content);
1291
1371
  }
1292
1372
  }
1293
- LendingMarket.$typeName = `${PKG_V1}::lending_market::LendingMarket`;
1294
- LendingMarket.$numTypeParams = 1;
1295
- LendingMarket.$isPhantom = [true];
1296
1373
  /* ============================== LendingMarketOwnerCap =============================== */
1297
1374
  export function isLendingMarketOwnerCap(type) {
1298
1375
  type = compressSuiType(type);
1299
1376
  return type.startsWith(`${PKG_V1}::lending_market::LendingMarketOwnerCap` + "<");
1300
1377
  }
1301
1378
  export class LendingMarketOwnerCap {
1379
+ __StructClass = true;
1380
+ static $typeName = `${PKG_V1}::lending_market::LendingMarketOwnerCap`;
1381
+ static $numTypeParams = 1;
1382
+ static $isPhantom = [true];
1383
+ $typeName = LendingMarketOwnerCap.$typeName;
1384
+ $fullTypeName;
1385
+ $typeArgs;
1386
+ $isPhantom = LendingMarketOwnerCap.$isPhantom;
1387
+ id;
1388
+ lendingMarketId;
1302
1389
  constructor(typeArgs, fields) {
1303
- this.__StructClass = true;
1304
- this.$typeName = LendingMarketOwnerCap.$typeName;
1305
- this.$isPhantom = LendingMarketOwnerCap.$isPhantom;
1306
1390
  this.$fullTypeName = composeSuiType(LendingMarketOwnerCap.$typeName, ...typeArgs);
1307
1391
  this.$typeArgs = typeArgs;
1308
1392
  this.id = fields.id;
@@ -1321,7 +1405,7 @@ export class LendingMarketOwnerCap {
1321
1405
  bcs: LendingMarketOwnerCap.bcs,
1322
1406
  fromJSONField: (field) => LendingMarketOwnerCap.fromJSONField(P, field),
1323
1407
  fromJSON: (json) => LendingMarketOwnerCap.fromJSON(P, json),
1324
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LendingMarketOwnerCap.fetch(client, P, id); }),
1408
+ fetch: async (client, id) => LendingMarketOwnerCap.fetch(client, P, id),
1325
1409
  new: (fields) => {
1326
1410
  return new LendingMarketOwnerCap([extractType(P)], fields);
1327
1411
  },
@@ -1369,7 +1453,11 @@ export class LendingMarketOwnerCap {
1369
1453
  };
1370
1454
  }
1371
1455
  toJSON() {
1372
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1456
+ return {
1457
+ $typeName: this.$typeName,
1458
+ $typeArgs: this.$typeArgs,
1459
+ ...this.toJSONField(),
1460
+ };
1373
1461
  }
1374
1462
  static fromJSONField(typeArg, field) {
1375
1463
  return LendingMarketOwnerCap.reified(typeArg).new({
@@ -1384,29 +1472,39 @@ export class LendingMarketOwnerCap {
1384
1472
  assertReifiedTypeArgsMatch(composeSuiType(LendingMarketOwnerCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
1385
1473
  return LendingMarketOwnerCap.fromJSONField(typeArg, json);
1386
1474
  }
1387
- static fetch(client, typeArg, id) {
1388
- return __awaiter(this, void 0, void 0, function* () {
1389
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1390
- if (!isLendingMarketOwnerCap(object.type)) {
1391
- throw new Error(`object at id ${id} is not a LendingMarketOwnerCap object`);
1392
- }
1393
- return LendingMarketOwnerCap.fromBcs(typeArg, object.content);
1394
- });
1475
+ static async fetch(client, typeArg, id) {
1476
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1477
+ if (!isLendingMarketOwnerCap(object.type)) {
1478
+ throw new Error(`object at id ${id} is not a LendingMarketOwnerCap object`);
1479
+ }
1480
+ return LendingMarketOwnerCap.fromBcs(typeArg, object.content);
1395
1481
  }
1396
1482
  }
1397
- LendingMarketOwnerCap.$typeName = `${PKG_V1}::lending_market::LendingMarketOwnerCap`;
1398
- LendingMarketOwnerCap.$numTypeParams = 1;
1399
- LendingMarketOwnerCap.$isPhantom = [true];
1400
1483
  /* ============================== LiquidateEvent =============================== */
1401
1484
  export function isLiquidateEvent(type) {
1402
1485
  type = compressSuiType(type);
1403
1486
  return type === `${PKG_V1}::lending_market::LiquidateEvent`;
1404
1487
  }
1405
1488
  export class LiquidateEvent {
1489
+ __StructClass = true;
1490
+ static $typeName = `${PKG_V1}::lending_market::LiquidateEvent`;
1491
+ static $numTypeParams = 0;
1492
+ static $isPhantom = [];
1493
+ $typeName = LiquidateEvent.$typeName;
1494
+ $fullTypeName;
1495
+ $typeArgs;
1496
+ $isPhantom = LiquidateEvent.$isPhantom;
1497
+ lendingMarketId;
1498
+ repayReserveId;
1499
+ withdrawReserveId;
1500
+ obligationId;
1501
+ repayCoinType;
1502
+ withdrawCoinType;
1503
+ repayAmount;
1504
+ withdrawAmount;
1505
+ protocolFeeAmount;
1506
+ liquidatorBonusAmount;
1406
1507
  constructor(typeArgs, fields) {
1407
- this.__StructClass = true;
1408
- this.$typeName = LiquidateEvent.$typeName;
1409
- this.$isPhantom = LiquidateEvent.$isPhantom;
1410
1508
  this.$fullTypeName = composeSuiType(LiquidateEvent.$typeName, ...typeArgs);
1411
1509
  this.$typeArgs = typeArgs;
1412
1510
  this.lendingMarketId = fields.lendingMarketId;
@@ -1433,7 +1531,7 @@ export class LiquidateEvent {
1433
1531
  bcs: LiquidateEvent.bcs,
1434
1532
  fromJSONField: (field) => LiquidateEvent.fromJSONField(field),
1435
1533
  fromJSON: (json) => LiquidateEvent.fromJSON(json),
1436
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LiquidateEvent.fetch(client, id); }),
1534
+ fetch: async (client, id) => LiquidateEvent.fetch(client, id),
1437
1535
  new: (fields) => {
1438
1536
  return new LiquidateEvent([], fields);
1439
1537
  },
@@ -1532,7 +1630,11 @@ export class LiquidateEvent {
1532
1630
  };
1533
1631
  }
1534
1632
  toJSON() {
1535
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1633
+ return {
1634
+ $typeName: this.$typeName,
1635
+ $typeArgs: this.$typeArgs,
1636
+ ...this.toJSONField(),
1637
+ };
1536
1638
  }
1537
1639
  static fromJSONField(field) {
1538
1640
  return LiquidateEvent.reified().new({
@@ -1554,29 +1656,31 @@ export class LiquidateEvent {
1554
1656
  }
1555
1657
  return LiquidateEvent.fromJSONField(json);
1556
1658
  }
1557
- static fetch(client, id) {
1558
- return __awaiter(this, void 0, void 0, function* () {
1559
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1560
- if (!isLiquidateEvent(object.type)) {
1561
- throw new Error(`object at id ${id} is not a LiquidateEvent object`);
1562
- }
1563
- return LiquidateEvent.fromBcs(object.content);
1564
- });
1659
+ static async fetch(client, id) {
1660
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1661
+ if (!isLiquidateEvent(object.type)) {
1662
+ throw new Error(`object at id ${id} is not a LiquidateEvent object`);
1663
+ }
1664
+ return LiquidateEvent.fromBcs(object.content);
1565
1665
  }
1566
1666
  }
1567
- LiquidateEvent.$typeName = `${PKG_V1}::lending_market::LiquidateEvent`;
1568
- LiquidateEvent.$numTypeParams = 0;
1569
- LiquidateEvent.$isPhantom = [];
1570
1667
  /* ============================== ObligationOwnerCap =============================== */
1571
1668
  export function isObligationOwnerCap(type) {
1572
1669
  type = compressSuiType(type);
1573
1670
  return type.startsWith(`${PKG_V1}::lending_market::ObligationOwnerCap` + "<");
1574
1671
  }
1575
1672
  export class ObligationOwnerCap {
1673
+ __StructClass = true;
1674
+ static $typeName = `${PKG_V1}::lending_market::ObligationOwnerCap`;
1675
+ static $numTypeParams = 1;
1676
+ static $isPhantom = [true];
1677
+ $typeName = ObligationOwnerCap.$typeName;
1678
+ $fullTypeName;
1679
+ $typeArgs;
1680
+ $isPhantom = ObligationOwnerCap.$isPhantom;
1681
+ id;
1682
+ obligationId;
1576
1683
  constructor(typeArgs, fields) {
1577
- this.__StructClass = true;
1578
- this.$typeName = ObligationOwnerCap.$typeName;
1579
- this.$isPhantom = ObligationOwnerCap.$isPhantom;
1580
1684
  this.$fullTypeName = composeSuiType(ObligationOwnerCap.$typeName, ...typeArgs);
1581
1685
  this.$typeArgs = typeArgs;
1582
1686
  this.id = fields.id;
@@ -1595,7 +1699,7 @@ export class ObligationOwnerCap {
1595
1699
  bcs: ObligationOwnerCap.bcs,
1596
1700
  fromJSONField: (field) => ObligationOwnerCap.fromJSONField(P, field),
1597
1701
  fromJSON: (json) => ObligationOwnerCap.fromJSON(P, json),
1598
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ObligationOwnerCap.fetch(client, P, id); }),
1702
+ fetch: async (client, id) => ObligationOwnerCap.fetch(client, P, id),
1599
1703
  new: (fields) => {
1600
1704
  return new ObligationOwnerCap([extractType(P)], fields);
1601
1705
  },
@@ -1643,7 +1747,11 @@ export class ObligationOwnerCap {
1643
1747
  };
1644
1748
  }
1645
1749
  toJSON() {
1646
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1750
+ return {
1751
+ $typeName: this.$typeName,
1752
+ $typeArgs: this.$typeArgs,
1753
+ ...this.toJSONField(),
1754
+ };
1647
1755
  }
1648
1756
  static fromJSONField(typeArg, field) {
1649
1757
  return ObligationOwnerCap.reified(typeArg).new({
@@ -1658,29 +1766,30 @@ export class ObligationOwnerCap {
1658
1766
  assertReifiedTypeArgsMatch(composeSuiType(ObligationOwnerCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
1659
1767
  return ObligationOwnerCap.fromJSONField(typeArg, json);
1660
1768
  }
1661
- static fetch(client, typeArg, id) {
1662
- return __awaiter(this, void 0, void 0, function* () {
1663
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1664
- if (!isObligationOwnerCap(object.type)) {
1665
- throw new Error(`object at id ${id} is not a ObligationOwnerCap object`);
1666
- }
1667
- return ObligationOwnerCap.fromBcs(typeArg, object.content);
1668
- });
1769
+ static async fetch(client, typeArg, id) {
1770
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1771
+ if (!isObligationOwnerCap(object.type)) {
1772
+ throw new Error(`object at id ${id} is not a ObligationOwnerCap object`);
1773
+ }
1774
+ return ObligationOwnerCap.fromBcs(typeArg, object.content);
1669
1775
  }
1670
1776
  }
1671
- ObligationOwnerCap.$typeName = `${PKG_V1}::lending_market::ObligationOwnerCap`;
1672
- ObligationOwnerCap.$numTypeParams = 1;
1673
- ObligationOwnerCap.$isPhantom = [true];
1674
1777
  /* ============================== RateLimiterExemption =============================== */
1675
1778
  export function isRateLimiterExemption(type) {
1676
1779
  type = compressSuiType(type);
1677
1780
  return type.startsWith(`${PKG_V1}::lending_market::RateLimiterExemption` + "<");
1678
1781
  }
1679
1782
  export class RateLimiterExemption {
1783
+ __StructClass = true;
1784
+ static $typeName = `${PKG_V1}::lending_market::RateLimiterExemption`;
1785
+ static $numTypeParams = 2;
1786
+ static $isPhantom = [true, true];
1787
+ $typeName = RateLimiterExemption.$typeName;
1788
+ $fullTypeName;
1789
+ $typeArgs;
1790
+ $isPhantom = RateLimiterExemption.$isPhantom;
1791
+ amount;
1680
1792
  constructor(typeArgs, fields) {
1681
- this.__StructClass = true;
1682
- this.$typeName = RateLimiterExemption.$typeName;
1683
- this.$isPhantom = RateLimiterExemption.$isPhantom;
1684
1793
  this.$fullTypeName = composeSuiType(RateLimiterExemption.$typeName, ...typeArgs);
1685
1794
  this.$typeArgs = typeArgs;
1686
1795
  this.amount = fields.amount;
@@ -1698,7 +1807,7 @@ export class RateLimiterExemption {
1698
1807
  bcs: RateLimiterExemption.bcs,
1699
1808
  fromJSONField: (field) => RateLimiterExemption.fromJSONField([P, T], field),
1700
1809
  fromJSON: (json) => RateLimiterExemption.fromJSON([P, T], json),
1701
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RateLimiterExemption.fetch(client, [P, T], id); }),
1810
+ fetch: async (client, id) => RateLimiterExemption.fetch(client, [P, T], id),
1702
1811
  new: (fields) => {
1703
1812
  return new RateLimiterExemption([extractType(P), extractType(T)], fields);
1704
1813
  },
@@ -1742,7 +1851,11 @@ export class RateLimiterExemption {
1742
1851
  };
1743
1852
  }
1744
1853
  toJSON() {
1745
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1854
+ return {
1855
+ $typeName: this.$typeName,
1856
+ $typeArgs: this.$typeArgs,
1857
+ ...this.toJSONField(),
1858
+ };
1746
1859
  }
1747
1860
  static fromJSONField(typeArgs, field) {
1748
1861
  return RateLimiterExemption.reified(typeArgs[0], typeArgs[1]).new({
@@ -1756,29 +1869,34 @@ export class RateLimiterExemption {
1756
1869
  assertReifiedTypeArgsMatch(composeSuiType(RateLimiterExemption.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
1757
1870
  return RateLimiterExemption.fromJSONField(typeArgs, json);
1758
1871
  }
1759
- static fetch(client, typeArgs, id) {
1760
- return __awaiter(this, void 0, void 0, function* () {
1761
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1762
- if (!isRateLimiterExemption(object.type)) {
1763
- throw new Error(`object at id ${id} is not a RateLimiterExemption object`);
1764
- }
1765
- return RateLimiterExemption.fromBcs(typeArgs, object.content);
1766
- });
1872
+ static async fetch(client, typeArgs, id) {
1873
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1874
+ if (!isRateLimiterExemption(object.type)) {
1875
+ throw new Error(`object at id ${id} is not a RateLimiterExemption object`);
1876
+ }
1877
+ return RateLimiterExemption.fromBcs(typeArgs, object.content);
1767
1878
  }
1768
1879
  }
1769
- RateLimiterExemption.$typeName = `${PKG_V1}::lending_market::RateLimiterExemption`;
1770
- RateLimiterExemption.$numTypeParams = 2;
1771
- RateLimiterExemption.$isPhantom = [true, true];
1772
1880
  /* ============================== RepayEvent =============================== */
1773
1881
  export function isRepayEvent(type) {
1774
1882
  type = compressSuiType(type);
1775
1883
  return type === `${PKG_V1}::lending_market::RepayEvent`;
1776
1884
  }
1777
1885
  export class RepayEvent {
1886
+ __StructClass = true;
1887
+ static $typeName = `${PKG_V1}::lending_market::RepayEvent`;
1888
+ static $numTypeParams = 0;
1889
+ static $isPhantom = [];
1890
+ $typeName = RepayEvent.$typeName;
1891
+ $fullTypeName;
1892
+ $typeArgs;
1893
+ $isPhantom = RepayEvent.$isPhantom;
1894
+ lendingMarketId;
1895
+ coinType;
1896
+ reserveId;
1897
+ obligationId;
1898
+ liquidityAmount;
1778
1899
  constructor(typeArgs, fields) {
1779
- this.__StructClass = true;
1780
- this.$typeName = RepayEvent.$typeName;
1781
- this.$isPhantom = RepayEvent.$isPhantom;
1782
1900
  this.$fullTypeName = composeSuiType(RepayEvent.$typeName, ...typeArgs);
1783
1901
  this.$typeArgs = typeArgs;
1784
1902
  this.lendingMarketId = fields.lendingMarketId;
@@ -1800,7 +1918,7 @@ export class RepayEvent {
1800
1918
  bcs: RepayEvent.bcs,
1801
1919
  fromJSONField: (field) => RepayEvent.fromJSONField(field),
1802
1920
  fromJSON: (json) => RepayEvent.fromJSON(json),
1803
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RepayEvent.fetch(client, id); }),
1921
+ fetch: async (client, id) => RepayEvent.fetch(client, id),
1804
1922
  new: (fields) => {
1805
1923
  return new RepayEvent([], fields);
1806
1924
  },
@@ -1874,7 +1992,11 @@ export class RepayEvent {
1874
1992
  };
1875
1993
  }
1876
1994
  toJSON() {
1877
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1995
+ return {
1996
+ $typeName: this.$typeName,
1997
+ $typeArgs: this.$typeArgs,
1998
+ ...this.toJSONField(),
1999
+ };
1878
2000
  }
1879
2001
  static fromJSONField(field) {
1880
2002
  return RepayEvent.reified().new({
@@ -1891,29 +2013,34 @@ export class RepayEvent {
1891
2013
  }
1892
2014
  return RepayEvent.fromJSONField(json);
1893
2015
  }
1894
- static fetch(client, id) {
1895
- return __awaiter(this, void 0, void 0, function* () {
1896
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1897
- if (!isRepayEvent(object.type)) {
1898
- throw new Error(`object at id ${id} is not a RepayEvent object`);
1899
- }
1900
- return RepayEvent.fromBcs(object.content);
1901
- });
2016
+ static async fetch(client, id) {
2017
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
2018
+ if (!isRepayEvent(object.type)) {
2019
+ throw new Error(`object at id ${id} is not a RepayEvent object`);
2020
+ }
2021
+ return RepayEvent.fromBcs(object.content);
1902
2022
  }
1903
2023
  }
1904
- RepayEvent.$typeName = `${PKG_V1}::lending_market::RepayEvent`;
1905
- RepayEvent.$numTypeParams = 0;
1906
- RepayEvent.$isPhantom = [];
1907
2024
  /* ============================== WithdrawEvent =============================== */
1908
2025
  export function isWithdrawEvent(type) {
1909
2026
  type = compressSuiType(type);
1910
2027
  return type === `${PKG_V1}::lending_market::WithdrawEvent`;
1911
2028
  }
1912
2029
  export class WithdrawEvent {
2030
+ __StructClass = true;
2031
+ static $typeName = `${PKG_V1}::lending_market::WithdrawEvent`;
2032
+ static $numTypeParams = 0;
2033
+ static $isPhantom = [];
2034
+ $typeName = WithdrawEvent.$typeName;
2035
+ $fullTypeName;
2036
+ $typeArgs;
2037
+ $isPhantom = WithdrawEvent.$isPhantom;
2038
+ lendingMarketId;
2039
+ coinType;
2040
+ reserveId;
2041
+ obligationId;
2042
+ ctokenAmount;
1913
2043
  constructor(typeArgs, fields) {
1914
- this.__StructClass = true;
1915
- this.$typeName = WithdrawEvent.$typeName;
1916
- this.$isPhantom = WithdrawEvent.$isPhantom;
1917
2044
  this.$fullTypeName = composeSuiType(WithdrawEvent.$typeName, ...typeArgs);
1918
2045
  this.$typeArgs = typeArgs;
1919
2046
  this.lendingMarketId = fields.lendingMarketId;
@@ -1935,7 +2062,7 @@ export class WithdrawEvent {
1935
2062
  bcs: WithdrawEvent.bcs,
1936
2063
  fromJSONField: (field) => WithdrawEvent.fromJSONField(field),
1937
2064
  fromJSON: (json) => WithdrawEvent.fromJSON(json),
1938
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return WithdrawEvent.fetch(client, id); }),
2065
+ fetch: async (client, id) => WithdrawEvent.fetch(client, id),
1939
2066
  new: (fields) => {
1940
2067
  return new WithdrawEvent([], fields);
1941
2068
  },
@@ -2009,7 +2136,11 @@ export class WithdrawEvent {
2009
2136
  };
2010
2137
  }
2011
2138
  toJSON() {
2012
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
2139
+ return {
2140
+ $typeName: this.$typeName,
2141
+ $typeArgs: this.$typeArgs,
2142
+ ...this.toJSONField(),
2143
+ };
2013
2144
  }
2014
2145
  static fromJSONField(field) {
2015
2146
  return WithdrawEvent.reified().new({
@@ -2026,16 +2157,11 @@ export class WithdrawEvent {
2026
2157
  }
2027
2158
  return WithdrawEvent.fromJSONField(json);
2028
2159
  }
2029
- static fetch(client, id) {
2030
- return __awaiter(this, void 0, void 0, function* () {
2031
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
2032
- if (!isWithdrawEvent(object.type)) {
2033
- throw new Error(`object at id ${id} is not a WithdrawEvent object`);
2034
- }
2035
- return WithdrawEvent.fromBcs(object.content);
2036
- });
2160
+ static async fetch(client, id) {
2161
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
2162
+ if (!isWithdrawEvent(object.type)) {
2163
+ throw new Error(`object at id ${id} is not a WithdrawEvent object`);
2164
+ }
2165
+ return WithdrawEvent.fromBcs(object.content);
2037
2166
  }
2038
2167
  }
2039
- WithdrawEvent.$typeName = `${PKG_V1}::lending_market::WithdrawEvent`;
2040
- WithdrawEvent.$numTypeParams = 0;
2041
- WithdrawEvent.$isPhantom = [];