@suilend/sdk 1.1.99 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -7
  2. package/_generated/_dependencies/source/0x1/ascii/structs.js +35 -75
  3. package/_generated/_dependencies/source/0x1/index.js +3 -6
  4. package/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -3
  5. package/_generated/_dependencies/source/0x1/option/structs.js +31 -69
  6. package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -5
  7. package/_generated/_dependencies/source/0x1/type-name/structs.js +20 -25
  8. package/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -7
  9. package/_generated/_dependencies/source/0x2/bag/structs.js +24 -29
  10. package/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -7
  11. package/_generated/_dependencies/source/0x2/balance/structs.js +49 -56
  12. package/_generated/_dependencies/source/0x2/index.js +3 -6
  13. package/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -8
  14. package/_generated/_dependencies/source/0x2/object/structs.js +34 -41
  15. package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +7 -7
  16. package/_generated/_dependencies/source/0x2/object-table/structs.js +31 -36
  17. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +5 -5
  18. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +23 -28
  19. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js +4 -7
  20. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +11 -11
  21. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +32 -37
  22. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +23 -23
  23. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +29 -34
  24. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +4 -4
  25. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +21 -59
  26. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +55 -55
  27. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +46 -53
  28. package/_generated/_framework/reified.d.ts +2 -2
  29. package/_generated/_framework/reified.js +27 -40
  30. package/_generated/_framework/util.js +26 -40
  31. package/_generated/_framework/vector.d.ts +4 -4
  32. package/_generated/_framework/vector.js +16 -21
  33. package/_generated/suilend/cell/structs.d.ts +4 -4
  34. package/_generated/suilend/cell/structs.js +31 -36
  35. package/_generated/suilend/decimal/structs.d.ts +4 -4
  36. package/_generated/suilend/decimal/structs.js +19 -24
  37. package/_generated/suilend/index.js +8 -12
  38. package/_generated/suilend/lending-market/functions.d.ts +1 -0
  39. package/_generated/suilend/lending-market/functions.js +271 -302
  40. package/_generated/suilend/lending-market/structs.d.ts +146 -146
  41. package/_generated/suilend/lending-market/structs.js +549 -617
  42. package/_generated/suilend/lending-market-registry/functions.js +7 -11
  43. package/_generated/suilend/liquidity-mining/structs.d.ts +50 -50
  44. package/_generated/suilend/liquidity-mining/structs.js +159 -205
  45. package/_generated/suilend/obligation/structs.d.ts +106 -106
  46. package/_generated/suilend/obligation/structs.js +313 -363
  47. package/_generated/suilend/rate-limiter/functions.js +23 -31
  48. package/_generated/suilend/rate-limiter/structs.d.ts +15 -15
  49. package/_generated/suilend/rate-limiter/structs.js +49 -56
  50. package/_generated/suilend/reserve/structs.d.ts +139 -139
  51. package/_generated/suilend/reserve/structs.js +397 -451
  52. package/_generated/suilend/reserve-config/functions.js +149 -190
  53. package/_generated/suilend/reserve-config/structs.d.ts +33 -33
  54. package/_generated/suilend/reserve-config/structs.js +109 -149
  55. package/api/events.js +1 -5
  56. package/api/index.js +1 -17
  57. package/client.d.ts +10 -10
  58. package/client.js +118 -128
  59. package/index.js +7 -23
  60. package/lib/constants.js +3 -9
  61. package/lib/index.js +5 -21
  62. package/lib/initialize.d.ts +3 -3
  63. package/lib/initialize.js +103 -140
  64. package/lib/liquidityMining.d.ts +3 -3
  65. package/lib/liquidityMining.js +57 -72
  66. package/lib/pyth.js +9 -14
  67. package/lib/strategyOwnerCap.js +106 -119
  68. package/lib/transactions.js +2 -7
  69. package/lib/types.js +4 -7
  70. package/mmt.js +2 -5
  71. package/package.json +1 -1
  72. package/parsers/apiReserveAssetDataEvent.js +25 -33
  73. package/parsers/index.js +5 -21
  74. package/parsers/lendingMarket.d.ts +1 -1
  75. package/parsers/lendingMarket.js +12 -19
  76. package/parsers/obligation.js +19 -26
  77. package/parsers/rateLimiter.js +11 -19
  78. package/parsers/reserve.d.ts +1 -1
  79. package/parsers/reserve.js +42 -85
  80. package/strategies.d.ts +11 -11
  81. package/strategies.js +547 -586
  82. package/swap/index.js +2 -18
  83. package/swap/quote.js +57 -65
  84. package/swap/transaction.d.ts +2 -2
  85. package/swap/transaction.js +40 -35
  86. package/utils/events.d.ts +3 -3
  87. package/utils/events.js +18 -35
  88. package/utils/index.js +16 -40
  89. package/utils/obligation.d.ts +4 -4
  90. package/utils/obligation.js +17 -60
  91. package/utils/simulate.js +118 -143
@@ -1,37 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -41,49 +7,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
8
  });
43
9
  };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.StakerKey = exports.ReserveAssetDataEvent = exports.Reserve = exports.LiquidityRequest = exports.InterestUpdateEvent = exports.ClaimStakingRewardsEvent = exports.CToken = exports.Balances = exports.BalanceKey = void 0;
46
- exports.isBalanceKey = isBalanceKey;
47
- exports.isBalances = isBalances;
48
- exports.isCToken = isCToken;
49
- exports.isClaimStakingRewardsEvent = isClaimStakingRewardsEvent;
50
- exports.isInterestUpdateEvent = isInterestUpdateEvent;
51
- exports.isLiquidityRequest = isLiquidityRequest;
52
- exports.isReserve = isReserve;
53
- exports.isReserveAssetDataEvent = isReserveAssetDataEvent;
54
- exports.isStakerKey = isStakerKey;
55
- const reified = __importStar(require("../../_framework/reified"));
56
- const structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
57
- const structs_2 = require("../../_dependencies/source/0x2/balance/structs");
58
- const structs_3 = require("../../_dependencies/source/0x2/object/structs");
59
- const structs_4 = require("../../_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs");
60
- const reified_1 = require("../../_framework/reified");
61
- const util_1 = require("../../_framework/util");
62
- const structs_5 = require("../cell/structs");
63
- const structs_6 = require("../decimal/structs");
64
- const index_1 = require("../index");
65
- const structs_7 = require("../liquidity-mining/structs");
66
- const structs_8 = require("../reserve-config/structs");
67
- const bcs_1 = require("@mysten/sui/bcs");
68
- const utils_1 = require("@mysten/sui/utils");
10
+ import * as reified from "../../_framework/reified";
11
+ import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
12
+ import { Balance, Supply, } from "../../_dependencies/source/0x2/balance/structs";
13
+ import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
14
+ import { PriceIdentifier } from "../../_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs";
15
+ import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom, } from "../../_framework/reified";
16
+ import { composeSuiType, compressSuiType, parseTypeName, } from "../../_framework/util";
17
+ import { Cell } from "../cell/structs";
18
+ import { Decimal } from "../decimal/structs";
19
+ import { PKG_V1, PKG_V8 } from "../index";
20
+ import { PoolRewardManager } from "../liquidity-mining/structs";
21
+ import { ReserveConfig } from "../reserve-config/structs";
22
+ import { bcs } from "@mysten/sui/bcs";
23
+ import { fromBase64, fromHex, toHex } from "@mysten/sui/utils";
69
24
  /* ============================== BalanceKey =============================== */
