@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 { Balance, Supply, } from "../../_dependencies/source/0x2/balance/structs.js";
@@ -27,10 +18,16 @@ export function isBalanceKey(type) {
27
18
  return type === `${PKG_V1}::reserve::BalanceKey`;
28
19
  }
29
20
  export class BalanceKey {
21
+ __StructClass = true;
22
+ static $typeName = `${PKG_V1}::reserve::BalanceKey`;
23
+ static $numTypeParams = 0;
24
+ static $isPhantom = [];
25
+ $typeName = BalanceKey.$typeName;
26
+ $fullTypeName;
27
+ $typeArgs;
28
+ $isPhantom = BalanceKey.$isPhantom;
29
+ dummyField;
30
30
  constructor(typeArgs, fields) {
31
- this.__StructClass = true;
32
- this.$typeName = BalanceKey.$typeName;
33
- this.$isPhantom = BalanceKey.$isPhantom;
34
31
  this.$fullTypeName = composeSuiType(BalanceKey.$typeName, ...typeArgs);
35
32
  this.$typeArgs = typeArgs;
36
33
  this.dummyField = fields.dummyField;
@@ -48,7 +45,7 @@ export class BalanceKey {
48
45
  bcs: BalanceKey.bcs,
49
46
  fromJSONField: (field) => BalanceKey.fromJSONField(field),
50
47
  fromJSON: (json) => BalanceKey.fromJSON(json),
51
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return BalanceKey.fetch(client, id); }),
48
+ fetch: async (client, id) => BalanceKey.fetch(client, id),
52
49
  new: (fields) => {
53
50
  return new BalanceKey([], fields);
54
51
  },
@@ -91,7 +88,11 @@ export class BalanceKey {
91
88
  };
92
89
  }
93
90
  toJSON() {
94
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
91
+ return {
92
+ $typeName: this.$typeName,
93
+ $typeArgs: this.$typeArgs,
94
+ ...this.toJSONField(),
95
+ };
95
96
  }
96
97
  static fromJSONField(field) {
97
98
  return BalanceKey.reified().new({
@@ -104,29 +105,34 @@ export class BalanceKey {
104
105
  }
105
106
  return BalanceKey.fromJSONField(json);
106
107
  }
107
- static fetch(client, id) {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
110
- if (!isBalanceKey(object.type)) {
111
- throw new Error(`object at id ${id} is not a BalanceKey object`);
112
- }
113
- return BalanceKey.fromBcs(object.content);
114
- });
108
+ static async fetch(client, id) {
109
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
110
+ if (!isBalanceKey(object.type)) {
111
+ throw new Error(`object at id ${id} is not a BalanceKey object`);
112
+ }
113
+ return BalanceKey.fromBcs(object.content);
115
114
  }
116
115
  }
117
- BalanceKey.$typeName = `${PKG_V1}::reserve::BalanceKey`;
118
- BalanceKey.$numTypeParams = 0;
119
- BalanceKey.$isPhantom = [];
120
116
  /* ============================== Balances =============================== */
121
117
  export function isBalances(type) {
122
118
  type = compressSuiType(type);
123
119
  return type.startsWith(`${PKG_V1}::reserve::Balances` + "<");
124
120
  }
