@mysten/sui 1.37.5 → 1.38.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 (156) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/bcs/index.d.ts +1 -1
  3. package/dist/cjs/cryptography/intent.d.ts +1 -1
  4. package/dist/cjs/cryptography/keypair.d.ts +1 -1
  5. package/dist/cjs/cryptography/keypair.js.map +1 -1
  6. package/dist/cjs/cryptography/publickey.d.ts +3 -3
  7. package/dist/cjs/cryptography/publickey.js.map +2 -2
  8. package/dist/cjs/cryptography/signature.d.ts +3 -3
  9. package/dist/cjs/experimental/transports/json-rpc-resolver.js +5 -3
  10. package/dist/cjs/experimental/transports/json-rpc-resolver.js.map +2 -2
  11. package/dist/cjs/experimental/transports/jsonRPC.d.ts +2 -2
  12. package/dist/cjs/keypairs/ed25519/keypair.d.ts +1 -1
  13. package/dist/cjs/keypairs/ed25519/keypair.js.map +1 -1
  14. package/dist/cjs/keypairs/ed25519/publickey.d.ts +1 -1
  15. package/dist/cjs/keypairs/ed25519/publickey.js.map +2 -2
  16. package/dist/cjs/keypairs/passkey/keypair.d.ts +1 -1
  17. package/dist/cjs/keypairs/passkey/keypair.js.map +1 -1
  18. package/dist/cjs/keypairs/passkey/publickey.d.ts +1 -1
  19. package/dist/cjs/keypairs/passkey/publickey.js.map +2 -2
  20. package/dist/cjs/keypairs/secp256k1/keypair.d.ts +1 -1
  21. package/dist/cjs/keypairs/secp256k1/keypair.js.map +1 -1
  22. package/dist/cjs/keypairs/secp256k1/publickey.d.ts +1 -1
  23. package/dist/cjs/keypairs/secp256k1/publickey.js.map +2 -2
  24. package/dist/cjs/keypairs/secp256r1/keypair.d.ts +1 -1
  25. package/dist/cjs/keypairs/secp256r1/keypair.js.map +1 -1
  26. package/dist/cjs/keypairs/secp256r1/publickey.d.ts +1 -1
  27. package/dist/cjs/keypairs/secp256r1/publickey.js.map +2 -2
  28. package/dist/cjs/multisig/publickey.d.ts +1 -1
  29. package/dist/cjs/multisig/publickey.js.map +2 -2
  30. package/dist/cjs/transactions/Commands.d.ts +9 -9
  31. package/dist/cjs/transactions/Commands.js +9 -9
  32. package/dist/cjs/transactions/Commands.js.map +2 -2
  33. package/dist/cjs/transactions/Transaction.d.ts +6 -5
  34. package/dist/cjs/transactions/Transaction.js +5 -5
  35. package/dist/cjs/transactions/Transaction.js.map +2 -2
  36. package/dist/cjs/transactions/TransactionData.d.ts +4 -5
  37. package/dist/cjs/transactions/TransactionData.js +3 -3
  38. package/dist/cjs/transactions/TransactionData.js.map +2 -2
  39. package/dist/cjs/transactions/data/internal.d.ts +21 -19
  40. package/dist/cjs/transactions/data/internal.js +45 -44
  41. package/dist/cjs/transactions/data/internal.js.map +2 -2
  42. package/dist/cjs/transactions/data/v1.d.ts +1 -1
  43. package/dist/cjs/transactions/data/v1.js +1 -1
  44. package/dist/cjs/transactions/data/v1.js.map +2 -2
  45. package/dist/cjs/transactions/data/v2.d.ts +4 -2
  46. package/dist/cjs/transactions/data/v2.js +7 -6
  47. package/dist/cjs/transactions/data/v2.js.map +2 -2
  48. package/dist/cjs/transactions/executor/caching.d.ts +1 -1
  49. package/dist/cjs/transactions/executor/serial.d.ts +1 -1
  50. package/dist/cjs/transactions/object.js +6 -16
  51. package/dist/cjs/transactions/object.js.map +2 -2
  52. package/dist/cjs/transactions/utils.d.ts +1 -2
  53. package/dist/cjs/transactions/utils.js +1 -1
  54. package/dist/cjs/transactions/utils.js.map +2 -2
  55. package/dist/cjs/utils/derived-objects.d.ts +5 -0
  56. package/dist/cjs/utils/derived-objects.js +34 -0
  57. package/dist/cjs/utils/derived-objects.js.map +7 -0
  58. package/dist/cjs/utils/index.d.ts +1 -0
  59. package/dist/cjs/utils/index.js +2 -0
  60. package/dist/cjs/utils/index.js.map +2 -2
  61. package/dist/cjs/version.d.ts +2 -2
  62. package/dist/cjs/version.js +2 -2
  63. package/dist/cjs/version.js.map +1 -1
  64. package/dist/cjs/zklogin/publickey.d.ts +2 -2
  65. package/dist/cjs/zklogin/publickey.js.map +2 -2
  66. package/dist/esm/bcs/index.d.ts +1 -1
  67. package/dist/esm/cryptography/intent.d.ts +1 -1
  68. package/dist/esm/cryptography/keypair.d.ts +1 -1
  69. package/dist/esm/cryptography/keypair.js.map +1 -1
  70. package/dist/esm/cryptography/publickey.d.ts +3 -3
  71. package/dist/esm/cryptography/publickey.js.map +2 -2
  72. package/dist/esm/cryptography/signature.d.ts +3 -3
  73. package/dist/esm/experimental/transports/json-rpc-resolver.js +6 -4
  74. package/dist/esm/experimental/transports/json-rpc-resolver.js.map +2 -2
  75. package/dist/esm/experimental/transports/jsonRPC.d.ts +2 -2
  76. package/dist/esm/keypairs/ed25519/keypair.d.ts +1 -1
  77. package/dist/esm/keypairs/ed25519/keypair.js.map +1 -1
  78. package/dist/esm/keypairs/ed25519/publickey.d.ts +1 -1
  79. package/dist/esm/keypairs/ed25519/publickey.js.map +2 -2
  80. package/dist/esm/keypairs/passkey/keypair.d.ts +1 -1
  81. package/dist/esm/keypairs/passkey/keypair.js.map +1 -1
  82. package/dist/esm/keypairs/passkey/publickey.d.ts +1 -1
  83. package/dist/esm/keypairs/passkey/publickey.js.map +2 -2
  84. package/dist/esm/keypairs/secp256k1/keypair.d.ts +1 -1
  85. package/dist/esm/keypairs/secp256k1/keypair.js.map +1 -1
  86. package/dist/esm/keypairs/secp256k1/publickey.d.ts +1 -1
  87. package/dist/esm/keypairs/secp256k1/publickey.js.map +2 -2
  88. package/dist/esm/keypairs/secp256r1/keypair.d.ts +1 -1
  89. package/dist/esm/keypairs/secp256r1/keypair.js.map +1 -1
  90. package/dist/esm/keypairs/secp256r1/publickey.d.ts +1 -1
  91. package/dist/esm/keypairs/secp256r1/publickey.js.map +2 -2
  92. package/dist/esm/multisig/publickey.d.ts +1 -1
  93. package/dist/esm/multisig/publickey.js.map +2 -2
  94. package/dist/esm/transactions/Commands.d.ts +9 -9
  95. package/dist/esm/transactions/Commands.js +10 -10
  96. package/dist/esm/transactions/Commands.js.map +2 -2
  97. package/dist/esm/transactions/Transaction.d.ts +6 -5
  98. package/dist/esm/transactions/Transaction.js +12 -7
  99. package/dist/esm/transactions/Transaction.js.map +2 -2
  100. package/dist/esm/transactions/TransactionData.d.ts +4 -5
  101. package/dist/esm/transactions/TransactionData.js +4 -4
  102. package/dist/esm/transactions/TransactionData.js.map +2 -2
  103. package/dist/esm/transactions/data/internal.d.ts +21 -19
  104. package/dist/esm/transactions/data/internal.js +45 -44
  105. package/dist/esm/transactions/data/internal.js.map +2 -2
  106. package/dist/esm/transactions/data/v1.d.ts +1 -1
  107. package/dist/esm/transactions/data/v1.js +2 -2
  108. package/dist/esm/transactions/data/v1.js.map +2 -2
  109. package/dist/esm/transactions/data/v2.d.ts +4 -2
  110. package/dist/esm/transactions/data/v2.js +8 -7
  111. package/dist/esm/transactions/data/v2.js.map +2 -2
  112. package/dist/esm/transactions/executor/caching.d.ts +1 -1
  113. package/dist/esm/transactions/executor/serial.d.ts +1 -1
  114. package/dist/esm/transactions/object.js +6 -16
  115. package/dist/esm/transactions/object.js.map +2 -2
  116. package/dist/esm/transactions/utils.d.ts +1 -2
  117. package/dist/esm/transactions/utils.js +2 -2
  118. package/dist/esm/transactions/utils.js.map +2 -2
  119. package/dist/esm/utils/derived-objects.d.ts +5 -0
  120. package/dist/esm/utils/derived-objects.js +14 -0
  121. package/dist/esm/utils/derived-objects.js.map +7 -0
  122. package/dist/esm/utils/index.d.ts +1 -0
  123. package/dist/esm/utils/index.js +2 -0
  124. package/dist/esm/utils/index.js.map +2 -2
  125. package/dist/esm/version.d.ts +2 -2
  126. package/dist/esm/version.js +2 -2
  127. package/dist/esm/version.js.map +1 -1
  128. package/dist/esm/zklogin/publickey.d.ts +2 -2
  129. package/dist/esm/zklogin/publickey.js.map +2 -2
  130. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  131. package/dist/tsconfig.tsbuildinfo +1 -1
  132. package/package.json +10 -10
  133. package/src/cryptography/keypair.ts +1 -1
  134. package/src/cryptography/publickey.ts +2 -2
  135. package/src/experimental/transports/json-rpc-resolver.ts +8 -4
  136. package/src/keypairs/ed25519/keypair.ts +1 -1
  137. package/src/keypairs/ed25519/publickey.ts +3 -3
  138. package/src/keypairs/passkey/keypair.ts +2 -2
  139. package/src/keypairs/passkey/publickey.ts +3 -3
  140. package/src/keypairs/secp256k1/keypair.ts +1 -1
  141. package/src/keypairs/secp256k1/publickey.ts +3 -3
  142. package/src/keypairs/secp256r1/keypair.ts +1 -1
  143. package/src/keypairs/secp256r1/publickey.ts +3 -3
  144. package/src/multisig/publickey.ts +3 -3
  145. package/src/transactions/Commands.ts +27 -22
  146. package/src/transactions/Transaction.ts +18 -11
  147. package/src/transactions/TransactionData.ts +7 -6
  148. package/src/transactions/data/internal.ts +44 -42
  149. package/src/transactions/data/v1.ts +5 -5
  150. package/src/transactions/data/v2.ts +7 -6
  151. package/src/transactions/object.ts +6 -18
  152. package/src/transactions/utils.ts +3 -3
  153. package/src/utils/derived-objects.ts +22 -0
  154. package/src/utils/index.ts +2 -0
  155. package/src/version.ts +2 -2
  156. package/src/zklogin/publickey.ts +3 -3
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": "1.37.5",
6
+ "version": "1.38.0",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -111,7 +111,7 @@
111
111
  "access": "public"
