@exodus/sui-api 1.0.3 → 1.1.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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/sui-api@1.0.3...@exodus/sui-api@1.1.0) (2025-10-01)
7
+
8
+
9
+ ### Features
10
+
11
+
12
+ * feat: sui - addressing audit comments (#6560)
13
+
14
+
15
+
6
16
  ## [1.0.3](https://github.com/ExodusMovement/assets/compare/@exodus/sui-api@1.0.2...@exodus/sui-api@1.0.3) (2025-09-10)
7
17
 
8
18
  **Note:** Version bump only for package @exodus/sui-api
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exodus/sui-api",
3
3
  "packageManager": "yarn@4.3.1",
4
- "version": "1.0.3",
4
+ "version": "1.1.0",
5
5
  "description": "Transaction monitors, RPC with the blockchain node, and other networking code for Sui",
6
6
  "type": "module",
7
7
  "main": "src/index.js",
@@ -29,8 +29,8 @@
29
29
  "@exodus/crypto": "^1.0.0-rc.26",
30
30
  "@exodus/currency": "^6.0.1",
31
31
  "@exodus/models": "^12.0.1",
32
- "@exodus/sui-lib": "^1.1.2",
33
- "@exodus/sui-meta": "^1.1.0",
32
+ "@exodus/sui-lib": "^1.3.0",
33
+ "@exodus/sui-meta": "^1.2.0",
34
34
  "bn.js": "^5.2.1",
35
35
  "lodash": "^4.17.21",
36
36
  "minimalistic-assert": "^1.0.1",
@@ -38,7 +38,7 @@
38
38
  "url-join": "^4.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@exodus/asset": "^2.1.0",
41
+ "@exodus/asset": "^2.2.0",
42
42
  "@exodus/assets-testing": "^1.0.0"
43
43
  },
44
44
  "homepage": "https://github.com/ExodusMovement/assets/tree/master/sui/sui-api",
@@ -49,5 +49,5 @@
49
49
  "type": "git",
50
50
  "url": "git+https://github.com/ExodusMovement/assets.git"
51
51
  },
52
- "gitHead": "e34e15811edb278cd5dc38c2d52e9cc9c303058f"
52
+ "gitHead": "b8636ba67e814522b1a744d94501c5eca38ebd68"
53
53
  }
