@typus/typus-perp-sdk 1.0.30 → 1.0.31
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/dist/src/fetch.d.ts +3 -0
- package/dist/src/fetch.js +3 -1
- package/dist/src/typus_perp/admin/functions.d.ts +25 -25
- package/dist/src/typus_perp/admin/functions.js +66 -53
- package/dist/src/typus_perp/admin/structs.d.ts +222 -222
- package/dist/src/typus_perp/admin/structs.js +256 -256
- package/dist/src/typus_perp/error/functions.d.ts +67 -67
- package/dist/src/typus_perp/error/functions.js +201 -134
- package/dist/src/typus_perp/escrow/functions.d.ts +3 -3
- package/dist/src/typus_perp/escrow/functions.js +9 -6
- package/dist/src/typus_perp/lending/functions.d.ts +15 -0
- package/dist/src/typus_perp/lending/functions.js +22 -0
- package/dist/src/typus_perp/lp-pool/functions.d.ts +102 -63
- package/dist/src/typus_perp/lp-pool/functions.js +243 -123
- package/dist/src/typus_perp/lp-pool/structs.d.ts +616 -348
- package/dist/src/typus_perp/lp-pool/structs.js +1202 -768
- package/dist/src/typus_perp/math/functions.d.ts +16 -5
- package/dist/src/typus_perp/math/functions.js +33 -12
- package/dist/src/typus_perp/position/functions.d.ts +86 -86
- package/dist/src/typus_perp/position/functions.js +223 -157
- package/dist/src/typus_perp/symbol/functions.d.ts +4 -4
- package/dist/src/typus_perp/symbol/functions.js +14 -10
- package/dist/src/typus_perp/tlp/functions.d.ts +5 -5
- package/dist/src/typus_perp/tlp/functions.js +17 -12
- package/dist/src/typus_perp/token-interface/functions.d.ts +2 -2
- package/dist/src/typus_perp/token-interface/functions.js +6 -4
- package/dist/src/typus_perp/trading/functions.d.ts +75 -75
- package/dist/src/typus_perp/trading/functions.js +189 -138
- package/dist/src/typus_perp/trading/structs.d.ts +6 -0
- package/dist/src/typus_perp/trading/structs.js +6 -0
- package/dist/src/typus_perp/treasury-caps/functions.d.ts +4 -4
- package/dist/src/typus_perp/treasury-caps/functions.js +14 -10
- package/package.json +2 -2
|
@@ -105,13 +105,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
105
105
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
106
106
|
};
|
|
107
107
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
108
|
-
exports.UpdateSpotConfigEvent = exports.UpdateMarginConfigEvent = exports.UpdateLiquidityValueEvent = exports.UpdateBorrowInfoEvent = exports.TokenPool = exports.SwapEvent = exports.SuspendTokenPoolEvent = exports.SuspendPoolEvent = exports.StartRemoveLiquidityTokenProcessEvent = exports.SpotConfig = exports.ResumeTokenPoolEvent = exports.ResumePoolEvent = exports.RemoveLiquidityTokenProcess = exports.NewLiquidityPoolEvent = exports.MintLpEvent = exports.MarginConfig = exports.ManagerFlashRepayLiquidityEvent = exports.ManagerFlashRemoveLiquidityEvent = exports.LiquidityPoolInfo = exports.LiquidityPool = exports.
|
|
109
|
-
exports.isConfig = isConfig;
|
|
110
|
-
exports.isState = isState;
|
|
111
|
-
exports.isRegistry = isRegistry;
|
|
108
|
+
exports.WithdrawLendingEvent = exports.UpdateSpotConfigEvent = exports.UpdateMarginConfigEvent = exports.UpdateLiquidityValueEvent = exports.UpdateBorrowInfoEvent = exports.TokenPool = exports.SwapEvent = exports.SuspendTokenPoolEvent = exports.SuspendPoolEvent = exports.State = exports.StartRemoveLiquidityTokenProcessEvent = exports.SpotConfig = exports.ResumeTokenPoolEvent = exports.ResumePoolEvent = exports.RemoveLiquidityTokenProcess = exports.Registry = exports.NewLiquidityPoolEvent = exports.MintLpEvent = exports.MarginConfig = exports.ManagerFlashRepayLiquidityEvent = exports.ManagerFlashRemoveLiquidityEvent = exports.LiquidityPoolInfo = exports.LiquidityPool = exports.DepositLendingEvent = exports.Config = exports.CompleteRemoveLiquidityTokenProcessEvent = exports.BurnLpEvent = exports.AddLiquidityTokenEvent = void 0;
|
|
112
109
|
exports.isAddLiquidityTokenEvent = isAddLiquidityTokenEvent;
|
|
113
110
|
exports.isBurnLpEvent = isBurnLpEvent;
|
|
114
111
|
exports.isCompleteRemoveLiquidityTokenProcessEvent = isCompleteRemoveLiquidityTokenProcessEvent;
|
|
112
|
+
exports.isConfig = isConfig;
|
|
113
|
+
exports.isDepositLendingEvent = isDepositLendingEvent;
|
|
115
114
|
exports.isLiquidityPool = isLiquidityPool;
|
|
116
115
|
exports.isLiquidityPoolInfo = isLiquidityPoolInfo;
|
|
117
116
|
exports.isManagerFlashRemoveLiquidityEvent = isManagerFlashRemoveLiquidityEvent;
|
|
@@ -119,11 +118,13 @@ exports.isManagerFlashRepayLiquidityEvent = isManagerFlashRepayLiquidityEvent;
|
|
|
119
118
|
exports.isMarginConfig = isMarginConfig;
|
|
120
119
|
exports.isMintLpEvent = isMintLpEvent;
|
|
121
120
|
exports.isNewLiquidityPoolEvent = isNewLiquidityPoolEvent;
|
|
121
|
+
exports.isRegistry = isRegistry;
|
|
122
122
|
exports.isRemoveLiquidityTokenProcess = isRemoveLiquidityTokenProcess;
|
|
123
123
|
exports.isResumePoolEvent = isResumePoolEvent;
|
|
124
124
|
exports.isResumeTokenPoolEvent = isResumeTokenPoolEvent;
|
|
125
125
|
exports.isSpotConfig = isSpotConfig;
|
|
126
126
|
exports.isStartRemoveLiquidityTokenProcessEvent = isStartRemoveLiquidityTokenProcessEvent;
|
|
127
|
+
exports.isState = isState;
|
|
127
128
|
exports.isSuspendPoolEvent = isSuspendPoolEvent;
|
|
128
129
|
exports.isSuspendTokenPoolEvent = isSuspendTokenPoolEvent;
|
|
129
130
|
exports.isSwapEvent = isSwapEvent;
|
|
@@ -132,6 +133,7 @@ exports.isUpdateBorrowInfoEvent = isUpdateBorrowInfoEvent;
|
|
|
132
133
|
exports.isUpdateLiquidityValueEvent = isUpdateLiquidityValueEvent;
|
|
133
134
|
exports.isUpdateMarginConfigEvent = isUpdateMarginConfigEvent;
|
|
134
135
|
exports.isUpdateSpotConfigEvent = isUpdateSpotConfigEvent;
|
|
136
|
+
exports.isWithdrawLendingEvent = isWithdrawLendingEvent;
|
|
135
137
|
var reified = __importStar(require("../../_framework/reified"));
|
|
136
138
|
var structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
|
|
137
139
|
var structs_2 = require("../../_dependencies/source/0x2/object/structs");
|
|
@@ -141,152 +143,158 @@ var structs_3 = require("../escrow/structs");
|
|
|
141
143
|
var index_1 = require("../index");
|
|
142
144
|
var bcs_1 = require("@mysten/sui/bcs");
|
|
143
145
|
var utils_1 = require("@mysten/sui/utils");
|
|
144
|
-
/* ==============================
|
|
145
|
-
function
|
|
146
|
+
/* ============================== AddLiquidityTokenEvent =============================== */
|
|
147
|
+
function isAddLiquidityTokenEvent(type) {
|
|
146
148
|
type = (0, util_1.compressSuiType)(type);
|
|
147
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
149
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::AddLiquidityTokenEvent");
|
|
148
150
|
}
|
|
149
|
-
var
|
|
150
|
-
function
|
|
151
|
+
var AddLiquidityTokenEvent = /** @class */ (function () {
|
|
152
|
+
function AddLiquidityTokenEvent(typeArgs, fields) {
|
|
151
153
|
this.__StructClass = true;
|
|
152
|
-
this.$typeName =
|
|
153
|
-
this.$isPhantom =
|
|
154
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
154
|
+
this.$typeName = AddLiquidityTokenEvent.$typeName;
|
|
155
|
+
this.$isPhantom = AddLiquidityTokenEvent.$isPhantom;
|
|
156
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([AddLiquidityTokenEvent.$typeName], __read(typeArgs), false));
|
|
155
157
|
this.$typeArgs = typeArgs;
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
158
|
-
this.
|
|
159
|
-
this.
|
|
158
|
+
this.sender = fields.sender;
|
|
159
|
+
this.index = fields.index;
|
|
160
|
+
this.tokenType = fields.tokenType;
|
|
161
|
+
this.config = fields.config;
|
|
162
|
+
this.state = fields.state;
|
|
160
163
|
this.u64Padding = fields.u64Padding;
|
|
161
164
|
}
|
|
162
|
-
|
|
165
|
+
AddLiquidityTokenEvent.reified = function () {
|
|
163
166
|
var _this = this;
|
|
164
167
|
return {
|
|
165
|
-
typeName:
|
|
166
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
168
|
+
typeName: AddLiquidityTokenEvent.$typeName,
|
|
169
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([AddLiquidityTokenEvent.$typeName], [], false)),
|
|
167
170
|
typeArgs: [],
|
|
168
|
-
isPhantom:
|
|
171
|
+
isPhantom: AddLiquidityTokenEvent.$isPhantom,
|
|
169
172
|
reifiedTypeArgs: [],
|
|
170
|
-
fromFields: function (fields) { return
|
|
171
|
-
fromFieldsWithTypes: function (item) { return
|
|
172
|
-
fromBcs: function (data) { return
|
|
173
|
-
bcs:
|
|
174
|
-
fromJSONField: function (field) { return
|
|
175
|
-
fromJSON: function (json) { return
|
|
176
|
-
fromSuiParsedData: function (content) { return
|
|
177
|
-
fromSuiObjectData: function (content) { return
|
|
173
|
+
fromFields: function (fields) { return AddLiquidityTokenEvent.fromFields(fields); },
|
|
174
|
+
fromFieldsWithTypes: function (item) { return AddLiquidityTokenEvent.fromFieldsWithTypes(item); },
|
|
175
|
+
fromBcs: function (data) { return AddLiquidityTokenEvent.fromBcs(data); },
|
|
176
|
+
bcs: AddLiquidityTokenEvent.bcs,
|
|
177
|
+
fromJSONField: function (field) { return AddLiquidityTokenEvent.fromJSONField(field); },
|
|
178
|
+
fromJSON: function (json) { return AddLiquidityTokenEvent.fromJSON(json); },
|
|
179
|
+
fromSuiParsedData: function (content) { return AddLiquidityTokenEvent.fromSuiParsedData(content); },
|
|
180
|
+
fromSuiObjectData: function (content) { return AddLiquidityTokenEvent.fromSuiObjectData(content); },
|
|
178
181
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
179
|
-
return [2 /*return*/,
|
|
182
|
+
return [2 /*return*/, AddLiquidityTokenEvent.fetch(client, id)];
|
|
180
183
|
}); }); },
|
|
181
184
|
new: function (fields) {
|
|
182
|
-
return new
|
|
185
|
+
return new AddLiquidityTokenEvent([], fields);
|
|
183
186
|
},
|
|
184
187
|
kind: "StructClassReified",
|
|
185
188
|
};
|
|
186
189
|
};
|
|
187
|
-
Object.defineProperty(
|
|
190
|
+
Object.defineProperty(AddLiquidityTokenEvent, "r", {
|
|
188
191
|
get: function () {
|
|
189
|
-
return
|
|
192
|
+
return AddLiquidityTokenEvent.reified();
|
|
190
193
|
},
|
|
191
194
|
enumerable: false,
|
|
192
195
|
configurable: true
|
|
193
196
|
});
|
|
194
|
-
|
|
195
|
-
return (0, reified_1.phantom)(
|
|
197
|
+
AddLiquidityTokenEvent.phantom = function () {
|
|
198
|
+
return (0, reified_1.phantom)(AddLiquidityTokenEvent.reified());
|
|
196
199
|
};
|
|
197
|
-
Object.defineProperty(
|
|
200
|
+
Object.defineProperty(AddLiquidityTokenEvent, "p", {
|
|
198
201
|
get: function () {
|
|
199
|
-
return
|
|
202
|
+
return AddLiquidityTokenEvent.phantom();
|
|
200
203
|
},
|
|
201
204
|
enumerable: false,
|
|
202
205
|
configurable: true
|
|
203
206
|
});
|
|
204
|
-
Object.defineProperty(
|
|
207
|
+
Object.defineProperty(AddLiquidityTokenEvent, "bcs", {
|
|
205
208
|
get: function () {
|
|
206
|
-
return bcs_1.bcs.struct("
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
return bcs_1.bcs.struct("AddLiquidityTokenEvent", {
|
|
210
|
+
sender: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
|
|
211
|
+
index: bcs_1.bcs.u64(),
|
|
212
|
+
token_type: structs_1.TypeName.bcs,
|
|
213
|
+
config: Config.bcs,
|
|
214
|
+
state: State.bcs,
|
|
211
215
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
212
216
|
});
|
|
213
217
|
},
|
|
214
218
|
enumerable: false,
|
|
215
219
|
configurable: true
|
|
216
220
|
});
|
|
217
|
-
|
|
218
|
-
return
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
AddLiquidityTokenEvent.fromFields = function (fields) {
|
|
222
|
+
return AddLiquidityTokenEvent.reified().new({
|
|
223
|
+
sender: (0, reified_1.decodeFromFields)("address", fields.sender),
|
|
224
|
+
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
225
|
+
tokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token_type),
|
|
226
|
+
config: (0, reified_1.decodeFromFields)(Config.reified(), fields.config),
|
|
227
|
+
state: (0, reified_1.decodeFromFields)(State.reified(), fields.state),
|
|
223
228
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
224
229
|
});
|
|
225
230
|
};
|
|
226
|
-
|
|
227
|
-
if (!
|
|
228
|
-
throw new Error("not a
|
|
231
|
+
AddLiquidityTokenEvent.fromFieldsWithTypes = function (item) {
|
|
232
|
+
if (!isAddLiquidityTokenEvent(item.type)) {
|
|
233
|
+
throw new Error("not a AddLiquidityTokenEvent type");
|
|
229
234
|
}
|
|
230
|
-
return
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
return AddLiquidityTokenEvent.reified().new({
|
|
236
|
+
sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
|
|
237
|
+
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
238
|
+
tokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token_type),
|
|
239
|
+
config: (0, reified_1.decodeFromFieldsWithTypes)(Config.reified(), item.fields.config),
|
|
240
|
+
state: (0, reified_1.decodeFromFieldsWithTypes)(State.reified(), item.fields.state),
|
|
235
241
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
236
242
|
});
|
|
237
243
|
};
|
|
238
|
-
|
|
239
|
-
return
|
|
244
|
+
AddLiquidityTokenEvent.fromBcs = function (data) {
|
|
245
|
+
return AddLiquidityTokenEvent.fromFields(AddLiquidityTokenEvent.bcs.parse(data));
|
|
240
246
|
};
|
|
241
|
-
|
|
247
|
+
AddLiquidityTokenEvent.prototype.toJSONField = function () {
|
|
242
248
|
return {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
249
|
+
sender: this.sender,
|
|
250
|
+
index: this.index.toString(),
|
|
251
|
+
tokenType: this.tokenType.toJSONField(),
|
|
252
|
+
config: this.config.toJSONField(),
|
|
253
|
+
state: this.state.toJSONField(),
|
|
247
254
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
248
255
|
};
|
|
249
256
|
};
|
|
250
|
-
|
|
257
|
+
AddLiquidityTokenEvent.prototype.toJSON = function () {
|
|
251
258
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
252
259
|
};
|
|
253
|
-
|
|
254
|
-
return
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
AddLiquidityTokenEvent.fromJSONField = function (field) {
|
|
261
|
+
return AddLiquidityTokenEvent.reified().new({
|
|
262
|
+
sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
|
|
263
|
+
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
264
|
+
tokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.tokenType),
|
|
265
|
+
config: (0, reified_1.decodeFromJSONField)(Config.reified(), field.config),
|
|
266
|
+
state: (0, reified_1.decodeFromJSONField)(State.reified(), field.state),
|
|
259
267
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
260
268
|
});
|
|
261
269
|
};
|
|
262
|
-
|
|
263
|
-
if (json.$typeName !==
|
|
270
|
+
AddLiquidityTokenEvent.fromJSON = function (json) {
|
|
271
|
+
if (json.$typeName !== AddLiquidityTokenEvent.$typeName) {
|
|
264
272
|
throw new Error("not a WithTwoGenerics json object");
|
|
265
273
|
}
|
|
266
|
-
return
|
|
274
|
+
return AddLiquidityTokenEvent.fromJSONField(json);
|
|
267
275
|
};
|
|
268
|
-
|
|
276
|
+
AddLiquidityTokenEvent.fromSuiParsedData = function (content) {
|
|
269
277
|
if (content.dataType !== "moveObject") {
|
|
270
278
|
throw new Error("not an object");
|
|
271
279
|
}
|
|
272
|
-
if (!
|
|
273
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
280
|
+
if (!isAddLiquidityTokenEvent(content.type)) {
|
|
281
|
+
throw new Error("object at ".concat(content.fields.id, " is not a AddLiquidityTokenEvent object"));
|
|
274
282
|
}
|
|
275
|
-
return
|
|
283
|
+
return AddLiquidityTokenEvent.fromFieldsWithTypes(content);
|
|
276
284
|
};
|
|
277
|
-
|
|
285
|
+
AddLiquidityTokenEvent.fromSuiObjectData = function (data) {
|
|
278
286
|
if (data.bcs) {
|
|
279
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
280
|
-
throw new Error("object at is not a
|
|
287
|
+
if (data.bcs.dataType !== "moveObject" || !isAddLiquidityTokenEvent(data.bcs.type)) {
|
|
288
|
+
throw new Error("object at is not a AddLiquidityTokenEvent object");
|
|
281
289
|
}
|
|
282
|
-
return
|
|
290
|
+
return AddLiquidityTokenEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
283
291
|
}
|
|
284
292
|
if (data.content) {
|
|
285
|
-
return
|
|
293
|
+
return AddLiquidityTokenEvent.fromSuiParsedData(data.content);
|
|
286
294
|
}
|
|
287
295
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
288
296
|
};
|
|
289
|
-
|
|
297
|
+
AddLiquidityTokenEvent.fetch = function (client, id) {
|
|
290
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
291
299
|
var res;
|
|
292
300
|
var _a, _b;
|
|
@@ -296,363 +304,192 @@ var Config = /** @class */ (function () {
|
|
|
296
304
|
case 1:
|
|
297
305
|
res = _c.sent();
|
|
298
306
|
if (res.error) {
|
|
299
|
-
throw new Error("error fetching
|
|
307
|
+
throw new Error("error fetching AddLiquidityTokenEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
300
308
|
}
|
|
301
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
302
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
309
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isAddLiquidityTokenEvent(res.data.bcs.type)) {
|
|
310
|
+
throw new Error("object at id ".concat(id, " is not a AddLiquidityTokenEvent object"));
|
|
303
311
|
}
|
|
304
|
-
return [2 /*return*/,
|
|
312
|
+
return [2 /*return*/, AddLiquidityTokenEvent.fromSuiObjectData(res.data)];
|
|
305
313
|
}
|
|
306
314
|
});
|
|
307
315
|
});
|
|
308
316
|
};
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return
|
|
317
|
+
AddLiquidityTokenEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::AddLiquidityTokenEvent");
|
|
318
|
+
AddLiquidityTokenEvent.$numTypeParams = 0;
|
|
319
|
+
AddLiquidityTokenEvent.$isPhantom = [];
|
|
320
|
+
return AddLiquidityTokenEvent;
|
|
313
321
|
}());
|
|
314
|
-
exports.
|
|
315
|
-
/* ==============================
|
|
316
|
-
function
|
|
322
|
+
exports.AddLiquidityTokenEvent = AddLiquidityTokenEvent;
|
|
323
|
+
/* ============================== BurnLpEvent =============================== */
|
|
324
|
+
function isBurnLpEvent(type) {
|
|
317
325
|
type = (0, util_1.compressSuiType)(type);
|
|
318
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
326
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::BurnLpEvent");
|
|
319
327
|
}
|
|
320
|
-
var
|
|
321
|
-
function
|
|
328
|
+
var BurnLpEvent = /** @class */ (function () {
|
|
329
|
+
function BurnLpEvent(typeArgs, fields) {
|
|
322
330
|
this.__StructClass = true;
|
|
323
|
-
this.$typeName =
|
|
324
|
-
this.$isPhantom =
|
|
325
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
331
|
+
this.$typeName = BurnLpEvent.$typeName;
|
|
332
|
+
this.$isPhantom = BurnLpEvent.$isPhantom;
|
|
333
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([BurnLpEvent.$typeName], __read(typeArgs), false));
|
|
326
334
|
this.$typeArgs = typeArgs;
|
|
327
|
-
this.
|
|
328
|
-
this.
|
|
329
|
-
this.
|
|
330
|
-
this.
|
|
331
|
-
this.
|
|
332
|
-
this.
|
|
333
|
-
this.
|
|
334
|
-
this.
|
|
335
|
-
this.previousCumulativeBorrowRate = fields.previousCumulativeBorrowRate;
|
|
336
|
-
this.currentLendingAmount = fields.currentLendingAmount;
|
|
335
|
+
this.sender = fields.sender;
|
|
336
|
+
this.index = fields.index;
|
|
337
|
+
this.lpTokenType = fields.lpTokenType;
|
|
338
|
+
this.burnLpAmount = fields.burnLpAmount;
|
|
339
|
+
this.burnAmountUsd = fields.burnAmountUsd;
|
|
340
|
+
this.burnFeeUsd = fields.burnFeeUsd;
|
|
341
|
+
this.liquidityTokenType = fields.liquidityTokenType;
|
|
342
|
+
this.withdrawTokenAmount = fields.withdrawTokenAmount;
|
|
337
343
|
this.u64Padding = fields.u64Padding;
|
|
338
344
|
}
|
|
339
|
-
|
|
345
|
+
BurnLpEvent.reified = function () {
|
|
340
346
|
var _this = this;
|
|
341
347
|
return {
|
|
342
|
-
typeName:
|
|
343
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
348
|
+
typeName: BurnLpEvent.$typeName,
|
|
349
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([BurnLpEvent.$typeName], [], false)),
|
|
344
350
|
typeArgs: [],
|
|
345
|
-
isPhantom:
|
|
351
|
+
isPhantom: BurnLpEvent.$isPhantom,
|
|
346
352
|
reifiedTypeArgs: [],
|
|
347
|
-
fromFields: function (fields) { return
|
|
348
|
-
fromFieldsWithTypes: function (item) { return
|
|
349
|
-
fromBcs: function (data) { return
|
|
350
|
-
bcs:
|
|
351
|
-
fromJSONField: function (field) { return
|
|
352
|
-
fromJSON: function (json) { return
|
|
353
|
-
fromSuiParsedData: function (content) { return
|
|
354
|
-
fromSuiObjectData: function (content) { return
|
|
353
|
+
fromFields: function (fields) { return BurnLpEvent.fromFields(fields); },
|
|
354
|
+
fromFieldsWithTypes: function (item) { return BurnLpEvent.fromFieldsWithTypes(item); },
|
|
355
|
+
fromBcs: function (data) { return BurnLpEvent.fromBcs(data); },
|
|
356
|
+
bcs: BurnLpEvent.bcs,
|
|
357
|
+
fromJSONField: function (field) { return BurnLpEvent.fromJSONField(field); },
|
|
358
|
+
fromJSON: function (json) { return BurnLpEvent.fromJSON(json); },
|
|
359
|
+
fromSuiParsedData: function (content) { return BurnLpEvent.fromSuiParsedData(content); },
|
|
360
|
+
fromSuiObjectData: function (content) { return BurnLpEvent.fromSuiObjectData(content); },
|
|
355
361
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
356
|
-
return [2 /*return*/,
|
|
362
|
+
return [2 /*return*/, BurnLpEvent.fetch(client, id)];
|
|
357
363
|
}); }); },
|
|
358
364
|
new: function (fields) {
|
|
359
|
-
return new
|
|
365
|
+
return new BurnLpEvent([], fields);
|
|
360
366
|
},
|
|
361
367
|
kind: "StructClassReified",
|
|
362
368
|
};
|
|
363
369
|
};
|
|
364
|
-
Object.defineProperty(
|
|
370
|
+
Object.defineProperty(BurnLpEvent, "r", {
|
|
365
371
|
get: function () {
|
|
366
|
-
return
|
|
372
|
+
return BurnLpEvent.reified();
|
|
367
373
|
},
|
|
368
374
|
enumerable: false,
|
|
369
375
|
configurable: true
|
|
370
376
|
});
|
|
371
|
-
|
|
372
|
-
return (0, reified_1.phantom)(
|
|
377
|
+
BurnLpEvent.phantom = function () {
|
|
378
|
+
return (0, reified_1.phantom)(BurnLpEvent.reified());
|
|
373
379
|
};
|
|
374
|
-
Object.defineProperty(
|
|
380
|
+
Object.defineProperty(BurnLpEvent, "p", {
|
|
375
381
|
get: function () {
|
|
376
|
-
return
|
|
382
|
+
return BurnLpEvent.phantom();
|
|
377
383
|
},
|
|
378
384
|
enumerable: false,
|
|
379
385
|
configurable: true
|
|
380
386
|
});
|
|
381
|
-
Object.defineProperty(
|
|
387
|
+
Object.defineProperty(BurnLpEvent, "bcs", {
|
|
382
388
|
get: function () {
|
|
383
|
-
return bcs_1.bcs.struct("
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
previous_cumulative_borrow_rate: bcs_1.bcs.u64(),
|
|
393
|
-
current_lending_amount: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
389
|
+
return bcs_1.bcs.struct("BurnLpEvent", {
|
|
390
|
+
sender: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
|
|
391
|
+
index: bcs_1.bcs.u64(),
|
|
392
|
+
lp_token_type: structs_1.TypeName.bcs,
|
|
393
|
+
burn_lp_amount: bcs_1.bcs.u64(),
|
|
394
|
+
burn_amount_usd: bcs_1.bcs.u64(),
|
|
395
|
+
burn_fee_usd: bcs_1.bcs.u64(),
|
|
396
|
+
liquidity_token_type: structs_1.TypeName.bcs,
|
|
397
|
+
withdraw_token_amount: bcs_1.bcs.u64(),
|
|
394
398
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
395
399
|
});
|
|
396
400
|
},
|
|
397
401
|
enumerable: false,
|
|
398
402
|
configurable: true
|
|
399
403
|
});
|
|
400
|
-
|
|
401
|
-
return
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
previousCumulativeBorrowRate: (0, reified_1.decodeFromFields)("u64", fields.previous_cumulative_borrow_rate),
|
|
411
|
-
currentLendingAmount: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.current_lending_amount),
|
|
404
|
+
BurnLpEvent.fromFields = function (fields) {
|
|
405
|
+
return BurnLpEvent.reified().new({
|
|
406
|
+
sender: (0, reified_1.decodeFromFields)("address", fields.sender),
|
|
407
|
+
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
408
|
+
lpTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.lp_token_type),
|
|
409
|
+
burnLpAmount: (0, reified_1.decodeFromFields)("u64", fields.burn_lp_amount),
|
|
410
|
+
burnAmountUsd: (0, reified_1.decodeFromFields)("u64", fields.burn_amount_usd),
|
|
411
|
+
burnFeeUsd: (0, reified_1.decodeFromFields)("u64", fields.burn_fee_usd),
|
|
412
|
+
liquidityTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.liquidity_token_type),
|
|
413
|
+
withdrawTokenAmount: (0, reified_1.decodeFromFields)("u64", fields.withdraw_token_amount),
|
|
412
414
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
413
415
|
});
|
|
414
416
|
};
|
|
415
|
-
|
|
416
|
-
if (!
|
|
417
|
-
throw new Error("not a
|
|
417
|
+
BurnLpEvent.fromFieldsWithTypes = function (item) {
|
|
418
|
+
if (!isBurnLpEvent(item.type)) {
|
|
419
|
+
throw new Error("not a BurnLpEvent type");
|
|
418
420
|
}
|
|
419
|
-
return
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
previousCumulativeBorrowRate: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.previous_cumulative_borrow_rate),
|
|
429
|
-
currentLendingAmount: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.current_lending_amount),
|
|
421
|
+
return BurnLpEvent.reified().new({
|
|
422
|
+
sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
|
|
423
|
+
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
424
|
+
lpTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.lp_token_type),
|
|
425
|
+
burnLpAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.burn_lp_amount),
|
|
426
|
+
burnAmountUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.burn_amount_usd),
|
|
427
|
+
burnFeeUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.burn_fee_usd),
|
|
428
|
+
liquidityTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.liquidity_token_type),
|
|
429
|
+
withdrawTokenAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.withdraw_token_amount),
|
|
430
430
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
431
431
|
});
|
|
432
432
|
};
|
|
433
|
-
|
|
434
|
-
return
|
|
433
|
+
BurnLpEvent.fromBcs = function (data) {
|
|
434
|
+
return BurnLpEvent.fromFields(BurnLpEvent.bcs.parse(data));
|
|
435
435
|
};
|
|
436
|
-
|
|
436
|
+
BurnLpEvent.prototype.toJSONField = function () {
|
|
437
437
|
return {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
previousCumulativeBorrowRate: this.previousCumulativeBorrowRate.toString(),
|
|
447
|
-
currentLendingAmount: (0, reified_1.fieldToJSON)("vector<u64>", this.currentLendingAmount),
|
|
438
|
+
sender: this.sender,
|
|
439
|
+
index: this.index.toString(),
|
|
440
|
+
lpTokenType: this.lpTokenType.toJSONField(),
|
|
441
|
+
burnLpAmount: this.burnLpAmount.toString(),
|
|
442
|
+
burnAmountUsd: this.burnAmountUsd.toString(),
|
|
443
|
+
burnFeeUsd: this.burnFeeUsd.toString(),
|
|
444
|
+
liquidityTokenType: this.liquidityTokenType.toJSONField(),
|
|
445
|
+
withdrawTokenAmount: this.withdrawTokenAmount.toString(),
|
|
448
446
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
449
447
|
};
|
|
450
448
|
};
|
|
451
|
-
|
|
449
|
+
BurnLpEvent.prototype.toJSON = function () {
|
|
452
450
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
453
451
|
};
|
|
454
|
-
|
|
455
|
-
return
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
previousCumulativeBorrowRate: (0, reified_1.decodeFromJSONField)("u64", field.previousCumulativeBorrowRate),
|
|
465
|
-
currentLendingAmount: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.currentLendingAmount),
|
|
452
|
+
BurnLpEvent.fromJSONField = function (field) {
|
|
453
|
+
return BurnLpEvent.reified().new({
|
|
454
|
+
sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
|
|
455
|
+
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
456
|
+
lpTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.lpTokenType),
|
|
457
|
+
burnLpAmount: (0, reified_1.decodeFromJSONField)("u64", field.burnLpAmount),
|
|
458
|
+
burnAmountUsd: (0, reified_1.decodeFromJSONField)("u64", field.burnAmountUsd),
|
|
459
|
+
burnFeeUsd: (0, reified_1.decodeFromJSONField)("u64", field.burnFeeUsd),
|
|
460
|
+
liquidityTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.liquidityTokenType),
|
|
461
|
+
withdrawTokenAmount: (0, reified_1.decodeFromJSONField)("u64", field.withdrawTokenAmount),
|
|
466
462
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
467
463
|
});
|
|
468
464
|
};
|
|
469
|
-
|
|
470
|
-
if (json.$typeName !==
|
|
471
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
472
|
-
}
|
|
473
|
-
return State.fromJSONField(json);
|
|
474
|
-
};
|
|
475
|
-
State.fromSuiParsedData = function (content) {
|
|
476
|
-
if (content.dataType !== "moveObject") {
|
|
477
|
-
throw new Error("not an object");
|
|
478
|
-
}
|
|
479
|
-
if (!isState(content.type)) {
|
|
480
|
-
throw new Error("object at ".concat(content.fields.id, " is not a State object"));
|
|
481
|
-
}
|
|
482
|
-
return State.fromFieldsWithTypes(content);
|
|
483
|
-
};
|
|
484
|
-
State.fromSuiObjectData = function (data) {
|
|
485
|
-
if (data.bcs) {
|
|
486
|
-
if (data.bcs.dataType !== "moveObject" || !isState(data.bcs.type)) {
|
|
487
|
-
throw new Error("object at is not a State object");
|
|
488
|
-
}
|
|
489
|
-
return State.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
490
|
-
}
|
|
491
|
-
if (data.content) {
|
|
492
|
-
return State.fromSuiParsedData(data.content);
|
|
493
|
-
}
|
|
494
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
495
|
-
};
|
|
496
|
-
State.fetch = function (client, id) {
|
|
497
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
498
|
-
var res;
|
|
499
|
-
var _a, _b;
|
|
500
|
-
return __generator(this, function (_c) {
|
|
501
|
-
switch (_c.label) {
|
|
502
|
-
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
503
|
-
case 1:
|
|
504
|
-
res = _c.sent();
|
|
505
|
-
if (res.error) {
|
|
506
|
-
throw new Error("error fetching State object at id ".concat(id, ": ").concat(res.error.code));
|
|
507
|
-
}
|
|
508
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isState(res.data.bcs.type)) {
|
|
509
|
-
throw new Error("object at id ".concat(id, " is not a State object"));
|
|
510
|
-
}
|
|
511
|
-
return [2 /*return*/, State.fromSuiObjectData(res.data)];
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
State.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::State");
|
|
517
|
-
State.$numTypeParams = 0;
|
|
518
|
-
State.$isPhantom = [];
|
|
519
|
-
return State;
|
|
520
|
-
}());
|
|
521
|
-
exports.State = State;
|
|
522
|
-
/* ============================== Registry =============================== */
|
|
523
|
-
function isRegistry(type) {
|
|
524
|
-
type = (0, util_1.compressSuiType)(type);
|
|
525
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::Registry");
|
|
526
|
-
}
|
|
527
|
-
var Registry = /** @class */ (function () {
|
|
528
|
-
function Registry(typeArgs, fields) {
|
|
529
|
-
this.__StructClass = true;
|
|
530
|
-
this.$typeName = Registry.$typeName;
|
|
531
|
-
this.$isPhantom = Registry.$isPhantom;
|
|
532
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Registry.$typeName], __read(typeArgs), false));
|
|
533
|
-
this.$typeArgs = typeArgs;
|
|
534
|
-
this.id = fields.id;
|
|
535
|
-
this.numPool = fields.numPool;
|
|
536
|
-
this.liquidityPoolRegistry = fields.liquidityPoolRegistry;
|
|
537
|
-
}
|
|
538
|
-
Registry.reified = function () {
|
|
539
|
-
var _this = this;
|
|
540
|
-
return {
|
|
541
|
-
typeName: Registry.$typeName,
|
|
542
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Registry.$typeName], [], false)),
|
|
543
|
-
typeArgs: [],
|
|
544
|
-
isPhantom: Registry.$isPhantom,
|
|
545
|
-
reifiedTypeArgs: [],
|
|
546
|
-
fromFields: function (fields) { return Registry.fromFields(fields); },
|
|
547
|
-
fromFieldsWithTypes: function (item) { return Registry.fromFieldsWithTypes(item); },
|
|
548
|
-
fromBcs: function (data) { return Registry.fromBcs(data); },
|
|
549
|
-
bcs: Registry.bcs,
|
|
550
|
-
fromJSONField: function (field) { return Registry.fromJSONField(field); },
|
|
551
|
-
fromJSON: function (json) { return Registry.fromJSON(json); },
|
|
552
|
-
fromSuiParsedData: function (content) { return Registry.fromSuiParsedData(content); },
|
|
553
|
-
fromSuiObjectData: function (content) { return Registry.fromSuiObjectData(content); },
|
|
554
|
-
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
555
|
-
return [2 /*return*/, Registry.fetch(client, id)];
|
|
556
|
-
}); }); },
|
|
557
|
-
new: function (fields) {
|
|
558
|
-
return new Registry([], fields);
|
|
559
|
-
},
|
|
560
|
-
kind: "StructClassReified",
|
|
561
|
-
};
|
|
562
|
-
};
|
|
563
|
-
Object.defineProperty(Registry, "r", {
|
|
564
|
-
get: function () {
|
|
565
|
-
return Registry.reified();
|
|
566
|
-
},
|
|
567
|
-
enumerable: false,
|
|
568
|
-
configurable: true
|
|
569
|
-
});
|
|
570
|
-
Registry.phantom = function () {
|
|
571
|
-
return (0, reified_1.phantom)(Registry.reified());
|
|
572
|
-
};
|
|
573
|
-
Object.defineProperty(Registry, "p", {
|
|
574
|
-
get: function () {
|
|
575
|
-
return Registry.phantom();
|
|
576
|
-
},
|
|
577
|
-
enumerable: false,
|
|
578
|
-
configurable: true
|
|
579
|
-
});
|
|
580
|
-
Object.defineProperty(Registry, "bcs", {
|
|
581
|
-
get: function () {
|
|
582
|
-
return bcs_1.bcs.struct("Registry", {
|
|
583
|
-
id: structs_2.UID.bcs,
|
|
584
|
-
num_pool: bcs_1.bcs.u64(),
|
|
585
|
-
liquidity_pool_registry: structs_2.UID.bcs,
|
|
586
|
-
});
|
|
587
|
-
},
|
|
588
|
-
enumerable: false,
|
|
589
|
-
configurable: true
|
|
590
|
-
});
|
|
591
|
-
Registry.fromFields = function (fields) {
|
|
592
|
-
return Registry.reified().new({
|
|
593
|
-
id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
|
|
594
|
-
numPool: (0, reified_1.decodeFromFields)("u64", fields.num_pool),
|
|
595
|
-
liquidityPoolRegistry: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.liquidity_pool_registry),
|
|
596
|
-
});
|
|
597
|
-
};
|
|
598
|
-
Registry.fromFieldsWithTypes = function (item) {
|
|
599
|
-
if (!isRegistry(item.type)) {
|
|
600
|
-
throw new Error("not a Registry type");
|
|
601
|
-
}
|
|
602
|
-
return Registry.reified().new({
|
|
603
|
-
id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
|
|
604
|
-
numPool: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.num_pool),
|
|
605
|
-
liquidityPoolRegistry: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.liquidity_pool_registry),
|
|
606
|
-
});
|
|
607
|
-
};
|
|
608
|
-
Registry.fromBcs = function (data) {
|
|
609
|
-
return Registry.fromFields(Registry.bcs.parse(data));
|
|
610
|
-
};
|
|
611
|
-
Registry.prototype.toJSONField = function () {
|
|
612
|
-
return {
|
|
613
|
-
id: this.id,
|
|
614
|
-
numPool: this.numPool.toString(),
|
|
615
|
-
liquidityPoolRegistry: this.liquidityPoolRegistry,
|
|
616
|
-
};
|
|
617
|
-
};
|
|
618
|
-
Registry.prototype.toJSON = function () {
|
|
619
|
-
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
620
|
-
};
|
|
621
|
-
Registry.fromJSONField = function (field) {
|
|
622
|
-
return Registry.reified().new({
|
|
623
|
-
id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
|
|
624
|
-
numPool: (0, reified_1.decodeFromJSONField)("u64", field.numPool),
|
|
625
|
-
liquidityPoolRegistry: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.liquidityPoolRegistry),
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
Registry.fromJSON = function (json) {
|
|
629
|
-
if (json.$typeName !== Registry.$typeName) {
|
|
465
|
+
BurnLpEvent.fromJSON = function (json) {
|
|
466
|
+
if (json.$typeName !== BurnLpEvent.$typeName) {
|
|
630
467
|
throw new Error("not a WithTwoGenerics json object");
|
|
631
468
|
}
|
|
632
|
-
return
|
|
469
|
+
return BurnLpEvent.fromJSONField(json);
|
|
633
470
|
};
|
|
634
|
-
|
|
471
|
+
BurnLpEvent.fromSuiParsedData = function (content) {
|
|
635
472
|
if (content.dataType !== "moveObject") {
|
|
636
473
|
throw new Error("not an object");
|
|
637
474
|
}
|
|
638
|
-
if (!
|
|
639
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
475
|
+
if (!isBurnLpEvent(content.type)) {
|
|
476
|
+
throw new Error("object at ".concat(content.fields.id, " is not a BurnLpEvent object"));
|
|
640
477
|
}
|
|
641
|
-
return
|
|
478
|
+
return BurnLpEvent.fromFieldsWithTypes(content);
|
|
642
479
|
};
|
|
643
|
-
|
|
480
|
+
BurnLpEvent.fromSuiObjectData = function (data) {
|
|
644
481
|
if (data.bcs) {
|
|
645
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
646
|
-
throw new Error("object at is not a
|
|
482
|
+
if (data.bcs.dataType !== "moveObject" || !isBurnLpEvent(data.bcs.type)) {
|
|
483
|
+
throw new Error("object at is not a BurnLpEvent object");
|
|
647
484
|
}
|
|
648
|
-
return
|
|
485
|
+
return BurnLpEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
649
486
|
}
|
|
650
487
|
if (data.content) {
|
|
651
|
-
return
|
|
488
|
+
return BurnLpEvent.fromSuiParsedData(data.content);
|
|
652
489
|
}
|
|
653
490
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
654
491
|
};
|
|
655
|
-
|
|
492
|
+
BurnLpEvent.fetch = function (client, id) {
|
|
656
493
|
return __awaiter(this, void 0, void 0, function () {
|
|
657
494
|
var res;
|
|
658
495
|
var _a, _b;
|
|
@@ -662,174 +499,168 @@ var Registry = /** @class */ (function () {
|
|
|
662
499
|
case 1:
|
|
663
500
|
res = _c.sent();
|
|
664
501
|
if (res.error) {
|
|
665
|
-
throw new Error("error fetching
|
|
502
|
+
throw new Error("error fetching BurnLpEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
666
503
|
}
|
|
667
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
668
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
504
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isBurnLpEvent(res.data.bcs.type)) {
|
|
505
|
+
throw new Error("object at id ".concat(id, " is not a BurnLpEvent object"));
|
|
669
506
|
}
|
|
670
|
-
return [2 /*return*/,
|
|
507
|
+
return [2 /*return*/, BurnLpEvent.fromSuiObjectData(res.data)];
|
|
671
508
|
}
|
|
672
509
|
});
|
|
673
510
|
});
|
|
674
511
|
};
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
return
|
|
512
|
+
BurnLpEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::BurnLpEvent");
|
|
513
|
+
BurnLpEvent.$numTypeParams = 0;
|
|
514
|
+
BurnLpEvent.$isPhantom = [];
|
|
515
|
+
return BurnLpEvent;
|
|
679
516
|
}());
|
|
680
|
-
exports.
|
|
681
|
-
/* ==============================
|
|
682
|
-
function
|
|
517
|
+
exports.BurnLpEvent = BurnLpEvent;
|
|
518
|
+
/* ============================== CompleteRemoveLiquidityTokenProcessEvent =============================== */
|
|
519
|
+
function isCompleteRemoveLiquidityTokenProcessEvent(type) {
|
|
683
520
|
type = (0, util_1.compressSuiType)(type);
|
|
684
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
521
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::CompleteRemoveLiquidityTokenProcessEvent");
|
|
685
522
|
}
|
|
686
|
-
var
|
|
687
|
-
function
|
|
523
|
+
var CompleteRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
524
|
+
function CompleteRemoveLiquidityTokenProcessEvent(typeArgs, fields) {
|
|
688
525
|
this.__StructClass = true;
|
|
689
|
-
this.$typeName =
|
|
690
|
-
this.$isPhantom =
|
|
691
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
526
|
+
this.$typeName = CompleteRemoveLiquidityTokenProcessEvent.$typeName;
|
|
527
|
+
this.$isPhantom = CompleteRemoveLiquidityTokenProcessEvent.$isPhantom;
|
|
528
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([CompleteRemoveLiquidityTokenProcessEvent.$typeName], __read(typeArgs), false));
|
|
692
529
|
this.$typeArgs = typeArgs;
|
|
693
|
-
this.sender = fields.sender;
|
|
694
530
|
this.index = fields.index;
|
|
695
|
-
this.
|
|
696
|
-
this.
|
|
697
|
-
this.
|
|
531
|
+
this.liquidityToken = fields.liquidityToken;
|
|
532
|
+
this.removedUsd = fields.removedUsd;
|
|
533
|
+
this.repaidUsd = fields.repaidUsd;
|
|
698
534
|
this.u64Padding = fields.u64Padding;
|
|
699
535
|
}
|
|
700
|
-
|
|
536
|
+
CompleteRemoveLiquidityTokenProcessEvent.reified = function () {
|
|
701
537
|
var _this = this;
|
|
702
538
|
return {
|
|
703
|
-
typeName:
|
|
704
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
539
|
+
typeName: CompleteRemoveLiquidityTokenProcessEvent.$typeName,
|
|
540
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([CompleteRemoveLiquidityTokenProcessEvent.$typeName], [], false)),
|
|
705
541
|
typeArgs: [],
|
|
706
|
-
isPhantom:
|
|
542
|
+
isPhantom: CompleteRemoveLiquidityTokenProcessEvent.$isPhantom,
|
|
707
543
|
reifiedTypeArgs: [],
|
|
708
|
-
fromFields: function (fields) { return
|
|
709
|
-
fromFieldsWithTypes: function (item) { return
|
|
710
|
-
fromBcs: function (data) { return
|
|
711
|
-
bcs:
|
|
712
|
-
fromJSONField: function (field) { return
|
|
713
|
-
fromJSON: function (json) { return
|
|
714
|
-
fromSuiParsedData: function (content) { return
|
|
715
|
-
fromSuiObjectData: function (content) { return
|
|
544
|
+
fromFields: function (fields) { return CompleteRemoveLiquidityTokenProcessEvent.fromFields(fields); },
|
|
545
|
+
fromFieldsWithTypes: function (item) { return CompleteRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes(item); },
|
|
546
|
+
fromBcs: function (data) { return CompleteRemoveLiquidityTokenProcessEvent.fromBcs(data); },
|
|
547
|
+
bcs: CompleteRemoveLiquidityTokenProcessEvent.bcs,
|
|
548
|
+
fromJSONField: function (field) { return CompleteRemoveLiquidityTokenProcessEvent.fromJSONField(field); },
|
|
549
|
+
fromJSON: function (json) { return CompleteRemoveLiquidityTokenProcessEvent.fromJSON(json); },
|
|
550
|
+
fromSuiParsedData: function (content) { return CompleteRemoveLiquidityTokenProcessEvent.fromSuiParsedData(content); },
|
|
551
|
+
fromSuiObjectData: function (content) { return CompleteRemoveLiquidityTokenProcessEvent.fromSuiObjectData(content); },
|
|
716
552
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
717
|
-
return [2 /*return*/,
|
|
553
|
+
return [2 /*return*/, CompleteRemoveLiquidityTokenProcessEvent.fetch(client, id)];
|
|
718
554
|
}); }); },
|
|
719
555
|
new: function (fields) {
|
|
720
|
-
return new
|
|
556
|
+
return new CompleteRemoveLiquidityTokenProcessEvent([], fields);
|
|
721
557
|
},
|
|
722
558
|
kind: "StructClassReified",
|
|
723
559
|
};
|
|
724
560
|
};
|
|
725
|
-
Object.defineProperty(
|
|
561
|
+
Object.defineProperty(CompleteRemoveLiquidityTokenProcessEvent, "r", {
|
|
726
562
|
get: function () {
|
|
727
|
-
return
|
|
563
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified();
|
|
728
564
|
},
|
|
729
565
|
enumerable: false,
|
|
730
566
|
configurable: true
|
|
731
567
|
});
|
|
732
|
-
|
|
733
|
-
return (0, reified_1.phantom)(
|
|
568
|
+
CompleteRemoveLiquidityTokenProcessEvent.phantom = function () {
|
|
569
|
+
return (0, reified_1.phantom)(CompleteRemoveLiquidityTokenProcessEvent.reified());
|
|
734
570
|
};
|
|
735
|
-
Object.defineProperty(
|
|
571
|
+
Object.defineProperty(CompleteRemoveLiquidityTokenProcessEvent, "p", {
|
|
736
572
|
get: function () {
|
|
737
|
-
return
|
|
573
|
+
return CompleteRemoveLiquidityTokenProcessEvent.phantom();
|
|
738
574
|
},
|
|
739
575
|
enumerable: false,
|
|
740
576
|
configurable: true
|
|
741
577
|
});
|
|
742
|
-
Object.defineProperty(
|
|
578
|
+
Object.defineProperty(CompleteRemoveLiquidityTokenProcessEvent, "bcs", {
|
|
743
579
|
get: function () {
|
|
744
|
-
return bcs_1.bcs.struct("
|
|
745
|
-
sender: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
|
|
580
|
+
return bcs_1.bcs.struct("CompleteRemoveLiquidityTokenProcessEvent", {
|
|
746
581
|
index: bcs_1.bcs.u64(),
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
582
|
+
liquidity_token: structs_1.TypeName.bcs,
|
|
583
|
+
removed_usd: bcs_1.bcs.u64(),
|
|
584
|
+
repaid_usd: bcs_1.bcs.u64(),
|
|
750
585
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
751
586
|
});
|
|
752
587
|
},
|
|
753
588
|
enumerable: false,
|
|
754
589
|
configurable: true
|
|
755
590
|
});
|
|
756
|
-
|
|
757
|
-
return
|
|
758
|
-
sender: (0, reified_1.decodeFromFields)("address", fields.sender),
|
|
591
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromFields = function (fields) {
|
|
592
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified().new({
|
|
759
593
|
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
594
|
+
liquidityToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.liquidity_token),
|
|
595
|
+
removedUsd: (0, reified_1.decodeFromFields)("u64", fields.removed_usd),
|
|
596
|
+
repaidUsd: (0, reified_1.decodeFromFields)("u64", fields.repaid_usd),
|
|
763
597
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
764
598
|
});
|
|
765
599
|
};
|
|
766
|
-
|
|
767
|
-
if (!
|
|
768
|
-
throw new Error("not a
|
|
600
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes = function (item) {
|
|
601
|
+
if (!isCompleteRemoveLiquidityTokenProcessEvent(item.type)) {
|
|
602
|
+
throw new Error("not a CompleteRemoveLiquidityTokenProcessEvent type");
|
|
769
603
|
}
|
|
770
|
-
return
|
|
771
|
-
sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
|
|
604
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified().new({
|
|
772
605
|
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
606
|
+
liquidityToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.liquidity_token),
|
|
607
|
+
removedUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.removed_usd),
|
|
608
|
+
repaidUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.repaid_usd),
|
|
776
609
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
777
610
|
});
|
|
778
611
|
};
|
|
779
|
-
|
|
780
|
-
return
|
|
612
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromBcs = function (data) {
|
|
613
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromFields(CompleteRemoveLiquidityTokenProcessEvent.bcs.parse(data));
|
|
781
614
|
};
|
|
782
|
-
|
|
615
|
+
CompleteRemoveLiquidityTokenProcessEvent.prototype.toJSONField = function () {
|
|
783
616
|
return {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
state: this.state.toJSONField(),
|
|
617
|
+
index: this.index.toString(),
|
|
618
|
+
liquidityToken: this.liquidityToken.toJSONField(),
|
|
619
|
+
removedUsd: this.removedUsd.toString(),
|
|
620
|
+
repaidUsd: this.repaidUsd.toString(),
|
|
789
621
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
790
622
|
};
|
|
791
623
|
};
|
|
792
|
-
|
|
624
|
+
CompleteRemoveLiquidityTokenProcessEvent.prototype.toJSON = function () {
|
|
793
625
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
794
626
|
};
|
|
795
|
-
|
|
796
|
-
return
|
|
797
|
-
sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
|
|
627
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromJSONField = function (field) {
|
|
628
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified().new({
|
|
798
629
|
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
630
|
+
liquidityToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.liquidityToken),
|
|
631
|
+
removedUsd: (0, reified_1.decodeFromJSONField)("u64", field.removedUsd),
|
|
632
|
+
repaidUsd: (0, reified_1.decodeFromJSONField)("u64", field.repaidUsd),
|
|
802
633
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
803
634
|
});
|
|
804
635
|
};
|
|
805
|
-
|
|
806
|
-
if (json.$typeName !==
|
|
636
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromJSON = function (json) {
|
|
637
|
+
if (json.$typeName !== CompleteRemoveLiquidityTokenProcessEvent.$typeName) {
|
|
807
638
|
throw new Error("not a WithTwoGenerics json object");
|
|
808
639
|
}
|
|
809
|
-
return
|
|
640
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromJSONField(json);
|
|
810
641
|
};
|
|
811
|
-
|
|
642
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromSuiParsedData = function (content) {
|
|
812
643
|
if (content.dataType !== "moveObject") {
|
|
813
644
|
throw new Error("not an object");
|
|
814
645
|
}
|
|
815
|
-
if (!
|
|
816
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
646
|
+
if (!isCompleteRemoveLiquidityTokenProcessEvent(content.type)) {
|
|
647
|
+
throw new Error("object at ".concat(content.fields.id, " is not a CompleteRemoveLiquidityTokenProcessEvent object"));
|
|
817
648
|
}
|
|
818
|
-
return
|
|
649
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes(content);
|
|
819
650
|
};
|
|
820
|
-
|
|
651
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromSuiObjectData = function (data) {
|
|
821
652
|
if (data.bcs) {
|
|
822
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
823
|
-
throw new Error("object at is not a
|
|
653
|
+
if (data.bcs.dataType !== "moveObject" || !isCompleteRemoveLiquidityTokenProcessEvent(data.bcs.type)) {
|
|
654
|
+
throw new Error("object at is not a CompleteRemoveLiquidityTokenProcessEvent object");
|
|
824
655
|
}
|
|
825
|
-
return
|
|
656
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
826
657
|
}
|
|
827
658
|
if (data.content) {
|
|
828
|
-
return
|
|
659
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromSuiParsedData(data.content);
|
|
829
660
|
}
|
|
830
661
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
831
662
|
};
|
|
832
|
-
|
|
663
|
+
CompleteRemoveLiquidityTokenProcessEvent.fetch = function (client, id) {
|
|
833
664
|
return __awaiter(this, void 0, void 0, function () {
|
|
834
665
|
var res;
|
|
835
666
|
var _a, _b;
|
|
@@ -839,192 +670,168 @@ var AddLiquidityTokenEvent = /** @class */ (function () {
|
|
|
839
670
|
case 1:
|
|
840
671
|
res = _c.sent();
|
|
841
672
|
if (res.error) {
|
|
842
|
-
throw new Error("error fetching
|
|
673
|
+
throw new Error("error fetching CompleteRemoveLiquidityTokenProcessEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
843
674
|
}
|
|
844
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
845
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
675
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isCompleteRemoveLiquidityTokenProcessEvent(res.data.bcs.type)) {
|
|
676
|
+
throw new Error("object at id ".concat(id, " is not a CompleteRemoveLiquidityTokenProcessEvent object"));
|
|
846
677
|
}
|
|
847
|
-
return [2 /*return*/,
|
|
678
|
+
return [2 /*return*/, CompleteRemoveLiquidityTokenProcessEvent.fromSuiObjectData(res.data)];
|
|
848
679
|
}
|
|
849
680
|
});
|
|
850
681
|
});
|
|
851
682
|
};
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
return
|
|
683
|
+
CompleteRemoveLiquidityTokenProcessEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::CompleteRemoveLiquidityTokenProcessEvent");
|
|
684
|
+
CompleteRemoveLiquidityTokenProcessEvent.$numTypeParams = 0;
|
|
685
|
+
CompleteRemoveLiquidityTokenProcessEvent.$isPhantom = [];
|
|
686
|
+
return CompleteRemoveLiquidityTokenProcessEvent;
|
|
856
687
|
}());
|
|
857
|
-
exports.
|
|
858
|
-
/* ==============================
|
|
859
|
-
function
|
|
688
|
+
exports.CompleteRemoveLiquidityTokenProcessEvent = CompleteRemoveLiquidityTokenProcessEvent;
|
|
689
|
+
/* ============================== Config =============================== */
|
|
690
|
+
function isConfig(type) {
|
|
860
691
|
type = (0, util_1.compressSuiType)(type);
|
|
861
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
692
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::Config");
|
|
862
693
|
}
|
|
863
|
-
var
|
|
864
|
-
function
|
|
694
|
+
var Config = /** @class */ (function () {
|
|
695
|
+
function Config(typeArgs, fields) {
|
|
865
696
|
this.__StructClass = true;
|
|
866
|
-
this.$typeName =
|
|
867
|
-
this.$isPhantom =
|
|
868
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
697
|
+
this.$typeName = Config.$typeName;
|
|
698
|
+
this.$isPhantom = Config.$isPhantom;
|
|
699
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Config.$typeName], __read(typeArgs), false));
|
|
869
700
|
this.$typeArgs = typeArgs;
|
|
870
|
-
this.
|
|
871
|
-
this.
|
|
872
|
-
this.
|
|
873
|
-
this.
|
|
874
|
-
this.burnAmountUsd = fields.burnAmountUsd;
|
|
875
|
-
this.burnFeeUsd = fields.burnFeeUsd;
|
|
876
|
-
this.liquidityTokenType = fields.liquidityTokenType;
|
|
877
|
-
this.withdrawTokenAmount = fields.withdrawTokenAmount;
|
|
701
|
+
this.oracleId = fields.oracleId;
|
|
702
|
+
this.liquidityTokenDecimal = fields.liquidityTokenDecimal;
|
|
703
|
+
this.spotConfig = fields.spotConfig;
|
|
704
|
+
this.marginConfig = fields.marginConfig;
|
|
878
705
|
this.u64Padding = fields.u64Padding;
|
|
879
706
|
}
|
|
880
|
-
|
|
707
|
+
Config.reified = function () {
|
|
881
708
|
var _this = this;
|
|
882
709
|
return {
|
|
883
|
-
typeName:
|
|
884
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
710
|
+
typeName: Config.$typeName,
|
|
711
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Config.$typeName], [], false)),
|
|
885
712
|
typeArgs: [],
|
|
886
|
-
isPhantom:
|
|
713
|
+
isPhantom: Config.$isPhantom,
|
|
887
714
|
reifiedTypeArgs: [],
|
|
888
|
-
fromFields: function (fields) { return
|
|
889
|
-
fromFieldsWithTypes: function (item) { return
|
|
890
|
-
fromBcs: function (data) { return
|
|
891
|
-
bcs:
|
|
892
|
-
fromJSONField: function (field) { return
|
|
893
|
-
fromJSON: function (json) { return
|
|
894
|
-
fromSuiParsedData: function (content) { return
|
|
895
|
-
fromSuiObjectData: function (content) { return
|
|
715
|
+
fromFields: function (fields) { return Config.fromFields(fields); },
|
|
716
|
+
fromFieldsWithTypes: function (item) { return Config.fromFieldsWithTypes(item); },
|
|
717
|
+
fromBcs: function (data) { return Config.fromBcs(data); },
|
|
718
|
+
bcs: Config.bcs,
|
|
719
|
+
fromJSONField: function (field) { return Config.fromJSONField(field); },
|
|
720
|
+
fromJSON: function (json) { return Config.fromJSON(json); },
|
|
721
|
+
fromSuiParsedData: function (content) { return Config.fromSuiParsedData(content); },
|
|
722
|
+
fromSuiObjectData: function (content) { return Config.fromSuiObjectData(content); },
|
|
896
723
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
897
|
-
return [2 /*return*/,
|
|
724
|
+
return [2 /*return*/, Config.fetch(client, id)];
|
|
898
725
|
}); }); },
|
|
899
726
|
new: function (fields) {
|
|
900
|
-
return new
|
|
727
|
+
return new Config([], fields);
|
|
901
728
|
},
|
|
902
729
|
kind: "StructClassReified",
|
|
903
730
|
};
|
|
904
731
|
};
|
|
905
|
-
Object.defineProperty(
|
|
732
|
+
Object.defineProperty(Config, "r", {
|
|
906
733
|
get: function () {
|
|
907
|
-
return
|
|
734
|
+
return Config.reified();
|
|
908
735
|
},
|
|
909
736
|
enumerable: false,
|
|
910
737
|
configurable: true
|
|
911
738
|
});
|
|
912
|
-
|
|
913
|
-
return (0, reified_1.phantom)(
|
|
739
|
+
Config.phantom = function () {
|
|
740
|
+
return (0, reified_1.phantom)(Config.reified());
|
|
914
741
|
};
|
|
915
|
-
Object.defineProperty(
|
|
742
|
+
Object.defineProperty(Config, "p", {
|
|
916
743
|
get: function () {
|
|
917
|
-
return
|
|
744
|
+
return Config.phantom();
|
|
918
745
|
},
|
|
919
746
|
enumerable: false,
|
|
920
747
|
configurable: true
|
|
921
748
|
});
|
|
922
|
-
Object.defineProperty(
|
|
749
|
+
Object.defineProperty(Config, "bcs", {
|
|
923
750
|
get: function () {
|
|
924
|
-
return bcs_1.bcs.struct("
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
burn_amount_usd: bcs_1.bcs.u64(),
|
|
930
|
-
burn_fee_usd: bcs_1.bcs.u64(),
|
|
931
|
-
liquidity_token_type: structs_1.TypeName.bcs,
|
|
932
|
-
withdraw_token_amount: bcs_1.bcs.u64(),
|
|
751
|
+
return bcs_1.bcs.struct("Config", {
|
|
752
|
+
oracle_id: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
|
|
753
|
+
liquidity_token_decimal: bcs_1.bcs.u64(),
|
|
754
|
+
spot_config: SpotConfig.bcs,
|
|
755
|
+
margin_config: MarginConfig.bcs,
|
|
933
756
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
934
757
|
});
|
|
935
758
|
},
|
|
936
759
|
enumerable: false,
|
|
937
760
|
configurable: true
|
|
938
761
|
});
|
|
939
|
-
|
|
940
|
-
return
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
burnAmountUsd: (0, reified_1.decodeFromFields)("u64", fields.burn_amount_usd),
|
|
946
|
-
burnFeeUsd: (0, reified_1.decodeFromFields)("u64", fields.burn_fee_usd),
|
|
947
|
-
liquidityTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.liquidity_token_type),
|
|
948
|
-
withdrawTokenAmount: (0, reified_1.decodeFromFields)("u64", fields.withdraw_token_amount),
|
|
762
|
+
Config.fromFields = function (fields) {
|
|
763
|
+
return Config.reified().new({
|
|
764
|
+
oracleId: (0, reified_1.decodeFromFields)("address", fields.oracle_id),
|
|
765
|
+
liquidityTokenDecimal: (0, reified_1.decodeFromFields)("u64", fields.liquidity_token_decimal),
|
|
766
|
+
spotConfig: (0, reified_1.decodeFromFields)(SpotConfig.reified(), fields.spot_config),
|
|
767
|
+
marginConfig: (0, reified_1.decodeFromFields)(MarginConfig.reified(), fields.margin_config),
|
|
949
768
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
950
769
|
});
|
|
951
770
|
};
|
|
952
|
-
|
|
953
|
-
if (!
|
|
954
|
-
throw new Error("not a
|
|
771
|
+
Config.fromFieldsWithTypes = function (item) {
|
|
772
|
+
if (!isConfig(item.type)) {
|
|
773
|
+
throw new Error("not a Config type");
|
|
955
774
|
}
|
|
956
|
-
return
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
burnAmountUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.burn_amount_usd),
|
|
962
|
-
burnFeeUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.burn_fee_usd),
|
|
963
|
-
liquidityTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.liquidity_token_type),
|
|
964
|
-
withdrawTokenAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.withdraw_token_amount),
|
|
775
|
+
return Config.reified().new({
|
|
776
|
+
oracleId: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.oracle_id),
|
|
777
|
+
liquidityTokenDecimal: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.liquidity_token_decimal),
|
|
778
|
+
spotConfig: (0, reified_1.decodeFromFieldsWithTypes)(SpotConfig.reified(), item.fields.spot_config),
|
|
779
|
+
marginConfig: (0, reified_1.decodeFromFieldsWithTypes)(MarginConfig.reified(), item.fields.margin_config),
|
|
965
780
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
966
781
|
});
|
|
967
782
|
};
|
|
968
|
-
|
|
969
|
-
return
|
|
783
|
+
Config.fromBcs = function (data) {
|
|
784
|
+
return Config.fromFields(Config.bcs.parse(data));
|
|
970
785
|
};
|
|
971
|
-
|
|
786
|
+
Config.prototype.toJSONField = function () {
|
|
972
787
|
return {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
burnAmountUsd: this.burnAmountUsd.toString(),
|
|
978
|
-
burnFeeUsd: this.burnFeeUsd.toString(),
|
|
979
|
-
liquidityTokenType: this.liquidityTokenType.toJSONField(),
|
|
980
|
-
withdrawTokenAmount: this.withdrawTokenAmount.toString(),
|
|
788
|
+
oracleId: this.oracleId,
|
|
789
|
+
liquidityTokenDecimal: this.liquidityTokenDecimal.toString(),
|
|
790
|
+
spotConfig: this.spotConfig.toJSONField(),
|
|
791
|
+
marginConfig: this.marginConfig.toJSONField(),
|
|
981
792
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
982
793
|
};
|
|
983
794
|
};
|
|
984
|
-
|
|
795
|
+
Config.prototype.toJSON = function () {
|
|
985
796
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
986
797
|
};
|
|
987
|
-
|
|
988
|
-
return
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
burnAmountUsd: (0, reified_1.decodeFromJSONField)("u64", field.burnAmountUsd),
|
|
994
|
-
burnFeeUsd: (0, reified_1.decodeFromJSONField)("u64", field.burnFeeUsd),
|
|
995
|
-
liquidityTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.liquidityTokenType),
|
|
996
|
-
withdrawTokenAmount: (0, reified_1.decodeFromJSONField)("u64", field.withdrawTokenAmount),
|
|
798
|
+
Config.fromJSONField = function (field) {
|
|
799
|
+
return Config.reified().new({
|
|
800
|
+
oracleId: (0, reified_1.decodeFromJSONField)("address", field.oracleId),
|
|
801
|
+
liquidityTokenDecimal: (0, reified_1.decodeFromJSONField)("u64", field.liquidityTokenDecimal),
|
|
802
|
+
spotConfig: (0, reified_1.decodeFromJSONField)(SpotConfig.reified(), field.spotConfig),
|
|
803
|
+
marginConfig: (0, reified_1.decodeFromJSONField)(MarginConfig.reified(), field.marginConfig),
|
|
997
804
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
998
805
|
});
|
|
999
806
|
};
|
|
1000
|
-
|
|
1001
|
-
if (json.$typeName !==
|
|
807
|
+
Config.fromJSON = function (json) {
|
|
808
|
+
if (json.$typeName !== Config.$typeName) {
|
|
1002
809
|
throw new Error("not a WithTwoGenerics json object");
|
|
1003
810
|
}
|
|
1004
|
-
return
|
|
811
|
+
return Config.fromJSONField(json);
|
|
1005
812
|
};
|
|
1006
|
-
|
|
813
|
+
Config.fromSuiParsedData = function (content) {
|
|
1007
814
|
if (content.dataType !== "moveObject") {
|
|
1008
815
|
throw new Error("not an object");
|
|
1009
816
|
}
|
|
1010
|
-
if (!
|
|
1011
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
817
|
+
if (!isConfig(content.type)) {
|
|
818
|
+
throw new Error("object at ".concat(content.fields.id, " is not a Config object"));
|
|
1012
819
|
}
|
|
1013
|
-
return
|
|
820
|
+
return Config.fromFieldsWithTypes(content);
|
|
1014
821
|
};
|
|
1015
|
-
|
|
822
|
+
Config.fromSuiObjectData = function (data) {
|
|
1016
823
|
if (data.bcs) {
|
|
1017
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
1018
|
-
throw new Error("object at is not a
|
|
824
|
+
if (data.bcs.dataType !== "moveObject" || !isConfig(data.bcs.type)) {
|
|
825
|
+
throw new Error("object at is not a Config object");
|
|
1019
826
|
}
|
|
1020
|
-
return
|
|
827
|
+
return Config.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1021
828
|
}
|
|
1022
829
|
if (data.content) {
|
|
1023
|
-
return
|
|
830
|
+
return Config.fromSuiParsedData(data.content);
|
|
1024
831
|
}
|
|
1025
832
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1026
833
|
};
|
|
1027
|
-
|
|
834
|
+
Config.fetch = function (client, id) {
|
|
1028
835
|
return __awaiter(this, void 0, void 0, function () {
|
|
1029
836
|
var res;
|
|
1030
837
|
var _a, _b;
|
|
@@ -1034,168 +841,198 @@ var BurnLpEvent = /** @class */ (function () {
|
|
|
1034
841
|
case 1:
|
|
1035
842
|
res = _c.sent();
|
|
1036
843
|
if (res.error) {
|
|
1037
|
-
throw new Error("error fetching
|
|
844
|
+
throw new Error("error fetching Config object at id ".concat(id, ": ").concat(res.error.code));
|
|
1038
845
|
}
|
|
1039
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
1040
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
846
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isConfig(res.data.bcs.type)) {
|
|
847
|
+
throw new Error("object at id ".concat(id, " is not a Config object"));
|
|
1041
848
|
}
|
|
1042
|
-
return [2 /*return*/,
|
|
849
|
+
return [2 /*return*/, Config.fromSuiObjectData(res.data)];
|
|
1043
850
|
}
|
|
1044
851
|
});
|
|
1045
852
|
});
|
|
1046
853
|
};
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
return
|
|
854
|
+
Config.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::Config");
|
|
855
|
+
Config.$numTypeParams = 0;
|
|
856
|
+
Config.$isPhantom = [];
|
|
857
|
+
return Config;
|
|
1051
858
|
}());
|
|
1052
|
-
exports.
|
|
1053
|
-
/* ==============================
|
|
1054
|
-
function
|
|
859
|
+
exports.Config = Config;
|
|
860
|
+
/* ============================== DepositLendingEvent =============================== */
|
|
861
|
+
function isDepositLendingEvent(type) {
|
|
1055
862
|
type = (0, util_1.compressSuiType)(type);
|
|
1056
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
863
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::DepositLendingEvent");
|
|
1057
864
|
}
|
|
1058
|
-
var
|
|
1059
|
-
function
|
|
865
|
+
var DepositLendingEvent = /** @class */ (function () {
|
|
866
|
+
function DepositLendingEvent(typeArgs, fields) {
|
|
1060
867
|
this.__StructClass = true;
|
|
1061
|
-
this.$typeName =
|
|
1062
|
-
this.$isPhantom =
|
|
1063
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
868
|
+
this.$typeName = DepositLendingEvent.$typeName;
|
|
869
|
+
this.$isPhantom = DepositLendingEvent.$isPhantom;
|
|
870
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([DepositLendingEvent.$typeName], __read(typeArgs), false));
|
|
1064
871
|
this.$typeArgs = typeArgs;
|
|
1065
872
|
this.index = fields.index;
|
|
1066
|
-
this.
|
|
1067
|
-
this.
|
|
1068
|
-
this.
|
|
873
|
+
this.lendingIndex = fields.lendingIndex;
|
|
874
|
+
this.cTokenType = fields.cTokenType;
|
|
875
|
+
this.depositAmount = fields.depositAmount;
|
|
876
|
+
this.mintedMarketCoinAmount = fields.mintedMarketCoinAmount;
|
|
877
|
+
this.latestLendingAmount = fields.latestLendingAmount;
|
|
878
|
+
this.latestMarketCoinAmount = fields.latestMarketCoinAmount;
|
|
879
|
+
this.latestReservedAmount = fields.latestReservedAmount;
|
|
880
|
+
this.latestLiquidityAmount = fields.latestLiquidityAmount;
|
|
1069
881
|
this.u64Padding = fields.u64Padding;
|
|
1070
882
|
}
|
|
1071
|
-
|
|
883
|
+
DepositLendingEvent.reified = function () {
|
|
1072
884
|
var _this = this;
|
|
1073
885
|
return {
|
|
1074
|
-
typeName:
|
|
1075
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
886
|
+
typeName: DepositLendingEvent.$typeName,
|
|
887
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([DepositLendingEvent.$typeName], [], false)),
|
|
1076
888
|
typeArgs: [],
|
|
1077
|
-
isPhantom:
|
|
889
|
+
isPhantom: DepositLendingEvent.$isPhantom,
|
|
1078
890
|
reifiedTypeArgs: [],
|
|
1079
|
-
fromFields: function (fields) { return
|
|
1080
|
-
fromFieldsWithTypes: function (item) { return
|
|
1081
|
-
fromBcs: function (data) { return
|
|
1082
|
-
bcs:
|
|
1083
|
-
fromJSONField: function (field) { return
|
|
1084
|
-
fromJSON: function (json) { return
|
|
1085
|
-
fromSuiParsedData: function (content) { return
|
|
1086
|
-
fromSuiObjectData: function (content) { return
|
|
891
|
+
fromFields: function (fields) { return DepositLendingEvent.fromFields(fields); },
|
|
892
|
+
fromFieldsWithTypes: function (item) { return DepositLendingEvent.fromFieldsWithTypes(item); },
|
|
893
|
+
fromBcs: function (data) { return DepositLendingEvent.fromBcs(data); },
|
|
894
|
+
bcs: DepositLendingEvent.bcs,
|
|
895
|
+
fromJSONField: function (field) { return DepositLendingEvent.fromJSONField(field); },
|
|
896
|
+
fromJSON: function (json) { return DepositLendingEvent.fromJSON(json); },
|
|
897
|
+
fromSuiParsedData: function (content) { return DepositLendingEvent.fromSuiParsedData(content); },
|
|
898
|
+
fromSuiObjectData: function (content) { return DepositLendingEvent.fromSuiObjectData(content); },
|
|
1087
899
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1088
|
-
return [2 /*return*/,
|
|
900
|
+
return [2 /*return*/, DepositLendingEvent.fetch(client, id)];
|
|
1089
901
|
}); }); },
|
|
1090
902
|
new: function (fields) {
|
|
1091
|
-
return new
|
|
903
|
+
return new DepositLendingEvent([], fields);
|
|
1092
904
|
},
|
|
1093
905
|
kind: "StructClassReified",
|
|
1094
906
|
};
|
|
1095
907
|
};
|
|
1096
|
-
Object.defineProperty(
|
|
908
|
+
Object.defineProperty(DepositLendingEvent, "r", {
|
|
1097
909
|
get: function () {
|
|
1098
|
-
return
|
|
910
|
+
return DepositLendingEvent.reified();
|
|
1099
911
|
},
|
|
1100
912
|
enumerable: false,
|
|
1101
913
|
configurable: true
|
|
1102
914
|
});
|
|
1103
|
-
|
|
1104
|
-
return (0, reified_1.phantom)(
|
|
915
|
+
DepositLendingEvent.phantom = function () {
|
|
916
|
+
return (0, reified_1.phantom)(DepositLendingEvent.reified());
|
|
1105
917
|
};
|
|
1106
|
-
Object.defineProperty(
|
|
918
|
+
Object.defineProperty(DepositLendingEvent, "p", {
|
|
1107
919
|
get: function () {
|
|
1108
|
-
return
|
|
920
|
+
return DepositLendingEvent.phantom();
|
|
1109
921
|
},
|
|
1110
922
|
enumerable: false,
|
|
1111
923
|
configurable: true
|
|
1112
924
|
});
|
|
1113
|
-
Object.defineProperty(
|
|
925
|
+
Object.defineProperty(DepositLendingEvent, "bcs", {
|
|
1114
926
|
get: function () {
|
|
1115
|
-
return bcs_1.bcs.struct("
|
|
927
|
+
return bcs_1.bcs.struct("DepositLendingEvent", {
|
|
1116
928
|
index: bcs_1.bcs.u64(),
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
929
|
+
lending_index: bcs_1.bcs.u64(),
|
|
930
|
+
c_token_type: structs_1.TypeName.bcs,
|
|
931
|
+
deposit_amount: bcs_1.bcs.u64(),
|
|
932
|
+
minted_market_coin_amount: bcs_1.bcs.u64(),
|
|
933
|
+
latest_lending_amount: bcs_1.bcs.u64(),
|
|
934
|
+
latest_market_coin_amount: bcs_1.bcs.u64(),
|
|
935
|
+
latest_reserved_amount: bcs_1.bcs.u64(),
|
|
936
|
+
latest_liquidity_amount: bcs_1.bcs.u64(),
|
|
1120
937
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
1121
938
|
});
|
|
1122
939
|
},
|
|
1123
940
|
enumerable: false,
|
|
1124
941
|
configurable: true
|
|
1125
942
|
});
|
|
1126
|
-
|
|
1127
|
-
return
|
|
943
|
+
DepositLendingEvent.fromFields = function (fields) {
|
|
944
|
+
return DepositLendingEvent.reified().new({
|
|
1128
945
|
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
946
|
+
lendingIndex: (0, reified_1.decodeFromFields)("u64", fields.lending_index),
|
|
947
|
+
cTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.c_token_type),
|
|
948
|
+
depositAmount: (0, reified_1.decodeFromFields)("u64", fields.deposit_amount),
|
|
949
|
+
mintedMarketCoinAmount: (0, reified_1.decodeFromFields)("u64", fields.minted_market_coin_amount),
|
|
950
|
+
latestLendingAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_lending_amount),
|
|
951
|
+
latestMarketCoinAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_market_coin_amount),
|
|
952
|
+
latestReservedAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_reserved_amount),
|
|
953
|
+
latestLiquidityAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_liquidity_amount),
|
|
1132
954
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
1133
955
|
});
|
|
1134
956
|
};
|
|
1135
|
-
|
|
1136
|
-
if (!
|
|
1137
|
-
throw new Error("not a
|
|
957
|
+
DepositLendingEvent.fromFieldsWithTypes = function (item) {
|
|
958
|
+
if (!isDepositLendingEvent(item.type)) {
|
|
959
|
+
throw new Error("not a DepositLendingEvent type");
|
|
1138
960
|
}
|
|
1139
|
-
return
|
|
961
|
+
return DepositLendingEvent.reified().new({
|
|
1140
962
|
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
963
|
+
lendingIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lending_index),
|
|
964
|
+
cTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.c_token_type),
|
|
965
|
+
depositAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.deposit_amount),
|
|
966
|
+
mintedMarketCoinAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.minted_market_coin_amount),
|
|
967
|
+
latestLendingAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_lending_amount),
|
|
968
|
+
latestMarketCoinAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_market_coin_amount),
|
|
969
|
+
latestReservedAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_reserved_amount),
|
|
970
|
+
latestLiquidityAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_liquidity_amount),
|
|
1144
971
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
1145
972
|
});
|
|
1146
973
|
};
|
|
1147
|
-
|
|
1148
|
-
return
|
|
974
|
+
DepositLendingEvent.fromBcs = function (data) {
|
|
975
|
+
return DepositLendingEvent.fromFields(DepositLendingEvent.bcs.parse(data));
|
|
1149
976
|
};
|
|
1150
|
-
|
|
977
|
+
DepositLendingEvent.prototype.toJSONField = function () {
|
|
1151
978
|
return {
|
|
1152
979
|
index: this.index.toString(),
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
980
|
+
lendingIndex: this.lendingIndex.toString(),
|
|
981
|
+
cTokenType: this.cTokenType.toJSONField(),
|
|
982
|
+
depositAmount: this.depositAmount.toString(),
|
|
983
|
+
mintedMarketCoinAmount: this.mintedMarketCoinAmount.toString(),
|
|
984
|
+
latestLendingAmount: this.latestLendingAmount.toString(),
|
|
985
|
+
latestMarketCoinAmount: this.latestMarketCoinAmount.toString(),
|
|
986
|
+
latestReservedAmount: this.latestReservedAmount.toString(),
|
|
987
|
+
latestLiquidityAmount: this.latestLiquidityAmount.toString(),
|
|
1156
988
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
1157
989
|
};
|
|
1158
990
|
};
|
|
1159
|
-
|
|
991
|
+
DepositLendingEvent.prototype.toJSON = function () {
|
|
1160
992
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
1161
993
|
};
|
|
1162
|
-
|
|
1163
|
-
return
|
|
994
|
+
DepositLendingEvent.fromJSONField = function (field) {
|
|
995
|
+
return DepositLendingEvent.reified().new({
|
|
1164
996
|
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
997
|
+
lendingIndex: (0, reified_1.decodeFromJSONField)("u64", field.lendingIndex),
|
|
998
|
+
cTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.cTokenType),
|
|
999
|
+
depositAmount: (0, reified_1.decodeFromJSONField)("u64", field.depositAmount),
|
|
1000
|
+
mintedMarketCoinAmount: (0, reified_1.decodeFromJSONField)("u64", field.mintedMarketCoinAmount),
|
|
1001
|
+
latestLendingAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestLendingAmount),
|
|
1002
|
+
latestMarketCoinAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestMarketCoinAmount),
|
|
1003
|
+
latestReservedAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestReservedAmount),
|
|
1004
|
+
latestLiquidityAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestLiquidityAmount),
|
|
1168
1005
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
1169
1006
|
});
|
|
1170
1007
|
};
|
|
1171
|
-
|
|
1172
|
-
if (json.$typeName !==
|
|
1008
|
+
DepositLendingEvent.fromJSON = function (json) {
|
|
1009
|
+
if (json.$typeName !== DepositLendingEvent.$typeName) {
|
|
1173
1010
|
throw new Error("not a WithTwoGenerics json object");
|
|
1174
1011
|
}
|
|
1175
|
-
return
|
|
1012
|
+
return DepositLendingEvent.fromJSONField(json);
|
|
1176
1013
|
};
|
|
1177
|
-
|
|
1014
|
+
DepositLendingEvent.fromSuiParsedData = function (content) {
|
|
1178
1015
|
if (content.dataType !== "moveObject") {
|
|
1179
1016
|
throw new Error("not an object");
|
|
1180
1017
|
}
|
|
1181
|
-
if (!
|
|
1182
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
1018
|
+
if (!isDepositLendingEvent(content.type)) {
|
|
1019
|
+
throw new Error("object at ".concat(content.fields.id, " is not a DepositLendingEvent object"));
|
|
1183
1020
|
}
|
|
1184
|
-
return
|
|
1021
|
+
return DepositLendingEvent.fromFieldsWithTypes(content);
|
|
1185
1022
|
};
|
|
1186
|
-
|
|
1023
|
+
DepositLendingEvent.fromSuiObjectData = function (data) {
|
|
1187
1024
|
if (data.bcs) {
|
|
1188
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
1189
|
-
throw new Error("object at is not a
|
|
1025
|
+
if (data.bcs.dataType !== "moveObject" || !isDepositLendingEvent(data.bcs.type)) {
|
|
1026
|
+
throw new Error("object at is not a DepositLendingEvent object");
|
|
1190
1027
|
}
|
|
1191
|
-
return
|
|
1028
|
+
return DepositLendingEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1192
1029
|
}
|
|
1193
1030
|
if (data.content) {
|
|
1194
|
-
return
|
|
1031
|
+
return DepositLendingEvent.fromSuiParsedData(data.content);
|
|
1195
1032
|
}
|
|
1196
1033
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1197
1034
|
};
|
|
1198
|
-
|
|
1035
|
+
DepositLendingEvent.fetch = function (client, id) {
|
|
1199
1036
|
return __awaiter(this, void 0, void 0, function () {
|
|
1200
1037
|
var res;
|
|
1201
1038
|
var _a, _b;
|
|
@@ -1205,22 +1042,22 @@ var CompleteRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
|
1205
1042
|
case 1:
|
|
1206
1043
|
res = _c.sent();
|
|
1207
1044
|
if (res.error) {
|
|
1208
|
-
throw new Error("error fetching
|
|
1045
|
+
throw new Error("error fetching DepositLendingEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
1209
1046
|
}
|
|
1210
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
1211
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
1047
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isDepositLendingEvent(res.data.bcs.type)) {
|
|
1048
|
+
throw new Error("object at id ".concat(id, " is not a DepositLendingEvent object"));
|
|
1212
1049
|
}
|
|
1213
|
-
return [2 /*return*/,
|
|
1050
|
+
return [2 /*return*/, DepositLendingEvent.fromSuiObjectData(res.data)];
|
|
1214
1051
|
}
|
|
1215
1052
|
});
|
|
1216
1053
|
});
|
|
1217
1054
|
};
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
return
|
|
1055
|
+
DepositLendingEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::DepositLendingEvent");
|
|
1056
|
+
DepositLendingEvent.$numTypeParams = 0;
|
|
1057
|
+
DepositLendingEvent.$isPhantom = [];
|
|
1058
|
+
return DepositLendingEvent;
|
|
1222
1059
|
}());
|
|
1223
|
-
exports.
|
|
1060
|
+
exports.DepositLendingEvent = DepositLendingEvent;
|
|
1224
1061
|
/* ============================== LiquidityPool =============================== */
|
|
1225
1062
|
function isLiquidityPool(type) {
|
|
1226
1063
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -2413,70 +2250,229 @@ var NewLiquidityPoolEvent = /** @class */ (function () {
|
|
|
2413
2250
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
2414
2251
|
});
|
|
2415
2252
|
};
|
|
2416
|
-
NewLiquidityPoolEvent.fromFieldsWithTypes = function (item) {
|
|
2417
|
-
if (!isNewLiquidityPoolEvent(item.type)) {
|
|
2418
|
-
throw new Error("not a NewLiquidityPoolEvent type");
|
|
2253
|
+
NewLiquidityPoolEvent.fromFieldsWithTypes = function (item) {
|
|
2254
|
+
if (!isNewLiquidityPoolEvent(item.type)) {
|
|
2255
|
+
throw new Error("not a NewLiquidityPoolEvent type");
|
|
2256
|
+
}
|
|
2257
|
+
return NewLiquidityPoolEvent.reified().new({
|
|
2258
|
+
sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
|
|
2259
|
+
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
2260
|
+
lpTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.lp_token_type),
|
|
2261
|
+
lpTokenDecimal: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lp_token_decimal),
|
|
2262
|
+
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
2263
|
+
});
|
|
2264
|
+
};
|
|
2265
|
+
NewLiquidityPoolEvent.fromBcs = function (data) {
|
|
2266
|
+
return NewLiquidityPoolEvent.fromFields(NewLiquidityPoolEvent.bcs.parse(data));
|
|
2267
|
+
};
|
|
2268
|
+
NewLiquidityPoolEvent.prototype.toJSONField = function () {
|
|
2269
|
+
return {
|
|
2270
|
+
sender: this.sender,
|
|
2271
|
+
index: this.index.toString(),
|
|
2272
|
+
lpTokenType: this.lpTokenType.toJSONField(),
|
|
2273
|
+
lpTokenDecimal: this.lpTokenDecimal.toString(),
|
|
2274
|
+
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
2275
|
+
};
|
|
2276
|
+
};
|
|
2277
|
+
NewLiquidityPoolEvent.prototype.toJSON = function () {
|
|
2278
|
+
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
2279
|
+
};
|
|
2280
|
+
NewLiquidityPoolEvent.fromJSONField = function (field) {
|
|
2281
|
+
return NewLiquidityPoolEvent.reified().new({
|
|
2282
|
+
sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
|
|
2283
|
+
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
2284
|
+
lpTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.lpTokenType),
|
|
2285
|
+
lpTokenDecimal: (0, reified_1.decodeFromJSONField)("u64", field.lpTokenDecimal),
|
|
2286
|
+
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
2287
|
+
});
|
|
2288
|
+
};
|
|
2289
|
+
NewLiquidityPoolEvent.fromJSON = function (json) {
|
|
2290
|
+
if (json.$typeName !== NewLiquidityPoolEvent.$typeName) {
|
|
2291
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
2292
|
+
}
|
|
2293
|
+
return NewLiquidityPoolEvent.fromJSONField(json);
|
|
2294
|
+
};
|
|
2295
|
+
NewLiquidityPoolEvent.fromSuiParsedData = function (content) {
|
|
2296
|
+
if (content.dataType !== "moveObject") {
|
|
2297
|
+
throw new Error("not an object");
|
|
2298
|
+
}
|
|
2299
|
+
if (!isNewLiquidityPoolEvent(content.type)) {
|
|
2300
|
+
throw new Error("object at ".concat(content.fields.id, " is not a NewLiquidityPoolEvent object"));
|
|
2301
|
+
}
|
|
2302
|
+
return NewLiquidityPoolEvent.fromFieldsWithTypes(content);
|
|
2303
|
+
};
|
|
2304
|
+
NewLiquidityPoolEvent.fromSuiObjectData = function (data) {
|
|
2305
|
+
if (data.bcs) {
|
|
2306
|
+
if (data.bcs.dataType !== "moveObject" || !isNewLiquidityPoolEvent(data.bcs.type)) {
|
|
2307
|
+
throw new Error("object at is not a NewLiquidityPoolEvent object");
|
|
2308
|
+
}
|
|
2309
|
+
return NewLiquidityPoolEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
2310
|
+
}
|
|
2311
|
+
if (data.content) {
|
|
2312
|
+
return NewLiquidityPoolEvent.fromSuiParsedData(data.content);
|
|
2313
|
+
}
|
|
2314
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
2315
|
+
};
|
|
2316
|
+
NewLiquidityPoolEvent.fetch = function (client, id) {
|
|
2317
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2318
|
+
var res;
|
|
2319
|
+
var _a, _b;
|
|
2320
|
+
return __generator(this, function (_c) {
|
|
2321
|
+
switch (_c.label) {
|
|
2322
|
+
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
2323
|
+
case 1:
|
|
2324
|
+
res = _c.sent();
|
|
2325
|
+
if (res.error) {
|
|
2326
|
+
throw new Error("error fetching NewLiquidityPoolEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
2327
|
+
}
|
|
2328
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isNewLiquidityPoolEvent(res.data.bcs.type)) {
|
|
2329
|
+
throw new Error("object at id ".concat(id, " is not a NewLiquidityPoolEvent object"));
|
|
2330
|
+
}
|
|
2331
|
+
return [2 /*return*/, NewLiquidityPoolEvent.fromSuiObjectData(res.data)];
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
});
|
|
2335
|
+
};
|
|
2336
|
+
NewLiquidityPoolEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::NewLiquidityPoolEvent");
|
|
2337
|
+
NewLiquidityPoolEvent.$numTypeParams = 0;
|
|
2338
|
+
NewLiquidityPoolEvent.$isPhantom = [];
|
|
2339
|
+
return NewLiquidityPoolEvent;
|
|
2340
|
+
}());
|
|
2341
|
+
exports.NewLiquidityPoolEvent = NewLiquidityPoolEvent;
|
|
2342
|
+
/* ============================== Registry =============================== */
|
|
2343
|
+
function isRegistry(type) {
|
|
2344
|
+
type = (0, util_1.compressSuiType)(type);
|
|
2345
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::Registry");
|
|
2346
|
+
}
|
|
2347
|
+
var Registry = /** @class */ (function () {
|
|
2348
|
+
function Registry(typeArgs, fields) {
|
|
2349
|
+
this.__StructClass = true;
|
|
2350
|
+
this.$typeName = Registry.$typeName;
|
|
2351
|
+
this.$isPhantom = Registry.$isPhantom;
|
|
2352
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Registry.$typeName], __read(typeArgs), false));
|
|
2353
|
+
this.$typeArgs = typeArgs;
|
|
2354
|
+
this.id = fields.id;
|
|
2355
|
+
this.numPool = fields.numPool;
|
|
2356
|
+
this.liquidityPoolRegistry = fields.liquidityPoolRegistry;
|
|
2357
|
+
}
|
|
2358
|
+
Registry.reified = function () {
|
|
2359
|
+
var _this = this;
|
|
2360
|
+
return {
|
|
2361
|
+
typeName: Registry.$typeName,
|
|
2362
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Registry.$typeName], [], false)),
|
|
2363
|
+
typeArgs: [],
|
|
2364
|
+
isPhantom: Registry.$isPhantom,
|
|
2365
|
+
reifiedTypeArgs: [],
|
|
2366
|
+
fromFields: function (fields) { return Registry.fromFields(fields); },
|
|
2367
|
+
fromFieldsWithTypes: function (item) { return Registry.fromFieldsWithTypes(item); },
|
|
2368
|
+
fromBcs: function (data) { return Registry.fromBcs(data); },
|
|
2369
|
+
bcs: Registry.bcs,
|
|
2370
|
+
fromJSONField: function (field) { return Registry.fromJSONField(field); },
|
|
2371
|
+
fromJSON: function (json) { return Registry.fromJSON(json); },
|
|
2372
|
+
fromSuiParsedData: function (content) { return Registry.fromSuiParsedData(content); },
|
|
2373
|
+
fromSuiObjectData: function (content) { return Registry.fromSuiObjectData(content); },
|
|
2374
|
+
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
2375
|
+
return [2 /*return*/, Registry.fetch(client, id)];
|
|
2376
|
+
}); }); },
|
|
2377
|
+
new: function (fields) {
|
|
2378
|
+
return new Registry([], fields);
|
|
2379
|
+
},
|
|
2380
|
+
kind: "StructClassReified",
|
|
2381
|
+
};
|
|
2382
|
+
};
|
|
2383
|
+
Object.defineProperty(Registry, "r", {
|
|
2384
|
+
get: function () {
|
|
2385
|
+
return Registry.reified();
|
|
2386
|
+
},
|
|
2387
|
+
enumerable: false,
|
|
2388
|
+
configurable: true
|
|
2389
|
+
});
|
|
2390
|
+
Registry.phantom = function () {
|
|
2391
|
+
return (0, reified_1.phantom)(Registry.reified());
|
|
2392
|
+
};
|
|
2393
|
+
Object.defineProperty(Registry, "p", {
|
|
2394
|
+
get: function () {
|
|
2395
|
+
return Registry.phantom();
|
|
2396
|
+
},
|
|
2397
|
+
enumerable: false,
|
|
2398
|
+
configurable: true
|
|
2399
|
+
});
|
|
2400
|
+
Object.defineProperty(Registry, "bcs", {
|
|
2401
|
+
get: function () {
|
|
2402
|
+
return bcs_1.bcs.struct("Registry", {
|
|
2403
|
+
id: structs_2.UID.bcs,
|
|
2404
|
+
num_pool: bcs_1.bcs.u64(),
|
|
2405
|
+
liquidity_pool_registry: structs_2.UID.bcs,
|
|
2406
|
+
});
|
|
2407
|
+
},
|
|
2408
|
+
enumerable: false,
|
|
2409
|
+
configurable: true
|
|
2410
|
+
});
|
|
2411
|
+
Registry.fromFields = function (fields) {
|
|
2412
|
+
return Registry.reified().new({
|
|
2413
|
+
id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
|
|
2414
|
+
numPool: (0, reified_1.decodeFromFields)("u64", fields.num_pool),
|
|
2415
|
+
liquidityPoolRegistry: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.liquidity_pool_registry),
|
|
2416
|
+
});
|
|
2417
|
+
};
|
|
2418
|
+
Registry.fromFieldsWithTypes = function (item) {
|
|
2419
|
+
if (!isRegistry(item.type)) {
|
|
2420
|
+
throw new Error("not a Registry type");
|
|
2419
2421
|
}
|
|
2420
|
-
return
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
lpTokenDecimal: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lp_token_decimal),
|
|
2425
|
-
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
2422
|
+
return Registry.reified().new({
|
|
2423
|
+
id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
|
|
2424
|
+
numPool: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.num_pool),
|
|
2425
|
+
liquidityPoolRegistry: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.liquidity_pool_registry),
|
|
2426
2426
|
});
|
|
2427
2427
|
};
|
|
2428
|
-
|
|
2429
|
-
return
|
|
2428
|
+
Registry.fromBcs = function (data) {
|
|
2429
|
+
return Registry.fromFields(Registry.bcs.parse(data));
|
|
2430
2430
|
};
|
|
2431
|
-
|
|
2431
|
+
Registry.prototype.toJSONField = function () {
|
|
2432
2432
|
return {
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
lpTokenDecimal: this.lpTokenDecimal.toString(),
|
|
2437
|
-
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
2433
|
+
id: this.id,
|
|
2434
|
+
numPool: this.numPool.toString(),
|
|
2435
|
+
liquidityPoolRegistry: this.liquidityPoolRegistry,
|
|
2438
2436
|
};
|
|
2439
2437
|
};
|
|
2440
|
-
|
|
2438
|
+
Registry.prototype.toJSON = function () {
|
|
2441
2439
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
2442
2440
|
};
|
|
2443
|
-
|
|
2444
|
-
return
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
lpTokenDecimal: (0, reified_1.decodeFromJSONField)("u64", field.lpTokenDecimal),
|
|
2449
|
-
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
2441
|
+
Registry.fromJSONField = function (field) {
|
|
2442
|
+
return Registry.reified().new({
|
|
2443
|
+
id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
|
|
2444
|
+
numPool: (0, reified_1.decodeFromJSONField)("u64", field.numPool),
|
|
2445
|
+
liquidityPoolRegistry: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.liquidityPoolRegistry),
|
|
2450
2446
|
});
|
|
2451
2447
|
};
|
|
2452
|
-
|
|
2453
|
-
if (json.$typeName !==
|
|
2448
|
+
Registry.fromJSON = function (json) {
|
|
2449
|
+
if (json.$typeName !== Registry.$typeName) {
|
|
2454
2450
|
throw new Error("not a WithTwoGenerics json object");
|
|
2455
2451
|
}
|
|
2456
|
-
return
|
|
2452
|
+
return Registry.fromJSONField(json);
|
|
2457
2453
|
};
|
|
2458
|
-
|
|
2454
|
+
Registry.fromSuiParsedData = function (content) {
|
|
2459
2455
|
if (content.dataType !== "moveObject") {
|
|
2460
2456
|
throw new Error("not an object");
|
|
2461
2457
|
}
|
|
2462
|
-
if (!
|
|
2463
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
2458
|
+
if (!isRegistry(content.type)) {
|
|
2459
|
+
throw new Error("object at ".concat(content.fields.id, " is not a Registry object"));
|
|
2464
2460
|
}
|
|
2465
|
-
return
|
|
2461
|
+
return Registry.fromFieldsWithTypes(content);
|
|
2466
2462
|
};
|
|
2467
|
-
|
|
2463
|
+
Registry.fromSuiObjectData = function (data) {
|
|
2468
2464
|
if (data.bcs) {
|
|
2469
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
2470
|
-
throw new Error("object at is not a
|
|
2465
|
+
if (data.bcs.dataType !== "moveObject" || !isRegistry(data.bcs.type)) {
|
|
2466
|
+
throw new Error("object at is not a Registry object");
|
|
2471
2467
|
}
|
|
2472
|
-
return
|
|
2468
|
+
return Registry.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
2473
2469
|
}
|
|
2474
2470
|
if (data.content) {
|
|
2475
|
-
return
|
|
2471
|
+
return Registry.fromSuiParsedData(data.content);
|
|
2476
2472
|
}
|
|
2477
2473
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
2478
2474
|
};
|
|
2479
|
-
|
|
2475
|
+
Registry.fetch = function (client, id) {
|
|
2480
2476
|
return __awaiter(this, void 0, void 0, function () {
|
|
2481
2477
|
var res;
|
|
2482
2478
|
var _a, _b;
|
|
@@ -2486,22 +2482,22 @@ var NewLiquidityPoolEvent = /** @class */ (function () {
|
|
|
2486
2482
|
case 1:
|
|
2487
2483
|
res = _c.sent();
|
|
2488
2484
|
if (res.error) {
|
|
2489
|
-
throw new Error("error fetching
|
|
2485
|
+
throw new Error("error fetching Registry object at id ".concat(id, ": ").concat(res.error.code));
|
|
2490
2486
|
}
|
|
2491
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
2492
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
2487
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isRegistry(res.data.bcs.type)) {
|
|
2488
|
+
throw new Error("object at id ".concat(id, " is not a Registry object"));
|
|
2493
2489
|
}
|
|
2494
|
-
return [2 /*return*/,
|
|
2490
|
+
return [2 /*return*/, Registry.fromSuiObjectData(res.data)];
|
|
2495
2491
|
}
|
|
2496
2492
|
});
|
|
2497
2493
|
});
|
|
2498
2494
|
};
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
return
|
|
2495
|
+
Registry.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::Registry");
|
|
2496
|
+
Registry.$numTypeParams = 0;
|
|
2497
|
+
Registry.$isPhantom = [];
|
|
2498
|
+
return Registry;
|
|
2503
2499
|
}());
|
|
2504
|
-
exports.
|
|
2500
|
+
exports.Registry = Registry;
|
|
2505
2501
|
/* ============================== RemoveLiquidityTokenProcess =============================== */
|
|
2506
2502
|
function isRemoveLiquidityTokenProcess(type) {
|
|
2507
2503
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -3240,118 +3236,325 @@ var StartRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
|
3240
3236
|
typeName: StartRemoveLiquidityTokenProcessEvent.$typeName,
|
|
3241
3237
|
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([StartRemoveLiquidityTokenProcessEvent.$typeName], [], false)),
|
|
3242
3238
|
typeArgs: [],
|
|
3243
|
-
isPhantom: StartRemoveLiquidityTokenProcessEvent.$isPhantom,
|
|
3239
|
+
isPhantom: StartRemoveLiquidityTokenProcessEvent.$isPhantom,
|
|
3240
|
+
reifiedTypeArgs: [],
|
|
3241
|
+
fromFields: function (fields) { return StartRemoveLiquidityTokenProcessEvent.fromFields(fields); },
|
|
3242
|
+
fromFieldsWithTypes: function (item) { return StartRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes(item); },
|
|
3243
|
+
fromBcs: function (data) { return StartRemoveLiquidityTokenProcessEvent.fromBcs(data); },
|
|
3244
|
+
bcs: StartRemoveLiquidityTokenProcessEvent.bcs,
|
|
3245
|
+
fromJSONField: function (field) { return StartRemoveLiquidityTokenProcessEvent.fromJSONField(field); },
|
|
3246
|
+
fromJSON: function (json) { return StartRemoveLiquidityTokenProcessEvent.fromJSON(json); },
|
|
3247
|
+
fromSuiParsedData: function (content) { return StartRemoveLiquidityTokenProcessEvent.fromSuiParsedData(content); },
|
|
3248
|
+
fromSuiObjectData: function (content) { return StartRemoveLiquidityTokenProcessEvent.fromSuiObjectData(content); },
|
|
3249
|
+
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3250
|
+
return [2 /*return*/, StartRemoveLiquidityTokenProcessEvent.fetch(client, id)];
|
|
3251
|
+
}); }); },
|
|
3252
|
+
new: function (fields) {
|
|
3253
|
+
return new StartRemoveLiquidityTokenProcessEvent([], fields);
|
|
3254
|
+
},
|
|
3255
|
+
kind: "StructClassReified",
|
|
3256
|
+
};
|
|
3257
|
+
};
|
|
3258
|
+
Object.defineProperty(StartRemoveLiquidityTokenProcessEvent, "r", {
|
|
3259
|
+
get: function () {
|
|
3260
|
+
return StartRemoveLiquidityTokenProcessEvent.reified();
|
|
3261
|
+
},
|
|
3262
|
+
enumerable: false,
|
|
3263
|
+
configurable: true
|
|
3264
|
+
});
|
|
3265
|
+
StartRemoveLiquidityTokenProcessEvent.phantom = function () {
|
|
3266
|
+
return (0, reified_1.phantom)(StartRemoveLiquidityTokenProcessEvent.reified());
|
|
3267
|
+
};
|
|
3268
|
+
Object.defineProperty(StartRemoveLiquidityTokenProcessEvent, "p", {
|
|
3269
|
+
get: function () {
|
|
3270
|
+
return StartRemoveLiquidityTokenProcessEvent.phantom();
|
|
3271
|
+
},
|
|
3272
|
+
enumerable: false,
|
|
3273
|
+
configurable: true
|
|
3274
|
+
});
|
|
3275
|
+
Object.defineProperty(StartRemoveLiquidityTokenProcessEvent, "bcs", {
|
|
3276
|
+
get: function () {
|
|
3277
|
+
return bcs_1.bcs.struct("StartRemoveLiquidityTokenProcessEvent", {
|
|
3278
|
+
index: bcs_1.bcs.u64(),
|
|
3279
|
+
liquidity_token: structs_1.TypeName.bcs,
|
|
3280
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
3281
|
+
});
|
|
3282
|
+
},
|
|
3283
|
+
enumerable: false,
|
|
3284
|
+
configurable: true
|
|
3285
|
+
});
|
|
3286
|
+
StartRemoveLiquidityTokenProcessEvent.fromFields = function (fields) {
|
|
3287
|
+
return StartRemoveLiquidityTokenProcessEvent.reified().new({
|
|
3288
|
+
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
3289
|
+
liquidityToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.liquidity_token),
|
|
3290
|
+
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
3291
|
+
});
|
|
3292
|
+
};
|
|
3293
|
+
StartRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes = function (item) {
|
|
3294
|
+
if (!isStartRemoveLiquidityTokenProcessEvent(item.type)) {
|
|
3295
|
+
throw new Error("not a StartRemoveLiquidityTokenProcessEvent type");
|
|
3296
|
+
}
|
|
3297
|
+
return StartRemoveLiquidityTokenProcessEvent.reified().new({
|
|
3298
|
+
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
3299
|
+
liquidityToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.liquidity_token),
|
|
3300
|
+
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
3301
|
+
});
|
|
3302
|
+
};
|
|
3303
|
+
StartRemoveLiquidityTokenProcessEvent.fromBcs = function (data) {
|
|
3304
|
+
return StartRemoveLiquidityTokenProcessEvent.fromFields(StartRemoveLiquidityTokenProcessEvent.bcs.parse(data));
|
|
3305
|
+
};
|
|
3306
|
+
StartRemoveLiquidityTokenProcessEvent.prototype.toJSONField = function () {
|
|
3307
|
+
return {
|
|
3308
|
+
index: this.index.toString(),
|
|
3309
|
+
liquidityToken: this.liquidityToken.toJSONField(),
|
|
3310
|
+
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
3311
|
+
};
|
|
3312
|
+
};
|
|
3313
|
+
StartRemoveLiquidityTokenProcessEvent.prototype.toJSON = function () {
|
|
3314
|
+
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
3315
|
+
};
|
|
3316
|
+
StartRemoveLiquidityTokenProcessEvent.fromJSONField = function (field) {
|
|
3317
|
+
return StartRemoveLiquidityTokenProcessEvent.reified().new({
|
|
3318
|
+
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
3319
|
+
liquidityToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.liquidityToken),
|
|
3320
|
+
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
3321
|
+
});
|
|
3322
|
+
};
|
|
3323
|
+
StartRemoveLiquidityTokenProcessEvent.fromJSON = function (json) {
|
|
3324
|
+
if (json.$typeName !== StartRemoveLiquidityTokenProcessEvent.$typeName) {
|
|
3325
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
3326
|
+
}
|
|
3327
|
+
return StartRemoveLiquidityTokenProcessEvent.fromJSONField(json);
|
|
3328
|
+
};
|
|
3329
|
+
StartRemoveLiquidityTokenProcessEvent.fromSuiParsedData = function (content) {
|
|
3330
|
+
if (content.dataType !== "moveObject") {
|
|
3331
|
+
throw new Error("not an object");
|
|
3332
|
+
}
|
|
3333
|
+
if (!isStartRemoveLiquidityTokenProcessEvent(content.type)) {
|
|
3334
|
+
throw new Error("object at ".concat(content.fields.id, " is not a StartRemoveLiquidityTokenProcessEvent object"));
|
|
3335
|
+
}
|
|
3336
|
+
return StartRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes(content);
|
|
3337
|
+
};
|
|
3338
|
+
StartRemoveLiquidityTokenProcessEvent.fromSuiObjectData = function (data) {
|
|
3339
|
+
if (data.bcs) {
|
|
3340
|
+
if (data.bcs.dataType !== "moveObject" || !isStartRemoveLiquidityTokenProcessEvent(data.bcs.type)) {
|
|
3341
|
+
throw new Error("object at is not a StartRemoveLiquidityTokenProcessEvent object");
|
|
3342
|
+
}
|
|
3343
|
+
return StartRemoveLiquidityTokenProcessEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
3344
|
+
}
|
|
3345
|
+
if (data.content) {
|
|
3346
|
+
return StartRemoveLiquidityTokenProcessEvent.fromSuiParsedData(data.content);
|
|
3347
|
+
}
|
|
3348
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
3349
|
+
};
|
|
3350
|
+
StartRemoveLiquidityTokenProcessEvent.fetch = function (client, id) {
|
|
3351
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3352
|
+
var res;
|
|
3353
|
+
var _a, _b;
|
|
3354
|
+
return __generator(this, function (_c) {
|
|
3355
|
+
switch (_c.label) {
|
|
3356
|
+
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
3357
|
+
case 1:
|
|
3358
|
+
res = _c.sent();
|
|
3359
|
+
if (res.error) {
|
|
3360
|
+
throw new Error("error fetching StartRemoveLiquidityTokenProcessEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
3361
|
+
}
|
|
3362
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isStartRemoveLiquidityTokenProcessEvent(res.data.bcs.type)) {
|
|
3363
|
+
throw new Error("object at id ".concat(id, " is not a StartRemoveLiquidityTokenProcessEvent object"));
|
|
3364
|
+
}
|
|
3365
|
+
return [2 /*return*/, StartRemoveLiquidityTokenProcessEvent.fromSuiObjectData(res.data)];
|
|
3366
|
+
}
|
|
3367
|
+
});
|
|
3368
|
+
});
|
|
3369
|
+
};
|
|
3370
|
+
StartRemoveLiquidityTokenProcessEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::StartRemoveLiquidityTokenProcessEvent");
|
|
3371
|
+
StartRemoveLiquidityTokenProcessEvent.$numTypeParams = 0;
|
|
3372
|
+
StartRemoveLiquidityTokenProcessEvent.$isPhantom = [];
|
|
3373
|
+
return StartRemoveLiquidityTokenProcessEvent;
|
|
3374
|
+
}());
|
|
3375
|
+
exports.StartRemoveLiquidityTokenProcessEvent = StartRemoveLiquidityTokenProcessEvent;
|
|
3376
|
+
/* ============================== State =============================== */
|
|
3377
|
+
function isState(type) {
|
|
3378
|
+
type = (0, util_1.compressSuiType)(type);
|
|
3379
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::State");
|
|
3380
|
+
}
|
|
3381
|
+
var State = /** @class */ (function () {
|
|
3382
|
+
function State(typeArgs, fields) {
|
|
3383
|
+
this.__StructClass = true;
|
|
3384
|
+
this.$typeName = State.$typeName;
|
|
3385
|
+
this.$isPhantom = State.$isPhantom;
|
|
3386
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([State.$typeName], __read(typeArgs), false));
|
|
3387
|
+
this.$typeArgs = typeArgs;
|
|
3388
|
+
this.liquidityAmount = fields.liquidityAmount;
|
|
3389
|
+
this.valueInUsd = fields.valueInUsd;
|
|
3390
|
+
this.reservedAmount = fields.reservedAmount;
|
|
3391
|
+
this.updateTsMs = fields.updateTsMs;
|
|
3392
|
+
this.isActive = fields.isActive;
|
|
3393
|
+
this.lastBorrowRateTsMs = fields.lastBorrowRateTsMs;
|
|
3394
|
+
this.cumulativeBorrowRate = fields.cumulativeBorrowRate;
|
|
3395
|
+
this.previousLastBorrowRateTsMs = fields.previousLastBorrowRateTsMs;
|
|
3396
|
+
this.previousCumulativeBorrowRate = fields.previousCumulativeBorrowRate;
|
|
3397
|
+
this.currentLendingAmount = fields.currentLendingAmount;
|
|
3398
|
+
this.u64Padding = fields.u64Padding;
|
|
3399
|
+
}
|
|
3400
|
+
State.reified = function () {
|
|
3401
|
+
var _this = this;
|
|
3402
|
+
return {
|
|
3403
|
+
typeName: State.$typeName,
|
|
3404
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([State.$typeName], [], false)),
|
|
3405
|
+
typeArgs: [],
|
|
3406
|
+
isPhantom: State.$isPhantom,
|
|
3244
3407
|
reifiedTypeArgs: [],
|
|
3245
|
-
fromFields: function (fields) { return
|
|
3246
|
-
fromFieldsWithTypes: function (item) { return
|
|
3247
|
-
fromBcs: function (data) { return
|
|
3248
|
-
bcs:
|
|
3249
|
-
fromJSONField: function (field) { return
|
|
3250
|
-
fromJSON: function (json) { return
|
|
3251
|
-
fromSuiParsedData: function (content) { return
|
|
3252
|
-
fromSuiObjectData: function (content) { return
|
|
3408
|
+
fromFields: function (fields) { return State.fromFields(fields); },
|
|
3409
|
+
fromFieldsWithTypes: function (item) { return State.fromFieldsWithTypes(item); },
|
|
3410
|
+
fromBcs: function (data) { return State.fromBcs(data); },
|
|
3411
|
+
bcs: State.bcs,
|
|
3412
|
+
fromJSONField: function (field) { return State.fromJSONField(field); },
|
|
3413
|
+
fromJSON: function (json) { return State.fromJSON(json); },
|
|
3414
|
+
fromSuiParsedData: function (content) { return State.fromSuiParsedData(content); },
|
|
3415
|
+
fromSuiObjectData: function (content) { return State.fromSuiObjectData(content); },
|
|
3253
3416
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3254
|
-
return [2 /*return*/,
|
|
3417
|
+
return [2 /*return*/, State.fetch(client, id)];
|
|
3255
3418
|
}); }); },
|
|
3256
3419
|
new: function (fields) {
|
|
3257
|
-
return new
|
|
3420
|
+
return new State([], fields);
|
|
3258
3421
|
},
|
|
3259
3422
|
kind: "StructClassReified",
|
|
3260
3423
|
};
|
|
3261
3424
|
};
|
|
3262
|
-
Object.defineProperty(
|
|
3425
|
+
Object.defineProperty(State, "r", {
|
|
3263
3426
|
get: function () {
|
|
3264
|
-
return
|
|
3427
|
+
return State.reified();
|
|
3265
3428
|
},
|
|
3266
3429
|
enumerable: false,
|
|
3267
3430
|
configurable: true
|
|
3268
3431
|
});
|
|
3269
|
-
|
|
3270
|
-
return (0, reified_1.phantom)(
|
|
3432
|
+
State.phantom = function () {
|
|
3433
|
+
return (0, reified_1.phantom)(State.reified());
|
|
3271
3434
|
};
|
|
3272
|
-
Object.defineProperty(
|
|
3435
|
+
Object.defineProperty(State, "p", {
|
|
3273
3436
|
get: function () {
|
|
3274
|
-
return
|
|
3437
|
+
return State.phantom();
|
|
3275
3438
|
},
|
|
3276
3439
|
enumerable: false,
|
|
3277
3440
|
configurable: true
|
|
3278
3441
|
});
|
|
3279
|
-
Object.defineProperty(
|
|
3442
|
+
Object.defineProperty(State, "bcs", {
|
|
3280
3443
|
get: function () {
|
|
3281
|
-
return bcs_1.bcs.struct("
|
|
3282
|
-
|
|
3283
|
-
|
|
3444
|
+
return bcs_1.bcs.struct("State", {
|
|
3445
|
+
liquidity_amount: bcs_1.bcs.u64(),
|
|
3446
|
+
value_in_usd: bcs_1.bcs.u64(),
|
|
3447
|
+
reserved_amount: bcs_1.bcs.u64(),
|
|
3448
|
+
update_ts_ms: bcs_1.bcs.u64(),
|
|
3449
|
+
is_active: bcs_1.bcs.bool(),
|
|
3450
|
+
last_borrow_rate_ts_ms: bcs_1.bcs.u64(),
|
|
3451
|
+
cumulative_borrow_rate: bcs_1.bcs.u64(),
|
|
3452
|
+
previous_last_borrow_rate_ts_ms: bcs_1.bcs.u64(),
|
|
3453
|
+
previous_cumulative_borrow_rate: bcs_1.bcs.u64(),
|
|
3454
|
+
current_lending_amount: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
3284
3455
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
3285
3456
|
});
|
|
3286
3457
|
},
|
|
3287
3458
|
enumerable: false,
|
|
3288
3459
|
configurable: true
|
|
3289
3460
|
});
|
|
3290
|
-
|
|
3291
|
-
return
|
|
3292
|
-
|
|
3293
|
-
|
|
3461
|
+
State.fromFields = function (fields) {
|
|
3462
|
+
return State.reified().new({
|
|
3463
|
+
liquidityAmount: (0, reified_1.decodeFromFields)("u64", fields.liquidity_amount),
|
|
3464
|
+
valueInUsd: (0, reified_1.decodeFromFields)("u64", fields.value_in_usd),
|
|
3465
|
+
reservedAmount: (0, reified_1.decodeFromFields)("u64", fields.reserved_amount),
|
|
3466
|
+
updateTsMs: (0, reified_1.decodeFromFields)("u64", fields.update_ts_ms),
|
|
3467
|
+
isActive: (0, reified_1.decodeFromFields)("bool", fields.is_active),
|
|
3468
|
+
lastBorrowRateTsMs: (0, reified_1.decodeFromFields)("u64", fields.last_borrow_rate_ts_ms),
|
|
3469
|
+
cumulativeBorrowRate: (0, reified_1.decodeFromFields)("u64", fields.cumulative_borrow_rate),
|
|
3470
|
+
previousLastBorrowRateTsMs: (0, reified_1.decodeFromFields)("u64", fields.previous_last_borrow_rate_ts_ms),
|
|
3471
|
+
previousCumulativeBorrowRate: (0, reified_1.decodeFromFields)("u64", fields.previous_cumulative_borrow_rate),
|
|
3472
|
+
currentLendingAmount: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.current_lending_amount),
|
|
3294
3473
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
3295
3474
|
});
|
|
3296
3475
|
};
|
|
3297
|
-
|
|
3298
|
-
if (!
|
|
3299
|
-
throw new Error("not a
|
|
3476
|
+
State.fromFieldsWithTypes = function (item) {
|
|
3477
|
+
if (!isState(item.type)) {
|
|
3478
|
+
throw new Error("not a State type");
|
|
3300
3479
|
}
|
|
3301
|
-
return
|
|
3302
|
-
|
|
3303
|
-
|
|
3480
|
+
return State.reified().new({
|
|
3481
|
+
liquidityAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.liquidity_amount),
|
|
3482
|
+
valueInUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.value_in_usd),
|
|
3483
|
+
reservedAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.reserved_amount),
|
|
3484
|
+
updateTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.update_ts_ms),
|
|
3485
|
+
isActive: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.is_active),
|
|
3486
|
+
lastBorrowRateTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.last_borrow_rate_ts_ms),
|
|
3487
|
+
cumulativeBorrowRate: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.cumulative_borrow_rate),
|
|
3488
|
+
previousLastBorrowRateTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.previous_last_borrow_rate_ts_ms),
|
|
3489
|
+
previousCumulativeBorrowRate: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.previous_cumulative_borrow_rate),
|
|
3490
|
+
currentLendingAmount: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.current_lending_amount),
|
|
3304
3491
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
3305
3492
|
});
|
|
3306
3493
|
};
|
|
3307
|
-
|
|
3308
|
-
return
|
|
3494
|
+
State.fromBcs = function (data) {
|
|
3495
|
+
return State.fromFields(State.bcs.parse(data));
|
|
3309
3496
|
};
|
|
3310
|
-
|
|
3497
|
+
State.prototype.toJSONField = function () {
|
|
3311
3498
|
return {
|
|
3312
|
-
|
|
3313
|
-
|
|
3499
|
+
liquidityAmount: this.liquidityAmount.toString(),
|
|
3500
|
+
valueInUsd: this.valueInUsd.toString(),
|
|
3501
|
+
reservedAmount: this.reservedAmount.toString(),
|
|
3502
|
+
updateTsMs: this.updateTsMs.toString(),
|
|
3503
|
+
isActive: this.isActive,
|
|
3504
|
+
lastBorrowRateTsMs: this.lastBorrowRateTsMs.toString(),
|
|
3505
|
+
cumulativeBorrowRate: this.cumulativeBorrowRate.toString(),
|
|
3506
|
+
previousLastBorrowRateTsMs: this.previousLastBorrowRateTsMs.toString(),
|
|
3507
|
+
previousCumulativeBorrowRate: this.previousCumulativeBorrowRate.toString(),
|
|
3508
|
+
currentLendingAmount: (0, reified_1.fieldToJSON)("vector<u64>", this.currentLendingAmount),
|
|
3314
3509
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
3315
3510
|
};
|
|
3316
3511
|
};
|
|
3317
|
-
|
|
3512
|
+
State.prototype.toJSON = function () {
|
|
3318
3513
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
3319
3514
|
};
|
|
3320
|
-
|
|
3321
|
-
return
|
|
3322
|
-
|
|
3323
|
-
|
|
3515
|
+
State.fromJSONField = function (field) {
|
|
3516
|
+
return State.reified().new({
|
|
3517
|
+
liquidityAmount: (0, reified_1.decodeFromJSONField)("u64", field.liquidityAmount),
|
|
3518
|
+
valueInUsd: (0, reified_1.decodeFromJSONField)("u64", field.valueInUsd),
|
|
3519
|
+
reservedAmount: (0, reified_1.decodeFromJSONField)("u64", field.reservedAmount),
|
|
3520
|
+
updateTsMs: (0, reified_1.decodeFromJSONField)("u64", field.updateTsMs),
|
|
3521
|
+
isActive: (0, reified_1.decodeFromJSONField)("bool", field.isActive),
|
|
3522
|
+
lastBorrowRateTsMs: (0, reified_1.decodeFromJSONField)("u64", field.lastBorrowRateTsMs),
|
|
3523
|
+
cumulativeBorrowRate: (0, reified_1.decodeFromJSONField)("u64", field.cumulativeBorrowRate),
|
|
3524
|
+
previousLastBorrowRateTsMs: (0, reified_1.decodeFromJSONField)("u64", field.previousLastBorrowRateTsMs),
|
|
3525
|
+
previousCumulativeBorrowRate: (0, reified_1.decodeFromJSONField)("u64", field.previousCumulativeBorrowRate),
|
|
3526
|
+
currentLendingAmount: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.currentLendingAmount),
|
|
3324
3527
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
3325
3528
|
});
|
|
3326
3529
|
};
|
|
3327
|
-
|
|
3328
|
-
if (json.$typeName !==
|
|
3530
|
+
State.fromJSON = function (json) {
|
|
3531
|
+
if (json.$typeName !== State.$typeName) {
|
|
3329
3532
|
throw new Error("not a WithTwoGenerics json object");
|
|
3330
3533
|
}
|
|
3331
|
-
return
|
|
3534
|
+
return State.fromJSONField(json);
|
|
3332
3535
|
};
|
|
3333
|
-
|
|
3536
|
+
State.fromSuiParsedData = function (content) {
|
|
3334
3537
|
if (content.dataType !== "moveObject") {
|
|
3335
3538
|
throw new Error("not an object");
|
|
3336
3539
|
}
|
|
3337
|
-
if (!
|
|
3338
|
-
throw new Error("object at ".concat(content.fields.id, " is not a
|
|
3540
|
+
if (!isState(content.type)) {
|
|
3541
|
+
throw new Error("object at ".concat(content.fields.id, " is not a State object"));
|
|
3339
3542
|
}
|
|
3340
|
-
return
|
|
3543
|
+
return State.fromFieldsWithTypes(content);
|
|
3341
3544
|
};
|
|
3342
|
-
|
|
3545
|
+
State.fromSuiObjectData = function (data) {
|
|
3343
3546
|
if (data.bcs) {
|
|
3344
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
3345
|
-
throw new Error("object at is not a
|
|
3547
|
+
if (data.bcs.dataType !== "moveObject" || !isState(data.bcs.type)) {
|
|
3548
|
+
throw new Error("object at is not a State object");
|
|
3346
3549
|
}
|
|
3347
|
-
return
|
|
3550
|
+
return State.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
3348
3551
|
}
|
|
3349
3552
|
if (data.content) {
|
|
3350
|
-
return
|
|
3553
|
+
return State.fromSuiParsedData(data.content);
|
|
3351
3554
|
}
|
|
3352
3555
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
3353
3556
|
};
|
|
3354
|
-
|
|
3557
|
+
State.fetch = function (client, id) {
|
|
3355
3558
|
return __awaiter(this, void 0, void 0, function () {
|
|
3356
3559
|
var res;
|
|
3357
3560
|
var _a, _b;
|
|
@@ -3361,22 +3564,22 @@ var StartRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
|
3361
3564
|
case 1:
|
|
3362
3565
|
res = _c.sent();
|
|
3363
3566
|
if (res.error) {
|
|
3364
|
-
throw new Error("error fetching
|
|
3567
|
+
throw new Error("error fetching State object at id ".concat(id, ": ").concat(res.error.code));
|
|
3365
3568
|
}
|
|
3366
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
3367
|
-
throw new Error("object at id ".concat(id, " is not a
|
|
3569
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isState(res.data.bcs.type)) {
|
|
3570
|
+
throw new Error("object at id ".concat(id, " is not a State object"));
|
|
3368
3571
|
}
|
|
3369
|
-
return [2 /*return*/,
|
|
3572
|
+
return [2 /*return*/, State.fromSuiObjectData(res.data)];
|
|
3370
3573
|
}
|
|
3371
3574
|
});
|
|
3372
3575
|
});
|
|
3373
3576
|
};
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
return
|
|
3577
|
+
State.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::State");
|
|
3578
|
+
State.$numTypeParams = 0;
|
|
3579
|
+
State.$isPhantom = [];
|
|
3580
|
+
return State;
|
|
3378
3581
|
}());
|
|
3379
|
-
exports.
|
|
3582
|
+
exports.State = State;
|
|
3380
3583
|
/* ============================== SuspendPoolEvent =============================== */
|
|
3381
3584
|
function isSuspendPoolEvent(type) {
|
|
3382
3585
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -4799,3 +5002,234 @@ var UpdateSpotConfigEvent = /** @class */ (function () {
|
|
|
4799
5002
|
return UpdateSpotConfigEvent;
|
|
4800
5003
|
}());
|
|
4801
5004
|
exports.UpdateSpotConfigEvent = UpdateSpotConfigEvent;
|
|
5005
|
+
/* ============================== WithdrawLendingEvent =============================== */
|
|
5006
|
+
function isWithdrawLendingEvent(type) {
|
|
5007
|
+
type = (0, util_1.compressSuiType)(type);
|
|
5008
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::WithdrawLendingEvent");
|
|
5009
|
+
}
|
|
5010
|
+
var WithdrawLendingEvent = /** @class */ (function () {
|
|
5011
|
+
function WithdrawLendingEvent(typeArgs, fields) {
|
|
5012
|
+
this.__StructClass = true;
|
|
5013
|
+
this.$typeName = WithdrawLendingEvent.$typeName;
|
|
5014
|
+
this.$isPhantom = WithdrawLendingEvent.$isPhantom;
|
|
5015
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([WithdrawLendingEvent.$typeName], __read(typeArgs), false));
|
|
5016
|
+
this.$typeArgs = typeArgs;
|
|
5017
|
+
this.index = fields.index;
|
|
5018
|
+
this.lendingIndex = fields.lendingIndex;
|
|
5019
|
+
this.cTokenType = fields.cTokenType;
|
|
5020
|
+
this.rTokenType = fields.rTokenType;
|
|
5021
|
+
this.withdrawAmount = fields.withdrawAmount;
|
|
5022
|
+
this.withdrawnCollateralAmount = fields.withdrawnCollateralAmount;
|
|
5023
|
+
this.latestLendingAmount = fields.latestLendingAmount;
|
|
5024
|
+
this.latestMarketCoinAmount = fields.latestMarketCoinAmount;
|
|
5025
|
+
this.latestReservedAmount = fields.latestReservedAmount;
|
|
5026
|
+
this.latestLiquidityAmount = fields.latestLiquidityAmount;
|
|
5027
|
+
this.lendingInterest = fields.lendingInterest;
|
|
5028
|
+
this.protocolShare = fields.protocolShare;
|
|
5029
|
+
this.lendingReward = fields.lendingReward;
|
|
5030
|
+
this.rewardProtocolShare = fields.rewardProtocolShare;
|
|
5031
|
+
this.u64Padding = fields.u64Padding;
|
|
5032
|
+
}
|
|
5033
|
+
WithdrawLendingEvent.reified = function () {
|
|
5034
|
+
var _this = this;
|
|
5035
|
+
return {
|
|
5036
|
+
typeName: WithdrawLendingEvent.$typeName,
|
|
5037
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([WithdrawLendingEvent.$typeName], [], false)),
|
|
5038
|
+
typeArgs: [],
|
|
5039
|
+
isPhantom: WithdrawLendingEvent.$isPhantom,
|
|
5040
|
+
reifiedTypeArgs: [],
|
|
5041
|
+
fromFields: function (fields) { return WithdrawLendingEvent.fromFields(fields); },
|
|
5042
|
+
fromFieldsWithTypes: function (item) { return WithdrawLendingEvent.fromFieldsWithTypes(item); },
|
|
5043
|
+
fromBcs: function (data) { return WithdrawLendingEvent.fromBcs(data); },
|
|
5044
|
+
bcs: WithdrawLendingEvent.bcs,
|
|
5045
|
+
fromJSONField: function (field) { return WithdrawLendingEvent.fromJSONField(field); },
|
|
5046
|
+
fromJSON: function (json) { return WithdrawLendingEvent.fromJSON(json); },
|
|
5047
|
+
fromSuiParsedData: function (content) { return WithdrawLendingEvent.fromSuiParsedData(content); },
|
|
5048
|
+
fromSuiObjectData: function (content) { return WithdrawLendingEvent.fromSuiObjectData(content); },
|
|
5049
|
+
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
5050
|
+
return [2 /*return*/, WithdrawLendingEvent.fetch(client, id)];
|
|
5051
|
+
}); }); },
|
|
5052
|
+
new: function (fields) {
|
|
5053
|
+
return new WithdrawLendingEvent([], fields);
|
|
5054
|
+
},
|
|
5055
|
+
kind: "StructClassReified",
|
|
5056
|
+
};
|
|
5057
|
+
};
|
|
5058
|
+
Object.defineProperty(WithdrawLendingEvent, "r", {
|
|
5059
|
+
get: function () {
|
|
5060
|
+
return WithdrawLendingEvent.reified();
|
|
5061
|
+
},
|
|
5062
|
+
enumerable: false,
|
|
5063
|
+
configurable: true
|
|
5064
|
+
});
|
|
5065
|
+
WithdrawLendingEvent.phantom = function () {
|
|
5066
|
+
return (0, reified_1.phantom)(WithdrawLendingEvent.reified());
|
|
5067
|
+
};
|
|
5068
|
+
Object.defineProperty(WithdrawLendingEvent, "p", {
|
|
5069
|
+
get: function () {
|
|
5070
|
+
return WithdrawLendingEvent.phantom();
|
|
5071
|
+
},
|
|
5072
|
+
enumerable: false,
|
|
5073
|
+
configurable: true
|
|
5074
|
+
});
|
|
5075
|
+
Object.defineProperty(WithdrawLendingEvent, "bcs", {
|
|
5076
|
+
get: function () {
|
|
5077
|
+
return bcs_1.bcs.struct("WithdrawLendingEvent", {
|
|
5078
|
+
index: bcs_1.bcs.u64(),
|
|
5079
|
+
lending_index: bcs_1.bcs.u64(),
|
|
5080
|
+
c_token_type: structs_1.TypeName.bcs,
|
|
5081
|
+
r_token_type: structs_1.TypeName.bcs,
|
|
5082
|
+
withdraw_amount: bcs_1.bcs.u64(),
|
|
5083
|
+
withdrawn_collateral_amount: bcs_1.bcs.u64(),
|
|
5084
|
+
latest_lending_amount: bcs_1.bcs.u64(),
|
|
5085
|
+
latest_market_coin_amount: bcs_1.bcs.u64(),
|
|
5086
|
+
latest_reserved_amount: bcs_1.bcs.u64(),
|
|
5087
|
+
latest_liquidity_amount: bcs_1.bcs.u64(),
|
|
5088
|
+
lending_interest: bcs_1.bcs.u64(),
|
|
5089
|
+
protocol_share: bcs_1.bcs.u64(),
|
|
5090
|
+
lending_reward: bcs_1.bcs.u64(),
|
|
5091
|
+
reward_protocol_share: bcs_1.bcs.u64(),
|
|
5092
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
5093
|
+
});
|
|
5094
|
+
},
|
|
5095
|
+
enumerable: false,
|
|
5096
|
+
configurable: true
|
|
5097
|
+
});
|
|
5098
|
+
WithdrawLendingEvent.fromFields = function (fields) {
|
|
5099
|
+
return WithdrawLendingEvent.reified().new({
|
|
5100
|
+
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
5101
|
+
lendingIndex: (0, reified_1.decodeFromFields)("u64", fields.lending_index),
|
|
5102
|
+
cTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.c_token_type),
|
|
5103
|
+
rTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.r_token_type),
|
|
5104
|
+
withdrawAmount: (0, reified_1.decodeFromFields)("u64", fields.withdraw_amount),
|
|
5105
|
+
withdrawnCollateralAmount: (0, reified_1.decodeFromFields)("u64", fields.withdrawn_collateral_amount),
|
|
5106
|
+
latestLendingAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_lending_amount),
|
|
5107
|
+
latestMarketCoinAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_market_coin_amount),
|
|
5108
|
+
latestReservedAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_reserved_amount),
|
|
5109
|
+
latestLiquidityAmount: (0, reified_1.decodeFromFields)("u64", fields.latest_liquidity_amount),
|
|
5110
|
+
lendingInterest: (0, reified_1.decodeFromFields)("u64", fields.lending_interest),
|
|
5111
|
+
protocolShare: (0, reified_1.decodeFromFields)("u64", fields.protocol_share),
|
|
5112
|
+
lendingReward: (0, reified_1.decodeFromFields)("u64", fields.lending_reward),
|
|
5113
|
+
rewardProtocolShare: (0, reified_1.decodeFromFields)("u64", fields.reward_protocol_share),
|
|
5114
|
+
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
5115
|
+
});
|
|
5116
|
+
};
|
|
5117
|
+
WithdrawLendingEvent.fromFieldsWithTypes = function (item) {
|
|
5118
|
+
if (!isWithdrawLendingEvent(item.type)) {
|
|
5119
|
+
throw new Error("not a WithdrawLendingEvent type");
|
|
5120
|
+
}
|
|
5121
|
+
return WithdrawLendingEvent.reified().new({
|
|
5122
|
+
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
5123
|
+
lendingIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lending_index),
|
|
5124
|
+
cTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.c_token_type),
|
|
5125
|
+
rTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.r_token_type),
|
|
5126
|
+
withdrawAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.withdraw_amount),
|
|
5127
|
+
withdrawnCollateralAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.withdrawn_collateral_amount),
|
|
5128
|
+
latestLendingAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_lending_amount),
|
|
5129
|
+
latestMarketCoinAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_market_coin_amount),
|
|
5130
|
+
latestReservedAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_reserved_amount),
|
|
5131
|
+
latestLiquidityAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.latest_liquidity_amount),
|
|
5132
|
+
lendingInterest: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lending_interest),
|
|
5133
|
+
protocolShare: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.protocol_share),
|
|
5134
|
+
lendingReward: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lending_reward),
|
|
5135
|
+
rewardProtocolShare: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.reward_protocol_share),
|
|
5136
|
+
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
5137
|
+
});
|
|
5138
|
+
};
|
|
5139
|
+
WithdrawLendingEvent.fromBcs = function (data) {
|
|
5140
|
+
return WithdrawLendingEvent.fromFields(WithdrawLendingEvent.bcs.parse(data));
|
|
5141
|
+
};
|
|
5142
|
+
WithdrawLendingEvent.prototype.toJSONField = function () {
|
|
5143
|
+
return {
|
|
5144
|
+
index: this.index.toString(),
|
|
5145
|
+
lendingIndex: this.lendingIndex.toString(),
|
|
5146
|
+
cTokenType: this.cTokenType.toJSONField(),
|
|
5147
|
+
rTokenType: this.rTokenType.toJSONField(),
|
|
5148
|
+
withdrawAmount: this.withdrawAmount.toString(),
|
|
5149
|
+
withdrawnCollateralAmount: this.withdrawnCollateralAmount.toString(),
|
|
5150
|
+
latestLendingAmount: this.latestLendingAmount.toString(),
|
|
5151
|
+
latestMarketCoinAmount: this.latestMarketCoinAmount.toString(),
|
|
5152
|
+
latestReservedAmount: this.latestReservedAmount.toString(),
|
|
5153
|
+
latestLiquidityAmount: this.latestLiquidityAmount.toString(),
|
|
5154
|
+
lendingInterest: this.lendingInterest.toString(),
|
|
5155
|
+
protocolShare: this.protocolShare.toString(),
|
|
5156
|
+
lendingReward: this.lendingReward.toString(),
|
|
5157
|
+
rewardProtocolShare: this.rewardProtocolShare.toString(),
|
|
5158
|
+
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
5159
|
+
};
|
|
5160
|
+
};
|
|
5161
|
+
WithdrawLendingEvent.prototype.toJSON = function () {
|
|
5162
|
+
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
5163
|
+
};
|
|
5164
|
+
WithdrawLendingEvent.fromJSONField = function (field) {
|
|
5165
|
+
return WithdrawLendingEvent.reified().new({
|
|
5166
|
+
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
5167
|
+
lendingIndex: (0, reified_1.decodeFromJSONField)("u64", field.lendingIndex),
|
|
5168
|
+
cTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.cTokenType),
|
|
5169
|
+
rTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.rTokenType),
|
|
5170
|
+
withdrawAmount: (0, reified_1.decodeFromJSONField)("u64", field.withdrawAmount),
|
|
5171
|
+
withdrawnCollateralAmount: (0, reified_1.decodeFromJSONField)("u64", field.withdrawnCollateralAmount),
|
|
5172
|
+
latestLendingAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestLendingAmount),
|
|
5173
|
+
latestMarketCoinAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestMarketCoinAmount),
|
|
5174
|
+
latestReservedAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestReservedAmount),
|
|
5175
|
+
latestLiquidityAmount: (0, reified_1.decodeFromJSONField)("u64", field.latestLiquidityAmount),
|
|
5176
|
+
lendingInterest: (0, reified_1.decodeFromJSONField)("u64", field.lendingInterest),
|
|
5177
|
+
protocolShare: (0, reified_1.decodeFromJSONField)("u64", field.protocolShare),
|
|
5178
|
+
lendingReward: (0, reified_1.decodeFromJSONField)("u64", field.lendingReward),
|
|
5179
|
+
rewardProtocolShare: (0, reified_1.decodeFromJSONField)("u64", field.rewardProtocolShare),
|
|
5180
|
+
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
5181
|
+
});
|
|
5182
|
+
};
|
|
5183
|
+
WithdrawLendingEvent.fromJSON = function (json) {
|
|
5184
|
+
if (json.$typeName !== WithdrawLendingEvent.$typeName) {
|
|
5185
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
5186
|
+
}
|
|
5187
|
+
return WithdrawLendingEvent.fromJSONField(json);
|
|
5188
|
+
};
|
|
5189
|
+
WithdrawLendingEvent.fromSuiParsedData = function (content) {
|
|
5190
|
+
if (content.dataType !== "moveObject") {
|
|
5191
|
+
throw new Error("not an object");
|
|
5192
|
+
}
|
|
5193
|
+
if (!isWithdrawLendingEvent(content.type)) {
|
|
5194
|
+
throw new Error("object at ".concat(content.fields.id, " is not a WithdrawLendingEvent object"));
|
|
5195
|
+
}
|
|
5196
|
+
return WithdrawLendingEvent.fromFieldsWithTypes(content);
|
|
5197
|
+
};
|
|
5198
|
+
WithdrawLendingEvent.fromSuiObjectData = function (data) {
|
|
5199
|
+
if (data.bcs) {
|
|
5200
|
+
if (data.bcs.dataType !== "moveObject" || !isWithdrawLendingEvent(data.bcs.type)) {
|
|
5201
|
+
throw new Error("object at is not a WithdrawLendingEvent object");
|
|
5202
|
+
}
|
|
5203
|
+
return WithdrawLendingEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
5204
|
+
}
|
|
5205
|
+
if (data.content) {
|
|
5206
|
+
return WithdrawLendingEvent.fromSuiParsedData(data.content);
|
|
5207
|
+
}
|
|
5208
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
5209
|
+
};
|
|
5210
|
+
WithdrawLendingEvent.fetch = function (client, id) {
|
|
5211
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5212
|
+
var res;
|
|
5213
|
+
var _a, _b;
|
|
5214
|
+
return __generator(this, function (_c) {
|
|
5215
|
+
switch (_c.label) {
|
|
5216
|
+
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
5217
|
+
case 1:
|
|
5218
|
+
res = _c.sent();
|
|
5219
|
+
if (res.error) {
|
|
5220
|
+
throw new Error("error fetching WithdrawLendingEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
5221
|
+
}
|
|
5222
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isWithdrawLendingEvent(res.data.bcs.type)) {
|
|
5223
|
+
throw new Error("object at id ".concat(id, " is not a WithdrawLendingEvent object"));
|
|
5224
|
+
}
|
|
5225
|
+
return [2 /*return*/, WithdrawLendingEvent.fromSuiObjectData(res.data)];
|
|
5226
|
+
}
|
|
5227
|
+
});
|
|
5228
|
+
});
|
|
5229
|
+
};
|
|
5230
|
+
WithdrawLendingEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::WithdrawLendingEvent");
|
|
5231
|
+
WithdrawLendingEvent.$numTypeParams = 0;
|
|
5232
|
+
WithdrawLendingEvent.$isPhantom = [];
|
|
5233
|
+
return WithdrawLendingEvent;
|
|
5234
|
+
}());
|
|
5235
|
+
exports.WithdrawLendingEvent = WithdrawLendingEvent;
|