70
- function isBalanceKey(type) {
71
- type = (0, util_1.compressSuiType)(type);
72
- return type === `${index_1.PKG_V1}::reserve::BalanceKey`;
25
+ export function isBalanceKey(type) {
26
+ type = compressSuiType(type);
27
+ return type === `${PKG_V1}::reserve::BalanceKey`;
73
28
  }
74
- class BalanceKey {
29
+ export class BalanceKey {
75
30
  constructor(typeArgs, fields) {
76
31
  this.__StructClass = true;
77
32
  this.$typeName = BalanceKey.$typeName;
78
33
  this.$isPhantom = BalanceKey.$isPhantom;
79
- this.$fullTypeName = (0, util_1.composeSuiType)(BalanceKey.$typeName, ...typeArgs);
34
+ this.$fullTypeName = composeSuiType(BalanceKey.$typeName, ...typeArgs);
80
35
  this.$typeArgs = typeArgs;
81
36
  this.dummyField = fields.dummyField;
82
37
  }
83
38
  static reified() {
84
39
  return {
85
40
  typeName: BalanceKey.$typeName,
86
- fullTypeName: (0, util_1.composeSuiType)(BalanceKey.$typeName, ...[]),
41
+ fullTypeName: composeSuiType(BalanceKey.$typeName, ...[]),
87
42
  typeArgs: [],
88
43
  isPhantom: BalanceKey.$isPhantom,
89
44
  reifiedTypeArgs: [],
@@ -106,19 +61,19 @@ class BalanceKey {
106
61
  return BalanceKey.reified();
107
62
  }
108
63
  static phantom() {
109
- return (0, reified_1.phantom)(BalanceKey.reified());
64
+ return phantom(BalanceKey.reified());
110
65
  }
111
66
  static get p() {
112
67
  return BalanceKey.phantom();
113
68
  }
114
69
  static get bcs() {
115
- return bcs_1.bcs.struct("BalanceKey", {
116
- dummy_field: bcs_1.bcs.bool(),
70
+ return bcs.struct("BalanceKey", {
71
+ dummy_field: bcs.bool(),
117
72
  });
118
73
  }
119
74
  static fromFields(fields) {
120
75
  return BalanceKey.reified().new({
121
- dummyField: (0, reified_1.decodeFromFields)("bool", fields.dummy_field),
76
+ dummyField: decodeFromFields("bool", fields.dummy_field),
122
77
  });
123
78
  }
124
79
  static fromFieldsWithTypes(item) {
@@ -126,7 +81,7 @@ class BalanceKey {
126
81
  throw new Error("not a BalanceKey type");
127
82
  }
128
83
  return BalanceKey.reified().new({
129
- dummyField: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.dummy_field),
84
+ dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field),
130
85
  });
131
86
  }
132
87
  static fromBcs(data) {
@@ -142,7 +97,7 @@ class BalanceKey {
142
97
  }
143
98
  static fromJSONField(field) {
144
99
  return BalanceKey.reified().new({
145
- dummyField: (0, reified_1.decodeFromJSONField)("bool", field.dummyField),
100
+ dummyField: decodeFromJSONField("bool", field.dummyField),
146
101
  });
147
102
  }
148
103
  static fromJSON(json) {
@@ -165,7 +120,7 @@ class BalanceKey {
165
120
  if (data.bcs.dataType !== "moveObject" || !isBalanceKey(data.bcs.type)) {
166
121
  throw new Error(`object at is not a BalanceKey object`);
167
122
  }
168
- return BalanceKey.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
123
+ return BalanceKey.fromBcs(fromBase64(data.bcs.bcsBytes));
169
124
  }
170
125
  if (data.content) {
171
126
  return BalanceKey.fromSuiParsedData(data.content);
@@ -187,21 +142,20 @@ class BalanceKey {
187
142
  });
188
143
  }
189
144
  }
190
- exports.BalanceKey = BalanceKey;
191
- BalanceKey.$typeName = `${index_1.PKG_V1}::reserve::BalanceKey`;
145
+ BalanceKey.$typeName = `${PKG_V1}::reserve::BalanceKey`;
192
146
  BalanceKey.$numTypeParams = 0;
193
147
  BalanceKey.$isPhantom = [];
194
148
  /* ============================== Balances =============================== */
195
- function isBalances(type) {
196
- type = (0, util_1.compressSuiType)(type);
197
- return type.startsWith(`${index_1.PKG_V1}::reserve::Balances` + "<");
149
+ export function isBalances(type) {
150
+ type = compressSuiType(type);
151
+ return type.startsWith(`${PKG_V1}::reserve::Balances` + "<");
198
152
  }
199
- class Balances {
153
+ export class Balances {
200
154
  constructor(typeArgs, fields) {
201
155
  this.__StructClass = true;
202
156
  this.$typeName = Balances.$typeName;
203
157
  this.$isPhantom = Balances.$isPhantom;
204
- this.$fullTypeName = (0, util_1.composeSuiType)(Balances.$typeName, ...typeArgs);
158
+ this.$fullTypeName = composeSuiType(Balances.$typeName, ...typeArgs);
205
159
  this.$typeArgs = typeArgs;
206
160
  this.availableAmount = fields.availableAmount;
207
161
  this.ctokenSupply = fields.ctokenSupply;
@@ -212,8 +166,8 @@ class Balances {
212
166
  static reified(P, T) {
213
167
  return {
214
168
  typeName: Balances.$typeName,
215
- fullTypeName: (0, util_1.composeSuiType)(Balances.$typeName, ...[(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)]),
216
- typeArgs: [(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)],
169
+ fullTypeName: composeSuiType(Balances.$typeName, ...[extractType(P), extractType(T)]),
170
+ typeArgs: [extractType(P), extractType(T)],
217
171
  isPhantom: Balances.$isPhantom,
218
172
  reifiedTypeArgs: [P, T],
219
173
  fromFields: (fields) => Balances.fromFields([P, T], fields),
@@ -226,7 +180,7 @@ class Balances {
226
180
  fromSuiObjectData: (content) => Balances.fromSuiObjectData([P, T], content),
227
181
  fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Balances.fetch(client, [P, T], id); }),
228
182
  new: (fields) => {
229
- return new Balances([(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)], fields);
183
+ return new Balances([extractType(P), extractType(T)], fields);
230
184
  },
231
185
  kind: "StructClassReified",
232
186
  };
@@ -235,40 +189,40 @@ class Balances {
235
189
  return Balances.reified;
236
190
  }
237
191
  static phantom(P, T) {
238
- return (0, reified_1.phantom)(Balances.reified(P, T));
192
+ return phantom(Balances.reified(P, T));
239
193
  }
240
194
  static get p() {
241
195
  return Balances.phantom;
242
196
  }
243
197
  static get bcs() {
244
- return bcs_1.bcs.struct("Balances", {
245
- available_amount: structs_2.Balance.bcs,
246
- ctoken_supply: structs_2.Supply.bcs,
247
- fees: structs_2.Balance.bcs,
248
- ctoken_fees: structs_2.Balance.bcs,
249
- deposited_ctokens: structs_2.Balance.bcs,
198
+ return bcs.struct("Balances", {
199
+ available_amount: Balance.bcs,
200
+ ctoken_supply: Supply.bcs,
201
+ fees: Balance.bcs,
202
+ ctoken_fees: Balance.bcs,
203
+ deposited_ctokens: Balance.bcs,
250
204
  });
251
205
  }
252
206
  static fromFields(typeArgs, fields) {
253
207
  return Balances.reified(typeArgs[0], typeArgs[1]).new({
254
- availableAmount: (0, reified_1.decodeFromFields)(structs_2.Balance.reified(typeArgs[1]), fields.available_amount),
255
- ctokenSupply: (0, reified_1.decodeFromFields)(structs_2.Supply.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), fields.ctoken_supply),
256
- fees: (0, reified_1.decodeFromFields)(structs_2.Balance.reified(typeArgs[1]), fields.fees),
257
- ctokenFees: (0, reified_1.decodeFromFields)(structs_2.Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), fields.ctoken_fees),
258
- depositedCtokens: (0, reified_1.decodeFromFields)(structs_2.Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), fields.deposited_ctokens),
208
+ availableAmount: decodeFromFields(Balance.reified(typeArgs[1]), fields.available_amount),
209
+ ctokenSupply: decodeFromFields(Supply.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), fields.ctoken_supply),
210
+ fees: decodeFromFields(Balance.reified(typeArgs[1]), fields.fees),
211
+ ctokenFees: decodeFromFields(Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), fields.ctoken_fees),
212
+ depositedCtokens: decodeFromFields(Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), fields.deposited_ctokens),
259
213
  });
260
214
  }
261
215
  static fromFieldsWithTypes(typeArgs, item) {
262
216
  if (!isBalances(item.type)) {
263
217
  throw new Error("not a Balances type");
264
218
  }
265
- (0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
219
+ assertFieldsWithTypesArgsMatch(item, typeArgs);
266
220
  return Balances.reified(typeArgs[0], typeArgs[1]).new({
267
- availableAmount: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.Balance.reified(typeArgs[1]), item.fields.available_amount),
268
- ctokenSupply: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.Supply.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), item.fields.ctoken_supply),
269
- fees: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.Balance.reified(typeArgs[1]), item.fields.fees),
270
- ctokenFees: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), item.fields.ctoken_fees),
271
- depositedCtokens: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), item.fields.deposited_ctokens),
221
+ availableAmount: decodeFromFieldsWithTypes(Balance.reified(typeArgs[1]), item.fields.available_amount),
222
+ ctokenSupply: decodeFromFieldsWithTypes(Supply.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), item.fields.ctoken_supply),
223
+ fees: decodeFromFieldsWithTypes(Balance.reified(typeArgs[1]), item.fields.fees),
224
+ ctokenFees: decodeFromFieldsWithTypes(Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), item.fields.ctoken_fees),
225
+ depositedCtokens: decodeFromFieldsWithTypes(Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), item.fields.deposited_ctokens),
272
226
  });
273
227
  }
274
228
  static fromBcs(typeArgs, data) {
@@ -288,18 +242,18 @@ class Balances {
288
242
  }
289
243
  static fromJSONField(typeArgs, field) {
290
244
  return Balances.reified(typeArgs[0], typeArgs[1]).new({
291
- availableAmount: (0, reified_1.decodeFromJSONField)(structs_2.Balance.reified(typeArgs[1]), field.availableAmount),
292
- ctokenSupply: (0, reified_1.decodeFromJSONField)(structs_2.Supply.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), field.ctokenSupply),
293
- fees: (0, reified_1.decodeFromJSONField)(structs_2.Balance.reified(typeArgs[1]), field.fees),
294
- ctokenFees: (0, reified_1.decodeFromJSONField)(structs_2.Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), field.ctokenFees),
295
- depositedCtokens: (0, reified_1.decodeFromJSONField)(structs_2.Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), field.depositedCtokens),
245
+ availableAmount: decodeFromJSONField(Balance.reified(typeArgs[1]), field.availableAmount),
246
+ ctokenSupply: decodeFromJSONField(Supply.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), field.ctokenSupply),
247
+ fees: decodeFromJSONField(Balance.reified(typeArgs[1]), field.fees),
248
+ ctokenFees: decodeFromJSONField(Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), field.ctokenFees),
249
+ depositedCtokens: decodeFromJSONField(Balance.reified(reified.phantom(CToken.reified(typeArgs[0], typeArgs[1]))), field.depositedCtokens),
296
250
  });
297
251
  }