125
121
  export class Balances {
122
+ __StructClass = true;
123
+ static $typeName = `${PKG_V1}::reserve::Balances`;
124
+ static $numTypeParams = 2;
125
+ static $isPhantom = [true, true];
126
+ $typeName = Balances.$typeName;
127
+ $fullTypeName;
128
+ $typeArgs;
129
+ $isPhantom = Balances.$isPhantom;
130
+ availableAmount;
131
+ ctokenSupply;
132
+ fees;
133
+ ctokenFees;
134
+ depositedCtokens;
126
135
  constructor(typeArgs, fields) {
127
- this.__StructClass = true;
128
- this.$typeName = Balances.$typeName;
129
- this.$isPhantom = Balances.$isPhantom;
130
136
  this.$fullTypeName = composeSuiType(Balances.$typeName, ...typeArgs);
131
137
  this.$typeArgs = typeArgs;
132
138
  this.availableAmount = fields.availableAmount;
@@ -148,7 +154,7 @@ export class Balances {
148
154
  bcs: Balances.bcs,
149
155
  fromJSONField: (field) => Balances.fromJSONField([P, T], field),
150
156
  fromJSON: (json) => Balances.fromJSON([P, T], json),
151
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Balances.fetch(client, [P, T], id); }),
157
+ fetch: async (client, id) => Balances.fetch(client, [P, T], id),
152
158
  new: (fields) => {
153
159
  return new Balances([extractType(P), extractType(T)], fields);
154
160
  },
@@ -208,7 +214,11 @@ export class Balances {
208
214
  };
209
215
  }
210
216
  toJSON() {
211
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
217
+ return {
218
+ $typeName: this.$typeName,
219
+ $typeArgs: this.$typeArgs,
220
+ ...this.toJSONField(),
221
+ };
212
222
  }
