@haneullabs/haneul 2.5.0 → 2.5.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 (35) hide show
  1. package/dist/bcs/bcs.d.mts +6 -6
  2. package/dist/cryptography/publickey.d.mts +1 -1
  3. package/dist/cryptography/publickey.d.mts.map +1 -1
  4. package/dist/cryptography/publickey.mjs +3 -3
  5. package/dist/cryptography/publickey.mjs.map +1 -1
  6. package/dist/cryptography/signature.d.mts +6 -6
  7. package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts +4 -4
  8. package/dist/grpc/proto/haneul/rpc/v2/name_service.client.d.mts +4 -4
  9. package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts +4 -4
  10. package/dist/grpc/proto/haneul/rpc/v2/transaction.d.mts.map +1 -1
  11. package/dist/multisig/publickey.mjs +1 -1
  12. package/dist/multisig/publickey.mjs.map +1 -1
  13. package/dist/transactions/data/internal.d.mts +109 -109
  14. package/dist/transactions/data/internal.d.mts.map +1 -1
  15. package/dist/transactions/data/v1.d.mts +220 -220
  16. package/dist/transactions/data/v1.d.mts.map +1 -1
  17. package/dist/verify/index.d.mts +2 -2
  18. package/dist/verify/index.mjs +2 -2
  19. package/dist/verify/verify.d.mts +2 -2
  20. package/dist/verify/verify.d.mts.map +1 -1
  21. package/dist/verify/verify.mjs +2 -2
  22. package/dist/verify/verify.mjs.map +1 -1
  23. package/dist/version.mjs +1 -1
  24. package/dist/version.mjs.map +1 -1
  25. package/dist/zklogin/bcs.d.mts +14 -14
  26. package/dist/zklogin/bcs.d.mts.map +1 -1
  27. package/dist/zklogin/nonce.mjs +1 -1
  28. package/dist/zklogin/nonce.mjs.map +1 -1
  29. package/package.json +3 -3
  30. package/src/cryptography/publickey.ts +3 -3
  31. package/src/multisig/publickey.ts +1 -1
  32. package/src/verify/index.ts +1 -1
  33. package/src/verify/verify.ts +1 -1
  34. package/src/version.ts +1 -1
  35. package/src/zklogin/nonce.ts +1 -1
@@ -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.4.0';\nexport const TARGETED_RPC_VERSION = '1.0.0';\n"],"mappings":";AAKA,MAAa,kBAAkB;AAC/B,MAAa,uBAAuB"}
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.5.2';\nexport const TARGETED_RPC_VERSION = '1.0.0';\n"],"mappings":";AAKA,MAAa,kBAAkB;AAC/B,MAAa,uBAAuB"}
@@ -1,31 +1,31 @@
1
- import * as _haneullabs_bcs810 from "@haneullabs/bcs";
1
+ import * as _haneullabs_bcs1111 from "@haneullabs/bcs";
2
2
  import { InferBcsInput } from "@haneullabs/bcs";
3
3
 
4
4
  //#region src/zklogin/bcs.d.ts
