@suilend/springsui-cli 1.0.13 → 2.0.0
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/cli/src/bytecode.js +28 -30
- package/cli/src/index.js +51 -86
- package/package.json +1 -1
- package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js +35 -75
- package/sdk/src/_generated/_dependencies/source/0x1/index.js +3 -6
- package/sdk/src/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -3
- package/sdk/src/_generated/_dependencies/source/0x1/option/structs.js +31 -69
- package/sdk/src/_generated/_dependencies/source/0x1/string/structs.d.ts +4 -4
- package/sdk/src/_generated/_dependencies/source/0x1/string/structs.js +21 -59
- package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -5
- package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js +20 -25
- package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.js +24 -29
- package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.js +49 -56
- package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.d.ts +52 -52
- package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.js +206 -223
- package/sdk/src/_generated/_dependencies/source/0x2/index.js +3 -6
- package/sdk/src/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -8
- package/sdk/src/_generated/_dependencies/source/0x2/object/structs.js +34 -41
- package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.d.ts +4 -4
- package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.js +19 -24
- package/sdk/src/_generated/_dependencies/source/0x2/table/structs.d.ts +7 -7
- package/sdk/src/_generated/_dependencies/source/0x2/table/structs.js +31 -36
- package/sdk/src/_generated/_dependencies/source/0x2/url/structs.d.ts +5 -5
- package/sdk/src/_generated/_dependencies/source/0x2/url/structs.js +20 -25
- package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.d.ts +5 -5
- package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js +57 -97
- package/sdk/src/_generated/_dependencies/source/0x3/index.js +3 -6
- package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.d.ts +60 -60
- package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js +170 -218
- package/sdk/src/_generated/_framework/reified.d.ts +2 -2
- package/sdk/src/_generated/_framework/reified.js +27 -40
- package/sdk/src/_generated/_framework/util.d.ts +2 -14
- package/sdk/src/_generated/_framework/util.js +26 -40
- package/sdk/src/_generated/_framework/vector.d.ts +4 -4
- package/sdk/src/_generated/_framework/vector.js +16 -21
- package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +4 -4
- package/sdk/src/_generated/liquid_staking/cell/structs.js +31 -36
- package/sdk/src/_generated/liquid_staking/fees/functions.js +55 -75
- package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +21 -21
- package/sdk/src/_generated/liquid_staking/fees/structs.js +58 -65
- package/sdk/src/_generated/liquid_staking/index.js +6 -10
- package/sdk/src/_generated/liquid_staking/liquid-staking/functions.js +86 -107
- package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +98 -98
- package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +264 -320
- package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +31 -31
- package/sdk/src/_generated/liquid_staking/storage/structs.js +85 -125
- package/sdk/src/_generated/liquid_staking/version/structs.d.ts +4 -4
- package/sdk/src/_generated/liquid_staking/version/structs.js +19 -24
- package/sdk/src/_generated/liquid_staking/weight/functions.js +44 -56
- package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +41 -41
- package/sdk/src/_generated/liquid_staking/weight/structs.js +128 -141
- package/sdk/src/client.d.ts +16 -16
- package/sdk/src/client.js +39 -82
- package/sdk/src/index.js +2 -18
- package/sdk/src/lib/index.js +1 -17
- package/sdk/src/lib/transactions.d.ts +1 -1
- package/sdk/src/lib/transactions.js +3 -8
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,33 +7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const index_1 = require("../index");
|
|
18
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
19
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
10
|
+
import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, phantom, } from "../../../../_framework/reified";
|
|
11
|
+
import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
|
|
12
|
+
import { String } from "../../0x1/ascii/structs";
|
|
13
|
+
import { PKG_V31 } from "../index";
|
|
14
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
15
|
+
import { fromBase64 } from "@mysten/sui/utils";
|
|
20
16
|
/* ============================== Url =============================== */
|
|
21
|
-
function isUrl(type) {
|
|
22
|
-
type =
|
|
23
|
-
return type === `${
|
|
17
|
+
export function isUrl(type) {
|
|
18
|
+
type = compressSuiType(type);
|
|
19
|
+
return type === `${PKG_V31}::url::Url`;
|
|
24
20
|
}
|
|
25
|
-
class Url {
|
|
21
|
+
export class Url {
|
|
26
22
|
constructor(typeArgs, fields) {
|
|
27
23
|
this.__StructClass = true;
|
|
28
24
|
this.$typeName = Url.$typeName;
|
|
29
25
|
this.$isPhantom = Url.$isPhantom;
|
|
30
|
-
this.$fullTypeName =
|
|
26
|
+
this.$fullTypeName = composeSuiType(Url.$typeName, ...typeArgs);
|
|
31
27
|
this.$typeArgs = typeArgs;
|
|
32
28
|
this.url = fields.url;
|
|
33
29
|
}
|
|
34
30
|
static reified() {
|
|
35
31
|
return {
|
|
36
32
|
typeName: Url.$typeName,
|
|
37
|
-
fullTypeName:
|
|
33
|
+
fullTypeName: composeSuiType(Url.$typeName, ...[]),
|
|
38
34
|
typeArgs: [],
|
|
39
35
|
isPhantom: Url.$isPhantom,
|
|
40
36
|
reifiedTypeArgs: [],
|
|
@@ -57,19 +53,19 @@ class Url {
|
|
|
57
53
|
return Url.reified();
|
|
58
54
|
}
|
|
59
55
|
static phantom() {
|
|
60
|
-
return
|
|
56
|
+
return phantom(Url.reified());
|
|
61
57
|
}
|
|
62
58
|
static get p() {
|
|
63
59
|
return Url.phantom();
|
|
64
60
|
}
|
|
65
61
|
static get bcs() {
|
|
66
|
-
return
|
|
67
|
-
url:
|
|
62
|
+
return bcs.struct("Url", {
|
|
63
|
+
url: String.bcs,
|
|
68
64
|
});
|
|
69
65
|
}
|
|
70
66
|
static fromFields(fields) {
|
|
71
67
|
return Url.reified().new({
|
|
72
|
-
url:
|
|
68
|
+
url: decodeFromFields(String.reified(), fields.url),
|
|
73
69
|
});
|
|
74
70
|
}
|
|
75
71
|
static fromFieldsWithTypes(item) {
|
|
@@ -77,7 +73,7 @@ class Url {
|
|
|
77
73
|
throw new Error("not a Url type");
|
|
78
74
|
}
|
|
79
75
|
return Url.reified().new({
|
|
80
|
-
url:
|
|
76
|
+
url: decodeFromFieldsWithTypes(String.reified(), item.fields.url),
|
|
81
77
|
});
|
|
82
78
|
}
|
|
83
79
|
static fromBcs(data) {
|
|
@@ -93,7 +89,7 @@ class Url {
|
|
|
93
89
|
}
|
|
94
90
|
static fromJSONField(field) {
|
|
95
91
|
return Url.reified().new({
|
|
96
|
-
url:
|
|
92
|
+
url: decodeFromJSONField(String.reified(), field.url),
|
|
97
93
|
});
|
|
98
94
|
}
|
|
99
95
|
static fromJSON(json) {
|
|
@@ -116,7 +112,7 @@ class Url {
|
|
|
116
112
|
if (data.bcs.dataType !== "moveObject" || !isUrl(data.bcs.type)) {
|
|
117
113
|
throw new Error(`object at is not a Url object`);
|
|
118
114
|
}
|
|
119
|
-
return Url.fromBcs((
|
|
115
|
+
return Url.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
120
116
|
}
|
|
121
117
|
if (data.content) {
|
|
122
118
|
return Url.fromSuiParsedData(data.content);
|
|
@@ -137,7 +133,6 @@ class Url {
|
|
|
137
133
|
});
|
|
138
134
|
}
|
|
139
135
|
}
|
|
140
|
-
|
|
141
|
-
Url.$typeName = `${index_1.PKG_V31}::url::Url`;
|
|
136
|
+
Url.$typeName = `${PKG_V31}::url::Url`;
|
|
142
137
|
Url.$numTypeParams = 0;
|
|
143
138
|
Url.$isPhantom = [];
|
|
@@ -4,7 +4,7 @@ import { FieldsWithTypes } from "../../../../_framework/util";
|
|
|
4
4
|
import { Vector } from "../../../../_framework/vector";
|
|
5
5
|
import { PKG_V31 } from "../index";
|
|
6
6
|
import { BcsType } from "@mysten/sui/bcs";
|
|
7
|
-
import {
|
|
7
|
+
import { SuiJsonRpcClient, SuiObjectData, SuiParsedData } from "@mysten/sui/jsonRpc";
|
|
8
8
|
export declare function isEntry(type: string): boolean;
|
|
9
9
|
export interface EntryFields<K extends TypeArgument, V extends TypeArgument> {
|
|
10
10
|
key: ToField<K>;
|
|
@@ -27,7 +27,7 @@ export declare class Entry<K extends TypeArgument, V extends TypeArgument> imple
|
|
|
27
27
|
static get r(): typeof Entry.reified;
|
|
28
28
|
static phantom<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(K: K, V: V): PhantomReified<ToTypeStr<Entry<ToTypeArgument<K>, ToTypeArgument<V>>>>;
|
|
29
29
|
static get p(): typeof Entry.phantom;
|
|
30
|
-
static get bcs(): <K extends BcsType<any>, V extends BcsType<any>>(K: K, V: V) => import("@mysten/
|
|
30
|
+
static get bcs(): <K extends BcsType<any>, V extends BcsType<any>>(K: K, V: V) => import("@mysten/bcs").BcsStruct<{
|
|
31
31
|
key: K;
|
|
32
32
|
value: V;
|
|
33
33
|
}, string>;
|
|
@@ -48,7 +48,7 @@ export declare class Entry<K extends TypeArgument, V extends TypeArgument> imple
|
|
|
48
48
|
static fromJSON<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], json: Record<string, any>): Entry<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
49
49
|
static fromSuiParsedData<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], content: SuiParsedData): Entry<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
50
50
|
static fromSuiObjectData<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], data: SuiObjectData): Entry<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
51
|
-
static fetch<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(client:
|
|
51
|
+
static fetch<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(client: SuiJsonRpcClient, typeArgs: [K, V], id: string): Promise<Entry<ToTypeArgument<K>, ToTypeArgument<V>>>;
|
|
52
52
|
}
|
|
53
53
|
export declare function isVecMap(type: string): boolean;
|
|
54
54
|
export interface VecMapFields<K extends TypeArgument, V extends TypeArgument> {
|
|
@@ -70,7 +70,7 @@ export declare class VecMap<K extends TypeArgument, V extends TypeArgument> impl
|
|
|
70
70
|
static get r(): typeof VecMap.reified;
|
|
71
71
|
static phantom<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(K: K, V: V): PhantomReified<ToTypeStr<VecMap<ToTypeArgument<K>, ToTypeArgument<V>>>>;
|
|
72
72
|
static get p(): typeof VecMap.phantom;
|
|
73
|
-
static get bcs(): <K extends BcsType<any>, V extends BcsType<any>>(K: K, V: V) => import("@mysten/
|
|
73
|
+
static get bcs(): <K extends BcsType<any>, V extends BcsType<any>>(K: K, V: V) => import("@mysten/bcs").BcsStruct<{
|
|
74
74
|
contents: BcsType<{
|
|
75
75
|
key: K extends BcsType<infer U, any, string> ? U : never;
|
|
76
76
|
value: V extends BcsType<infer U, any, string> ? U : never;
|
|
@@ -102,5 +102,5 @@ export declare class VecMap<K extends TypeArgument, V extends TypeArgument> impl
|
|
|
102
102
|
static fromJSON<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], json: Record<string, any>): VecMap<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
103
103
|
static fromSuiParsedData<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], content: SuiParsedData): VecMap<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
104
104
|
static fromSuiObjectData<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(typeArgs: [K, V], data: SuiObjectData): VecMap<ToTypeArgument<K>, ToTypeArgument<V>>;
|
|
105
|
-
static fetch<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(client:
|
|
105
|
+
static fetch<K extends Reified<TypeArgument, any>, V extends Reified<TypeArgument, any>>(client: SuiJsonRpcClient, typeArgs: [K, V], id: string): Promise<VecMap<ToTypeArgument<K>, ToTypeArgument<V>>>;
|
|
106
106
|
}
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,27 +7,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
8
|
});
|
|
43
9
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const util_1 = require("../../../../_framework/util");
|
|
51
|
-
const index_1 = require("../index");
|
|
52
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
53
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
10
|
+
import * as reified from "../../../../_framework/reified";
|
|
11
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs, } from "../../../../_framework/reified";
|
|
12
|
+
import { composeSuiType, compressSuiType, parseTypeName, } from "../../../../_framework/util";
|
|
13
|
+
import { PKG_V31 } from "../index";
|
|
14
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
15
|
+
import { fromBase64 } from "@mysten/sui/utils";
|
|
54
16
|
/* ============================== Entry =============================== */
|
|
55
|
-
function isEntry(type) {
|
|
56
|
-
type =
|
|
57
|
-
return type.startsWith(`${
|
|
17
|
+
export function isEntry(type) {
|
|
18
|
+
type = compressSuiType(type);
|
|
19
|
+
return type.startsWith(`${PKG_V31}::vec_map::Entry` + "<");
|
|
58
20
|
}
|
|
59
|
-
class Entry {
|
|
21
|
+
export class Entry {
|
|
60
22
|
constructor(typeArgs, fields) {
|
|
61
23
|
this.__StructClass = true;
|
|
62
24
|
this.$typeName = Entry.$typeName;
|
|
63
25
|
this.$isPhantom = Entry.$isPhantom;
|
|
64
|
-
this.$fullTypeName =
|
|
26
|
+
this.$fullTypeName = composeSuiType(Entry.$typeName, ...typeArgs);
|
|
65
27
|
this.$typeArgs = typeArgs;
|
|
66
28
|
this.key = fields.key;
|
|
67
29
|
this.value = fields.value;
|
|
@@ -69,21 +31,21 @@ class Entry {
|
|
|
69
31
|
static reified(K, V) {
|
|
70
32
|
return {
|
|
71
33
|
typeName: Entry.$typeName,
|
|
72
|
-
fullTypeName:
|
|
73
|
-
typeArgs: [
|
|
34
|
+
fullTypeName: composeSuiType(Entry.$typeName, ...[extractType(K), extractType(V)]),
|
|
35
|
+
typeArgs: [extractType(K), extractType(V)],
|
|
74
36
|
isPhantom: Entry.$isPhantom,
|
|
75
37
|
reifiedTypeArgs: [K, V],
|
|
76
38
|
fromFields: (fields) => Entry.fromFields([K, V], fields),
|
|
77
39
|
fromFieldsWithTypes: (item) => Entry.fromFieldsWithTypes([K, V], item),
|
|
78
40
|
fromBcs: (data) => Entry.fromBcs([K, V], data),
|
|
79
|
-
bcs: Entry.bcs(
|
|
41
|
+
bcs: Entry.bcs(toBcs(K), toBcs(V)),
|
|
80
42
|
fromJSONField: (field) => Entry.fromJSONField([K, V], field),
|
|
81
43
|
fromJSON: (json) => Entry.fromJSON([K, V], json),
|
|
82
44
|
fromSuiParsedData: (content) => Entry.fromSuiParsedData([K, V], content),
|
|
83
45
|
fromSuiObjectData: (content) => Entry.fromSuiObjectData([K, V], content),
|
|
84
46
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Entry.fetch(client, [K, V], id); }),
|
|
85
47
|
new: (fields) => {
|
|
86
|
-
return new Entry([
|
|
48
|
+
return new Entry([extractType(K), extractType(V)], fields);
|
|
87
49
|
},
|
|
88
50
|
kind: "StructClassReified",
|
|
89
51
|
};
|
|
@@ -92,40 +54,40 @@ class Entry {
|
|
|
92
54
|
return Entry.reified;
|
|
93
55
|
}
|
|
94
56
|
static phantom(K, V) {
|
|
95
|
-
return
|
|
57
|
+
return phantom(Entry.reified(K, V));
|
|
96
58
|
}
|
|
97
59
|
static get p() {
|
|
98
60
|
return Entry.phantom;
|
|
99
61
|
}
|
|
100
62
|
static get bcs() {
|
|
101
|
-
return (K, V) =>
|
|
63
|
+
return (K, V) => bcs.struct(`Entry<${K.name}, ${V.name}>`, {
|
|
102
64
|
key: K,
|
|
103
65
|
value: V,
|
|
104
66
|
});
|
|
105
67
|
}
|
|
106
68
|
static fromFields(typeArgs, fields) {
|
|
107
69
|
return Entry.reified(typeArgs[0], typeArgs[1]).new({
|
|
108
|
-
key:
|
|
109
|
-
value:
|
|
70
|
+
key: decodeFromFields(typeArgs[0], fields.key),
|
|
71
|
+
value: decodeFromFields(typeArgs[1], fields.value),
|
|
110
72
|
});
|
|
111
73
|
}
|
|
112
74
|
static fromFieldsWithTypes(typeArgs, item) {
|
|
113
75
|
if (!isEntry(item.type)) {
|
|
114
76
|
throw new Error("not a Entry type");
|
|
115
77
|
}
|
|
116
|
-
|
|
78
|
+
assertFieldsWithTypesArgsMatch(item, typeArgs);
|
|
117
79
|
return Entry.reified(typeArgs[0], typeArgs[1]).new({
|
|
118
|
-
key:
|
|
119
|
-
value:
|
|
80
|
+
key: decodeFromFieldsWithTypes(typeArgs[0], item.fields.key),
|
|
81
|
+
value: decodeFromFieldsWithTypes(typeArgs[1], item.fields.value),
|
|
120
82
|
});
|
|
121
83
|
}
|
|
122
84
|
static fromBcs(typeArgs, data) {
|
|
123
|
-
return Entry.fromFields(typeArgs, Entry.bcs(
|
|
85
|
+
return Entry.fromFields(typeArgs, Entry.bcs(toBcs(typeArgs[0]), toBcs(typeArgs[1])).parse(data));
|
|
124
86
|
}
|
|
125
87
|
toJSONField() {
|
|
126
88
|
return {
|
|
127
|
-
key:
|
|
128
|
-
value:
|
|
89
|
+
key: fieldToJSON(this.$typeArgs[0], this.key),
|
|
90
|
+
value: fieldToJSON(this.$typeArgs[1], this.value),
|
|
129
91
|
};
|
|
130
92
|
}
|
|
131
93
|
toJSON() {
|
|
@@ -133,15 +95,15 @@ class Entry {
|
|
|
133
95
|
}
|
|
134
96
|
static fromJSONField(typeArgs, field) {
|
|
135
97
|
return Entry.reified(typeArgs[0], typeArgs[1]).new({
|
|
136
|
-
key:
|
|
137
|
-
value:
|
|
98
|
+
key: decodeFromJSONField(typeArgs[0], field.key),
|
|
99
|
+
value: decodeFromJSONField(typeArgs[1], field.value),
|
|
138
100
|
});
|
|
139
101
|
}
|
|
140
102
|
static fromJSON(typeArgs, json) {
|
|
141
103
|
if (json.$typeName !== Entry.$typeName) {
|
|
142
104
|
throw new Error("not a WithTwoGenerics json object");
|
|
143
105
|
}
|
|
144
|
-
|
|
106
|
+
assertReifiedTypeArgsMatch(composeSuiType(Entry.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
|
|
145
107
|
return Entry.fromJSONField(typeArgs, json);
|
|
146
108
|
}
|
|
147
109
|
static fromSuiParsedData(typeArgs, content) {
|
|
@@ -158,18 +120,18 @@ class Entry {
|
|
|
158
120
|
if (data.bcs.dataType !== "moveObject" || !isEntry(data.bcs.type)) {
|
|
159
121
|
throw new Error(`object at is not a Entry object`);
|
|
160
122
|
}
|
|
161
|
-
const gotTypeArgs =
|
|
123
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
162
124
|
if (gotTypeArgs.length !== 2) {
|
|
163
125
|
throw new Error(`type argument mismatch: expected 2 type arguments but got ${gotTypeArgs.length}`);
|
|
164
126
|
}
|
|
165
127
|
for (let i = 0; i < 2; i++) {
|
|
166
|
-
const gotTypeArg =
|
|
167
|
-
const expectedTypeArg =
|
|
128
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
129
|
+
const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
|
|
168
130
|
if (gotTypeArg !== expectedTypeArg) {
|
|
169
131
|
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
170
132
|
}
|
|
171
133
|
}
|
|
172
|
-
return Entry.fromBcs(typeArgs, (
|
|
134
|
+
return Entry.fromBcs(typeArgs, fromBase64(data.bcs.bcsBytes));
|
|
173
135
|
}
|
|
174
136
|
if (data.content) {
|
|
175
137
|
return Entry.fromSuiParsedData(typeArgs, data.content);
|
|
@@ -191,42 +153,41 @@ class Entry {
|
|
|
191
153
|
});
|
|
192
154
|
}
|
|
193
155
|
}
|
|
194
|
-
|
|
195
|
-
Entry.$typeName = `${index_1.PKG_V31}::vec_map::Entry`;
|
|
156
|
+
Entry.$typeName = `${PKG_V31}::vec_map::Entry`;
|
|
196
157
|
Entry.$numTypeParams = 2;
|
|
197
158
|
Entry.$isPhantom = [false, false];
|
|
198
159
|
/* ============================== VecMap =============================== */
|
|
199
|
-
function isVecMap(type) {
|
|
200
|
-
type =
|
|
201
|
-
return type.startsWith(`${
|
|
160
|
+
export function isVecMap(type) {
|
|
161
|
+
type = compressSuiType(type);
|
|
162
|
+
return type.startsWith(`${PKG_V31}::vec_map::VecMap` + "<");
|
|
202
163
|
}
|
|
203
|
-
class VecMap {
|
|
164
|
+
export class VecMap {
|
|
204
165
|
constructor(typeArgs, fields) {
|
|
205
166
|
this.__StructClass = true;
|
|
206
167
|
this.$typeName = VecMap.$typeName;
|
|
207
168
|
this.$isPhantom = VecMap.$isPhantom;
|
|
208
|
-
this.$fullTypeName =
|
|
169
|
+
this.$fullTypeName = composeSuiType(VecMap.$typeName, ...typeArgs);
|
|
209
170
|
this.$typeArgs = typeArgs;
|
|
210
171
|
this.contents = fields.contents;
|
|
211
172
|
}
|
|
212
173
|
static reified(K, V) {
|
|
213
174
|
return {
|
|
214
175
|
typeName: VecMap.$typeName,
|
|
215
|
-
fullTypeName:
|
|
216
|
-
typeArgs: [
|
|
176
|
+
fullTypeName: composeSuiType(VecMap.$typeName, ...[extractType(K), extractType(V)]),
|
|
177
|
+
typeArgs: [extractType(K), extractType(V)],
|
|
217
178
|
isPhantom: VecMap.$isPhantom,
|
|
218
179
|
reifiedTypeArgs: [K, V],
|
|
219
180
|
fromFields: (fields) => VecMap.fromFields([K, V], fields),
|
|
220
181
|
fromFieldsWithTypes: (item) => VecMap.fromFieldsWithTypes([K, V], item),
|
|
221
182
|
fromBcs: (data) => VecMap.fromBcs([K, V], data),
|
|
222
|
-
bcs: VecMap.bcs(
|
|
183
|
+
bcs: VecMap.bcs(toBcs(K), toBcs(V)),
|
|
223
184
|
fromJSONField: (field) => VecMap.fromJSONField([K, V], field),
|
|
224
185
|
fromJSON: (json) => VecMap.fromJSON([K, V], json),
|
|
225
186
|
fromSuiParsedData: (content) => VecMap.fromSuiParsedData([K, V], content),
|
|
226
187
|
fromSuiObjectData: (content) => VecMap.fromSuiObjectData([K, V], content),
|
|
227
188
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return VecMap.fetch(client, [K, V], id); }),
|
|
228
189
|
new: (fields) => {
|
|
229
|
-
return new VecMap([
|
|
190
|
+
return new VecMap([extractType(K), extractType(V)], fields);
|
|
230
191
|
},
|
|
231
192
|
kind: "StructClassReified",
|
|
232
193
|
};
|
|
@@ -235,36 +196,36 @@ class VecMap {
|
|
|
235
196
|
return VecMap.reified;
|
|
236
197
|
}
|
|
237
198
|
static phantom(K, V) {
|
|
238
|
-
return
|
|
199
|
+
return phantom(VecMap.reified(K, V));
|
|
239
200
|
}
|
|
240
201
|
static get p() {
|
|
241
202
|
return VecMap.phantom;
|
|
242
203
|
}
|
|
243
204
|
static get bcs() {
|
|
244
|
-
return (K, V) =>
|
|
245
|
-
contents:
|
|
205
|
+
return (K, V) => bcs.struct(`VecMap<${K.name}, ${V.name}>`, {
|
|
206
|
+
contents: bcs.vector(Entry.bcs(K, V)),
|
|
246
207
|
});
|
|
247
208
|
}
|
|
248
209
|
static fromFields(typeArgs, fields) {
|
|
249
210
|
return VecMap.reified(typeArgs[0], typeArgs[1]).new({
|
|
250
|
-
contents:
|
|
211
|
+
contents: decodeFromFields(reified.vector(Entry.reified(typeArgs[0], typeArgs[1])), fields.contents),
|
|
251
212
|
});
|
|
252
213
|
}
|
|
253
214
|
static fromFieldsWithTypes(typeArgs, item) {
|
|
254
215
|
if (!isVecMap(item.type)) {
|
|
255
216
|
throw new Error("not a VecMap type");
|
|
256
217
|
}
|
|
257
|
-
|
|
218
|
+
assertFieldsWithTypesArgsMatch(item, typeArgs);
|
|
258
219
|
return VecMap.reified(typeArgs[0], typeArgs[1]).new({
|
|
259
|
-
contents:
|
|
220
|
+
contents: decodeFromFieldsWithTypes(reified.vector(Entry.reified(typeArgs[0], typeArgs[1])), item.fields.contents),
|
|
260
221
|
});
|
|
261
222
|
}
|
|
262
223
|
static fromBcs(typeArgs, data) {
|
|
263
|
-
return VecMap.fromFields(typeArgs, VecMap.bcs(
|
|
224
|
+
return VecMap.fromFields(typeArgs, VecMap.bcs(toBcs(typeArgs[0]), toBcs(typeArgs[1])).parse(data));
|
|
264
225
|
}
|
|
265
226
|
toJSONField() {
|
|
266
227
|
return {
|
|
267
|
-
contents:
|
|
228
|
+
contents: fieldToJSON(`vector<${Entry.$typeName}<${this.$typeArgs[0]}, ${this.$typeArgs[1]}>>`, this.contents),
|
|
268
229
|
};
|
|
269
230
|
}
|
|
270
231
|
toJSON() {
|
|
@@ -272,14 +233,14 @@ class VecMap {
|
|
|
272
233
|
}
|
|
273
234
|
static fromJSONField(typeArgs, field) {
|
|
274
235
|
return VecMap.reified(typeArgs[0], typeArgs[1]).new({
|
|
275
|
-
contents:
|
|
236
|
+
contents: decodeFromJSONField(reified.vector(Entry.reified(typeArgs[0], typeArgs[1])), field.contents),
|
|
276
237
|
});
|
|
277
238
|
}
|
|
278
239
|
static fromJSON(typeArgs, json) {
|
|
279
240
|
if (json.$typeName !== VecMap.$typeName) {
|
|
280
241
|
throw new Error("not a WithTwoGenerics json object");
|
|
281
242
|
}
|
|
282
|
-
|
|
243
|
+
assertReifiedTypeArgsMatch(composeSuiType(VecMap.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
|
|
283
244
|
return VecMap.fromJSONField(typeArgs, json);
|
|
284
245
|
}
|
|
285
246
|
static fromSuiParsedData(typeArgs, content) {
|
|
@@ -296,18 +257,18 @@ class VecMap {
|
|
|
296
257
|
if (data.bcs.dataType !== "moveObject" || !isVecMap(data.bcs.type)) {
|
|
297
258
|
throw new Error(`object at is not a VecMap object`);
|
|
298
259
|
}
|
|
299
|
-
const gotTypeArgs =
|
|
260
|
+
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
300
261
|
if (gotTypeArgs.length !== 2) {
|
|
301
262
|
throw new Error(`type argument mismatch: expected 2 type arguments but got ${gotTypeArgs.length}`);
|
|
302
263
|
}
|
|
303
264
|
for (let i = 0; i < 2; i++) {
|
|
304
|
-
const gotTypeArg =
|
|
305
|
-
const expectedTypeArg =
|
|
265
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
266
|
+
const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
|
|
306
267
|
if (gotTypeArg !== expectedTypeArg) {
|
|
307
268
|
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
308
269
|
}
|
|
309
270
|
}
|
|
310
|
-
return VecMap.fromBcs(typeArgs, (
|
|
271
|
+
return VecMap.fromBcs(typeArgs, fromBase64(data.bcs.bcsBytes));
|
|
311
272
|
}
|
|
312
273
|
if (data.content) {
|
|
313
274
|
return VecMap.fromSuiParsedData(typeArgs, data.content);
|
|
@@ -329,7 +290,6 @@ class VecMap {
|
|
|
329
290
|
});
|
|
330
291
|
}
|
|
331
292
|
}
|
|
332
|
-
|
|
333
|
-
VecMap.$typeName = `${index_1.PKG_V31}::vec_map::VecMap`;
|
|
293
|
+
VecMap.$typeName = `${PKG_V31}::vec_map::VecMap`;
|
|
334
294
|
VecMap.$numTypeParams = 2;
|
|
335
295
|
VecMap.$isPhantom = [false, false];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.PACKAGE_ID = "0x3";
|
|
5
|
-
exports.PUBLISHED_AT = "0x3";
|
|
6
|
-
exports.PKG_V19 = "0x3";
|
|
1
|
+
export const PACKAGE_ID = "0x3";
|
|
2
|
+
export const PUBLISHED_AT = "0x3";
|
|
3
|
+
export const PKG_V19 = "0x3";
|