@mysten/sui 1.10.0 → 1.12.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 (187) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cjs/bcs/bcs.js +14 -14
  3. package/dist/cjs/bcs/bcs.js.map +2 -2
  4. package/dist/cjs/client/client.js +6 -6
  5. package/dist/cjs/client/client.js.map +2 -2
  6. package/dist/cjs/client/types/generated.d.ts +1 -2
  7. package/dist/cjs/client/types/generated.js.map +1 -1
  8. package/dist/cjs/cryptography/keypair.js +2 -2
  9. package/dist/cjs/cryptography/keypair.js.map +2 -2
  10. package/dist/cjs/cryptography/mnemonics.js +1 -1
  11. package/dist/cjs/cryptography/mnemonics.js.map +1 -1
  12. package/dist/cjs/cryptography/publickey.js +2 -2
  13. package/dist/cjs/cryptography/publickey.js.map +2 -2
  14. package/dist/cjs/cryptography/signature.js +2 -2
  15. package/dist/cjs/cryptography/signature.js.map +2 -2
  16. package/dist/cjs/graphql/generated/2024.1/tada-env.d.js.map +1 -1
  17. package/dist/cjs/graphql/generated/2024.4/tada-env.d.js.map +1 -1
  18. package/dist/cjs/graphql/schemas/2024.1/index.d.ts +32 -0
  19. package/dist/cjs/graphql/schemas/2024.4/index.d.ts +63 -1
  20. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +1 -1
  21. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js.map +1 -1
  22. package/dist/cjs/keypairs/ed25519/keypair.d.ts +2 -2
  23. package/dist/cjs/keypairs/ed25519/keypair.js +8 -1
  24. package/dist/cjs/keypairs/ed25519/keypair.js.map +2 -2
  25. package/dist/cjs/keypairs/ed25519/publickey.js +1 -1
  26. package/dist/cjs/keypairs/ed25519/publickey.js.map +2 -2
  27. package/dist/cjs/keypairs/secp256k1/keypair.d.ts +2 -2
  28. package/dist/cjs/keypairs/secp256k1/keypair.js +8 -1
  29. package/dist/cjs/keypairs/secp256k1/keypair.js.map +2 -2
  30. package/dist/cjs/keypairs/secp256k1/publickey.js +1 -1
  31. package/dist/cjs/keypairs/secp256k1/publickey.js.map +2 -2
  32. package/dist/cjs/keypairs/secp256r1/keypair.d.ts +2 -2
  33. package/dist/cjs/keypairs/secp256r1/keypair.js +8 -1
  34. package/dist/cjs/keypairs/secp256r1/keypair.js.map +2 -2
  35. package/dist/cjs/keypairs/secp256r1/publickey.js +1 -1
  36. package/dist/cjs/keypairs/secp256r1/publickey.js.map +2 -2
  37. package/dist/cjs/multisig/publickey.js +2 -2
  38. package/dist/cjs/multisig/publickey.js.map +2 -2
  39. package/dist/cjs/multisig/signer.js +2 -2
  40. package/dist/cjs/multisig/signer.js.map +2 -2
  41. package/dist/cjs/transactions/Commands.js +2 -2
  42. package/dist/cjs/transactions/Commands.js.map +2 -2
  43. package/dist/cjs/transactions/Inputs.js +1 -1
  44. package/dist/cjs/transactions/Inputs.js.map +2 -2
  45. package/dist/cjs/transactions/Transaction.js +2 -2
  46. package/dist/cjs/transactions/Transaction.js.map +2 -2
  47. package/dist/cjs/transactions/TransactionData.js +1 -1
  48. package/dist/cjs/transactions/TransactionData.js.map +2 -2
  49. package/dist/cjs/transactions/data/v1.js +6 -6
  50. package/dist/cjs/transactions/data/v1.js.map +2 -2
  51. package/dist/cjs/transactions/executor/parallel.js +1 -1
  52. package/dist/cjs/transactions/executor/parallel.js.map +2 -2
  53. package/dist/cjs/transactions/executor/serial.js +1 -1
  54. package/dist/cjs/transactions/executor/serial.js.map +2 -2
  55. package/dist/cjs/transactions/json-rpc-resolver.js +1 -1
  56. package/dist/cjs/transactions/json-rpc-resolver.js.map +1 -1
  57. package/dist/cjs/utils/dynamic-fields.d.ts +2 -0
  58. package/dist/cjs/utils/dynamic-fields.js +41 -0
  59. package/dist/cjs/utils/dynamic-fields.js.map +7 -0
  60. package/dist/cjs/utils/index.d.ts +2 -1
  61. package/dist/cjs/utils/index.js +9 -1
  62. package/dist/cjs/utils/index.js.map +2 -2
  63. package/dist/cjs/utils/sui-types.js +1 -1
  64. package/dist/cjs/utils/sui-types.js.map +2 -2
  65. package/dist/cjs/verify/verify.js +1 -1
  66. package/dist/cjs/verify/verify.js.map +2 -2
  67. package/dist/cjs/version.d.ts +2 -2
  68. package/dist/cjs/version.js +2 -2
  69. package/dist/cjs/version.js.map +1 -1
  70. package/dist/cjs/zklogin/publickey.js +5 -5
  71. package/dist/cjs/zklogin/publickey.js.map +2 -2
  72. package/dist/cjs/zklogin/signature.js +3 -3
  73. package/dist/cjs/zklogin/signature.js.map +2 -2
  74. package/dist/esm/bcs/bcs.js +15 -15
  75. package/dist/esm/bcs/bcs.js.map +2 -2
  76. package/dist/esm/client/client.js +7 -7
  77. package/dist/esm/client/client.js.map +2 -2
  78. package/dist/esm/client/types/generated.d.ts +1 -2
  79. package/dist/esm/cryptography/keypair.js +3 -3
  80. package/dist/esm/cryptography/keypair.js.map +2 -2
  81. package/dist/esm/cryptography/mnemonics.js +2 -2
  82. package/dist/esm/cryptography/mnemonics.js.map +1 -1
  83. package/dist/esm/cryptography/publickey.js +3 -3
  84. package/dist/esm/cryptography/publickey.js.map +2 -2
  85. package/dist/esm/cryptography/signature.js +3 -3
  86. package/dist/esm/cryptography/signature.js.map +2 -2
  87. package/dist/esm/graphql/schemas/2024.1/index.d.ts +32 -0
  88. package/dist/esm/graphql/schemas/2024.4/index.d.ts +63 -1
  89. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +2 -2
  90. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js.map +1 -1
  91. package/dist/esm/keypairs/ed25519/keypair.d.ts +2 -2
  92. package/dist/esm/keypairs/ed25519/keypair.js +14 -2
  93. package/dist/esm/keypairs/ed25519/keypair.js.map +2 -2
  94. package/dist/esm/keypairs/ed25519/publickey.js +2 -2
  95. package/dist/esm/keypairs/ed25519/publickey.js.map +2 -2
  96. package/dist/esm/keypairs/secp256k1/keypair.d.ts +2 -2
  97. package/dist/esm/keypairs/secp256k1/keypair.js +9 -2
  98. package/dist/esm/keypairs/secp256k1/keypair.js.map +2 -2
  99. package/dist/esm/keypairs/secp256k1/publickey.js +2 -2
  100. package/dist/esm/keypairs/secp256k1/publickey.js.map +2 -2
  101. package/dist/esm/keypairs/secp256r1/keypair.d.ts +2 -2
  102. package/dist/esm/keypairs/secp256r1/keypair.js +9 -2
  103. package/dist/esm/keypairs/secp256r1/keypair.js.map +2 -2
  104. package/dist/esm/keypairs/secp256r1/publickey.js +2 -2
  105. package/dist/esm/keypairs/secp256r1/publickey.js.map +2 -2
  106. package/dist/esm/multisig/publickey.js +3 -3
  107. package/dist/esm/multisig/publickey.js.map +2 -2
  108. package/dist/esm/multisig/signer.js +3 -3
  109. package/dist/esm/multisig/signer.js.map +2 -2
  110. package/dist/esm/transactions/Commands.js +3 -3
  111. package/dist/esm/transactions/Commands.js.map +2 -2
  112. package/dist/esm/transactions/Inputs.js +2 -2
  113. package/dist/esm/transactions/Inputs.js.map +2 -2
  114. package/dist/esm/transactions/Transaction.js +3 -3
  115. package/dist/esm/transactions/Transaction.js.map +2 -2
  116. package/dist/esm/transactions/TransactionData.js +2 -2
  117. package/dist/esm/transactions/TransactionData.js.map +2 -2
  118. package/dist/esm/transactions/data/v1.js +7 -7
  119. package/dist/esm/transactions/data/v1.js.map +2 -2
  120. package/dist/esm/transactions/executor/parallel.js +2 -2
  121. package/dist/esm/transactions/executor/parallel.js.map +2 -2
  122. package/dist/esm/transactions/executor/serial.js +2 -2
  123. package/dist/esm/transactions/executor/serial.js.map +2 -2
  124. package/dist/esm/transactions/json-rpc-resolver.js +1 -1
  125. package/dist/esm/transactions/json-rpc-resolver.js.map +1 -1
  126. package/dist/esm/utils/dynamic-fields.d.ts +2 -0
  127. package/dist/esm/utils/dynamic-fields.js +21 -0
  128. package/dist/esm/utils/dynamic-fields.js.map +7 -0
  129. package/dist/esm/utils/index.d.ts +2 -1
  130. package/dist/esm/utils/index.js +21 -2
  131. package/dist/esm/utils/index.js.map +2 -2
  132. package/dist/esm/utils/sui-types.js +2 -2
  133. package/dist/esm/utils/sui-types.js.map +2 -2
  134. package/dist/esm/verify/verify.js +2 -2
  135. package/dist/esm/verify/verify.js.map +2 -2
  136. package/dist/esm/version.d.ts +2 -2
  137. package/dist/esm/version.js +2 -2
  138. package/dist/esm/version.js.map +1 -1
  139. package/dist/esm/zklogin/publickey.js +6 -6
  140. package/dist/esm/zklogin/publickey.js.map +2 -2
  141. package/dist/esm/zklogin/signature.js +4 -4
  142. package/dist/esm/zklogin/signature.js.map +2 -2
  143. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  144. package/dist/tsconfig.tsbuildinfo +1 -1
  145. package/package.json +2 -2
  146. package/src/bcs/bcs.ts +15 -15
  147. package/src/client/client.ts +7 -7
  148. package/src/client/types/generated.ts +1 -2
  149. package/src/cryptography/keypair.ts +3 -3
  150. package/src/cryptography/mnemonics.ts +2 -2
  151. package/src/cryptography/publickey.ts +3 -3
  152. package/src/cryptography/signature.ts +3 -3
  153. package/src/graphql/generated/2024.1/schema.graphql +18 -4
  154. package/src/graphql/generated/2024.1/tada-env.d.ts +1 -1
  155. package/src/graphql/generated/2024.4/schema.graphql +33 -5
  156. package/src/graphql/generated/2024.4/tada-env.d.ts +3 -2
  157. package/src/keypairs/ed25519/ed25519-hd-key.ts +2 -2
  158. package/src/keypairs/ed25519/keypair.ts +18 -3
  159. package/src/keypairs/ed25519/publickey.ts +2 -2
  160. package/src/keypairs/secp256k1/keypair.ts +13 -3
  161. package/src/keypairs/secp256k1/publickey.ts +2 -2
  162. package/src/keypairs/secp256r1/keypair.ts +13 -3
  163. package/src/keypairs/secp256r1/publickey.ts +2 -2
  164. package/src/multisig/publickey.ts +3 -3
  165. package/src/multisig/signer.ts +3 -3
  166. package/src/transactions/Commands.ts +3 -3
  167. package/src/transactions/Inputs.ts +2 -2
  168. package/src/transactions/Transaction.ts +3 -3
  169. package/src/transactions/TransactionData.ts +2 -2
  170. package/src/transactions/__tests__/Transaction.test.ts +2 -2
  171. package/src/transactions/__tests__/bcs.test.ts +2 -2
  172. package/src/transactions/data/v1.ts +7 -7
  173. package/src/transactions/executor/parallel.ts +2 -2
  174. package/src/transactions/executor/serial.ts +2 -2
  175. package/src/transactions/json-rpc-resolver.ts +1 -1
  176. package/src/utils/dynamic-fields.ts +30 -0
  177. package/src/utils/index.ts +14 -1
  178. package/src/utils/sui-types.ts +2 -2
  179. package/src/verify/verify.ts +2 -2
  180. package/src/version.ts +2 -2
  181. package/src/zklogin/publickey.ts +6 -6
  182. package/src/zklogin/signature.ts +5 -4
  183. package/dist/cjs/graphql/generated/2024-01/tada-env.d.js +0 -17
  184. package/dist/cjs/graphql/generated/2024-01/tada-env.d.js.map +0 -7
  185. package/dist/esm/graphql/generated/2024-01/tada-env.d.js +0 -1
  186. package/dist/esm/graphql/generated/2024-01/tada-env.d.js.map +0 -7
  187. package/src/graphql/generated/2024-01/tada-env.d.ts +0 -202
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { fromB64, toB64 } from '@mysten/bcs';
4
+ import { fromBase64, toBase64 } from '@mysten/bcs';
5
5
  import { blake2b } from '@noble/hashes/blake2b';
