@mysten/sui 2.31.0 → 2.31.2

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 (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/client/core-resolver.d.mts.map +1 -1
  3. package/dist/client/core-resolver.mjs +3 -2
  4. package/dist/client/core-resolver.mjs.map +1 -1
  5. package/dist/client/mvr.mjs +2 -1
  6. package/dist/client/mvr.mjs.map +1 -1
  7. package/dist/cryptography/signature.d.mts +6 -6
  8. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
  9. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  10. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  11. package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
  12. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  13. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  14. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  15. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  16. package/dist/jsonRpc/client.mjs +1 -1
  17. package/dist/transactions/data/internal.d.mts +133 -133
  18. package/dist/transactions/data/v1.d.mts +239 -239
  19. package/dist/transactions/data/v1.d.mts.map +1 -1
  20. package/dist/transactions/data/v2.d.mts +16 -16
  21. package/dist/transactions/data/v2.d.mts.map +1 -1
  22. package/dist/utils/index.d.mts +2 -1
  23. package/dist/utils/index.mjs +2 -1
  24. package/dist/utils/move-registry.d.mts +3 -2
  25. package/dist/utils/move-registry.d.mts.map +1 -1
  26. package/dist/utils/move-registry.mjs +2 -18
  27. package/dist/utils/move-registry.mjs.map +1 -1
  28. package/dist/utils/named-packages.d.mts +5 -0
  29. package/dist/utils/named-packages.d.mts.map +1 -0
  30. package/dist/utils/named-packages.mjs +23 -0
  31. package/dist/utils/named-packages.mjs.map +1 -0
  32. package/dist/utils/sui-types.mjs +1 -1
  33. package/dist/utils/sui-types.mjs.map +1 -1
  34. package/dist/version.mjs +1 -1
  35. package/dist/version.mjs.map +1 -1
  36. package/package.json +1 -1
  37. package/src/client/core-resolver.ts +6 -2
  38. package/src/utils/move-registry.ts +2 -25
  39. package/src/utils/named-packages.ts +29 -0
  40. package/src/utils/sui-types.ts +1 -1
  41. package/src/version.ts +1 -1
@@ -1,12 +1,12 @@
1
1
  import { EnumInputShape } from "@mysten/bcs";
2
- import * as valibot0 from "valibot";
2
+ import * as valibot1369 from "valibot";
3
3
  import { GenericSchema, InferOutput } from "valibot";
4
4
 
5
5
  //#region src/transactions/data/v2.d.ts
6
- declare const SerializedTransactionDataV2Schema: valibot0.ObjectSchema<{
7
- readonly version: valibot0.LiteralSchema<2, undefined>;
8
- readonly sender: valibot0.NullishSchema<valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<undefined>, valibot0.TransformAction<string, string>, valibot0.CheckAction<string, undefined>]>, undefined>;
9
- readonly expiration: valibot0.NullishSchema<GenericSchema<EnumInputShape<{
6
+ declare const SerializedTransactionDataV2Schema: valibot1369.ObjectSchema<{
7
+ readonly version: valibot1369.LiteralSchema<2, undefined>;
8
+ readonly sender: valibot1369.NullishSchema<valibot1369.SchemaWithPipe<readonly [valibot1369.StringSchema<undefined>, valibot1369.TransformAction<string, string>, valibot1369.CheckAction<string, undefined>]>, undefined>;
9
+ readonly expiration: valibot1369.NullishSchema<GenericSchema<EnumInputShape<{
10
10
  None: true;
11
11
  Epoch: string | number;
12
12
  ValidDuring: {
@@ -30,17 +30,17 @@ declare const SerializedTransactionDataV2Schema: valibot0.ObjectSchema<{
30
30
  nonce: number;
31
31
  };
32
32
  }>>, undefined>;
33
- readonly gasData: valibot0.ObjectSchema<{
34
- readonly budget: valibot0.NullableSchema<valibot0.SchemaWithPipe<readonly [valibot0.UnionSchema<[valibot0.StringSchema<undefined>, valibot0.SchemaWithPipe<readonly [valibot0.NumberSchema<undefined>, valibot0.IntegerAction<number, undefined>]>], undefined>, valibot0.CheckAction<string | number, "Invalid u64">]>, undefined>;
35
- readonly price: valibot0.NullableSchema<valibot0.SchemaWithPipe<readonly [valibot0.UnionSchema<[valibot0.StringSchema<undefined>, valibot0.SchemaWithPipe<readonly [valibot0.NumberSchema<undefined>, valibot0.IntegerAction<number, undefined>]>], undefined>, valibot0.CheckAction<string | number, "Invalid u64">]>, undefined>;
36
- readonly owner: valibot0.NullableSchema<valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<undefined>, valibot0.TransformAction<string, string>, valibot0.CheckAction<string, undefined>]>, undefined>;
37
- readonly payment: valibot0.NullableSchema<valibot0.ArraySchema<valibot0.ObjectSchema<{
38
- readonly objectId: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<undefined>, valibot0.TransformAction<string, string>, valibot0.CheckAction<string, undefined>]>;
39
- readonly version: valibot0.SchemaWithPipe<readonly [valibot0.UnionSchema<[valibot0.StringSchema<undefined>, valibot0.SchemaWithPipe<readonly [valibot0.NumberSchema<undefined>, valibot0.IntegerAction<number, undefined>]>], undefined>, valibot0.CheckAction<string | number, "Invalid u64">]>;
40
- readonly digest: valibot0.StringSchema<undefined>;
33
+ readonly gasData: valibot1369.ObjectSchema<{
34
+ readonly budget: valibot1369.NullableSchema<valibot1369.SchemaWithPipe<readonly [valibot1369.UnionSchema<[valibot1369.StringSchema<undefined>, valibot1369.SchemaWithPipe<readonly [valibot1369.NumberSchema<undefined>, valibot1369.IntegerAction<number, undefined>]>], undefined>, valibot1369.CheckAction<string | number, "Invalid u64">]>, undefined>;
35
+ readonly price: valibot1369.NullableSchema<valibot1369.SchemaWithPipe<readonly [valibot1369.UnionSchema<[valibot1369.StringSchema<undefined>, valibot1369.SchemaWithPipe<readonly [valibot1369.NumberSchema<undefined>, valibot1369.IntegerAction<number, undefined>]>], undefined>, valibot1369.CheckAction<string | number, "Invalid u64">]>, undefined>;
36
+ readonly owner: valibot1369.NullableSchema<valibot1369.SchemaWithPipe<readonly [valibot1369.StringSchema<undefined>, valibot1369.TransformAction<string, string>, valibot1369.CheckAction<string, undefined>]>, undefined>;
37
+ readonly payment: valibot1369.NullableSchema<valibot1369.ArraySchema<valibot1369.ObjectSchema<{
38
+ readonly objectId: valibot1369.SchemaWithPipe<readonly [valibot1369.StringSchema<undefined>, valibot1369.TransformAction<string, string>, valibot1369.CheckAction<string, undefined>]>;
39
+ readonly version: valibot1369.SchemaWithPipe<readonly [valibot1369.UnionSchema<[valibot1369.StringSchema<undefined>, valibot1369.SchemaWithPipe<readonly [valibot1369.NumberSchema<undefined>, valibot1369.IntegerAction<number, undefined>]>], undefined>, valibot1369.CheckAction<string | number, "Invalid u64">]>;
40
+ readonly digest: valibot1369.StringSchema<undefined>;
41
41
  }, undefined>, undefined>, undefined>;
42
42
  }, undefined>;
43
- readonly inputs: valibot0.ArraySchema<GenericSchema<EnumInputShape<{
43
+ readonly inputs: valibot1369.ArraySchema<GenericSchema<EnumInputShape<{
44
44
  Object: EnumInputShape<{
45
45
  ImmOrOwnedObject: {
46
46
  objectId: string;
@@ -90,7 +90,7 @@ declare const SerializedTransactionDataV2Schema: valibot0.ObjectSchema<{
90
90
  };
91
91
  };
92
92
  }>>, undefined>;
93
- readonly commands: valibot0.ArraySchema<GenericSchema<EnumInputShape<{
93
+ readonly commands: valibot1369.ArraySchema<GenericSchema<EnumInputShape<{
94
94
  MoveCall: {
95
95
  package: string;
96
96
  module: string;
@@ -189,7 +189,7 @@ declare const SerializedTransactionDataV2Schema: valibot0.ObjectSchema<{
189
189
  };
190
190
  };
191
191
  }>>, undefined>;
192
- readonly digest: valibot0.OptionalSchema<valibot0.NullableSchema<valibot0.StringSchema<undefined>, undefined>, undefined>;
192
+ readonly digest: valibot1369.OptionalSchema<valibot1369.NullableSchema<valibot1369.StringSchema<undefined>, undefined>, undefined>;
193
193
  }, undefined>;
194
194
  type SerializedTransactionDataV2 = InferOutput<typeof SerializedTransactionDataV2Schema>;
195
195
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.mts","names":[],"sources":["../../../src/transactions/data/v2.ts"],"mappings":";;;;;cAqJa,iCAAA,WAAiC,YAAA;EAAA,kBAQ5C,QAAA,CAAA,aAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEU,2BAAA,GAA8B,WAAA,QAAmB,iCAAA"}
1
+ {"version":3,"file":"v2.d.mts","names":[],"sources":["../../../src/transactions/data/v2.ts"],"mappings":";;;;;cAqJa,iCAAA,cAAiC,YAAA;EAAA,kBAQ5C,WAAA,CAAA,aAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEU,2BAAA,GAA8B,WAAA,QAAmB,iCAAA"}
@@ -3,7 +3,8 @@ import { SUI_ADDRESS_LENGTH, isValidStructTag, isValidSuiAddress, isValidSuiObje
3
3
  import { formatAddress, formatDigest, parseToMist, parseToUnits } from "./format.mjs";
4
4
  import { isValidSuiNSName, normalizeSuiNSName } from "./suins.mjs";
5
5
  import { MIST_PER_SUI, MOVE_STDLIB_ADDRESS, SUI_CLOCK_OBJECT_ID, SUI_COIN_REGISTRY_OBJECT_ID, SUI_DECIMALS, SUI_DENY_LIST_OBJECT_ID, SUI_FRAMEWORK_ADDRESS, SUI_RANDOM_OBJECT_ID, SUI_SYSTEM_ADDRESS, SUI_SYSTEM_MODULE_NAME, SUI_SYSTEM_STATE_OBJECT_ID, SUI_TYPE_ARG } from "./constants.mjs";
6
- import { isValidNamedPackage, isValidNamedType } from "./move-registry.mjs";
6
+ import { isValidNamedPackage } from "./named-packages.mjs";
7
+ import { isValidNamedType } from "./move-registry.mjs";
7
8
  import { deriveDynamicFieldID } from "./dynamic-fields.mjs";
8
9
  import { deriveObjectID } from "./derived-objects.mjs";
9
10
  import { fromBase58, fromBase64, fromHex, toBase58, toBase64, toHex } from "@mysten/bcs";
@@ -1,8 +1,9 @@
1
1
  import { isValidSuiNSName, normalizeSuiNSName } from "./suins.mjs";
2
- import { isValidNamedPackage, isValidNamedType } from "./move-registry.mjs";
2
+ import { isValidNamedPackage } from "./named-packages.mjs";
3
3
  import { SUI_ADDRESS_LENGTH, isValidStructTag, isValidSuiAddress, isValidSuiObjectId, isValidTransactionDigest, normalizeStructTag, normalizeSuiAddress, normalizeSuiObjectId, parseStructTag } from "./sui-types.mjs";
4
4
  import { normalizeTypeTag } from "../bcs/type-tag-serializer.mjs";
5
5
  import { deriveDynamicFieldID } from "./dynamic-fields.mjs";
6
+ import { isValidNamedType } from "./move-registry.mjs";
6
7
  import { MIST_PER_SUI, MOVE_STDLIB_ADDRESS, SUI_CLOCK_OBJECT_ID, SUI_COIN_REGISTRY_OBJECT_ID, SUI_DECIMALS, SUI_DENY_LIST_OBJECT_ID, SUI_FRAMEWORK_ADDRESS, SUI_RANDOM_OBJECT_ID, SUI_SYSTEM_ADDRESS, SUI_SYSTEM_MODULE_NAME, SUI_SYSTEM_STATE_OBJECT_ID, SUI_TYPE_ARG } from "./constants.mjs";
7
8
  import { formatAddress, formatDigest, parseToMist, parseToUnits } from "./format.mjs";
8
9
  import { deriveObjectID } from "./derived-objects.mjs";
@@ -1,9 +1,10 @@
1
+ import { isValidNamedPackage } from "./named-packages.mjs";
2
+
1
3
  //#region src/utils/move-registry.d.ts
2
- declare const isValidNamedPackage: (name: string) => boolean;
3
4
  /**
4
5
  * Checks if a type contains valid named packages and is a valid Move struct tag.
5
6
  */
6
7
  declare const isValidNamedType: (type: string) => boolean;
7
8
  //#endregion
8
- export { isValidNamedPackage, isValidNamedType };
9
+ export { isValidNamedType };
9
10
  //# sourceMappingURL=move-registry.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"move-registry.d.mts","names":[],"sources":["../../src/utils/move-registry.ts"],"mappings":";cAea,mBAAA,GAAuB,IAAA;AAApC;;;AAAA,cAmBa,gBAAA,GAAoB,IAAA"}
1
+ {"version":3,"file":"move-registry.d.mts","names":[],"sources":["../../src/utils/move-registry.ts"],"mappings":";;;;;AAWA;cAAa,gBAAA,GAAoB,IAAA"}
@@ -1,23 +1,7 @@
1
- import { isValidSuiNSName } from "./suins.mjs";
1
+ import { NAME_SEPARATOR, isValidNamedPackage } from "./named-packages.mjs";
2
2
  import { isValidStructTag } from "./sui-types.mjs";
3
3
 
4
4
  //#region src/utils/move-registry.ts
5
- /** The pattern to find an optionally versioned name */
6
- const NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
7
- /** The pattern for a valid version number */
8
- const VERSION_REGEX = /^\d+$/;
9
- /** The maximum size for an app */
10
- const MAX_APP_SIZE = 64;
11
- /** The separator for the name */
12
- const NAME_SEPARATOR = "/";
13
- const isValidNamedPackage = (name) => {
14
- const parts = name.split(NAME_SEPARATOR);
15
- if (parts.length < 2 || parts.length > 3) return false;
16
- const [org, app, version] = parts;
17
- if (version !== void 0 && !VERSION_REGEX.test(version)) return false;
18
- if (!isValidSuiNSName(org)) return false;
19
- return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
20
- };
21
5
  /**
22
6
  * Checks if a type contains valid named packages and is a valid Move struct tag.
23
7
  */
@@ -28,5 +12,5 @@ const isValidNamedType = (type) => {
28
12
  };
29
13
 
30
14
  //#endregion
31
- export { isValidNamedPackage, isValidNamedType };
15
+ export { isValidNamedType };
32
16
  //# sourceMappingURL=move-registry.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"move-registry.mjs","names":[],"sources":["../../src/utils/move-registry.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { isValidSuiNSName } from './suins.js';\nimport { isValidStructTag } from './sui-types.js';\n\n/** The pattern to find an optionally versioned name */\nconst NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;\n/** The pattern for a valid version number */\nconst VERSION_REGEX = /^\\d+$/;\n/** The maximum size for an app */\nconst MAX_APP_SIZE = 64;\n/** The separator for the name */\nconst NAME_SEPARATOR = '/';\n\nexport const isValidNamedPackage = (name: string): boolean => {\n\tconst parts = name.split(NAME_SEPARATOR);\n\t// The name has to have 2 parts (without-version), or 3 parts (with version).\n\tif (parts.length < 2 || parts.length > 3) return false;\n\n\tconst [org, app, version] = parts; // split by {org} {app} {optional version}\n\n\t// If the version exists, it must be a number.\n\tif (version !== undefined && !VERSION_REGEX.test(version)) return false;\n\t// Check if the org is a valid SuiNS name.\n\tif (!isValidSuiNSName(org)) return false;\n\n\t// Check if the app is a valid name.\n\treturn NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;\n};\n\n/**\n * Checks if a type contains valid named packages and is a valid Move struct tag.\n */\nexport const isValidNamedType = (type: string): boolean => {\n\t// split our type by all possible type delimeters.\n\tconst splitType = type.split(/::|<|>|,/);\n\tfor (const t of splitType) {\n\t\tif (t.includes(NAME_SEPARATOR) && !isValidNamedPackage(t)) return false;\n\t}\n\treturn isValidStructTag(type);\n};\n"],"mappings":";;;;;AAOA,MAAM,eAAe;;AAErB,MAAM,gBAAgB;;AAEtB,MAAM,eAAe;;AAErB,MAAM,iBAAiB;AAEvB,MAAa,uBAAuB,SAA0B;CAC7D,MAAM,QAAQ,KAAK,MAAM,eAAe;AAExC,KAAI,MAAM,SAAS,KAAK,MAAM,SAAS,EAAG,QAAO;CAEjD,MAAM,CAAC,KAAK,KAAK,WAAW;AAG5B,KAAI,YAAY,UAAa,CAAC,cAAc,KAAK,QAAQ,CAAE,QAAO;AAElE,KAAI,CAAC,iBAAiB,IAAI,CAAE,QAAO;AAGnC,QAAO,aAAa,KAAK,IAAI,IAAI,IAAI,SAAS;;;;;AAM/C,MAAa,oBAAoB,SAA0B;CAE1D,MAAM,YAAY,KAAK,MAAM,WAAW;AACxC,MAAK,MAAM,KAAK,UACf,KAAI,EAAE,SAAS,eAAe,IAAI,CAAC,oBAAoB,EAAE,CAAE,QAAO;AAEnE,QAAO,iBAAiB,KAAK"}
1
+ {"version":3,"file":"move-registry.mjs","names":[],"sources":["../../src/utils/move-registry.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { isValidNamedPackage, NAME_SEPARATOR } from './named-packages.js';\nimport { isValidStructTag } from './sui-types.js';\n\nexport { isValidNamedPackage } from './named-packages.js';\n\n/**\n * Checks if a type contains valid named packages and is a valid Move struct tag.\n */\nexport const isValidNamedType = (type: string): boolean => {\n\t// split our type by all possible type delimeters.\n\tconst splitType = type.split(/::|<|>|,/);\n\tfor (const t of splitType) {\n\t\tif (t.includes(NAME_SEPARATOR) && !isValidNamedPackage(t)) return false;\n\t}\n\treturn isValidStructTag(type);\n};\n"],"mappings":";;;;;;;AAWA,MAAa,oBAAoB,SAA0B;CAE1D,MAAM,YAAY,KAAK,MAAM,WAAW;AACxC,MAAK,MAAM,KAAK,UACf,KAAI,EAAE,SAAS,eAAe,IAAI,CAAC,oBAAoB,EAAE,CAAE,QAAO;AAEnE,QAAO,iBAAiB,KAAK"}
@@ -0,0 +1,5 @@
1
+ //#region src/utils/named-packages.d.ts
2
+ declare const isValidNamedPackage: (name: string) => boolean;
3
+ //#endregion
4
+ export { isValidNamedPackage };
5
+ //# sourceMappingURL=named-packages.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"named-packages.d.mts","names":[],"sources":["../../src/utils/named-packages.ts"],"mappings":";cAca,mBAAA,GAAuB,IAAA"}
@@ -0,0 +1,23 @@
1
+ import { isValidSuiNSName } from "./suins.mjs";
2
+
3
+ //#region src/utils/named-packages.ts
4
+ /** The pattern to find an optionally versioned name */
5
+ const NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
6
+ /** The pattern for a valid version number */
7
+ const VERSION_REGEX = /^\d+$/;
8
+ /** The maximum size for an app */
9
+ const MAX_APP_SIZE = 64;
10
+ /** The separator for the name */
11
+ const NAME_SEPARATOR = "/";
12
+ const isValidNamedPackage = (name) => {
13
+ const parts = name.split(NAME_SEPARATOR);
14
+ if (parts.length < 2 || parts.length > 3) return false;
15
+ const [org, app, version] = parts;
16
+ if (version !== void 0 && !VERSION_REGEX.test(version)) return false;
17
+ if (!isValidSuiNSName(org)) return false;
18
+ return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
19
+ };
20
+
21
+ //#endregion
22
+ export { NAME_SEPARATOR, isValidNamedPackage };
23
+ //# sourceMappingURL=named-packages.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"named-packages.mjs","names":[],"sources":["../../src/utils/named-packages.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { isValidSuiNSName } from './suins.js';\n\n/** The pattern to find an optionally versioned name */\nconst NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;\n/** The pattern for a valid version number */\nconst VERSION_REGEX = /^\\d+$/;\n/** The maximum size for an app */\nconst MAX_APP_SIZE = 64;\n/** The separator for the name */\nexport const NAME_SEPARATOR = '/';\n\nexport const isValidNamedPackage = (name: string): boolean => {\n\tconst parts = name.split(NAME_SEPARATOR);\n\t// The name has to have 2 parts (without-version), or 3 parts (with version).\n\tif (parts.length < 2 || parts.length > 3) return false;\n\n\tconst [org, app, version] = parts; // split by {org} {app} {optional version}\n\n\t// If the version exists, it must be a number.\n\tif (version !== undefined && !VERSION_REGEX.test(version)) return false;\n\t// Check if the org is a valid SuiNS name.\n\tif (!isValidSuiNSName(org)) return false;\n\n\t// Check if the app is a valid name.\n\treturn NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;\n};\n"],"mappings":";;;;AAMA,MAAM,eAAe;;AAErB,MAAM,gBAAgB;;AAEtB,MAAM,eAAe;;AAErB,MAAa,iBAAiB;AAE9B,MAAa,uBAAuB,SAA0B;CAC7D,MAAM,QAAQ,KAAK,MAAM,eAAe;AAExC,KAAI,MAAM,SAAS,KAAK,MAAM,SAAS,EAAG,QAAO;CAEjD,MAAM,CAAC,KAAK,KAAK,WAAW;AAG5B,KAAI,YAAY,UAAa,CAAC,cAAc,KAAK,QAAQ,CAAE,QAAO;AAElE,KAAI,CAAC,iBAAiB,IAAI,CAAE,QAAO;AAGnC,QAAO,aAAa,KAAK,IAAI,IAAI,IAAI,SAAS"}
@@ -1,4 +1,4 @@
1
- import { isValidNamedPackage } from "./move-registry.mjs";
1
+ import { isValidNamedPackage } from "./named-packages.mjs";
2
2
  import { fromBase58, splitGenericParameters } from "@mysten/bcs";
3
3
 
4
4
  //#region src/utils/sui-types.ts
@@ -1 +1 @@
1
- {"version":3,"file":"sui-types.mjs","names":[],"sources":["../../src/utils/sui-types.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase58, splitGenericParameters } from '@mysten/bcs';\n\nimport { isValidNamedPackage } from './move-registry.js';\n\nconst TX_DIGEST_LENGTH = 32;\n\n/** Returns whether the tx digest is valid based on the serialization format */\nexport function isValidTransactionDigest(value: string): value is string {\n\ttry {\n\t\tconst buffer = fromBase58(value);\n\t\treturn buffer.length === TX_DIGEST_LENGTH;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// TODO - can we automatically sync this with rust length definition?\n// Source of truth is\n// https://github.com/MystenLabs/sui/blob/acb2b97ae21f47600e05b0d28127d88d0725561d/crates/sui-types/src/base_types.rs#L67\n// which uses the Move account address length\n// https://github.com/move-language/move/blob/67ec40dc50c66c34fd73512fcc412f3b68d67235/language/move-core/types/src/account_address.rs#L23 .\n\nexport const SUI_ADDRESS_LENGTH = 32;\nexport function isValidSuiAddress(value: string): value is string {\n\treturn isHex(value) && getHexByteLength(value) === SUI_ADDRESS_LENGTH;\n}\n\nexport function isValidSuiObjectId(value: string): boolean {\n\treturn isValidSuiAddress(value);\n}\n\nconst MOVE_IDENTIFIER_REGEX = /^[a-zA-Z][a-zA-Z0-9_]*$/;\n\nexport function isValidMoveIdentifier(name: string): boolean {\n\treturn MOVE_IDENTIFIER_REGEX.test(name);\n}\n\nconst PRIMITIVE_TYPE_TAGS = [\n\t'bool',\n\t'u8',\n\t'u16',\n\t'u32',\n\t'u64',\n\t'u128',\n\t'u256',\n\t'address',\n\t'signer',\n];\n\nconst VECTOR_TYPE_REGEX = /^vector<(.+)>$/;\n\nfunction isValidTypeTag(type: string): boolean {\n\tif (PRIMITIVE_TYPE_TAGS.includes(type)) return true;\n\n\tconst vectorMatch = type.match(VECTOR_TYPE_REGEX);\n\tif (vectorMatch) return isValidTypeTag(vectorMatch[1]);\n\n\tif (type.includes('::')) return isValidStructTag(type);\n\n\treturn false;\n}\n\nfunction isValidParsedStructTag(tag: StructTag): boolean {\n\tif (!isValidSuiAddress(tag.address) && !isValidNamedPackage(tag.address)) {\n\t\treturn false;\n\t}\n\n\tif (!isValidMoveIdentifier(tag.module) || !isValidMoveIdentifier(tag.name)) {\n\t\treturn false;\n\t}\n\n\treturn tag.typeParams.every((param) => {\n\t\tif (typeof param === 'string') {\n\t\t\treturn isValidTypeTag(param);\n\t\t}\n\t\treturn isValidParsedStructTag(param);\n\t});\n}\n\nexport function isValidStructTag(type: string): boolean {\n\ttry {\n\t\tconst tag = parseStructTag(type);\n\t\treturn isValidParsedStructTag(tag);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport type StructTag = {\n\taddress: string;\n\tmodule: string;\n\tname: string;\n\ttypeParams: (string | StructTag)[];\n};\n\nfunction parseTypeTag(type: string): string | StructTag {\n\tif (type.startsWith('vector<')) {\n\t\tif (!type.endsWith('>')) {\n\t\t\tthrow new Error(`Invalid type tag: ${type}`);\n\t\t}\n\t\tconst inner = type.slice(7, -1);\n\t\tif (!inner) {\n\t\t\tthrow new Error(`Invalid type tag: ${type}`);\n\t\t}\n\t\tconst parsed = parseTypeTag(inner);\n\t\tif (typeof parsed === 'string') {\n\t\t\treturn `vector<${parsed}>`;\n\t\t}\n\t\treturn `vector<${normalizeStructTag(parsed)}>`;\n\t}\n\n\tif (!type.includes('::')) return type;\n\n\treturn parseStructTag(type);\n}\n\nexport function parseStructTag(type: string): StructTag {\n\tconst parts = type.split('::');\n\n\tif (parts.length < 3) {\n\t\tthrow new Error(`Invalid struct tag: ${type}`);\n\t}\n\n\tconst [address, module] = parts;\n\n\tif (!address || !module) {\n\t\tthrow new Error(`Invalid struct tag: ${type}`);\n\t}\n\n\tconst isMvrPackage = isValidNamedPackage(address);\n\n\tconst rest = type.slice(address.length + module.length + 4);\n\tconst name = rest.includes('<') ? rest.slice(0, rest.indexOf('<')) : rest;\n\n\tif (!name || (rest.includes('<') && !rest.endsWith('>'))) {\n\t\tthrow new Error(`Invalid struct tag: ${type}`);\n\t}\n\n\tconst typeParams = rest.includes('<')\n\t\t? splitGenericParameters(rest.slice(rest.indexOf('<') + 1, rest.lastIndexOf('>'))).map(\n\t\t\t\t(typeParam) => parseTypeTag(typeParam.trim()),\n\t\t\t)\n\t\t: [];\n\n\treturn {\n\t\taddress: isMvrPackage ? address : normalizeSuiAddress(address),\n\t\tmodule,\n\t\tname,\n\t\ttypeParams,\n\t};\n}\n\nexport function normalizeStructTag(type: string | StructTag): string {\n\tif (typeof type === 'string' && type.startsWith('vector<')) {\n\t\tthrow new Error(\n\t\t\t'normalizeStructTag does not support vector types. Use normalizeTypeTag instead.',\n\t\t);\n\t}\n\n\tconst { address, module, name, typeParams } =\n\t\ttypeof type === 'string' ? parseStructTag(type) : type;\n\n\tconst formattedTypeParams =\n\t\ttypeParams?.length > 0\n\t\t\t? `<${typeParams\n\t\t\t\t\t.map((typeParam) =>\n\t\t\t\t\t\ttypeof typeParam === 'string' ? typeParam : normalizeStructTag(typeParam),\n\t\t\t\t\t)\n\t\t\t\t\t.join(',')}>`\n\t\t\t: '';\n\n\treturn `${address}::${module}::${name}${formattedTypeParams}`;\n}\n\n/**\n * Perform the following operations:\n * 1. Make the address lower case\n * 2. Prepend `0x` if the string does not start with `0x`.\n * 3. Add more zeros if the length of the address(excluding `0x`) is less than `SUI_ADDRESS_LENGTH`\n *\n * WARNING: if the address value itself starts with `0x`, e.g., `0x0x`, the default behavior\n * is to treat the first `0x` not as part of the address. The default behavior can be overridden by\n * setting `forceAdd0x` to true\n *\n */\nexport function normalizeSuiAddress(value: string, forceAdd0x: boolean = false): string {\n\tlet address = value.toLowerCase();\n\tif (!forceAdd0x && address.startsWith('0x')) {\n\t\taddress = address.slice(2);\n\t}\n\treturn `0x${address.padStart(SUI_ADDRESS_LENGTH * 2, '0')}`;\n}\n\nexport function normalizeSuiObjectId(value: string, forceAdd0x: boolean = false): string {\n\treturn normalizeSuiAddress(value, forceAdd0x);\n}\n\nfunction isHex(value: string): boolean {\n\treturn /^(0x|0X)?[a-fA-F0-9]+$/.test(value) && value.length % 2 === 0;\n}\n\nfunction getHexByteLength(value: string): number {\n\treturn /^(0x|0X)/.test(value) ? (value.length - 2) / 2 : value.length / 2;\n}\n"],"mappings":";;;;AAOA,MAAM,mBAAmB;;AAGzB,SAAgB,yBAAyB,OAAgC;AACxE,KAAI;AAEH,SADe,WAAW,MAAM,CAClB,WAAW;SAClB;AACP,SAAO;;;AAUT,MAAa,qBAAqB;AAClC,SAAgB,kBAAkB,OAAgC;AACjE,QAAO,MAAM,MAAM,IAAI,iBAAiB,MAAM,KAAK;;AAGpD,SAAgB,mBAAmB,OAAwB;AAC1D,QAAO,kBAAkB,MAAM;;AAGhC,MAAM,wBAAwB;AAE9B,SAAgB,sBAAsB,MAAuB;AAC5D,QAAO,sBAAsB,KAAK,KAAK;;AAG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E3B,QAAO,KAAK,QAAQ,SAAS,qBAAqB,GAAG,IAAI;;AAG1D,SAAgB,qBAAqB,OAAe,aAAsB,OAAe;AACxF,QAAO,oBAAoB,OAAO,WAAW;;AAG9C,SAAS,MAAM,OAAwB;AACtC,QAAO,yBAAyB,KAAK,MAAM,IAAI,MAAM,SAAS,MAAM;;AAGrE,SAAS,iBAAiB,OAAuB;AAChD,QAAO,WAAW,KAAK,MAAM,IAAI,MAAM,SAAS,KAAK,IAAI,MAAM,SAAS"}
1
+ {"version":3,"file":"sui-types.mjs","names":[],"sources":["../../src/utils/sui-types.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase58, splitGenericParameters } from '@mysten/bcs';\n\nimport { isValidNamedPackage } from './named-packages.js';\n\nconst TX_DIGEST_LENGTH = 32;\n\n/** Returns whether the tx digest is valid based on the serialization format */\nexport function isValidTransactionDigest(value: string): value is string {\n\ttry {\n\t\tconst buffer = fromBase58(value);\n\t\treturn buffer.length === TX_DIGEST_LENGTH;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// TODO - can we automatically sync this with rust length definition?\n// Source of truth is\n// https://github.com/MystenLabs/sui/blob/acb2b97ae21f47600e05b0d28127d88d0725561d/crates/sui-types/src/base_types.rs#L67\n// which uses the Move account address length\n// https://github.com/move-language/move/blob/67ec40dc50c66c34fd73512fcc412f3b68d67235/language/move-core/types/src/account_address.rs#L23 .\n\nexport const SUI_ADDRESS_LENGTH = 32;\nexport function isValidSuiAddress(value: string): value is string {\n\treturn isHex(value) && getHexByteLength(value) === SUI_ADDRESS_LENGTH;\n}\n\nexport function isValidSuiObjectId(value: string): boolean {\n\treturn isValidSuiAddress(value);\n}\n\nconst MOVE_IDENTIFIER_REGEX = /^[a-zA-Z][a-zA-Z0-9_]*$/;\n\nexport function isValidMoveIdentifier(name: string): boolean {\n\treturn MOVE_IDENTIFIER_REGEX.test(name);\n}\n\nconst PRIMITIVE_TYPE_TAGS = [\n\t'bool',\n\t'u8',\n\t'u16',\n\t'u32',\n\t'u64',\n\t'u128',\n\t'u256',\n\t'address',\n\t'signer',\n];\n\nconst VECTOR_TYPE_REGEX = /^vector<(.+)>$/;\n\nfunction isValidTypeTag(type: string): boolean {\n\tif (PRIMITIVE_TYPE_TAGS.includes(type)) return true;\n\n\tconst vectorMatch = type.match(VECTOR_TYPE_REGEX);\n\tif (vectorMatch) return isValidTypeTag(vectorMatch[1]);\n\n\tif (type.includes('::')) return isValidStructTag(type);\n\n\treturn false;\n}\n\nfunction isValidParsedStructTag(tag: StructTag): boolean {\n\tif (!isValidSuiAddress(tag.address) && !isValidNamedPackage(tag.address)) {\n\t\treturn false;\n\t}\n\n\tif (!isValidMoveIdentifier(tag.module) || !isValidMoveIdentifier(tag.name)) {\n\t\treturn false;\n\t}\n\n\treturn tag.typeParams.every((param) => {\n\t\tif (typeof param === 'string') {\n\t\t\treturn isValidTypeTag(param);\n\t\t}\n\t\treturn isValidParsedStructTag(param);\n\t});\n}\n\nexport function isValidStructTag(type: string): boolean {\n\ttry {\n\t\tconst tag = parseStructTag(type);\n\t\treturn isValidParsedStructTag(tag);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport type StructTag = {\n\taddress: string;\n\tmodule: string;\n\tname: string;\n\ttypeParams: (string | StructTag)[];\n};\n\nfunction parseTypeTag(type: string): string | StructTag {\n\tif (type.startsWith('vector<')) {\n\t\tif (!type.endsWith('>')) {\n\t\t\tthrow new Error(`Invalid type tag: ${type}`);\n\t\t}\n\t\tconst inner = type.slice(7, -1);\n\t\tif (!inner) {\n\t\t\tthrow new Error(`Invalid type tag: ${type}`);\n\t\t}\n\t\tconst parsed = parseTypeTag(inner);\n\t\tif (typeof parsed === 'string') {\n\t\t\treturn `vector<${parsed}>`;\n\t\t}\n\t\treturn `vector<${normalizeStructTag(parsed)}>`;\n\t}\n\n\tif (!type.includes('::')) return type;\n\n\treturn parseStructTag(type);\n}\n\nexport function parseStructTag(type: string): StructTag {\n\tconst parts = type.split('::');\n\n\tif (parts.length < 3) {\n\t\tthrow new Error(`Invalid struct tag: ${type}`);\n\t}\n\n\tconst [address, module] = parts;\n\n\tif (!address || !module) {\n\t\tthrow new Error(`Invalid struct tag: ${type}`);\n\t}\n\n\tconst isMvrPackage = isValidNamedPackage(address);\n\n\tconst rest = type.slice(address.length + module.length + 4);\n\tconst name = rest.includes('<') ? rest.slice(0, rest.indexOf('<')) : rest;\n\n\tif (!name || (rest.includes('<') && !rest.endsWith('>'))) {\n\t\tthrow new Error(`Invalid struct tag: ${type}`);\n\t}\n\n\tconst typeParams = rest.includes('<')\n\t\t? splitGenericParameters(rest.slice(rest.indexOf('<') + 1, rest.lastIndexOf('>'))).map(\n\t\t\t\t(typeParam) => parseTypeTag(typeParam.trim()),\n\t\t\t)\n\t\t: [];\n\n\treturn {\n\t\taddress: isMvrPackage ? address : normalizeSuiAddress(address),\n\t\tmodule,\n\t\tname,\n\t\ttypeParams,\n\t};\n}\n\nexport function normalizeStructTag(type: string | StructTag): string {\n\tif (typeof type === 'string' && type.startsWith('vector<')) {\n\t\tthrow new Error(\n\t\t\t'normalizeStructTag does not support vector types. Use normalizeTypeTag instead.',\n\t\t);\n\t}\n\n\tconst { address, module, name, typeParams } =\n\t\ttypeof type === 'string' ? parseStructTag(type) : type;\n\n\tconst formattedTypeParams =\n\t\ttypeParams?.length > 0\n\t\t\t? `<${typeParams\n\t\t\t\t\t.map((typeParam) =>\n\t\t\t\t\t\ttypeof typeParam === 'string' ? typeParam : normalizeStructTag(typeParam),\n\t\t\t\t\t)\n\t\t\t\t\t.join(',')}>`\n\t\t\t: '';\n\n\treturn `${address}::${module}::${name}${formattedTypeParams}`;\n}\n\n/**\n * Perform the following operations:\n * 1. Make the address lower case\n * 2. Prepend `0x` if the string does not start with `0x`.\n * 3. Add more zeros if the length of the address(excluding `0x`) is less than `SUI_ADDRESS_LENGTH`\n *\n * WARNING: if the address value itself starts with `0x`, e.g., `0x0x`, the default behavior\n * is to treat the first `0x` not as part of the address. The default behavior can be overridden by\n * setting `forceAdd0x` to true\n *\n */\nexport function normalizeSuiAddress(value: string, forceAdd0x: boolean = false): string {\n\tlet address = value.toLowerCase();\n\tif (!forceAdd0x && address.startsWith('0x')) {\n\t\taddress = address.slice(2);\n\t}\n\treturn `0x${address.padStart(SUI_ADDRESS_LENGTH * 2, '0')}`;\n}\n\nexport function normalizeSuiObjectId(value: string, forceAdd0x: boolean = false): string {\n\treturn normalizeSuiAddress(value, forceAdd0x);\n}\n\nfunction isHex(value: string): boolean {\n\treturn /^(0x|0X)?[a-fA-F0-9]+$/.test(value) && value.length % 2 === 0;\n}\n\nfunction getHexByteLength(value: string): number {\n\treturn /^(0x|0X)/.test(value) ? (value.length - 2) / 2 : value.length / 2;\n}\n"],"mappings":";;;;AAOA,MAAM,mBAAmB;;AAGzB,SAAgB,yBAAyB,OAAgC;AACxE,KAAI;AAEH,SADe,WAAW,MAAM,CAClB,WAAW;SAClB;AACP,SAAO;;;AAUT,MAAa,qBAAqB;AAClC,SAAgB,kBAAkB,OAAgC;AACjE,QAAO,MAAM,MAAM,IAAI,iBAAiB,MAAM,KAAK;;AAGpD,SAAgB,mBAAmB,OAAwB;AAC1D,QAAO,kBAAkB,MAAM;;AAGhC,MAAM,wBAAwB;AAE9B,SAAgB,sBAAsB,MAAuB;AAC5D,QAAO,sBAAsB,KAAK,KAAK;;AAGxC,MAAM,sBAAsB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAM,oBAAoB;AAE1B,SAAS,eAAe,MAAuB;AAC9C,KAAI,oBAAoB,SAAS,KAAK,CAAE,QAAO;CAE/C,MAAM,cAAc,KAAK,MAAM,kBAAkB;AACjD,KAAI,YAAa,QAAO,eAAe,YAAY,GAAG;AAEtD,KAAI,KAAK,SAAS,KAAK,CAAE,QAAO,iBAAiB,KAAK;AAEtD,QAAO;;AAGR,SAAS,uBAAuB,KAAyB;AACxD,KAAI,CAAC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  //#region src/version.ts
2
- const PACKAGE_VERSION = "2.31.0";
2
+ const PACKAGE_VERSION = "2.31.2";
3
3
 
4
4
  //#endregion
5
5
  export { PACKAGE_VERSION };
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// This file is generated by genversion.mjs. Do not edit it directly.\n\nexport const PACKAGE_VERSION = '2.31.0';\n"],"mappings":";AAKA,MAAa,kBAAkB"}
1
+ {"version":3,"file":"version.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// This file is generated by genversion.mjs. Do not edit it directly.\n\nexport const PACKAGE_VERSION = '2.31.2';\n"],"mappings":";AAKA,MAAa,kBAAkB"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui TypeScript API",
5
5
  "homepage": "https://sdk.mystenlabs.com",
6
- "version": "2.31.0",
6
+ "version": "2.31.2",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -22,6 +22,9 @@ import { transactionUsesGasCoin } from '../transactions/resolution-utils.js';
22
22
  // The maximum objects that can be fetched at once using multiGetObjects.
23
23
  const MAX_OBJECTS_PER_FETCH = 50;
24
24
 
25
+ // The gas payment limit is inclusive as of protocol version 96.
26
+ const MAX_GAS_PAYMENT_OBJECTS = 256;
27
+
25
28
  // An amount of gas (in gas units) that is added to transactions as an overhead to ensure transactions do not fail.
26
29
  const GAS_SAFE_OVERHEAD = 1000n;
27
30
  const MAX_GAS = 50_000_000_000;
@@ -237,12 +240,13 @@ function setGasPayment({
237
240
  if (usesGasCoin && reservationAmount > 0n && chainIdentifier && epoch) {
238
241
  transactionData.gasData.payment = [
239
242
  createCoinReservationRef(reservationAmount, gasPayer, chainIdentifier, epoch),
240
- ...paymentCoins,
243
+ // The reservation occupies one entry in the gas payment limit.
244
+ ...paymentCoins.slice(0, MAX_GAS_PAYMENT_OBJECTS - 1),
241
245
  ];
242
246
  } else if (!filteredCoins.length) {
243
247
  throw new Error('No valid gas coins found for the transaction.');
244
248
  } else {
245
- transactionData.gasData.payment = paymentCoins;
249
+ transactionData.gasData.payment = paymentCoins.slice(0, MAX_GAS_PAYMENT_OBJECTS);
246
250
  }
247
251
  }
248
252
 
@@ -1,33 +1,10 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { isValidSuiNSName } from './suins.js';
4
+ import { isValidNamedPackage, NAME_SEPARATOR } from './named-packages.js';
5
5
  import { isValidStructTag } from './sui-types.js';
6
6
 
7
- /** The pattern to find an optionally versioned name */
8
- const NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
9
- /** The pattern for a valid version number */
10
- const VERSION_REGEX = /^\d+$/;
11
- /** The maximum size for an app */
12
- const MAX_APP_SIZE = 64;
13
- /** The separator for the name */
14
- const NAME_SEPARATOR = '/';
15
-
16
- export const isValidNamedPackage = (name: string): boolean => {
17
- const parts = name.split(NAME_SEPARATOR);
18
- // The name has to have 2 parts (without-version), or 3 parts (with version).
19
- if (parts.length < 2 || parts.length > 3) return false;
20
-
21
- const [org, app, version] = parts; // split by {org} {app} {optional version}
22
-
23
- // If the version exists, it must be a number.
24
- if (version !== undefined && !VERSION_REGEX.test(version)) return false;
25
- // Check if the org is a valid SuiNS name.
26
- if (!isValidSuiNSName(org)) return false;
27
-
28
- // Check if the app is a valid name.
29
- return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
30
- };
7
+ export { isValidNamedPackage } from './named-packages.js';
31
8
 
32
9
  /**
33
10
  * Checks if a type contains valid named packages and is a valid Move struct tag.
@@ -0,0 +1,29 @@
1
+ // Copyright (c) Mysten Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { isValidSuiNSName } from './suins.js';
5
+
6
+ /** The pattern to find an optionally versioned name */
7
+ const NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
8
+ /** The pattern for a valid version number */
9
+ const VERSION_REGEX = /^\d+$/;
10
+ /** The maximum size for an app */
11
+ const MAX_APP_SIZE = 64;
12
+ /** The separator for the name */
13
+ export const NAME_SEPARATOR = '/';
14
+
15
+ export const isValidNamedPackage = (name: string): boolean => {
16
+ const parts = name.split(NAME_SEPARATOR);
17
+ // The name has to have 2 parts (without-version), or 3 parts (with version).
18
+ if (parts.length < 2 || parts.length > 3) return false;
19
+
20
+ const [org, app, version] = parts; // split by {org} {app} {optional version}
21
+
22
+ // If the version exists, it must be a number.
23
+ if (version !== undefined && !VERSION_REGEX.test(version)) return false;
24
+ // Check if the org is a valid SuiNS name.
25
+ if (!isValidSuiNSName(org)) return false;
26
+
27
+ // Check if the app is a valid name.
28
+ return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
29
+ };
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { fromBase58, splitGenericParameters } from '@mysten/bcs';
5
5
 
6
- import { isValidNamedPackage } from './move-registry.js';
6
+ import { isValidNamedPackage } from './named-packages.js';
7
7
 
8
8
  const TX_DIGEST_LENGTH = 32;
9
9
 
package/src/version.ts CHANGED
@@ -3,4 +3,4 @@
3
3
 
4
4
  // This file is generated by genversion.mjs. Do not edit it directly.
5
5
 
6
- export const PACKAGE_VERSION = '2.31.0';
6
+ export const PACKAGE_VERSION = '2.31.2';