quantum-coin-js-sdk 1.0.39 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/.gitignore +2 -1
  2. package/README.md +109 -768
  3. package/index.d.ts +76 -545
  4. package/index.js +319 -1194
  5. package/package.json +20 -5
  6. package/wasmBase64.js +7 -16
  7. package/wasm_exec.js +575 -587
  8. package/.idea/.name +0 -1
  9. package/.idea/modules.xml +0 -8
  10. package/.idea/quantum-coin-js-sdk.iml +0 -12
  11. package/.idea/vcs.xml +0 -6
  12. package/.vs/ProjectSettings.json +0 -3
  13. package/.vs/VSWorkspaceState.json +0 -8
  14. package/.vs/quantum-coin-js-sdk/FileContentIndex/a9d6de82-cfc3-4c22-ac38-06d706ff3673.vsidx +0 -0
  15. package/.vs/quantum-coin-js-sdk/FileContentIndex/fdc816df-1898-4153-99f2-c69ef4c2283b.vsidx +0 -0
  16. package/.vs/quantum-coin-js-sdk/config/applicationhost.config +0 -1011
  17. package/.vs/quantum-coin-js-sdk/v17/.wsuo +0 -0
  18. package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.backup.json +0 -39
  19. package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.json +0 -57
  20. package/.vs/slnx.sqlite +0 -0
  21. package/example/README.md +0 -14
  22. package/example/conversion-example.js +0 -19
  23. package/example/example-create-contract.js +0 -396
  24. package/example/example-encode-decode-rlp.js +0 -225
  25. package/example/example-event-pack-unpack.js +0 -391
  26. package/example/example-misc.js +0 -100
  27. package/example/example-rpc-send-signRawTransaction.js +0 -318
  28. package/example/example-rpc-send.js +0 -115
  29. package/example/example-send.js +0 -69
  30. package/example/example-token-pack-unpack.js +0 -960
  31. package/example/example-wallet-version4.js +0 -34
  32. package/example/example-wallet.js +0 -43
  33. package/example/example.js +0 -405
  34. package/example/node_modules/.bin/sdkgen +0 -16
  35. package/example/node_modules/.bin/sdkgen.cmd +0 -17
  36. package/example/node_modules/.bin/sdkgen.ps1 +0 -28
  37. package/example/node_modules/.package-lock.json +0 -47
  38. package/example/node_modules/quantumcoin/.github/workflows/publish-npmjs.yaml +0 -22
  39. package/example/node_modules/quantumcoin/LICENSE +0 -21
  40. package/example/node_modules/quantumcoin/README-SDK.md +0 -828
  41. package/example/node_modules/quantumcoin/README.md +0 -197
  42. package/example/node_modules/quantumcoin/config.d.ts +0 -50
  43. package/example/node_modules/quantumcoin/config.js +0 -123
  44. package/example/node_modules/quantumcoin/examples/AllSolidityTypes.sol +0 -184
  45. package/example/node_modules/quantumcoin/examples/SimpleIERC20.sol +0 -74
  46. package/example/node_modules/quantumcoin/examples/events.js +0 -41
  47. package/example/node_modules/quantumcoin/examples/events.ts +0 -35
  48. package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.js +0 -100
  49. package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.ts +0 -77
  50. package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.js +0 -100
  51. package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.ts +0 -77
  52. package/example/node_modules/quantumcoin/examples/example.js +0 -67
  53. package/example/node_modules/quantumcoin/examples/example.ts +0 -56
  54. package/example/node_modules/quantumcoin/examples/offline-signing.js +0 -77
  55. package/example/node_modules/quantumcoin/examples/offline-signing.ts +0 -65
  56. package/example/node_modules/quantumcoin/examples/package-lock.json +0 -596
  57. package/example/node_modules/quantumcoin/examples/package.json +0 -32
  58. package/example/node_modules/quantumcoin/examples/read-operations.js +0 -32
  59. package/example/node_modules/quantumcoin/examples/read-operations.ts +0 -31
  60. package/example/node_modules/quantumcoin/examples/sdk-generator-erc20.inline.json +0 -251
  61. package/example/node_modules/quantumcoin/examples/solidity-types.ts +0 -43
  62. package/example/node_modules/quantumcoin/examples/wallet-offline.js +0 -36
  63. package/example/node_modules/quantumcoin/examples/wallet-offline.ts +0 -26
  64. package/example/node_modules/quantumcoin/generate-sdk.js +0 -1846
  65. package/example/node_modules/quantumcoin/index.js +0 -12
  66. package/example/node_modules/quantumcoin/package.json +0 -95
  67. package/example/node_modules/quantumcoin/scripts/copy-declarations.js +0 -31
  68. package/example/node_modules/quantumcoin/scripts/run-all-one-by-one.js +0 -151
  69. package/example/node_modules/quantumcoin/src/abi/fragments.d.ts +0 -42
  70. package/example/node_modules/quantumcoin/src/abi/fragments.js +0 -63
  71. package/example/node_modules/quantumcoin/src/abi/index.d.ts +0 -13
  72. package/example/node_modules/quantumcoin/src/abi/index.js +0 -9
  73. package/example/node_modules/quantumcoin/src/abi/interface.d.ts +0 -128
  74. package/example/node_modules/quantumcoin/src/abi/interface.js +0 -605
  75. package/example/node_modules/quantumcoin/src/abi/js-abi-coder.d.ts +0 -8
  76. package/example/node_modules/quantumcoin/src/abi/js-abi-coder.js +0 -538
  77. package/example/node_modules/quantumcoin/src/constants.d.ts +0 -61
  78. package/example/node_modules/quantumcoin/src/constants.js +0 -94
  79. package/example/node_modules/quantumcoin/src/contract/contract-factory.d.ts +0 -28
  80. package/example/node_modules/quantumcoin/src/contract/contract-factory.js +0 -111
  81. package/example/node_modules/quantumcoin/src/contract/contract.d.ts +0 -113
  82. package/example/node_modules/quantumcoin/src/contract/contract.js +0 -408
  83. package/example/node_modules/quantumcoin/src/contract/index.d.ts +0 -9
  84. package/example/node_modules/quantumcoin/src/contract/index.js +0 -9
  85. package/example/node_modules/quantumcoin/src/errors/index.d.ts +0 -92
  86. package/example/node_modules/quantumcoin/src/errors/index.js +0 -200
  87. package/example/node_modules/quantumcoin/src/generator/index.d.ts +0 -81
  88. package/example/node_modules/quantumcoin/src/generator/index.js +0 -1571
  89. package/example/node_modules/quantumcoin/src/index.d.ts +0 -122
  90. package/example/node_modules/quantumcoin/src/index.js +0 -41
  91. package/example/node_modules/quantumcoin/src/internal/hex.d.ts +0 -68
  92. package/example/node_modules/quantumcoin/src/internal/hex.js +0 -180
  93. package/example/node_modules/quantumcoin/src/providers/extra-providers.d.ts +0 -139
  94. package/example/node_modules/quantumcoin/src/providers/extra-providers.js +0 -614
  95. package/example/node_modules/quantumcoin/src/providers/index.d.ts +0 -17
  96. package/example/node_modules/quantumcoin/src/providers/index.js +0 -10
  97. package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.d.ts +0 -12
  98. package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.js +0 -89
  99. package/example/node_modules/quantumcoin/src/providers/provider.d.ts +0 -206
  100. package/example/node_modules/quantumcoin/src/providers/provider.js +0 -524
  101. package/example/node_modules/quantumcoin/src/types/index.d.ts +0 -214
  102. package/example/node_modules/quantumcoin/src/types/index.js +0 -9
  103. package/example/node_modules/quantumcoin/src/utils/address.d.ts +0 -58
  104. package/example/node_modules/quantumcoin/src/utils/address.js +0 -144
  105. package/example/node_modules/quantumcoin/src/utils/encoding.d.ts +0 -120
  106. package/example/node_modules/quantumcoin/src/utils/encoding.js +0 -306
  107. package/example/node_modules/quantumcoin/src/utils/fixednumber.d.ts +0 -57
  108. package/example/node_modules/quantumcoin/src/utils/fixednumber.js +0 -366
  109. package/example/node_modules/quantumcoin/src/utils/hashing.d.ts +0 -76
  110. package/example/node_modules/quantumcoin/src/utils/hashing.js +0 -298
  111. package/example/node_modules/quantumcoin/src/utils/index.d.ts +0 -63
  112. package/example/node_modules/quantumcoin/src/utils/index.js +0 -14
  113. package/example/node_modules/quantumcoin/src/utils/result.d.ts +0 -57
  114. package/example/node_modules/quantumcoin/src/utils/result.js +0 -128
  115. package/example/node_modules/quantumcoin/src/utils/rlp.d.ts +0 -12
  116. package/example/node_modules/quantumcoin/src/utils/rlp.js +0 -215
  117. package/example/node_modules/quantumcoin/src/utils/units.d.ts +0 -29
  118. package/example/node_modules/quantumcoin/src/utils/units.js +0 -107
  119. package/example/node_modules/quantumcoin/src/wallet/index.d.ts +0 -10
  120. package/example/node_modules/quantumcoin/src/wallet/index.js +0 -8
  121. package/example/node_modules/quantumcoin/src/wallet/wallet.d.ts +0 -192
  122. package/example/node_modules/quantumcoin/src/wallet/wallet.js +0 -713
  123. package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.js +0 -207
  124. package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.ts +0 -191
  125. package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.fixtures.js +0 -231
  126. package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +0 -387
  127. package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +0 -350
  128. package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.js +0 -165
  129. package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.ts +0 -160
  130. package/example/node_modules/quantumcoin/test/e2e/helpers.js +0 -59
  131. package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.js +0 -141
  132. package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.ts +0 -128
  133. package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.js +0 -168
  134. package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +0 -141
  135. package/example/node_modules/quantumcoin/test/e2e/transactional.test.js +0 -245
  136. package/example/node_modules/quantumcoin/test/e2e/transactional.test.ts +0 -208
  137. package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.js +0 -407
  138. package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.ts +0 -337
  139. package/example/node_modules/quantumcoin/test/fixtures/ConstructorParam.sol +0 -23
  140. package/example/node_modules/quantumcoin/test/fixtures/MultiContracts.sol +0 -37
  141. package/example/node_modules/quantumcoin/test/fixtures/SimpleStorage.sol +0 -18
  142. package/example/node_modules/quantumcoin/test/fixtures/StakingContract.abi.json +0 -1
  143. package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.js +0 -49
  144. package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.ts +0 -44
  145. package/example/node_modules/quantumcoin/test/integration/provider.test.js +0 -88
  146. package/example/node_modules/quantumcoin/test/integration/provider.test.ts +0 -85
  147. package/example/node_modules/quantumcoin/test/integration/ws-provider.test.js +0 -41
  148. package/example/node_modules/quantumcoin/test/integration/ws-provider.test.ts +0 -38
  149. package/example/node_modules/quantumcoin/test/security/abi-decoder-bounds.test.js +0 -122
  150. package/example/node_modules/quantumcoin/test/security/contract-overrides.test.js +0 -112
  151. package/example/node_modules/quantumcoin/test/security/generator-injection.test.js +0 -195
  152. package/example/node_modules/quantumcoin/test/security/malformed-input.test.js +0 -330
  153. package/example/node_modules/quantumcoin/test/security/malformed-input.test.ts +0 -35
  154. package/example/node_modules/quantumcoin/test/security/rpc-numeric-bounds.test.js +0 -81
  155. package/example/node_modules/quantumcoin/test/security/rpc-trust.test.js +0 -202
  156. package/example/node_modules/quantumcoin/test/unit/_encrypted-output.txt +0 -6
  157. package/example/node_modules/quantumcoin/test/unit/_log-encrypted-jsons.js +0 -45
  158. package/example/node_modules/quantumcoin/test/unit/_write-keystore-fixture.js +0 -16
  159. package/example/node_modules/quantumcoin/test/unit/abi-interface.test.js +0 -110
  160. package/example/node_modules/quantumcoin/test/unit/abi-interface.test.ts +0 -109
  161. package/example/node_modules/quantumcoin/test/unit/address-wallet.test.js +0 -923
  162. package/example/node_modules/quantumcoin/test/unit/address-wallet.test.ts +0 -877
  163. package/example/node_modules/quantumcoin/test/unit/browser-provider.test.js +0 -85
  164. package/example/node_modules/quantumcoin/test/unit/browser-provider.test.ts +0 -79
  165. package/example/node_modules/quantumcoin/test/unit/contract.test.js +0 -85
  166. package/example/node_modules/quantumcoin/test/unit/contract.test.ts +0 -83
  167. package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.js +0 -127
  168. package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.ts +0 -91
  169. package/example/node_modules/quantumcoin/test/unit/errors.test.js +0 -77
  170. package/example/node_modules/quantumcoin/test/unit/errors.test.ts +0 -76
  171. package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.js +0 -55
  172. package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.ts +0 -54
  173. package/example/node_modules/quantumcoin/test/unit/fixednumber.test.js +0 -656
  174. package/example/node_modules/quantumcoin/test/unit/fixednumber.test.ts +0 -660
  175. package/example/node_modules/quantumcoin/test/unit/fixtures/encrypted-keystores-48-32-36.js +0 -9
  176. package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.js +0 -42
  177. package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.ts +0 -41
  178. package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.js +0 -113
  179. package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.ts +0 -110
  180. package/example/node_modules/quantumcoin/test/unit/generator.test.js +0 -149
  181. package/example/node_modules/quantumcoin/test/unit/generator.test.ts +0 -148
  182. package/example/node_modules/quantumcoin/test/unit/hashing.test.js +0 -64
  183. package/example/node_modules/quantumcoin/test/unit/hashing.test.ts +0 -63
  184. package/example/node_modules/quantumcoin/test/unit/init.test.js +0 -39
  185. package/example/node_modules/quantumcoin/test/unit/init.test.ts +0 -38
  186. package/example/node_modules/quantumcoin/test/unit/interface.test.js +0 -56
  187. package/example/node_modules/quantumcoin/test/unit/interface.test.ts +0 -54
  188. package/example/node_modules/quantumcoin/test/unit/internal-hex.test.js +0 -81
  189. package/example/node_modules/quantumcoin/test/unit/internal-hex.test.ts +0 -80
  190. package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.js +0 -98
  191. package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.ts +0 -64
  192. package/example/node_modules/quantumcoin/test/unit/providers.test.js +0 -252
  193. package/example/node_modules/quantumcoin/test/unit/providers.test.ts +0 -251
  194. package/example/node_modules/quantumcoin/test/unit/result.test.js +0 -80
  195. package/example/node_modules/quantumcoin/test/unit/result.test.ts +0 -79
  196. package/example/node_modules/quantumcoin/test/unit/solidity-types.test.js +0 -49
  197. package/example/node_modules/quantumcoin/test/unit/solidity-types.test.ts +0 -39
  198. package/example/node_modules/quantumcoin/test/unit/utils.test.js +0 -57
  199. package/example/node_modules/quantumcoin/test/unit/utils.test.ts +0 -56
  200. package/example/node_modules/quantumcoin/test/verbose-logger.js +0 -74
  201. package/example/node_modules/quantumcoin/tsconfig.build.json +0 -14
  202. package/example/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +0 -22
  203. package/example/node_modules/seed-words/BUILD.md +0 -7
  204. package/example/node_modules/seed-words/LICENSE +0 -121
  205. package/example/node_modules/seed-words/README.md +0 -67
  206. package/example/node_modules/seed-words/dist/seedwords.d.ts +0 -39
  207. package/example/node_modules/seed-words/package.json +0 -27
  208. package/example/node_modules/seed-words/seedwords.js +0 -315
  209. package/example/node_modules/seed-words/seedwords.txt +0 -65536
  210. package/example/node_modules/seed-words/tsconfig.json +0 -21
  211. package/example/package-lock.json +0 -56
  212. package/example/package.json +0 -15
  213. package/tests/encrypted-32.json +0 -1
  214. package/tests/encrypted-36.json +0 -1
  215. package/tests/encrypted-48.json +0 -1
  216. package/tests/generate-verify-vectors.js +0 -91
  217. package/tests/get-gas-price.test.js +0 -59
  218. package/tests/non-transactional.preinit.test.js +0 -41
  219. package/tests/non-transactional.test.js +0 -1389
  220. package/tests/scrypt.test.js +0 -128
  221. package/tests/sign-raw-keytype5-context-null.test.js +0 -107
  222. package/tests/sign-raw-transaction.test.js +0 -196
  223. package/tests/sign-verify.test.js +0 -311
  224. package/tests/transactional.relay.test.js +0 -131
  225. package/tests/transactional.rpc.test.js +0 -103
  226. package/tests/verify-vectors.json +0 -95035