6
6
  import { bytesToHex } from '@noble/hashes/utils';
7
7
 
@@ -81,7 +81,7 @@ export class MultiSigPublicKey extends PublicKey {
81
81
  super();
82
82
 
83
83
  if (typeof value === 'string') {
84
- this.rawBytes = fromB64(value);
84
+ this.rawBytes = fromBase64(value);
85
85
 
86
86
  this.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);
87
87
  } else if (value instanceof Uint8Array) {
@@ -306,7 +306,7 @@ export class MultiSigPublicKey extends PublicKey {
306
306
  let tmp = new Uint8Array(bytes.length + 1);
307
307
  tmp.set([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]);
308
308
  tmp.set(bytes, 1);
309
- return toB64(tmp);
309
+ return toBase64(tmp);
310
310
  }
311
311
  }
312
312
 
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { toB64 } from '@mysten/bcs';
3
+ import { toBase64 } from '@mysten/bcs';
4
4
 
5
5
  import type { SignatureScheme } from '../cryptography/index.js';
6
6
  import { Signer } from '../cryptography/index.js';
@@ -73,7 +73,7 @@ export class MultiSigSigner extends Signer {
73
73
 
74
74
  return {
75
75
  signature,
76
- bytes: toB64(bytes),
76
+ bytes: toBase64(bytes),
77
77
  };
78
78
  }
