@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.
Files changed (60) hide show
  1. package/cli/src/bytecode.js +28 -30
  2. package/cli/src/index.js +51 -86
  3. package/package.json +1 -1
  4. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -7
  5. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js +35 -75
  6. package/sdk/src/_generated/_dependencies/source/0x1/index.js +3 -6
  7. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -3
  8. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.js +31 -69
  9. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.d.ts +4 -4
  10. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.js +21 -59
  11. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -5
  12. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js +20 -25
  13. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -7
  14. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.js +24 -29
  15. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -7
  16. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.js +49 -56
  17. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.d.ts +52 -52
  18. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.js +206 -223
  19. package/sdk/src/_generated/_dependencies/source/0x2/index.js +3 -6
  20. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -8
  21. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.js +34 -41
  22. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.d.ts +4 -4
  23. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.js +19 -24
  24. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.d.ts +7 -7
  25. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.js +31 -36
  26. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.d.ts +5 -5
  27. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.js +20 -25
  28. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.d.ts +5 -5
  29. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js +57 -97
  30. package/sdk/src/_generated/_dependencies/source/0x3/index.js +3 -6
  31. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.d.ts +60 -60
  32. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js +170 -218
  33. package/sdk/src/_generated/_framework/reified.d.ts +2 -2
  34. package/sdk/src/_generated/_framework/reified.js +27 -40
  35. package/sdk/src/_generated/_framework/util.d.ts +2 -14
  36. package/sdk/src/_generated/_framework/util.js +26 -40
  37. package/sdk/src/_generated/_framework/vector.d.ts +4 -4
  38. package/sdk/src/_generated/_framework/vector.js +16 -21
  39. package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +4 -4
  40. package/sdk/src/_generated/liquid_staking/cell/structs.js +31 -36
  41. package/sdk/src/_generated/liquid_staking/fees/functions.js +55 -75
  42. package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +21 -21
  43. package/sdk/src/_generated/liquid_staking/fees/structs.js +58 -65
  44. package/sdk/src/_generated/liquid_staking/index.js +6 -10
  45. package/sdk/src/_generated/liquid_staking/liquid-staking/functions.js +86 -107
  46. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +98 -98
  47. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +264 -320
  48. package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +31 -31
  49. package/sdk/src/_generated/liquid_staking/storage/structs.js +85 -125
  50. package/sdk/src/_generated/liquid_staking/version/structs.d.ts +4 -4
  51. package/sdk/src/_generated/liquid_staking/version/structs.js +19 -24
  52. package/sdk/src/_generated/liquid_staking/weight/functions.js +44 -56
  53. package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +41 -41
  54. package/sdk/src/_generated/liquid_staking/weight/structs.js +128 -141
  55. package/sdk/src/client.d.ts +16 -16
  56. package/sdk/src/client.js +39 -82
  57. package/sdk/src/index.js +2 -18
  58. package/sdk/src/lib/index.js +1 -17
  59. package/sdk/src/lib/transactions.d.ts +1 -1
  60. package/sdk/src/lib/transactions.js +3 -8
@@ -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,34 +7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
8
  });
43
9
  };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.String = exports.Char = void 0;
