@suilend/sdk 1.1.19 → 1.1.21

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 (50) hide show
  1. package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +3 -3
  2. package/_generated/_dependencies/source/0x1/ascii/structs.js +7 -7
  3. package/_generated/_dependencies/source/0x1/index.d.ts +1 -1
  4. package/_generated/_dependencies/source/0x1/index.js +2 -2
  5. package/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -3
  6. package/_generated/_dependencies/source/0x1/option/structs.js +4 -4
  7. package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +2 -2
  8. package/_generated/_dependencies/source/0x1/type-name/structs.js +4 -4
  9. package/_generated/_dependencies/source/0x2/bag/structs.js +2 -2
  10. package/_generated/_dependencies/source/0x2/balance/structs.js +3 -3
  11. package/_generated/_dependencies/source/0x2/object/structs.js +3 -3
  12. package/_generated/_dependencies/source/0x2/object-table/structs.js +2 -2
  13. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +2 -2
  14. package/_generated/_framework/reified.js +10 -10
  15. package/_generated/_framework/util.d.ts +11 -5
  16. package/_generated/_framework/util.js +13 -12
  17. package/_generated/_framework/vector.d.ts +1 -1
  18. package/_generated/_framework/vector.js +2 -2
  19. package/_generated/suilend/cell/structs.d.ts +3 -3
  20. package/_generated/suilend/cell/structs.js +2 -2
  21. package/_generated/suilend/decimal/structs.d.ts +3 -3
  22. package/_generated/suilend/decimal/structs.js +2 -2
  23. package/_generated/suilend/index.d.ts +3 -3
  24. package/_generated/suilend/index.js +11 -5
  25. package/_generated/suilend/lending-market/functions.d.ts +50 -6
  26. package/_generated/suilend/lending-market/functions.js +136 -41
  27. package/_generated/suilend/lending-market/structs.d.ts +192 -192
  28. package/_generated/suilend/lending-market/structs.js +392 -392
  29. package/_generated/suilend/lending-market-registry/functions.js +3 -2
  30. package/_generated/suilend/liquidity-mining/structs.d.ts +14 -14
  31. package/_generated/suilend/liquidity-mining/structs.js +6 -6
  32. package/_generated/suilend/obligation/structs.d.ts +17 -17
  33. package/_generated/suilend/obligation/structs.js +7 -7
  34. package/_generated/suilend/rate-limiter/functions.js +7 -6
  35. package/_generated/suilend/rate-limiter/structs.d.ts +6 -6
  36. package/_generated/suilend/rate-limiter/structs.js +3 -3
  37. package/_generated/suilend/reserve/structs.d.ts +179 -15
  38. package/_generated/suilend/reserve/structs.js +434 -7
  39. package/_generated/suilend/reserve-config/functions.d.ts +7 -7
  40. package/_generated/suilend/reserve-config/functions.js +54 -53
  41. package/_generated/suilend/reserve-config/structs.d.ts +6 -6
  42. package/_generated/suilend/reserve-config/structs.js +3 -3
  43. package/client.d.ts +3 -2
  44. package/client.js +52 -31
  45. package/package.json +1 -1
  46. package/parsers/lendingMarket.d.ts +3 -3
  47. package/parsers/obligation.d.ts +4 -4
  48. package/parsers/reserve.d.ts +2 -2
  49. package/utils/events.js +3 -3
  50. package/utils/obligation.js +6 -5
@@ -32,13 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ReserveAssetDataEvent = exports.Reserve = exports.InterestUpdateEvent = exports.CToken = exports.Balances = exports.BalanceKey = void 0;
36
- exports.isBalanceKey = isBalanceKey;
37
- exports.isBalances = isBalances;
38
- exports.isCToken = isCToken;
39
- exports.isInterestUpdateEvent = isInterestUpdateEvent;
40
- exports.isReserve = isReserve;
41
- exports.isReserveAssetDataEvent = isReserveAssetDataEvent;
35
+ exports.StakerKey = exports.isStakerKey = exports.ReserveAssetDataEvent = exports.isReserveAssetDataEvent = exports.Reserve = exports.isReserve = exports.LiquidityRequest = exports.isLiquidityRequest = exports.InterestUpdateEvent = exports.isInterestUpdateEvent = exports.ClaimStakingRewardsEvent = exports.isClaimStakingRewardsEvent = exports.CToken = exports.isCToken = exports.Balances = exports.isBalances = exports.BalanceKey = exports.isBalanceKey = void 0;
42
36
  const reified = __importStar(require("../../_framework/reified"));