79
79
 
@@ -86,7 +86,7 @@ export class MultiSigSigner extends Signer {
86
86
 
87
87
  return {
88
88
  signature,
89
- bytes: toB64(bytes),
89
+ bytes: toBase64(bytes),
90
90
  };
91
91
  }
92
92
  }
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { toB64 } from '@mysten/bcs';
4
+ import { toBase64 } from '@mysten/bcs';
5
5
  import type { InferInput } from 'valibot';
6
6
  import { parse } from 'valibot';
7
7
 
@@ -108,7 +108,7 @@ export const Commands = {
108
108
  $kind: 'Publish',
109
109
  Publish: {
110
110
  modules: modules.map((module) =>
111
- typeof module === 'string' ? module : toB64(new Uint8Array(module)),
111
+ typeof module === 'string' ? module : toBase64(new Uint8Array(module)),
112
112
  ),
113
113
  dependencies: dependencies.map((dep) => normalizeSuiObjectId(dep)),
114
114
  },
@@ -129,7 +129,7 @@ export const Commands = {
129
129
  $kind: 'Upgrade',
130
130
  Upgrade: {
131
131
  modules: modules.map((module) =>
132
- typeof module === 'string' ? module : toB64(new Uint8Array(module)),
132
+ typeof module === 'string' ? module : toBase64(new Uint8Array(module)),
133
133
  ),
134
134
  dependencies: dependencies.map((dep) => normalizeSuiObjectId(dep)),
135
135
  package: packageId,
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { toB64 } from '@mysten/bcs';
4
+ import { toBase64 } from '@mysten/bcs';
5
5
  import type { SerializedBcs } from '@mysten/bcs';
6
6
 
7
7
  import { normalizeSuiAddress } from '../utils/sui-types.js';
@@ -11,7 +11,7 @@ function Pure(data: Uint8Array | SerializedBcs<any>): Extract<CallArg, { Pure: u
11
11
  return {
12
12
  $kind: 'Pure',
13
13
  Pure: {
14
- bytes: data instanceof Uint8Array ? toB64(data) : data.toBase64(),
14
+ bytes: data instanceof Uint8Array ? toBase64(data) : data.toBase64(),
15
15
  },
16
16
  };
17
17
  }
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { SerializedBcs } from '@mysten/bcs';
5
- import { fromB64, isSerializedBcs } from '@mysten/bcs';
5
+ import { fromBase64, isSerializedBcs } from '@mysten/bcs';
6
6
  import type { InferInput } from 'valibot';
7
7
  import { is, parse } from 'valibot';
8
8
 
@@ -144,7 +144,7 @@ export class Transaction {
144
144
  const tx = new Transaction();
145
145
 
146
146
  tx.#data = TransactionDataBuilder.fromKindBytes(
147
- typeof serialized === 'string' ? fromB64(serialized) : serialized,
147
+ typeof serialized === 'string' ? fromBase64(serialized) : serialized,
148
148
  );
149
149
 
150
150
  return tx;
@@ -163,7 +163,7 @@ export class Transaction {
163
163
  newTransaction.#data = new TransactionDataBuilder(transaction.getData());
164
164
  } else if (typeof transaction !== 'string' || !transaction.startsWith('{')) {
165
165
  newTransaction.#data = TransactionDataBuilder.fromBytes(
166
- typeof transaction === 'string' ? fromB64(transaction) : transaction,
166
+ typeof transaction === 'string' ? fromBase64(transaction) : transaction,
167
167
  );
168
168
  } else {
169
169
  newTransaction.#data = TransactionDataBuilder.restore(JSON.parse(transaction));
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { toB58 } from '@mysten/bcs';
4
+ import { toBase58 } from '@mysten/bcs';
5
5
  import type { InferInput } from 'valibot';
6
6
  import { parse } from 'valibot';
7
7
 
@@ -87,7 +87,7 @@ export class TransactionDataBuilder implements TransactionData {
87
87
  */
88
88
  static getDigestFromBytes(bytes: Uint8Array) {
89
89
  const hash = hashTypedData('TransactionData', bytes);
90
- return toB58(hash);
90
+ return toBase58(hash);
91
91
  }
92
92
 
93
93
  // @deprecated use gasData instead
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { toB58 } from '@mysten/bcs';
4
+ import { toBase58 } from '@mysten/bcs';
5
5
  import { describe, expect, it } from 'vitest';
6
6
 
7
7
  import { bcs } from '../../bcs/index.js';
@@ -165,7 +165,7 @@ function ref(): { objectId: string; version: string; digest: string } {
165
165
  return {
166
166
  objectId: (Math.random() * 100000).toFixed(0).padEnd(64, '0'),
167
167
  version: String((Math.random() * 10000).toFixed(0)),
168
- digest: toB58(
168
+ digest: toBase58(
169
169
  new Uint8Array([
170
170
  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1,
171
171
  2,
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { toB58 } from '@mysten/bcs';
4
+ import { toBase58 } from '@mysten/bcs';
5
5
  import { expect, it } from 'vitest';
6
6
 
7
7
  import { bcs } from '../../bcs/index.js';
@@ -51,7 +51,7 @@ function ref(): { objectId: string; version: string; digest: string } {
51
51
  return {
52
52
  objectId: normalizeSuiAddress((Math.random() * 100000).toFixed(0).padEnd(64, '0')),
53
53
  version: String((Math.random() * 10000).toFixed(0)),
54
- digest: toB58(
54
+ digest: toBase58(
55
55
  new Uint8Array([
56
56
  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1,
57
57
  2,
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { fromB64, toB64 } from '@mysten/bcs';
4
+ import { fromBase64, toBase64 } from '@mysten/bcs';
5
5
  import type { GenericSchema, InferInput, InferOutput } from 'valibot';
6
6
  import {
7
7
  array,
@@ -236,7 +236,7 @@ export function serializeV1TransactionData(
236
236
  kind: 'Input',
237
237
  index,
238
238
  value: {
239
- Pure: Array.from(fromB64(input.Pure.bytes)),
239
+ Pure: Array.from(fromBase64(input.Pure.bytes)),
240
240
  },
241
241
  type: 'pure',
242
242
  };
@@ -313,7 +313,7 @@ export function serializeV1TransactionData(
313
313
  if (command.Publish) {
314
314
  return {
315
315
  kind: 'Publish',
316
- modules: command.Publish.modules.map((mod) => Array.from(fromB64(mod))),
316
+ modules: command.Publish.modules.map((mod) => Array.from(fromBase64(mod))),
317
317
  dependencies: command.Publish.dependencies,
318
318
  };
319
319
  }
@@ -337,7 +337,7 @@ export function serializeV1TransactionData(
337
337
  if (command.Upgrade) {
338
338
  return {
339
339
  kind: 'Upgrade',
340
- modules: command.Upgrade.modules.map((mod) => Array.from(fromB64(mod))),
340
+ modules: command.Upgrade.modules.map((mod) => Array.from(fromBase64(mod))),
341
341
  dependencies: command.Upgrade.dependencies,
342
342
  packageId: command.Upgrade.package,
343
343
  ticket: convertTransactionArgument(command.Upgrade.ticket, inputs),
@@ -434,7 +434,7 @@ export function transactionDataFromV1(data: SerializedTransactionDataV1): Transa
434
434
 
435
435
  return {
436
436
  Pure: {
437
- bytes: toB64(new Uint8Array(value.Pure)),
437
+ bytes: toBase64(new Uint8Array(value.Pure)),
438
438
  },
439
439
  };
440
440
  }
@@ -491,7 +491,7 @@ export function transactionDataFromV1(data: SerializedTransactionDataV1): Transa
491
491
  case 'Publish': {
492
492
  return {
493
493
  Publish: {
494
- modules: transaction.modules.map((mod) => toB64(Uint8Array.from(mod))),
494
+ modules: transaction.modules.map((mod) => toBase64(Uint8Array.from(mod))),
495
495
  dependencies: transaction.dependencies,
496
496
  },
497
497
  };
@@ -515,7 +515,7 @@ export function transactionDataFromV1(data: SerializedTransactionDataV1): Transa
515
515
  case 'Upgrade': {
516
516
  return {
517
517
  Upgrade: {
518
- modules: transaction.modules.map((mod) => toB64(Uint8Array.from(mod))),
518
+ modules: transaction.modules.map((mod) => toBase64(Uint8Array.from(mod))),
519
519
  dependencies: transaction.dependencies,
520
520
  package: transaction.packageId,
521
521
  ticket: parseV1TransactionArgument(transaction.ticket),
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { toB64 } from '@mysten/bcs';
4
+ import { toBase64 } from '@mysten/bcs';
5
5
 
6
6
  import { bcs } from '../../bcs/index.js';
7
7
  import type { SuiObjectRef } from '../../bcs/types.js';
@@ -266,7 +266,7 @@ export class ParallelTransactionExecutor {
266
266
 
267
267
  return {
268
268
  digest: results.digest,
269
- effects: toB64(effectsBytes),
269
+ effects: toBase64(effectsBytes),
270
270
  data: results,
271
271
  };
272
272
  } catch (error) {
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { toB64 } from '@mysten/bcs';
4
+ import { toBase64 } from '@mysten/bcs';
5
5
 
6
6
  import { bcs } from '../../bcs/index.js';
7
7
  import type { SuiClient, SuiTransactionBlockResponseOptions } from '../../client/index.js';
@@ -109,7 +109,7 @@ export class SerialTransactionExecutor {
109
109
 
110
110
  return {
111
111
  digest: results.digest,
112
- effects: toB64(effectsBytes),
112
+ effects: toBase64(effectsBytes),
113
113
  data: results,
114
114
  };
115
115
  });
@@ -473,7 +473,7 @@ function isReceivingType(type: OpenMoveTypeSignature): boolean {
473
473
  export function getClient(options: BuildTransactionOptions): SuiClient {
474
474
  if (!options.client) {
475
475
  throw new Error(
476
- `No provider passed to Transaction#build, but transaction data was not sufficient to build offline.`,
476
+ `No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.`,
477
477
  );
478
478
  }
479
479
 
@@ -0,0 +1,30 @@
1
+ // Copyright (c) Mysten Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { toHex } from '@mysten/bcs';
5
+ import { blake2b } from '@noble/hashes/blake2b';
6
+
7
+ import type { TypeTag } from '../bcs/bcs.js';
8
+ import { bcs } from '../bcs/index.js';
9
+
10
+ export function deriveDynamicFieldID(
11
+ parentId: string,
12
+ typeTag: typeof TypeTag.$inferInput,
13
+ key: Uint8Array,
14
+ ) {
15
+ const address = bcs.Address.serialize(parentId).toBytes();
16
+ const tag = bcs.TypeTag.serialize(typeTag).toBytes();
17
+ const keyLength = bcs.u64().serialize(key.length).toBytes();
18
+
19
+ const hash = blake2b.create({
20
+ dkLen: 32,
21
+ });
22
+
23
+ hash.update(new Uint8Array([0xf0]));
24
+ hash.update(address);
25
+ hash.update(keyLength);
26
+ hash.update(key);
27
+ hash.update(tag);
28
+
29
+ return `0x${toHex(hash.digest().slice(0, 32))}`;
30
+ }
@@ -13,7 +13,18 @@ export {
13
13
  SUI_ADDRESS_LENGTH,
14
14
  } from './sui-types.js';
15
15
 
16
- export { fromB64, toB64, fromHEX, toHEX } from '@mysten/bcs';
16
+ export {
17
+ fromB64,
18
+ toB64,
19
+ fromHEX,
20
+ toHex,
21
+ toHEX,
22
+ fromHex,
23
+ fromBase64,
24
+ toBase64,
25
+ fromBase58,
26
+ toBase58,
27
+ } from '@mysten/bcs';
17
28
  export { isValidSuiNSName, normalizeSuiNSName } from './suins.js';
18
29
 
19
30
  export {
@@ -29,3 +40,5 @@ export {
29
40
  } from './constants.js';
30
41
 
31
42
  export { isValidNamedPackage, isValidNamedType } from './move-registry.js';
43
+
44
+ export { deriveDynamicFieldID } from './dynamic-fields.js';
@@ -1,14 +1,14 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { fromB58, splitGenericParameters } from '@mysten/bcs';
4
+ import { fromBase58, splitGenericParameters } from '@mysten/bcs';
5
5
 
6
6
  const TX_DIGEST_LENGTH = 32;
7
7
 
8
8
  /** Returns whether the tx digest is valid based on the serialization format */
9
9
  export function isValidTransactionDigest(value: string): value is string {
10
10
  try {
11
- const buffer = fromB58(value);
11
+ const buffer = fromBase58(value);
12
12
  return buffer.length === TX_DIGEST_LENGTH;
13
13
  } catch (e) {
14
14
  return false;
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { fromB64 } from '@mysten/bcs';
4
+ import { fromBase64 } from '@mysten/bcs';
5
5
 
6
6
  import type { PublicKey, SignatureFlag, SignatureScheme } from '../cryptography/index.js';
7
7
  import { parseSerializedSignature, SIGNATURE_FLAG_TO_SCHEME } from '../cryptography/index.js';
@@ -107,7 +107,7 @@ export function publicKeyFromSuiBytes(
107
107
  publicKey: string | Uint8Array,
108
108
  options: { client?: SuiGraphQLClient } = {},
109
109
  ) {
110
- const bytes = typeof publicKey === 'string' ? fromB64(publicKey) : publicKey;
110
+ const bytes = typeof publicKey === 'string' ? fromBase64(publicKey) : publicKey;
111
111
 
112
112
  const signatureScheme = SIGNATURE_FLAG_TO_SCHEME[bytes[0] as SignatureFlag];
113
113
 
package/src/version.ts CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  // This file is generated by genversion.mjs. Do not edit it directly.
5
5
 
6
- export const PACKAGE_VERSION = '1.10.0';
7
- export const TARGETED_RPC_VERSION = '1.35.0';
6
+ export const PACKAGE_VERSION = '1.12.0';
7
+ export const TARGETED_RPC_VERSION = '1.36.0';
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { fromB64, toB64 } from '@mysten/bcs';
4
+ import { fromBase64, toBase64 } from '@mysten/bcs';
5
5
 
6
6
  import { PublicKey } from '../cryptography/publickey.js';
7
7
  import type { PublicKeyInitData } from '../cryptography/publickey.js';
@@ -29,7 +29,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
29
29
  this.#client = client;
30
30
 
31
31
  if (typeof value === 'string') {
32
- this.#data = fromB64(value);
32
+ this.#data = fromBase64(value);
33
33
  } else if (value instanceof Uint8Array) {
34
34
  this.#data = value;
35
35
  } else {
@@ -74,7 +74,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
74
74
 
75
75
  return graphqlVerifyZkLoginSignature({
76
76
  address: address,
77
- bytes: toB64(message),
77
+ bytes: toBase64(message),
78
78
  signature: parsedSignature.serializedSignature,
79
79
  intentScope: 'PERSONAL_MESSAGE',
80
80
  client: this.#client,
@@ -89,7 +89,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
89
89
  const address = new ZkLoginPublicIdentifier(parsedSignature.publicKey).toSuiAddress();
90
90
  return graphqlVerifyZkLoginSignature({
91
91
  address: address,
92
- bytes: toB64(transaction),
92
+ bytes: toBase64(transaction),
93
93
  signature: parsedSignature.serializedSignature,
94
94
  intentScope: 'TRANSACTION_DATA',
95
95
  client: this.#client,
@@ -164,7 +164,7 @@ async function graphqlVerifyZkLoginSignature({
164
164
  }
165
165
 
166
166
  export function parseSerializedZkLoginSignature(signature: Uint8Array | string) {
167
- const bytes = typeof signature === 'string' ? fromB64(signature) : signature;
167
+ const bytes = typeof signature === 'string' ? fromBase64(signature) : signature;
168
168
 
169
169
  if (bytes[0] !== SIGNATURE_SCHEME_TO_FLAG.ZkLogin) {
170
170
  throw new Error('Invalid signature scheme');
@@ -176,7 +176,7 @@ export function parseSerializedZkLoginSignature(signature: Uint8Array | string)
176
176
  const iss = extractClaimValue<string>(issBase64Details, 'iss');
177
177
  const publicIdentifer = toZkLoginPublicIdentifier(BigInt(addressSeed), iss);
178
178
  return {
179
- serializedSignature: toB64(bytes),
179
+ serializedSignature: toBase64(bytes),
180
180
  signatureScheme: 'ZkLogin' as const,
181
181
  zkLogin: {
182
182
  inputs,
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { fromB64, toB64 } from '@mysten/bcs';
4
+ import { fromBase64, toBase64 } from '@mysten/bcs';
5
5
 
6
6
  import { SIGNATURE_SCHEME_TO_FLAG } from '../cryptography/signature-scheme.js';
7
7
  import type { ZkLoginSignature } from './bcs.js';
@@ -17,7 +17,8 @@ function getZkLoginSignatureBytes({ inputs, maxEpoch, userSignature }: ZkLoginSi
17
17
  {
18
18
  inputs,
19
19
  maxEpoch,
20
- userSignature: typeof userSignature === 'string' ? fromB64(userSignature) : userSignature,
20
+ userSignature:
21
+ typeof userSignature === 'string' ? fromBase64(userSignature) : userSignature,
21
22
  },
22
23
  { maxSize: 2048 },
23
24
  )
@@ -29,9 +30,9 @@ export function getZkLoginSignature({ inputs, maxEpoch, userSignature }: ZkLogin
29
30
  const signatureBytes = new Uint8Array(bytes.length + 1);
30
31
  signatureBytes.set([SIGNATURE_SCHEME_TO_FLAG.ZkLogin]);
31
32
  signatureBytes.set(bytes, 1);
32
- return toB64(signatureBytes);
33
+ return toBase64(signatureBytes);
33
34
  }
34
35
 
35
36
  export function parseZkLoginSignature(signature: string | Uint8Array) {
36
- return zkLoginSignature.parse(typeof signature === 'string' ? fromB64(signature) : signature);
37
+ return zkLoginSignature.parse(typeof signature === 'string' ? fromBase64(signature) : signature);
37
38
  }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var tada_env_d_exports = {};
16
- module.exports = __toCommonJS(tada_env_d_exports);
17
- //# sourceMappingURL=tada-env.d.js.map