213
223
  static fromJSONField(typeArgs, field) {
214
224
  return Balances.reified(typeArgs[0], typeArgs[1]).new({
@@ -226,29 +236,30 @@ export class Balances {
226
236
  assertReifiedTypeArgsMatch(composeSuiType(Balances.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
227
237
  return Balances.fromJSONField(typeArgs, json);
228
238
  }
229
- static fetch(client, typeArgs, id) {
230
- return __awaiter(this, void 0, void 0, function* () {
231
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
232
- if (!isBalances(object.type)) {
233
- throw new Error(`object at id ${id} is not a Balances object`);
234
- }
235
- return Balances.fromBcs(typeArgs, object.content);
236
- });
239
+ static async fetch(client, typeArgs, id) {
240
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
241
+ if (!isBalances(object.type)) {
242
+ throw new Error(`object at id ${id} is not a Balances object`);
243
+ }
244
+ return Balances.fromBcs(typeArgs, object.content);
237
245
  }
238
246
  }
239
- Balances.$typeName = `${PKG_V1}::reserve::Balances`;
240
- Balances.$numTypeParams = 2;
241
- Balances.$isPhantom = [true, true];
242
247
  /* ============================== CToken =============================== */
243
248
  export function isCToken(type) {
244
249
  type = compressSuiType(type);
245
250
  return type.startsWith(`${PKG_V1}::reserve::CToken` + "<");
246
251
  }
247
252
  export class CToken {
253
+ __StructClass = true;
254
+ static $typeName = `${PKG_V1}::reserve::CToken`;
255
+ static $numTypeParams = 2;
256
+ static $isPhantom = [true, true];
257
+ $typeName = CToken.$typeName;
258
+ $fullTypeName;
259
+ $typeArgs;
260
+ $isPhantom = CToken.$isPhantom;
261
+ dummyField;
248
262
  constructor(typeArgs, fields) {
249
- this.__StructClass = true;
250
- this.$typeName = CToken.$typeName;
251
- this.$isPhantom = CToken.$isPhantom;
252
263
  this.$fullTypeName = composeSuiType(CToken.$typeName, ...typeArgs);
253
264
  this.$typeArgs = typeArgs;
254
265
  this.dummyField = fields.dummyField;
@@ -266,7 +277,7 @@ export class CToken {
266
277
  bcs: CToken.bcs,
267
278
  fromJSONField: (field) => CToken.fromJSONField([P, T], field),
268
279
  fromJSON: (json) => CToken.fromJSON([P, T], json),
269
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return CToken.fetch(client, [P, T], id); }),
280
+ fetch: async (client, id) => CToken.fetch(client, [P, T], id),
270
281
  new: (fields) => {
271
282
  return new CToken([extractType(P), extractType(T)], fields);
272
283
  },
@@ -310,7 +321,11 @@ export class CToken {
310
321
  };
311
322
  }
312
323
  toJSON() {
313
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
324
+ return {
325
+ $typeName: this.$typeName,
326
+ $typeArgs: this.$typeArgs,
327
+ ...this.toJSONField(),
328
+ };
314
329
  }
315
330
  static fromJSONField(typeArgs, field) {
316
331
  return CToken.reified(typeArgs[0], typeArgs[1]).new({
@@ -324,29 +339,33 @@ export class CToken {
324
339
  assertReifiedTypeArgsMatch(composeSuiType(CToken.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
325
340
  return CToken.fromJSONField(typeArgs, json);
326
341
  }
327
- static fetch(client, typeArgs, id) {
328
- return __awaiter(this, void 0, void 0, function* () {
329
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
330
- if (!isCToken(object.type)) {
331
- throw new Error(`object at id ${id} is not a CToken object`);
332
- }
333
- return CToken.fromBcs(typeArgs, object.content);
334
- });
342
+ static async fetch(client, typeArgs, id) {
343
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
344
+ if (!isCToken(object.type)) {
345
+ throw new Error(`object at id ${id} is not a CToken object`);
346
+ }
347
+ return CToken.fromBcs(typeArgs, object.content);
335
348
  }
336
349
  }
337
- CToken.$typeName = `${PKG_V1}::reserve::CToken`;
338
- CToken.$numTypeParams = 2;
339
- CToken.$isPhantom = [true, true];
340
350
  /* ============================== ClaimStakingRewardsEvent =============================== */
341
351
  export function isClaimStakingRewardsEvent(type) {
342
352
  type = compressSuiType(type);
343
353
  return type === `${PKG_V8}::reserve::ClaimStakingRewardsEvent`;
344
354
  }
345
355
  export class ClaimStakingRewardsEvent {
356
+ __StructClass = true;
357
+ static $typeName = `${PKG_V8}::reserve::ClaimStakingRewardsEvent`;
358
+ static $numTypeParams = 0;
359
+ static $isPhantom = [];
360
+ $typeName = ClaimStakingRewardsEvent.$typeName;
361
+ $fullTypeName;
362
+ $typeArgs;
363
+ $isPhantom = ClaimStakingRewardsEvent.$isPhantom;
364
+ lendingMarketId;
365
+ coinType;
366
+ reserveId;
367
+ amount;
346
368
  constructor(typeArgs, fields) {
347
- this.__StructClass = true;
348
- this.$typeName = ClaimStakingRewardsEvent.$typeName;
349
- this.$isPhantom = ClaimStakingRewardsEvent.$isPhantom;
350
369
  this.$fullTypeName = composeSuiType(ClaimStakingRewardsEvent.$typeName, ...typeArgs);
351
370
  this.$typeArgs = typeArgs;
352
371
  this.lendingMarketId = fields.lendingMarketId;
@@ -367,7 +386,7 @@ export class ClaimStakingRewardsEvent {
367
386
  bcs: ClaimStakingRewardsEvent.bcs,
368
387
  fromJSONField: (field) => ClaimStakingRewardsEvent.fromJSONField(field),
369
388
  fromJSON: (json) => ClaimStakingRewardsEvent.fromJSON(json),
370
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ClaimStakingRewardsEvent.fetch(client, id); }),
389
+ fetch: async (client, id) => ClaimStakingRewardsEvent.fetch(client, id),
371
390
  new: (fields) => {
372
391
  return new ClaimStakingRewardsEvent([], fields);
373
392
  },
@@ -432,7 +451,11 @@ export class ClaimStakingRewardsEvent {
432
451
  };
433
452
  }
434
453
  toJSON() {
435
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
454
+ return {
455
+ $typeName: this.$typeName,
456
+ $typeArgs: this.$typeArgs,
457
+ ...this.toJSONField(),
458
+ };
436
459
  }
437
460
  static fromJSONField(field) {
438
461
  return ClaimStakingRewardsEvent.reified().new({
@@ -448,29 +471,43 @@ export class ClaimStakingRewardsEvent {
448
471
  }
449
472
  return ClaimStakingRewardsEvent.fromJSONField(json);
450
473
  }
451
- static fetch(client, id) {
452
- return __awaiter(this, void 0, void 0, function* () {
453
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
454
- if (!isClaimStakingRewardsEvent(object.type)) {
455
- throw new Error(`object at id ${id} is not a ClaimStakingRewardsEvent object`);
456
- }
457
- return ClaimStakingRewardsEvent.fromBcs(object.content);
458
- });
474
+ static async fetch(client, id) {
475
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
476
+ if (!isClaimStakingRewardsEvent(object.type)) {
477
+ throw new Error(`object at id ${id} is not a ClaimStakingRewardsEvent object`);
478
+ }
479
+ return ClaimStakingRewardsEvent.fromBcs(object.content);
459
480
  }
460
481
  }
461
- ClaimStakingRewardsEvent.$typeName = `${PKG_V8}::reserve::ClaimStakingRewardsEvent`;
462
- ClaimStakingRewardsEvent.$numTypeParams = 0;
463
- ClaimStakingRewardsEvent.$isPhantom = [];
464
482
  /* ============================== InterestUpdateEvent =============================== */
465
483
  export function isInterestUpdateEvent(type) {
466
484
  type = compressSuiType(type);
467
485
  return type === `${PKG_V1}::reserve::InterestUpdateEvent`;
468
486
  }
469
487
  export class InterestUpdateEvent {
488
+ __StructClass = true;
489
+ static $typeName = `${PKG_V1}::reserve::InterestUpdateEvent`;
490
+ static $numTypeParams = 0;
491
+ static $isPhantom = [];
492
+ $typeName = InterestUpdateEvent.$typeName;
493
+ $fullTypeName;
494
+ $typeArgs;
495
+ $isPhantom = InterestUpdateEvent.$isPhantom;
496
+ lendingMarketId;
497
+ coinType;
498
+ reserveId;
499
+ cumulativeBorrowRate;
500
+ availableAmount;
501
+ borrowedAmount;
502
+ unclaimedSpreadFees;
503
+ ctokenSupply;
504
+ borrowInterestPaid;
505
+ spreadFee;
506
+ supplyInterestEarned;
507
+ borrowInterestPaidUsdEstimate;
508
+ protocolFeeUsdEstimate;
509
+ supplyInterestEarnedUsdEstimate;
470
510
  constructor(typeArgs, fields) {
471
- this.__StructClass = true;
472
- this.$typeName = InterestUpdateEvent.$typeName;
473
- this.$isPhantom = InterestUpdateEvent.$isPhantom;
474
511
  this.$fullTypeName = composeSuiType(InterestUpdateEvent.$typeName, ...typeArgs);
475
512
  this.$typeArgs = typeArgs;
476
513
  this.lendingMarketId = fields.lendingMarketId;
@@ -502,7 +539,7 @@ export class InterestUpdateEvent {
502
539
  bcs: InterestUpdateEvent.bcs,
503
540
  fromJSONField: (field) => InterestUpdateEvent.fromJSONField(field),
504
541
  fromJSON: (json) => InterestUpdateEvent.fromJSON(json),
505
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return InterestUpdateEvent.fetch(client, id); }),
542
+ fetch: async (client, id) => InterestUpdateEvent.fetch(client, id),
506
543
  new: (fields) => {
507
544
  return new InterestUpdateEvent([], fields);
508
545
  },
@@ -607,7 +644,11 @@ export class InterestUpdateEvent {
607
644
  };
608
645
  }
609
646
  toJSON() {
610
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
647
+ return {
648
+ $typeName: this.$typeName,
649
+ $typeArgs: this.$typeArgs,
650
+ ...this.toJSONField(),
651
+ };
611
652
  }
612
653
  static fromJSONField(field) {
613
654
  return InterestUpdateEvent.reified().new({
@@ -633,29 +674,31 @@ export class InterestUpdateEvent {
633
674
  }
634
675
  return InterestUpdateEvent.fromJSONField(json);
635
676
  }
636
- static fetch(client, id) {
637
- return __awaiter(this, void 0, void 0, function* () {
638
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
639
- if (!isInterestUpdateEvent(object.type)) {
640
- throw new Error(`object at id ${id} is not a InterestUpdateEvent object`);
641
- }
642
- return InterestUpdateEvent.fromBcs(object.content);
643
- });
677
+ static async fetch(client, id) {
678
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
679
+ if (!isInterestUpdateEvent(object.type)) {
680
+ throw new Error(`object at id ${id} is not a InterestUpdateEvent object`);
681
+ }
682
+ return InterestUpdateEvent.fromBcs(object.content);
644
683
  }
645
684
  }
646
- InterestUpdateEvent.$typeName = `${PKG_V1}::reserve::InterestUpdateEvent`;
647
- InterestUpdateEvent.$numTypeParams = 0;
648
- InterestUpdateEvent.$isPhantom = [];
649
685
  /* ============================== LiquidityRequest =============================== */
650
686
  export function isLiquidityRequest(type) {
651
687
  type = compressSuiType(type);
652
688
  return type.startsWith(`${PKG_V8}::reserve::LiquidityRequest` + "<");
653
689
  }
654
690
  export class LiquidityRequest {
691
+ __StructClass = true;
692
+ static $typeName = `${PKG_V8}::reserve::LiquidityRequest`;
693
+ static $numTypeParams = 2;
694
+ static $isPhantom = [true, true];
695
+ $typeName = LiquidityRequest.$typeName;
696
+ $fullTypeName;
697
+ $typeArgs;
698
+ $isPhantom = LiquidityRequest.$isPhantom;
699
+ amount;
700
+ fee;
655
701
  constructor(typeArgs, fields) {
656
- this.__StructClass = true;
657
- this.$typeName = LiquidityRequest.$typeName;
658
- this.$isPhantom = LiquidityRequest.$isPhantom;
659
702
  this.$fullTypeName = composeSuiType(LiquidityRequest.$typeName, ...typeArgs);
660
703
  this.$typeArgs = typeArgs;
661
704
  this.amount = fields.amount;
@@ -674,7 +717,7 @@ export class LiquidityRequest {
674
717
  bcs: LiquidityRequest.bcs,
675
718
  fromJSONField: (field) => LiquidityRequest.fromJSONField([P, T], field),
676
719
  fromJSON: (json) => LiquidityRequest.fromJSON([P, T], json),
677
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LiquidityRequest.fetch(client, [P, T], id); }),
720
+ fetch: async (client, id) => LiquidityRequest.fetch(client, [P, T], id),
678
721
  new: (fields) => {
679
722
  return new LiquidityRequest([extractType(P), extractType(T)], fields);
680
723
  },
@@ -722,7 +765,11 @@ export class LiquidityRequest {
722
765
  };
723
766
  }
724
767
  toJSON() {
725
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
768
+ return {
769
+ $typeName: this.$typeName,
770
+ $typeArgs: this.$typeArgs,
771
+ ...this.toJSONField(),
772
+ };
726
773
  }
727
774
  static fromJSONField(typeArgs, field) {
728
775
  return LiquidityRequest.reified(typeArgs[0], typeArgs[1]).new({
@@ -737,29 +784,48 @@ export class LiquidityRequest {
737
784
  assertReifiedTypeArgsMatch(composeSuiType(LiquidityRequest.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
738
785
  return LiquidityRequest.fromJSONField(typeArgs, json);
739
786
  }
740
- static fetch(client, typeArgs, id) {
741
- return __awaiter(this, void 0, void 0, function* () {
742
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
743
- if (!isLiquidityRequest(object.type)) {
744
- throw new Error(`object at id ${id} is not a LiquidityRequest object`);
745
- }
746
- return LiquidityRequest.fromBcs(typeArgs, object.content);
747
- });
787
+ static async fetch(client, typeArgs, id) {
788
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
789
+ if (!isLiquidityRequest(object.type)) {
790
+ throw new Error(`object at id ${id} is not a LiquidityRequest object`);
791
+ }
792
+ return LiquidityRequest.fromBcs(typeArgs, object.content);
748
793
  }
749
794
  }
750
- LiquidityRequest.$typeName = `${PKG_V8}::reserve::LiquidityRequest`;
751
- LiquidityRequest.$numTypeParams = 2;
752
- LiquidityRequest.$isPhantom = [true, true];
753
795
  /* ============================== Reserve =============================== */
754
796
  export function isReserve(type) {
755
797
  type = compressSuiType(type);
756
798
  return type.startsWith(`${PKG_V1}::reserve::Reserve` + "<");
757
799
  }
758
800
  export class Reserve {
801
+ __StructClass = true;
802
+ static $typeName = `${PKG_V1}::reserve::Reserve`;
803
+ static $numTypeParams = 1;
804
+ static $isPhantom = [true];
805
+ $typeName = Reserve.$typeName;
806
+ $fullTypeName;
807
+ $typeArgs;
808
+ $isPhantom = Reserve.$isPhantom;
809
+ id;
810
+ lendingMarketId;
811
+ arrayIndex;
812
+ coinType;
813
+ config;
814
+ mintDecimals;
815
+ priceIdentifier;
816
+ price;
817
+ smoothedPrice;
818
+ priceLastUpdateTimestampS;
819
+ availableAmount;
820
+ ctokenSupply;
821
+ borrowedAmount;
822
+ cumulativeBorrowRate;
823
+ interestLastUpdateTimestampS;
824
+ unclaimedSpreadFees;
825
+ attributedBorrowValue;
826
+ depositsPoolRewardManager;
827
+ borrowsPoolRewardManager;
759
828
  constructor(typeArgs, fields) {
760
- this.__StructClass = true;
761
- this.$typeName = Reserve.$typeName;
762
- this.$isPhantom = Reserve.$isPhantom;
763
829
  this.$fullTypeName = composeSuiType(Reserve.$typeName, ...typeArgs);
764
830
  this.$typeArgs = typeArgs;
765
831
  this.id = fields.id;
@@ -795,7 +861,7 @@ export class Reserve {
795
861
  bcs: Reserve.bcs,
796
862
  fromJSONField: (field) => Reserve.fromJSONField(P, field),
797
863
  fromJSON: (json) => Reserve.fromJSON(P, json),
798
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Reserve.fetch(client, P, id); }),
864
+ fetch: async (client, id) => Reserve.fetch(client, P, id),
799
865
  new: (fields) => {
800
866
  return new Reserve([extractType(P)], fields);
801
867
  },
@@ -911,7 +977,11 @@ export class Reserve {
911
977
  };
912
978
  }
913
979
  toJSON() {
914
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
980
+ return {
981
+ $typeName: this.$typeName,
982
+ $typeArgs: this.$typeArgs,
983
+ ...this.toJSONField(),
984
+ };
915
985
  }
916
986
  static fromJSONField(typeArg, field) {
917
987
  return Reserve.reified(typeArg).new({
@@ -943,29 +1013,45 @@ export class Reserve {
943
1013
  assertReifiedTypeArgsMatch(composeSuiType(Reserve.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
944
1014
  return Reserve.fromJSONField(typeArg, json);
945
1015
  }
946
- static fetch(client, typeArg, id) {
947
- return __awaiter(this, void 0, void 0, function* () {
948
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
949
- if (!isReserve(object.type)) {
950
- throw new Error(`object at id ${id} is not a Reserve object`);
951
- }
952
- return Reserve.fromBcs(typeArg, object.content);
953
- });
1016
+ static async fetch(client, typeArg, id) {
1017
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1018
+ if (!isReserve(object.type)) {
1019
+ throw new Error(`object at id ${id} is not a Reserve object`);
1020
+ }
1021
+ return Reserve.fromBcs(typeArg, object.content);
954
1022
  }
955
1023
  }
956
- Reserve.$typeName = `${PKG_V1}::reserve::Reserve`;
957
- Reserve.$numTypeParams = 1;
958
- Reserve.$isPhantom = [true];
959
1024
  /* ============================== ReserveAssetDataEvent =============================== */
960
1025
  export function isReserveAssetDataEvent(type) {
961
1026
  type = compressSuiType(type);
962
1027
  return type === `${PKG_V1}::reserve::ReserveAssetDataEvent`;
963
1028
  }
964
1029
  export class ReserveAssetDataEvent {
1030
+ __StructClass = true;
1031
+ static $typeName = `${PKG_V1}::reserve::ReserveAssetDataEvent`;
1032
+ static $numTypeParams = 0;
1033
+ static $isPhantom = [];
1034
+ $typeName = ReserveAssetDataEvent.$typeName;
1035
+ $fullTypeName;
1036
+ $typeArgs;
1037
+ $isPhantom = ReserveAssetDataEvent.$isPhantom;
1038
+ lendingMarketId;
1039
+ coinType;
1040
+ reserveId;
1041
+ availableAmount;
1042
+ supplyAmount;
1043
+ borrowedAmount;
1044
+ availableAmountUsdEstimate;
1045
+ supplyAmountUsdEstimate;
1046
+ borrowedAmountUsdEstimate;
1047
+ borrowApr;
1048
+ supplyApr;
1049
+ ctokenSupply;
1050
+ cumulativeBorrowRate;
1051
+ price;
1052
+ smoothedPrice;
1053
+ priceLastUpdateTimestampS;
965
1054
  constructor(typeArgs, fields) {
966
- this.__StructClass = true;
967
- this.$typeName = ReserveAssetDataEvent.$typeName;
968
- this.$isPhantom = ReserveAssetDataEvent.$isPhantom;
969
1055
  this.$fullTypeName = composeSuiType(ReserveAssetDataEvent.$typeName, ...typeArgs);
970
1056
  this.$typeArgs = typeArgs;
971
1057
  this.lendingMarketId = fields.lendingMarketId;
@@ -998,7 +1084,7 @@ export class ReserveAssetDataEvent {
998
1084
  bcs: ReserveAssetDataEvent.bcs,
999
1085
  fromJSONField: (field) => ReserveAssetDataEvent.fromJSONField(field),
1000
1086
  fromJSON: (json) => ReserveAssetDataEvent.fromJSON(json),
1001
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ReserveAssetDataEvent.fetch(client, id); }),
1087
+ fetch: async (client, id) => ReserveAssetDataEvent.fetch(client, id),
1002
1088
  new: (fields) => {
1003
1089
  return new ReserveAssetDataEvent([], fields);
1004
1090
  },
@@ -1111,7 +1197,11 @@ export class ReserveAssetDataEvent {
1111
1197
  };
1112
1198
  }
1113
1199
  toJSON() {
1114
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1200
+ return {
1201
+ $typeName: this.$typeName,
1202
+ $typeArgs: this.$typeArgs,
1203
+ ...this.toJSONField(),
1204
+ };
1115
1205
  }
1116
1206
  static fromJSONField(field) {
1117
1207
  return ReserveAssetDataEvent.reified().new({
@@ -1139,29 +1229,30 @@ export class ReserveAssetDataEvent {
1139
1229
  }
1140
1230
  return ReserveAssetDataEvent.fromJSONField(json);
1141
1231
  }
1142
- static fetch(client, id) {
1143
- return __awaiter(this, void 0, void 0, function* () {
1144
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1145
- if (!isReserveAssetDataEvent(object.type)) {
1146
- throw new Error(`object at id ${id} is not a ReserveAssetDataEvent object`);
1147
- }
1148
- return ReserveAssetDataEvent.fromBcs(object.content);
1149
- });
1232
+ static async fetch(client, id) {
1233
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1234
+ if (!isReserveAssetDataEvent(object.type)) {
1235
+ throw new Error(`object at id ${id} is not a ReserveAssetDataEvent object`);
1236
+ }
1237
+ return ReserveAssetDataEvent.fromBcs(object.content);
1150
1238
  }
1151
1239
  }
1152
- ReserveAssetDataEvent.$typeName = `${PKG_V1}::reserve::ReserveAssetDataEvent`;
1153
- ReserveAssetDataEvent.$numTypeParams = 0;
1154
- ReserveAssetDataEvent.$isPhantom = [];
1155
1240
  /* ============================== StakerKey =============================== */
1156
1241
  export function isStakerKey(type) {
1157
1242
  type = compressSuiType(type);
1158
1243
  return type === `${PKG_V8}::reserve::StakerKey`;
1159
1244
  }
1160
1245
  export class StakerKey {
1246
+ __StructClass = true;
1247
+ static $typeName = `${PKG_V8}::reserve::StakerKey`;
1248
+ static $numTypeParams = 0;
1249
+ static $isPhantom = [];
1250
+ $typeName = StakerKey.$typeName;
1251
+ $fullTypeName;
1252
+ $typeArgs;
1253
+ $isPhantom = StakerKey.$isPhantom;
1254
+ dummyField;
1161
1255
  constructor(typeArgs, fields) {
1162
- this.__StructClass = true;
1163
- this.$typeName = StakerKey.$typeName;
1164
- this.$isPhantom = StakerKey.$isPhantom;
1165
1256
  this.$fullTypeName = composeSuiType(StakerKey.$typeName, ...typeArgs);
1166
1257
  this.$typeArgs = typeArgs;
1167
1258
  this.dummyField = fields.dummyField;
@@ -1179,7 +1270,7 @@ export class StakerKey {
1179
1270
  bcs: StakerKey.bcs,
1180
1271
  fromJSONField: (field) => StakerKey.fromJSONField(field),
1181
1272
  fromJSON: (json) => StakerKey.fromJSON(json),
1182
- fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return StakerKey.fetch(client, id); }),
1273
+ fetch: async (client, id) => StakerKey.fetch(client, id),
1183
1274
  new: (fields) => {
1184
1275
  return new StakerKey([], fields);
1185
1276
  },
@@ -1222,7 +1313,11 @@ export class StakerKey {
1222
1313
  };
1223
1314
  }
1224
1315
  toJSON() {
1225
- return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1316
+ return {
1317
+ $typeName: this.$typeName,
1318
+ $typeArgs: this.$typeArgs,
1319
+ ...this.toJSONField(),
1320
+ };
1226
1321
  }
1227
1322
  static fromJSONField(field) {
1228
1323
  return StakerKey.reified().new({
@@ -1235,16 +1330,11 @@ export class StakerKey {
1235
1330
  }
1236
1331
  return StakerKey.fromJSONField(json);
1237
1332
  }
1238
- static fetch(client, id) {
1239
- return __awaiter(this, void 0, void 0, function* () {
1240
- const { object } = yield client.getObject({ objectId: id, include: { content: true } });
1241
- if (!isStakerKey(object.type)) {
1242
- throw new Error(`object at id ${id} is not a StakerKey object`);
1243
- }
1244
- return StakerKey.fromBcs(object.content);
1245
- });
1333
+ static async fetch(client, id) {
1334
+ const { object } = await client.getObject({ objectId: id, include: { content: true } });
1335
+ if (!isStakerKey(object.type)) {
1336
+ throw new Error(`object at id ${id} is not a StakerKey object`);
1337
+ }
1338
+ return StakerKey.fromBcs(object.content);
1246
1339
  }
1247
1340
  }
1248
- StakerKey.$typeName = `${PKG_V8}::reserve::StakerKey`;
1249
- StakerKey.$numTypeParams = 0;
1250
- StakerKey.$isPhantom = [];