@suilend/sdk 1.1.19 → 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x1/ascii/structs.js +7 -7
- package/_generated/_dependencies/source/0x1/index.d.ts +1 -1
- package/_generated/_dependencies/source/0x1/index.js +2 -2
- package/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x1/option/structs.js +4 -4
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +2 -2
- package/_generated/_dependencies/source/0x1/type-name/structs.js +4 -4
- package/_generated/_dependencies/source/0x2/bag/structs.js +2 -2
- package/_generated/_dependencies/source/0x2/balance/structs.js +3 -3
- package/_generated/_dependencies/source/0x2/object/structs.js +3 -3
- package/_generated/_dependencies/source/0x2/object-table/structs.js +2 -2
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +2 -2
- package/_generated/_framework/reified.js +10 -10
- package/_generated/_framework/util.d.ts +11 -5
- package/_generated/_framework/util.js +13 -12
- package/_generated/_framework/vector.d.ts +1 -1
- package/_generated/_framework/vector.js +2 -2
- package/_generated/suilend/cell/structs.d.ts +3 -3
- package/_generated/suilend/cell/structs.js +2 -2
- package/_generated/suilend/decimal/structs.d.ts +3 -3
- package/_generated/suilend/decimal/structs.js +2 -2
- package/_generated/suilend/index.d.ts +3 -3
- package/_generated/suilend/index.js +11 -5
- package/_generated/suilend/lending-market/functions.d.ts +50 -6
- package/_generated/suilend/lending-market/functions.js +136 -41
- package/_generated/suilend/lending-market/structs.d.ts +192 -192
- package/_generated/suilend/lending-market/structs.js +392 -392
- package/_generated/suilend/lending-market-registry/functions.js +3 -2
- package/_generated/suilend/liquidity-mining/structs.d.ts +14 -14
- package/_generated/suilend/liquidity-mining/structs.js +6 -6
- package/_generated/suilend/obligation/structs.d.ts +17 -17
- package/_generated/suilend/obligation/structs.js +7 -7
- package/_generated/suilend/rate-limiter/functions.js +7 -6
- package/_generated/suilend/rate-limiter/structs.d.ts +6 -6
- package/_generated/suilend/rate-limiter/structs.js +3 -3
- package/_generated/suilend/reserve/structs.d.ts +179 -15
- package/_generated/suilend/reserve/structs.js +434 -7
- package/_generated/suilend/reserve-config/functions.d.ts +7 -7
- package/_generated/suilend/reserve-config/functions.js +54 -53
- package/_generated/suilend/reserve-config/structs.d.ts +6 -6
- package/_generated/suilend/reserve-config/structs.js +3 -3
- package/client.d.ts +3 -2
- package/client.js +52 -31
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +3 -3
- package/parsers/obligation.d.ts +4 -4
- package/parsers/reserve.d.ts +2 -2
- package/utils/events.js +3 -3
- package/utils/obligation.js +6 -5
|
@@ -32,21 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.WithdrawEvent = exports.RepayEvent = exports.
|
|
36
|
-
exports.isBorrowEvent = isBorrowEvent;
|
|
37
|
-
exports.isClaimRewardEvent = isClaimRewardEvent;
|
|
38
|
-
exports.isDepositEvent = isDepositEvent;
|
|
39
|
-
exports.isForgiveEvent = isForgiveEvent;
|
|
40
|
-
exports.isLENDING_MARKET = isLENDING_MARKET;
|
|
41
|
-
exports.isLendingMarket = isLendingMarket;
|
|
42
|
-
exports.isLendingMarketOwnerCap = isLendingMarketOwnerCap;
|
|
43
|
-
exports.isLiquidateEvent = isLiquidateEvent;
|
|
44
|
-
exports.isMintEvent = isMintEvent;
|
|
45
|
-
exports.isObligationOwnerCap = isObligationOwnerCap;
|
|
46
|
-
exports.isRateLimiterExemption = isRateLimiterExemption;
|
|
47
|
-
exports.isRedeemEvent = isRedeemEvent;
|
|
48
|
-
exports.isRepayEvent = isRepayEvent;
|
|
49
|
-
exports.isWithdrawEvent = isWithdrawEvent;
|
|
35
|
+
exports.WithdrawEvent = exports.isWithdrawEvent = exports.RepayEvent = exports.isRepayEvent = exports.RateLimiterExemption = exports.isRateLimiterExemption = exports.ObligationOwnerCap = exports.isObligationOwnerCap = exports.LiquidateEvent = exports.isLiquidateEvent = exports.LendingMarketOwnerCap = exports.isLendingMarketOwnerCap = exports.LendingMarket = exports.isLendingMarket = exports.LENDING_MARKET = exports.isLENDING_MARKET = exports.ForgiveEvent = exports.isForgiveEvent = exports.DepositEvent = exports.isDepositEvent = exports.ClaimRewardEvent = exports.isClaimRewardEvent = exports.BorrowEvent = exports.isBorrowEvent = exports.RedeemEvent = exports.isRedeemEvent = exports.MintEvent = exports.isMintEvent = void 0;
|
|
50
36
|
const reified = __importStar(require("../../_framework/reified"));
|
|
51
37
|
const structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
|
|
52
38
|
const structs_2 = require("../../_dependencies/source/0x2/object-table/structs");
|
|
@@ -60,11 +46,332 @@ const structs_6 = require("../rate-limiter/structs");
|
|
|
60
46
|
const structs_7 = require("../reserve/structs");
|
|
61
47
|
const bcs_1 = require("@mysten/sui/bcs");
|
|
62
48
|
const utils_1 = require("@mysten/sui/utils");
|
|
49
|
+
/* ============================== MintEvent =============================== */
|
|
50
|
+
function isMintEvent(type) {
|
|
51
|
+
type = (0, util_1.compressSuiType)(type);
|
|
52
|
+
return type === `${index_1.PKG_V1}::lending_market::MintEvent`;
|
|
53
|
+
}
|
|
54
|
+
exports.isMintEvent = isMintEvent;
|
|
55
|
+
class MintEvent {
|
|
56
|
+
constructor(typeArgs, fields) {
|
|
57
|
+
this.__StructClass = true;
|
|
58
|
+
this.$typeName = MintEvent.$typeName;
|
|
59
|
+
this.$isPhantom = MintEvent.$isPhantom;
|
|
60
|
+
this.$fullTypeName = (0, util_1.composeSuiType)(MintEvent.$typeName, ...typeArgs);
|
|
61
|
+
this.$typeArgs = typeArgs;
|
|
62
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
63
|
+
this.coinType = fields.coinType;
|
|
64
|
+
this.reserveId = fields.reserveId;
|
|
65
|
+
this.liquidityAmount = fields.liquidityAmount;
|
|
66
|
+
this.ctokenAmount = fields.ctokenAmount;
|
|
67
|
+
}
|
|
68
|
+
static reified() {
|
|
69
|
+
return {
|
|
70
|
+
typeName: MintEvent.$typeName,
|
|
71
|
+
fullTypeName: (0, util_1.composeSuiType)(MintEvent.$typeName, ...[]),
|
|
72
|
+
typeArgs: [],
|
|
73
|
+
isPhantom: MintEvent.$isPhantom,
|
|
74
|
+
reifiedTypeArgs: [],
|
|
75
|
+
fromFields: (fields) => MintEvent.fromFields(fields),
|
|
76
|
+
fromFieldsWithTypes: (item) => MintEvent.fromFieldsWithTypes(item),
|
|
77
|
+
fromBcs: (data) => MintEvent.fromBcs(data),
|
|
78
|
+
bcs: MintEvent.bcs,
|
|
79
|
+
fromJSONField: (field) => MintEvent.fromJSONField(field),
|
|
80
|
+
fromJSON: (json) => MintEvent.fromJSON(json),
|
|
81
|
+
fromSuiParsedData: (content) => MintEvent.fromSuiParsedData(content),
|
|
82
|
+
fromSuiObjectData: (content) => MintEvent.fromSuiObjectData(content),
|
|
83
|
+
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return MintEvent.fetch(client, id); }),
|
|
84
|
+
new: (fields) => {
|
|
85
|
+
return new MintEvent([], fields);
|
|
86
|
+
},
|
|
87
|
+
kind: "StructClassReified",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
static get r() {
|
|
91
|
+
return MintEvent.reified();
|
|
92
|
+
}
|
|
93
|
+
static phantom() {
|
|
94
|
+
return (0, reified_1.phantom)(MintEvent.reified());
|
|
95
|
+
}
|
|
96
|
+
static get p() {
|
|
97
|
+
return MintEvent.phantom();
|
|
98
|
+
}
|
|
99
|
+
static get bcs() {
|
|
100
|
+
return bcs_1.bcs.struct("MintEvent", {
|
|
101
|
+
lending_market_id: bcs_1.bcs
|
|
102
|
+
.bytes(32)
|
|
103
|
+
.transform({
|
|
104
|
+
input: (val) => (0, utils_1.fromHEX)(val),
|
|
105
|
+
output: (val) => (0, utils_1.toHEX)(val),
|
|
106
|
+
}),
|
|
107
|
+
coin_type: structs_1.TypeName.bcs,
|
|
108
|
+
reserve_id: bcs_1.bcs
|
|
109
|
+
.bytes(32)
|
|
110
|
+
.transform({
|
|
111
|
+
input: (val) => (0, utils_1.fromHEX)(val),
|
|
112
|
+
output: (val) => (0, utils_1.toHEX)(val),
|
|
113
|
+
}),
|
|
114
|
+
liquidity_amount: bcs_1.bcs.u64(),
|
|
115
|
+
ctoken_amount: bcs_1.bcs.u64(),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
static fromFields(fields) {
|
|
119
|
+
return MintEvent.reified().new({
|
|
120
|
+
lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
|
|
121
|
+
coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
|
|
122
|
+
reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
|
|
123
|
+
liquidityAmount: (0, reified_1.decodeFromFields)("u64", fields.liquidity_amount),
|
|
124
|
+
ctokenAmount: (0, reified_1.decodeFromFields)("u64", fields.ctoken_amount),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
static fromFieldsWithTypes(item) {
|
|
128
|
+
if (!isMintEvent(item.type)) {
|
|
129
|
+
throw new Error("not a MintEvent type");
|
|
130
|
+
}
|
|
131
|
+
return MintEvent.reified().new({
|
|
132
|
+
lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
|
|
133
|
+
coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
|
|
134
|
+
reserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.reserve_id),
|
|
135
|
+
liquidityAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.liquidity_amount),
|
|
136
|
+
ctokenAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.ctoken_amount),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
static fromBcs(data) {
|
|
140
|
+
return MintEvent.fromFields(MintEvent.bcs.parse(data));
|
|
141
|
+
}
|
|
142
|
+
toJSONField() {
|
|
143
|
+
return {
|
|
144
|
+
lendingMarketId: this.lendingMarketId,
|
|
145
|
+
coinType: this.coinType.toJSONField(),
|
|
146
|
+
reserveId: this.reserveId,
|
|
147
|
+
liquidityAmount: this.liquidityAmount.toString(),
|
|
148
|
+
ctokenAmount: this.ctokenAmount.toString(),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
toJSON() {
|
|
152
|
+
return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
153
|
+
}
|
|
154
|
+
static fromJSONField(field) {
|
|
155
|
+
return MintEvent.reified().new({
|
|
156
|
+
lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
|
|
157
|
+
coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
|
|
158
|
+
reserveId: (0, reified_1.decodeFromJSONField)("address", field.reserveId),
|
|
159
|
+
liquidityAmount: (0, reified_1.decodeFromJSONField)("u64", field.liquidityAmount),
|
|
160
|
+
ctokenAmount: (0, reified_1.decodeFromJSONField)("u64", field.ctokenAmount),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
static fromJSON(json) {
|
|
164
|
+
if (json.$typeName !== MintEvent.$typeName) {
|
|
165
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
166
|
+
}
|
|
167
|
+
return MintEvent.fromJSONField(json);
|
|
168
|
+
}
|
|
169
|
+
static fromSuiParsedData(content) {
|
|
170
|
+
if (content.dataType !== "moveObject") {
|
|
171
|
+
throw new Error("not an object");
|
|
172
|
+
}
|
|
173
|
+
if (!isMintEvent(content.type)) {
|
|
174
|
+
throw new Error(`object at ${content.fields.id} is not a MintEvent object`);
|
|
175
|
+
}
|
|
176
|
+
return MintEvent.fromFieldsWithTypes(content);
|
|
177
|
+
}
|
|
178
|
+
static fromSuiObjectData(data) {
|
|
179
|
+
if (data.bcs) {
|
|
180
|
+
if (data.bcs.dataType !== "moveObject" || !isMintEvent(data.bcs.type)) {
|
|
181
|
+
throw new Error(`object at is not a MintEvent object`);
|
|
182
|
+
}
|
|
183
|
+
return MintEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
184
|
+
}
|
|
185
|
+
if (data.content) {
|
|
186
|
+
return MintEvent.fromSuiParsedData(data.content);
|
|
187
|
+
}
|
|
188
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
189
|
+
}
|
|
190
|
+
static fetch(client, id) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
var _a, _b;
|
|
193
|
+
const res = yield client.getObject({ id, options: { showBcs: true } });
|
|
194
|
+
if (res.error) {
|
|
195
|
+
throw new Error(`error fetching MintEvent object at id ${id}: ${res.error.code}`);
|
|
196
|
+
}
|
|
197
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
198
|
+
!isMintEvent(res.data.bcs.type)) {
|
|
199
|
+
throw new Error(`object at id ${id} is not a MintEvent object`);
|
|
200
|
+
}
|
|
201
|
+
return MintEvent.fromSuiObjectData(res.data);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.MintEvent = MintEvent;
|
|
206
|
+
MintEvent.$typeName = `${index_1.PKG_V1}::lending_market::MintEvent`;
|
|
207
|
+
MintEvent.$numTypeParams = 0;
|
|
208
|
+
MintEvent.$isPhantom = [];
|
|
209
|
+
/* ============================== RedeemEvent =============================== */
|
|
210
|
+
function isRedeemEvent(type) {
|
|
211
|
+
type = (0, util_1.compressSuiType)(type);
|
|
212
|
+
return type === `${index_1.PKG_V1}::lending_market::RedeemEvent`;
|
|
213
|
+
}
|
|
214
|
+
exports.isRedeemEvent = isRedeemEvent;
|
|
215
|
+
class RedeemEvent {
|
|
216
|
+
constructor(typeArgs, fields) {
|
|
217
|
+
this.__StructClass = true;
|
|
218
|
+
this.$typeName = RedeemEvent.$typeName;
|
|
219
|
+
this.$isPhantom = RedeemEvent.$isPhantom;
|
|
220
|
+
this.$fullTypeName = (0, util_1.composeSuiType)(RedeemEvent.$typeName, ...typeArgs);
|
|
221
|
+
this.$typeArgs = typeArgs;
|
|
222
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
223
|
+
this.coinType = fields.coinType;
|
|
224
|
+
this.reserveId = fields.reserveId;
|
|
225
|
+
this.ctokenAmount = fields.ctokenAmount;
|
|
226
|
+
this.liquidityAmount = fields.liquidityAmount;
|
|
227
|
+
}
|
|
228
|
+
static reified() {
|
|
229
|
+
return {
|
|
230
|
+
typeName: RedeemEvent.$typeName,
|
|
231
|
+
fullTypeName: (0, util_1.composeSuiType)(RedeemEvent.$typeName, ...[]),
|
|
232
|
+
typeArgs: [],
|
|
233
|
+
isPhantom: RedeemEvent.$isPhantom,
|
|
234
|
+
reifiedTypeArgs: [],
|
|
235
|
+
fromFields: (fields) => RedeemEvent.fromFields(fields),
|
|
236
|
+
fromFieldsWithTypes: (item) => RedeemEvent.fromFieldsWithTypes(item),
|
|
237
|
+
fromBcs: (data) => RedeemEvent.fromBcs(data),
|
|
238
|
+
bcs: RedeemEvent.bcs,
|
|
239
|
+
fromJSONField: (field) => RedeemEvent.fromJSONField(field),
|
|
240
|
+
fromJSON: (json) => RedeemEvent.fromJSON(json),
|
|
241
|
+
fromSuiParsedData: (content) => RedeemEvent.fromSuiParsedData(content),
|
|
242
|
+
fromSuiObjectData: (content) => RedeemEvent.fromSuiObjectData(content),
|
|
243
|
+
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RedeemEvent.fetch(client, id); }),
|
|
244
|
+
new: (fields) => {
|
|
245
|
+
return new RedeemEvent([], fields);
|
|
246
|
+
},
|
|
247
|
+
kind: "StructClassReified",
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
static get r() {
|
|
251
|
+
return RedeemEvent.reified();
|
|
252
|
+
}
|
|
253
|
+
static phantom() {
|
|
254
|
+
return (0, reified_1.phantom)(RedeemEvent.reified());
|
|
255
|
+
}
|
|
256
|
+
static get p() {
|
|
257
|
+
return RedeemEvent.phantom();
|
|
258
|
+
}
|
|
259
|
+
static get bcs() {
|
|
260
|
+
return bcs_1.bcs.struct("RedeemEvent", {
|
|
261
|
+
lending_market_id: bcs_1.bcs
|
|
262
|
+
.bytes(32)
|
|
263
|
+
.transform({
|
|
264
|
+
input: (val) => (0, utils_1.fromHEX)(val),
|
|
265
|
+
output: (val) => (0, utils_1.toHEX)(val),
|
|
266
|
+
}),
|
|
267
|
+
coin_type: structs_1.TypeName.bcs,
|
|
268
|
+
reserve_id: bcs_1.bcs
|
|
269
|
+
.bytes(32)
|
|
270
|
+
.transform({
|
|
271
|
+
input: (val) => (0, utils_1.fromHEX)(val),
|
|
272
|
+
output: (val) => (0, utils_1.toHEX)(val),
|
|
273
|
+
}),
|
|
274
|
+
ctoken_amount: bcs_1.bcs.u64(),
|
|
275
|
+
liquidity_amount: bcs_1.bcs.u64(),
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
static fromFields(fields) {
|
|
279
|
+
return RedeemEvent.reified().new({
|
|
280
|
+
lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
|
|
281
|
+
coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
|
|
282
|
+
reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
|
|
283
|
+
ctokenAmount: (0, reified_1.decodeFromFields)("u64", fields.ctoken_amount),
|
|
284
|
+
liquidityAmount: (0, reified_1.decodeFromFields)("u64", fields.liquidity_amount),
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
static fromFieldsWithTypes(item) {
|
|
288
|
+
if (!isRedeemEvent(item.type)) {
|
|
289
|
+
throw new Error("not a RedeemEvent type");
|
|
290
|
+
}
|
|
291
|
+
return RedeemEvent.reified().new({
|
|
292
|
+
lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
|
|
293
|
+
coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
|
|
294
|
+
reserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.reserve_id),
|
|
295
|
+
ctokenAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.ctoken_amount),
|
|
296
|
+
liquidityAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.liquidity_amount),
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
static fromBcs(data) {
|
|
300
|
+
return RedeemEvent.fromFields(RedeemEvent.bcs.parse(data));
|
|
301
|
+
}
|
|
302
|
+
toJSONField() {
|
|
303
|
+
return {
|
|
304
|
+
lendingMarketId: this.lendingMarketId,
|
|
305
|
+
coinType: this.coinType.toJSONField(),
|
|
306
|
+
reserveId: this.reserveId,
|
|
307
|
+
ctokenAmount: this.ctokenAmount.toString(),
|
|
308
|
+
liquidityAmount: this.liquidityAmount.toString(),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
toJSON() {
|
|
312
|
+
return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
313
|
+
}
|
|
314
|
+
static fromJSONField(field) {
|
|
315
|
+
return RedeemEvent.reified().new({
|
|
316
|
+
lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
|
|
317
|
+
coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
|
|
318
|
+
reserveId: (0, reified_1.decodeFromJSONField)("address", field.reserveId),
|
|
319
|
+
ctokenAmount: (0, reified_1.decodeFromJSONField)("u64", field.ctokenAmount),
|
|
320
|
+
liquidityAmount: (0, reified_1.decodeFromJSONField)("u64", field.liquidityAmount),
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
static fromJSON(json) {
|
|
324
|
+
if (json.$typeName !== RedeemEvent.$typeName) {
|
|
325
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
326
|
+
}
|
|
327
|
+
return RedeemEvent.fromJSONField(json);
|
|
328
|
+
}
|
|
329
|
+
static fromSuiParsedData(content) {
|
|
330
|
+
if (content.dataType !== "moveObject") {
|
|
331
|
+
throw new Error("not an object");
|
|
332
|
+
}
|
|
333
|
+
if (!isRedeemEvent(content.type)) {
|
|
334
|
+
throw new Error(`object at ${content.fields.id} is not a RedeemEvent object`);
|
|
335
|
+
}
|
|
336
|
+
return RedeemEvent.fromFieldsWithTypes(content);
|
|
337
|
+
}
|
|
338
|
+
static fromSuiObjectData(data) {
|
|
339
|
+
if (data.bcs) {
|
|
340
|
+
if (data.bcs.dataType !== "moveObject" || !isRedeemEvent(data.bcs.type)) {
|
|
341
|
+
throw new Error(`object at is not a RedeemEvent object`);
|
|
342
|
+
}
|
|
343
|
+
return RedeemEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
344
|
+
}
|
|
345
|
+
if (data.content) {
|
|
346
|
+
return RedeemEvent.fromSuiParsedData(data.content);
|
|
347
|
+
}
|
|
348
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
349
|
+
}
|
|
350
|
+
static fetch(client, id) {
|
|
351
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
+
var _a, _b;
|
|
353
|
+
const res = yield client.getObject({ id, options: { showBcs: true } });
|
|
354
|
+
if (res.error) {
|
|
355
|
+
throw new Error(`error fetching RedeemEvent object at id ${id}: ${res.error.code}`);
|
|
356
|
+
}
|
|
357
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
358
|
+
!isRedeemEvent(res.data.bcs.type)) {
|
|
359
|
+
throw new Error(`object at id ${id} is not a RedeemEvent object`);
|
|
360
|
+
}
|
|
361
|
+
return RedeemEvent.fromSuiObjectData(res.data);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
exports.RedeemEvent = RedeemEvent;
|
|
366
|
+
RedeemEvent.$typeName = `${index_1.PKG_V1}::lending_market::RedeemEvent`;
|
|
367
|
+
RedeemEvent.$numTypeParams = 0;
|
|
368
|
+
RedeemEvent.$isPhantom = [];
|
|
63
369
|
/* ============================== BorrowEvent =============================== */
|
|
64
370
|
function isBorrowEvent(type) {
|
|
65
371
|
type = (0, util_1.compressSuiType)(type);
|
|
66
372
|
return type === `${index_1.PKG_V1}::lending_market::BorrowEvent`;
|
|
67
373
|
}
|
|
374
|
+
exports.isBorrowEvent = isBorrowEvent;
|
|
68
375
|
class BorrowEvent {
|
|
69
376
|
constructor(typeArgs, fields) {
|
|
70
377
|
this.__StructClass = true;
|
|
@@ -235,6 +542,7 @@ function isClaimRewardEvent(type) {
|
|
|
235
542
|
type = (0, util_1.compressSuiType)(type);
|
|
236
543
|
return type === `${index_1.PKG_V1}::lending_market::ClaimRewardEvent`;
|
|
237
544
|
}
|
|
545
|
+
exports.isClaimRewardEvent = isClaimRewardEvent;
|
|
238
546
|
class ClaimRewardEvent {
|
|
239
547
|
constructor(typeArgs, fields) {
|
|
240
548
|
this.__StructClass = true;
|
|
@@ -417,6 +725,7 @@ function isDepositEvent(type) {
|
|
|
417
725
|
type = (0, util_1.compressSuiType)(type);
|
|
418
726
|
return type === `${index_1.PKG_V1}::lending_market::DepositEvent`;
|
|
419
727
|
}
|
|
728
|
+
exports.isDepositEvent = isDepositEvent;
|
|
420
729
|
class DepositEvent {
|
|
421
730
|
constructor(typeArgs, fields) {
|
|
422
731
|
this.__StructClass = true;
|
|
@@ -582,6 +891,7 @@ function isForgiveEvent(type) {
|
|
|
582
891
|
type = (0, util_1.compressSuiType)(type);
|
|
583
892
|
return type === `${index_1.PKG_V1}::lending_market::ForgiveEvent`;
|
|
584
893
|
}
|
|
894
|
+
exports.isForgiveEvent = isForgiveEvent;
|
|
585
895
|
class ForgiveEvent {
|
|
586
896
|
constructor(typeArgs, fields) {
|
|
587
897
|
this.__StructClass = true;
|
|
@@ -747,6 +1057,7 @@ function isLENDING_MARKET(type) {
|
|
|
747
1057
|
type = (0, util_1.compressSuiType)(type);
|
|
748
1058
|
return type === `${index_1.PKG_V1}::lending_market::LENDING_MARKET`;
|
|
749
1059
|
}
|
|
1060
|
+
exports.isLENDING_MARKET = isLENDING_MARKET;
|
|
750
1061
|
class LENDING_MARKET {
|
|
751
1062
|
constructor(typeArgs, fields) {
|
|
752
1063
|
this.__StructClass = true;
|
|
@@ -873,6 +1184,7 @@ function isLendingMarket(type) {
|
|
|
873
1184
|
type = (0, util_1.compressSuiType)(type);
|
|
874
1185
|
return type.startsWith(`${index_1.PKG_V1}::lending_market::LendingMarket` + "<");
|
|
875
1186
|
}
|
|
1187
|
+
exports.isLendingMarket = isLendingMarket;
|
|
876
1188
|
class LendingMarket {
|
|
877
1189
|
constructor(typeArgs, fields) {
|
|
878
1190
|
this.__StructClass = true;
|
|
@@ -1057,6 +1369,7 @@ function isLendingMarketOwnerCap(type) {
|
|
|
1057
1369
|
type = (0, util_1.compressSuiType)(type);
|
|
1058
1370
|
return type.startsWith(`${index_1.PKG_V1}::lending_market::LendingMarketOwnerCap` + "<");
|
|
1059
1371
|
}
|
|
1372
|
+
exports.isLendingMarketOwnerCap = isLendingMarketOwnerCap;
|
|
1060
1373
|
class LendingMarketOwnerCap {
|
|
1061
1374
|
constructor(typeArgs, fields) {
|
|
1062
1375
|
this.__StructClass = true;
|
|
@@ -1200,6 +1513,7 @@ function isLiquidateEvent(type) {
|
|
|
1200
1513
|
type = (0, util_1.compressSuiType)(type);
|
|
1201
1514
|
return type === `${index_1.PKG_V1}::lending_market::LiquidateEvent`;
|
|
1202
1515
|
}
|
|
1516
|
+
exports.isLiquidateEvent = isLiquidateEvent;
|
|
1203
1517
|
class LiquidateEvent {
|
|
1204
1518
|
constructor(typeArgs, fields) {
|
|
1205
1519
|
this.__StructClass = true;
|
|
@@ -1286,252 +1600,93 @@ class LiquidateEvent {
|
|
|
1286
1600
|
static fromFields(fields) {
|
|
1287
1601
|
return LiquidateEvent.reified().new({
|
|
1288
1602
|
lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
|
|
1289
|
-
repayReserveId: (0, reified_1.decodeFromFields)("address", fields.repay_reserve_id),
|
|
1290
|
-
withdrawReserveId: (0, reified_1.decodeFromFields)("address", fields.withdraw_reserve_id),
|
|
1291
|
-
obligationId: (0, reified_1.decodeFromFields)("address", fields.obligation_id),
|
|
1292
|
-
repayCoinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.repay_coin_type),
|
|
1293
|
-
withdrawCoinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.withdraw_coin_type),
|
|
1294
|
-
repayAmount: (0, reified_1.decodeFromFields)("u64", fields.repay_amount),
|
|
1295
|
-
withdrawAmount: (0, reified_1.decodeFromFields)("u64", fields.withdraw_amount),
|
|
1296
|
-
protocolFeeAmount: (0, reified_1.decodeFromFields)("u64", fields.protocol_fee_amount),
|
|
1297
|
-
liquidatorBonusAmount: (0, reified_1.decodeFromFields)("u64", fields.liquidator_bonus_amount),
|
|
1298
|
-
});
|
|
1299
|
-
}
|
|
1300
|
-
static fromFieldsWithTypes(item) {
|
|
1301
|
-
if (!isLiquidateEvent(item.type)) {
|
|
1302
|
-
throw new Error("not a LiquidateEvent type");
|
|
1303
|
-
}
|
|
1304
|
-
return LiquidateEvent.reified().new({
|
|
1305
|
-
lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
|
|
1306
|
-
repayReserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.repay_reserve_id),
|
|
1307
|
-
withdrawReserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.withdraw_reserve_id),
|
|
1308
|
-
obligationId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.obligation_id),
|
|
1309
|
-
repayCoinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.repay_coin_type),
|
|
1310
|
-
withdrawCoinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.withdraw_coin_type),
|
|
1311
|
-
repayAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.repay_amount),
|
|
1312
|
-
withdrawAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.withdraw_amount),
|
|
1313
|
-
protocolFeeAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.protocol_fee_amount),
|
|
1314
|
-
liquidatorBonusAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.liquidator_bonus_amount),
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
static fromBcs(data) {
|
|
1318
|
-
return LiquidateEvent.fromFields(LiquidateEvent.bcs.parse(data));
|
|
1319
|
-
}
|
|
1320
|
-
toJSONField() {
|
|
1321
|
-
return {
|
|
1322
|
-
lendingMarketId: this.lendingMarketId,
|
|
1323
|
-
repayReserveId: this.repayReserveId,
|
|
1324
|
-
withdrawReserveId: this.withdrawReserveId,
|
|
1325
|
-
obligationId: this.obligationId,
|
|
1326
|
-
repayCoinType: this.repayCoinType.toJSONField(),
|
|
1327
|
-
withdrawCoinType: this.withdrawCoinType.toJSONField(),
|
|
1328
|
-
repayAmount: this.repayAmount.toString(),
|
|
1329
|
-
withdrawAmount: this.withdrawAmount.toString(),
|
|
1330
|
-
protocolFeeAmount: this.protocolFeeAmount.toString(),
|
|
1331
|
-
liquidatorBonusAmount: this.liquidatorBonusAmount.toString(),
|
|
1332
|
-
};
|
|
1333
|
-
}
|
|
1334
|
-
toJSON() {
|
|
1335
|
-
return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
1336
|
-
}
|
|
1337
|
-
static fromJSONField(field) {
|
|
1338
|
-
return LiquidateEvent.reified().new({
|
|
1339
|
-
lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
|
|
1340
|
-
repayReserveId: (0, reified_1.decodeFromJSONField)("address", field.repayReserveId),
|
|
1341
|
-
withdrawReserveId: (0, reified_1.decodeFromJSONField)("address", field.withdrawReserveId),
|
|
1342
|
-
obligationId: (0, reified_1.decodeFromJSONField)("address", field.obligationId),
|
|
1343
|
-
repayCoinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.repayCoinType),
|
|
1344
|
-
withdrawCoinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.withdrawCoinType),
|
|
1345
|
-
repayAmount: (0, reified_1.decodeFromJSONField)("u64", field.repayAmount),
|
|
1346
|
-
withdrawAmount: (0, reified_1.decodeFromJSONField)("u64", field.withdrawAmount),
|
|
1347
|
-
protocolFeeAmount: (0, reified_1.decodeFromJSONField)("u64", field.protocolFeeAmount),
|
|
1348
|
-
liquidatorBonusAmount: (0, reified_1.decodeFromJSONField)("u64", field.liquidatorBonusAmount),
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
static fromJSON(json) {
|
|
1352
|
-
if (json.$typeName !== LiquidateEvent.$typeName) {
|
|
1353
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
1354
|
-
}
|
|
1355
|
-
return LiquidateEvent.fromJSONField(json);
|
|
1356
|
-
}
|
|
1357
|
-
static fromSuiParsedData(content) {
|
|
1358
|
-
if (content.dataType !== "moveObject") {
|
|
1359
|
-
throw new Error("not an object");
|
|
1360
|
-
}
|
|
1361
|
-
if (!isLiquidateEvent(content.type)) {
|
|
1362
|
-
throw new Error(`object at ${content.fields.id} is not a LiquidateEvent object`);
|
|
1363
|
-
}
|
|
1364
|
-
return LiquidateEvent.fromFieldsWithTypes(content);
|
|
1365
|
-
}
|
|
1366
|
-
static fromSuiObjectData(data) {
|
|
1367
|
-
if (data.bcs) {
|
|
1368
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1369
|
-
!isLiquidateEvent(data.bcs.type)) {
|
|
1370
|
-
throw new Error(`object at is not a LiquidateEvent object`);
|
|
1371
|
-
}
|
|
1372
|
-
return LiquidateEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1373
|
-
}
|
|
1374
|
-
if (data.content) {
|
|
1375
|
-
return LiquidateEvent.fromSuiParsedData(data.content);
|
|
1376
|
-
}
|
|
1377
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1378
|
-
}
|
|
1379
|
-
static fetch(client, id) {
|
|
1380
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1381
|
-
var _a, _b;
|
|
1382
|
-
const res = yield client.getObject({ id, options: { showBcs: true } });
|
|
1383
|
-
if (res.error) {
|
|
1384
|
-
throw new Error(`error fetching LiquidateEvent object at id ${id}: ${res.error.code}`);
|
|
1385
|
-
}
|
|
1386
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1387
|
-
!isLiquidateEvent(res.data.bcs.type)) {
|
|
1388
|
-
throw new Error(`object at id ${id} is not a LiquidateEvent object`);
|
|
1389
|
-
}
|
|
1390
|
-
return LiquidateEvent.fromSuiObjectData(res.data);
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
exports.LiquidateEvent = LiquidateEvent;
|
|
1395
|
-
LiquidateEvent.$typeName = `${index_1.PKG_V1}::lending_market::LiquidateEvent`;
|
|
1396
|
-
LiquidateEvent.$numTypeParams = 0;
|
|
1397
|
-
LiquidateEvent.$isPhantom = [];
|
|
1398
|
-
/* ============================== MintEvent =============================== */
|
|
1399
|
-
function isMintEvent(type) {
|
|
1400
|
-
type = (0, util_1.compressSuiType)(type);
|
|
1401
|
-
return type === `${index_1.PKG_V1}::lending_market::MintEvent`;
|
|
1402
|
-
}
|
|
1403
|
-
class MintEvent {
|
|
1404
|
-
constructor(typeArgs, fields) {
|
|
1405
|
-
this.__StructClass = true;
|
|
1406
|
-
this.$typeName = MintEvent.$typeName;
|
|
1407
|
-
this.$isPhantom = MintEvent.$isPhantom;
|
|
1408
|
-
this.$fullTypeName = (0, util_1.composeSuiType)(MintEvent.$typeName, ...typeArgs);
|
|
1409
|
-
this.$typeArgs = typeArgs;
|
|
1410
|
-
this.lendingMarketId = fields.lendingMarketId;
|
|
1411
|
-
this.coinType = fields.coinType;
|
|
1412
|
-
this.reserveId = fields.reserveId;
|
|
1413
|
-
this.liquidityAmount = fields.liquidityAmount;
|
|
1414
|
-
this.ctokenAmount = fields.ctokenAmount;
|
|
1415
|
-
}
|
|
1416
|
-
static reified() {
|
|
1417
|
-
return {
|
|
1418
|
-
typeName: MintEvent.$typeName,
|
|
1419
|
-
fullTypeName: (0, util_1.composeSuiType)(MintEvent.$typeName, ...[]),
|
|
1420
|
-
typeArgs: [],
|
|
1421
|
-
isPhantom: MintEvent.$isPhantom,
|
|
1422
|
-
reifiedTypeArgs: [],
|
|
1423
|
-
fromFields: (fields) => MintEvent.fromFields(fields),
|
|
1424
|
-
fromFieldsWithTypes: (item) => MintEvent.fromFieldsWithTypes(item),
|
|
1425
|
-
fromBcs: (data) => MintEvent.fromBcs(data),
|
|
1426
|
-
bcs: MintEvent.bcs,
|
|
1427
|
-
fromJSONField: (field) => MintEvent.fromJSONField(field),
|
|
1428
|
-
fromJSON: (json) => MintEvent.fromJSON(json),
|
|
1429
|
-
fromSuiParsedData: (content) => MintEvent.fromSuiParsedData(content),
|
|
1430
|
-
fromSuiObjectData: (content) => MintEvent.fromSuiObjectData(content),
|
|
1431
|
-
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return MintEvent.fetch(client, id); }),
|
|
1432
|
-
new: (fields) => {
|
|
1433
|
-
return new MintEvent([], fields);
|
|
1434
|
-
},
|
|
1435
|
-
kind: "StructClassReified",
|
|
1436
|
-
};
|
|
1437
|
-
}
|
|
1438
|
-
static get r() {
|
|
1439
|
-
return MintEvent.reified();
|
|
1440
|
-
}
|
|
1441
|
-
static phantom() {
|
|
1442
|
-
return (0, reified_1.phantom)(MintEvent.reified());
|
|
1443
|
-
}
|
|
1444
|
-
static get p() {
|
|
1445
|
-
return MintEvent.phantom();
|
|
1446
|
-
}
|
|
1447
|
-
static get bcs() {
|
|
1448
|
-
return bcs_1.bcs.struct("MintEvent", {
|
|
1449
|
-
lending_market_id: bcs_1.bcs
|
|
1450
|
-
.bytes(32)
|
|
1451
|
-
.transform({
|
|
1452
|
-
input: (val) => (0, utils_1.fromHEX)(val),
|
|
1453
|
-
output: (val) => (0, utils_1.toHEX)(val),
|
|
1454
|
-
}),
|
|
1455
|
-
coin_type: structs_1.TypeName.bcs,
|
|
1456
|
-
reserve_id: bcs_1.bcs
|
|
1457
|
-
.bytes(32)
|
|
1458
|
-
.transform({
|
|
1459
|
-
input: (val) => (0, utils_1.fromHEX)(val),
|
|
1460
|
-
output: (val) => (0, utils_1.toHEX)(val),
|
|
1461
|
-
}),
|
|
1462
|
-
liquidity_amount: bcs_1.bcs.u64(),
|
|
1463
|
-
ctoken_amount: bcs_1.bcs.u64(),
|
|
1464
|
-
});
|
|
1465
|
-
}
|
|
1466
|
-
static fromFields(fields) {
|
|
1467
|
-
return MintEvent.reified().new({
|
|
1468
|
-
lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
|
|
1469
|
-
coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
|
|
1470
|
-
reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
|
|
1471
|
-
liquidityAmount: (0, reified_1.decodeFromFields)("u64", fields.liquidity_amount),
|
|
1472
|
-
ctokenAmount: (0, reified_1.decodeFromFields)("u64", fields.ctoken_amount),
|
|
1603
|
+
repayReserveId: (0, reified_1.decodeFromFields)("address", fields.repay_reserve_id),
|
|
1604
|
+
withdrawReserveId: (0, reified_1.decodeFromFields)("address", fields.withdraw_reserve_id),
|
|
1605
|
+
obligationId: (0, reified_1.decodeFromFields)("address", fields.obligation_id),
|
|
1606
|
+
repayCoinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.repay_coin_type),
|
|
1607
|
+
withdrawCoinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.withdraw_coin_type),
|
|
1608
|
+
repayAmount: (0, reified_1.decodeFromFields)("u64", fields.repay_amount),
|
|
1609
|
+
withdrawAmount: (0, reified_1.decodeFromFields)("u64", fields.withdraw_amount),
|
|
1610
|
+
protocolFeeAmount: (0, reified_1.decodeFromFields)("u64", fields.protocol_fee_amount),
|
|
1611
|
+
liquidatorBonusAmount: (0, reified_1.decodeFromFields)("u64", fields.liquidator_bonus_amount),
|
|
1473
1612
|
});
|
|
1474
1613
|
}
|
|
1475
1614
|
static fromFieldsWithTypes(item) {
|
|
1476
|
-
if (!
|
|
1477
|
-
throw new Error("not a
|
|
1615
|
+
if (!isLiquidateEvent(item.type)) {
|
|
1616
|
+
throw new Error("not a LiquidateEvent type");
|
|
1478
1617
|
}
|
|
1479
|
-
return
|
|
1618
|
+
return LiquidateEvent.reified().new({
|
|
1480
1619
|
lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1620
|
+
repayReserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.repay_reserve_id),
|
|
1621
|
+
withdrawReserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.withdraw_reserve_id),
|
|
1622
|
+
obligationId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.obligation_id),
|
|
1623
|
+
repayCoinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.repay_coin_type),
|
|
1624
|
+
withdrawCoinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.withdraw_coin_type),
|
|
1625
|
+
repayAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.repay_amount),
|
|
1626
|
+
withdrawAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.withdraw_amount),
|
|
1627
|
+
protocolFeeAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.protocol_fee_amount),
|
|
1628
|
+
liquidatorBonusAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.liquidator_bonus_amount),
|
|
1485
1629
|
});
|
|
1486
1630
|
}
|
|
1487
1631
|
static fromBcs(data) {
|
|
1488
|
-
return
|
|
1632
|
+
return LiquidateEvent.fromFields(LiquidateEvent.bcs.parse(data));
|
|
1489
1633
|
}
|
|
1490
1634
|
toJSONField() {
|
|
1491
1635
|
return {
|
|
1492
1636
|
lendingMarketId: this.lendingMarketId,
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1637
|
+
repayReserveId: this.repayReserveId,
|
|
1638
|
+
withdrawReserveId: this.withdrawReserveId,
|
|
1639
|
+
obligationId: this.obligationId,
|
|
1640
|
+
repayCoinType: this.repayCoinType.toJSONField(),
|
|
1641
|
+
withdrawCoinType: this.withdrawCoinType.toJSONField(),
|
|
1642
|
+
repayAmount: this.repayAmount.toString(),
|
|
1643
|
+
withdrawAmount: this.withdrawAmount.toString(),
|
|
1644
|
+
protocolFeeAmount: this.protocolFeeAmount.toString(),
|
|
1645
|
+
liquidatorBonusAmount: this.liquidatorBonusAmount.toString(),
|
|
1497
1646
|
};
|
|
1498
1647
|
}
|
|
1499
1648
|
toJSON() {
|
|
1500
1649
|
return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
1501
1650
|
}
|
|
1502
1651
|
static fromJSONField(field) {
|
|
1503
|
-
return
|
|
1652
|
+
return LiquidateEvent.reified().new({
|
|
1504
1653
|
lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1654
|
+
repayReserveId: (0, reified_1.decodeFromJSONField)("address", field.repayReserveId),
|
|
1655
|
+
withdrawReserveId: (0, reified_1.decodeFromJSONField)("address", field.withdrawReserveId),
|
|
1656
|
+
obligationId: (0, reified_1.decodeFromJSONField)("address", field.obligationId),
|
|
1657
|
+
repayCoinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.repayCoinType),
|
|
1658
|
+
withdrawCoinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.withdrawCoinType),
|
|
1659
|
+
repayAmount: (0, reified_1.decodeFromJSONField)("u64", field.repayAmount),
|
|
1660
|
+
withdrawAmount: (0, reified_1.decodeFromJSONField)("u64", field.withdrawAmount),
|
|
1661
|
+
protocolFeeAmount: (0, reified_1.decodeFromJSONField)("u64", field.protocolFeeAmount),
|
|
1662
|
+
liquidatorBonusAmount: (0, reified_1.decodeFromJSONField)("u64", field.liquidatorBonusAmount),
|
|
1509
1663
|
});
|
|
1510
1664
|
}
|
|
1511
1665
|
static fromJSON(json) {
|
|
1512
|
-
if (json.$typeName !==
|
|
1666
|
+
if (json.$typeName !== LiquidateEvent.$typeName) {
|
|
1513
1667
|
throw new Error("not a WithTwoGenerics json object");
|
|
1514
1668
|
}
|
|
1515
|
-
return
|
|
1669
|
+
return LiquidateEvent.fromJSONField(json);
|
|
1516
1670
|
}
|
|
1517
1671
|
static fromSuiParsedData(content) {
|
|
1518
1672
|
if (content.dataType !== "moveObject") {
|
|
1519
1673
|
throw new Error("not an object");
|
|
1520
1674
|
}
|
|
1521
|
-
if (!
|
|
1522
|
-
throw new Error(`object at ${content.fields.id} is not a
|
|
1675
|
+
if (!isLiquidateEvent(content.type)) {
|
|
1676
|
+
throw new Error(`object at ${content.fields.id} is not a LiquidateEvent object`);
|
|
1523
1677
|
}
|
|
1524
|
-
return
|
|
1678
|
+
return LiquidateEvent.fromFieldsWithTypes(content);
|
|
1525
1679
|
}
|
|
1526
1680
|
static fromSuiObjectData(data) {
|
|
1527
1681
|
if (data.bcs) {
|
|
1528
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
1529
|
-
|
|
1682
|
+
if (data.bcs.dataType !== "moveObject" ||
|
|
1683
|
+
!isLiquidateEvent(data.bcs.type)) {
|
|
1684
|
+
throw new Error(`object at is not a LiquidateEvent object`);
|
|
1530
1685
|
}
|
|
1531
|
-
return
|
|
1686
|
+
return LiquidateEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1532
1687
|
}
|
|
1533
1688
|
if (data.content) {
|
|
1534
|
-
return
|
|
1689
|
+
return LiquidateEvent.fromSuiParsedData(data.content);
|
|
1535
1690
|
}
|
|
1536
1691
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1537
1692
|
}
|
|
@@ -1540,25 +1695,26 @@ class MintEvent {
|
|
|
1540
1695
|
var _a, _b;
|
|
1541
1696
|
const res = yield client.getObject({ id, options: { showBcs: true } });
|
|
1542
1697
|
if (res.error) {
|
|
1543
|
-
throw new Error(`error fetching
|
|
1698
|
+
throw new Error(`error fetching LiquidateEvent object at id ${id}: ${res.error.code}`);
|
|
1544
1699
|
}
|
|
1545
1700
|
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1546
|
-
!
|
|
1547
|
-
throw new Error(`object at id ${id} is not a
|
|
1701
|
+
!isLiquidateEvent(res.data.bcs.type)) {
|
|
1702
|
+
throw new Error(`object at id ${id} is not a LiquidateEvent object`);
|
|
1548
1703
|
}
|
|
1549
|
-
return
|
|
1704
|
+
return LiquidateEvent.fromSuiObjectData(res.data);
|
|
1550
1705
|
});
|
|
1551
1706
|
}
|
|
1552
1707
|
}
|
|
1553
|
-
exports.
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1708
|
+
exports.LiquidateEvent = LiquidateEvent;
|
|
1709
|
+
LiquidateEvent.$typeName = `${index_1.PKG_V1}::lending_market::LiquidateEvent`;
|
|
1710
|
+
LiquidateEvent.$numTypeParams = 0;
|
|
1711
|
+
LiquidateEvent.$isPhantom = [];
|
|
1557
1712
|
/* ============================== ObligationOwnerCap =============================== */
|
|
1558
1713
|
function isObligationOwnerCap(type) {
|
|
1559
1714
|
type = (0, util_1.compressSuiType)(type);
|
|
1560
1715
|
return type.startsWith(`${index_1.PKG_V1}::lending_market::ObligationOwnerCap` + "<");
|
|
1561
1716
|
}
|
|
1717
|
+
exports.isObligationOwnerCap = isObligationOwnerCap;
|
|
1562
1718
|
class ObligationOwnerCap {
|
|
1563
1719
|
constructor(typeArgs, fields) {
|
|
1564
1720
|
this.__StructClass = true;
|
|
@@ -1702,6 +1858,7 @@ function isRateLimiterExemption(type) {
|
|
|
1702
1858
|
type = (0, util_1.compressSuiType)(type);
|
|
1703
1859
|
return type.startsWith(`${index_1.PKG_V1}::lending_market::RateLimiterExemption` + "<");
|
|
1704
1860
|
}
|
|
1861
|
+
exports.isRateLimiterExemption = isRateLimiterExemption;
|
|
1705
1862
|
class RateLimiterExemption {
|
|
1706
1863
|
constructor(typeArgs, fields) {
|
|
1707
1864
|
this.__StructClass = true;
|
|
@@ -1836,170 +1993,12 @@ exports.RateLimiterExemption = RateLimiterExemption;
|
|
|
1836
1993
|
RateLimiterExemption.$typeName = `${index_1.PKG_V1}::lending_market::RateLimiterExemption`;
|
|
1837
1994
|
RateLimiterExemption.$numTypeParams = 2;
|
|
1838
1995
|
RateLimiterExemption.$isPhantom = [true, true];
|
|
1839
|
-
/* ============================== RedeemEvent =============================== */
|
|
1840
|
-
function isRedeemEvent(type) {
|
|
1841
|
-
type = (0, util_1.compressSuiType)(type);
|
|
1842
|
-
return type === `${index_1.PKG_V1}::lending_market::RedeemEvent`;
|
|
1843
|
-
}
|
|
1844
|
-
class RedeemEvent {
|
|
1845
|
-
constructor(typeArgs, fields) {
|
|
1846
|
-
this.__StructClass = true;
|
|
1847
|
-
this.$typeName = RedeemEvent.$typeName;
|
|
1848
|
-
this.$isPhantom = RedeemEvent.$isPhantom;
|
|
1849
|
-
this.$fullTypeName = (0, util_1.composeSuiType)(RedeemEvent.$typeName, ...typeArgs);
|
|
1850
|
-
this.$typeArgs = typeArgs;
|
|
1851
|
-
this.lendingMarketId = fields.lendingMarketId;
|
|
1852
|
-
this.coinType = fields.coinType;
|
|
1853
|
-
this.reserveId = fields.reserveId;
|
|
1854
|
-
this.ctokenAmount = fields.ctokenAmount;
|
|
1855
|
-
this.liquidityAmount = fields.liquidityAmount;
|
|
1856
|
-
}
|
|
1857
|
-
static reified() {
|
|
1858
|
-
return {
|
|
1859
|
-
typeName: RedeemEvent.$typeName,
|
|
1860
|
-
fullTypeName: (0, util_1.composeSuiType)(RedeemEvent.$typeName, ...[]),
|
|
1861
|
-
typeArgs: [],
|
|
1862
|
-
isPhantom: RedeemEvent.$isPhantom,
|
|
1863
|
-
reifiedTypeArgs: [],
|
|
1864
|
-
fromFields: (fields) => RedeemEvent.fromFields(fields),
|
|
1865
|
-
fromFieldsWithTypes: (item) => RedeemEvent.fromFieldsWithTypes(item),
|
|
1866
|
-
fromBcs: (data) => RedeemEvent.fromBcs(data),
|
|
1867
|
-
bcs: RedeemEvent.bcs,
|
|
1868
|
-
fromJSONField: (field) => RedeemEvent.fromJSONField(field),
|
|
1869
|
-
fromJSON: (json) => RedeemEvent.fromJSON(json),
|
|
1870
|
-
fromSuiParsedData: (content) => RedeemEvent.fromSuiParsedData(content),
|
|
1871
|
-
fromSuiObjectData: (content) => RedeemEvent.fromSuiObjectData(content),
|
|
1872
|
-
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RedeemEvent.fetch(client, id); }),
|
|
1873
|
-
new: (fields) => {
|
|
1874
|
-
return new RedeemEvent([], fields);
|
|
1875
|
-
},
|
|
1876
|
-
kind: "StructClassReified",
|
|
1877
|
-
};
|
|
1878
|
-
}
|
|
1879
|
-
static get r() {
|
|
1880
|
-
return RedeemEvent.reified();
|
|
1881
|
-
}
|
|
1882
|
-
static phantom() {
|
|
1883
|
-
return (0, reified_1.phantom)(RedeemEvent.reified());
|
|
1884
|
-
}
|
|
1885
|
-
static get p() {
|
|
1886
|
-
return RedeemEvent.phantom();
|
|
1887
|
-
}
|
|
1888
|
-
static get bcs() {
|
|
1889
|
-
return bcs_1.bcs.struct("RedeemEvent", {
|
|
1890
|
-
lending_market_id: bcs_1.bcs
|
|
1891
|
-
.bytes(32)
|
|
1892
|
-
.transform({
|
|
1893
|
-
input: (val) => (0, utils_1.fromHEX)(val),
|
|
1894
|
-
output: (val) => (0, utils_1.toHEX)(val),
|
|
1895
|
-
}),
|
|
1896
|
-
coin_type: structs_1.TypeName.bcs,
|
|
1897
|
-
reserve_id: bcs_1.bcs
|
|
1898
|
-
.bytes(32)
|
|
1899
|
-
.transform({
|
|
1900
|
-
input: (val) => (0, utils_1.fromHEX)(val),
|
|
1901
|
-
output: (val) => (0, utils_1.toHEX)(val),
|
|
1902
|
-
}),
|
|
1903
|
-
ctoken_amount: bcs_1.bcs.u64(),
|
|
1904
|
-
liquidity_amount: bcs_1.bcs.u64(),
|
|
1905
|
-
});
|
|
1906
|
-
}
|
|
1907
|
-
static fromFields(fields) {
|
|
1908
|
-
return RedeemEvent.reified().new({
|
|
1909
|
-
lendingMarketId: (0, reified_1.decodeFromFields)("address", fields.lending_market_id),
|
|
1910
|
-
coinType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.coin_type),
|
|
1911
|
-
reserveId: (0, reified_1.decodeFromFields)("address", fields.reserve_id),
|
|
1912
|
-
ctokenAmount: (0, reified_1.decodeFromFields)("u64", fields.ctoken_amount),
|
|
1913
|
-
liquidityAmount: (0, reified_1.decodeFromFields)("u64", fields.liquidity_amount),
|
|
1914
|
-
});
|
|
1915
|
-
}
|
|
1916
|
-
static fromFieldsWithTypes(item) {
|
|
1917
|
-
if (!isRedeemEvent(item.type)) {
|
|
1918
|
-
throw new Error("not a RedeemEvent type");
|
|
1919
|
-
}
|
|
1920
|
-
return RedeemEvent.reified().new({
|
|
1921
|
-
lendingMarketId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.lending_market_id),
|
|
1922
|
-
coinType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.coin_type),
|
|
1923
|
-
reserveId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.reserve_id),
|
|
1924
|
-
ctokenAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.ctoken_amount),
|
|
1925
|
-
liquidityAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.liquidity_amount),
|
|
1926
|
-
});
|
|
1927
|
-
}
|
|
1928
|
-
static fromBcs(data) {
|
|
1929
|
-
return RedeemEvent.fromFields(RedeemEvent.bcs.parse(data));
|
|
1930
|
-
}
|
|
1931
|
-
toJSONField() {
|
|
1932
|
-
return {
|
|
1933
|
-
lendingMarketId: this.lendingMarketId,
|
|
1934
|
-
coinType: this.coinType.toJSONField(),
|
|
1935
|
-
reserveId: this.reserveId,
|
|
1936
|
-
ctokenAmount: this.ctokenAmount.toString(),
|
|
1937
|
-
liquidityAmount: this.liquidityAmount.toString(),
|
|
1938
|
-
};
|
|
1939
|
-
}
|
|
1940
|
-
toJSON() {
|
|
1941
|
-
return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
1942
|
-
}
|
|
1943
|
-
static fromJSONField(field) {
|
|
1944
|
-
return RedeemEvent.reified().new({
|
|
1945
|
-
lendingMarketId: (0, reified_1.decodeFromJSONField)("address", field.lendingMarketId),
|
|
1946
|
-
coinType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.coinType),
|
|
1947
|
-
reserveId: (0, reified_1.decodeFromJSONField)("address", field.reserveId),
|
|
1948
|
-
ctokenAmount: (0, reified_1.decodeFromJSONField)("u64", field.ctokenAmount),
|
|
1949
|
-
liquidityAmount: (0, reified_1.decodeFromJSONField)("u64", field.liquidityAmount),
|
|
1950
|
-
});
|
|
1951
|
-
}
|
|
1952
|
-
static fromJSON(json) {
|
|
1953
|
-
if (json.$typeName !== RedeemEvent.$typeName) {
|
|
1954
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
1955
|
-
}
|
|
1956
|
-
return RedeemEvent.fromJSONField(json);
|
|
1957
|
-
}
|
|
1958
|
-
static fromSuiParsedData(content) {
|
|
1959
|
-
if (content.dataType !== "moveObject") {
|
|
1960
|
-
throw new Error("not an object");
|
|
1961
|
-
}
|
|
1962
|
-
if (!isRedeemEvent(content.type)) {
|
|
1963
|
-
throw new Error(`object at ${content.fields.id} is not a RedeemEvent object`);
|
|
1964
|
-
}
|
|
1965
|
-
return RedeemEvent.fromFieldsWithTypes(content);
|
|
1966
|
-
}
|
|
1967
|
-
static fromSuiObjectData(data) {
|
|
1968
|
-
if (data.bcs) {
|
|
1969
|
-
if (data.bcs.dataType !== "moveObject" || !isRedeemEvent(data.bcs.type)) {
|
|
1970
|
-
throw new Error(`object at is not a RedeemEvent object`);
|
|
1971
|
-
}
|
|
1972
|
-
return RedeemEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1973
|
-
}
|
|
1974
|
-
if (data.content) {
|
|
1975
|
-
return RedeemEvent.fromSuiParsedData(data.content);
|
|
1976
|
-
}
|
|
1977
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1978
|
-
}
|
|
1979
|
-
static fetch(client, id) {
|
|
1980
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1981
|
-
var _a, _b;
|
|
1982
|
-
const res = yield client.getObject({ id, options: { showBcs: true } });
|
|
1983
|
-
if (res.error) {
|
|
1984
|
-
throw new Error(`error fetching RedeemEvent object at id ${id}: ${res.error.code}`);
|
|
1985
|
-
}
|
|
1986
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
1987
|
-
!isRedeemEvent(res.data.bcs.type)) {
|
|
1988
|
-
throw new Error(`object at id ${id} is not a RedeemEvent object`);
|
|
1989
|
-
}
|
|
1990
|
-
return RedeemEvent.fromSuiObjectData(res.data);
|
|
1991
|
-
});
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
exports.RedeemEvent = RedeemEvent;
|
|
1995
|
-
RedeemEvent.$typeName = `${index_1.PKG_V1}::lending_market::RedeemEvent`;
|
|
1996
|
-
RedeemEvent.$numTypeParams = 0;
|
|
1997
|
-
RedeemEvent.$isPhantom = [];
|
|
1998
1996
|
/* ============================== RepayEvent =============================== */
|
|
1999
1997
|
function isRepayEvent(type) {
|
|
2000
1998
|
type = (0, util_1.compressSuiType)(type);
|
|
2001
1999
|
return type === `${index_1.PKG_V1}::lending_market::RepayEvent`;
|
|
2002
2000
|
}
|
|
2001
|
+
exports.isRepayEvent = isRepayEvent;
|
|
2003
2002
|
class RepayEvent {
|
|
2004
2003
|
constructor(typeArgs, fields) {
|
|
2005
2004
|
this.__StructClass = true;
|
|
@@ -2164,6 +2163,7 @@ function isWithdrawEvent(type) {
|
|
|
2164
2163
|
type = (0, util_1.compressSuiType)(type);
|
|
2165
2164
|
return type === `${index_1.PKG_V1}::lending_market::WithdrawEvent`;
|
|
2166
2165
|
}
|
|
2166
|
+
exports.isWithdrawEvent = isWithdrawEvent;
|
|
2167
2167
|
class WithdrawEvent {
|
|
2168
2168
|
constructor(typeArgs, fields) {
|
|
2169
2169
|
this.__StructClass = true;
|