112
112
  },
113
113
  "devDependencies": {
114
- "@0no-co/graphqlsp": "^1.14.0",
114
+ "@0no-co/graphqlsp": "^1.15.0",
115
115
  "@graphql-codegen/add": "^5.0.3",
116
116
  "@graphql-codegen/cli": "^5.0.7",
117
117
  "@graphql-codegen/typed-document-node": "^5.1.2",
@@ -125,11 +125,11 @@
125
125
  "@types/ws": "^8.18.1",
126
126
  "cross-env": "^7.0.3",
127
127
  "graphql-config": "^5.1.5",
128
- "msw": "^2.10.4",
129
- "tmp": "^0.2.3",
128
+ "msw": "^2.11.1",
129
+ "tmp": "^0.2.5",
130
130
  "ts-retry-promise": "^0.8.1",
131
- "typescript": "^5.8.3",
132
- "vite": "^7.0.5",
131
+ "typescript": "^5.9.2",
132
+ "vite": "^7.1.5",
133
133
  "vite-tsconfig-paths": "^5.1.4",
134
134
  "vitest": "^3.2.4",
135
135
  "wait-on": "^8.0.4",
@@ -143,12 +143,12 @@
143
143
  "@scure/base": "^1.2.6",
144
144
  "@scure/bip32": "^1.7.0",
145
145
  "@scure/bip39": "^1.6.0",
146
- "gql.tada": "^1.8.12",
146
+ "gql.tada": "^1.8.13",
147
147
  "graphql": "^16.11.0",
148
- "poseidon-lite": "^0.2.0",
148
+ "poseidon-lite": "0.2.1",
149
149
  "valibot": "^0.36.0",
150
- "@mysten/bcs": "1.7.0",
151
- "@mysten/utils": "0.1.1"
150
+ "@mysten/bcs": "1.8.0",
151
+ "@mysten/utils": "0.2.0"
152
152
  },