@@ -19,8 +19,7 @@ export const getFeeAsyncFactory = ({ assetClientInterface, serverApi, createUnsi
19
19
  asset,
20
20
  senderAddress,
21
21
  walletAccount,
22
- recipientAddress:
23
- recipientAddress || '0x7a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d28',
22
+ recipientAddress: recipientAddress || senderAddress,
24
23
  amount: amount.toBaseString(),
25
24
  serverApi,
26
25
  gasBudget: MIN_GAS_BUDGET,
@@ -12,6 +12,23 @@ const {
12
12
  parseStructTag,
13
13
  } = vendorLib.utils
14
14
 
15
+ const MOVE_IDENT = /^[A-Z_a-z]\w*$/
16
+
17
+ // Strict .sui domain (labels a-z0-9 and '-', no leading/trailing '-')
18
+ const SUI_DOMAIN_RE = /^(?=.{1,253}$)(?:[\da-z](?:[\da-z-]{0,61}[\da-z])?\.)+sui$/i
19
+
20
+ // Sui address helpers
21
+ function isEvenHexDigits(hex) {
22
+ return /^[\dA-Fa-f]+$/.test(hex) && hex.length > 0 && hex.length % 2 === 0
23
+ }
24
+
25
+ // Pre-normalization: 1..64 hex digits (<=32 bytes), even length, 0x prefixed
26
+ function isSuiAddressLoose(addr) {
27
+ if (!/^0x[\dA-Fa-f]+$/.test(addr)) return false
28
+ const hex = addr.slice(2)
29
+ return isEvenHexDigits(hex) && hex.length <= 64
30
+ }
31
+
15
32
  var __typeError = (msg) => {
16
33
  throw new TypeError(msg)
17
34
  }
@@ -303,7 +320,8 @@ function validateOverrides(overrides) {
303
320
 
304
321
  if (overrides?.types) {
305
322
  for (const [type, val] of Object.entries(overrides.types)) {
306
- if (parseStructTag(type).typeParams.length > 0) {
323
+ // NOTE: exodus dev edited on audit
324
+ if (!isStructTag(type) || parseStructTag(type).typeParams.length > 0) {
307
325
  throw new Error(
308
326
  'Type overrides must be first-level only. If you want to supply generic types, just pass each type individually.'
309
327
  )
@@ -340,9 +358,37 @@ function replaceMvrNames(tag, typeCache) {
340
358
  }
341
359
 
342
360
  function hasMvrName(nameOrType) {
343
- return (
344
- nameOrType.includes(NAME_SEPARATOR) || nameOrType.includes('@') || nameOrType.includes('.sui')
345
- )
361
+ // NOTE: exodus dev edited on audit
362
+ if (typeof nameOrType !== 'string') return false
363
+ const s = nameOrType.trim()
364
+ if (!s) return false
365
+
366
+ // 1) foo(.bar).sui
367
+ if (SUI_DOMAIN_RE.test(s)) return true
368
+
369
+ // 2) name@0x<hex>
370
+ const at = s.indexOf('@')
371
+ if (at > 0) {
372
+ const left = s.slice(0, at)
373
+ const right = s.slice(at + 1)
374
+ if (MOVE_IDENT.test(left) && isSuiAddressLoose(right)) return true
375
+ }
376
+
377
+ // 3) namespace/name (exactly one separator, both identifiers)
378
+ if (s.includes(NAME_SEPARATOR)) {
379
+ const parts = s.split(NAME_SEPARATOR)
380
+ if (
381
+ parts.length === 2 &&
382
+ parts[0] &&
383
+ parts[1] &&
384
+ MOVE_IDENT.test(parts[0]) &&
385
+ MOVE_IDENT.test(parts[1])
386
+ ) {
387
+ return true
388
+ }
389
+ }
390
+
391
+ return false
346
392
  }
347
393
 
348
394
  function isStructTag(type) {
@@ -6,7 +6,7 @@ import { Argument } from './data/internal.js'
6
6
 
7
7
  const { toBase64, normalizeSuiObjectId } = vendorLib.utils
8
8
 
9
- const Commands = {
9
+ export const SuiCommands = {
10
10
  MoveCall(input) {
11
11
  const [pkg, mod = '', fn = ''] =
12
12
  'target' in input ? input.target.split('::') : [input.package, input.module, input.function]
@@ -97,6 +97,3 @@ const Commands = {
97
97
  }
98
98
  },
99
99
  }
100
-
101
- export { Commands }
102
- // # sourceMappingURL=Commands.js.map
@@ -3,7 +3,7 @@
3
3
  import { vendorLib } from '@exodus/sui-lib'
4
4
 
5
5
  import { is, parse } from '../valibot.js'
6
- import { Commands } from './Commands.js'
6
+ import { SuiCommands } from './Commands.js'
7
7
  import { Argument, NormalizedCallArg, ObjectRef, TransactionExpiration } from './data/internal.js'
8
8
  import { SerializedTransactionDataV2 } from './data/v2.js'
9
9
  import { Inputs } from './Inputs.js'
@@ -430,7 +430,7 @@ const _Transaction = class _Transaction {
430
430
 
431
431
  // Method shorthands:
432
432
  splitCoins(coin, amounts) {
433
- const command = Commands.SplitCoins(
433
+ const command = SuiCommands.SplitCoins(
434
434
  typeof coin === 'string'
435
435
  ? this.object(coin)
436
436
  : __privateMethod(this, _Transaction_instances, resolveArgument_fn).call(this, coin),
@@ -449,7 +449,7 @@ const _Transaction = class _Transaction {
449
449
 
450
450
  mergeCoins(destination, sources) {
451
451
  return this.add(
452
- Commands.MergeCoins(
452
+ SuiCommands.MergeCoins(
453
453
  this.object(destination),
454
454
  sources.map((src) => this.object(src))
455
455
  )
@@ -458,7 +458,7 @@ const _Transaction = class _Transaction {
458
458
 
459
459
  publish({ modules, dependencies }) {
460
460
  return this.add(
461
- Commands.Publish({
461
+ SuiCommands.Publish({
462
462
  modules,
463
463
  dependencies,
464
464
  })
@@ -467,7 +467,7 @@ const _Transaction = class _Transaction {
467
467
 
468
468
  upgrade({ modules, dependencies, package: packageId, ticket }) {
469
469
  return this.add(
470
- Commands.Upgrade({
470
+ SuiCommands.Upgrade({
471
471
  modules,
472
472
  dependencies,
473
473
  package: packageId,
@@ -478,7 +478,7 @@ const _Transaction = class _Transaction {
478
478
 
479
479
  moveCall({ arguments: args, ...input }) {
480
480
  return this.add(
481
- Commands.MoveCall({
481
+ SuiCommands.MoveCall({
482
482
  ...input,
483
483
  arguments: args?.map((arg) =>
484
484
  __privateMethod(this, _Transaction_instances, normalizeTransactionArgument_fn).call(
@@ -492,7 +492,7 @@ const _Transaction = class _Transaction {
492
492
 
493
493
  transferObjects(objects, address) {
494
494
  return this.add(
495
- Commands.TransferObjects(
495
+ SuiCommands.TransferObjects(
496
496
  objects.map((obj) => this.object(obj)),
497
497
  typeof address === 'string'
498
498
  ? this.pure.address(address)
@@ -506,7 +506,7 @@ const _Transaction = class _Transaction {
506
506
 
507
507
  makeMoveVec({ type, elements }) {
508
508
  return this.add(
509
- Commands.MakeMoveVec({
509
+ SuiCommands.MakeMoveVec({
510
510
  type,
511
511
  elements: elements.map((obj) => this.object(obj)),
512
512
  })
@@ -2,40 +2,31 @@
2
2
  /* eslint-disable sonarjs/no-nested-template-literals */
3
3
  /* eslint-disable @exodus/mutable/no-param-reassign-prop-only */
4
4
  // src/storages/globalConfig/globalConfig.ts
5
- var store
6
5
 
7
6
  // @__NO_SIDE_EFFECTS__
8
- function getGlobalConfig(config2) {
7
+ function getGlobalConfig(cfg) {
8
+ // NOTE: exodus dev edited on audit
9
9
  return {
10
- lang: config2?.lang ?? store?.lang,
11
- message: config2?.message,
12
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
13
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly,
10
+ lang: cfg?.lang,
11
+ message: cfg?.message,
12
+ abortEarly: !!cfg?.abortEarly,
13
+ abortPipeEarly: !!cfg?.abortPipeEarly,
14
14
  }
15
15
  }
16
16
 
17
- // src/storages/globalMessage/globalMessage.ts
18
- var store2
19
-
20
17
  // @__NO_SIDE_EFFECTS__
21
18
  function getGlobalMessage(lang) {
22
- return store2?.get(lang)
19
+ // NOTE: exodus dev edited on audit
23
20
  }
24
21
 
25
- // src/storages/schemaMessage/schemaMessage.ts
26
- var store3
27
-
28
22
  // @__NO_SIDE_EFFECTS__
29
23
  function getSchemaMessage(lang) {
30
- return store3?.get(lang)
24
+ // NOTE: exodus dev edited on audit
31
25
  }
32
26
 
33
- // src/storages/specificMessage/specificMessage.ts
34
- var store4
35
-
36
27
  // @__NO_SIDE_EFFECTS__
37
28
  function getSpecificMessage(reference, lang) {
38
- return store4?.get(reference)?.get(lang)
29
+ // NOTE: exodus dev edited on audit
39
30
  }
40
31
 
41
32
  // src/utils/_stringify/_stringify.ts