@latticexyz/world-module-erc20 2.2.18-f0433092876e2ac9b5b12cd0ecae9c120a2d0368 → 2.2.19-900ac35deebfa260bafb1697d15e95eef855cd69

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 (120) hide show
  1. package/dist/_esm-H47RQ4ED.js +3915 -0
  2. package/dist/{_esm-BQNWKNND.js.map → _esm-H47RQ4ED.js.map} +1 -1
  3. package/dist/ccip-VJWDNI4X.js +15 -0
  4. package/dist/chunk-2VXHCW2O.js +132 -0
  5. package/dist/{chunk-TJJDXMQ6.js.map → chunk-2VXHCW2O.js.map} +1 -1
  6. package/dist/chunk-LIWKL347.js +3833 -0
  7. package/dist/{chunk-GSBUANUZ.js.map → chunk-LIWKL347.js.map} +1 -1
  8. package/dist/chunk-PR4QN5HX.js +43 -0
  9. package/dist/internal.js +27 -1
  10. package/dist/internal.js.map +1 -1
  11. package/dist/mud.config.js +83 -1
  12. package/dist/mud.config.js.map +1 -1
  13. package/dist/secp256k1-XVT662DN.js +2395 -0
  14. package/dist/{secp256k1-UMYSD4MC.js.map → secp256k1-XVT662DN.js.map} +1 -1
  15. package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
  16. package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
  17. package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
  18. package/out/Constants.sol/ERC20TableNames.json +1 -1
  19. package/out/Constants.sol/ModuleConstants.json +1 -1
  20. package/out/Constants.sol/OwnableTableNames.json +1 -1
  21. package/out/Constants.sol/PausableTableNames.json +1 -1
  22. package/out/Context.sol/Context.abi.json +15 -1
  23. package/out/Context.sol/Context.abi.json.d.ts +17 -0
  24. package/out/Context.sol/Context.json +1 -1
  25. package/out/Delegation.sol/Delegation.json +1 -1
  26. package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.json +1 -1
  27. package/out/ERC20BaseTest.t.sol/ERC20WithInternalStoreBehaviorTest.json +1 -1
  28. package/out/ERC20BaseTest.t.sol/ERC20WithInternalStoreTest.json +1 -1
  29. package/out/ERC20BaseTest.t.sol/ERC20WithWorldBehaviorTest.json +1 -1
  30. package/out/ERC20BaseTest.t.sol/ERC20WithWorldTest.json +1 -1
  31. package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json +13 -0
  32. package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json.d.ts +13 -0
  33. package/out/ERC20BaseTest.t.sol/MockERC20Base.json +1 -1
  34. package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.abi.json +13 -0
  35. package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.abi.json.d.ts +13 -0
  36. package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.json +1 -1
  37. package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.abi.json +95 -3
  38. package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.abi.json.d.ts +95 -3
  39. package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.json +1 -1
  40. package/out/ERC20BaseTest.t.sol/TestConstants.json +1 -1
  41. package/out/ERC20Burnable.sol/ERC20Burnable.abi.json +13 -0
  42. package/out/ERC20Burnable.sol/ERC20Burnable.abi.json.d.ts +13 -0
  43. package/out/ERC20Burnable.sol/ERC20Burnable.json +1 -1
  44. package/out/ERC20Burnable.t.sol/ERC20BurnableTest.json +1 -1
  45. package/out/ERC20Burnable.t.sol/ERC20BurnableWithInternalStoreTest.json +1 -1
  46. package/out/ERC20Burnable.t.sol/ERC20BurnableWithWorldTest.json +1 -1
  47. package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.abi.json +13 -0
  48. package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.abi.json.d.ts +13 -0
  49. package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.json +1 -1
  50. package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.abi.json +95 -3
  51. package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.abi.json.d.ts +95 -3
  52. package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.json +1 -1
  53. package/out/ERC20Module.sol/ERC20Module.json +1 -1
  54. package/out/ERC20Module.sol/ERC20RegistryLib.json +1 -1
  55. package/out/ERC20Module.t.sol/ERC20ModuleTest.json +1 -1
  56. package/out/ERC20Module.t.sol/TestConstants.json +1 -1
  57. package/out/ERC20Pausable.sol/ERC20Pausable.abi.json +13 -0
  58. package/out/ERC20Pausable.sol/ERC20Pausable.abi.json.d.ts +13 -0
  59. package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -1
  60. package/out/ERC20Pausable.t.sol/ERC20PausableBehaviorTest.json +1 -1
  61. package/out/ERC20Pausable.t.sol/ERC20PausableWithInternalStoreTest.json +1 -1
  62. package/out/ERC20Pausable.t.sol/ERC20PausableWithWorldTest.json +1 -1
  63. package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json +13 -0
  64. package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json.d.ts +13 -0
  65. package/out/ERC20Pausable.t.sol/MockERC20Pausable.json +1 -1
  66. package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.abi.json +13 -0
  67. package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.abi.json.d.ts +13 -0
  68. package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.json +1 -1
  69. package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.abi.json +95 -3
  70. package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.abi.json.d.ts +95 -3
  71. package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.json +1 -1
  72. package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.abi.json +13 -0
  73. package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.abi.json.d.ts +13 -0
  74. package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.json +1 -1
  75. package/out/ERC20WithWorld.sol/ERC20WithWorld.abi.json +95 -3
  76. package/out/ERC20WithWorld.sol/ERC20WithWorld.abi.json.d.ts +95 -3
  77. package/out/ERC20WithWorld.sol/ERC20WithWorld.json +1 -1
  78. package/out/IBaseWorld.sol/IBaseWorld.json +1 -1
  79. package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.json +1 -1
  80. package/out/InitModule.sol/InitModule.json +1 -1
  81. package/out/MUDERC20.sol/MUDERC20.abi.json +13 -0
  82. package/out/MUDERC20.sol/MUDERC20.abi.json.d.ts +13 -0
  83. package/out/MUDERC20.sol/MUDERC20.json +1 -1
  84. package/out/Module.sol/Module.json +1 -1
  85. package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.json +1 -1
  86. package/out/Ownable.sol/Ownable.abi.json +13 -0
  87. package/out/Ownable.sol/Ownable.abi.json.d.ts +13 -0
  88. package/out/Ownable.sol/Ownable.json +1 -1
  89. package/out/Pausable.sol/Pausable.abi.json +13 -0
  90. package/out/Pausable.sol/Pausable.abi.json.d.ts +13 -0
  91. package/out/Pausable.sol/Pausable.json +1 -1
  92. package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
  93. package/out/StoreConsumer.sol/StoreConsumer.json +1 -1
  94. package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.json +1 -1
  95. package/out/System.sol/System.json +1 -1
  96. package/out/SystemCall.sol/SystemCall.json +1 -1
  97. package/out/WithStore.sol/WithStore.abi.json +13 -0
  98. package/out/WithStore.sol/WithStore.abi.json.d.ts +13 -0
  99. package/out/WithStore.sol/WithStore.json +1 -1
  100. package/out/WithWorld.sol/WithWorld.abi.json +95 -3
  101. package/out/WithWorld.sol/WithWorld.abi.json.d.ts +95 -3
  102. package/out/WithWorld.sol/WithWorld.json +1 -1
  103. package/out/World.sol/World.json +1 -1
  104. package/out/WorldContext.sol/WorldContextConsumer.json +1 -1
  105. package/out/WorldContext.sol/WorldContextConsumerLib.json +1 -1
  106. package/out/WorldContext.sol/WorldContextProviderLib.json +1 -1
  107. package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.json +1 -1
  108. package/out/build-info/{04cd01b00610d99132b6410373c2f462.json → 60c60a9593fdb00b3264c36836a28f39.json} +1 -1
  109. package/package.json +8 -8
  110. package/src/examples/ERC20WithWorld.sol +5 -0
  111. package/src/experimental/Constants.sol +7 -7
  112. package/src/experimental/ERC20Module.sol +9 -1
  113. package/dist/_esm-BQNWKNND.js +0 -10
  114. package/dist/ccip-YAWUVTAX.js +0 -2
  115. package/dist/chunk-GSBUANUZ.js +0 -30
  116. package/dist/chunk-LURIOADG.js +0 -2
  117. package/dist/chunk-TJJDXMQ6.js +0 -7
  118. package/dist/secp256k1-UMYSD4MC.js +0 -22
  119. /package/dist/{ccip-YAWUVTAX.js.map → ccip-VJWDNI4X.js.map} +0 -0
  120. /package/dist/{chunk-LURIOADG.js.map → chunk-PR4QN5HX.js.map} +0 -0