298
252
  static fromJSON(typeArgs, json) {
299
253
  if (json.$typeName !== Balances.$typeName) {
300
254
  throw new Error("not a WithTwoGenerics json object");
301
255
  }
302
- (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(Balances.$typeName, ...typeArgs.map(reified_1.extractType)), json.$typeArgs, typeArgs);
256
+ assertReifiedTypeArgsMatch(composeSuiType(Balances.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
303
257
  return Balances.fromJSONField(typeArgs, json);
304
258
  }
305
259
  static fromSuiParsedData(typeArgs, content) {
@@ -316,18 +270,18 @@ class Balances {
316
270
  if (data.bcs.dataType !== "moveObject" || !isBalances(data.bcs.type)) {
317
271
  throw new Error(`object at is not a Balances object`);
318
272
  }
319
- const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
273
+ const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
320
274
  if (gotTypeArgs.length !== 2) {
321
275
  throw new Error(`type argument mismatch: expected 2 type arguments but got ${gotTypeArgs.length}`);
322
276
  }
323
277
  for (let i = 0; i < 2; i++) {
324
- const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
325
- const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
278
+ const gotTypeArg = compressSuiType(gotTypeArgs[i]);
279
+ const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
326
280
  if (gotTypeArg !== expectedTypeArg) {
327
281
  throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
328
282
  }
329
283
  }
330
- return Balances.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
284
+ return Balances.fromBcs(typeArgs, fromBase64(data.bcs.bcsBytes));
331
285
  }
332
286
  if (data.content) {
333
287
  return Balances.fromSuiParsedData(typeArgs, data.content);
@@ -349,29 +303,28 @@ class Balances {
349
303
  });
350
304
  }
351
305
  }
352
- exports.Balances = Balances;
353
- Balances.$typeName = `${index_1.PKG_V1}::reserve::Balances`;
306
+ Balances.$typeName = `${PKG_V1}::reserve::Balances`;
354
307
  Balances.$numTypeParams = 2;
355
308
  Balances.$isPhantom = [true, true];
356
309
  /* ============================== CToken =============================== */
357
- function isCToken(type) {
358
- type = (0, util_1.compressSuiType)(type);
359
- return type.startsWith(`${index_1.PKG_V1}::reserve::CToken` + "<");
310
+ export function isCToken(type) {
311
+ type = compressSuiType(type);
312
+ return type.startsWith(`${PKG_V1}::reserve::CToken` + "<");
360
313
  }
361
- class CToken {
314
+ export class CToken {
362
315
  constructor(typeArgs, fields) {
363
316
  this.__StructClass = true;
364
317
  this.$typeName = CToken.$typeName;
365
318
  this.$isPhantom = CToken.$isPhantom;
366
- this.$fullTypeName = (0, util_1.composeSuiType)(CToken.$typeName, ...typeArgs);
319
+ this.$fullTypeName = composeSuiType(CToken.$typeName, ...typeArgs);
367
320
  this.$typeArgs = typeArgs;
368
321
  this.dummyField = fields.dummyField;
369
322
  }
370
323
  static reified(P, T) {
371
324
  return {
372
325
  typeName: CToken.$typeName,
373
- fullTypeName: (0, util_1.composeSuiType)(CToken.$typeName, ...[(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)]),
374
- typeArgs: [(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)],
326
+ fullTypeName: composeSuiType(CToken.$typeName, ...[extractType(P), extractType(T)]),
327
+ typeArgs: [extractType(P), extractType(T)],
375
328
  isPhantom: CToken.$isPhantom,
376
329
  reifiedTypeArgs: [P, T],
377
330
  fromFields: (fields) => CToken.fromFields([P, T], fields),
@@ -384,7 +337,7 @@ class CToken {
384
337
  fromSuiObjectData: (content) => CToken.fromSuiObjectData([P, T], content),
385
338
  fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return CToken.fetch(client, [P, T], id); }),
386
339
  new: (fields) => {
387
- return new CToken([(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)], fields);
340
+ return new CToken([extractType(P), extractType(T)], fields);
388
341
  },
389
342
  kind: "StructClassReified",
390
343
  };
@@ -393,28 +346,28 @@ class CToken {
393
346
  return CToken.reified;
394
347
  }
395
348
  static phantom(P, T) {
396
- return (0, reified_1.phantom)(CToken.reified(P, T));
349
+ return phantom(CToken.reified(P, T));
397
350
  }
398
351
  static get p() {
399
352
  return CToken.phantom;
400
353
  }
401
354
  static get bcs() {
402
- return bcs_1.bcs.struct("CToken", {
403
- dummy_field: bcs_1.bcs.bool(),
355
+ return bcs.struct("CToken", {
356
+ dummy_field: bcs.bool(),
404
357
  });
405
358
  }
406
359
  static fromFields(typeArgs, fields) {
407
360
  return CToken.reified(typeArgs[0], typeArgs[1]).new({
408
- dummyField: (0, reified_1.decodeFromFields)("bool", fields.dummy_field),
361
+ dummyField: decodeFromFields("bool", fields.dummy_field),
409
362
  });
410
363
  }
411
364
  static fromFieldsWithTypes(typeArgs, item) {
412
365
  if (!isCToken(item.type)) {
413
366
  throw new Error("not a CToken type");
414
367
  }
415
- (0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
368
+ assertFieldsWithTypesArgsMatch(item, typeArgs);
416
369
  return CToken.reified(typeArgs[0], typeArgs[1]).new({
417
- dummyField: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.dummy_field),
370
+ dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field),
418
371
  });
419
372
  }
420
373
  static fromBcs(typeArgs, data) {
@@ -430,14 +383,14 @@ class CToken {
430
383
  }
431
384
  static fromJSONField(typeArgs, field) {
432
385
  return CToken.reified(typeArgs[0], typeArgs[1]).new({
433
- dummyField: (0, reified_1.decodeFromJSONField)("bool", field.dummyField),
386
+ dummyField: decodeFromJSONField("bool", field.dummyField),
434
387
  });
435
388
  }
436
389
  static fromJSON(typeArgs, json) {
437
390
  if (json.$typeName !== CToken.$typeName) {
438
391
  throw new Error("not a WithTwoGenerics json object");
439
392
  }
440
- (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(CToken.$typeName, ...typeArgs.map(reified_1.extractType)), json.$typeArgs, typeArgs);
393
+ assertReifiedTypeArgsMatch(composeSuiType(CToken.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
441
394
  return CToken.fromJSONField(typeArgs, json);
442
395
  }
443
396
  static fromSuiParsedData(typeArgs, content) {
@@ -454,18 +407,18 @@ class CToken {
454
407
  if (data.bcs.dataType !== "moveObject" || !isCToken(data.bcs.type)) {
455
408
  throw new Error(`object at is not a CToken object`);
456
409
  }
457
- const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
410
+ const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
458
411
  if (gotTypeArgs.length !== 2) {
459
412
  throw new Error(`type argument mismatch: expected 2 type arguments but got ${gotTypeArgs.length}`);
460
413
  }
461
414
  for (let i = 0; i < 2; i++) {
462
- const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
463
- const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
415
+ const gotTypeArg = compressSuiType(gotTypeArgs[i]);
416
+ const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
464
417
  if (gotTypeArg !== expectedTypeArg) {
465
418
  throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
466
419
  }
467
420
  }
468
- return CToken.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
421
+ return CToken.fromBcs(typeArgs, fromBase64(data.bcs.bcsBytes));
469
422
  }
470
423
  if (data.content) {
471
424
  return CToken.fromSuiParsedData(typeArgs, data.content);
@@ -487,21 +440,20 @@ class CToken {
487
440
  });
488
441
  }
489
442
  }
490
- exports.CToken = CToken;
491
- CToken.$typeName = `${index_1.PKG_V1}::reserve::CToken`;
443
+ CToken.$typeName = `${PKG_V1}::reserve::CToken`;
492
444
  CToken.$numTypeParams = 2;
493
445
  CToken.$isPhantom = [true, true];
494
446
  /* ============================== ClaimStakingRewardsEvent =============================== */
495
- function isClaimStakingRewardsEvent(type) {
496
- type = (0, util_1.compressSuiType)(type);
497
- return type === `${index_1.PKG_V8}::reserve::ClaimStakingRewardsEvent`;
447
+ export function isClaimStakingRewardsEvent(type) {
448
+ type = compressSuiType(type);
449
+ return type === `${PKG_V8}::reserve::ClaimStakingRewardsEvent`;
498
450
  }
499
- class ClaimStakingRewardsEvent {
451
+ export class ClaimStakingRewardsEvent {
500
452
  constructor(typeArgs, fields) {
501
453
  this.__StructClass = true;
502
454
  this.$typeName = ClaimStakingRewardsEvent.$typeName;
503
455
  this.$isPhantom = ClaimStakingRewardsEvent.$isPhantom;
504
- this.$fullTypeName = (0, util_1.composeSuiType)(ClaimStakingRewardsEvent.$typeName, ...typeArgs);
456
+ this.$fullTypeName = composeSuiType(ClaimStakingRewardsEvent.$typeName, ...typeArgs);
505
457
  this.$typeArgs = typeArgs;
506
458
  this.lendingMarketId = fields.lendingMarketId;
507
459
  this.coinType = fields.coinType;
@@ -511,7 +463,7 @@ class ClaimStakingRewardsEvent {
511
463
  static reified() {
512
464
  return {
513
465
  typeName: ClaimStakingRewardsEvent.$typeName,
514
- fullTypeName: (0, util_1.composeSuiType)(ClaimStakingRewardsEvent.$typeName, ...[]),
466
+ fullTypeName: composeSuiType(ClaimStakingRewardsEvent.$typeName, ...[]),
515
467
  typeArgs: [],
516
468
  isPhantom: ClaimStakingRewardsEvent.$isPhantom,
517
469
  reifiedTypeArgs: [],
@@ -534,35 +486,35 @@ class ClaimStakingRewardsEvent {
534
486
  return ClaimStakingRewardsEvent.reified();
535
487
  }
536
488
  static phantom() {
537
- return (0, reified_1.phantom)(ClaimStakingRewardsEvent.reified());
489
+ return phantom(ClaimStakingRewardsEvent.reified());
538
490
  }
539
491
  static get p() {
540
492
  return ClaimStakingRewardsEvent.phantom();
541
493
  }
542
494
  static get bcs() {
543
- return bcs_1.bcs.struct("ClaimStakingRewardsEvent", {
544
- lending_market_id: bcs_1.bcs
495
+ return bcs.struct("ClaimStakingRewardsEvent", {
496
+ lending_market_id: bcs
545
497
  .bytes(32)
546
498
  .transform({
547
- input: (val) => (0, utils_1.fromHEX)(val),
548
- output: (val) => (0, utils_1.toHEX)(val),
499
+ input: (val) => fromHex(val),
500
+ output: (val) => toHex(val),
549
501
  }),
550
- coin_type: structs_1.TypeName.bcs,
551
- reserve_id: bcs_1.bcs
502
+ coin_type: TypeName.bcs,
503
+ reserve_id: bcs
552
504
  .bytes(32)
553
505
  .transform({
554
- input: (val) => (0, utils_1.fromHEX)(val),
555
- output: (val) => (0, utils_1.toHEX)(val),
506
+ input: (val) => fromHex(val),
507
+ output: (val) => toHex(val),
556
508
  }),
557
- amount: bcs_1.bcs.u64(),
509
+ amount: bcs.u64(),
558
510
  });
559
511
  }
560
512
  static fromFields(fields) {
561
513
  return ClaimStakingRewardsEvent.reified().new({
562
- lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
563
- coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
564
- reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
565
- amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
514
+ lendingMarketId: decodeFromFields("address", fields.lending_market_id),
515
+ coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
516
+ reserveId: decodeFromFields("address", fields.reserve_id),
517
+ amount: decodeFromFields("u64", fields.amount),
566
518
  });
567
519
  }
568
520
  static fromFieldsWithTypes(item) {
@@ -570,10 +522,10 @@ class ClaimStakingRewardsEvent {
570
522
  throw new Error("not a ClaimStakingRewardsEvent type");
571
523
  }
572
524
  return ClaimStakingRewardsEvent.reified().new({
573
- lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
574
- coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
575
- reserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.reserve_id),
576
- amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
525
+ lendingMarketId: decodeFromFieldsWithTypes("address", item.fields.lending_market_id),
526
+ coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
527
+ reserveId: decodeFromFieldsWithTypes("address", item.fields.reserve_id),
528
+ amount: decodeFromFieldsWithTypes("u64", item.fields.amount),
577
529
  });
578
530
  }
579
531
  static fromBcs(data) {
@@ -592,10 +544,10 @@ class ClaimStakingRewardsEvent {
592
544
  }
593
545
  static fromJSONField(field) {
594
546
  return ClaimStakingRewardsEvent.reified().new({
595
- lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
596
- coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
597
- reserveId: (0, reified_1.decodeFromJSONField)("address", field.reserveId),
598
- amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
547
+ lendingMarketId: decodeFromJSONField("address", field.lendingMarketId),
548
+ coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
549
+ reserveId: decodeFromJSONField("address", field.reserveId),
550
+ amount: decodeFromJSONField("u64", field.amount),
599
551
  });
600
552
  }
601
553
  static fromJSON(json) {
@@ -619,7 +571,7 @@ class ClaimStakingRewardsEvent {
619
571
  !isClaimStakingRewardsEvent(data.bcs.type)) {
620
572
  throw new Error(`object at is not a ClaimStakingRewardsEvent object`);
621
573
  }
622
- return ClaimStakingRewardsEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
574
+ return ClaimStakingRewardsEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
623
575
  }
624
576
  if (data.content) {
625
577
  return ClaimStakingRewardsEvent.fromSuiParsedData(data.content);
@@ -641,21 +593,20 @@ class ClaimStakingRewardsEvent {
641
593
  });
642
594
  }
643
595
  }
644
- exports.ClaimStakingRewardsEvent = ClaimStakingRewardsEvent;
645
- ClaimStakingRewardsEvent.$typeName = `${index_1.PKG_V8}::reserve::ClaimStakingRewardsEvent`;
596
+ ClaimStakingRewardsEvent.$typeName = `${PKG_V8}::reserve::ClaimStakingRewardsEvent`;
646
597
  ClaimStakingRewardsEvent.$numTypeParams = 0;
647
598
  ClaimStakingRewardsEvent.$isPhantom = [];
648
599
  /* ============================== InterestUpdateEvent =============================== */
649
- function isInterestUpdateEvent(type) {
650
- type = (0, util_1.compressSuiType)(type);
651
- return type === `${index_1.PKG_V1}::reserve::InterestUpdateEvent`;
600
+ export function isInterestUpdateEvent(type) {
601
+ type = compressSuiType(type);
602
+ return type === `${PKG_V1}::reserve::InterestUpdateEvent`;
652
603
  }
653
- class InterestUpdateEvent {
604
+ export class InterestUpdateEvent {
654
605
  constructor(typeArgs, fields) {
655
606
  this.__StructClass = true;
656
607
  this.$typeName = InterestUpdateEvent.$typeName;
657
608
  this.$isPhantom = InterestUpdateEvent.$isPhantom;
658
- this.$fullTypeName = (0, util_1.composeSuiType)(InterestUpdateEvent.$typeName, ...typeArgs);
609
+ this.$fullTypeName = composeSuiType(InterestUpdateEvent.$typeName, ...typeArgs);
659
610
  this.$typeArgs = typeArgs;
660
611
  this.lendingMarketId = fields.lendingMarketId;
661
612
  this.coinType = fields.coinType;
@@ -676,7 +627,7 @@ class InterestUpdateEvent {
676
627
  static reified() {
677
628
  return {
678
629
  typeName: InterestUpdateEvent.$typeName,
679
- fullTypeName: (0, util_1.composeSuiType)(InterestUpdateEvent.$typeName, ...[]),
630
+ fullTypeName: composeSuiType(InterestUpdateEvent.$typeName, ...[]),
680
631
  typeArgs: [],
681
632
  isPhantom: InterestUpdateEvent.$isPhantom,
682
633
  reifiedTypeArgs: [],
@@ -699,55 +650,55 @@ class InterestUpdateEvent {
699
650
  return InterestUpdateEvent.reified();
700
651
  }
701
652
  static phantom() {
702
- return (0, reified_1.phantom)(InterestUpdateEvent.reified());
653
+ return phantom(InterestUpdateEvent.reified());
703
654
  }
704
655
  static get p() {
705
656
  return InterestUpdateEvent.phantom();
706
657
  }
707
658
  static get bcs() {
708
- return bcs_1.bcs.struct("InterestUpdateEvent", {
709
- lending_market_id: bcs_1.bcs
659
+ return bcs.struct("InterestUpdateEvent", {
660
+ lending_market_id: bcs
710
661
  .bytes(32)
711
662
  .transform({
712
- input: (val) => (0, utils_1.fromHEX)(val),
713
- output: (val) => (0, utils_1.toHEX)(val),
663
+ input: (val) => fromHex(val),
664
+ output: (val) => toHex(val),
714
665
  }),
715
- coin_type: structs_1.TypeName.bcs,
716
- reserve_id: bcs_1.bcs
666
+ coin_type: TypeName.bcs,
667
+ reserve_id: bcs
717
668
  .bytes(32)
718
669
  .transform({
719
- input: (val) => (0, utils_1.fromHEX)(val),
720
- output: (val) => (0, utils_1.toHEX)(val),
670
+ input: (val) => fromHex(val),
671
+ output: (val) => toHex(val),
721
672
  }),
722
- cumulative_borrow_rate: structs_6.Decimal.bcs,
723
- available_amount: bcs_1.bcs.u64(),
724
- borrowed_amount: structs_6.Decimal.bcs,
725
- unclaimed_spread_fees: structs_6.Decimal.bcs,
726
- ctoken_supply: bcs_1.bcs.u64(),
727
- borrow_interest_paid: structs_6.Decimal.bcs,
728
- spread_fee: structs_6.Decimal.bcs,
729
- supply_interest_earned: structs_6.Decimal.bcs,
730
- borrow_interest_paid_usd_estimate: structs_6.Decimal.bcs,
731
- protocol_fee_usd_estimate: structs_6.Decimal.bcs,
732
- supply_interest_earned_usd_estimate: structs_6.Decimal.bcs,
673
+ cumulative_borrow_rate: Decimal.bcs,
674
+ available_amount: bcs.u64(),
675
+ borrowed_amount: Decimal.bcs,
676
+ unclaimed_spread_fees: Decimal.bcs,
677
+ ctoken_supply: bcs.u64(),
678
+ borrow_interest_paid: Decimal.bcs,
679
+ spread_fee: Decimal.bcs,
680
+ supply_interest_earned: Decimal.bcs,
681
+ borrow_interest_paid_usd_estimate: Decimal.bcs,
682
+ protocol_fee_usd_estimate: Decimal.bcs,
683
+ supply_interest_earned_usd_estimate: Decimal.bcs,
733
684
  });
734
685
  }
735
686
  static fromFields(fields) {
736
687
  return InterestUpdateEvent.reified().new({
737
- lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
738
- coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
739
- reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
740
- cumulativeBorrowRate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.cumulative_borrow_rate),
741
- availableAmount: (0, reified_1.decodeFromFields)("u64", fields.available_amount),
742
- borrowedAmount: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.borrowed_amount),
743
- unclaimedSpreadFees: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.unclaimed_spread_fees),
744
- ctokenSupply: (0, reified_1.decodeFromFields)("u64", fields.ctoken_supply),
745
- borrowInterestPaid: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.borrow_interest_paid),
746
- spreadFee: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.spread_fee),
747
- supplyInterestEarned: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.supply_interest_earned),
748
- borrowInterestPaidUsdEstimate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.borrow_interest_paid_usd_estimate),
749
- protocolFeeUsdEstimate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.protocol_fee_usd_estimate),
750
- supplyInterestEarnedUsdEstimate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.supply_interest_earned_usd_estimate),
688
+ lendingMarketId: decodeFromFields("address", fields.lending_market_id),
689
+ coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
690
+ reserveId: decodeFromFields("address", fields.reserve_id),
691
+ cumulativeBorrowRate: decodeFromFields(Decimal.reified(), fields.cumulative_borrow_rate),
692
+ availableAmount: decodeFromFields("u64", fields.available_amount),
693
+ borrowedAmount: decodeFromFields(Decimal.reified(), fields.borrowed_amount),
694
+ unclaimedSpreadFees: decodeFromFields(Decimal.reified(), fields.unclaimed_spread_fees),
695
+ ctokenSupply: decodeFromFields("u64", fields.ctoken_supply),
696
+ borrowInterestPaid: decodeFromFields(Decimal.reified(), fields.borrow_interest_paid),
697
+ spreadFee: decodeFromFields(Decimal.reified(), fields.spread_fee),
698
+ supplyInterestEarned: decodeFromFields(Decimal.reified(), fields.supply_interest_earned),
699
+ borrowInterestPaidUsdEstimate: decodeFromFields(Decimal.reified(), fields.borrow_interest_paid_usd_estimate),
700
+ protocolFeeUsdEstimate: decodeFromFields(Decimal.reified(), fields.protocol_fee_usd_estimate),
701
+ supplyInterestEarnedUsdEstimate: decodeFromFields(Decimal.reified(), fields.supply_interest_earned_usd_estimate),
751
702
  });
752
703
  }
753
704
  static fromFieldsWithTypes(item) {
@@ -755,20 +706,20 @@ class InterestUpdateEvent {
755
706
  throw new Error("not a InterestUpdateEvent type");
756
707
  }
757
708
  return InterestUpdateEvent.reified().new({
758
- lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
759
- coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
760
- reserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.reserve_id),
761
- cumulativeBorrowRate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.cumulative_borrow_rate),
762
- availableAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.available_amount),
763
- borrowedAmount: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.borrowed_amount),
764
- unclaimedSpreadFees: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.unclaimed_spread_fees),
765
- ctokenSupply: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.ctoken_supply),
766
- borrowInterestPaid: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.borrow_interest_paid),
767
- spreadFee: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.spread_fee),
768
- supplyInterestEarned: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.supply_interest_earned),
769
- borrowInterestPaidUsdEstimate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.borrow_interest_paid_usd_estimate),
770
- protocolFeeUsdEstimate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.protocol_fee_usd_estimate),
771
- supplyInterestEarnedUsdEstimate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.supply_interest_earned_usd_estimate),
709
+ lendingMarketId: decodeFromFieldsWithTypes("address", item.fields.lending_market_id),
710
+ coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
711
+ reserveId: decodeFromFieldsWithTypes("address", item.fields.reserve_id),
712
+ cumulativeBorrowRate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.cumulative_borrow_rate),
713
+ availableAmount: decodeFromFieldsWithTypes("u64", item.fields.available_amount),
714
+ borrowedAmount: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.borrowed_amount),
715
+ unclaimedSpreadFees: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.unclaimed_spread_fees),
716
+ ctokenSupply: decodeFromFieldsWithTypes("u64", item.fields.ctoken_supply),
717
+ borrowInterestPaid: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.borrow_interest_paid),
718
+ spreadFee: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.spread_fee),
719
+ supplyInterestEarned: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.supply_interest_earned),
720
+ borrowInterestPaidUsdEstimate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.borrow_interest_paid_usd_estimate),
721
+ protocolFeeUsdEstimate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.protocol_fee_usd_estimate),
722
+ supplyInterestEarnedUsdEstimate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.supply_interest_earned_usd_estimate),
772
723
  });