43
37
  const structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
44
38
  const structs_2 = require("../../_dependencies/source/0x2/balance/structs");
@@ -58,6 +52,7 @@ function isBalanceKey(type) {
58
52
  type = (0, util_1.compressSuiType)(type);
59
53
  return type === `${index_1.PKG_V1}::reserve::BalanceKey`;
60
54
  }
55
+ exports.isBalanceKey = isBalanceKey;
61
56
  class BalanceKey {
62
57
  constructor(typeArgs, fields) {
63
58
  this.__StructClass = true;
@@ -183,6 +178,7 @@ function isBalances(type) {
183
178
  type = (0, util_1.compressSuiType)(type);
184
179
  return type.startsWith(`${index_1.PKG_V1}::reserve::Balances` + "<");
185
180
  }
181
+ exports.isBalances = isBalances;
186
182
  class Balances {
187
183
  constructor(typeArgs, fields) {
188
184
  this.__StructClass = true;
@@ -345,6 +341,7 @@ function isCToken(type) {
345
341
  type = (0, util_1.compressSuiType)(type);
346
342
  return type.startsWith(`${index_1.PKG_V1}::reserve::CToken` + "<");
347
343
  }
344
+ exports.isCToken = isCToken;
348
345
  class CToken {
349
346
  constructor(typeArgs, fields) {
350
347
  this.__StructClass = true;
@@ -478,11 +475,167 @@ exports.CToken = CToken;
478
475
  CToken.$typeName = `${index_1.PKG_V1}::reserve::CToken`;
479
476
  CToken.$numTypeParams = 2;
480
477
  CToken.$isPhantom = [true, true];
478
+ /* ============================== ClaimStakingRewardsEvent =============================== */
479
+ function isClaimStakingRewardsEvent(type) {
480
+ type = (0, util_1.compressSuiType)(type);
481
+ return type === `${index_1.PKG_V1}::reserve::ClaimStakingRewardsEvent`;
482
+ }
483
+ exports.isClaimStakingRewardsEvent = isClaimStakingRewardsEvent;
484
+ class ClaimStakingRewardsEvent {
485
+ constructor(typeArgs, fields) {
486
+ this.__StructClass = true;
487
+ this.$typeName = ClaimStakingRewardsEvent.$typeName;
488
+ this.$isPhantom = ClaimStakingRewardsEvent.$isPhantom;
489
+ this.$fullTypeName = (0, util_1.composeSuiType)(ClaimStakingRewardsEvent.$typeName, ...typeArgs);
490
+ this.$typeArgs = typeArgs;
491
+ this.lendingMarketId = fields.lendingMarketId;
492
+ this.coinType = fields.coinType;
493
+ this.reserveId = fields.reserveId;
494
+ this.amount = fields.amount;
495
+ }
496
+ static reified() {
497
+ return {
498
+ typeName: ClaimStakingRewardsEvent.$typeName,
499
+ fullTypeName: (0, util_1.composeSuiType)(ClaimStakingRewardsEvent.$typeName, ...[]),
500
+ typeArgs: [],
501
+ isPhantom: ClaimStakingRewardsEvent.$isPhantom,
502
+ reifiedTypeArgs: [],
503
+ fromFields: (fields) => ClaimStakingRewardsEvent.fromFields(fields),
504
+ fromFieldsWithTypes: (item) => ClaimStakingRewardsEvent.fromFieldsWithTypes(item),
505
+ fromBcs: (data) => ClaimStakingRewardsEvent.fromBcs(data),
506
+ bcs: ClaimStakingRewardsEvent.bcs,
507
+ fromJSONField: (field) => ClaimStakingRewardsEvent.fromJSONField(field),
508
+ fromJSON: (json) => ClaimStakingRewardsEvent.fromJSON(json),
509
+ fromSuiParsedData: (content) => ClaimStakingRewardsEvent.fromSuiParsedData(content),
510
+ fromSuiObjectData: (content) => ClaimStakingRewardsEvent.fromSuiObjectData(content),
511
+ fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return ClaimStakingRewardsEvent.fetch(client, id); }),
512
+ new: (fields) => {
513
+ return new ClaimStakingRewardsEvent([], fields);
514
+ },
515
+ kind: "StructClassReified",
516
+ };
517
+ }
518
+ static get r() {
519
+ return ClaimStakingRewardsEvent.reified();
520
+ }
521
+ static phantom() {
522
+ return (0, reified_1.phantom)(ClaimStakingRewardsEvent.reified());
523
+ }
524
+ static get p() {
525
+ return ClaimStakingRewardsEvent.phantom();
526
+ }
527
+ static get bcs() {
528
+ return bcs_1.bcs.struct("ClaimStakingRewardsEvent", {
529
+ lending_market_id: bcs_1.bcs
530
+ .bytes(32)
531
+ .transform({
532
+ input: (val) => (0, utils_1.fromHEX)(val),
533
+ output: (val) => (0, utils_1.toHEX)(val),
534
+ }),
535
+ coin_type: structs_1.TypeName.bcs,
536
+ reserve_id: bcs_1.bcs
537
+ .bytes(32)
538
+ .transform({
539
+ input: (val) => (0, utils_1.fromHEX)(val),
540
+ output: (val) => (0, utils_1.toHEX)(val),
541
+ }),
542
+ amount: bcs_1.bcs.u64(),
543
+ });
544
+ }
545
+ static fromFields(fields) {
546
+ return ClaimStakingRewardsEvent.reified().new({
547
+ lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
548
+ coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
549
+ reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
550
+ amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
551
+ });
552
+ }
553
+ static fromFieldsWithTypes(item) {
554
+ if (!isClaimStakingRewardsEvent(item.type)) {
555
+ throw new Error("not a ClaimStakingRewardsEvent type");
556
+ }
557
+ return ClaimStakingRewardsEvent.reified().new({
558
+ lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
559
+ coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
560
+ reserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.reserve_id),
561
+ amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
562
+ });
563
+ }
564
+ static fromBcs(data) {
565
+ return ClaimStakingRewardsEvent.fromFields(ClaimStakingRewardsEvent.bcs.parse(data));
566
+ }
567
+ toJSONField() {
568
+ return {
569
+ lendingMarketId: this.lendingMarketId,
570
+ coinType: this.coinType.toJSONField(),
571
+ reserveId: this.reserveId,
572
+ amount: this.amount.toString(),
573
+ };
574
+ }
575
+ toJSON() {
576
+ return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
577
+ }
578
+ static fromJSONField(field) {
579
+ return ClaimStakingRewardsEvent.reified().new({
580
+ lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
581
+ coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
582
+ reserveId: (0, reified_1.decodeFromJSONField)("address", field.reserveId),
583
+ amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
584
+ });
585
+ }
586
+ static fromJSON(json) {
587
+ if (json.$typeName !== ClaimStakingRewardsEvent.$typeName) {
588
+ throw new Error("not a WithTwoGenerics json object");
589
+ }
590
+ return ClaimStakingRewardsEvent.fromJSONField(json);
591
+ }
592
+ static fromSuiParsedData(content) {
593
+ if (content.dataType !== "moveObject") {
594
+ throw new Error("not an object");
595
+ }
596
+ if (!isClaimStakingRewardsEvent(content.type)) {
597
+ throw new Error(`object at ${content.fields.id} is not a ClaimStakingRewardsEvent object`);
598
+ }
599
+ return ClaimStakingRewardsEvent.fromFieldsWithTypes(content);
600
+ }
601
+ static fromSuiObjectData(data) {
602
+ if (data.bcs) {
603
+ if (data.bcs.dataType !== "moveObject" ||
604
+ !isClaimStakingRewardsEvent(data.bcs.type)) {
605
+ throw new Error(`object at is not a ClaimStakingRewardsEvent object`);
606
+ }
607
+ return ClaimStakingRewardsEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
608
+ }
609
+ if (data.content) {
610
+ return ClaimStakingRewardsEvent.fromSuiParsedData(data.content);
611
+ }
612
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
613
+ }
614
+ static fetch(client, id) {
615
+ return __awaiter(this, void 0, void 0, function* () {
616
+ var _a, _b;
617
+ const res = yield client.getObject({ id, options: { showBcs: true } });
618
+ if (res.error) {
619
+ throw new Error(`error fetching ClaimStakingRewardsEvent object at id ${id}: ${res.error.code}`);
620
+ }
621
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
622
+ !isClaimStakingRewardsEvent(res.data.bcs.type)) {
623
+ throw new Error(`object at id ${id} is not a ClaimStakingRewardsEvent object`);
624
+ }
625
+ return ClaimStakingRewardsEvent.fromSuiObjectData(res.data);
626
+ });
627
+ }
628
+ }
629
+ exports.ClaimStakingRewardsEvent = ClaimStakingRewardsEvent;
630
+ ClaimStakingRewardsEvent.$typeName = `${index_1.PKG_V1}::reserve::ClaimStakingRewardsEvent`;
631
+ ClaimStakingRewardsEvent.$numTypeParams = 0;
632
+ ClaimStakingRewardsEvent.$isPhantom = [];
481
633
  /* ============================== InterestUpdateEvent =============================== */
482
634
  function isInterestUpdateEvent(type) {
483
635
  type = (0, util_1.compressSuiType)(type);
484
636
  return type === `${index_1.PKG_V1}::reserve::InterestUpdateEvent`;
485
637
  }
638
+ exports.isInterestUpdateEvent = isInterestUpdateEvent;
486
639
  class InterestUpdateEvent {
487
640
  constructor(typeArgs, fields) {
488
641
  this.__StructClass = true;
@@ -693,11 +846,158 @@ exports.InterestUpdateEvent = InterestUpdateEvent;
693
846
  InterestUpdateEvent.$typeName = `${index_1.PKG_V1}::reserve::InterestUpdateEvent`;
694
847
  InterestUpdateEvent.$numTypeParams = 0;
695
848
  InterestUpdateEvent.$isPhantom = [];
849
+ /* ============================== LiquidityRequest =============================== */
850
+ function isLiquidityRequest(type) {
851
+ type = (0, util_1.compressSuiType)(type);
852
+ return type.startsWith(`${index_1.PKG_V1}::reserve::LiquidityRequest` + "<");
853
+ }
854
+ exports.isLiquidityRequest = isLiquidityRequest;
855
+ class LiquidityRequest {
856
+ constructor(typeArgs, fields) {
857
+ this.__StructClass = true;
858
+ this.$typeName = LiquidityRequest.$typeName;
859
+ this.$isPhantom = LiquidityRequest.$isPhantom;
860
+ this.$fullTypeName = (0, util_1.composeSuiType)(LiquidityRequest.$typeName, ...typeArgs);
861
+ this.$typeArgs = typeArgs;
862
+ this.amount = fields.amount;
863
+ this.fee = fields.fee;
864
+ }
865
+ static reified(P, T) {
866
+ return {
867
+ typeName: LiquidityRequest.$typeName,
868
+ fullTypeName: (0, util_1.composeSuiType)(LiquidityRequest.$typeName, ...[(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)]),
869
+ typeArgs: [(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)],
870
+ isPhantom: LiquidityRequest.$isPhantom,
871
+ reifiedTypeArgs: [P, T],
872
+ fromFields: (fields) => LiquidityRequest.fromFields([P, T], fields),
873
+ fromFieldsWithTypes: (item) => LiquidityRequest.fromFieldsWithTypes([P, T], item),
874
+ fromBcs: (data) => LiquidityRequest.fromBcs([P, T], data),
875
+ bcs: LiquidityRequest.bcs,
876
+ fromJSONField: (field) => LiquidityRequest.fromJSONField([P, T], field),
877
+ fromJSON: (json) => LiquidityRequest.fromJSON([P, T], json),
878
+ fromSuiParsedData: (content) => LiquidityRequest.fromSuiParsedData([P, T], content),
879
+ fromSuiObjectData: (content) => LiquidityRequest.fromSuiObjectData([P, T], content),
880
+ fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LiquidityRequest.fetch(client, [P, T], id); }),
881
+ new: (fields) => {
882
+ return new LiquidityRequest([(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)], fields);
883
+ },
884
+ kind: "StructClassReified",
885
+ };
886
+ }
887
+ static get r() {
888
+ return LiquidityRequest.reified;
889
+ }
890
+ static phantom(P, T) {
891
+ return (0, reified_1.phantom)(LiquidityRequest.reified(P, T));
892
+ }
893
+ static get p() {
894
+ return LiquidityRequest.phantom;
895
+ }
896
+ static get bcs() {
897
+ return bcs_1.bcs.struct("LiquidityRequest", {
898
+ amount: bcs_1.bcs.u64(),
899
+ fee: bcs_1.bcs.u64(),
900
+ });
901
+ }
902
+ static fromFields(typeArgs, fields) {
903
+ return LiquidityRequest.reified(typeArgs[0], typeArgs[1]).new({
904
+ amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
905
+ fee: (0, reified_1.decodeFromFields)("u64", fields.fee),
906
+ });
907
+ }
908
+ static fromFieldsWithTypes(typeArgs, item) {
909
+ if (!isLiquidityRequest(item.type)) {
910
+ throw new Error("not a LiquidityRequest type");
911
+ }
912
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
913
+ return LiquidityRequest.reified(typeArgs[0], typeArgs[1]).new({
914
+ amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
915
+ fee: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.fee),
916
+ });
917
+ }
918
+ static fromBcs(typeArgs, data) {
919
+ return LiquidityRequest.fromFields(typeArgs, LiquidityRequest.bcs.parse(data));
920
+ }
921
+ toJSONField() {
922
+ return {
923
+ amount: this.amount.toString(),
924
+ fee: this.fee.toString(),
925
+ };
926
+ }
927
+ toJSON() {
928
+ return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
929
+ }
930
+ static fromJSONField(typeArgs, field) {
931
+ return LiquidityRequest.reified(typeArgs[0], typeArgs[1]).new({
932
+ amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
933
+ fee: (0, reified_1.decodeFromJSONField)("u64", field.fee),
934
+ });
935
+ }
936
+ static fromJSON(typeArgs, json) {
937
+ if (json.$typeName !== LiquidityRequest.$typeName) {
938
+ throw new Error("not a WithTwoGenerics json object");
939
+ }
940
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(LiquidityRequest.$typeName, ...typeArgs.map(reified_1.extractType)), json.$typeArgs, typeArgs);
941
+ return LiquidityRequest.fromJSONField(typeArgs, json);
942
+ }
943
+ static fromSuiParsedData(typeArgs, content) {
944
+ if (content.dataType !== "moveObject") {
945
+ throw new Error("not an object");
946
+ }
947
+ if (!isLiquidityRequest(content.type)) {
948
+ throw new Error(`object at ${content.fields.id} is not a LiquidityRequest object`);
949
+ }
950
+ return LiquidityRequest.fromFieldsWithTypes(typeArgs, content);
951
+ }
952
+ static fromSuiObjectData(typeArgs, data) {
953
+ if (data.bcs) {
954
+ if (data.bcs.dataType !== "moveObject" ||
955
+ !isLiquidityRequest(data.bcs.type)) {
956
+ throw new Error(`object at is not a LiquidityRequest object`);
957
+ }
958
+ const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
959
+ if (gotTypeArgs.length !== 2) {
960
+ throw new Error(`type argument mismatch: expected 2 type arguments but got ${gotTypeArgs.length}`);
961
+ }
962
+ for (let i = 0; i < 2; i++) {
963
+ const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
964
+ const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
965
+ if (gotTypeArg !== expectedTypeArg) {
966
+ throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
967
+ }
968
+ }
969
+ return LiquidityRequest.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
970
+ }
971
+ if (data.content) {
972
+ return LiquidityRequest.fromSuiParsedData(typeArgs, data.content);
973
+ }
974
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
975
+ }
976
+ static fetch(client, typeArgs, id) {
977
+ return __awaiter(this, void 0, void 0, function* () {
978
+ var _a, _b;
979
+ const res = yield client.getObject({ id, options: { showBcs: true } });
980
+ if (res.error) {
981
+ throw new Error(`error fetching LiquidityRequest object at id ${id}: ${res.error.code}`);
982
+ }
983
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
984
+ !isLiquidityRequest(res.data.bcs.type)) {
985
+ throw new Error(`object at id ${id} is not a LiquidityRequest object`);
986
+ }
987
+ return LiquidityRequest.fromSuiObjectData(typeArgs, res.data);
988
+ });
989
+ }
990
+ }
991
+ exports.LiquidityRequest = LiquidityRequest;
992
+ LiquidityRequest.$typeName = `${index_1.PKG_V1}::reserve::LiquidityRequest`;
993
+ LiquidityRequest.$numTypeParams = 2;
994
+ LiquidityRequest.$isPhantom = [true, true];
696
995
  /* ============================== Reserve =============================== */
