@typus/typus-perp-sdk 1.0.52 → 1.0.53
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/_dependencies/source/0x2/bag/structs.d.ts +61 -0
- package/dist/src/_dependencies/source/0x2/bag/structs.js +229 -0
- package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +88 -0
- package/dist/src/_dependencies/source/0x2/balance/structs.js +386 -0
- package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +460 -0
- package/dist/src/_dependencies/source/0x2/coin/structs.js +1247 -0
- package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +153 -0
- package/dist/src/_dependencies/source/0x2/linked-table/structs.js +438 -0
- package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +46 -0
- package/dist/src/_dependencies/source/0x2/sui/structs.js +222 -0
- package/dist/src/_dependencies/source/0x2/table/structs.d.ts +61 -0
- package/dist/src/_dependencies/source/0x2/table/structs.js +248 -0
- package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +68 -0
- package/dist/src/_dependencies/source/0x2/table-vec/structs.js +274 -0
- package/dist/src/_dependencies/source/0x2/token/structs.d.ts +449 -0
- package/dist/src/_dependencies/source/0x2/token/structs.js +1095 -0
- package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +370 -0
- package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +1091 -0
- package/dist/src/_dependencies/source/0x2/url/structs.d.ts +53 -0
- package/dist/src/_dependencies/source/0x2/url/structs.js +223 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +489 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +1084 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +147 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +456 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +239 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +653 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +405 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +899 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +8 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +11 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +102 -0
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/keyed-big-vector/structs.d.ts +70 -70
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/keyed-big-vector/structs.js +174 -174
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +699 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +1459 -0
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/linked-object-table/structs.d.ts +62 -62
- package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/linked-object-table/structs.js +170 -170
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +147 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +430 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +1071 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +2261 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +279 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +733 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +328 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +892 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +88 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +263 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +347 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +591 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +73 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +258 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +876 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +1721 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +46 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +222 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +3 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +6 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +89 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +155 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +444 -0
- package/dist/src/_dependencies/source/{0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded → 0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274}/vault/structs.d.ts +84 -84
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +446 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +844 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +6 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +9 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +69 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +94 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +376 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +454 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +881 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +68 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +274 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +1117 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +2387 -0
- package/dist/src/fetch.d.ts +1 -1
- package/dist/src/fetch.js +1 -1
- package/dist/src/index.js +17 -17
- package/dist/src/typus_perp/admin/structs.d.ts +67 -5
- package/dist/src/typus_perp/admin/structs.js +155 -1
- package/dist/src/typus_perp/escrow/functions.js +1 -1
- package/dist/src/typus_perp/escrow/structs.d.ts +2 -2
- package/dist/src/typus_perp/escrow/structs.js +1 -1
- package/dist/src/typus_perp/lp-pool/structs.d.ts +28 -28
- package/dist/src/typus_perp/position/functions.js +1 -1
- package/dist/src/typus_perp/position/structs.d.ts +6 -6
- package/dist/src/typus_perp/symbol/structs.d.ts +1 -1
- package/dist/src/typus_perp/tlp/structs.d.ts +2 -2
- package/dist/src/typus_perp/trading/functions.js +1 -1
- package/dist/src/typus_perp/trading/structs.d.ts +32 -32
- package/dist/src/typus_perp/trading/structs.js +2 -2
- package/dist/src/typus_perp/treasury-caps/structs.d.ts +1 -1
- package/dist/src/typus_stake_pool/admin/functions.d.ts +25 -25
- package/dist/src/typus_stake_pool/admin/functions.js +66 -53
- package/dist/src/typus_stake_pool/admin/structs.d.ts +191 -191
- package/dist/src/typus_stake_pool/admin/structs.js +179 -179
- package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +50 -44
- package/dist/src/typus_stake_pool/stake-pool/functions.js +127 -88
- package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +202 -202
- package/dist/src/typus_stake_pool/stake-pool/structs.js +432 -432
- package/dist/src/user/order.js +34 -34
- package/package.json +1 -1
- package/dist/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.d.ts +0 -8
- package/dist/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.js +0 -11
- package/dist/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.d.ts +0 -3
- package/dist/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.js +0 -6
- package/dist/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.d.ts +0 -3
- package/dist/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.js +0 -6
- /package/dist/src/_dependencies/source/{0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded → 0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274}/vault/structs.js +0 -0
|
@@ -105,10 +105,10 @@ 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.
|
|
108
|
+
exports.Slice = exports.KeyedBigVector = exports.Element = void 0;
|
|
109
109
|
exports.isElement = isElement;
|
|
110
|
-
exports.isSlice = isSlice;
|
|
111
110
|
exports.isKeyedBigVector = isKeyedBigVector;
|
|
111
|
+
exports.isSlice = isSlice;
|
|
112
112
|
var reified = __importStar(require("../../../../_framework/reified"));
|
|
113
113
|
var reified_1 = require("../../../../_framework/reified");
|
|
114
114
|
var util_1 = require("../../../../_framework/util");
|
|
@@ -120,7 +120,7 @@ var utils_1 = require("@mysten/sui/utils");
|
|
|
120
120
|
/* ============================== Element =============================== */
|
|
121
121
|
function isElement(type) {
|
|
122
122
|
type = (0, util_1.compressSuiType)(type);
|
|
123
|
-
return type.startsWith("".concat(index_1.
|
|
123
|
+
return type.startsWith("".concat(index_1.PKG_V12, "::keyed_big_vector::Element") + "<");
|
|
124
124
|
}
|
|
125
125
|
var Element = /** @class */ (function () {
|
|
126
126
|
function Element(typeArgs, fields) {
|
|
@@ -279,184 +279,16 @@ var Element = /** @class */ (function () {
|
|
|
279
279
|
});
|
|
280
280
|
});
|
|
281
281
|
};
|
|
282
|
-
Element.$typeName = "".concat(index_1.
|
|
282
|
+
Element.$typeName = "".concat(index_1.PKG_V12, "::keyed_big_vector::Element");
|
|
283
283
|
Element.$numTypeParams = 2;
|
|
284
284
|
Element.$isPhantom = [false, false];
|
|
285
285
|
return Element;
|
|
286
286
|
}());
|
|
287
287
|
exports.Element = Element;
|
|
288
|
-
/* ============================== Slice =============================== */
|
|
289
|
-
function isSlice(type) {
|
|
290
|
-
type = (0, util_1.compressSuiType)(type);
|
|
291
|
-
return type.startsWith("".concat(index_1.PKG_V16, "::keyed_big_vector::Slice") + "<");
|
|
292
|
-
}
|
|
293
|
-
var Slice = /** @class */ (function () {
|
|
294
|
-
function Slice(typeArgs, fields) {
|
|
295
|
-
this.__StructClass = true;
|
|
296
|
-
this.$typeName = Slice.$typeName;
|
|
297
|
-
this.$isPhantom = Slice.$isPhantom;
|
|
298
|
-
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Slice.$typeName], __read(typeArgs), false));
|
|
299
|
-
this.$typeArgs = typeArgs;
|
|
300
|
-
this.idx = fields.idx;
|
|
301
|
-
this.vector = fields.vector;
|
|
302
|
-
}
|
|
303
|
-
Slice.reified = function (K, V) {
|
|
304
|
-
var _this = this;
|
|
305
|
-
return {
|
|
306
|
-
typeName: Slice.$typeName,
|
|
307
|
-
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Slice.$typeName], [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], false)),
|
|
308
|
-
typeArgs: [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)],
|
|
309
|
-
isPhantom: Slice.$isPhantom,
|
|
310
|
-
reifiedTypeArgs: [K, V],
|
|
311
|
-
fromFields: function (fields) { return Slice.fromFields([K, V], fields); },
|
|
312
|
-
fromFieldsWithTypes: function (item) { return Slice.fromFieldsWithTypes([K, V], item); },
|
|
313
|
-
fromBcs: function (data) { return Slice.fromBcs([K, V], data); },
|
|
314
|
-
bcs: Slice.bcs((0, reified_1.toBcs)(K), (0, reified_1.toBcs)(V)),
|
|
315
|
-
fromJSONField: function (field) { return Slice.fromJSONField([K, V], field); },
|
|
316
|
-
fromJSON: function (json) { return Slice.fromJSON([K, V], json); },
|
|
317
|
-
fromSuiParsedData: function (content) { return Slice.fromSuiParsedData([K, V], content); },
|
|
318
|
-
fromSuiObjectData: function (content) { return Slice.fromSuiObjectData([K, V], content); },
|
|
319
|
-
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
320
|
-
return [2 /*return*/, Slice.fetch(client, [K, V], id)];
|
|
321
|
-
}); }); },
|
|
322
|
-
new: function (fields) {
|
|
323
|
-
return new Slice([(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], fields);
|
|
324
|
-
},
|
|
325
|
-
kind: "StructClassReified",
|
|
326
|
-
};
|
|
327
|
-
};
|
|
328
|
-
Object.defineProperty(Slice, "r", {
|
|
329
|
-
get: function () {
|
|
330
|
-
return Slice.reified;
|
|
331
|
-
},
|
|
332
|
-
enumerable: false,
|
|
333
|
-
configurable: true
|
|
334
|
-
});
|
|
335
|
-
Slice.phantom = function (K, V) {
|
|
336
|
-
return (0, reified_1.phantom)(Slice.reified(K, V));
|
|
337
|
-
};
|
|
338
|
-
Object.defineProperty(Slice, "p", {
|
|
339
|
-
get: function () {
|
|
340
|
-
return Slice.phantom;
|
|
341
|
-
},
|
|
342
|
-
enumerable: false,
|
|
343
|
-
configurable: true
|
|
344
|
-
});
|
|
345
|
-
Object.defineProperty(Slice, "bcs", {
|
|
346
|
-
get: function () {
|
|
347
|
-
return function (K, V) {
|
|
348
|
-
return bcs_1.bcs.struct("Slice<".concat(K.name, ", ").concat(V.name, ">"), {
|
|
349
|
-
idx: bcs_1.bcs.u16(),
|
|
350
|
-
vector: bcs_1.bcs.vector(Element.bcs(K, V)),
|
|
351
|
-
});
|
|
352
|
-
};
|
|
353
|
-
},
|
|
354
|
-
enumerable: false,
|
|
355
|
-
configurable: true
|
|
356
|
-
});
|
|
357
|
-
Slice.fromFields = function (typeArgs, fields) {
|
|
358
|
-
return Slice.reified(typeArgs[0], typeArgs[1]).new({
|
|
359
|
-
idx: (0, reified_1.decodeFromFields)("u16", fields.idx),
|
|
360
|
-
vector: (0, reified_1.decodeFromFields)(reified.vector(Element.reified(typeArgs[0], typeArgs[1])), fields.vector),
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
Slice.fromFieldsWithTypes = function (typeArgs, item) {
|
|
364
|
-
if (!isSlice(item.type)) {
|
|
365
|
-
throw new Error("not a Slice type");
|
|
366
|
-
}
|
|
367
|
-
(0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
|
|
368
|
-
return Slice.reified(typeArgs[0], typeArgs[1]).new({
|
|
369
|
-
idx: (0, reified_1.decodeFromFieldsWithTypes)("u16", item.fields.idx),
|
|
370
|
-
vector: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector(Element.reified(typeArgs[0], typeArgs[1])), item.fields.vector),
|
|
371
|
-
});
|
|
372
|
-
};
|
|
373
|
-
Slice.fromBcs = function (typeArgs, data) {
|
|
374
|
-
return Slice.fromFields(typeArgs, Slice.bcs((0, reified_1.toBcs)(typeArgs[0]), (0, reified_1.toBcs)(typeArgs[1])).parse(data));
|
|
375
|
-
};
|
|
376
|
-
Slice.prototype.toJSONField = function () {
|
|
377
|
-
return {
|
|
378
|
-
idx: this.idx,
|
|
379
|
-
vector: (0, reified_1.fieldToJSON)("vector<".concat(Element.$typeName, "<").concat(this.$typeArgs[0], ", ").concat(this.$typeArgs[1], ">>"), this.vector),
|
|
380
|
-
};
|
|
381
|
-
};
|
|
382
|
-
Slice.prototype.toJSON = function () {
|
|
383
|
-
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
384
|
-
};
|
|
385
|
-
Slice.fromJSONField = function (typeArgs, field) {
|
|
386
|
-
return Slice.reified(typeArgs[0], typeArgs[1]).new({
|
|
387
|
-
idx: (0, reified_1.decodeFromJSONField)("u16", field.idx),
|
|
388
|
-
vector: (0, reified_1.decodeFromJSONField)(reified.vector(Element.reified(typeArgs[0], typeArgs[1])), field.vector),
|
|
389
|
-
});
|
|
390
|
-
};
|
|
391
|
-
Slice.fromJSON = function (typeArgs, json) {
|
|
392
|
-
if (json.$typeName !== Slice.$typeName) {
|
|
393
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
394
|
-
}
|
|
395
|
-
(0, reified_1.assertReifiedTypeArgsMatch)(util_1.composeSuiType.apply(void 0, __spreadArray([Slice.$typeName], __read(typeArgs.map(reified_1.extractType)), false)), json.$typeArgs, typeArgs);
|
|
396
|
-
return Slice.fromJSONField(typeArgs, json);
|
|
397
|
-
};
|
|
398
|
-
Slice.fromSuiParsedData = function (typeArgs, content) {
|
|
399
|
-
if (content.dataType !== "moveObject") {
|
|
400
|
-
throw new Error("not an object");
|
|
401
|
-
}
|
|
402
|
-
if (!isSlice(content.type)) {
|
|
403
|
-
throw new Error("object at ".concat(content.fields.id, " is not a Slice object"));
|
|
404
|
-
}
|
|
405
|
-
return Slice.fromFieldsWithTypes(typeArgs, content);
|
|
406
|
-
};
|
|
407
|
-
Slice.fromSuiObjectData = function (typeArgs, data) {
|
|
408
|
-
if (data.bcs) {
|
|
409
|
-
if (data.bcs.dataType !== "moveObject" || !isSlice(data.bcs.type)) {
|
|
410
|
-
throw new Error("object at is not a Slice object");
|
|
411
|
-
}
|
|
412
|
-
var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
|
|
413
|
-
if (gotTypeArgs.length !== 2) {
|
|
414
|
-
throw new Error("type argument mismatch: expected 2 type arguments but got ".concat(gotTypeArgs.length));
|
|
415
|
-
}
|
|
416
|
-
for (var i = 0; i < 2; i++) {
|
|
417
|
-
var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
|
|
418
|
-
var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
|
|
419
|
-
if (gotTypeArg !== expectedTypeArg) {
|
|
420
|
-
throw new Error("type argument mismatch at position ".concat(i, ": expected '").concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return Slice.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
424
|
-
}
|
|
425
|
-
if (data.content) {
|
|
426
|
-
return Slice.fromSuiParsedData(typeArgs, data.content);
|
|
427
|
-
}
|
|
428
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
429
|
-
};
|
|
430
|
-
Slice.fetch = function (client, typeArgs, id) {
|
|
431
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
432
|
-
var res;
|
|
433
|
-
var _a, _b;
|
|
434
|
-
return __generator(this, function (_c) {
|
|
435
|
-
switch (_c.label) {
|
|
436
|
-
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
437
|
-
case 1:
|
|
438
|
-
res = _c.sent();
|
|
439
|
-
if (res.error) {
|
|
440
|
-
throw new Error("error fetching Slice object at id ".concat(id, ": ").concat(res.error.code));
|
|
441
|
-
}
|
|
442
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isSlice(res.data.bcs.type)) {
|
|
443
|
-
throw new Error("object at id ".concat(id, " is not a Slice object"));
|
|
444
|
-
}
|
|
445
|
-
return [2 /*return*/, Slice.fromSuiObjectData(typeArgs, res.data)];
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
};
|
|
450
|
-
Slice.$typeName = "".concat(index_1.PKG_V16, "::keyed_big_vector::Slice");
|
|
451
|
-
Slice.$numTypeParams = 2;
|
|
452
|
-
Slice.$isPhantom = [false, false];
|
|
453
|
-
return Slice;
|
|
454
|
-
}());
|
|
455
|
-
exports.Slice = Slice;
|
|
456
288
|
/* ============================== KeyedBigVector =============================== */
|
|
457
289
|
function isKeyedBigVector(type) {
|
|
458
290
|
type = (0, util_1.compressSuiType)(type);
|
|
459
|
-
return type === "".concat(index_1.
|
|
291
|
+
return type === "".concat(index_1.PKG_V12, "::keyed_big_vector::KeyedBigVector");
|
|
460
292
|
}
|
|
461
293
|
var KeyedBigVector = /** @class */ (function () {
|
|
462
294
|
function KeyedBigVector(typeArgs, fields) {
|
|
@@ -624,9 +456,177 @@ var KeyedBigVector = /** @class */ (function () {
|
|
|
624
456
|
});
|
|
625
457
|
});
|
|
626
458
|
};
|
|
627
|
-
KeyedBigVector.$typeName = "".concat(index_1.
|
|
459
|
+
KeyedBigVector.$typeName = "".concat(index_1.PKG_V12, "::keyed_big_vector::KeyedBigVector");
|
|
628
460
|
KeyedBigVector.$numTypeParams = 0;
|
|
629
461
|
KeyedBigVector.$isPhantom = [];
|
|
630
462
|
return KeyedBigVector;
|
|
631
463
|
}());
|
|
632
464
|
exports.KeyedBigVector = KeyedBigVector;
|
|
465
|
+
/* ============================== Slice =============================== */
|
|
466
|
+
function isSlice(type) {
|
|
467
|
+
type = (0, util_1.compressSuiType)(type);
|
|
468
|
+
return type.startsWith("".concat(index_1.PKG_V12, "::keyed_big_vector::Slice") + "<");
|
|
469
|
+
}
|
|
470
|
+
var Slice = /** @class */ (function () {
|
|
471
|
+
function Slice(typeArgs, fields) {
|
|
472
|
+
this.__StructClass = true;
|
|
473
|
+
this.$typeName = Slice.$typeName;
|
|
474
|
+
this.$isPhantom = Slice.$isPhantom;
|
|
475
|
+
this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Slice.$typeName], __read(typeArgs), false));
|
|
476
|
+
this.$typeArgs = typeArgs;
|
|
477
|
+
this.idx = fields.idx;
|
|
478
|
+
this.vector = fields.vector;
|
|
479
|
+
}
|
|
480
|
+
Slice.reified = function (K, V) {
|
|
481
|
+
var _this = this;
|
|
482
|
+
return {
|
|
483
|
+
typeName: Slice.$typeName,
|
|
484
|
+
fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Slice.$typeName], [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], false)),
|
|
485
|
+
typeArgs: [(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)],
|
|
486
|
+
isPhantom: Slice.$isPhantom,
|
|
487
|
+
reifiedTypeArgs: [K, V],
|
|
488
|
+
fromFields: function (fields) { return Slice.fromFields([K, V], fields); },
|
|
489
|
+
fromFieldsWithTypes: function (item) { return Slice.fromFieldsWithTypes([K, V], item); },
|
|
490
|
+
fromBcs: function (data) { return Slice.fromBcs([K, V], data); },
|
|
491
|
+
bcs: Slice.bcs((0, reified_1.toBcs)(K), (0, reified_1.toBcs)(V)),
|
|
492
|
+
fromJSONField: function (field) { return Slice.fromJSONField([K, V], field); },
|
|
493
|
+
fromJSON: function (json) { return Slice.fromJSON([K, V], json); },
|
|
494
|
+
fromSuiParsedData: function (content) { return Slice.fromSuiParsedData([K, V], content); },
|
|
495
|
+
fromSuiObjectData: function (content) { return Slice.fromSuiObjectData([K, V], content); },
|
|
496
|
+
fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
497
|
+
return [2 /*return*/, Slice.fetch(client, [K, V], id)];
|
|
498
|
+
}); }); },
|
|
499
|
+
new: function (fields) {
|
|
500
|
+
return new Slice([(0, reified_1.extractType)(K), (0, reified_1.extractType)(V)], fields);
|
|
501
|
+
},
|
|
502
|
+
kind: "StructClassReified",
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
Object.defineProperty(Slice, "r", {
|
|
506
|
+
get: function () {
|
|
507
|
+
return Slice.reified;
|
|
508
|
+
},
|
|
509
|
+
enumerable: false,
|
|
510
|
+
configurable: true
|
|
511
|
+
});
|
|
512
|
+
Slice.phantom = function (K, V) {
|
|
513
|
+
return (0, reified_1.phantom)(Slice.reified(K, V));
|
|
514
|
+
};
|
|
515
|
+
Object.defineProperty(Slice, "p", {
|
|
516
|
+
get: function () {
|
|
517
|
+
return Slice.phantom;
|
|
518
|
+
},
|
|
519
|
+
enumerable: false,
|
|
520
|
+
configurable: true
|
|
521
|
+
});
|
|
522
|
+
Object.defineProperty(Slice, "bcs", {
|
|
523
|
+
get: function () {
|
|
524
|
+
return function (K, V) {
|
|
525
|
+
return bcs_1.bcs.struct("Slice<".concat(K.name, ", ").concat(V.name, ">"), {
|
|
526
|
+
idx: bcs_1.bcs.u16(),
|
|
527
|
+
vector: bcs_1.bcs.vector(Element.bcs(K, V)),
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
},
|
|
531
|
+
enumerable: false,
|
|
532
|
+
configurable: true
|
|
533
|
+
});
|
|
534
|
+
Slice.fromFields = function (typeArgs, fields) {
|
|
535
|
+
return Slice.reified(typeArgs[0], typeArgs[1]).new({
|
|
536
|
+
idx: (0, reified_1.decodeFromFields)("u16", fields.idx),
|
|
537
|
+
vector: (0, reified_1.decodeFromFields)(reified.vector(Element.reified(typeArgs[0], typeArgs[1])), fields.vector),
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
Slice.fromFieldsWithTypes = function (typeArgs, item) {
|
|
541
|
+
if (!isSlice(item.type)) {
|
|
542
|
+
throw new Error("not a Slice type");
|
|
543
|
+
}
|
|
544
|
+
(0, reified_1.assertFieldsWithTypesArgsMatch)(item, typeArgs);
|
|
545
|
+
return Slice.reified(typeArgs[0], typeArgs[1]).new({
|
|
546
|
+
idx: (0, reified_1.decodeFromFieldsWithTypes)("u16", item.fields.idx),
|
|
547
|
+
vector: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector(Element.reified(typeArgs[0], typeArgs[1])), item.fields.vector),
|
|
548
|
+
});
|
|
549
|
+
};
|
|
550
|
+
Slice.fromBcs = function (typeArgs, data) {
|
|
551
|
+
return Slice.fromFields(typeArgs, Slice.bcs((0, reified_1.toBcs)(typeArgs[0]), (0, reified_1.toBcs)(typeArgs[1])).parse(data));
|
|
552
|
+
};
|
|
553
|
+
Slice.prototype.toJSONField = function () {
|
|
554
|
+
return {
|
|
555
|
+
idx: this.idx,
|
|
556
|
+
vector: (0, reified_1.fieldToJSON)("vector<".concat(Element.$typeName, "<").concat(this.$typeArgs[0], ", ").concat(this.$typeArgs[1], ">>"), this.vector),
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
Slice.prototype.toJSON = function () {
|
|
560
|
+
return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
|
|
561
|
+
};
|
|
562
|
+
Slice.fromJSONField = function (typeArgs, field) {
|
|
563
|
+
return Slice.reified(typeArgs[0], typeArgs[1]).new({
|
|
564
|
+
idx: (0, reified_1.decodeFromJSONField)("u16", field.idx),
|
|
565
|
+
vector: (0, reified_1.decodeFromJSONField)(reified.vector(Element.reified(typeArgs[0], typeArgs[1])), field.vector),
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
Slice.fromJSON = function (typeArgs, json) {
|
|
569
|
+
if (json.$typeName !== Slice.$typeName) {
|
|
570
|
+
throw new Error("not a WithTwoGenerics json object");
|
|
571
|
+
}
|
|
572
|
+
(0, reified_1.assertReifiedTypeArgsMatch)(util_1.composeSuiType.apply(void 0, __spreadArray([Slice.$typeName], __read(typeArgs.map(reified_1.extractType)), false)), json.$typeArgs, typeArgs);
|
|
573
|
+
return Slice.fromJSONField(typeArgs, json);
|
|
574
|
+
};
|
|
575
|
+
Slice.fromSuiParsedData = function (typeArgs, content) {
|
|
576
|
+
if (content.dataType !== "moveObject") {
|
|
577
|
+
throw new Error("not an object");
|
|
578
|
+
}
|
|
579
|
+
if (!isSlice(content.type)) {
|
|
580
|
+
throw new Error("object at ".concat(content.fields.id, " is not a Slice object"));
|
|
581
|
+
}
|
|
582
|
+
return Slice.fromFieldsWithTypes(typeArgs, content);
|
|
583
|
+
};
|
|
584
|
+
Slice.fromSuiObjectData = function (typeArgs, data) {
|
|
585
|
+
if (data.bcs) {
|
|
586
|
+
if (data.bcs.dataType !== "moveObject" || !isSlice(data.bcs.type)) {
|
|
587
|
+
throw new Error("object at is not a Slice object");
|
|
588
|
+
}
|
|
589
|
+
var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
|
|
590
|
+
if (gotTypeArgs.length !== 2) {
|
|
591
|
+
throw new Error("type argument mismatch: expected 2 type arguments but got ".concat(gotTypeArgs.length));
|
|
592
|
+
}
|
|
593
|
+
for (var i = 0; i < 2; i++) {
|
|
594
|
+
var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[i]);
|
|
595
|
+
var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArgs[i]));
|
|
596
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
597
|
+
throw new Error("type argument mismatch at position ".concat(i, ": expected '").concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return Slice.fromBcs(typeArgs, (0, utils_1.fromB64)(data.bcs.bcsBytes));
|
|
601
|
+
}
|
|
602
|
+
if (data.content) {
|
|
603
|
+
return Slice.fromSuiParsedData(typeArgs, data.content);
|
|
604
|
+
}
|
|
605
|
+
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
606
|
+
};
|
|
607
|
+
Slice.fetch = function (client, typeArgs, id) {
|
|
608
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
609
|
+
var res;
|
|
610
|
+
var _a, _b;
|
|
611
|
+
return __generator(this, function (_c) {
|
|
612
|
+
switch (_c.label) {
|
|
613
|
+
case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
|
|
614
|
+
case 1:
|
|
615
|
+
res = _c.sent();
|
|
616
|
+
if (res.error) {
|
|
617
|
+
throw new Error("error fetching Slice object at id ".concat(id, ": ").concat(res.error.code));
|
|
618
|
+
}
|
|
619
|
+
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isSlice(res.data.bcs.type)) {
|
|
620
|
+
throw new Error("object at id ".concat(id, " is not a Slice object"));
|
|
621
|
+
}
|
|
622
|
+
return [2 /*return*/, Slice.fromSuiObjectData(typeArgs, res.data)];
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
Slice.$typeName = "".concat(index_1.PKG_V12, "::keyed_big_vector::Slice");
|
|
628
|
+
Slice.$numTypeParams = 2;
|
|
629
|
+
Slice.$isPhantom = [false, false];
|
|
630
|
+
return Slice;
|
|
631
|
+
}());
|
|
632
|
+
exports.Slice = Slice;
|