773
724
  }
774
725
  static fromBcs(data) {
@@ -797,20 +748,20 @@ class InterestUpdateEvent {
797
748
  }
798
749
  static fromJSONField(field) {
799
750
  return InterestUpdateEvent.reified().new({
800
- lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
801
- coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
802
- reserveId: (0, reified_1.decodeFromJSONField)("address", field.reserveId),
803
- cumulativeBorrowRate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.cumulativeBorrowRate),
804
- availableAmount: (0, reified_1.decodeFromJSONField)("u64", field.availableAmount),
805
- borrowedAmount: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.borrowedAmount),
806
- unclaimedSpreadFees: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.unclaimedSpreadFees),
807
- ctokenSupply: (0, reified_1.decodeFromJSONField)("u64", field.ctokenSupply),
808
- borrowInterestPaid: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.borrowInterestPaid),
809
- spreadFee: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.spreadFee),
810
- supplyInterestEarned: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.supplyInterestEarned),
811
- borrowInterestPaidUsdEstimate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.borrowInterestPaidUsdEstimate),
812
- protocolFeeUsdEstimate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.protocolFeeUsdEstimate),
813
- supplyInterestEarnedUsdEstimate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.supplyInterestEarnedUsdEstimate),
751
+ lendingMarketId: decodeFromJSONField("address", field.lendingMarketId),
752
+ coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
753
+ reserveId: decodeFromJSONField("address", field.reserveId),
754
+ cumulativeBorrowRate: decodeFromJSONField(Decimal.reified(), field.cumulativeBorrowRate),
755
+ availableAmount: decodeFromJSONField("u64", field.availableAmount),
756
+ borrowedAmount: decodeFromJSONField(Decimal.reified(), field.borrowedAmount),
757
+ unclaimedSpreadFees: decodeFromJSONField(Decimal.reified(), field.unclaimedSpreadFees),
758
+ ctokenSupply: decodeFromJSONField("u64", field.ctokenSupply),
759
+ borrowInterestPaid: decodeFromJSONField(Decimal.reified(), field.borrowInterestPaid),
760
+ spreadFee: decodeFromJSONField(Decimal.reified(), field.spreadFee),
761
+ supplyInterestEarned: decodeFromJSONField(Decimal.reified(), field.supplyInterestEarned),
762
+ borrowInterestPaidUsdEstimate: decodeFromJSONField(Decimal.reified(), field.borrowInterestPaidUsdEstimate),
763
+ protocolFeeUsdEstimate: decodeFromJSONField(Decimal.reified(), field.protocolFeeUsdEstimate),
764
+ supplyInterestEarnedUsdEstimate: decodeFromJSONField(Decimal.reified(), field.supplyInterestEarnedUsdEstimate),
814
765
  });
815
766
  }
816
767
  static fromJSON(json) {
@@ -834,7 +785,7 @@ class InterestUpdateEvent {
834
785
  !isInterestUpdateEvent(data.bcs.type)) {
835
786
  throw new Error(`object at is not a InterestUpdateEvent object`);
836
787
  }
837
- return InterestUpdateEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
788
+ return InterestUpdateEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
838
789
  }
839
790
  if (data.content) {
840
791
  return InterestUpdateEvent.fromSuiParsedData(data.content);
@@ -856,21 +807,20 @@ class InterestUpdateEvent {
856
807
  });