697
996
  function isReserve(type) {
698
997
  type = (0, util_1.compressSuiType)(type);
699
998
  return type.startsWith(`${index_1.PKG_V1}::reserve::Reserve` + "<");
700
999
  }
1000
+ exports.isReserve = isReserve;
701
1001
  class Reserve {
702
1002
  constructor(typeArgs, fields) {
703
1003
  this.__StructClass = true;
@@ -942,6 +1242,7 @@ function isReserveAssetDataEvent(type) {
942
1242
  type = (0, util_1.compressSuiType)(type);
943
1243
  return type === `${index_1.PKG_V1}::reserve::ReserveAssetDataEvent`;
944
1244
  }
1245
+ exports.isReserveAssetDataEvent = isReserveAssetDataEvent;
945
1246
  class ReserveAssetDataEvent {
946
1247
  constructor(typeArgs, fields) {
947
1248
  this.__StructClass = true;
@@ -1163,3 +1464,129 @@ exports.ReserveAssetDataEvent = ReserveAssetDataEvent;
1163
1464
  ReserveAssetDataEvent.$typeName = `${index_1.PKG_V1}::reserve::ReserveAssetDataEvent`;
1164
1465
  ReserveAssetDataEvent.$numTypeParams = 0;
1165
1466
  ReserveAssetDataEvent.$isPhantom = [];
1467
+ /* ============================== StakerKey =============================== */
1468
+ function isStakerKey(type) {
1469
+ type = (0, util_1.compressSuiType)(type);
1470
+ return type === `${index_1.PKG_V1}::reserve::StakerKey`;
1471
+ }
1472
+ exports.isStakerKey = isStakerKey;
1473
+ class StakerKey {
1474
+ constructor(typeArgs, fields) {
1475
+ this.__StructClass = true;
1476
+ this.$typeName = StakerKey.$typeName;
1477
+ this.$isPhantom = StakerKey.$isPhantom;
1478
+ this.$fullTypeName = (0, util_1.composeSuiType)(StakerKey.$typeName, ...typeArgs);
1479
+ this.$typeArgs = typeArgs;
1480
+ this.dummyField = fields.dummyField;
1481
+ }
1482
+ static reified() {
1483
+ return {
1484
+ typeName: StakerKey.$typeName,
1485
+ fullTypeName: (0, util_1.composeSuiType)(StakerKey.$typeName, ...[]),
1486
+ typeArgs: [],
1487
+ isPhantom: StakerKey.$isPhantom,
1488
+ reifiedTypeArgs: [],
1489
+ fromFields: (fields) => StakerKey.fromFields(fields),
1490
+ fromFieldsWithTypes: (item) => StakerKey.fromFieldsWithTypes(item),
1491
+ fromBcs: (data) => StakerKey.fromBcs(data),
1492
+ bcs: StakerKey.bcs,
1493
+ fromJSONField: (field) => StakerKey.fromJSONField(field),
1494
+ fromJSON: (json) => StakerKey.fromJSON(json),
1495
+ fromSuiParsedData: (content) => StakerKey.fromSuiParsedData(content),
1496
+ fromSuiObjectData: (content) => StakerKey.fromSuiObjectData(content),
1497
+ fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return StakerKey.fetch(client, id); }),
1498
+ new: (fields) => {
1499
+ return new StakerKey([], fields);
1500
+ },
1501
+ kind: "StructClassReified",
1502
+ };
1503
+ }
1504
+ static get r() {
1505
+ return StakerKey.reified();
1506
+ }
1507
+ static phantom() {
1508
+ return (0, reified_1.phantom)(StakerKey.reified());
1509
+ }
1510
+ static get p() {
1511
+ return StakerKey.phantom();
1512
+ }
1513
+ static get bcs() {
1514
+ return bcs_1.bcs.struct("StakerKey", {
1515
+ dummy_field: bcs_1.bcs.bool(),
1516
+ });
1517
+ }
1518
+ static fromFields(fields) {
1519
+ return StakerKey.reified().new({
1520
+ dummyField: (0, reified_1.decodeFromFields)("bool", fields.dummy_field),
1521
+ });
1522
+ }
1523
+ static fromFieldsWithTypes(item) {
1524
+ if (!isStakerKey(item.type)) {
1525
+ throw new Error("not a StakerKey type");
1526
+ }
1527
+ return StakerKey.reified().new({
1528
+ dummyField: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.dummy_field),
1529
+ });
1530
+ }
1531
+ static fromBcs(data) {
1532
+ return StakerKey.fromFields(StakerKey.bcs.parse(data));
1533
+ }
1534
+ toJSONField() {
1535
+ return {
1536
+ dummyField: this.dummyField,
1537
+ };
1538
+ }
1539
+ toJSON() {
1540
+ return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1541
+ }
1542
+ static fromJSONField(field) {
1543
+ return StakerKey.reified().new({
1544
+ dummyField: (0, reified_1.decodeFromJSONField)("bool", field.dummyField),
1545
+ });
1546
+ }
1547
+ static fromJSON(json) {
1548
+ if (json.$typeName !== StakerKey.$typeName) {
1549
+ throw new Error("not a WithTwoGenerics json object");
1550
+ }
1551
+ return StakerKey.fromJSONField(json);
1552
+ }
1553
+ static fromSuiParsedData(content) {
1554
+ if (content.dataType !== "moveObject") {
1555
+ throw new Error("not an object");
1556
+ }
1557
+ if (!isStakerKey(content.type)) {
1558
+ throw new Error(`object at ${content.fields.id} is not a StakerKey object`);
1559
+ }
1560
+ return StakerKey.fromFieldsWithTypes(content);
1561
+ }
1562
+ static fromSuiObjectData(data) {
1563
+ if (data.bcs) {
1564
+ if (data.bcs.dataType !== "moveObject" || !isStakerKey(data.bcs.type)) {
1565
+ throw new Error(`object at is not a StakerKey object`);
1566
+ }
1567
+ return StakerKey.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1568
+ }
1569
+ if (data.content) {
1570
+ return StakerKey.fromSuiParsedData(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
+ static fetch(client, id) {
1575
+ return __awaiter(this, void 0, void 0, function* () {
1576
+ var _a, _b;
1577
+ const res = yield client.getObject({ id, options: { showBcs: true } });
1578
+ if (res.error) {
1579
+ throw new Error(`error fetching StakerKey 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
+ !isStakerKey(res.data.bcs.type)) {
1583
+ throw new Error(`object at id ${id} is not a StakerKey object`);
1584
+ }
1585
+ return StakerKey.fromSuiObjectData(res.data);
1586
+ });
1587
+ }
1588
+ }
1589
+ exports.StakerKey = StakerKey;
1590
+ StakerKey.$typeName = `${index_1.PKG_V1}::reserve::StakerKey`;
1591
+ StakerKey.$numTypeParams = 0;
1592
+ StakerKey.$isPhantom = [];
@@ -1,12 +1,18 @@
1
1
  import { GenericArg } from "../../_framework/util";
2
2
  import { Transaction, TransactionArgument, TransactionObjectInput } from "@mysten/sui/transactions";
3
+ export declare function destroy(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
3
4
  export interface SetArgs {
4
5
  builder: TransactionObjectInput;
5
6
  field: GenericArg;
6
7
  value: GenericArg;
7
8
  }
8
9
  export declare function set(tx: Transaction, typeArgs: [string, string], args: SetArgs): import("@mysten/sui/transactions").TransactionResult;
9
- export declare function destroy(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
10
+ export interface SetSpreadFeeBpsArgs {
11
+ builder: TransactionObjectInput;
12
+ spreadFeeBps: bigint | TransactionArgument;
13
+ }
14
+ export declare function setSpreadFeeBps(tx: Transaction, args: SetSpreadFeeBpsArgs): import("@mysten/sui/transactions").TransactionResult;
15
+ export declare function spreadFee(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
10
16
  export declare function from(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
11
17
  export declare function borrowFee(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
12
18
  export declare function borrowLimit(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
@@ -137,12 +143,6 @@ export interface SetProtocolLiquidationFeeBpsArgs {
137
143
  protocolLiquidationFeeBps: bigint | TransactionArgument;
138
144
  }
139
145
  export declare function setProtocolLiquidationFeeBps(tx: Transaction, args: SetProtocolLiquidationFeeBpsArgs): import("@mysten/sui/transactions").TransactionResult;
140
- export interface SetSpreadFeeBpsArgs {
141
- builder: TransactionObjectInput;
142
- spreadFeeBps: bigint | TransactionArgument;
143
- }
144
- export declare function setSpreadFeeBps(tx: Transaction, args: SetSpreadFeeBpsArgs): import("@mysten/sui/transactions").TransactionResult;
145
- export declare function spreadFee(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
146
146
  export declare function validateReserveConfig(tx: Transaction, config: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
147
147
  export interface ValidateUtilsAndAprsArgs {
148
148
  utils: Array<number | TransactionArgument> | TransactionArgument;