153
153
  "scripts": {
154
154
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
@@ -39,7 +39,7 @@ export interface SignAndExecuteOptions {
39
39
  * TODO: Document
40
40
  */
41
41
  export abstract class Signer {
42
- abstract sign(bytes: Uint8Array): Promise<Uint8Array>;
42
+ abstract sign(bytes: Uint8Array): Promise<Uint8Array<ArrayBuffer>>;
43
43
  /**
44
44
  * Sign messages with a specific intent. By combining the message bytes with the intent before hashing and signing,
45
45
  * it ensures that a signed message is tied to a specific purpose and domain separator is provided
@@ -105,7 +105,7 @@ export abstract class PublicKey {
105
105
  * Returns the bytes representation of the public key
106
106
  * prefixed with the signature scheme flag
107
107
  */
108
- toSuiBytes(): Uint8Array {
108
+ toSuiBytes(): Uint8Array<ArrayBuffer> {
109
109
  const rawBytes = this.toRawBytes();
110
110
  const suiBytes = new Uint8Array(rawBytes.length + 1);
111
111
  suiBytes.set([this.flag()]);
@@ -127,7 +127,7 @@ export abstract class PublicKey {
127
127
  /**
128
128
  * Return the byte array representation of the public key
129
129
  */
130
- abstract toRawBytes(): Uint8Array;
130
+ abstract toRawBytes(): Uint8Array<ArrayBuffer>;
131
131
 
132
132
  /**
133
133
  * Return signature scheme flag of the public key
@@ -4,7 +4,7 @@
4
4
  import { parse } from 'valibot';
5
5
 
6
6
  import { normalizeSuiAddress, normalizeSuiObjectId, SUI_TYPE_ARG } from '../../utils/index.js';
7
- import { ObjectRef } from '../../transactions/data/internal.js';
7
+ import { ObjectRefSchema } from '../../transactions/data/internal.js';
8
8
  import type { CallArg, Command, OpenMoveTypeSignature } from '../../transactions/data/internal.js';
9
9
  import { Inputs } from '../../transactions/Inputs.js';
10
10
  import {
@@ -118,7 +118,9 @@ async function setGasPayment(transactionData: TransactionDataBuilder, client: Su
118
118
  throw new Error('No valid gas coins found for the transaction.');
119
119
  }
120
120
 
121
- transactionData.gasConfig.payment = paymentCoins.map((payment) => parse(ObjectRef, payment));
121
+ transactionData.gasConfig.payment = paymentCoins.map((payment) =>
122
+ parse(ObjectRefSchema, payment),
123
+ );
122
124
  }
123
125
  }
124
126
 
@@ -206,7 +208,7 @@ async function resolveObjectReferences(transactionData: TransactionDataBuilder,
206
208
  objectId: id,
207
209
  initialSharedVersion:
208
210
  input.UnresolvedObject.initialSharedVersion || object?.initialSharedVersion!,
209
- mutable: isUsedAsMutable(transactionData, index),
211
+ mutable: input.UnresolvedObject.mutable || isUsedAsMutable(transactionData, index),
210
212
  });
211
213
  } else if (isUsedAsReceiving(transactionData, index)) {
212
214
  updated = Inputs.ReceivingRef(
@@ -252,7 +254,9 @@ async function normalizeInputs(transactionData: TransactionDataBuilder, client:
252
254
  return null;
253
255
  });
254
256
  const needsResolution = inputs.some(
255
- (input) => input?.UnresolvedPure || input?.UnresolvedObject,
257
+ (input) =>
258
+ input?.UnresolvedPure ||
259
+ (input?.UnresolvedObject && typeof input?.UnresolvedObject.mutable !== 'boolean'),
256
260
  );
257
261
 
258
262
  if (needsResolution) {
@@ -139,7 +139,7 @@ export class Ed25519Keypair extends Keypair {
139
139
  * Return the signature for the provided data using Ed25519.
140
140
  */
141
141
  async sign(data: Uint8Array) {
142
- return ed25519.sign(data, this.keypair.secretKey);
142
+ return ed25519.sign(data, this.keypair.secretKey) as Uint8Array<ArrayBuffer>;
143
143
  }
144
144
 
145
145
  /**
@@ -19,7 +19,7 @@ const PUBLIC_KEY_SIZE = 32;
19
19
  */
20
20
  export class Ed25519PublicKey extends PublicKey {
21
21
  static SIZE = PUBLIC_KEY_SIZE;
22
- private data: Uint8Array;
22
+ private data: Uint8Array<ArrayBuffer>;
23
23
 
24
24
  /**
25
25
  * Create a new Ed25519PublicKey object
@@ -31,7 +31,7 @@ export class Ed25519PublicKey extends PublicKey {
31
31
  if (typeof value === 'string') {
32
32
  this.data = fromBase64(value);
33
33
  } else if (value instanceof Uint8Array) {
34
- this.data = value;
34
+ this.data = value as Uint8Array<ArrayBuffer>;
35
35
  } else {
36
36
  this.data = Uint8Array.from(value);
37
37
  }
@@ -53,7 +53,7 @@ export class Ed25519PublicKey extends PublicKey {
53
53
  /**
54
54
  * Return the byte array representation of the Ed25519 public key
55
55
  */
56
- toRawBytes(): Uint8Array {
56
+ toRawBytes(): Uint8Array<ArrayBuffer> {
57
57
  return this.data;
58
58
  }
59
59
 
@@ -65,7 +65,7 @@ export class BrowserPasskeyProvider implements PasskeyProvider {
65
65
  name: this.#name,
66
66
  displayName: this.#name,
67
67
  ...this.#options.user,
68
- id: randomBytes(10),
68
+ id: randomBytes(10) as BufferSource,
69
69
  },
70
70
  challenge: new TextEncoder().encode('Create passkey wallet on Sui'),
71
71
  pubKeyCredParams: [{ alg: -7, type: 'public-key' }],
@@ -83,7 +83,7 @@ export class BrowserPasskeyProvider implements PasskeyProvider {
83
83
  async get(challenge: Uint8Array): Promise<AuthenticationCredential> {
84
84
  return (await navigator.credentials.get({
85
85
  publicKey: {
86
- challenge,
86
+ challenge: challenge as BufferSource,
87
87
  userVerification: this.#options.authenticatorSelection?.userVerification || 'required',
88
88
  timeout: this.#options.timeout ?? 60000,
89
89
  },
@@ -65,7 +65,7 @@ export const SECP256R1_SPKI_HEADER = new Uint8Array([
65
65
  */
66
66
  export class PasskeyPublicKey extends PublicKey {
67
67
  static SIZE = PASSKEY_PUBLIC_KEY_SIZE;
68
- private data: Uint8Array;
68
+ private data: Uint8Array<ArrayBuffer>;
69
69
 
70
70
  /**
71
71
  * Create a new PasskeyPublicKey object
@@ -77,7 +77,7 @@ export class PasskeyPublicKey extends PublicKey {
77
77
  if (typeof value === 'string') {
78
78
  this.data = fromBase64(value);
79
79
  } else if (value instanceof Uint8Array) {
80
- this.data = value;
80
+ this.data = value as Uint8Array<ArrayBuffer>;
81
81
  } else {
82
82
  this.data = Uint8Array.from(value);
83
83
  }
@@ -99,7 +99,7 @@ export class PasskeyPublicKey extends PublicKey {
99
99
  /**
100
100
  * Return the byte array representation of the Secp256r1 public key
101
101
  */
102
- toRawBytes(): Uint8Array {
102
+ toRawBytes(): Uint8Array<ArrayBuffer> {
103
103
  return this.data;
104
104
  }
105
105
 
@@ -132,7 +132,7 @@ export class Secp256k1Keypair extends Keypair {
132
132
  const sig = secp256k1.sign(msgHash, this.keypair.secretKey, {
133
133
  lowS: true,
134
134
  });
135
- return sig.toCompactRawBytes();
135
+ return sig.toCompactRawBytes() as Uint8Array<ArrayBuffer>;
136
136
  }
137
137
 
138
138
  /**
@@ -20,7 +20,7 @@ const SECP256K1_PUBLIC_KEY_SIZE = 33;
20
20
  */
21
21
  export class Secp256k1PublicKey extends PublicKey {
22
22
  static SIZE = SECP256K1_PUBLIC_KEY_SIZE;
23
- private data: Uint8Array;
23
+ private data: Uint8Array<ArrayBuffer>;
24
24
 
25
25
  /**
26
26
  * Create a new Secp256k1PublicKey object
@@ -32,7 +32,7 @@ export class Secp256k1PublicKey extends PublicKey {
32
32
  if (typeof value === 'string') {
33
33
  this.data = fromBase64(value);
34
34
  } else if (value instanceof Uint8Array) {
35
- this.data = value;
35
+ this.data = value as Uint8Array<ArrayBuffer>;
36
36
  } else {
37
37
  this.data = Uint8Array.from(value);
38
38
  }
@@ -54,7 +54,7 @@ export class Secp256k1PublicKey extends PublicKey {
54
54
  /**
55
55
  * Return the byte array representation of the Secp256k1 public key
56
56
  */
57
- toRawBytes(): Uint8Array {
57
+ toRawBytes(): Uint8Array<ArrayBuffer> {
58
58
  return this.data;
59
59
  }
60
60
 
@@ -133,7 +133,7 @@ export class Secp256r1Keypair extends Keypair {
133
133
  const sig = secp256r1.sign(msgHash, this.keypair.secretKey, {
134
134
  lowS: true,
135
135
  });
136
- return sig.toCompactRawBytes();
136
+ return sig.toCompactRawBytes() as Uint8Array<ArrayBuffer>;
137
137
  }
138
138
 
139
139
  /**
@@ -17,7 +17,7 @@ const SECP256R1_PUBLIC_KEY_SIZE = 33;
17
17
  */
18
18
  export class Secp256r1PublicKey extends PublicKey {
19
19
  static SIZE = SECP256R1_PUBLIC_KEY_SIZE;
20
- private data: Uint8Array;
20
+ private data: Uint8Array<ArrayBuffer>;
21
21
 
22
22
  /**
23
23
  * Create a new Secp256r1PublicKey object
@@ -29,7 +29,7 @@ export class Secp256r1PublicKey extends PublicKey {
29
29
  if (typeof value === 'string') {
30
30
  this.data = fromBase64(value);
31
31
  } else if (value instanceof Uint8Array) {
32
- this.data = value;
32
+ this.data = value as Uint8Array<ArrayBuffer>;
33
33
  } else {
34
34
  this.data = Uint8Array.from(value);
35
35
  }
@@ -51,7 +51,7 @@ export class Secp256r1PublicKey extends PublicKey {
51
51
  /**
52
52
  * Return the byte array representation of the Secp256r1 public key
53
53
  */
54
- toRawBytes(): Uint8Array {
54
+ toRawBytes(): Uint8Array<ArrayBuffer> {
55
55
  return this.data;
56
56
  }
57
57
 
@@ -64,7 +64,7 @@ export const MIN_SIGNER_IN_MULTISIG = 1;
64
64
  * A MultiSig public key
65
65
  */
66
66
  export class MultiSigPublicKey extends PublicKey {
67
- private rawBytes: Uint8Array;
67
+ private rawBytes: Uint8Array<ArrayBuffer>;
68
68
  private multisigPublicKey: MultiSigPublicKeyStruct;
69
69
  private publicKeys: {
70
70
  weight: number;
@@ -87,7 +87,7 @@ export class MultiSigPublicKey extends PublicKey {
87
87
 
88
88
  this.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);
89
89
  } else if (value instanceof Uint8Array) {
90
- this.rawBytes = value;
90
+ this.rawBytes = value as Uint8Array<ArrayBuffer>;
91
91
  this.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);
92
92
  } else {
93
93
  this.multisigPublicKey = value;
@@ -169,7 +169,7 @@ export class MultiSigPublicKey extends PublicKey {
169
169
  /**
170
170
  * Return the byte array representation of the MultiSig public key
171
171
  */
172
- toRawBytes(): Uint8Array {
172
+ toRawBytes(): Uint8Array<ArrayBuffer> {
173
173
  return this.rawBytes;
174
174
  }
175
175
 
@@ -6,13 +6,13 @@ import type { InferInput } from 'valibot';
6
6
  import { parse } from 'valibot';
7
7
 
8
8
  import { normalizeSuiObjectId } from '../utils/sui-types.js';
9
- import { Argument } from './data/internal.js';
10
- import type { CallArg, Command } from './data/internal.js';
9
+ import type { Argument, CallArg, Command } from './data/internal.js';
10
+ import { ArgumentSchema } from './data/internal.js';
11
11
  import type { AsyncTransactionThunk, Transaction } from './Transaction.js';
12
12
 
13
13
  export type TransactionArgument =
14
- | InferInput<typeof Argument>
15
- | ((tx: Transaction) => InferInput<typeof Argument>)
14
+ | InferInput<typeof ArgumentSchema>
15
+ | ((tx: Transaction) => InferInput<typeof ArgumentSchema>)
16
16
  | AsyncTransactionThunk;
17
17
  export type TransactionInput = CallArg;
18
18
 
@@ -63,38 +63,38 @@ export const Commands = {
63
63
  },
64
64
 
65
65
  TransferObjects(
66
- objects: InferInput<typeof Argument>[],
67
- address: InferInput<typeof Argument>,
66
+ objects: InferInput<typeof ArgumentSchema>[],
67
+ address: InferInput<typeof ArgumentSchema>,
68
68
  ): TransactionShape<'TransferObjects'> {
69
69
  return {
70
70
  $kind: 'TransferObjects',
71
71
  TransferObjects: {
72
- objects: objects.map((o) => parse(Argument, o)),
73
- address: parse(Argument, address),
72
+ objects: objects.map((o) => parse(ArgumentSchema, o)),
73
+ address: parse(ArgumentSchema, address),
74
74
  },
75
75
  };
76
76
  },
77
77
  SplitCoins(
78
- coin: InferInput<typeof Argument>,
79
- amounts: InferInput<typeof Argument>[],
78
+ coin: InferInput<typeof ArgumentSchema>,
79
+ amounts: InferInput<typeof ArgumentSchema>[],
80
80
  ): TransactionShape<'SplitCoins'> {
81
81
  return {
82
82
  $kind: 'SplitCoins',
83
83
  SplitCoins: {
84
- coin: parse(Argument, coin),
85
- amounts: amounts.map((o) => parse(Argument, o)),
84
+ coin: parse(ArgumentSchema, coin),
85
+ amounts: amounts.map((o) => parse(ArgumentSchema, o)),
86
86
  },
87
87
  };
88
88
  },
89
89
  MergeCoins(
90
- destination: InferInput<typeof Argument>,
91
- sources: InferInput<typeof Argument>[],
90
+ destination: InferInput<typeof ArgumentSchema>,
91
+ sources: InferInput<typeof ArgumentSchema>[],
92
92
  ): TransactionShape<'MergeCoins'> {
93
93
  return {
94
94
  $kind: 'MergeCoins',
95
95
  MergeCoins: {
96
- destination: parse(Argument, destination),
97
- sources: sources.map((o) => parse(Argument, o)),
96
+ destination: parse(ArgumentSchema, destination),
97
+ sources: sources.map((o) => parse(ArgumentSchema, o)),
98
98
  },
99
99
  };
100
100
  },
@@ -124,7 +124,7 @@ export const Commands = {
124
124
  modules: number[][] | string[];
125
125
  dependencies: string[];
126
126
  package: string;
127
- ticket: InferInput<typeof Argument>;
127
+ ticket: InferInput<typeof ArgumentSchema>;
128
128
  }): TransactionShape<'Upgrade'> {
129
129
  return {
130
130
  $kind: 'Upgrade',
@@ -134,7 +134,7 @@ export const Commands = {
134
134
  ),
135
135
  dependencies: dependencies.map((dep) => normalizeSuiObjectId(dep)),
136
136
  package: packageId,
137
- ticket: parse(Argument, ticket),
137
+ ticket: parse(ArgumentSchema, ticket),
138
138
  },
139
139
  };
140
140
  },
@@ -143,13 +143,13 @@ export const Commands = {
143
143
  elements,
144
144
  }: {
145
145
  type?: string;
146
- elements: InferInput<typeof Argument>[];
146
+ elements: InferInput<typeof ArgumentSchema>[];
147
147
  }): TransactionShape<'MakeMoveVec'> {
148
148
  return {
149
149
  $kind: 'MakeMoveVec',
150
150
  MakeMoveVec: {
151
151
  type: type ?? null,
152
- elements: elements.map((o) => parse(Argument, o)),
152
+ elements: elements.map((o) => parse(ArgumentSchema, o)),
153
153
  },
154
154
  };
155
155
  },
@@ -159,7 +159,10 @@ export const Commands = {
159
159
  data = {},
160
160
  }: {
161
161
  name: string;
162
- inputs?: Record<string, InferInput<typeof Argument> | InferInput<typeof Argument>[]>;
162
+ inputs?: Record<
163
+ string,
164
+ InferInput<typeof ArgumentSchema> | InferInput<typeof ArgumentSchema>[]
165
+ >;
163
166
  data?: Record<string, unknown>;
164
167
  }): TransactionShape<'$Intent'> {
165
168
  return {
@@ -169,7 +172,9 @@ export const Commands = {
169
172
  inputs: Object.fromEntries(
170
173
  Object.entries(inputs).map(([key, value]) => [
171
174
  key,
172
- Array.isArray(value) ? value.map((o) => parse(Argument, o)) : parse(Argument, value),
175
+ Array.isArray(value)
176
+ ? value.map((o) => parse(ArgumentSchema, o))
177
+ : parse(ArgumentSchema, value),
173
178
  ]),
174
179
  ),
175
180
  data,
@@ -11,10 +11,15 @@ import type { SignatureWithBytes, Signer } from '../cryptography/index.js';
11
11
  import { normalizeSuiAddress } from '../utils/sui-types.js';
12
12
  import type { TransactionArgument } from './Commands.js';
13
13
  import { Commands } from './Commands.js';
14
- import type { CallArg, Command } from './data/internal.js';
15
- import { Argument, NormalizedCallArg, ObjectRef, TransactionExpiration } from './data/internal.js';
14
+ import type { CallArg, Command, Argument, ObjectRef } from './data/internal.js';
15
+ import {
16
+ ArgumentSchema,
17
+ NormalizedCallArg,
18
+ ObjectRefSchema,
19
+ TransactionExpiration,
20
+ } from './data/internal.js';
16
21
  import { serializeV1TransactionData } from './data/v1.js';
17
- import { SerializedTransactionDataV2 } from './data/v2.js';
22
+ import { SerializedTransactionDataV2Schema } from './data/v2.js';
18
23
  import { Inputs } from './Inputs.js';
19
24
  import { needsTransactionResolution, resolveTransactionPlugin } from './resolve.js';
20
25
  import type {
@@ -29,8 +34,10 @@ import { getIdFromCallArg } from './utils.js';
29
34
  import { namedPackagesPlugin } from './plugins/NamedPackagesPlugin.js';
30
35
 
31
36
  export type TransactionObjectArgument =
32
- | Exclude<InferInput<typeof Argument>, { Input: unknown; type?: 'pure' }>
33
- | ((tx: Transaction) => Exclude<InferInput<typeof Argument>, { Input: unknown; type?: 'pure' }>)
37
+ | Exclude<InferInput<typeof ArgumentSchema>, { Input: unknown; type?: 'pure' }>
38
+ | ((
39
+ tx: Transaction,
40
+ ) => Exclude<InferInput<typeof ArgumentSchema>, { Input: unknown; type?: 'pure' }>)
34
41
  | AsyncTransactionThunk<TransactionResultArgument>;
35
42
 
36
43
  export type TransactionResult = Extract<Argument, { Result: unknown }> &
@@ -290,7 +297,7 @@ export class Transaction {
290
297
  this.#data.gasConfig.owner = owner;
291
298
  }
292
299
  setGasPayment(payments: ObjectRef[]) {
293
- this.#data.gasConfig.payment = payments.map((payment) => parse(ObjectRef, payment));
300
+ this.#data.gasConfig.payment = payments.map((payment) => parse(ObjectRefSchema, payment));
294
301
  }
295
302
 
296
303
  #data: TransactionDataBuilder;
@@ -363,7 +370,7 @@ export class Transaction {
363
370
  return this.object(this.add(value as (tx: Transaction) => TransactionObjectArgument));
364
371
  }
365
372
 
366
- if (typeof value === 'object' && is(Argument, value)) {
373
+ if (typeof value === 'object' && is(ArgumentSchema, value)) {
367
374
  return value as { $kind: 'Input'; Input: number; type?: 'object' };
368
375
  }
369
376
 
@@ -538,10 +545,10 @@ export class Transaction {
538
545
  return this.#resolveArgument(resolved);
539
546
  }
540
547
 
541
- return parse(Argument, resolved);
548
+ return parse(ArgumentSchema, resolved);
542
549
  }
543
550
 
544
- return parse(Argument, arg);
551
+ return parse(ArgumentSchema, arg);
545
552
  }
546
553
 
547
554
  // Method shorthands:
@@ -668,7 +675,7 @@ export class Transaction {
668
675
  const fullyResolved = this.isFullyResolved();
669
676
  return JSON.stringify(
670
677
  parse(
671
- SerializedTransactionDataV2,
678
+ SerializedTransactionDataV2Schema,
672
679
  fullyResolved
673
680
  ? {
674
681
  ...this.#data.snapshot(),
@@ -720,7 +727,7 @@ export class Transaction {
720
727
  }
721
728
 
722
729
  /** Build the transaction to BCS bytes. */
723
- async build(options: BuildTransactionOptions = {}): Promise<Uint8Array> {
730
+ async build(options: BuildTransactionOptions = {}): Promise<Uint8Array<ArrayBuffer>> {
724
731
  await this.prepareForSerialization(options);
725
732
  await this.#prepareBuild(options);
726
733
  return this.#data.build({
@@ -13,11 +13,12 @@ import type {
13
13
  Command,
14
14
  GasData,
15
15
  TransactionExpiration,
16
+ TransactionData,
16
17
  } from './data/internal.js';
17
- import { TransactionData } from './data/internal.js';
18
+ import { TransactionDataSchema } from './data/internal.js';
18
19
  import { transactionDataFromV1 } from './data/v1.js';
19
20
  import type { SerializedTransactionDataV1 } from './data/v1.js';
20
- import type { SerializedTransactionDataV2 } from './data/v2.js';
21
+ import type { SerializedTransactionDataV2Schema } from './data/v2.js';
21
22
  import { hashTypedData } from './hash.js';
22
23
 
23
24
  function prepareSuiAddress(address: string) {
@@ -69,13 +70,13 @@ export class TransactionDataBuilder implements TransactionData {
69
70
 
70
71
  static restore(
71
72
  data:
72
- | InferInput<typeof SerializedTransactionDataV2>
73
+ | InferInput<typeof SerializedTransactionDataV2Schema>
73
74
  | InferInput<typeof SerializedTransactionDataV1>,
74
75
  ) {
75
76
  if (data.version === 2) {
76
- return new TransactionDataBuilder(parse(TransactionData, data));
77
+ return new TransactionDataBuilder(parse(TransactionDataSchema, data));
77
78
  } else {
78
- return new TransactionDataBuilder(parse(TransactionData, transactionDataFromV1(data)));
79
+ return new TransactionDataBuilder(parse(TransactionDataSchema, transactionDataFromV1(data)));
79
80
  }
80
81
  }
81
82
 
@@ -320,7 +321,7 @@ export class TransactionDataBuilder implements TransactionData {
320
321
  }
321
322
 
322
323
  snapshot(): TransactionData {
323
- return parse(TransactionData, this);
324
+ return parse(TransactionDataSchema, this);
324
325
  }
325
326
 
326
327
  shallowClone() {