857
808
  }
858
809
  }
859
- exports.InterestUpdateEvent = InterestUpdateEvent;
860
- InterestUpdateEvent.$typeName = `${index_1.PKG_V1}::reserve::InterestUpdateEvent`;
810
+ InterestUpdateEvent.$typeName = `${PKG_V1}::reserve::InterestUpdateEvent`;
861
811
  InterestUpdateEvent.$numTypeParams = 0;
862
812
  InterestUpdateEvent.$isPhantom = [];
863
813
  /* ============================== LiquidityRequest =============================== */
864
- function isLiquidityRequest(type) {
865
- type = (0, util_1.compressSuiType)(type);
866
- return type.startsWith(`${index_1.PKG_V8}::reserve::LiquidityRequest` + "<");
814
+ export function isLiquidityRequest(type) {
815
+ type = compressSuiType(type);
816
+ return type.startsWith(`${PKG_V8}::reserve::LiquidityRequest` + "<");
867
817
  }
868
- class LiquidityRequest {
818
+ export class LiquidityRequest {
869
819
  constructor(typeArgs, fields) {
870
820
  this.__StructClass = true;
871
821
  this.$typeName = LiquidityRequest.$typeName;
872
822
  this.$isPhantom = LiquidityRequest.$isPhantom;
873
- this.$fullTypeName = (0, util_1.composeSuiType)(LiquidityRequest.$typeName, ...typeArgs);
823
+ this.$fullTypeName = composeSuiType(LiquidityRequest.$typeName, ...typeArgs);
874
824
  this.$typeArgs = typeArgs;
875
825
  this.amount = fields.amount;
876
826
  this.fee = fields.fee;
@@ -878,8 +828,8 @@ class LiquidityRequest {
878
828
  static reified(P, T) {
879
829
  return {
880
830
  typeName: LiquidityRequest.$typeName,
881
- fullTypeName: (0, util_1.composeSuiType)(LiquidityRequest.$typeName, ...[(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)]),
882
- typeArgs: [(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)],
831
+ fullTypeName: composeSuiType(LiquidityRequest.$typeName, ...[extractType(P), extractType(T)]),
832
+ typeArgs: [extractType(P), extractType(T)],
883
833
  isPhantom: LiquidityRequest.$isPhantom,
884
834
  reifiedTypeArgs: [P, T],
885
835
  fromFields: (fields) => LiquidityRequest.fromFields([P, T], fields),
@@ -892,7 +842,7 @@ class LiquidityRequest {
892
842
  fromSuiObjectData: (content) => LiquidityRequest.fromSuiObjectData([P, T], content),
893
843
  fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return LiquidityRequest.fetch(client, [P, T], id); }),
894
844
  new: (fields) => {
895
- return new LiquidityRequest([(0, reified_1.extractType)(P), (0, reified_1.extractType)(T)], fields);
845
+ return new LiquidityRequest([extractType(P), extractType(T)], fields);
896
846
  },
897
847
  kind: "StructClassReified",
898
848
  };
@@ -901,31 +851,31 @@ class LiquidityRequest {
901
851
  return LiquidityRequest.reified;
902
852
  }
903
853
  static phantom(P, T) {
904
- return (0, reified_1.phantom)(LiquidityRequest.reified(P, T));
854
+ return phantom(LiquidityRequest.reified(P, T));
905
855
  }
906
856
  static get p() {
907
857
  return LiquidityRequest.phantom;
908
858
  }
909
859
  static get bcs() {
910
- return bcs_1.bcs.struct("LiquidityRequest", {
911
- amount: bcs_1.bcs.u64(),
912
- fee: bcs_1.bcs.u64(),
860
+ return bcs.struct("LiquidityRequest", {
861
+ amount: bcs.u64(),
862
+ fee: bcs.u64(),
913
863
  });
914
864
  }
915
865
  static fromFields(typeArgs, fields) {
916
866
  return LiquidityRequest.reified(typeArgs[0], typeArgs[1]).new({
917
- amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
918
- fee: (0, reified_1.decodeFromFields)("u64", fields.fee),
867
+ amount: decodeFromFields("u64", fields.amount),
868
+ fee: decodeFromFields("u64", fields.fee),
919
869
  });
920
870
  }
921
871
  static fromFieldsWithTypes(typeArgs, item) {
922
872
  if (!isLiquidityRequest(item.type)) {
923
873
  throw new Error("not a LiquidityRequest type");
924
874
  }
925
- (0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
875
+ assertFieldsWithTypesArgsMatch(item, typeArgs);
926
876
  return LiquidityRequest.reified(typeArgs[0], typeArgs[1]).new({
927
- amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
928
- fee: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.fee),
877
+ amount: decodeFromFieldsWithTypes("u64", item.fields.amount),
878
+ fee: decodeFromFieldsWithTypes("u64", item.fields.fee),
929
879
  });
930
880
  }
931
881
  static fromBcs(typeArgs, data) {
@@ -942,15 +892,15 @@ class LiquidityRequest {
942
892
  }
943
893
  static fromJSONField(typeArgs, field) {
944
894
  return LiquidityRequest.reified(typeArgs[0], typeArgs[1]).new({
945
- amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
946
- fee: (0, reified_1.decodeFromJSONField)("u64", field.fee),
895
+ amount: decodeFromJSONField("u64", field.amount),
896
+ fee: decodeFromJSONField("u64", field.fee),
947
897
  });
948
898
  }
949
899
  static fromJSON(typeArgs, json) {
950
900
  if (json.$typeName !== LiquidityRequest.$typeName) {
951
901
  throw new Error("not a WithTwoGenerics json object");
952
902
  }
953
- (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(LiquidityRequest.$typeName, ...typeArgs.map(reified_1.extractType)), json.$typeArgs, typeArgs);
903
+ assertReifiedTypeArgsMatch(composeSuiType(LiquidityRequest.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
954
904
  return LiquidityRequest.fromJSONField(typeArgs, json);
955
905
  }
956
906
  static fromSuiParsedData(typeArgs, content) {
@@ -968,18 +918,18 @@ class LiquidityRequest {
968
918
  !isLiquidityRequest(data.bcs.type)) {
969
919
  throw new Error(`object at is not a LiquidityRequest object`);
970
920
  }
971
- const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
921
+ const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
972
922
  if (gotTypeArgs.length !== 2) {
973
923
  throw new Error(`type argument mismatch: expected 2 type arguments but got ${gotTypeArgs.length}`);
974
924
  }
975
925
  for (let i = 0; i < 2; i++) {
976
- const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
977
- const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
926
+ const gotTypeArg = compressSuiType(gotTypeArgs[i]);
927
+ const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
978
928
  if (gotTypeArg !== expectedTypeArg) {
979
929
  throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
980
930
  }
981
931
  }
982
- return LiquidityRequest.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
932
+ return LiquidityRequest.fromBcs(typeArgs, fromBase64(data.bcs.bcsBytes));
983
933
  }
984
934
  if (data.content) {
985
935
  return LiquidityRequest.fromSuiParsedData(typeArgs, data.content);
@@ -1001,21 +951,20 @@ class LiquidityRequest {
1001
951
  });
1002
952
  }
1003
953
  }
1004
- exports.LiquidityRequest = LiquidityRequest;
1005
- LiquidityRequest.$typeName = `${index_1.PKG_V8}::reserve::LiquidityRequest`;
954
+ LiquidityRequest.$typeName = `${PKG_V8}::reserve::LiquidityRequest`;
1006
955
  LiquidityRequest.$numTypeParams = 2;
1007
956
  LiquidityRequest.$isPhantom = [true, true];
1008
957
  /* ============================== Reserve =============================== */
1009
- function isReserve(type) {
1010
- type = (0, util_1.compressSuiType)(type);
1011
- return type.startsWith(`${index_1.PKG_V1}::reserve::Reserve` + "<");
958
+ export function isReserve(type) {
959
+ type = compressSuiType(type);
960
+ return type.startsWith(`${PKG_V1}::reserve::Reserve` + "<");
1012
961
  }
1013
- class Reserve {
962
+ export class Reserve {
1014
963
  constructor(typeArgs, fields) {
1015
964
  this.__StructClass = true;
1016
965
  this.$typeName = Reserve.$typeName;
1017
966
  this.$isPhantom = Reserve.$isPhantom;
1018
- this.$fullTypeName = (0, util_1.composeSuiType)(Reserve.$typeName, ...typeArgs);
967
+ this.$fullTypeName = composeSuiType(Reserve.$typeName, ...typeArgs);
1019
968
  this.$typeArgs = typeArgs;
1020
969
  this.id = fields.id;
1021
970
  this.lendingMarketId = fields.lendingMarketId;
@@ -1040,8 +989,8 @@ class Reserve {
1040
989
  static reified(P) {
1041
990
  return {
1042
991
  typeName: Reserve.$typeName,
1043
- fullTypeName: (0, util_1.composeSuiType)(Reserve.$typeName, ...[(0, reified_1.extractType)(P)]),
1044
- typeArgs: [(0, reified_1.extractType)(P)],
992
+ fullTypeName: composeSuiType(Reserve.$typeName, ...[extractType(P)]),
993
+ typeArgs: [extractType(P)],
1045
994
  isPhantom: Reserve.$isPhantom,
1046
995
  reifiedTypeArgs: [P],
1047
996
  fromFields: (fields) => Reserve.fromFields(P, fields),
@@ -1054,7 +1003,7 @@ class Reserve {
1054
1003
  fromSuiObjectData: (content) => Reserve.fromSuiObjectData(P, content),
1055
1004
  fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Reserve.fetch(client, P, id); }),
1056
1005
  new: (fields) => {
1057
- return new Reserve([(0, reified_1.extractType)(P)], fields);
1006
+ return new Reserve([extractType(P)], fields);
1058
1007
  },
1059
1008
  kind: "StructClassReified",
1060
1009
  };
@@ -1063,82 +1012,82 @@ class Reserve {
1063
1012
  return Reserve.reified;
1064
1013
  }
1065
1014
  static phantom(P) {
1066
- return (0, reified_1.phantom)(Reserve.reified(P));
1015
+ return phantom(Reserve.reified(P));
1067
1016
  }
1068
1017
  static get p() {
1069
1018
  return Reserve.phantom;
1070
1019
  }
1071
1020
  static get bcs() {
1072
- return bcs_1.bcs.struct("Reserve", {
1073
- id: structs_3.UID.bcs,
1074
- lending_market_id: structs_3.ID.bcs,
1075
- array_index: bcs_1.bcs.u64(),
1076
- coin_type: structs_1.TypeName.bcs,
1077
- config: structs_5.Cell.bcs(structs_8.ReserveConfig.bcs),
1078
- mint_decimals: bcs_1.bcs.u8(),
1079
- price_identifier: structs_4.PriceIdentifier.bcs,
1080
- price: structs_6.Decimal.bcs,
1081
- smoothed_price: structs_6.Decimal.bcs,
1082
- price_last_update_timestamp_s: bcs_1.bcs.u64(),
1083
- available_amount: bcs_1.bcs.u64(),
1084
- ctoken_supply: bcs_1.bcs.u64(),
1085
- borrowed_amount: structs_6.Decimal.bcs,
1086
- cumulative_borrow_rate: structs_6.Decimal.bcs,
1087
- interest_last_update_timestamp_s: bcs_1.bcs.u64(),
1088
- unclaimed_spread_fees: structs_6.Decimal.bcs,
1089
- attributed_borrow_value: structs_6.Decimal.bcs,
1090
- deposits_pool_reward_manager: structs_7.PoolRewardManager.bcs,
1091
- borrows_pool_reward_manager: structs_7.PoolRewardManager.bcs,
1021
+ return bcs.struct("Reserve", {
1022
+ id: UID.bcs,
1023
+ lending_market_id: ID.bcs,
1024
+ array_index: bcs.u64(),
1025
+ coin_type: TypeName.bcs,
1026
+ config: Cell.bcs(ReserveConfig.bcs),
1027
+ mint_decimals: bcs.u8(),
1028
+ price_identifier: PriceIdentifier.bcs,
1029
+ price: Decimal.bcs,
1030
+ smoothed_price: Decimal.bcs,
1031
+ price_last_update_timestamp_s: bcs.u64(),
1032
+ available_amount: bcs.u64(),
1033
+ ctoken_supply: bcs.u64(),
1034
+ borrowed_amount: Decimal.bcs,
1035
+ cumulative_borrow_rate: Decimal.bcs,
1036
+ interest_last_update_timestamp_s: bcs.u64(),
1037
+ unclaimed_spread_fees: Decimal.bcs,
1038
+ attributed_borrow_value: Decimal.bcs,
1039
+ deposits_pool_reward_manager: PoolRewardManager.bcs,
1040
+ borrows_pool_reward_manager: PoolRewardManager.bcs,
1092
1041
  });
1093
1042
  }
1094
1043
  static fromFields(typeArg, fields) {
1095
1044
  return Reserve.reified(typeArg).new({
1096
- id: (0, reified_1.decodeFromFields)(structs_3.UID.reified(), fields.id),
1097
- lendingMarketId: (0, reified_1.decodeFromFields)(structs_3.ID.reified(), fields.lending_market_id),
1098
- arrayIndex: (0, reified_1.decodeFromFields)("u64", fields.array_index),
1099
- coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
1100
- config: (0, reified_1.decodeFromFields)(structs_5.Cell.reified(structs_8.ReserveConfig.reified()), fields.config),
1101
- mintDecimals: (0, reified_1.decodeFromFields)("u8", fields.mint_decimals),
1102
- priceIdentifier: (0, reified_1.decodeFromFields)(structs_4.PriceIdentifier.reified(), fields.price_identifier),
1103
- price: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.price),
1104
- smoothedPrice: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.smoothed_price),
1105
- priceLastUpdateTimestampS: (0, reified_1.decodeFromFields)("u64", fields.price_last_update_timestamp_s),
1106
- availableAmount: (0, reified_1.decodeFromFields)("u64", fields.available_amount),
1107
- ctokenSupply: (0, reified_1.decodeFromFields)("u64", fields.ctoken_supply),
1108
- borrowedAmount: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.borrowed_amount),
1109
- cumulativeBorrowRate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.cumulative_borrow_rate),
1110
- interestLastUpdateTimestampS: (0, reified_1.decodeFromFields)("u64", fields.interest_last_update_timestamp_s),
1111
- unclaimedSpreadFees: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.unclaimed_spread_fees),
1112
- attributedBorrowValue: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.attributed_borrow_value),
1113
- depositsPoolRewardManager: (0, reified_1.decodeFromFields)(structs_7.PoolRewardManager.reified(), fields.deposits_pool_reward_manager),
1114
- borrowsPoolRewardManager: (0, reified_1.decodeFromFields)(structs_7.PoolRewardManager.reified(), fields.borrows_pool_reward_manager),
1045
+ id: decodeFromFields(UID.reified(), fields.id),
1046
+ lendingMarketId: decodeFromFields(ID.reified(), fields.lending_market_id),
1047
+ arrayIndex: decodeFromFields("u64", fields.array_index),
1048
+ coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
1049
+ config: decodeFromFields(Cell.reified(ReserveConfig.reified()), fields.config),
1050
+ mintDecimals: decodeFromFields("u8", fields.mint_decimals),
1051
+ priceIdentifier: decodeFromFields(PriceIdentifier.reified(), fields.price_identifier),
1052
+ price: decodeFromFields(Decimal.reified(), fields.price),
1053
+ smoothedPrice: decodeFromFields(Decimal.reified(), fields.smoothed_price),
1054
+ priceLastUpdateTimestampS: decodeFromFields("u64", fields.price_last_update_timestamp_s),
1055
+ availableAmount: decodeFromFields("u64", fields.available_amount),
1056
+ ctokenSupply: decodeFromFields("u64", fields.ctoken_supply),
1057
+ borrowedAmount: decodeFromFields(Decimal.reified(), fields.borrowed_amount),
1058
+ cumulativeBorrowRate: decodeFromFields(Decimal.reified(), fields.cumulative_borrow_rate),
1059
+ interestLastUpdateTimestampS: decodeFromFields("u64", fields.interest_last_update_timestamp_s),
1060
+ unclaimedSpreadFees: decodeFromFields(Decimal.reified(), fields.unclaimed_spread_fees),
1061
+ attributedBorrowValue: decodeFromFields(Decimal.reified(), fields.attributed_borrow_value),
1062
+ depositsPoolRewardManager: decodeFromFields(PoolRewardManager.reified(), fields.deposits_pool_reward_manager),
1063
+ borrowsPoolRewardManager: decodeFromFields(PoolRewardManager.reified(), fields.borrows_pool_reward_manager),
1115
1064
  });
1116
1065
  }
1117
1066
  static fromFieldsWithTypes(typeArg, item) {
1118
1067
  if (!isReserve(item.type)) {
1119
1068
  throw new Error("not a Reserve type");
1120
1069
  }
1121
- (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
1070
+ assertFieldsWithTypesArgsMatch(item, [typeArg]);
1122
1071
  return Reserve.reified(typeArg).new({
1123
- id: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.UID.reified(), item.fields.id),
1124
- lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.ID.reified(), item.fields.lending_market_id),
1125
- arrayIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.array_index),
1126
- coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
1127
- config: (0, reified_1.decodeFromFieldsWithTypes)(structs_5.Cell.reified(structs_8.ReserveConfig.reified()), item.fields.config),
1128
- mintDecimals: (0, reified_1.decodeFromFieldsWithTypes)("u8", item.fields.mint_decimals),
1129
- priceIdentifier: (0, reified_1.decodeFromFieldsWithTypes)(structs_4.PriceIdentifier.reified(), item.fields.price_identifier),
1130
- price: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.price),
1131
- smoothedPrice: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.smoothed_price),
1132
- priceLastUpdateTimestampS: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.price_last_update_timestamp_s),
1133
- availableAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.available_amount),
1134
- ctokenSupply: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.ctoken_supply),
1135
- borrowedAmount: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.borrowed_amount),
1136
- cumulativeBorrowRate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.cumulative_borrow_rate),
1137
- interestLastUpdateTimestampS: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.interest_last_update_timestamp_s),
1138
- unclaimedSpreadFees: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.unclaimed_spread_fees),
1139
- attributedBorrowValue: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.attributed_borrow_value),
1140
- depositsPoolRewardManager: (0, reified_1.decodeFromFieldsWithTypes)(structs_7.PoolRewardManager.reified(), item.fields.deposits_pool_reward_manager),
1141
- borrowsPoolRewardManager: (0, reified_1.decodeFromFieldsWithTypes)(structs_7.PoolRewardManager.reified(), item.fields.borrows_pool_reward_manager),
1072
+ id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
1073
+ lendingMarketId: decodeFromFieldsWithTypes(ID.reified(), item.fields.lending_market_id),
1074
+ arrayIndex: decodeFromFieldsWithTypes("u64", item.fields.array_index),
1075
+ coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
1076
+ config: decodeFromFieldsWithTypes(Cell.reified(ReserveConfig.reified()), item.fields.config),
1077
+ mintDecimals: decodeFromFieldsWithTypes("u8", item.fields.mint_decimals),
1078
+ priceIdentifier: decodeFromFieldsWithTypes(PriceIdentifier.reified(), item.fields.price_identifier),
1079
+ price: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.price),
1080
+ smoothedPrice: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.smoothed_price),
1081
+ priceLastUpdateTimestampS: decodeFromFieldsWithTypes("u64", item.fields.price_last_update_timestamp_s),
1082
+ availableAmount: decodeFromFieldsWithTypes("u64", item.fields.available_amount),
1083
+ ctokenSupply: decodeFromFieldsWithTypes("u64", item.fields.ctoken_supply),
1084
+ borrowedAmount: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.borrowed_amount),
1085
+ cumulativeBorrowRate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.cumulative_borrow_rate),
1086
+ interestLastUpdateTimestampS: decodeFromFieldsWithTypes("u64", item.fields.interest_last_update_timestamp_s),
1087
+ unclaimedSpreadFees: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.unclaimed_spread_fees),
1088
+ attributedBorrowValue: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.attributed_borrow_value),
1089
+ depositsPoolRewardManager: decodeFromFieldsWithTypes(PoolRewardManager.reified(), item.fields.deposits_pool_reward_manager),
1090
+ borrowsPoolRewardManager: decodeFromFieldsWithTypes(PoolRewardManager.reified(), item.fields.borrows_pool_reward_manager),
1142
1091
  });