5
- declare const zkLoginSignature: _haneullabs_bcs810.BcsStruct<{
6
- inputs: _haneullabs_bcs810.BcsStruct<{
7
- proofPoints: _haneullabs_bcs810.BcsStruct<{
8
- a: _haneullabs_bcs810.BcsType<string[], Iterable<string> & {
5
+ declare const zkLoginSignature: _haneullabs_bcs1111.BcsStruct<{
6
+ inputs: _haneullabs_bcs1111.BcsStruct<{
7
+ proofPoints: _haneullabs_bcs1111.BcsStruct<{
8
+ a: _haneullabs_bcs1111.BcsType<string[], Iterable<string> & {
9
9
  length: number;
10
10
  }, string>;
11
- b: _haneullabs_bcs810.BcsType<string[][], Iterable<Iterable<string> & {
11
+ b: _haneullabs_bcs1111.BcsType<string[][], Iterable<Iterable<string> & {
12
12
  length: number;
13
13
  }> & {
14
14
  length: number;
15
15
  }, string>;
16
- c: _haneullabs_bcs810.BcsType<string[], Iterable<string> & {
16
+ c: _haneullabs_bcs1111.BcsType<string[], Iterable<string> & {
17
17
  length: number;
18
18
  }, string>;
19
19
  }, string>;
20
- issBase64Details: _haneullabs_bcs810.BcsStruct<{
21
- value: _haneullabs_bcs810.BcsType<string, string, "string">;
22
- indexMod4: _haneullabs_bcs810.BcsType<number, number, "u8">;
20
+ issBase64Details: _haneullabs_bcs1111.BcsStruct<{
21
+ value: _haneullabs_bcs1111.BcsType<string, string, "string">;
22
+ indexMod4: _haneullabs_bcs1111.BcsType<number, number, "u8">;
23
23
  }, string>;
24
- headerBase64: _haneullabs_bcs810.BcsType<string, string, "string">;
25
- addressSeed: _haneullabs_bcs810.BcsType<string, string, "string">;
24
+ headerBase64: _haneullabs_bcs1111.BcsType<string, string, "string">;
25
+ addressSeed: _haneullabs_bcs1111.BcsType<string, string, "string">;
26
26
  }, string>;
27
- maxEpoch: _haneullabs_bcs810.BcsType<string, string | number | bigint, "u64">;
28
- userSignature: _haneullabs_bcs810.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
27
+ maxEpoch: _haneullabs_bcs1111.BcsType<string, string | number | bigint, "u64">;
28
+ userSignature: _haneullabs_bcs1111.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
29
29
  }, string>;
30
30
  type ZkLoginSignature = InferBcsInput<typeof zkLoginSignature>;
31
31
  type ZkLoginSignatureInputs = ZkLoginSignature['inputs'];
@@ -1 +1 @@
1
- {"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/zklogin/bcs.ts"],"sourcesContent":[],"mappings":";;;;cAMa,qCAAgB;;;MAAhB,CAAA,4BAgBX,CAAA,MAAA,EAAA,UAAA,CAAA,MAAA,CAAA,GAAA;;;;;;;;;;;;;;;;;;;;2CAhB2B,WAAA,gBAAA,CAAA,UAAA,CAAA,MAAA,CAAA,EAAA,YAAA,CAAA;CAAA,EAAA,MAAA,CAAA;AAkBjB,KAAA,gBAAA,GAAmB,aAAqB,CAAA,OAAA,gBAAR,CAAA;AAChC,KAAA,sBAAA,GAAyB,gBAAA,CAAA,QAAgB,CAAA"}
1
+ {"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/zklogin/bcs.ts"],"sourcesContent":[],"mappings":";;;;cAMa,sCAAgB;;;MAAhB,CAAA,6BAgBX,CAAA,MAAA,EAAA,UAAA,CAAA,MAAA,CAAA,GAAA;;;;;;;;;;;;;;;;;;;;4CAhB2B,WAAA,gBAAA,CAAA,UAAA,CAAA,MAAA,CAAA,EAAA,YAAA,CAAA;CAAA,EAAA,MAAA,CAAA;AAkBjB,KAAA,gBAAA,GAAmB,aAAqB,CAAA,OAAA,gBAAR,CAAA;AAChC,KAAA,sBAAA,GAAyB,gBAAA,CAAA,QAAgB,CAAA"}
@@ -15,7 +15,7 @@ function generateRandomness() {
15
15
  return String(toBigIntBE(randomBytes(16)));
16
16
  }
17
17
  function generateNonce(publicKey, maxEpoch, randomness) {
18
- const publicKeyBytes = toBigIntBE(publicKey.toSuiBytes());
18
+ const publicKeyBytes = toBigIntBE(publicKey.toHaneulBytes());
19
19
  const Z = toPaddedBigEndianBytes(poseidonHash([
20
20
  publicKeyBytes / 2n ** 128n,
21
21
  publicKeyBytes % 2n ** 128n,
@@ -1 +1 @@
1
- {"version":3,"file":"nonce.mjs","names":[],"sources":["../../src/zklogin/nonce.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toHex } from '@haneullabs/bcs';\nimport { randomBytes } from '@noble/hashes/utils.js';\nimport { base64urlnopad } from '@scure/base';\n\nimport type { PublicKey } from '../cryptography/publickey.js';\nimport { poseidonHash } from './poseidon.js';\nimport { toPaddedBigEndianBytes } from './utils.js';\n\nexport const NONCE_LENGTH = 27;\n\nfunction toBigIntBE(bytes: Uint8Array) {\n\tconst hex = toHex(bytes);\n\tif (hex.length === 0) {\n\t\treturn BigInt(0);\n\t}\n\treturn BigInt(`0x${hex}`);\n}\n\nexport function generateRandomness() {\n\t// Once Node 20 enters LTS, we can just use crypto.getRandomValues(new Uint8Array(16)), but until then we use `randomBytes` to improve compatibility:\n\treturn String(toBigIntBE(randomBytes(16)));\n}\n\nexport function generateNonce(publicKey: PublicKey, maxEpoch: number, randomness: bigint | string) {\n\tconst publicKeyBytes = toBigIntBE(publicKey.toSuiBytes());\n\tconst eph_public_key_0 = publicKeyBytes / 2n ** 128n;\n\tconst eph_public_key_1 = publicKeyBytes % 2n ** 128n;\n\tconst bigNum = poseidonHash([eph_public_key_0, eph_public_key_1, maxEpoch, BigInt(randomness)]);\n\tconst Z = toPaddedBigEndianBytes(bigNum, 20);\n\tconst nonce = base64urlnopad.encode(Z);\n\n\tif (nonce.length !== NONCE_LENGTH) {\n\t\tthrow new Error(`Length of nonce ${nonce} (${nonce.length}) is not equal to ${NONCE_LENGTH}`);\n\t}\n\treturn nonce;\n}\n"],"mappings":";;;;;;;AAWA,MAAa,eAAe;AAE5B,SAAS,WAAW,OAAmB;CACtC,MAAM,MAAM,MAAM,MAAM;AACxB,KAAI,IAAI,WAAW,EAClB,QAAO,OAAO,EAAE;AAEjB,QAAO,OAAO,KAAK,MAAM;;AAG1B,SAAgB,qBAAqB;AAEpC,QAAO,OAAO,WAAW,YAAY,GAAG,CAAC,CAAC;;AAG3C,SAAgB,cAAc,WAAsB,UAAkB,YAA6B;CAClG,MAAM,iBAAiB,WAAW,UAAU,YAAY,CAAC;CAIzD,MAAM,IAAI,uBADK,aAAa;EAFH,iBAAiB,MAAM;EACvB,iBAAiB,MAAM;EACiB;EAAU,OAAO,WAAW;EAAC,CAAC,EACtD,GAAG;CAC5C,MAAM,QAAQ,eAAe,OAAO,EAAE;AAEtC,KAAI,MAAM,WAAW,aACpB,OAAM,IAAI,MAAM,mBAAmB,MAAM,IAAI,MAAM,OAAO,oBAAoB,eAAe;AAE9F,QAAO"}
1
+ {"version":3,"file":"nonce.mjs","names":[],"sources":["../../src/zklogin/nonce.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toHex } from '@haneullabs/bcs';\nimport { randomBytes } from '@noble/hashes/utils.js';\nimport { base64urlnopad } from '@scure/base';\n\nimport type { PublicKey } from '../cryptography/publickey.js';\nimport { poseidonHash } from './poseidon.js';\nimport { toPaddedBigEndianBytes } from './utils.js';\n\nexport const NONCE_LENGTH = 27;\n\nfunction toBigIntBE(bytes: Uint8Array) {\n\tconst hex = toHex(bytes);\n\tif (hex.length === 0) {\n\t\treturn BigInt(0);\n\t}\n\treturn BigInt(`0x${hex}`);\n}\n\nexport function generateRandomness() {\n\t// Once Node 20 enters LTS, we can just use crypto.getRandomValues(new Uint8Array(16)), but until then we use `randomBytes` to improve compatibility:\n\treturn String(toBigIntBE(randomBytes(16)));\n}\n\nexport function generateNonce(publicKey: PublicKey, maxEpoch: number, randomness: bigint | string) {\n\tconst publicKeyBytes = toBigIntBE(publicKey.toHaneulBytes());\n\tconst eph_public_key_0 = publicKeyBytes / 2n ** 128n;\n\tconst eph_public_key_1 = publicKeyBytes % 2n ** 128n;\n\tconst bigNum = poseidonHash([eph_public_key_0, eph_public_key_1, maxEpoch, BigInt(randomness)]);\n\tconst Z = toPaddedBigEndianBytes(bigNum, 20);\n\tconst nonce = base64urlnopad.encode(Z);\n\n\tif (nonce.length !== NONCE_LENGTH) {\n\t\tthrow new Error(`Length of nonce ${nonce} (${nonce.length}) is not equal to ${NONCE_LENGTH}`);\n\t}\n\treturn nonce;\n}\n"],"mappings":";;;;;;;AAWA,MAAa,eAAe;AAE5B,SAAS,WAAW,OAAmB;CACtC,MAAM,MAAM,MAAM,MAAM;AACxB,KAAI,IAAI,WAAW,EAClB,QAAO,OAAO,EAAE;AAEjB,QAAO,OAAO,KAAK,MAAM;;AAG1B,SAAgB,qBAAqB;AAEpC,QAAO,OAAO,WAAW,YAAY,GAAG,CAAC,CAAC;;AAG3C,SAAgB,cAAc,WAAsB,UAAkB,YAA6B;CAClG,MAAM,iBAAiB,WAAW,UAAU,eAAe,CAAC;CAI5D,MAAM,IAAI,uBADK,aAAa;EAFH,iBAAiB,MAAM;EACvB,iBAAiB,MAAM;EACiB;EAAU,OAAO,WAAW;EAAC,CAAC,EACtD,GAAG;CAC5C,MAAM,QAAQ,eAAe,OAAO,EAAE;AAEtC,KAAI,MAAM,WAAW,aACpB,OAAM,IAAI,MAAM,mBAAmB,MAAM,IAAI,MAAM,OAAO,oBAAoB,eAAe;AAE9F,QAAO"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Haneul Labs <build@haneul-labs.com>",
4
4
  "description": "Haneul TypeScript API",
5
5
  "homepage": "https://sdk.haneul-labs.com",
6
- "version": "2.5.0",
6
+ "version": "2.5.2",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -182,8 +182,8 @@
182
182
  },
183
183
  "dependencies": {
184
184
  "@graphql-typed-document-node/core": "^3.2.0",
185
- "@haneullabs/bcs": "workspace:^",
186
- "@haneullabs/utils": "workspace:^",
185
+ "@haneullabs/bcs": "^2.0.2",
186
+ "@haneullabs/utils": "^0.3.1",
187
187
  "@noble/curves": "^2.0.1",
188
188
  "@noble/hashes": "^2.0.1",
189
189
  "@protobuf-ts/grpcweb-transport": "^2.11.1",
@@ -61,7 +61,7 @@ export abstract class PublicKey {
61
61
  * of the scheme flag with the raw bytes of the public key
62
62
  */
63
63
  toSuiPublicKey(): string {
64
- const bytes = this.toSuiBytes();
64
+ const bytes = this.toHaneulBytes();
65
65
  return toBase64(bytes);
66
66
  }
67
67
 
@@ -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<ArrayBuffer> {
108
+ toHaneulBytes(): Uint8Array<ArrayBuffer> {
109
109
  const rawBytes = this.toRawBytes();
110
110
  const suiBytes = new Uint8Array(rawBytes.length + 1);
111
111
  suiBytes.set([this.flag()]);
@@ -120,7 +120,7 @@ export abstract class PublicKey {
120
120
  toHaneulAddress(): string {
121
121
  // Each hex char represents half a byte, hence hex address doubles the length
122
122
  return normalizeHaneulAddress(
123
- bytesToHex(blake2b(this.toSuiBytes(), { dkLen: 32 })).slice(0, HANEUL_ADDRESS_LENGTH * 2),
123
+ bytesToHex(blake2b(this.toHaneulBytes(), { dkLen: 32 })).slice(0, HANEUL_ADDRESS_LENGTH * 2),
124
124
  );
125
125
  }
126
126
 
@@ -197,7 +197,7 @@ export class MultiSigPublicKey extends PublicKey {
197
197
  // The initial value 3 ensures that following data will be after the flag byte and threshold bytes
198
198
  let i = 3;
199
199
  for (const { publicKey, weight } of this.publicKeys) {
200
- const bytes = publicKey.toSuiBytes();
200
+ const bytes = publicKey.toHaneulBytes();
201
201
  tmp.set(bytes, i);
202
202
  i += bytes.length;
203
203
  tmp.set([weight], i++);
@@ -6,5 +6,5 @@ export {
6
6
  verifyPersonalMessageSignature,
7
7
  verifyTransactionSignature,
8
8
  publicKeyFromRawBytes,
9
- publicKeyFromSuiBytes,
9
+ publicKeyFromHaneulBytes,
10
10
  } from './verify.js';
@@ -136,7 +136,7 @@ export function publicKeyFromRawBytes(
136
136
  return publicKey;
137
137
  }
138
138
 
139
- export function publicKeyFromSuiBytes(
139
+ export function publicKeyFromHaneulBytes(
140
140
  publicKey: string | Uint8Array,
141
141
  options: { client?: ClientWithCoreApi; address?: string } = {},
142
142
  ) {
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 = '2.4.0';
6
+ export const PACKAGE_VERSION = '2.5.2';
7
7
  export const TARGETED_RPC_VERSION = '1.0.0';
@@ -25,7 +25,7 @@ export function generateRandomness() {
25
25
  }
26
26
 
27
27
  export function generateNonce(publicKey: PublicKey, maxEpoch: number, randomness: bigint | string) {
28
- const publicKeyBytes = toBigIntBE(publicKey.toSuiBytes());
28
+ const publicKeyBytes = toBigIntBE(publicKey.toHaneulBytes());
29
29
  const eph_public_key_0 = publicKeyBytes / 2n ** 128n;
30
30
  const eph_public_key_1 = publicKeyBytes % 2n ** 128n;
31
31
  const bigNum = poseidonHash([eph_public_key_0, eph_public_key_1, maxEpoch, BigInt(randomness)]);