@@ -0,0 +1,15 @@
1
+ import {
2
+ ccipRequest,
3
+ offchainLookup,
4
+ offchainLookupAbiItem,
5
+ offchainLookupSignature
6
+ } from "./chunk-LIWKL347.js";
7
+ import "./chunk-2VXHCW2O.js";
8
+ import "./chunk-PR4QN5HX.js";
9
+ export {
10
+ ccipRequest,
11
+ offchainLookup,
12
+ offchainLookupAbiItem,
13
+ offchainLookupSignature
14
+ };
15
+ //# sourceMappingURL=ccip-VJWDNI4X.js.map
@@ -0,0 +1,132 @@
1
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/cryptoNode.js
2
+ import * as nc from "node:crypto";
3
+ var crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
4
+
5
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js
6
+ function number(n) {
7
+ if (!Number.isSafeInteger(n) || n < 0)
8
+ throw new Error(`positive integer expected, not ${n}`);
9
+ }
10
+ function isBytes(a) {
11
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
12
+ }
13
+ function bytes(b, ...lengths) {
14
+ if (!isBytes(b))
15
+ throw new Error("Uint8Array expected");
16
+ if (lengths.length > 0 && !lengths.includes(b.length))
17
+ throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
18
+ }
19
+ function hash(h) {
20
+ if (typeof h !== "function" || typeof h.create !== "function")
21
+ throw new Error("Hash should be wrapped by utils.wrapConstructor");
22
+ number(h.outputLen);
23
+ number(h.blockLen);
24
+ }
25
+ function exists(instance, checkFinished = true) {
26
+ if (instance.destroyed)
27
+ throw new Error("Hash instance has been destroyed");
28
+ if (checkFinished && instance.finished)
29
+ throw new Error("Hash#digest() has already been called");
30
+ }
31
+ function output(out, instance) {
32
+ bytes(out);
33
+ const min = instance.outputLen;
34
+ if (out.length < min) {
35
+ throw new Error(`digestInto() expects output buffer of length at least ${min}`);
36
+ }
37
+ }
38
+
39
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js
40
+ var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
41
+ var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
42
+ var rotr = (word, shift) => word << 32 - shift | word >>> shift;
43
+ var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
44
+ var byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
45
+ function byteSwap32(arr) {
46
+ for (let i = 0; i < arr.length; i++) {
47
+ arr[i] = byteSwap(arr[i]);
48
+ }
49
+ }
50
+ function utf8ToBytes(str) {
51
+ if (typeof str !== "string")
52
+ throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
53
+ return new Uint8Array(new TextEncoder().encode(str));
54
+ }
55
+ function toBytes(data) {
56
+ if (typeof data === "string")
57
+ data = utf8ToBytes(data);
58
+ bytes(data);
59
+ return data;
60
+ }
61
+ function concatBytes(...arrays) {
62
+ let sum = 0;
63
+ for (let i = 0; i < arrays.length; i++) {
64
+ const a = arrays[i];
65
+ bytes(a);
66
+ sum += a.length;
67
+ }
68
+ const res = new Uint8Array(sum);
69
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
70
+ const a = arrays[i];
71
+ res.set(a, pad);
72
+ pad += a.length;
73
+ }
74
+ return res;
75
+ }
76
+ var Hash = class {
77
+ // Safe version that clones internal state
78
+ clone() {
79
+ return this._cloneInto();
80
+ }
81
+ };
82
+ var toStr = {}.toString;
83
+ function wrapConstructor(hashCons) {
84
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
85
+ const tmp = hashCons();
86
+ hashC.outputLen = tmp.outputLen;
87
+ hashC.blockLen = tmp.blockLen;
88
+ hashC.create = () => hashCons();
89
+ return hashC;
90
+ }
91
+ function wrapXOFConstructorWithOpts(hashCons) {
92
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
93
+ const tmp = hashCons({});
94
+ hashC.outputLen = tmp.outputLen;
95
+ hashC.blockLen = tmp.blockLen;
96
+ hashC.create = (opts) => hashCons(opts);
97
+ return hashC;
98
+ }
99
+ function randomBytes(bytesLength = 32) {
100
+ if (crypto && typeof crypto.getRandomValues === "function") {
101
+ return crypto.getRandomValues(new Uint8Array(bytesLength));
102
+ }
103
+ if (crypto && typeof crypto.randomBytes === "function") {
104
+ return crypto.randomBytes(bytesLength);
105
+ }
106
+ throw new Error("crypto.getRandomValues must be defined");
107
+ }
108
+
109
+ export {
110
+ number,
111
+ bytes,
112
+ hash,
113
+ exists,
114
+ output,
115
+ u32,
116
+ createView,
117
+ rotr,
118
+ isLE,
119
+ byteSwap32,
120
+ toBytes,
121
+ concatBytes,
122
+ Hash,
123
+ wrapConstructor,
124
+ wrapXOFConstructorWithOpts,
125
+ randomBytes
126
+ };
127
+ /*! Bundled license information:
128
+
129
+ @noble/hashes/esm/utils.js:
130
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
131
+ */
132
+ //# sourceMappingURL=chunk-2VXHCW2O.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/cryptoNode.ts","../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/_assert.ts","../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/utils.ts"],"sourcesContent":["// We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.\n// Falls back to Node.js built-in crypto for Node.js <=v14\n// See utils.ts for details.\n// @ts-ignore\nimport * as nc from 'node:crypto';\nexport const crypto =\n nc && typeof nc === 'object' && 'webcrypto' in nc\n ? (nc.webcrypto as any)\n : nc && typeof nc === 'object' && 'randomBytes' in nc\n ? nc\n : undefined;\n","function number(n: number) {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error(`positive integer expected, not ${n}`);\n}\n\nfunction bool(b: boolean) {\n if (typeof b !== 'boolean') throw new Error(`boolean expected, not ${b}`);\n}\n\n// copied from utils\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\nfunction bytes(b: Uint8Array | undefined, ...lengths: number[]) {\n if (!isBytes(b)) throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\n\ntype Hash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\nfunction hash(h: Hash) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(h.outputLen);\n number(h.blockLen);\n}\n\nfunction exists(instance: any, checkFinished = true) {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\nfunction output(out: any, instance: any) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nexport { number, bool, bytes, hash, exists, output };\n\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nimport { bytes as abytes } from './_assert.js';\n// export { isBytes } from './_assert.js';\n// We can't reuse isBytes from _assert, because somehow this causes huge perf issues\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\n// Cast array to different type\nexport const u8 = (arr: TypedArray) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr: TypedArray) =>\n new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n\n// Cast array to view\nexport const createView = (arr: TypedArray) =>\n new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word: number, shift: number) => (word << (32 - shift)) | (word >>> shift);\n// The rotate left (circular left shift) operation for uint32\nexport const rotl = (word: number, shift: number) =>\n (word << shift) | ((word >>> (32 - shift)) >>> 0);\n\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// The byte swap operation for uint32\nexport const byteSwap = (word: number) =>\n ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff);\n// Conditionally byte swap if on a big-endian platform\nexport const byteSwapIfBE = isLE ? (n: number) => n : (n: number) => byteSwap(n);\n\n// In place byte swap for Uint32Array\nexport function byteSwap32(arr: Uint32Array) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n}\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n abytes(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 } as const;\nfunction asciiToBase16(char: number): number | undefined {\n if (char >= asciis._0 && char <= asciis._9) return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F) return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f) return char - (asciis._a - 10);\n return;\n}\n\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => {};\n\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters: number, tick: number, cb: (i: number) => void) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\nexport type Input = Uint8Array | string;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n\n// For runtime check if class implements interface\nexport abstract class Hash<T extends Hash<T>> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\nconst toStr = {}.toString;\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\nexport type CHash = ReturnType<typeof wrapConstructor>;\n\nexport function wrapConstructor<T extends Hash<T>>(hashCons: () => Hash<T>) {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function wrapConstructorWithOpts<H extends Hash<H>, T extends Object>(\n hashCons: (opts?: T) => Hash<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\nexport function wrapXOFConstructorWithOpts<H extends HashXOF<H>, T extends Object>(\n hashCons: (opts?: T) => HashXOF<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto && typeof crypto.randomBytes === 'function') {\n return crypto.randomBytes(bytesLength);\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n"],"mappings":"AAIA,UAAYA,MAAQ,cACb,IAAMC,EACXD,GAAM,OAAOA,GAAO,UAAY,cAAeA,EACvC,YACJA,GAAM,OAAOA,GAAO,UAAY,gBAAiBA,EAC/CA,EACA,OCVR,SAASE,EAAOC,EAAS,CACvB,GAAI,CAAC,OAAO,cAAcA,CAAC,GAAKA,EAAI,EAAG,MAAM,IAAI,MAAM,kCAAkCA,CAAC,EAAE,CAC9F,CAOM,SAAUC,EAAQC,EAAU,CAChC,OACEA,aAAa,YACZA,GAAK,MAAQ,OAAOA,GAAM,UAAYA,EAAE,YAAY,OAAS,YAElE,CAEA,SAASC,EAAMC,KAA8BC,EAAiB,CAC5D,GAAI,CAACJ,EAAQG,CAAC,EAAG,MAAM,IAAI,MAAM,qBAAqB,EACtD,GAAIC,EAAQ,OAAS,GAAK,CAACA,EAAQ,SAASD,EAAE,MAAM,EAClD,MAAM,IAAI,MAAM,iCAAiCC,CAAO,mBAAmBD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CAAC,EAG3D,GAAIC,GAAU,OAAOA,EAAO,aAAgB,WAC1C,OAAOA,EAAO,YAAYD,CAAW,EAEvC,MAAM,IAAI,MAAM,wCAAwC,CAC1D","names":["nc","crypto","number","n","isBytes","a","bytes","b","lengths","hash","h","number","exists","instance","checkFinished","output","out","min","u32","arr","createView","rotr","word","shift","isLE","byteSwap","word","byteSwap32","arr","i","byteSwap","utf8ToBytes","str","toBytes","data","bytes","concatBytes","arrays","sum","i","a","res","pad","Hash","toStr","wrapConstructor","hashCons","hashC","msg","toBytes","tmp","wrapXOFConstructorWithOpts","hashCons","hashC","msg","opts","toBytes","tmp","randomBytes","bytesLength","crypto"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/cryptoNode.ts","../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/_assert.ts","../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/utils.ts"],"sourcesContent":["// We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.\n// Falls back to Node.js built-in crypto for Node.js <=v14\n// See utils.ts for details.\n// @ts-ignore\nimport * as nc from 'node:crypto';\nexport const crypto =\n nc && typeof nc === 'object' && 'webcrypto' in nc\n ? (nc.webcrypto as any)\n : nc && typeof nc === 'object' && 'randomBytes' in nc\n ? nc\n : undefined;\n","function number(n: number) {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error(`positive integer expected, not ${n}`);\n}\n\nfunction bool(b: boolean) {\n if (typeof b !== 'boolean') throw new Error(`boolean expected, not ${b}`);\n}\n\n// copied from utils\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\nfunction bytes(b: Uint8Array | undefined, ...lengths: number[]) {\n if (!isBytes(b)) throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\n\ntype Hash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\nfunction hash(h: Hash) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(h.outputLen);\n number(h.blockLen);\n}\n\nfunction exists(instance: any, checkFinished = true) {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\nfunction output(out: any, instance: any) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nexport { number, bool, bytes, hash, exists, output };\n\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nimport { bytes as abytes } from './_assert.js';\n// export { isBytes } from './_assert.js';\n// We can't reuse isBytes from _assert, because somehow this causes huge perf issues\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\n// Cast array to different type\nexport const u8 = (arr: TypedArray) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr: TypedArray) =>\n new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n\n// Cast array to view\nexport const createView = (arr: TypedArray) =>\n new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word: number, shift: number) => (word << (32 - shift)) | (word >>> shift);\n// The rotate left (circular left shift) operation for uint32\nexport const rotl = (word: number, shift: number) =>\n (word << shift) | ((word >>> (32 - shift)) >>> 0);\n\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// The byte swap operation for uint32\nexport const byteSwap = (word: number) =>\n ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff);\n// Conditionally byte swap if on a big-endian platform\nexport const byteSwapIfBE = isLE ? (n: number) => n : (n: number) => byteSwap(n);\n\n// In place byte swap for Uint32Array\nexport function byteSwap32(arr: Uint32Array) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n}\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n abytes(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 } as const;\nfunction asciiToBase16(char: number): number | undefined {\n if (char >= asciis._0 && char <= asciis._9) return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F) return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f) return char - (asciis._a - 10);\n return;\n}\n\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => {};\n\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters: number, tick: number, cb: (i: number) => void) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\nexport type Input = Uint8Array | string;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n\n// For runtime check if class implements interface\nexport abstract class Hash<T extends Hash<T>> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\nconst toStr = {}.toString;\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\nexport type CHash = ReturnType<typeof wrapConstructor>;\n\nexport function wrapConstructor<T extends Hash<T>>(hashCons: () => Hash<T>) {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function wrapConstructorWithOpts<H extends Hash<H>, T extends Object>(\n hashCons: (opts?: T) => Hash<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\nexport function wrapXOFConstructorWithOpts<H extends HashXOF<H>, T extends Object>(\n hashCons: (opts?: T) => HashXOF<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto && typeof crypto.randomBytes === 'function') {\n return crypto.randomBytes(bytesLength);\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n"],"mappings":";AAIA,YAAY,QAAQ;AACb,IAAM,SACX,MAAM,OAAO,OAAO,YAAY,eAAe,KACvC,eACJ,MAAM,OAAO,OAAO,YAAY,iBAAiB,KAC/C,KACA;;;ACVR,SAAS,OAAO,GAAS;AACvB,MAAI,CAAC,OAAO,cAAc,CAAC,KAAK,IAAI;AAAG,UAAM,IAAI,MAAM,kCAAkC,CAAC,EAAE;AAC9F;AAOM,SAAU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