1143
1092
  }
1144
1093
  static fromBcs(typeArg, data) {
@@ -1172,32 +1121,32 @@ class Reserve {
1172
1121
  }
1173
1122
  static fromJSONField(typeArg, field) {
1174
1123
  return Reserve.reified(typeArg).new({
1175
- id: (0, reified_1.decodeFromJSONField)(structs_3.UID.reified(), field.id),
1176
- lendingMarketId: (0, reified_1.decodeFromJSONField)(structs_3.ID.reified(), field.lendingMarketId),
1177
- arrayIndex: (0, reified_1.decodeFromJSONField)("u64", field.arrayIndex),
1178
- coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
1179
- config: (0, reified_1.decodeFromJSONField)(structs_5.Cell.reified(structs_8.ReserveConfig.reified()), field.config),
1180
- mintDecimals: (0, reified_1.decodeFromJSONField)("u8", field.mintDecimals),
1181
- priceIdentifier: (0, reified_1.decodeFromJSONField)(structs_4.PriceIdentifier.reified(), field.priceIdentifier),
1182
- price: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.price),
1183
- smoothedPrice: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.smoothedPrice),
1184
- priceLastUpdateTimestampS: (0, reified_1.decodeFromJSONField)("u64", field.priceLastUpdateTimestampS),
1185
- availableAmount: (0, reified_1.decodeFromJSONField)("u64", field.availableAmount),
1186
- ctokenSupply: (0, reified_1.decodeFromJSONField)("u64", field.ctokenSupply),
1187
- borrowedAmount: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.borrowedAmount),
1188
- cumulativeBorrowRate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.cumulativeBorrowRate),
1189
- interestLastUpdateTimestampS: (0, reified_1.decodeFromJSONField)("u64", field.interestLastUpdateTimestampS),
1190
- unclaimedSpreadFees: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.unclaimedSpreadFees),
1191
- attributedBorrowValue: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.attributedBorrowValue),
1192
- depositsPoolRewardManager: (0, reified_1.decodeFromJSONField)(structs_7.PoolRewardManager.reified(), field.depositsPoolRewardManager),
1193
- borrowsPoolRewardManager: (0, reified_1.decodeFromJSONField)(structs_7.PoolRewardManager.reified(), field.borrowsPoolRewardManager),
1124
+ id: decodeFromJSONField(UID.reified(), field.id),
1125
+ lendingMarketId: decodeFromJSONField(ID.reified(), field.lendingMarketId),
1126
+ arrayIndex: decodeFromJSONField("u64", field.arrayIndex),
1127
+ coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
1128
+ config: decodeFromJSONField(Cell.reified(ReserveConfig.reified()), field.config),
1129
+ mintDecimals: decodeFromJSONField("u8", field.mintDecimals),
1130
+ priceIdentifier: decodeFromJSONField(PriceIdentifier.reified(), field.priceIdentifier),
1131
+ price: decodeFromJSONField(Decimal.reified(), field.price),
1132
+ smoothedPrice: decodeFromJSONField(Decimal.reified(), field.smoothedPrice),
1133
+ priceLastUpdateTimestampS: decodeFromJSONField("u64", field.priceLastUpdateTimestampS),
1134
+ availableAmount: decodeFromJSONField("u64", field.availableAmount),
1135
+ ctokenSupply: decodeFromJSONField("u64", field.ctokenSupply),
1136
+ borrowedAmount: decodeFromJSONField(Decimal.reified(), field.borrowedAmount),
1137
+ cumulativeBorrowRate: decodeFromJSONField(Decimal.reified(), field.cumulativeBorrowRate),
1138
+ interestLastUpdateTimestampS: decodeFromJSONField("u64", field.interestLastUpdateTimestampS),
1139
+ unclaimedSpreadFees: decodeFromJSONField(Decimal.reified(), field.unclaimedSpreadFees),
1140
+ attributedBorrowValue: decodeFromJSONField(Decimal.reified(), field.attributedBorrowValue),
1141
+ depositsPoolRewardManager: decodeFromJSONField(PoolRewardManager.reified(), field.depositsPoolRewardManager),
1142
+ borrowsPoolRewardManager: decodeFromJSONField(PoolRewardManager.reified(), field.borrowsPoolRewardManager),
1194
1143
  });