46
- exports.isChar = isChar;
47
- exports.isString = isString;
48
- const reified = __importStar(require("../../../../_framework/reified"));
49
- const reified_1 = require("../../../../_framework/reified");
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 { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../../../_framework/reified";
12
+ import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
13
+ import { PKG_V14 } from "../index";
14
+ import { bcs } from "@mysten/sui/bcs";
15
+ import { fromBase64 } from "@mysten/sui/utils";
54
16
  /* ============================== Char =============================== */
55
- function isChar(type) {
56
- type = (0, util_1.compressSuiType)(type);
57
- return type === `${index_1.PKG_V14}::ascii::Char`;
17
+ export function isChar(type) {
18
+ type = compressSuiType(type);
19
+ return type === `${PKG_V14}::ascii::Char`;
58
20
  }
59
- class Char {
21
+ export class Char {
60
22
  constructor(typeArgs, fields) {
61
23
  this.__StructClass = true;
62
24
  this.$typeName = Char.$typeName;
63
25
  this.$isPhantom = Char.$isPhantom;
64
- this.$fullTypeName = (0, util_1.composeSuiType)(Char.$typeName, ...typeArgs);
26
+ this.$fullTypeName = composeSuiType(Char.$typeName, ...typeArgs);
65
27
  this.$typeArgs = typeArgs;
66
28
  this.byte = fields.byte;
67
29
  }
68
30
  static reified() {
69
31
  return {
70
32
  typeName: Char.$typeName,
71
- fullTypeName: (0, util_1.composeSuiType)(Char.$typeName, ...[]),
33
+ fullTypeName: composeSuiType(Char.$typeName, ...[]),
72
34
  typeArgs: [],
73
35
  isPhantom: Char.$isPhantom,
74
36
  reifiedTypeArgs: [],
@@ -91,25 +53,25 @@ class Char {
91
53
  return Char.reified();
92
54
  }
93
55
  static phantom() {
94
- return (0, reified_1.phantom)(Char.reified());
56
+ return phantom(Char.reified());
95
57
  }
96
58
  static get p() {
97
59
  return Char.phantom();
98
60
  }
99
61
  static get bcs() {
100
- return bcs_1.bcs.struct("Char", {
101
- byte: bcs_1.bcs.u8(),
62
+ return bcs.struct("Char", {
63
+ byte: bcs.u8(),
102
64
  });
103
65
  }
104
66
  static fromFields(fields) {
105
- return Char.reified().new({ byte: (0, reified_1.decodeFromFields)("u8", fields.byte) });
67
+ return Char.reified().new({ byte: decodeFromFields("u8", fields.byte) });
106
68
  }
107
69
  static fromFieldsWithTypes(item) {
108
70
  if (!isChar(item.type)) {
109
71
  throw new Error("not a Char type");
110
72
  }
111
73
  return Char.reified().new({
112
- byte: (0, reified_1.decodeFromFieldsWithTypes)("u8", item.fields.byte),
74
+ byte: decodeFromFieldsWithTypes("u8", item.fields.byte),
113
75
  });
114
76
  }
115
77
  static fromBcs(data) {
@@ -124,7 +86,7 @@ class Char {
124
86
  return Object.assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
125
87
  }
126
88
  static fromJSONField(field) {
127
- return Char.reified().new({ byte: (0, reified_1.decodeFromJSONField)("u8", field.byte) });
89
+ return Char.reified().new({ byte: decodeFromJSONField("u8", field.byte) });
128
90
  }
129
91
  static fromJSON(json) {
130
92
  if (json.$typeName !== Char.$typeName) {
@@ -146,7 +108,7 @@ class Char {
146
108
  if (data.bcs.dataType !== "moveObject" || !isChar(data.bcs.type)) {
147
109
  throw new Error(`object at is not a Char object`);
148
110
  }
149
- return Char.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
111
+ return Char.fromBcs(fromBase64(data.bcs.bcsBytes));
150
112
  }
151
113
  if (data.content) {
152
114
  return Char.fromSuiParsedData(data.content);
@@ -168,28 +130,27 @@ class Char {
168
130
  });
169
131
  }
170
132
  }
171
- exports.Char = Char;
172
- Char.$typeName = `${index_1.PKG_V14}::ascii::Char`;
133
+ Char.$typeName = `${PKG_V14}::ascii::Char`;
173
134
  Char.$numTypeParams = 0;
174
135
  Char.$isPhantom = [];
175
136
  /* ============================== String =============================== */
176
- function isString(type) {
177
- type = (0, util_1.compressSuiType)(type);
178
- return type === `${index_1.PKG_V14}::ascii::String`;
137
+ export function isString(type) {
138
+ type = compressSuiType(type);
139
+ return type === `${PKG_V14}::ascii::String`;
179
140
  }
180
- class String {
141
+ export class String {
181
142
  constructor(typeArgs, fields) {
182
143
  this.__StructClass = true;
183
144
  this.$typeName = String.$typeName;
184
145
  this.$isPhantom = String.$isPhantom;
185
- this.$fullTypeName = (0, util_1.composeSuiType)(String.$typeName, ...typeArgs);
146
+ this.$fullTypeName = composeSuiType(String.$typeName, ...typeArgs);
186
147
  this.$typeArgs = typeArgs;
187
148
  this.bytes = fields.bytes;
188
149
  }
189
150
  static reified() {
190
151
  return {
191
152
  typeName: String.$typeName,
192
- fullTypeName: (0, util_1.composeSuiType)(String.$typeName, ...[]),
153
+ fullTypeName: composeSuiType(String.$typeName, ...[]),
193
154
  typeArgs: [],
194
155
  isPhantom: String.$isPhantom,
195
156
  reifiedTypeArgs: [],
@@ -212,19 +173,19 @@ class String {
212
173
  return String.reified();
213
174
  }
214
175
  static phantom() {
215
- return (0, reified_1.phantom)(String.reified());
176
+ return phantom(String.reified());
216
177
  }
217
178
  static get p() {
218
179
  return String.phantom();
219
180
  }
220
181
  static get bcs() {
221
- return bcs_1.bcs.struct("String", {
222
- bytes: bcs_1.bcs.vector(bcs_1.bcs.u8()),
182
+ return bcs.struct("String", {
183
+ bytes: bcs.vector(bcs.u8()),
223
184
  });
224
185
  }
225
186
  static fromFields(fields) {
226
187
  return String.reified().new({
227
- bytes: (0, reified_1.decodeFromFields)(reified.vector("u8"), fields.bytes),
188
+ bytes: decodeFromFields(reified.vector("u8"), fields.bytes),
228
189
  });
229
190
  }
230
191
  static fromFieldsWithTypes(item) {
@@ -232,7 +193,7 @@ class String {
232
193
  throw new Error("not a String type");
233
194
  }
234
195
  return String.reified().new({
235
- bytes: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u8"), item.fields.bytes),
196
+ bytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.bytes),
236
197
  });
237
198
  }
238
199
  static fromBcs(data) {
@@ -240,7 +201,7 @@ class String {
240
201
  }
241
202
  toJSONField() {
242
203
  return {
243
- bytes: (0, reified_1.fieldToJSON)(`vector<u8>`, this.bytes),
204
+ bytes: fieldToJSON(`vector<u8>`, this.bytes),
244
205
  };
245
206
  }
246
207
  toJSON() {
@@ -248,7 +209,7 @@ class String {
248
209
  }
249
210
  static fromJSONField(field) {
250
211
  return String.reified().new({
251
- bytes: (0, reified_1.decodeFromJSONField)(reified.vector("u8"), field.bytes),
212
+ bytes: decodeFromJSONField(reified.vector("u8"), field.bytes),
252
213
  });
253
214
  }
254
215
  static fromJSON(json) {
@@ -271,7 +232,7 @@ class String {
271
232
  if (data.bcs.dataType !== "moveObject" || !isString(data.bcs.type)) {
272
233
  throw new Error(`object at is not a String object`);
273
234
  }
274
- return String.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
235
+ return String.fromBcs(fromBase64(data.bcs.bcsBytes));
275
236
  }
276
237
  if (data.content) {
277
238
  return String.fromSuiParsedData(data.content);
@@ -293,7 +254,6 @@ class String {
293
254
  });
294
255
  }
295
256
  }
296
- exports.String = String;
297
- String.$typeName = `${index_1.PKG_V14}::ascii::String`;
257
+ String.$typeName = `${PKG_V14}::ascii::String`;
298
258
  String.$numTypeParams = 0;
299
259
  String.$isPhantom = [];
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PKG_V14 = exports.PUBLISHED_AT = exports.PACKAGE_ID = void 0;
4
- exports.PACKAGE_ID = "0x1";
5
- exports.PUBLISHED_AT = "0x1";
6
- exports.PKG_V14 = "0x1";
1
+ export const PACKAGE_ID = "0x1";
2
+ export const PUBLISHED_AT = "0x1";
3
+ export const PKG_V14 = "0x1";
@@ -4,7 +4,7 @@ import { FieldsWithTypes } from "../../../../_framework/util";
4
4
  import { Vector } from "../../../../_framework/vector";
5
5
  import { PKG_V14 } from "../index";
6
6
  import { BcsType } from "@mysten/sui/bcs";
7
- import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
7
+ import { SuiJsonRpcClient, SuiObjectData, SuiParsedData } from "@mysten/sui/jsonRpc";
8
8
  export declare function isOption(type: string): boolean;
9
9
  export interface OptionFields<Element extends TypeArgument> {
10
10
  vec: ToField<Vector<Element>>;
@@ -26,7 +26,7 @@ export declare class Option<Element extends TypeArgument> implements StructClass
26
26
  static get r(): typeof Option.reified;
27
27
  static phantom<Element extends Reified<TypeArgument, any>>(Element: Element): PhantomReified<ToTypeStr<Option<ToTypeArgument<Element>>>>;
28
28
  static get p(): typeof Option.phantom;
29
- static get bcs(): <Element extends BcsType<any>>(Element: Element) => import("@mysten/sui/bcs").BcsStruct<{
29
+ static get bcs(): <Element extends BcsType<any>>(Element: Element) => import("@mysten/bcs").BcsStruct<{
30
30
  vec: BcsType<import("@mysten/bcs").InferBcsType<Element>[], Iterable<import("@mysten/bcs").InferBcsInput<Element>> & {
31
31
  length: number;
32
32
  }, string>;
@@ -46,5 +46,5 @@ export declare class Option<Element extends TypeArgument> implements StructClass
46
46
  static fromJSON<Element extends Reified<TypeArgument, any>>(typeArg: Element, json: Record<string, any>): Option<ToTypeArgument<Element>>;
47
47
  static fromSuiParsedData<Element extends Reified<TypeArgument, any>>(typeArg: Element, content: SuiParsedData): Option<ToTypeArgument<Element>>;
48
48
  static fromSuiObjectData<Element extends Reified<TypeArgument, any>>(typeArg: Element, data: SuiObjectData): Option<ToTypeArgument<Element>>;
49
- static fetch<Element extends Reified<TypeArgument, any>>(client: SuiClient, typeArg: Element, id: string): Promise<Option<ToTypeArgument<Element>>>;
49
+ static fetch<Element extends Reified<TypeArgument, any>>(client: SuiJsonRpcClient, typeArg: Element, id: string): Promise<Option<ToTypeArgument<Element>>>;
50
50
  }
@@ -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,48 +7,45 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
8
  });
43
9
  };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.Option = void 0;
46
- exports.isOption = isOption;
47
- const reified = __importStar(require("../../../../_framework/reified"));
48
- const reified_1 = require("../../../../_framework/reified");
49
- const util_1 = require("../../../../_framework/util");
50
- const index_1 = require("../index");
51
- const bcs_1 = require("@mysten/sui/bcs");
52
- 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_V14 } from "../index";
14
+ import { bcs } from "@mysten/sui/bcs";
15
+ import { fromBase64 } from "@mysten/sui/utils";
53
16
  /* ============================== Option =============================== */
54
- function isOption(type) {
55
- type = (0, util_1.compressSuiType)(type);
56
- return type.startsWith(`${index_1.PKG_V14}::option::Option` + "<");
17
+ export function isOption(type) {
18
+ type = compressSuiType(type);
19
+ return type.startsWith(`${PKG_V14}::option::Option` + "<");
57
20
  }
58
- class Option {
21
+ export class Option {
59
22
  constructor(typeArgs, fields) {
60
23
  this.__StructClass = true;
61
24
  this.__inner = null; // for type checking in reified.ts
62
25
  this.$typeName = Option.$typeName;
63
26
  this.$isPhantom = Option.$isPhantom;
64
- this.$fullTypeName = (0, util_1.composeSuiType)(Option.$typeName, ...typeArgs);
27
+ this.$fullTypeName = composeSuiType(Option.$typeName, ...typeArgs);
65
28
  this.$typeArgs = typeArgs;
66
29
  this.vec = fields.vec;
67
30
  }
68
31
  static reified(Element) {
69
32
  return {
70
33
  typeName: Option.$typeName,
71
- fullTypeName: (0, util_1.composeSuiType)(Option.$typeName, ...[(0, reified_1.extractType)(Element)]),
72
- typeArgs: [(0, reified_1.extractType)(Element)],
34
+ fullTypeName: composeSuiType(Option.$typeName, ...[extractType(Element)]),
35
+ typeArgs: [extractType(Element)],
73
36
  isPhantom: Option.$isPhantom,
74
37
  reifiedTypeArgs: [Element],
75
38
  fromFields: (fields) => Option.fromFields(Element, fields),
76
39
  fromFieldsWithTypes: (item) => Option.fromFieldsWithTypes(Element, item),
77
40
  fromBcs: (data) => Option.fromBcs(Element, data),
78
- bcs: Option.bcs((0, reified_1.toBcs)(Element)),
41
+ bcs: Option.bcs(toBcs(Element)),
79
42
  fromJSONField: (field) => Option.fromJSONField(Element, field),
80
43
  fromJSON: (json) => Option.fromJSON(Element, json),
81
44
  fromSuiParsedData: (content) => Option.fromSuiParsedData(Element, content),
82
45
  fromSuiObjectData: (content) => Option.fromSuiObjectData(Element, content),
83
46
  fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return Option.fetch(client, Element, id); }),
84
47
  new: (fields) => {
85
- return new Option([(0, reified_1.extractType)(Element)], fields);
48
+ return new Option([extractType(Element)], fields);
86
49
  },
87
50
  kind: "StructClassReified",
88
51
  };
@@ -91,37 +54,37 @@ class Option {
91
54
  return Option.reified;
92
55
  }
93
56
  static phantom(Element) {
94
- return (0, reified_1.phantom)(Option.reified(Element));
57
+ return phantom(Option.reified(Element));
95
58
  }
96
59
  static get p() {
97
60
  return Option.phantom;
98
61
  }
99
62
  static get bcs() {
100
- return (Element) => bcs_1.bcs.struct(`Option<${Element.name}>`, {
101
- vec: bcs_1.bcs.vector(Element),
63
+ return (Element) => bcs.struct(`Option<${Element.name}>`, {
64
+ vec: bcs.vector(Element),
102
65
  });
103
66
  }
104
67
  static fromFields(typeArg, fields) {
105
68
  return Option.reified(typeArg).new({
106
- vec: (0, reified_1.decodeFromFields)(reified.vector(typeArg), fields.vec),
69
+ vec: decodeFromFields(reified.vector(typeArg), fields.vec),
107
70
  });
108
71
  }
109
72
  static fromFieldsWithTypes(typeArg, item) {
110
73
  if (!isOption(item.type)) {
111
74
  throw new Error("not a Option type");
112
75
  }
113
- (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
76
+ assertFieldsWithTypesArgsMatch(item, [typeArg]);
114
77
  return Option.reified(typeArg).new({
115
- vec: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector(typeArg), item.fields.vec),
78
+ vec: decodeFromFieldsWithTypes(reified.vector(typeArg), item.fields.vec),
116
79
  });
117
80
  }
118
81
  static fromBcs(typeArg, data) {
119
82
  const typeArgs = [typeArg];
120
- return Option.fromFields(typeArg, Option.bcs((0, reified_1.toBcs)(typeArgs[0])).parse(data));
83
+ return Option.fromFields(typeArg, Option.bcs(toBcs(typeArgs[0])).parse(data));
121
84
  }
122
85
  toJSONField() {
123
86
  return {
124
- vec: (0, reified_1.fieldToJSON)(`vector<${this.$typeArgs[0]}>`, this.vec),
87
+ vec: fieldToJSON(`vector<${this.$typeArgs[0]}>`, this.vec),
125
88
  };
126
89
  }
127
90
  toJSON() {
@@ -129,14 +92,14 @@ class Option {
129
92
  }
130
93
  static fromJSONField(typeArg, field) {
131
94
  return Option.reified(typeArg).new({
132
- vec: (0, reified_1.decodeFromJSONField)(reified.vector(typeArg), field.vec),
95
+ vec: decodeFromJSONField(reified.vector(typeArg), field.vec),
133
96
  });
134
97
  }
135
98
  static fromJSON(typeArg, json) {
136
99
  if (json.$typeName !== Option.$typeName) {
137
100
  throw new Error("not a WithTwoGenerics json object");
138
101
  }
139
- (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(Option.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
102
+ assertReifiedTypeArgsMatch(composeSuiType(Option.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
140
103
  return Option.fromJSONField(typeArg, json);
141
104
  }
142
105
  static fromSuiParsedData(typeArg, content) {
@@ -153,16 +116,16 @@ class Option {
153
116
  if (data.bcs.dataType !== "moveObject" || !isOption(data.bcs.type)) {
154
117
  throw new Error(`object at is not a Option object`);
155
118
  }
156
- const gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
119
+ const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
157
120
  if (gotTypeArgs.length !== 1) {
158
121
  throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
159
122
  }
160
- const gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
161
- const expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
162
- if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
123
+ const gotTypeArg = compressSuiType(gotTypeArgs[0]);
124
+ const expectedTypeArg = compressSuiType(extractType(typeArg));
125
+ if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
163
126
  throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
164
127
  }
165
- return Option.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
128
+ return Option.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
166
129
  }
167
130
  if (data.content) {
168
131
  return Option.fromSuiParsedData(typeArg, data.content);
@@ -184,7 +147,6 @@ class Option {
184
147
  });
185
148
  }
186
149
  }
187
- exports.Option = Option;
188
- Option.$typeName = `${index_1.PKG_V14}::option::Option`;
150
+ Option.$typeName = `${PKG_V14}::option::Option`;
189
151
  Option.$numTypeParams = 1;
190
152
  Option.$isPhantom = [false];
@@ -3,7 +3,7 @@ import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../
3
3
  import { FieldsWithTypes } from "../../../../_framework/util";
4
4
  import { Vector } from "../../../../_framework/vector";
5
5
  import { PKG_V14 } from "../index";
6
- import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
6
+ import { SuiJsonRpcClient, SuiObjectData, SuiParsedData } from "@mysten/sui/jsonRpc";
7
7
  export declare function isString(type: string): boolean;
8
8
  export interface StringFields {
9
9
  bytes: ToField<Vector<"u8">>;
@@ -24,8 +24,8 @@ export declare class String implements StructClass {
24
24
  static get r(): reified.StructClassReified<String, StringFields>;
25
25
  static phantom(): PhantomReified<ToTypeStr<String>>;
26
26
  static get p(): reified.PhantomReified<"0x1::string::String">;
27
- static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
28
- bytes: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
27
+ static get bcs(): import("@mysten/bcs").BcsStruct<{
28
+ bytes: import("@mysten/bcs").BcsType<number[], Iterable<number> & {
29
29
  length: number;
30
30
  }, string>;
31
31
  }, string>;
@@ -44,5 +44,5 @@ export declare class String implements StructClass {
44
44
  static fromJSON(json: Record<string, any>): String;
45
45
  static fromSuiParsedData(content: SuiParsedData): String;
46
46
  static fromSuiObjectData(data: SuiObjectData): String;
47
- static fetch(client: SuiClient, id: string): Promise<String>;
47
+ static fetch(client: SuiJsonRpcClient, id: string): Promise<String>;
48
48
  }
@@ -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,33 +7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
8
  });
43
9
  };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.String = void 0;
46
- exports.isString = isString;
47
- const reified = __importStar(require("../../../../_framework/reified"));
48
- const reified_1 = require("../../../../_framework/reified");
49
- const util_1 = require("../../../../_framework/util");
50
- const index_1 = require("../index");
51
- const bcs_1 = require("@mysten/sui/bcs");
52
- const utils_1 = require("@mysten/sui/utils");
10
+ import * as reified from "../../../../_framework/reified";
11
+ import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../../../_framework/reified";
12
+ import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
13
+ import { PKG_V14 } from "../index";
14
+ import { bcs } from "@mysten/sui/bcs";
15
+ import { fromBase64 } from "@mysten/sui/utils";
53
16
  /* ============================== String =============================== */
54
- function isString(type) {
55
- type = (0, util_1.compressSuiType)(type);
56
- return type === `${index_1.PKG_V14}::string::String`;
17
+ export function isString(type) {
18
+ type = compressSuiType(type);
19
+ return type === `${PKG_V14}::string::String`;
57
20
  }
58
- class String {
21
+ export class String {
59
22
  constructor(typeArgs, fields) {
60
23
  this.__StructClass = true;
61
24
  this.$typeName = String.$typeName;
62
25
  this.$isPhantom = String.$isPhantom;
63
- this.$fullTypeName = (0, util_1.composeSuiType)(String.$typeName, ...typeArgs);
26
+ this.$fullTypeName = composeSuiType(String.$typeName, ...typeArgs);
64
27
  this.$typeArgs = typeArgs;
65
28
  this.bytes = fields.bytes;
66
29
  }
67
30
  static reified() {
68
31
  return {
69
32
  typeName: String.$typeName,
70
- fullTypeName: (0, util_1.composeSuiType)(String.$typeName, ...[]),
33
+ fullTypeName: composeSuiType(String.$typeName, ...[]),
71
34
  typeArgs: [],
72
35
  isPhantom: String.$isPhantom,
73
36
  reifiedTypeArgs: [],
@@ -90,19 +53,19 @@ class String {
90
53
  return String.reified();
91
54
  }
92
55
  static phantom() {
93
- return (0, reified_1.phantom)(String.reified());
56
+ return phantom(String.reified());
94
57
  }
95
58
  static get p() {
96
59
  return String.phantom();
97
60
  }
98
61
  static get bcs() {
99
- return bcs_1.bcs.struct("String", {
100
- bytes: bcs_1.bcs.vector(bcs_1.bcs.u8()),
62
+ return bcs.struct("String", {
63
+ bytes: bcs.vector(bcs.u8()),
101
64
  });
102
65
  }
103
66
  static fromFields(fields) {
104
67
  return String.reified().new({
105
- bytes: (0, reified_1.decodeFromFields)(reified.vector("u8"), fields.bytes),
68
+ bytes: decodeFromFields(reified.vector("u8"), fields.bytes),
106
69
  });
107
70
  }
108
71
  static fromFieldsWithTypes(item) {
@@ -110,7 +73,7 @@ class String {
110
73
  throw new Error("not a String type");
111
74
  }
112
75
  return String.reified().new({
113
- bytes: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u8"), item.fields.bytes),
76
+ bytes: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.bytes),
114
77
  });
115
78
  }
116
79
  static fromBcs(data) {
@@ -118,7 +81,7 @@ class String {
118
81
  }
119
82
  toJSONField() {
120
83
  return {
121
- bytes: (0, reified_1.fieldToJSON)(`vector<u8>`, this.bytes),
84
+ bytes: fieldToJSON(`vector<u8>`, this.bytes),
122
85
  };
123
86
  }
124
87
  toJSON() {
@@ -126,7 +89,7 @@ class String {
126
89
  }
127
90
  static fromJSONField(field) {
128
91
  return String.reified().new({
129
- bytes: (0, reified_1.decodeFromJSONField)(reified.vector("u8"), field.bytes),
92
+ bytes: decodeFromJSONField(reified.vector("u8"), field.bytes),
130
93
  });
131
94
  }
132
95
  static fromJSON(json) {
@@ -149,7 +112,7 @@ class String {
149
112
  if (data.bcs.dataType !== "moveObject" || !isString(data.bcs.type)) {
150
113
  throw new Error(`object at is not a String object`);
151
114
  }
152
- return String.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
115
+ return String.fromBcs(fromBase64(data.bcs.bcsBytes));
153
116
  }
154
117
  if (data.content) {
155
118
  return String.fromSuiParsedData(data.content);
@@ -171,7 +134,6 @@ class String {
171
134
  });
172
135
  }
173
136
  }
174
- exports.String = String;
175
- String.$typeName = `${index_1.PKG_V14}::string::String`;
137
+ String.$typeName = `${PKG_V14}::string::String`;
176
138
  String.$numTypeParams = 0;
177
139
  String.$isPhantom = [];