@typus/typus-perp-sdk 1.0.29 → 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/index.d.ts +6 -0
- package/dist/src/index.js +52 -12
- 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/index.d.ts +1 -3
- package/dist/src/typus_perp/index.js +3 -3
- 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 +661 -337
- package/dist/src/typus_perp/lp-pool/structs.js +1212 -766
- 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/dist/src/typus_stake_pool/index.d.ts +1 -3
- package/dist/src/typus_stake_pool/index.js +3 -3
- 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,357 +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;
|
|
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;
|
|
336
343
|
this.u64Padding = fields.u64Padding;
|
|
337
344
|
}
|
|
338
|
-
|
|
345
|
+
BurnLpEvent.reified = function () {
|
|
339
346
|
var _this = this;
|
|
340
347
|
return {
|
|
341
|
-
typeName:
|
|
342
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
348
|
+
typeName: BurnLpEvent.$typeName,
|
|
349
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([BurnLpEvent.$typeName], [], false)),
|
|
343
350
|
typeArgs: [],
|
|
344
|
-
isPhantom:
|
|
351
|
+
isPhantom: BurnLpEvent.$isPhantom,
|
|
345
352
|
reifiedTypeArgs: [],
|
|
346
|
-
fromFields: function (fields) { return
|
|
347
|
-
fromFieldsWithTypes: function (item) { return
|
|
348
|
-
fromBcs: function (data) { return
|
|
349
|
-
bcs:
|
|
350
|
-
fromJSONField: function (field) { return
|
|
351
|
-
fromJSON: function (json) { return
|
|
352
|
-
fromSuiParsedData: function (content) { return
|
|
353
|
-
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); },
|
|
354
361
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
355
|
-
return [2 /*return*/,
|
|
362
|
+
return [2 /*return*/, BurnLpEvent.fetch(client, id)];
|
|
356
363
|
}); }); },
|
|
357
364
|
new: function (fields) {
|
|
358
|
-
return new
|
|
365
|
+
return new BurnLpEvent([], fields);
|
|
359
366
|
},
|
|
360
367
|
kind: "StructClassReified",
|
|
361
368
|
};
|
|
362
369
|
};
|
|
363
|
-
Object.defineProperty(
|
|
370
|
+
Object.defineProperty(BurnLpEvent, "r", {
|
|
364
371
|
get: function () {
|
|
365
|
-
return
|
|
372
|
+
return BurnLpEvent.reified();
|
|
366
373
|
},
|
|
367
374
|
enumerable: false,
|
|
368
375
|
configurable: true
|
|
369
376
|
});
|
|
370
|
-
|
|
371
|
-
return (0, reified_1.phantom)(
|
|
372
|
-
};
|
|
373
|
-
Object.defineProperty(
|
|
377
|
+
BurnLpEvent.phantom = function () {
|
|
378
|
+
return (0, reified_1.phantom)(BurnLpEvent.reified());
|
|
379
|
+
};
|
|
380
|
+
Object.defineProperty(BurnLpEvent, "p", {
|
|
374
381
|
get: function () {
|
|
375
|
-
return
|
|
382
|
+
return BurnLpEvent.phantom();
|
|
376
383
|
},
|
|
377
384
|
enumerable: false,
|
|
378
385
|
configurable: true
|
|
379
386
|
});
|
|
380
|
-
Object.defineProperty(
|
|
387
|
+
Object.defineProperty(BurnLpEvent, "bcs", {
|
|
381
388
|
get: function () {
|
|
382
|
-
return bcs_1.bcs.struct("
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
previous_cumulative_borrow_rate: 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(),
|
|
392
398
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
393
399
|
});
|
|
394
400
|
},
|
|
395
401
|
enumerable: false,
|
|
396
402
|
configurable: true
|
|
397
403
|
});
|
|
398
|
-
|
|
399
|
-
return
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
previousCumulativeBorrowRate: (0, reified_1.decodeFromFields)("u64", fields.previous_cumulative_borrow_rate),
|
|
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),
|
|
409
414
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
410
415
|
});
|
|
411
416
|
};
|
|
412
|
-
|
|
413
|
-
if (!
|
|
414
|
-
throw new Error("not a
|
|
417
|
+
BurnLpEvent.fromFieldsWithTypes = function (item) {
|
|
418
|
+
if (!isBurnLpEvent(item.type)) {
|
|
419
|
+
throw new Error("not a BurnLpEvent type");
|
|
415
420
|
}
|
|
416
|
-
return
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
previousCumulativeBorrowRate: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.previous_cumulative_borrow_rate),
|
|
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),
|
|
426
430
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
427
431
|
});
|
|
428
432
|
};
|
|
429
|
-
|
|
430
|
-
return
|
|
433
|
+
BurnLpEvent.fromBcs = function (data) {
|
|
434
|
+
return BurnLpEvent.fromFields(BurnLpEvent.bcs.parse(data));
|
|
431
435
|
};
|
|
432
|
-
|
|
436
|
+
BurnLpEvent.prototype.toJSONField = function () {
|
|
433
437
|
return {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
previousCumulativeBorrowRate: this.previousCumulativeBorrowRate.toString(),
|
|
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(),
|
|
443
446
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
444
447
|
};
|
|
445
448
|
};
|
|
446
|
-
|
|
449
|
+
BurnLpEvent.prototype.toJSON = function () {
|
|
447
450
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
448
451
|
};
|
|
449
|
-
|
|
450
|
-
return
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
previousCumulativeBorrowRate: (0, reified_1.decodeFromJSONField)("u64", field.previousCumulativeBorrowRate),
|
|
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),
|
|
460
462
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
461
463
|
});
|
|
462
464
|
};
|
|
463
|
-
|
|
464
|
-
if (json.$typeName !==
|
|
465
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
466
|
-
}
|
|
467
|
-
return State.fromJSONField(json);
|
|
468
|
-
};
|
|
469
|
-
State.fromSuiParsedData = function (content) {
|
|
470
|
-
if (content.dataType !== "moveObject") {
|
|
471
|
-
throw new Error("not an object");
|
|
472
|
-
}
|
|
473
|
-
if (!isState(content.type)) {
|
|
474
|
-
throw new Error("object at ".concat(content.fields.id, " is not a State object"));
|
|
475
|
-
}
|
|
476
|
-
return State.fromFieldsWithTypes(content);
|
|
477
|
-
};
|
|
478
|
-
State.fromSuiObjectData = function (data) {
|
|
479
|
-
if (data.bcs) {
|
|
480
|
-
if (data.bcs.dataType !== "moveObject" || !isState(data.bcs.type)) {
|
|
481
|
-
throw new Error("object at is not a State object");
|
|
482
|
-
}
|
|
483
|
-
return State.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
484
|
-
}
|
|
485
|
-
if (data.content) {
|
|
486
|
-
return State.fromSuiParsedData(data.content);
|
|
487
|
-
}
|
|
488
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
489
|
-
};
|
|
490
|
-
State.fetch = function (client, id) {
|
|
491
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
492
|
-
var res;
|
|
493
|
-
var _a, _b;
|
|
494
|
-
return __generator(this, function (_c) {
|
|
495
|
-
switch (_c.label) {
|
|
496
|
-
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
497
|
-
case 1:
|
|
498
|
-
res = _c.sent();
|
|
499
|
-
if (res.error) {
|
|
500
|
-
throw new Error("error fetching State object at id ".concat(id, ": ").concat(res.error.code));
|
|
501
|
-
}
|
|
502
|
-
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)) {
|
|
503
|
-
throw new Error("object at id ".concat(id, " is not a State object"));
|
|
504
|
-
}
|
|
505
|
-
return [2 /*return*/, State.fromSuiObjectData(res.data)];
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
});
|
|
509
|
-
};
|
|
510
|
-
State.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::State");
|
|
511
|
-
State.$numTypeParams = 0;
|
|
512
|
-
State.$isPhantom = [];
|
|
513
|
-
return State;
|
|
514
|
-
}());
|
|
515
|
-
exports.State = State;
|
|
516
|
-
/* ============================== Registry =============================== */
|
|
517
|
-
function isRegistry(type) {
|
|
518
|
-
type = (0, util_1.compressSuiType)(type);
|
|
519
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::Registry");
|
|
520
|
-
}
|
|
521
|
-
var Registry = /** @class */ (function () {
|
|
522
|
-
function Registry(typeArgs, fields) {
|
|
523
|
-
this.__StructClass = true;
|
|
524
|
-
this.$typeName = Registry.$typeName;
|
|
525
|
-
this.$isPhantom = Registry.$isPhantom;
|
|
526
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Registry.$typeName], __read(typeArgs), false));
|
|
527
|
-
this.$typeArgs = typeArgs;
|
|
528
|
-
this.id = fields.id;
|
|
529
|
-
this.numPool = fields.numPool;
|
|
530
|
-
this.liquidityPoolRegistry = fields.liquidityPoolRegistry;
|
|
531
|
-
}
|
|
532
|
-
Registry.reified = function () {
|
|
533
|
-
var _this = this;
|
|
534
|
-
return {
|
|
535
|
-
typeName: Registry.$typeName,
|
|
536
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Registry.$typeName], [], false)),
|
|
537
|
-
typeArgs: [],
|
|
538
|
-
isPhantom: Registry.$isPhantom,
|
|
539
|
-
reifiedTypeArgs: [],
|
|
540
|
-
fromFields: function (fields) { return Registry.fromFields(fields); },
|
|
541
|
-
fromFieldsWithTypes: function (item) { return Registry.fromFieldsWithTypes(item); },
|
|
542
|
-
fromBcs: function (data) { return Registry.fromBcs(data); },
|
|
543
|
-
bcs: Registry.bcs,
|
|
544
|
-
fromJSONField: function (field) { return Registry.fromJSONField(field); },
|
|
545
|
-
fromJSON: function (json) { return Registry.fromJSON(json); },
|
|
546
|
-
fromSuiParsedData: function (content) { return Registry.fromSuiParsedData(content); },
|
|
547
|
-
fromSuiObjectData: function (content) { return Registry.fromSuiObjectData(content); },
|
|
548
|
-
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
549
|
-
return [2 /*return*/, Registry.fetch(client, id)];
|
|
550
|
-
}); }); },
|
|
551
|
-
new: function (fields) {
|
|
552
|
-
return new Registry([], fields);
|
|
553
|
-
},
|
|
554
|
-
kind: "StructClassReified",
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
Object.defineProperty(Registry, "r", {
|
|
558
|
-
get: function () {
|
|
559
|
-
return Registry.reified();
|
|
560
|
-
},
|
|
561
|
-
enumerable: false,
|
|
562
|
-
configurable: true
|
|
563
|
-
});
|
|
564
|
-
Registry.phantom = function () {
|
|
565
|
-
return (0, reified_1.phantom)(Registry.reified());
|
|
566
|
-
};
|
|
567
|
-
Object.defineProperty(Registry, "p", {
|
|
568
|
-
get: function () {
|
|
569
|
-
return Registry.phantom();
|
|
570
|
-
},
|
|
571
|
-
enumerable: false,
|
|
572
|
-
configurable: true
|
|
573
|
-
});
|
|
574
|
-
Object.defineProperty(Registry, "bcs", {
|
|
575
|
-
get: function () {
|
|
576
|
-
return bcs_1.bcs.struct("Registry", {
|
|
577
|
-
id: structs_2.UID.bcs,
|
|
578
|
-
num_pool: bcs_1.bcs.u64(),
|
|
579
|
-
liquidity_pool_registry: structs_2.UID.bcs,
|
|
580
|
-
});
|
|
581
|
-
},
|
|
582
|
-
enumerable: false,
|
|
583
|
-
configurable: true
|
|
584
|
-
});
|
|
585
|
-
Registry.fromFields = function (fields) {
|
|
586
|
-
return Registry.reified().new({
|
|
587
|
-
id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
|
|
588
|
-
numPool: (0, reified_1.decodeFromFields)("u64", fields.num_pool),
|
|
589
|
-
liquidityPoolRegistry: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.liquidity_pool_registry),
|
|
590
|
-
});
|
|
591
|
-
};
|
|
592
|
-
Registry.fromFieldsWithTypes = function (item) {
|
|
593
|
-
if (!isRegistry(item.type)) {
|
|
594
|
-
throw new Error("not a Registry type");
|
|
595
|
-
}
|
|
596
|
-
return Registry.reified().new({
|
|
597
|
-
id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
|
|
598
|
-
numPool: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.num_pool),
|
|
599
|
-
liquidityPoolRegistry: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.liquidity_pool_registry),
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
Registry.fromBcs = function (data) {
|
|
603
|
-
return Registry.fromFields(Registry.bcs.parse(data));
|
|
604
|
-
};
|
|
605
|
-
Registry.prototype.toJSONField = function () {
|
|
606
|
-
return {
|
|
607
|
-
id: this.id,
|
|
608
|
-
numPool: this.numPool.toString(),
|
|
609
|
-
liquidityPoolRegistry: this.liquidityPoolRegistry,
|
|
610
|
-
};
|
|
611
|
-
};
|
|
612
|
-
Registry.prototype.toJSON = function () {
|
|
613
|
-
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
614
|
-
};
|
|
615
|
-
Registry.fromJSONField = function (field) {
|
|
616
|
-
return Registry.reified().new({
|
|
617
|
-
id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
|
|
618
|
-
numPool: (0, reified_1.decodeFromJSONField)("u64", field.numPool),
|
|
619
|
-
liquidityPoolRegistry: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.liquidityPoolRegistry),
|
|
620
|
-
});
|
|
621
|
-
};
|
|
622
|
-
Registry.fromJSON = function (json) {
|
|
623
|
-
if (json.$typeName !== Registry.$typeName) {
|
|
465
|
+
BurnLpEvent.fromJSON = function (json) {
|
|
466
|
+
if (json.$typeName !== BurnLpEvent.$typeName) {
|
|
624
467
|
throw new Error("not a WithTwoGenerics json object");
|
|
625
468
|
}
|
|
626
|
-
return
|
|
469
|
+
return BurnLpEvent.fromJSONField(json);
|
|
627
470
|
};
|
|
628
|
-
|
|
471
|
+
BurnLpEvent.fromSuiParsedData = function (content) {
|
|
629
472
|
if (content.dataType !== "moveObject") {
|
|
630
473
|
throw new Error("not an object");
|
|
631
474
|
}
|
|
632
|
-
if (!
|
|
633
|
-
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"));
|
|
634
477
|
}
|
|
635
|
-
return
|
|
478
|
+
return BurnLpEvent.fromFieldsWithTypes(content);
|
|
636
479
|
};
|
|
637
|
-
|
|
480
|
+
BurnLpEvent.fromSuiObjectData = function (data) {
|
|
638
481
|
if (data.bcs) {
|
|
639
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
640
|
-
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");
|
|
641
484
|
}
|
|
642
|
-
return
|
|
485
|
+
return BurnLpEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
643
486
|
}
|
|
644
487
|
if (data.content) {
|
|
645
|
-
return
|
|
488
|
+
return BurnLpEvent.fromSuiParsedData(data.content);
|
|
646
489
|
}
|
|
647
490
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
648
491
|
};
|
|
649
|
-
|
|
492
|
+
BurnLpEvent.fetch = function (client, id) {
|
|
650
493
|
return __awaiter(this, void 0, void 0, function () {
|
|
651
494
|
var res;
|
|
652
495
|
var _a, _b;
|
|
@@ -656,174 +499,168 @@ var Registry = /** @class */ (function () {
|
|
|
656
499
|
case 1:
|
|
657
500
|
res = _c.sent();
|
|
658
501
|
if (res.error) {
|
|
659
|
-
throw new Error("error fetching
|
|
502
|
+
throw new Error("error fetching BurnLpEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
660
503
|
}
|
|
661
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
662
|
-
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"));
|
|
663
506
|
}
|
|
664
|
-
return [2 /*return*/,
|
|
507
|
+
return [2 /*return*/, BurnLpEvent.fromSuiObjectData(res.data)];
|
|
665
508
|
}
|
|
666
509
|
});
|
|
667
510
|
});
|
|
668
511
|
};
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
return
|
|
512
|
+
BurnLpEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::BurnLpEvent");
|
|
513
|
+
BurnLpEvent.$numTypeParams = 0;
|
|
514
|
+
BurnLpEvent.$isPhantom = [];
|
|
515
|
+
return BurnLpEvent;
|
|
673
516
|
}());
|
|
674
|
-
exports.
|
|
675
|
-
/* ==============================
|
|
676
|
-
function
|
|
517
|
+
exports.BurnLpEvent = BurnLpEvent;
|
|
518
|
+
/* ============================== CompleteRemoveLiquidityTokenProcessEvent =============================== */
|
|
519
|
+
function isCompleteRemoveLiquidityTokenProcessEvent(type) {
|
|
677
520
|
type = (0, util_1.compressSuiType)(type);
|
|
678
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
521
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::CompleteRemoveLiquidityTokenProcessEvent");
|
|
679
522
|
}
|
|
680
|
-
var
|
|
681
|
-
function
|
|
523
|
+
var CompleteRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
524
|
+
function CompleteRemoveLiquidityTokenProcessEvent(typeArgs, fields) {
|
|
682
525
|
this.__StructClass = true;
|
|
683
|
-
this.$typeName =
|
|
684
|
-
this.$isPhantom =
|
|
685
|
-
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));
|
|
686
529
|
this.$typeArgs = typeArgs;
|
|
687
|
-
this.sender = fields.sender;
|
|
688
530
|
this.index = fields.index;
|
|
689
|
-
this.
|
|
690
|
-
this.
|
|
691
|
-
this.
|
|
531
|
+
this.liquidityToken = fields.liquidityToken;
|
|
532
|
+
this.removedUsd = fields.removedUsd;
|
|
533
|
+
this.repaidUsd = fields.repaidUsd;
|
|
692
534
|
this.u64Padding = fields.u64Padding;
|
|
693
535
|
}
|
|
694
|
-
|
|
536
|
+
CompleteRemoveLiquidityTokenProcessEvent.reified = function () {
|
|
695
537
|
var _this = this;
|
|
696
538
|
return {
|
|
697
|
-
typeName:
|
|
698
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
539
|
+
typeName: CompleteRemoveLiquidityTokenProcessEvent.$typeName,
|
|
540
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([CompleteRemoveLiquidityTokenProcessEvent.$typeName], [], false)),
|
|
699
541
|
typeArgs: [],
|
|
700
|
-
isPhantom:
|
|
542
|
+
isPhantom: CompleteRemoveLiquidityTokenProcessEvent.$isPhantom,
|
|
701
543
|
reifiedTypeArgs: [],
|
|
702
|
-
fromFields: function (fields) { return
|
|
703
|
-
fromFieldsWithTypes: function (item) { return
|
|
704
|
-
fromBcs: function (data) { return
|
|
705
|
-
bcs:
|
|
706
|
-
fromJSONField: function (field) { return
|
|
707
|
-
fromJSON: function (json) { return
|
|
708
|
-
fromSuiParsedData: function (content) { return
|
|
709
|
-
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); },
|
|
710
552
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
711
|
-
return [2 /*return*/,
|
|
553
|
+
return [2 /*return*/, CompleteRemoveLiquidityTokenProcessEvent.fetch(client, id)];
|
|
712
554
|
}); }); },
|
|
713
555
|
new: function (fields) {
|
|
714
|
-
return new
|
|
556
|
+
return new CompleteRemoveLiquidityTokenProcessEvent([], fields);
|
|
715
557
|
},
|
|
716
558
|
kind: "StructClassReified",
|
|
717
559
|
};
|
|
718
560
|
};
|
|
719
|
-
Object.defineProperty(
|
|
561
|
+
Object.defineProperty(CompleteRemoveLiquidityTokenProcessEvent, "r", {
|
|
720
562
|
get: function () {
|
|
721
|
-
return
|
|
563
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified();
|
|
722
564
|
},
|
|
723
565
|
enumerable: false,
|
|
724
566
|
configurable: true
|
|
725
567
|
});
|
|
726
|
-
|
|
727
|
-
return (0, reified_1.phantom)(
|
|
568
|
+
CompleteRemoveLiquidityTokenProcessEvent.phantom = function () {
|
|
569
|
+
return (0, reified_1.phantom)(CompleteRemoveLiquidityTokenProcessEvent.reified());
|
|
728
570
|
};
|
|
729
|
-
Object.defineProperty(
|
|
571
|
+
Object.defineProperty(CompleteRemoveLiquidityTokenProcessEvent, "p", {
|
|
730
572
|
get: function () {
|
|
731
|
-
return
|
|
573
|
+
return CompleteRemoveLiquidityTokenProcessEvent.phantom();
|
|
732
574
|
},
|
|
733
575
|
enumerable: false,
|
|
734
576
|
configurable: true
|
|
735
577
|
});
|
|
736
|
-
Object.defineProperty(
|
|
578
|
+
Object.defineProperty(CompleteRemoveLiquidityTokenProcessEvent, "bcs", {
|
|
737
579
|
get: function () {
|
|
738
|
-
return bcs_1.bcs.struct("
|
|
739
|
-
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", {
|
|
740
581
|
index: bcs_1.bcs.u64(),
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
582
|
+
liquidity_token: structs_1.TypeName.bcs,
|
|
583
|
+
removed_usd: bcs_1.bcs.u64(),
|
|
584
|
+
repaid_usd: bcs_1.bcs.u64(),
|
|
744
585
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
745
586
|
});
|
|
746
587
|
},
|
|
747
588
|
enumerable: false,
|
|
748
589
|
configurable: true
|
|
749
590
|
});
|
|
750
|
-
|
|
751
|
-
return
|
|
752
|
-
sender: (0, reified_1.decodeFromFields)("address", fields.sender),
|
|
591
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromFields = function (fields) {
|
|
592
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified().new({
|
|
753
593
|
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
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),
|
|
757
597
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
758
598
|
});
|
|
759
599
|
};
|
|
760
|
-
|
|
761
|
-
if (!
|
|
762
|
-
throw new Error("not a
|
|
600
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes = function (item) {
|
|
601
|
+
if (!isCompleteRemoveLiquidityTokenProcessEvent(item.type)) {
|
|
602
|
+
throw new Error("not a CompleteRemoveLiquidityTokenProcessEvent type");
|
|
763
603
|
}
|
|
764
|
-
return
|
|
765
|
-
sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
|
|
604
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified().new({
|
|
766
605
|
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
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),
|
|
770
609
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
771
610
|
});
|
|
772
611
|
};
|
|
773
|
-
|
|
774
|
-
return
|
|
612
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromBcs = function (data) {
|
|
613
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromFields(CompleteRemoveLiquidityTokenProcessEvent.bcs.parse(data));
|
|
775
614
|
};
|
|
776
|
-
|
|
615
|
+
CompleteRemoveLiquidityTokenProcessEvent.prototype.toJSONField = function () {
|
|
777
616
|
return {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
state: this.state.toJSONField(),
|
|
617
|
+
index: this.index.toString(),
|
|
618
|
+
liquidityToken: this.liquidityToken.toJSONField(),
|
|
619
|
+
removedUsd: this.removedUsd.toString(),
|
|
620
|
+
repaidUsd: this.repaidUsd.toString(),
|
|
783
621
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
784
622
|
};
|
|
785
623
|
};
|
|
786
|
-
|
|
624
|
+
CompleteRemoveLiquidityTokenProcessEvent.prototype.toJSON = function () {
|
|
787
625
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
788
626
|
};
|
|
789
|
-
|
|
790
|
-
return
|
|
791
|
-
sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
|
|
627
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromJSONField = function (field) {
|
|
628
|
+
return CompleteRemoveLiquidityTokenProcessEvent.reified().new({
|
|
792
629
|
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
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),
|
|
796
633
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
797
634
|
});
|
|
798
635
|
};
|
|
799
|
-
|
|
800
|
-
if (json.$typeName !==
|
|
636
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromJSON = function (json) {
|
|
637
|
+
if (json.$typeName !== CompleteRemoveLiquidityTokenProcessEvent.$typeName) {
|
|
801
638
|
throw new Error("not a WithTwoGenerics json object");
|
|
802
639
|
}
|
|
803
|
-
return
|
|
640
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromJSONField(json);
|
|
804
641
|
};
|
|
805
|
-
|
|
642
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromSuiParsedData = function (content) {
|
|
806
643
|
if (content.dataType !== "moveObject") {
|
|
807
644
|
throw new Error("not an object");
|
|
808
645
|
}
|
|
809
|
-
if (!
|
|
810
|
-
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"));
|
|
811
648
|
}
|
|
812
|
-
return
|
|
649
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromFieldsWithTypes(content);
|
|
813
650
|
};
|
|
814
|
-
|
|
651
|
+
CompleteRemoveLiquidityTokenProcessEvent.fromSuiObjectData = function (data) {
|
|
815
652
|
if (data.bcs) {
|
|
816
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
817
|
-
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");
|
|
818
655
|
}
|
|
819
|
-
return
|
|
656
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
820
657
|
}
|
|
821
658
|
if (data.content) {
|
|
822
|
-
return
|
|
659
|
+
return CompleteRemoveLiquidityTokenProcessEvent.fromSuiParsedData(data.content);
|
|
823
660
|
}
|
|
824
661
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
825
662
|
};
|
|
826
|
-
|
|
663
|
+
CompleteRemoveLiquidityTokenProcessEvent.fetch = function (client, id) {
|
|
827
664
|
return __awaiter(this, void 0, void 0, function () {
|
|
828
665
|
var res;
|
|
829
666
|
var _a, _b;
|
|
@@ -833,192 +670,168 @@ var AddLiquidityTokenEvent = /** @class */ (function () {
|
|
|
833
670
|
case 1:
|
|
834
671
|
res = _c.sent();
|
|
835
672
|
if (res.error) {
|
|
836
|
-
throw new Error("error fetching
|
|
673
|
+
throw new Error("error fetching CompleteRemoveLiquidityTokenProcessEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
837
674
|
}
|
|
838
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
839
|
-
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"));
|
|
840
677
|
}
|
|
841
|
-
return [2 /*return*/,
|
|
678
|
+
return [2 /*return*/, CompleteRemoveLiquidityTokenProcessEvent.fromSuiObjectData(res.data)];
|
|
842
679
|
}
|
|
843
680
|
});
|
|
844
681
|
});
|
|
845
682
|
};
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
return
|
|
683
|
+
CompleteRemoveLiquidityTokenProcessEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::CompleteRemoveLiquidityTokenProcessEvent");
|
|
684
|
+
CompleteRemoveLiquidityTokenProcessEvent.$numTypeParams = 0;
|
|
685
|
+
CompleteRemoveLiquidityTokenProcessEvent.$isPhantom = [];
|
|
686
|
+
return CompleteRemoveLiquidityTokenProcessEvent;
|
|
850
687
|
}());
|
|
851
|
-
exports.
|
|
852
|
-
/* ==============================
|
|
853
|
-
function
|
|
688
|
+
exports.CompleteRemoveLiquidityTokenProcessEvent = CompleteRemoveLiquidityTokenProcessEvent;
|
|
689
|
+
/* ============================== Config =============================== */
|
|
690
|
+
function isConfig(type) {
|
|
854
691
|
type = (0, util_1.compressSuiType)(type);
|
|
855
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
692
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::Config");
|
|
856
693
|
}
|
|
857
|
-
var
|
|
858
|
-
function
|
|
694
|
+
var Config = /** @class */ (function () {
|
|
695
|
+
function Config(typeArgs, fields) {
|
|
859
696
|
this.__StructClass = true;
|
|
860
|
-
this.$typeName =
|
|
861
|
-
this.$isPhantom =
|
|
862
|
-
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));
|
|
863
700
|
this.$typeArgs = typeArgs;
|
|
864
|
-
this.
|
|
865
|
-
this.
|
|
866
|
-
this.
|
|
867
|
-
this.
|
|
868
|
-
this.burnAmountUsd = fields.burnAmountUsd;
|
|
869
|
-
this.burnFeeUsd = fields.burnFeeUsd;
|
|
870
|
-
this.liquidityTokenType = fields.liquidityTokenType;
|
|
871
|
-
this.withdrawTokenAmount = fields.withdrawTokenAmount;
|
|
701
|
+
this.oracleId = fields.oracleId;
|
|
702
|
+
this.liquidityTokenDecimal = fields.liquidityTokenDecimal;
|
|
703
|
+
this.spotConfig = fields.spotConfig;
|
|
704
|
+
this.marginConfig = fields.marginConfig;
|
|
872
705
|
this.u64Padding = fields.u64Padding;
|
|
873
706
|
}
|
|
874
|
-
|
|
707
|
+
Config.reified = function () {
|
|
875
708
|
var _this = this;
|
|
876
709
|
return {
|
|
877
|
-
typeName:
|
|
878
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
710
|
+
typeName: Config.$typeName,
|
|
711
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Config.$typeName], [], false)),
|
|
879
712
|
typeArgs: [],
|
|
880
|
-
isPhantom:
|
|
713
|
+
isPhantom: Config.$isPhantom,
|
|
881
714
|
reifiedTypeArgs: [],
|
|
882
|
-
fromFields: function (fields) { return
|
|
883
|
-
fromFieldsWithTypes: function (item) { return
|
|
884
|
-
fromBcs: function (data) { return
|
|
885
|
-
bcs:
|
|
886
|
-
fromJSONField: function (field) { return
|
|
887
|
-
fromJSON: function (json) { return
|
|
888
|
-
fromSuiParsedData: function (content) { return
|
|
889
|
-
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); },
|
|
890
723
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
891
|
-
return [2 /*return*/,
|
|
724
|
+
return [2 /*return*/, Config.fetch(client, id)];
|
|
892
725
|
}); }); },
|
|
893
726
|
new: function (fields) {
|
|
894
|
-
return new
|
|
727
|
+
return new Config([], fields);
|
|
895
728
|
},
|
|
896
729
|
kind: "StructClassReified",
|
|
897
730
|
};
|
|
898
731
|
};
|
|
899
|
-
Object.defineProperty(
|
|
732
|
+
Object.defineProperty(Config, "r", {
|
|
900
733
|
get: function () {
|
|
901
|
-
return
|
|
734
|
+
return Config.reified();
|
|
902
735
|
},
|
|
903
736
|
enumerable: false,
|
|
904
737
|
configurable: true
|
|
905
738
|
});
|
|
906
|
-
|
|
907
|
-
return (0, reified_1.phantom)(
|
|
739
|
+
Config.phantom = function () {
|
|
740
|
+
return (0, reified_1.phantom)(Config.reified());
|
|
908
741
|
};
|
|
909
|
-
Object.defineProperty(
|
|
742
|
+
Object.defineProperty(Config, "p", {
|
|
910
743
|
get: function () {
|
|
911
|
-
return
|
|
744
|
+
return Config.phantom();
|
|
912
745
|
},
|
|
913
746
|
enumerable: false,
|
|
914
747
|
configurable: true
|
|
915
748
|
});
|
|
916
|
-
Object.defineProperty(
|
|
749
|
+
Object.defineProperty(Config, "bcs", {
|
|
917
750
|
get: function () {
|
|
918
|
-
return bcs_1.bcs.struct("
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
burn_amount_usd: bcs_1.bcs.u64(),
|
|
924
|
-
burn_fee_usd: bcs_1.bcs.u64(),
|
|
925
|
-
liquidity_token_type: structs_1.TypeName.bcs,
|
|
926
|
-
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,
|
|
927
756
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
928
757
|
});
|
|
929
758
|
},
|
|
930
759
|
enumerable: false,
|
|
931
760
|
configurable: true
|
|
932
761
|
});
|
|
933
|
-
|
|
934
|
-
return
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
burnAmountUsd: (0, reified_1.decodeFromFields)("u64", fields.burn_amount_usd),
|
|
940
|
-
burnFeeUsd: (0, reified_1.decodeFromFields)("u64", fields.burn_fee_usd),
|
|
941
|
-
liquidityTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.liquidity_token_type),
|
|
942
|
-
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),
|
|
943
768
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
944
769
|
});
|
|
945
770
|
};
|
|
946
|
-
|
|
947
|
-
if (!
|
|
948
|
-
throw new Error("not a
|
|
771
|
+
Config.fromFieldsWithTypes = function (item) {
|
|
772
|
+
if (!isConfig(item.type)) {
|
|
773
|
+
throw new Error("not a Config type");
|
|
949
774
|
}
|
|
950
|
-
return
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
burnAmountUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.burn_amount_usd),
|
|
956
|
-
burnFeeUsd: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.burn_fee_usd),
|
|
957
|
-
liquidityTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.liquidity_token_type),
|
|
958
|
-
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),
|
|
959
780
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
960
781
|
});
|
|
961
782
|
};
|
|
962
|
-
|
|
963
|
-
return
|
|
783
|
+
Config.fromBcs = function (data) {
|
|
784
|
+
return Config.fromFields(Config.bcs.parse(data));
|
|
964
785
|
};
|
|
965
|
-
|
|
786
|
+
Config.prototype.toJSONField = function () {
|
|
966
787
|
return {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
burnAmountUsd: this.burnAmountUsd.toString(),
|
|
972
|
-
burnFeeUsd: this.burnFeeUsd.toString(),
|
|
973
|
-
liquidityTokenType: this.liquidityTokenType.toJSONField(),
|
|
974
|
-
withdrawTokenAmount: this.withdrawTokenAmount.toString(),
|
|
788
|
+
oracleId: this.oracleId,
|
|
789
|
+
liquidityTokenDecimal: this.liquidityTokenDecimal.toString(),
|
|
790
|
+
spotConfig: this.spotConfig.toJSONField(),
|
|
791
|
+
marginConfig: this.marginConfig.toJSONField(),
|
|
975
792
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
976
793
|
};
|
|
977
794
|
};
|
|
978
|
-
|
|
795
|
+
Config.prototype.toJSON = function () {
|
|
979
796
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
980
797
|
};
|
|
981
|
-
|
|
982
|
-
return
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
burnAmountUsd: (0, reified_1.decodeFromJSONField)("u64", field.burnAmountUsd),
|
|
988
|
-
burnFeeUsd: (0, reified_1.decodeFromJSONField)("u64", field.burnFeeUsd),
|
|
989
|
-
liquidityTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.liquidityTokenType),
|
|
990
|
-
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),
|
|
991
804
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
992
805
|
});
|
|
993
806
|
};
|
|
994
|
-
|
|
995
|
-
if (json.$typeName !==
|
|
807
|
+
Config.fromJSON = function (json) {
|
|
808
|
+
if (json.$typeName !== Config.$typeName) {
|
|
996
809
|
throw new Error("not a WithTwoGenerics json object");
|
|
997
810
|
}
|
|
998
|
-
return
|
|
811
|
+
return Config.fromJSONField(json);
|
|
999
812
|
};
|
|
1000
|
-
|
|
813
|
+
Config.fromSuiParsedData = function (content) {
|
|
1001
814
|
if (content.dataType !== "moveObject") {
|
|
1002
815
|
throw new Error("not an object");
|
|
1003
816
|
}
|
|
1004
|
-
if (!
|
|
1005
|
-
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"));
|
|
1006
819
|
}
|
|
1007
|
-
return
|
|
820
|
+
return Config.fromFieldsWithTypes(content);
|
|
1008
821
|
};
|
|
1009
|
-
|
|
822
|
+
Config.fromSuiObjectData = function (data) {
|
|
1010
823
|
if (data.bcs) {
|
|
1011
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
1012
|
-
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");
|
|
1013
826
|
}
|
|
1014
|
-
return
|
|
827
|
+
return Config.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1015
828
|
}
|
|
1016
829
|
if (data.content) {
|
|
1017
|
-
return
|
|
830
|
+
return Config.fromSuiParsedData(data.content);
|
|
1018
831
|
}
|
|
1019
832
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1020
833
|
};
|
|
1021
|
-
|
|
834
|
+
Config.fetch = function (client, id) {
|
|
1022
835
|
return __awaiter(this, void 0, void 0, function () {
|
|
1023
836
|
var res;
|
|
1024
837
|
var _a, _b;
|
|
@@ -1028,168 +841,198 @@ var BurnLpEvent = /** @class */ (function () {
|
|
|
1028
841
|
case 1:
|
|
1029
842
|
res = _c.sent();
|
|
1030
843
|
if (res.error) {
|
|
1031
|
-
throw new Error("error fetching
|
|
844
|
+
throw new Error("error fetching Config object at id ".concat(id, ": ").concat(res.error.code));
|
|
1032
845
|
}
|
|
1033
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
1034
|
-
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"));
|
|
1035
848
|
}
|
|
1036
|
-
return [2 /*return*/,
|
|
849
|
+
return [2 /*return*/, Config.fromSuiObjectData(res.data)];
|
|
1037
850
|
}
|
|
1038
851
|
});
|
|
1039
852
|
});
|
|
1040
853
|
};
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
return
|
|
854
|
+
Config.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::Config");
|
|
855
|
+
Config.$numTypeParams = 0;
|
|
856
|
+
Config.$isPhantom = [];
|
|
857
|
+
return Config;
|
|
1045
858
|
}());
|
|
1046
|
-
exports.
|
|
1047
|
-
/* ==============================
|
|
1048
|
-
function
|
|
859
|
+
exports.Config = Config;
|
|
860
|
+
/* ============================== DepositLendingEvent =============================== */
|
|
861
|
+
function isDepositLendingEvent(type) {
|
|
1049
862
|
type = (0, util_1.compressSuiType)(type);
|
|
1050
|
-
return type === "".concat(index_1.PKG_V1, "::lp_pool::
|
|
863
|
+
return type === "".concat(index_1.PKG_V1, "::lp_pool::DepositLendingEvent");
|
|
1051
864
|
}
|
|
1052
|
-
var
|
|
1053
|
-
function
|
|
865
|
+
var DepositLendingEvent = /** @class */ (function () {
|
|
866
|
+
function DepositLendingEvent(typeArgs, fields) {
|
|
1054
867
|
this.__StructClass = true;
|
|
1055
|
-
this.$typeName =
|
|
1056
|
-
this.$isPhantom =
|
|
1057
|
-
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));
|
|
1058
871
|
this.$typeArgs = typeArgs;
|
|
1059
872
|
this.index = fields.index;
|
|
1060
|
-
this.
|
|
1061
|
-
this.
|
|
1062
|
-
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;
|
|
1063
881
|
this.u64Padding = fields.u64Padding;
|
|
1064
882
|
}
|
|
1065
|
-
|
|
883
|
+
DepositLendingEvent.reified = function () {
|
|
1066
884
|
var _this = this;
|
|
1067
885
|
return {
|
|
1068
|
-
typeName:
|
|
1069
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
886
|
+
typeName: DepositLendingEvent.$typeName,
|
|
887
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([DepositLendingEvent.$typeName], [], false)),
|
|
1070
888
|
typeArgs: [],
|
|
1071
|
-
isPhantom:
|
|
889
|
+
isPhantom: DepositLendingEvent.$isPhantom,
|
|
1072
890
|
reifiedTypeArgs: [],
|
|
1073
|
-
fromFields: function (fields) { return
|
|
1074
|
-
fromFieldsWithTypes: function (item) { return
|
|
1075
|
-
fromBcs: function (data) { return
|
|
1076
|
-
bcs:
|
|
1077
|
-
fromJSONField: function (field) { return
|
|
1078
|
-
fromJSON: function (json) { return
|
|
1079
|
-
fromSuiParsedData: function (content) { return
|
|
1080
|
-
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); },
|
|
1081
899
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1082
|
-
return [2 /*return*/,
|
|
900
|
+
return [2 /*return*/, DepositLendingEvent.fetch(client, id)];
|
|
1083
901
|
}); }); },
|
|
1084
902
|
new: function (fields) {
|
|
1085
|
-
return new
|
|
903
|
+
return new DepositLendingEvent([], fields);
|
|
1086
904
|
},
|
|
1087
905
|
kind: "StructClassReified",
|
|
1088
906
|
};
|
|
1089
907
|
};
|
|
1090
|
-
Object.defineProperty(
|
|
908
|
+
Object.defineProperty(DepositLendingEvent, "r", {
|
|
1091
909
|
get: function () {
|
|
1092
|
-
return
|
|
910
|
+
return DepositLendingEvent.reified();
|
|
1093
911
|
},
|
|
1094
912
|
enumerable: false,
|
|
1095
913
|
configurable: true
|
|
1096
914
|
});
|
|
1097
|
-
|
|
1098
|
-
return (0, reified_1.phantom)(
|
|
915
|
+
DepositLendingEvent.phantom = function () {
|
|
916
|
+
return (0, reified_1.phantom)(DepositLendingEvent.reified());
|
|
1099
917
|
};
|
|
1100
|
-
Object.defineProperty(
|
|
918
|
+
Object.defineProperty(DepositLendingEvent, "p", {
|
|
1101
919
|
get: function () {
|
|
1102
|
-
return
|
|
920
|
+
return DepositLendingEvent.phantom();
|
|
1103
921
|
},
|
|
1104
922
|
enumerable: false,
|
|
1105
923
|
configurable: true
|
|
1106
924
|
});
|
|
1107
|
-
Object.defineProperty(
|
|
925
|
+
Object.defineProperty(DepositLendingEvent, "bcs", {
|
|
1108
926
|
get: function () {
|
|
1109
|
-
return bcs_1.bcs.struct("
|
|
927
|
+
return bcs_1.bcs.struct("DepositLendingEvent", {
|
|
1110
928
|
index: bcs_1.bcs.u64(),
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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(),
|
|
1114
937
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
1115
938
|
});
|
|
1116
939
|
},
|
|
1117
940
|
enumerable: false,
|
|
1118
941
|
configurable: true
|
|
1119
942
|
});
|
|
1120
|
-
|
|
1121
|
-
return
|
|
943
|
+
DepositLendingEvent.fromFields = function (fields) {
|
|
944
|
+
return DepositLendingEvent.reified().new({
|
|
1122
945
|
index: (0, reified_1.decodeFromFields)("u64", fields.index),
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
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),
|
|
1126
954
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
1127
955
|
});
|
|
1128
956
|
};
|
|
1129
|
-
|
|
1130
|
-
if (!
|
|
1131
|
-
throw new Error("not a
|
|
957
|
+
DepositLendingEvent.fromFieldsWithTypes = function (item) {
|
|
958
|
+
if (!isDepositLendingEvent(item.type)) {
|
|
959
|
+
throw new Error("not a DepositLendingEvent type");
|
|
1132
960
|
}
|
|
1133
|
-
return
|
|
961
|
+
return DepositLendingEvent.reified().new({
|
|
1134
962
|
index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
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),
|
|
1138
971
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
1139
972
|
});
|
|
1140
973
|
};
|
|
1141
|
-
|
|
1142
|
-
return
|
|
974
|
+
DepositLendingEvent.fromBcs = function (data) {
|
|
975
|
+
return DepositLendingEvent.fromFields(DepositLendingEvent.bcs.parse(data));
|
|
1143
976
|
};
|
|
1144
|
-
|
|
977
|
+
DepositLendingEvent.prototype.toJSONField = function () {
|
|
1145
978
|
return {
|
|
1146
979
|
index: this.index.toString(),
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
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(),
|
|
1150
988
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
1151
989
|
};
|
|
1152
990
|
};
|
|
1153
|
-
|
|
991
|
+
DepositLendingEvent.prototype.toJSON = function () {
|
|
1154
992
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
1155
993
|
};
|
|
1156
|
-
|
|
1157
|
-
return
|
|
994
|
+
DepositLendingEvent.fromJSONField = function (field) {
|
|
995
|
+
return DepositLendingEvent.reified().new({
|
|
1158
996
|
index: (0, reified_1.decodeFromJSONField)("u64", field.index),
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
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),
|
|
1162
1005
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
1163
1006
|
});
|
|
1164
1007
|
};
|
|
1165
|
-
|
|
1166
|
-
if (json.$typeName !==
|
|
1008
|
+
DepositLendingEvent.fromJSON = function (json) {
|
|
1009
|
+
if (json.$typeName !== DepositLendingEvent.$typeName) {
|
|
1167
1010
|
throw new Error("not a WithTwoGenerics json object");
|
|
1168
1011
|
}
|
|
1169
|
-
return
|
|
1012
|
+
return DepositLendingEvent.fromJSONField(json);
|
|
1170
1013
|
};
|
|
1171
|
-
|
|
1014
|
+
DepositLendingEvent.fromSuiParsedData = function (content) {
|
|
1172
1015
|
if (content.dataType !== "moveObject") {
|
|
1173
1016
|
throw new Error("not an object");
|
|
1174
1017
|
}
|
|
1175
|
-
if (!
|
|
1176
|
-
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"));
|
|
1177
1020
|
}
|
|
1178
|
-
return
|
|
1021
|
+
return DepositLendingEvent.fromFieldsWithTypes(content);
|
|
1179
1022
|
};
|
|
1180
|
-
|
|
1023
|
+
DepositLendingEvent.fromSuiObjectData = function (data) {
|
|
1181
1024
|
if (data.bcs) {
|
|
1182
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
1183
|
-
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");
|
|
1184
1027
|
}
|
|
1185
|
-
return
|
|
1028
|
+
return DepositLendingEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
1186
1029
|
}
|
|
1187
1030
|
if (data.content) {
|
|
1188
|
-
return
|
|
1031
|
+
return DepositLendingEvent.fromSuiParsedData(data.content);
|
|
1189
1032
|
}
|
|
1190
1033
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
1191
1034
|
};
|
|
1192
|
-
|
|
1035
|
+
DepositLendingEvent.fetch = function (client, id) {
|
|
1193
1036
|
return __awaiter(this, void 0, void 0, function () {
|
|
1194
1037
|
var res;
|
|
1195
1038
|
var _a, _b;
|
|
@@ -1199,22 +1042,22 @@ var CompleteRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
|
1199
1042
|
case 1:
|
|
1200
1043
|
res = _c.sent();
|
|
1201
1044
|
if (res.error) {
|
|
1202
|
-
throw new Error("error fetching
|
|
1045
|
+
throw new Error("error fetching DepositLendingEvent object at id ".concat(id, ": ").concat(res.error.code));
|
|
1203
1046
|
}
|
|
1204
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
1205
|
-
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"));
|
|
1206
1049
|
}
|
|
1207
|
-
return [2 /*return*/,
|
|
1050
|
+
return [2 /*return*/, DepositLendingEvent.fromSuiObjectData(res.data)];
|
|
1208
1051
|
}
|
|
1209
1052
|
});
|
|
1210
1053
|
});
|
|
1211
1054
|
};
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
return
|
|
1055
|
+
DepositLendingEvent.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::DepositLendingEvent");
|
|
1056
|
+
DepositLendingEvent.$numTypeParams = 0;
|
|
1057
|
+
DepositLendingEvent.$isPhantom = [];
|
|
1058
|
+
return DepositLendingEvent;
|
|
1216
1059
|
}());
|
|
1217
|
-
exports.
|
|
1060
|
+
exports.DepositLendingEvent = DepositLendingEvent;
|
|
1218
1061
|
/* ============================== LiquidityPool =============================== */
|
|
1219
1062
|
function isLiquidityPool(type) {
|
|
1220
1063
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -2407,70 +2250,229 @@ var NewLiquidityPoolEvent = /** @class */ (function () {
|
|
|
2407
2250
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
2408
2251
|
});
|
|
2409
2252
|
};
|
|
2410
|
-
NewLiquidityPoolEvent.fromFieldsWithTypes = function (item) {
|
|
2411
|
-
if (!isNewLiquidityPoolEvent(item.type)) {
|
|
2412
|
-
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");
|
|
2413
2421
|
}
|
|
2414
|
-
return
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
lpTokenDecimal: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lp_token_decimal),
|
|
2419
|
-
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),
|
|
2420
2426
|
});
|
|
2421
2427
|
};
|
|
2422
|
-
|
|
2423
|
-
return
|
|
2428
|
+
Registry.fromBcs = function (data) {
|
|
2429
|
+
return Registry.fromFields(Registry.bcs.parse(data));
|
|
2424
2430
|
};
|
|
2425
|
-
|
|
2431
|
+
Registry.prototype.toJSONField = function () {
|
|
2426
2432
|
return {
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
lpTokenDecimal: this.lpTokenDecimal.toString(),
|
|
2431
|
-
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
2433
|
+
id: this.id,
|
|
2434
|
+
numPool: this.numPool.toString(),
|
|
2435
|
+
liquidityPoolRegistry: this.liquidityPoolRegistry,
|
|
2432
2436
|
};
|
|
2433
2437
|
};
|
|
2434
|
-
|
|
2438
|
+
Registry.prototype.toJSON = function () {
|
|
2435
2439
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
2436
2440
|
};
|
|
2437
|
-
|
|
2438
|
-
return
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
lpTokenDecimal: (0, reified_1.decodeFromJSONField)("u64", field.lpTokenDecimal),
|
|
2443
|
-
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),
|
|
2444
2446
|
});
|
|
2445
2447
|
};
|
|
2446
|
-
|
|
2447
|
-
if (json.$typeName !==
|
|
2448
|
+
Registry.fromJSON = function (json) {
|
|
2449
|
+
if (json.$typeName !== Registry.$typeName) {
|
|
2448
2450
|
throw new Error("not a WithTwoGenerics json object");
|
|
2449
2451
|
}
|
|
2450
|
-
return
|
|
2452
|
+
return Registry.fromJSONField(json);
|
|
2451
2453
|
};
|
|
2452
|
-
|
|
2454
|
+
Registry.fromSuiParsedData = function (content) {
|
|
2453
2455
|
if (content.dataType !== "moveObject") {
|
|
2454
2456
|
throw new Error("not an object");
|
|
2455
2457
|
}
|
|
2456
|
-
if (!
|
|
2457
|
-
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"));
|
|
2458
2460
|
}
|
|
2459
|
-
return
|
|
2461
|
+
return Registry.fromFieldsWithTypes(content);
|
|
2460
2462
|
};
|
|
2461
|
-
|
|
2463
|
+
Registry.fromSuiObjectData = function (data) {
|
|
2462
2464
|
if (data.bcs) {
|
|
2463
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
2464
|
-
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");
|
|
2465
2467
|
}
|
|
2466
|
-
return
|
|
2468
|
+
return Registry.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
2467
2469
|
}
|
|
2468
2470
|
if (data.content) {
|
|
2469
|
-
return
|
|
2471
|
+
return Registry.fromSuiParsedData(data.content);
|
|
2470
2472
|
}
|
|
2471
2473
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
2472
2474
|
};
|
|
2473
|
-
|
|
2475
|
+
Registry.fetch = function (client, id) {
|
|
2474
2476
|
return __awaiter(this, void 0, void 0, function () {
|
|
2475
2477
|
var res;
|
|
2476
2478
|
var _a, _b;
|
|
@@ -2480,22 +2482,22 @@ var NewLiquidityPoolEvent = /** @class */ (function () {
|
|
|
2480
2482
|
case 1:
|
|
2481
2483
|
res = _c.sent();
|
|
2482
2484
|
if (res.error) {
|
|
2483
|
-
throw new Error("error fetching
|
|
2485
|
+
throw new Error("error fetching Registry object at id ".concat(id, ": ").concat(res.error.code));
|
|
2484
2486
|
}
|
|
2485
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
2486
|
-
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"));
|
|
2487
2489
|
}
|
|
2488
|
-
return [2 /*return*/,
|
|
2490
|
+
return [2 /*return*/, Registry.fromSuiObjectData(res.data)];
|
|
2489
2491
|
}
|
|
2490
2492
|
});
|
|
2491
2493
|
});
|
|
2492
2494
|
};
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
return
|
|
2495
|
+
Registry.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::Registry");
|
|
2496
|
+
Registry.$numTypeParams = 0;
|
|
2497
|
+
Registry.$isPhantom = [];
|
|
2498
|
+
return Registry;
|
|
2497
2499
|
}());
|
|
2498
|
-
exports.
|
|
2500
|
+
exports.Registry = Registry;
|
|
2499
2501
|
/* ============================== RemoveLiquidityTokenProcess =============================== */
|
|
2500
2502
|
function isRemoveLiquidityTokenProcess(type) {
|
|
2501
2503
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -3026,6 +3028,7 @@ var SpotConfig = /** @class */ (function () {
|
|
|
3026
3028
|
this.additionalBurnFeeBp = fields.additionalBurnFeeBp;
|
|
3027
3029
|
this.swapFeeBp = fields.swapFeeBp;
|
|
3028
3030
|
this.swapFeeProtocolShareBp = fields.swapFeeProtocolShareBp;
|
|
3031
|
+
this.lendingProtocolShareBp = fields.lendingProtocolShareBp;
|
|
3029
3032
|
this.u64Padding = fields.u64Padding;
|
|
3030
3033
|
}
|
|
3031
3034
|
SpotConfig.reified = function () {
|
|
@@ -3082,6 +3085,7 @@ var SpotConfig = /** @class */ (function () {
|
|
|
3082
3085
|
additional_burn_fee_bp: bcs_1.bcs.u64(),
|
|
3083
3086
|
swap_fee_bp: bcs_1.bcs.u64(),
|
|
3084
3087
|
swap_fee_protocol_share_bp: bcs_1.bcs.u64(),
|
|
3088
|
+
lending_protocol_share_bp: bcs_1.bcs.u64(),
|
|
3085
3089
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
3086
3090
|
});
|
|
3087
3091
|
},
|
|
@@ -3099,6 +3103,7 @@ var SpotConfig = /** @class */ (function () {
|
|
|
3099
3103
|
additionalBurnFeeBp: (0, reified_1.decodeFromFields)("u64", fields.additional_burn_fee_bp),
|
|
3100
3104
|
swapFeeBp: (0, reified_1.decodeFromFields)("u64", fields.swap_fee_bp),
|
|
3101
3105
|
swapFeeProtocolShareBp: (0, reified_1.decodeFromFields)("u64", fields.swap_fee_protocol_share_bp),
|
|
3106
|
+
lendingProtocolShareBp: (0, reified_1.decodeFromFields)("u64", fields.lending_protocol_share_bp),
|
|
3102
3107
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
3103
3108
|
});
|
|
3104
3109
|
};
|
|
@@ -3116,6 +3121,7 @@ var SpotConfig = /** @class */ (function () {
|
|
|
3116
3121
|
additionalBurnFeeBp: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.additional_burn_fee_bp),
|
|
3117
3122
|
swapFeeBp: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.swap_fee_bp),
|
|
3118
3123
|
swapFeeProtocolShareBp: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.swap_fee_protocol_share_bp),
|
|
3124
|
+
lendingProtocolShareBp: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.lending_protocol_share_bp),
|
|
3119
3125
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
3120
3126
|
});
|
|
3121
3127
|
};
|
|
@@ -3133,6 +3139,7 @@ var SpotConfig = /** @class */ (function () {
|
|
|
3133
3139
|
additionalBurnFeeBp: this.additionalBurnFeeBp.toString(),
|
|
3134
3140
|
swapFeeBp: this.swapFeeBp.toString(),
|
|
3135
3141
|
swapFeeProtocolShareBp: this.swapFeeProtocolShareBp.toString(),
|
|
3142
|
+
lendingProtocolShareBp: this.lendingProtocolShareBp.toString(),
|
|
3136
3143
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
3137
3144
|
};
|
|
3138
3145
|
};
|
|
@@ -3150,6 +3157,7 @@ var SpotConfig = /** @class */ (function () {
|
|
|
3150
3157
|
additionalBurnFeeBp: (0, reified_1.decodeFromJSONField)("u64", field.additionalBurnFeeBp),
|
|
3151
3158
|
swapFeeBp: (0, reified_1.decodeFromJSONField)("u64", field.swapFeeBp),
|
|
3152
3159
|
swapFeeProtocolShareBp: (0, reified_1.decodeFromJSONField)("u64", field.swapFeeProtocolShareBp),
|
|
3160
|
+
lendingProtocolShareBp: (0, reified_1.decodeFromJSONField)("u64", field.lendingProtocolShareBp),
|
|
3153
3161
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
3154
3162
|
});
|
|
3155
3163
|
};
|
|
@@ -3222,124 +3230,331 @@ var StartRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
|
3222
3230
|
this.liquidityToken = fields.liquidityToken;
|
|
3223
3231
|
this.u64Padding = fields.u64Padding;
|
|
3224
3232
|
}
|
|
3225
|
-
StartRemoveLiquidityTokenProcessEvent.reified = function () {
|
|
3233
|
+
StartRemoveLiquidityTokenProcessEvent.reified = function () {
|
|
3234
|
+
var _this = this;
|
|
3235
|
+
return {
|
|
3236
|
+
typeName: StartRemoveLiquidityTokenProcessEvent.$typeName,
|
|
3237
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([StartRemoveLiquidityTokenProcessEvent.$typeName], [], false)),
|
|
3238
|
+
typeArgs: [],
|
|
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 () {
|
|
3226
3401
|
var _this = this;
|
|
3227
3402
|
return {
|
|
3228
|
-
typeName:
|
|
3229
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([
|
|
3403
|
+
typeName: State.$typeName,
|
|
3404
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([State.$typeName], [], false)),
|
|
3230
3405
|
typeArgs: [],
|
|
3231
|
-
isPhantom:
|
|
3406
|
+
isPhantom: State.$isPhantom,
|
|
3232
3407
|
reifiedTypeArgs: [],
|
|
3233
|
-
fromFields: function (fields) { return
|
|
3234
|
-
fromFieldsWithTypes: function (item) { return
|
|
3235
|
-
fromBcs: function (data) { return
|
|
3236
|
-
bcs:
|
|
3237
|
-
fromJSONField: function (field) { return
|
|
3238
|
-
fromJSON: function (json) { return
|
|
3239
|
-
fromSuiParsedData: function (content) { return
|
|
3240
|
-
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); },
|
|
3241
3416
|
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3242
|
-
return [2 /*return*/,
|
|
3417
|
+
return [2 /*return*/, State.fetch(client, id)];
|
|
3243
3418
|
}); }); },
|
|
3244
3419
|
new: function (fields) {
|
|
3245
|
-
return new
|
|
3420
|
+
return new State([], fields);
|
|
3246
3421
|
},
|
|
3247
3422
|
kind: "StructClassReified",
|
|
3248
3423
|
};
|
|
3249
3424
|
};
|
|
3250
|
-
Object.defineProperty(
|
|
3425
|
+
Object.defineProperty(State, "r", {
|
|
3251
3426
|
get: function () {
|
|
3252
|
-
return
|
|
3427
|
+
return State.reified();
|
|
3253
3428
|
},
|
|
3254
3429
|
enumerable: false,
|
|
3255
3430
|
configurable: true
|
|
3256
3431
|
});
|
|
3257
|
-
|
|
3258
|
-
return (0, reified_1.phantom)(
|
|
3432
|
+
State.phantom = function () {
|
|
3433
|
+
return (0, reified_1.phantom)(State.reified());
|
|
3259
3434
|
};
|
|
3260
|
-
Object.defineProperty(
|
|
3435
|
+
Object.defineProperty(State, "p", {
|
|
3261
3436
|
get: function () {
|
|
3262
|
-
return
|
|
3437
|
+
return State.phantom();
|
|
3263
3438
|
},
|
|
3264
3439
|
enumerable: false,
|
|
3265
3440
|
configurable: true
|
|
3266
3441
|
});
|
|
3267
|
-
Object.defineProperty(
|
|
3442
|
+
Object.defineProperty(State, "bcs", {
|
|
3268
3443
|
get: function () {
|
|
3269
|
-
return bcs_1.bcs.struct("
|
|
3270
|
-
|
|
3271
|
-
|
|
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()),
|
|
3272
3455
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
3273
3456
|
});
|
|
3274
3457
|
},
|
|
3275
3458
|
enumerable: false,
|
|
3276
3459
|
configurable: true
|
|
3277
3460
|
});
|
|
3278
|
-
|
|
3279
|
-
return
|
|
3280
|
-
|
|
3281
|
-
|
|
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),
|
|
3282
3473
|
u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
|
|
3283
3474
|
});
|
|
3284
3475
|
};
|
|
3285
|
-
|
|
3286
|
-
if (!
|
|
3287
|
-
throw new Error("not a
|
|
3476
|
+
State.fromFieldsWithTypes = function (item) {
|
|
3477
|
+
if (!isState(item.type)) {
|
|
3478
|
+
throw new Error("not a State type");
|
|
3288
3479
|
}
|
|
3289
|
-
return
|
|
3290
|
-
|
|
3291
|
-
|
|
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),
|
|
3292
3491
|
u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
|
|
3293
3492
|
});
|
|
3294
3493
|
};
|
|
3295
|
-
|
|
3296
|
-
return
|
|
3494
|
+
State.fromBcs = function (data) {
|
|
3495
|
+
return State.fromFields(State.bcs.parse(data));
|
|
3297
3496
|
};
|
|
3298
|
-
|
|
3497
|
+
State.prototype.toJSONField = function () {
|
|
3299
3498
|
return {
|
|
3300
|
-
|
|
3301
|
-
|
|
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),
|
|
3302
3509
|
u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
|
|
3303
3510
|
};
|
|
3304
3511
|
};
|
|
3305
|
-
|
|
3512
|
+
State.prototype.toJSON = function () {
|
|
3306
3513
|
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
3307
3514
|
};
|
|
3308
|
-
|
|
3309
|
-
return
|
|
3310
|
-
|
|
3311
|
-
|
|
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),
|
|
3312
3527
|
u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
|
|
3313
3528
|
});
|
|
3314
3529
|
};
|
|
3315
|
-
|
|
3316
|
-
if (json.$typeName !==
|
|
3530
|
+
State.fromJSON = function (json) {
|
|
3531
|
+
if (json.$typeName !== State.$typeName) {
|
|
3317
3532
|
throw new Error("not a WithTwoGenerics json object");
|
|
3318
3533
|
}
|
|
3319
|
-
return
|
|
3534
|
+
return State.fromJSONField(json);
|
|
3320
3535
|
};
|
|
3321
|
-
|
|
3536
|
+
State.fromSuiParsedData = function (content) {
|
|
3322
3537
|
if (content.dataType !== "moveObject") {
|
|
3323
3538
|
throw new Error("not an object");
|
|
3324
3539
|
}
|
|
3325
|
-
if (!
|
|
3326
|
-
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"));
|
|
3327
3542
|
}
|
|
3328
|
-
return
|
|
3543
|
+
return State.fromFieldsWithTypes(content);
|
|
3329
3544
|
};
|
|
3330
|
-
|
|
3545
|
+
State.fromSuiObjectData = function (data) {
|
|
3331
3546
|
if (data.bcs) {
|
|
3332
|
-
if (data.bcs.dataType !== "moveObject" || !
|
|
3333
|
-
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");
|
|
3334
3549
|
}
|
|
3335
|
-
return
|
|
3550
|
+
return State.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
3336
3551
|
}
|
|
3337
3552
|
if (data.content) {
|
|
3338
|
-
return
|
|
3553
|
+
return State.fromSuiParsedData(data.content);
|
|
3339
3554
|
}
|
|
3340
3555
|
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
3341
3556
|
};
|
|
3342
|
-
|
|
3557
|
+
State.fetch = function (client, id) {
|
|
3343
3558
|
return __awaiter(this, void 0, void 0, function () {
|
|
3344
3559
|
var res;
|
|
3345
3560
|
var _a, _b;
|
|
@@ -3349,22 +3564,22 @@ var StartRemoveLiquidityTokenProcessEvent = /** @class */ (function () {
|
|
|
3349
3564
|
case 1:
|
|
3350
3565
|
res = _c.sent();
|
|
3351
3566
|
if (res.error) {
|
|
3352
|
-
throw new Error("error fetching
|
|
3567
|
+
throw new Error("error fetching State object at id ".concat(id, ": ").concat(res.error.code));
|
|
3353
3568
|
}
|
|
3354
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !
|
|
3355
|
-
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"));
|
|
3356
3571
|
}
|
|
3357
|
-
return [2 /*return*/,
|
|
3572
|
+
return [2 /*return*/, State.fromSuiObjectData(res.data)];
|
|
3358
3573
|
}
|
|
3359
3574
|
});
|
|
3360
3575
|
});
|
|
3361
3576
|
};
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
return
|
|
3577
|
+
State.$typeName = "".concat(index_1.PKG_V1, "::lp_pool::State");
|
|
3578
|
+
State.$numTypeParams = 0;
|
|
3579
|
+
State.$isPhantom = [];
|
|
3580
|
+
return State;
|
|
3366
3581
|
}());
|
|
3367
|
-
exports.
|
|
3582
|
+
exports.State = State;
|
|
3368
3583
|
/* ============================== SuspendPoolEvent =============================== */
|
|
3369
3584
|
function isSuspendPoolEvent(type) {
|
|
3370
3585
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -4787,3 +5002,234 @@ var UpdateSpotConfigEvent = /** @class */ (function () {
|
|
|
4787
5002
|
return UpdateSpotConfigEvent;
|
|
4788
5003
|
}());
|
|
4789
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;
|