1195
1144
  }
1196
1145
  static fromJSON(typeArg, json) {
1197
1146
  if (json.$typeName !== Reserve.$typeName) {
1198
1147
  throw new Error("not a WithTwoGenerics json object");
1199
1148
  }
1200
- (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(Reserve.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
1149
+ assertReifiedTypeArgsMatch(composeSuiType(Reserve.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
1201
1150
  return Reserve.fromJSONField(typeArg, json);
1202
1151
  }
1203
1152
  static fromSuiParsedData(typeArg, content) {
@@ -1214,16 +1163,16 @@ class Reserve {
1214
1163
  if (data.bcs.dataType !== "moveObject" || !isReserve(data.bcs.type)) {
1215
1164
  throw new Error(`object at is not a Reserve object`);
1216
1165
  }
1217
- const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
1166
+ const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
1218
1167
  if (gotTypeArgs.length !== 1) {
1219
1168
  throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
1220
1169
  }
1221
- const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
1222
- const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
1223
- if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
1170
+ const gotTypeArg = compressSuiType(gotTypeArgs[0]);
1171
+ const expectedTypeArg = compressSuiType(extractType(typeArg));
1172
+ if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
1224
1173
  throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
1225
1174
  }
1226
- return Reserve.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
1175
+ return Reserve.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
1227
1176
  }
1228
1177
  if (data.content) {
1229
1178
  return Reserve.fromSuiParsedData(typeArg, data.content);
@@ -1245,21 +1194,20 @@ class Reserve {
1245
1194
  });
1246
1195
  }
1247
1196
  }
1248
- exports.Reserve = Reserve;
1249
- Reserve.$typeName = `${index_1.PKG_V1}::reserve::Reserve`;
1197
+ Reserve.$typeName = `${PKG_V1}::reserve::Reserve`;
1250
1198
  Reserve.$numTypeParams = 1;
1251
1199
  Reserve.$isPhantom = [true];
1252
1200
  /* ============================== ReserveAssetDataEvent =============================== */
1253
- function isReserveAssetDataEvent(type) {
1254
- type = (0, util_1.compressSuiType)(type);
1255
- return type === `${index_1.PKG_V1}::reserve::ReserveAssetDataEvent`;
1201
+ export function isReserveAssetDataEvent(type) {
1202
+ type = compressSuiType(type);
1203
+ return type === `${PKG_V1}::reserve::ReserveAssetDataEvent`;
1256
1204
  }
1257
- class ReserveAssetDataEvent {
1205
+ export class ReserveAssetDataEvent {
1258
1206
  constructor(typeArgs, fields) {
1259
1207
  this.__StructClass = true;
1260
1208
  this.$typeName = ReserveAssetDataEvent.$typeName;
1261
1209
  this.$isPhantom = ReserveAssetDataEvent.$isPhantom;
1262
- this.$fullTypeName = (0, util_1.composeSuiType)(ReserveAssetDataEvent.$typeName, ...typeArgs);
1210
+ this.$fullTypeName = composeSuiType(ReserveAssetDataEvent.$typeName, ...typeArgs);
1263
1211
  this.$typeArgs = typeArgs;
1264
1212
  this.lendingMarketId = fields.lendingMarketId;
1265
1213
  this.coinType = fields.coinType;
@@ -1281,7 +1229,7 @@ class ReserveAssetDataEvent {
1281
1229
  static reified() {
1282
1230
  return {
1283
1231
  typeName: ReserveAssetDataEvent.$typeName,
1284
- fullTypeName: (0, util_1.composeSuiType)(ReserveAssetDataEvent.$typeName, ...[]),
1232
+ fullTypeName: composeSuiType(ReserveAssetDataEvent.$typeName, ...[]),
1285
1233
  typeArgs: [],
1286
1234
  isPhantom: ReserveAssetDataEvent.$isPhantom,
1287
1235
  reifiedTypeArgs: [],
@@ -1304,59 +1252,59 @@ class ReserveAssetDataEvent {
1304
1252
  return ReserveAssetDataEvent.reified();
1305
1253
  }
1306
1254
  static phantom() {
1307
- return (0, reified_1.phantom)(ReserveAssetDataEvent.reified());
1255
+ return phantom(ReserveAssetDataEvent.reified());
1308
1256
  }
1309
1257
  static get p() {
1310
1258
  return ReserveAssetDataEvent.phantom();
1311
1259
  }
1312
1260
  static get bcs() {
1313
- return bcs_1.bcs.struct("ReserveAssetDataEvent", {
1314
- lending_market_id: bcs_1.bcs
1261
+ return bcs.struct("ReserveAssetDataEvent", {
1262
+ lending_market_id: bcs
1315
1263
  .bytes(32)
1316
1264
  .transform({
1317
- input: (val) => (0, utils_1.fromHEX)(val),
1318
- output: (val) => (0, utils_1.toHEX)(val),
1265
+ input: (val) => fromHex(val),
1266
+ output: (val) => toHex(val),
1319
1267
  }),
1320
- coin_type: structs_1.TypeName.bcs,
1321
- reserve_id: bcs_1.bcs
1268
+ coin_type: TypeName.bcs,
1269
+ reserve_id: bcs
1322
1270
  .bytes(32)
1323
1271
  .transform({
1324
- input: (val) => (0, utils_1.fromHEX)(val),
1325
- output: (val) => (0, utils_1.toHEX)(val),
1272
+ input: (val) => fromHex(val),
1273
+ output: (val) => toHex(val),
1326
1274
  }),
1327
- available_amount: structs_6.Decimal.bcs,
1328
- supply_amount: structs_6.Decimal.bcs,
1329
- borrowed_amount: structs_6.Decimal.bcs,
1330
- available_amount_usd_estimate: structs_6.Decimal.bcs,
1331
- supply_amount_usd_estimate: structs_6.Decimal.bcs,
1332
- borrowed_amount_usd_estimate: structs_6.Decimal.bcs,
1333
- borrow_apr: structs_6.Decimal.bcs,
1334
- supply_apr: structs_6.Decimal.bcs,
1335
- ctoken_supply: bcs_1.bcs.u64(),
1336
- cumulative_borrow_rate: structs_6.Decimal.bcs,
1337
- price: structs_6.Decimal.bcs,
1338
- smoothed_price: structs_6.Decimal.bcs,
1339
- price_last_update_timestamp_s: bcs_1.bcs.u64(),
1275
+ available_amount: Decimal.bcs,
1276
+ supply_amount: Decimal.bcs,
1277
+ borrowed_amount: Decimal.bcs,
1278
+ available_amount_usd_estimate: Decimal.bcs,
1279
+ supply_amount_usd_estimate: Decimal.bcs,
1280
+ borrowed_amount_usd_estimate: Decimal.bcs,
1281
+ borrow_apr: Decimal.bcs,
1282
+ supply_apr: Decimal.bcs,
1283
+ ctoken_supply: bcs.u64(),
1284
+ cumulative_borrow_rate: Decimal.bcs,
1285
+ price: Decimal.bcs,
1286
+ smoothed_price: Decimal.bcs,
1287
+ price_last_update_timestamp_s: bcs.u64(),
1340
1288
  });
1341
1289
  }
1342
1290
  static fromFields(fields) {
1343
1291
  return ReserveAssetDataEvent.reified().new({
1344
- lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
1345
- coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
1346
- reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
1347
- availableAmount: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.available_amount),
1348
- supplyAmount: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.supply_amount),
1349
- borrowedAmount: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.borrowed_amount),
1350
- availableAmountUsdEstimate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.available_amount_usd_estimate),
1351
- supplyAmountUsdEstimate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.supply_amount_usd_estimate),
1352
- borrowedAmountUsdEstimate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.borrowed_amount_usd_estimate),
1353
- borrowApr: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.borrow_apr),
1354
- supplyApr: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.supply_apr),
1355
- ctokenSupply: (0, reified_1.decodeFromFields)("u64", fields.ctoken_supply),
1356
- cumulativeBorrowRate: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.cumulative_borrow_rate),
1357
- price: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.price),
1358
- smoothedPrice: (0, reified_1.decodeFromFields)(structs_6.Decimal.reified(), fields.smoothed_price),
1359
- priceLastUpdateTimestampS: (0, reified_1.decodeFromFields)("u64", fields.price_last_update_timestamp_s),
1292
+ lendingMarketId: decodeFromFields("address", fields.lending_market_id),
1293
+ coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
1294
+ reserveId: decodeFromFields("address", fields.reserve_id),
1295
+ availableAmount: decodeFromFields(Decimal.reified(), fields.available_amount),
1296
+ supplyAmount: decodeFromFields(Decimal.reified(), fields.supply_amount),
1297
+ borrowedAmount: decodeFromFields(Decimal.reified(), fields.borrowed_amount),
1298
+ availableAmountUsdEstimate: decodeFromFields(Decimal.reified(), fields.available_amount_usd_estimate),
1299
+ supplyAmountUsdEstimate: decodeFromFields(Decimal.reified(), fields.supply_amount_usd_estimate),
1300
+ borrowedAmountUsdEstimate: decodeFromFields(Decimal.reified(), fields.borrowed_amount_usd_estimate),
1301
+ borrowApr: decodeFromFields(Decimal.reified(), fields.borrow_apr),
1302
+ supplyApr: decodeFromFields(Decimal.reified(), fields.supply_apr),
1303
+ ctokenSupply: decodeFromFields("u64", fields.ctoken_supply),
1304
+ cumulativeBorrowRate: decodeFromFields(Decimal.reified(), fields.cumulative_borrow_rate),
1305
+ price: decodeFromFields(Decimal.reified(), fields.price),
1306
+ smoothedPrice: decodeFromFields(Decimal.reified(), fields.smoothed_price),
1307
+ priceLastUpdateTimestampS: decodeFromFields("u64", fields.price_last_update_timestamp_s),
1360
1308
  });
1361
1309
  }
1362
1310
  static fromFieldsWithTypes(item) {
@@ -1364,22 +1312,22 @@ class ReserveAssetDataEvent {
1364
1312
  throw new Error("not a ReserveAssetDataEvent type");
1365
1313
  }
1366
1314
  return ReserveAssetDataEvent.reified().new({
1367
- lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
1368
- coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
1369
- reserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.reserve_id),
1370
- availableAmount: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.available_amount),
1371
- supplyAmount: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.supply_amount),
1372
- borrowedAmount: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.borrowed_amount),
1373
- availableAmountUsdEstimate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.available_amount_usd_estimate),
1374
- supplyAmountUsdEstimate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.supply_amount_usd_estimate),
1375
- borrowedAmountUsdEstimate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.borrowed_amount_usd_estimate),
1376
- borrowApr: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.borrow_apr),
1377
- supplyApr: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.supply_apr),
1378
- ctokenSupply: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.ctoken_supply),
1379
- cumulativeBorrowRate: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.cumulative_borrow_rate),
1380
- price: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.price),
1381
- smoothedPrice: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.Decimal.reified(), item.fields.smoothed_price),
1382
- priceLastUpdateTimestampS: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.price_last_update_timestamp_s),
1315
+ lendingMarketId: decodeFromFieldsWithTypes("address", item.fields.lending_market_id),
1316
+ coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
1317
+ reserveId: decodeFromFieldsWithTypes("address", item.fields.reserve_id),
1318
+ availableAmount: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.available_amount),
1319
+ supplyAmount: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.supply_amount),
1320
+ borrowedAmount: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.borrowed_amount),
1321
+ availableAmountUsdEstimate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.available_amount_usd_estimate),
1322
+ supplyAmountUsdEstimate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.supply_amount_usd_estimate),
1323
+ borrowedAmountUsdEstimate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.borrowed_amount_usd_estimate),
1324
+ borrowApr: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.borrow_apr),
1325
+ supplyApr: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.supply_apr),
1326
+ ctokenSupply: decodeFromFieldsWithTypes("u64", item.fields.ctoken_supply),
1327
+ cumulativeBorrowRate: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.cumulative_borrow_rate),
1328
+ price: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.price),
1329
+ smoothedPrice: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.smoothed_price),
1330
+ priceLastUpdateTimestampS: decodeFromFieldsWithTypes("u64", item.fields.price_last_update_timestamp_s),
1383
1331
  });