@@ -1,713 +0,0 @@
1
- /**
2
- * @fileoverview Wallet and signer implementations.
3
- *
4
- * The QuantumCoin.js wallet model mirrors ethers.js v6:
5
- * - AbstractSigner -> BaseWallet -> Wallet
6
- * - NonceManager wrapper
7
- *
8
- * Cryptographic operations are delegated to `quantum-coin-js-sdk`.
9
- */
10
-
11
- const qcsdk = require("quantum-coin-js-sdk");
12
- const seedWords = require("seed-words");
13
- const { JsonRpcProvider } = require("../providers/json-rpc-provider");
14
- const { assertArgument, assertSecretArgument, makeError } = require("../errors");
15
- const { arrayify, bytesToHex, hexToBytes, isHexString, normalizeHex } = require("../internal/hex");
16
- const { getAddress } = require("../utils/address");
17
- const { WeiPerEther } = require("../constants");
18
-
19
- function _requireInitialized() {
20
- // eslint-disable-next-line global-require
21
- const { isInitialized, getInitializationPromise } = require("../../config");
22
- if (isInitialized()) return;
23
- if (getInitializationPromise() != null) {
24
- throw makeError(
25
- "QuantumCoin SDK is still initializing. Await the Initialize() promise before using SDK methods.",
26
- "UNKNOWN_ERROR",
27
- { operation: "requireInitialized" },
28
- );
29
- }
30
- throw makeError("QuantumCoin SDK not initialized. Call Initialize() first.", "UNKNOWN_ERROR", { operation: "wallet" });
31
- }
32
-
33
- function _bytesToNumberArray(bytes) {
34
- return Array.from(bytes);
35
- }
36
-
37
- /**
38
- * Verify that a private/public key pair is internally consistent (the public
39
- * key really corresponds to the private key). Constructing a wallet from a
40
- * mismatched pair must fail loudly here rather than silently producing a wallet
41
- * that signs with one key but claims another.
42
- *
43
- * NOTE: `qcsdk.verifyWallet` requires the raw (non-`0x`-prefixed) address form,
44
- * so we build the verification wallet from `addressFromPublicKey` directly
45
- * (mirroring the original `fromKeys` flow) rather than reusing a wallet that may
46
- * carry a normalized `0x` address.
47
- *
48
- * @param {Uint8Array} privateKeyBytes
49
- * @param {Uint8Array} publicKeyBytes
50
- */
51
- function _assertKeyPairValid(privateKeyBytes, publicKeyBytes) {
52
- const privArr = _bytesToNumberArray(privateKeyBytes);
53
- const pubArr = _bytesToNumberArray(publicKeyBytes);
54
- const addr = qcsdk.addressFromPublicKey(pubArr);
55
- if (typeof addr !== "string") throw makeError("addressFromPublicKey failed", "UNKNOWN_ERROR", {});
56
- const checkWallet = new qcsdk.Wallet(addr, privArr, pubArr);
57
- const verified = qcsdk.verifyWallet(checkWallet);
58
- if (verified !== true) {
59
- throw makeError("verifyWallet failed: the provided key pair is invalid", "INVALID_ARGUMENT", { verified });
60
- }
61
- }
62
-
63
- const _maxSafeInt = 0x1fffffffffffffn; // 2^53 - 1
64
-
65
- function _getBigInt(value, name) {
66
- if (typeof value === "bigint") return value;
67
- if (typeof value === "number") {
68
- assertArgument(Number.isInteger(value), "underflow", name, value);
69
- assertArgument(value >= -Number(_maxSafeInt) && value <= Number(_maxSafeInt), "overflow", name, value);
70
- return BigInt(value);
71
- }
72
- if (typeof value === "string") {
73
- if (value === "0x" || value === "0X") return 0n;
74
- try { return BigInt(value); }
75
- catch { assertArgument(false, "invalid BigNumberish string", name, value); }
76
- }
77
- assertArgument(false, "invalid BigNumberish", name, value);
78
- }
79
-
80
- function _getNumber(value, name) {
81
- const bi = _getBigInt(value, name);
82
- assertArgument(bi >= -_maxSafeInt && bi <= _maxSafeInt, "overflow", name, value);
83
- return Number(bi);
84
- }
85
-
86
- /**
87
- * SigningKey wrapper (PQC private/public key bytes).
88
- */
89
- class SigningKey {
90
- /**
91
- * @param {Uint8Array} privateKeyBytes
92
- * @param {Uint8Array} publicKeyBytes
93
- */
94
- constructor(privateKeyBytes, publicKeyBytes) {
95
- Object.defineProperty(this, "privateKeyBytes", {
96
- enumerable: false,
97
- configurable: false,
98
- writable: false,
99
- value: new Uint8Array(privateKeyBytes),
100
- });
101
- this.publicKeyBytes = new Uint8Array(publicKeyBytes);
102
- }
103
-
104
- toJSON() {
105
- return {};
106
- }
107
- }
108
-
109
- /**
110
- * AbstractSigner base (minimal).
111
- */
112
- class AbstractSigner {
113
- /**
114
- * @param {import("../providers/provider").AbstractProvider|null} provider
115
- */
116
- constructor(provider) {
117
- this.provider = provider || null;
118
- }
119
-
120
- async getAddress() {
121
- throw makeError("getAddress not implemented", "NOT_IMPLEMENTED", {});
122
- }
123
- }
124
-
125
- /**
126
- * BaseWallet - core signing implementation.
127
- */
128
- class BaseWallet extends AbstractSigner {
129
- /**
130
- * @param {SigningKey} signingKey
131
- * @param {import("../providers/provider").AbstractProvider|null=} provider
132
- * @param {{ address: string }=} precomputed
133
- * @param {any=} qcWallet Internal quantum-coin-js-sdk Wallet (optional)
134
- */
135
- constructor(signingKey, provider, precomputed, qcWallet) {
136
- super(provider || null);
137
- _requireInitialized();
138
-
139
- Object.defineProperty(this, "signingKey", {
140
- enumerable: false,
141
- configurable: false,
142
- writable: false,
143
- value: signingKey,
144
- });
145
- Object.defineProperty(this, "_qcWallet", {
146
- enumerable: false,
147
- configurable: true,
148
- writable: true,
149
- value: qcWallet || null,
150
- });
151
-
152
- /** @type {string} */
153
- this.address = precomputed?.address || "";
154
-
155
- Object.defineProperty(this, "privateKey", {
156
- enumerable: false,
157
- get: () => bytesToHex(this.signingKey.privateKeyBytes),
158
- });
159
-
160
- Object.defineProperty(this, "publicKey", {
161
- enumerable: true,
162
- get: () => bytesToHex(this.signingKey.publicKeyBytes),
163
- });
164
-
165
- Object.defineProperty(this, "_seed", {
166
- enumerable: false,
167
- configurable: true,
168
- writable: true,
169
- value: null,
170
- });
171
-
172
- Object.defineProperty(this, "seed", {
173
- enumerable: false,
174
- get: () => this._seed,
175
- });
176
- }
177
-
178
- toJSON() {
179
- return { address: this.address };
180
- }
181
-
182
- async getAddress() {
183
- return this.address;
184
- }
185
-
186
- /**
187
- * Sign a transaction using quantum-coin-js-sdk signRawTransaction().
188
- * @param {import("../providers/provider").TransactionRequest} tx
189
- * @returns {Promise<string>}
190
- */
191
- async signTransaction(tx) {
192
- const { raw } = await this._signDetailed(tx);
193
- return raw;
194
- }
195
-
196
- /**
197
- * Internal: sign a transaction and return both the raw serialized transaction
198
- * and the signer-computed transaction hash. The hash is later used to
199
- * verify that an untrusted RPC node broadcast exactly the transaction we
200
- * signed rather than substituting a different one.
201
- * @param {import("../providers/provider").TransactionRequest} tx
202
- * @returns {Promise<{ raw: string, hash: string|null }>}
203
- */
204
- async _signDetailed(tx) {
205
- _requireInitialized();
206
- assertArgument(tx && typeof tx === "object", "invalid tx", "tx", tx);
207
-
208
- const toAddress = tx.to == null ? null : getAddress(tx.to);
209
- const valueInWei = tx.value == null ? 0n : _getBigInt(tx.value, "tx.value");
210
- const gasLimit = tx.gasLimit == null ? 21000 : _getNumber(tx.gasLimit, "tx.gasLimit");
211
-
212
- const data = tx.data == null ? null : normalizeHex(tx.data);
213
- const remarks = tx.remarks == null ? null : normalizeHex(tx.remarks);
214
-
215
- if (remarks != null) {
216
- assertArgument(isHexString(remarks), "remarks must be hex string", "remarks", remarks);
217
- const remarkBytes = hexToBytes(remarks);
218
- assertArgument(remarkBytes.length <= 32, "remarks too long (max 32 bytes)", "remarks", remarks);
219
- }
220
-
221
- // Nonce must be provided or resolved from provider.
222
- let nonce = tx.nonce;
223
- if (nonce == null) {
224
- if (!this.provider) throw makeError("missing provider to resolve nonce", "UNKNOWN_ERROR", { operation: "signTransaction" });
225
- // Prefer pending to avoid nonce collisions with in-flight transactions.
226
- try {
227
- nonce = await this.provider.getTransactionCount(this.address, "pending");
228
- } catch {
229
- nonce = await this.provider.getTransactionCount(this.address, "latest");
230
- }
231
- }
232
- assertArgument(Number.isInteger(nonce) && nonce >= 0, "invalid nonce", "nonce", nonce);
233
-
234
- // `chainId` remains accepted from the tx (e.g. via contract overrides). We
235
- // intentionally do NOT assert it against the
236
- // provider here because `chainId` in quantum-coin-js-sdk (qcsdk) defaults to
237
- // 123123 internally — an unset chainId resolves to that network default rather
238
- // than being left unbound. Cross-chain replay risk is therefore bounded by the
239
- // qcsdk default; explicit per-call chainId overrides are caller responsibility.
240
- const chainId = tx.chainId != null ? tx.chainId : (this.provider && this.provider.chainId != null ? this.provider.chainId : null);
241
- const signingContext = tx.signingContext ?? null;
242
-
243
- // chainId is mandatory for signing. Without it the signed transaction is
244
- // not bound to a network and can be replayed on a different chain. Online
245
- // flows resolve chainId from the connected provider; offline signing must
246
- // pass tx.chainId explicitly.
247
- let chainIdNum = null;
248
- try {
249
- chainIdNum = chainId == null ? null : _getNumber(chainId, "tx.chainId");
250
- } catch {
251
- chainIdNum = null;
252
- }
253
- assertArgument(
254
- chainIdNum != null && chainIdNum >= 0,
255
- "chainId is required for signing; pass tx.chainId or connect to a provider",
256
- "chainId",
257
- chainId,
258
- );
259
-
260
- /** @type {any} */
261
- const qcWallet =
262
- this._qcWallet ||
263
- new qcsdk.Wallet(
264
- this.address,
265
- _bytesToNumberArray(this.signingKey.privateKeyBytes),
266
- _bytesToNumberArray(this.signingKey.publicKeyBytes),
267
- );
268
-
269
- const req = new qcsdk.TransactionSigningRequest(
270
- qcWallet,
271
- toAddress,
272
- valueInWei,
273
- nonce,
274
- data,
275
- gasLimit,
276
- remarks,
277
- chainId,
278
- signingContext,
279
- );
280
- const signResult = qcsdk.signRawTransaction(req);
281
- // quantum-coin-js-sdk returns a SignResult object: { resultCode, txnHash, txnData }
282
- if (!signResult || typeof signResult !== "object") {
283
- throw makeError("signRawTransaction failed", "UNKNOWN_ERROR", {});
284
- }
285
- if (typeof signResult.resultCode === "number" && signResult.resultCode !== 0) {
286
- throw makeError("signRawTransaction failed", "UNKNOWN_ERROR", {
287
- resultCode: signResult.resultCode,
288
- hash: signResult.txnHash || null,
289
- });
290
- }
291
- const raw = signResult.txnData;
292
- if (typeof raw !== "string") throw makeError("signRawTransaction did not return txnData", "UNKNOWN_ERROR", {});
293
- let hash = null;
294
- if (typeof signResult.txnHash === "string" && signResult.txnHash.length > 0) {
295
- hash = normalizeHex(signResult.txnHash).toLowerCase();
296
- }
297
- return { raw: normalizeHex(raw), hash };
298
- }
299
-
300
- /**
301
- * Signs and sends a transaction.
302
- * @param {import("../providers/provider").TransactionRequest} tx
303
- * @returns {Promise<import("../providers/provider").TransactionResponse>}
304
- */
305
- async sendTransaction(tx) {
306
- if (!this.provider) throw makeError("missing provider", "UNKNOWN_ERROR", { operation: "sendTransaction" });
307
- const { raw, hash } = await this._signDetailed({ ...tx, from: this.address });
308
- // Tell the provider which hash we expect so it can reject a node that
309
- // broadcasts (or echoes back) a different transaction than the one we signed.
310
- return this.provider.sendTransaction(raw, hash ? { expectedHash: hash } : undefined);
311
- }
312
- }
313
-
314
- /**
315
- * Wallet - convenience methods around BaseWallet.
316
- */
317
- class Wallet extends BaseWallet {
318
- /**
319
- * @param {string|Uint8Array|SigningKey} key
320
- * @param {import("../providers/provider").AbstractProvider=} provider
321
- */
322
- constructor(key, provider) {
323
- _requireInitialized();
324
-
325
- let signingKey;
326
- let qcAddress;
327
-
328
- if (key instanceof SigningKey) {
329
- signingKey = key;
330
- // Compute address from public key
331
- const addr = qcsdk.addressFromPublicKey(_bytesToNumberArray(signingKey.publicKeyBytes));
332
- if (typeof addr !== "string") throw makeError("addressFromPublicKey failed", "UNKNOWN_ERROR", {});
333
- qcAddress = normalizeHex(addr);
334
- } else {
335
- const privBytes = typeof key === "string" ? hexToBytes(key) : arrayify(key);
336
- const pubHex = qcsdk.publicKeyFromPrivateKey(_bytesToNumberArray(privBytes));
337
- if (typeof pubHex !== "string") throw makeError("publicKeyFromPrivateKey failed", "UNKNOWN_ERROR", {});
338
- const pubBytes = hexToBytes(pubHex);
339
- const addr = qcsdk.addressFromPublicKey(_bytesToNumberArray(pubBytes));
340
- if (typeof addr !== "string") throw makeError("addressFromPublicKey failed", "UNKNOWN_ERROR", {});
341
- qcAddress = normalizeHex(addr);
342
- signingKey = new SigningKey(privBytes, pubBytes);
343
- }
344
-
345
- /** @type {any} */
346
- const qcWallet = new qcsdk.Wallet(
347
- qcAddress,
348
- _bytesToNumberArray(signingKey.privateKeyBytes),
349
- _bytesToNumberArray(signingKey.publicKeyBytes),
350
- );
351
-
352
- // Central choke point — every Wallet (createRandom/fromPhrase/fromSeed/
353
- // fromEncryptedJsonSync/fromKeys/connect all funnel through this constructor)
354
- // is verified for key-pair consistency before it can be used to sign.
355
- _assertKeyPairValid(signingKey.privateKeyBytes, signingKey.publicKeyBytes);
356
-
357
- super(signingKey, provider || null, { address: qcAddress }, qcWallet);
358
- }
359
-
360
- /**
361
- * Returns wallet address (sync).
362
- * @returns {string}
363
- */
364
- getAddress() {
365
- return this.address;
366
- }
367
-
368
- /**
369
- * Returns wallet balance.
370
- * @param {string=} blockTag
371
- * @returns {Promise<bigint>}
372
- */
373
- async getBalance(blockTag) {
374
- if (!this.provider) throw makeError("missing provider", "UNKNOWN_ERROR", { operation: "getBalance" });
375
- void blockTag;
376
- return this.provider.getBalance(this.address);
377
- }
378
-
379
- /**
380
- * Returns wallet nonce.
381
- * @param {string=} blockTag
382
- * @returns {Promise<number>}
383
- */
384
- async getTransactionCount(blockTag) {
385
- if (!this.provider) throw makeError("missing provider", "UNKNOWN_ERROR", { operation: "getTransactionCount" });
386
- return this.provider.getTransactionCount(this.address, blockTag);
387
- }
388
-
389
- /**
390
- * Encrypts and serializes this wallet to JSON.
391
- * @param {string|Uint8Array} password
392
- * @returns {string}
393
- */
394
- encryptSync(password) {
395
- _requireInitialized();
396
- if (this._seed != null) {
397
- return Wallet.encryptSeedSync(hexToBytes(this._seed), password);
398
- }
399
- // A Uint8Array password is decoded as UTF-8 with NFC normalization below.
400
- // For arbitrary (non-UTF-8) byte passwords this is
401
- // lossy — invalid sequences become U+FFFD — so a binary password may not
402
- // round-trip and the keystore could fail to reopen. This is intentionally left
403
- // as-is because the password->key mapping is part of the shared QuantumCoin
404
- // keystore format owned by qcsdk (and interoperable with the Desktop/Mobile/Web
405
- // /CLI wallets); changing it risks breaking existing keystores and cross-app
406
- // interop. Prefer string passphrases. (Fixing correctly requires a keystore-spec
407
- // decision, not a local change.)
408
- const pw = typeof password === "string"
409
- ? password.normalize("NFC")
410
- : Buffer.from(arrayify(password)).toString("utf8").normalize("NFC");
411
- assertSecretArgument(pw.length >= 12, "password must be at least 12 characters", "password");
412
- const json = qcsdk.serializeEncryptedWallet(this._qcWallet, pw);
413
- if (typeof json !== "string") throw makeError("serializeEncryptedWallet failed", "UNKNOWN_ERROR", {});
414
- return json;
415
- }
416
-
417
- /**
418
- * Encrypts raw seed bytes into a wallet JSON string (version 5 pre-expansion format).
419
- * The resulting JSON can be opened with `Wallet.fromEncryptedJsonSync()` or
420
- * Desktop/Mobile/Web/CLI wallet applications.
421
- * @param {number[]|Uint8Array} seed Raw seed bytes: 64 (keyType 3), 72 (keyType 5), or 96 (legacy)
422
- * @param {string|Uint8Array} password Passphrase (at least 12 characters)
423
- * @returns {string}
424
- */
425
- static encryptSeedSync(seed, password) {
426
- _requireInitialized();
427
- const seedArr = seed instanceof Uint8Array ? Array.from(seed) : seed;
428
- assertArgument(Array.isArray(seedArr), "seed must be an array of numbers or Uint8Array", "seed", seed);
429
- const allowedLengths = [64, 72, 96];
430
- assertArgument(allowedLengths.includes(seedArr.length), "seed must be 64, 72, or 96 bytes", "seed", seedArr.length);
431
- // See encryptSync — a Uint8Array password is decoded as UTF-8/NFC, which is
432
- // lossy for arbitrary byte passwords. Left as-is
433
- // because the password->key mapping is part of the shared qcsdk keystore format
434
- // (cross-app interop); prefer string passphrases.
435
- const pw = typeof password === "string"
436
- ? password.normalize("NFC")
437
- : Buffer.from(arrayify(password)).toString("utf8").normalize("NFC");
438
- assertSecretArgument(pw.length >= 12, "password must be at least 12 characters", "password");
439
- const json = qcsdk.serializeSeedAsEncryptedWallet(seedArr, pw);
440
- if (typeof json !== "string") throw makeError("serializeSeedAsEncryptedWallet failed", "UNKNOWN_ERROR", {});
441
- return json;
442
- }
443
-
444
- /**
445
- * Returns the seed phrase (list of words) if this wallet has a seed, else null.
446
- * Derived from the stored pre-expansion seed via seed-words.getWordListFromSeedArray.
447
- *
448
- * Non-null for wallets created via createRandom, fromPhrase, fromSeed, and
449
- * fromEncryptedJsonSync when the JSON is a version-5 keystore produced by
450
- * encryptSync on a seed-bearing wallet or by encryptSeedSync.
451
- * Null for fromKeys and for v3/v4 keystores without preExpansionSeed.
452
- *
453
- * @returns {string[]|null}
454
- */
455
- getPhrase() {
456
- _requireInitialized();
457
- if (this._seed == null) return null;
458
- const bytes = Array.from(hexToBytes(this._seed));
459
- const words = seedWords.getWordListFromSeedArray(bytes);
460
- return Array.isArray(words) ? words : null;
461
- }
462
-
463
- /**
464
- * Returns the recommended signing context for this wallet.
465
- * Setting fullSign to true may incur additional gas cost.
466
- * @param {boolean|null=} fullSign Defaults to false when null or omitted.
467
- * @returns {number}
468
- */
469
- getSigningContext(fullSign) {
470
- const fs = fullSign ?? false;
471
- const pubLen = this.signingKey.publicKeyBytes.length;
472
- if (pubLen === 1408) {
473
- return fs ? 2 : 0;
474
- }
475
- if (pubLen === 2688) {
476
- return 1;
477
- }
478
- throw makeError("unsupported public key size", "UNSUPPORTED_OPERATION", { publicKeyLength: pubLen });
479
- }
480
-
481
- /**
482
- * Returns a new wallet connected to a provider.
483
- * @param {import("../providers/provider").AbstractProvider} provider
484
- * @returns {Wallet}
485
- */
486
- connect(provider) {
487
- const w = new Wallet(this.signingKey, provider);
488
- w._qcWallet = this._qcWallet;
489
- w._seed = this._seed;
490
- return w;
491
- }
492
-
493
- /**
494
- * Creates a new random wallet.
495
- * @param {import("../providers/provider").AbstractProvider=} provider
496
- * @param {number|null=} keyType Optional key type: null (default=3), 3, or 5
497
- * @returns {Wallet}
498
- */
499
- static createRandom(provider, keyType) {
500
- _requireInitialized();
501
- if (keyType != null) {
502
- assertArgument(keyType === 3 || keyType === 5, "keyType must be null, 3, or 5", "keyType", keyType);
503
- }
504
- const words = qcsdk.newWalletSeedWords(keyType ?? null);
505
- if (!words || !Array.isArray(words)) {
506
- throw makeError("newWalletSeedWords failed", "UNKNOWN_ERROR", { result: words });
507
- }
508
- return Wallet.fromPhrase(words, provider);
509
- }
510
-
511
- /**
512
- * Creates a wallet from raw seed bytes.
513
- * @param {number[]} seed Raw seed bytes: 64 (keyType 3), 72 (keyType 5), or 96 (legacy)
514
- * @param {import("../providers/provider").AbstractProvider=} provider
515
- * @returns {Wallet}
516
- */
517
- static fromSeed(seed, provider) {
518
- _requireInitialized();
519
- assertArgument(Array.isArray(seed), "seed must be an array of numbers", "seed", seed);
520
- const allowedLengths = [64, 72, 96];
521
- assertArgument(allowedLengths.includes(seed.length), "seed must be 64, 72, or 96 bytes", "seed", seed.length);
522
- const qcWallet = qcsdk.openWalletFromSeed(seed);
523
- if (!qcWallet || typeof qcWallet === "number") {
524
- throw makeError("openWalletFromSeed failed", "UNKNOWN_ERROR", { result: qcWallet });
525
- }
526
- return Wallet._fromQcWallet(qcWallet, provider || null);
527
- }
528
-
529
- /**
530
- * Creates a wallet from an encrypted JSON string.
531
- * @param {string} json
532
- * @param {string} password
533
- * @param {import("../providers/provider").AbstractProvider=} provider
534
- * @returns {Wallet}
535
- */
536
- static fromEncryptedJsonSync(json, password, provider) {
537
- _requireInitialized();
538
- const qcWallet = qcsdk.deserializeEncryptedWallet(json, password);
539
- if (!qcWallet) throw makeError("deserializeEncryptedWallet failed", "UNKNOWN_ERROR", {});
540
- return Wallet._fromQcWallet(qcWallet, provider || null);
541
- }
542
-
543
- /**
544
- * Creates a wallet from a seed phrase (32, 36, or 48 words).
545
- * @param {string|string[]} phrase
546
- * @param {import("../providers/provider").AbstractProvider=} provider
547
- * @returns {Wallet}
548
- */
549
- static fromPhrase(phrase, provider) {
550
- _requireInitialized();
551
- let words = phrase;
552
- if (typeof phrase === "string") {
553
- words = phrase
554
- .split(/[,\s]+/g)
555
- .map((w) => w.trim())
556
- .filter(Boolean);
557
- }
558
- assertArgument(Array.isArray(words), "phrase must be a string or string[]", "phrase", phrase);
559
- const allowedLengths = [32, 36, 48];
560
- assertArgument(
561
- allowedLengths.includes(words.length),
562
- "seed phrase must contain 32, 36, or 48 words",
563
- "phrase",
564
- words.length,
565
- );
566
- const qcWallet = qcsdk.openWalletFromSeedWords(words);
567
- if (!qcWallet) throw makeError("openWalletFromSeedWords failed", "UNKNOWN_ERROR", {});
568
- return Wallet._fromQcWallet(qcWallet, provider || null);
569
- }
570
-
571
- /**
572
- * Creates a wallet from raw private and public key bytes.
573
- * @param {Uint8Array|string} privateKey Private key bytes or hex string
574
- * @param {Uint8Array|string} publicKey Public key bytes or hex string
575
- * @param {import("../providers/provider").AbstractProvider=} provider
576
- * @returns {Wallet}
577
- */
578
- static fromKeys(privateKey, publicKey, provider) {
579
- _requireInitialized();
580
- const privBytes = typeof privateKey === "string" ? hexToBytes(privateKey) : arrayify(privateKey);
581
- const pubBytes = typeof publicKey === "string" ? hexToBytes(publicKey) : arrayify(publicKey);
582
- assertSecretArgument(privBytes.length > 0, "privateKey must not be empty", "privateKey");
583
- assertSecretArgument(pubBytes.length > 0, "publicKey must not be empty", "publicKey");
584
-
585
- const privArr = _bytesToNumberArray(privBytes);
586
- const pubArr = _bytesToNumberArray(pubBytes);
587
- const addr = qcsdk.addressFromPublicKey(pubArr);
588
- if (typeof addr !== "string") throw makeError("addressFromPublicKey failed", "UNKNOWN_ERROR", {});
589
-
590
- const qcWallet = new qcsdk.Wallet(addr, privArr, pubArr);
591
- // Key-pair verification now happens centrally in the Wallet constructor
592
- // (reached via _fromQcWallet -> new Wallet). No redundant verify here.
593
- return Wallet._fromQcWallet(qcWallet, provider || null);
594
- }
595
-
596
- /**
597
- * Internal helper: build a Wallet from a quantum-coin-js-sdk Wallet object.
598
- * @param {any} qcWallet
599
- * @param {import("../providers/provider").AbstractProvider|null} provider
600
- * @returns {Wallet}
601
- */
602
- static _fromQcWallet(qcWallet, provider) {
603
- const privSrc = qcWallet.privateKey;
604
- const pubSrc = qcWallet.publicKey;
605
-
606
- if (!privSrc || (privSrc instanceof Uint8Array && privSrc.length === 0) || (Array.isArray(privSrc) && privSrc.length === 0)) {
607
- throw makeError("qcWallet.privateKey is empty or missing", "UNKNOWN_ERROR", {});
608
- }
609
- if (!pubSrc || (pubSrc instanceof Uint8Array && pubSrc.length === 0) || (Array.isArray(pubSrc) && pubSrc.length === 0)) {
610
- throw makeError("qcWallet.publicKey is empty or missing", "UNKNOWN_ERROR", {});
611
- }
612
-
613
- const privBytes =
614
- privSrc instanceof Uint8Array ? new Uint8Array(privSrc) : Uint8Array.from(Array.from(privSrc).map((n) => (Number(n) & 0xff)));
615
- const pubBytes =
616
- pubSrc instanceof Uint8Array ? new Uint8Array(pubSrc) : Uint8Array.from(Array.from(pubSrc).map((n) => (Number(n) & 0xff)));
617
- const key = new SigningKey(privBytes, pubBytes);
618
-
619
- const w = new Wallet(key, provider || null);
620
- // Ensure we keep the exact underlying qcWallet for operations like encrypt/signRawTransaction.
621
- w._qcWallet = qcWallet;
622
- if (typeof qcWallet.address === "string") {
623
- w.address = normalizeHex(qcWallet.address);
624
- }
625
- if (qcWallet.preExpansionSeed != null) {
626
- const seedSrc = qcWallet.preExpansionSeed;
627
- const seedBytes =
628
- seedSrc instanceof Uint8Array ? seedSrc : Uint8Array.from(Array.from(seedSrc).map((n) => (Number(n) & 0xff)));
629
- w._seed = bytesToHex(seedBytes);
630
- }
631
- return w;
632
- }
633
- }
634
-
635
- /**
636
- * NonceManager wrapper.
637
- */
638
- class NonceManager extends AbstractSigner {
639
- /**
640
- * @param {AbstractSigner} signer
641
- */
642
- constructor(signer) {
643
- super(signer.provider || null);
644
- this.signer = signer;
645
- this._nonce = null;
646
- }
647
-
648
- async getAddress() {
649
- return this.signer.getAddress();
650
- }
651
-
652
- async getTransactionCount(blockTag) {
653
- if (this._nonce != null) return this._nonce;
654
- if (!this.provider) throw makeError("missing provider", "UNKNOWN_ERROR", { operation: "getTransactionCount" });
655
- const address = await this.getAddress();
656
- this._nonce = await this.provider.getTransactionCount(address, blockTag);
657
- return this._nonce;
658
- }
659
-
660
- async sendTransaction(tx) {
661
- const nonce = await this.getTransactionCount("latest");
662
- const result = await this.signer.sendTransaction({ ...tx, nonce });
663
- this._nonce = nonce + 1;
664
- return result;
665
- }
666
-
667
- reset() {
668
- this._nonce = null;
669
- }
670
-
671
- increment() {
672
- if (this._nonce == null) this._nonce = 0;
673
- this._nonce++;
674
- }
675
- }
676
-
677
- /**
678
- * JsonRpcSigner placeholder (ethers-like).
679
- * This SDK encourages using Wallet directly for signing.
680
- */
681
- class JsonRpcSigner extends AbstractSigner {
682
- constructor(provider, address) {
683
- super(provider);
684
- this._address = address;
685
- }
686
- async getAddress() {
687
- return this._address;
688
- }
689
- }
690
-
691
- /**
692
- * VoidSigner (cannot sign, only provides address).
693
- */
694
- class VoidSigner extends AbstractSigner {
695
- constructor(address, provider) {
696
- super(provider || null);
697
- this._address = getAddress(address);
698
- }
699
- async getAddress() {
700
- return this._address;
701
- }
702
- }
703
-
704
- module.exports = {
705
- SigningKey,
706
- AbstractSigner,
707
- BaseWallet,
708
- Wallet,
709
- NonceManager,
710
- JsonRpcSigner,
711
- VoidSigner,
712
- };
713
-