1384
1332
  }
1385
1333
  static fromBcs(data) {
@@ -1410,22 +1358,22 @@ class ReserveAssetDataEvent {
1410
1358
  }
1411
1359
  static fromJSONField(field) {
1412
1360
  return ReserveAssetDataEvent.reified().new({
1413
- lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
1414
- coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
1415
- reserveId: (0, reified_1.decodeFromJSONField)("address", field.reserveId),
1416
- availableAmount: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.availableAmount),
1417
- supplyAmount: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.supplyAmount),
1418
- borrowedAmount: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.borrowedAmount),
1419
- availableAmountUsdEstimate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.availableAmountUsdEstimate),
1420
- supplyAmountUsdEstimate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.supplyAmountUsdEstimate),
1421
- borrowedAmountUsdEstimate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.borrowedAmountUsdEstimate),
1422
- borrowApr: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.borrowApr),
1423
- supplyApr: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.supplyApr),
1424
- ctokenSupply: (0, reified_1.decodeFromJSONField)("u64", field.ctokenSupply),
1425
- cumulativeBorrowRate: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.cumulativeBorrowRate),
1426
- price: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.price),
1427
- smoothedPrice: (0, reified_1.decodeFromJSONField)(structs_6.Decimal.reified(), field.smoothedPrice),
1428
- priceLastUpdateTimestampS: (0, reified_1.decodeFromJSONField)("u64", field.priceLastUpdateTimestampS),
1361
+ lendingMarketId: decodeFromJSONField("address", field.lendingMarketId),
1362
+ coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
1363
+ reserveId: decodeFromJSONField("address", field.reserveId),
1364
+ availableAmount: decodeFromJSONField(Decimal.reified(), field.availableAmount),
1365
+ supplyAmount: decodeFromJSONField(Decimal.reified(), field.supplyAmount),
1366
+ borrowedAmount: decodeFromJSONField(Decimal.reified(), field.borrowedAmount),
1367
+ availableAmountUsdEstimate: decodeFromJSONField(Decimal.reified(), field.availableAmountUsdEstimate),
1368
+ supplyAmountUsdEstimate: decodeFromJSONField(Decimal.reified(), field.supplyAmountUsdEstimate),
1369
+ borrowedAmountUsdEstimate: decodeFromJSONField(Decimal.reified(), field.borrowedAmountUsdEstimate),
1370
+ borrowApr: decodeFromJSONField(Decimal.reified(), field.borrowApr),
1371
+ supplyApr: decodeFromJSONField(Decimal.reified(), field.supplyApr),
1372
+ ctokenSupply: decodeFromJSONField("u64", field.ctokenSupply),
1373
+ cumulativeBorrowRate: decodeFromJSONField(Decimal.reified(), field.cumulativeBorrowRate),
1374
+ price: decodeFromJSONField(Decimal.reified(), field.price),
1375
+ smoothedPrice: decodeFromJSONField(Decimal.reified(), field.smoothedPrice),
1376
+ priceLastUpdateTimestampS: decodeFromJSONField("u64", field.priceLastUpdateTimestampS),
1429
1377
  });
1430
1378
  }
1431
1379
  static fromJSON(json) {
@@ -1449,7 +1397,7 @@ class ReserveAssetDataEvent {
1449
1397
  !isReserveAssetDataEvent(data.bcs.type)) {
1450
1398
  throw new Error(`object at is not a ReserveAssetDataEvent object`);
1451
1399
  }
1452
- return ReserveAssetDataEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1400
+ return ReserveAssetDataEvent.fromBcs(fromBase64(data.bcs.bcsBytes));
1453
1401
  }
1454
1402
  if (data.content) {
1455
1403
  return ReserveAssetDataEvent.fromSuiParsedData(data.content);
@@ -1471,28 +1419,27 @@ class ReserveAssetDataEvent {
1471
1419
  });
1472
1420
  }
1473
1421
  }
1474
- exports.ReserveAssetDataEvent = ReserveAssetDataEvent;
1475
- ReserveAssetDataEvent.$typeName = `${index_1.PKG_V1}::reserve::ReserveAssetDataEvent`;
1422
+ ReserveAssetDataEvent.$typeName = `${PKG_V1}::reserve::ReserveAssetDataEvent`;
1476
1423
  ReserveAssetDataEvent.$numTypeParams = 0;
1477
1424
  ReserveAssetDataEvent.$isPhantom = [];
1478
1425
  /* ============================== StakerKey =============================== */
1479
- function isStakerKey(type) {
1480
- type = (0, util_1.compressSuiType)(type);
1481
- return type === `${index_1.PKG_V8}::reserve::StakerKey`;
1426
+ export function isStakerKey(type) {
1427
+ type = compressSuiType(type);
1428
+ return type === `${PKG_V8}::reserve::StakerKey`;
1482
1429
  }
1483
- class StakerKey {
1430
+ export class StakerKey {
1484
1431
  constructor(typeArgs, fields) {
1485
1432
  this.__StructClass = true;
1486
1433
  this.$typeName = StakerKey.$typeName;
1487
1434
  this.$isPhantom = StakerKey.$isPhantom;
1488
- this.$fullTypeName = (0, util_1.composeSuiType)(StakerKey.$typeName, ...typeArgs);
1435
+ this.$fullTypeName = composeSuiType(StakerKey.$typeName, ...typeArgs);
1489
1436
  this.$typeArgs = typeArgs;
1490
1437
  this.dummyField = fields.dummyField;
1491
1438
  }
1492
1439
  static reified() {
1493
1440
  return {
1494
1441
  typeName: StakerKey.$typeName,
1495
- fullTypeName: (0, util_1.composeSuiType)(StakerKey.$typeName, ...[]),
1442
+ fullTypeName: composeSuiType(StakerKey.$typeName, ...[]),
1496
1443
  typeArgs: [],
1497
1444
  isPhantom: StakerKey.$isPhantom,
1498
1445
  reifiedTypeArgs: [],
@@ -1515,19 +1462,19 @@ class StakerKey {
1515
1462
  return StakerKey.reified();
1516
1463
  }
1517
1464
  static phantom() {
1518
- return (0, reified_1.phantom)(StakerKey.reified());
1465
+ return phantom(StakerKey.reified());
1519
1466
  }
1520
1467
  static get p() {
1521
1468
  return StakerKey.phantom();
1522
1469
  }
1523
1470
  static get bcs() {
1524
- return bcs_1.bcs.struct("StakerKey", {
1525
- dummy_field: bcs_1.bcs.bool(),
1471
+ return bcs.struct("StakerKey", {
1472
+ dummy_field: bcs.bool(),
1526
1473
  });
1527
1474
  }
1528
1475
  static fromFields(fields) {
1529
1476
  return StakerKey.reified().new({
1530
- dummyField: (0, reified_1.decodeFromFields)("bool", fields.dummy_field),
1477
+ dummyField: decodeFromFields("bool", fields.dummy_field),
1531
1478
  });
1532
1479
  }
1533
1480
  static fromFieldsWithTypes(item) {
@@ -1535,7 +1482,7 @@ class StakerKey {
1535
1482
  throw new Error("not a StakerKey type");
1536
1483
  }
1537
1484
  return StakerKey.reified().new({
1538
- dummyField: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.dummy_field),
1485
+ dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field),
1539
1486
  });
1540
1487
  }
1541
1488
  static fromBcs(data) {
@@ -1551,7 +1498,7 @@ class StakerKey {
1551
1498
  }
1552
1499
  static fromJSONField(field) {
1553
1500
  return StakerKey.reified().new({
1554
- dummyField: (0, reified_1.decodeFromJSONField)("bool", field.dummyField),
1501
+ dummyField: decodeFromJSONField("bool", field.dummyField),
1555
1502
  });
1556
1503
  }
1557
1504
  static fromJSON(json) {
@@ -1574,7 +1521,7 @@ class StakerKey {
1574
1521
  if (data.bcs.dataType !== "moveObject" || !isStakerKey(data.bcs.type)) {
1575
1522
  throw new Error(`object at is not a StakerKey object`);
1576
1523
  }
1577
- return StakerKey.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1524
+ return StakerKey.fromBcs(fromBase64(data.bcs.bcsBytes));
1578
1525
  }
1579
1526
  if (data.content) {
1580
1527
  return StakerKey.fromSuiParsedData(data.content);
@@ -1596,7 +1543,6 @@ class StakerKey {
1596
1543
  });
1597
1544
  }
1598
1545
  }
1599
- exports.StakerKey = StakerKey;
1600
- StakerKey.$typeName = `${index_1.PKG_V8}::reserve::StakerKey`;
1546
+ StakerKey.$typeName = `${PKG_V8}::reserve::StakerKey`;
1601
1547
  StakerKey.$numTypeParams = 0;
1602
1548
  StakerKey.$isPhantom = [];