quantumcoin 7.0.11 → 7.0.13

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 (324) hide show
  1. package/README-SDK.md +828 -807
  2. package/README.md +17 -0
  3. package/config.d.ts +50 -50
  4. package/examples/example-generated-sdk-js/README.md +65 -0
  5. package/examples/example-generated-sdk-js/examples/_test-wallet.js +17 -0
  6. package/examples/example-generated-sdk-js/examples/deploy.js +41 -0
  7. package/examples/example-generated-sdk-js/examples/events.js +36 -0
  8. package/examples/example-generated-sdk-js/examples/read-operations.js +46 -0
  9. package/examples/example-generated-sdk-js/examples/write-operations.js +44 -0
  10. package/examples/example-generated-sdk-js/index.d.ts +1 -0
  11. package/examples/example-generated-sdk-js/index.js +15 -0
  12. package/examples/example-generated-sdk-js/package-lock.json +59 -0
  13. package/examples/example-generated-sdk-js/package.json +22 -0
  14. package/examples/example-generated-sdk-js/src/SimpleERC20.d.ts +19 -0
  15. package/examples/example-generated-sdk-js/src/SimpleERC20.js +353 -0
  16. package/examples/example-generated-sdk-js/src/SimpleERC20__factory.d.ts +10 -0
  17. package/examples/example-generated-sdk-js/src/SimpleERC20__factory.js +29 -0
  18. package/examples/example-generated-sdk-js/src/index.d.ts +4 -0
  19. package/examples/example-generated-sdk-js/src/index.js +5 -0
  20. package/examples/example-generated-sdk-js/src/quantumcoin-shims.d.ts +23 -0
  21. package/examples/example-generated-sdk-js/src/types.d.ts +3 -0
  22. package/examples/example-generated-sdk-js/src/types.js +3 -0
  23. package/examples/example-generated-sdk-js/test/e2e/SimpleERC20.e2e.test.js +78 -0
  24. package/examples/example-generated-sdk-ts/README.md +65 -0
  25. package/examples/example-generated-sdk-ts/examples/_test-wallet.js +17 -0
  26. package/examples/example-generated-sdk-ts/examples/deploy.js +41 -0
  27. package/examples/example-generated-sdk-ts/examples/events.js +36 -0
  28. package/examples/example-generated-sdk-ts/examples/read-operations.js +46 -0
  29. package/examples/example-generated-sdk-ts/examples/write-operations.js +44 -0
  30. package/examples/example-generated-sdk-ts/index.d.ts +1 -0
  31. package/examples/example-generated-sdk-ts/index.js +15 -0
  32. package/examples/example-generated-sdk-ts/package-lock.json +59 -0
  33. package/examples/example-generated-sdk-ts/package.json +23 -0
  34. package/examples/example-generated-sdk-ts/src/SimpleERC20.ts +334 -0
  35. package/examples/example-generated-sdk-ts/src/SimpleERC20__factory.ts +28 -0
  36. package/examples/example-generated-sdk-ts/src/index.ts +4 -0
  37. package/examples/example-generated-sdk-ts/src/quantumcoin-shims.d.ts +23 -0
  38. package/examples/example-generated-sdk-ts/src/types.ts +4 -0
  39. package/examples/example-generated-sdk-ts/test/e2e/SimpleERC20.e2e.test.js +78 -0
  40. package/examples/example-generated-sdk-ts/tsconfig.json +14 -0
  41. package/examples/package-lock.json +1 -1
  42. package/examples/sdk-generator-erc20.inline.json +251 -251
  43. package/generate-sdk.js +1825 -1823
  44. package/package.json +1 -1
  45. package/src/abi/fragments.d.ts +42 -42
  46. package/src/abi/index.d.ts +13 -13
  47. package/src/contract/index.d.ts +9 -9
  48. package/src/errors/index.d.ts +92 -92
  49. package/src/generator/index.d.ts +11 -4
  50. package/src/generator/index.js +33 -5
  51. package/src/internal/hex.d.ts +68 -61
  52. package/src/internal/hex.js +36 -0
  53. package/src/providers/json-rpc-provider.d.ts +12 -12
  54. package/src/providers/provider.js +3 -3
  55. package/src/utils/address.d.ts +58 -58
  56. package/src/utils/encoding.d.ts +120 -120
  57. package/src/utils/hashing.js +298 -298
  58. package/src/utils/index.d.ts +63 -63
  59. package/src/utils/index.js +14 -14
  60. package/src/utils/result.d.ts +57 -57
  61. package/src/utils/rlp.d.ts +12 -12
  62. package/src/utils/units.d.ts +29 -29
  63. package/src/wallet/index.d.ts +10 -10
  64. package/src/wallet/wallet.d.ts +192 -187
  65. package/src/wallet/wallet.js +630 -610
  66. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/README.md +83 -0
  67. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/artifacts/AllSolidityTypes.abi.json +12544 -0
  68. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/artifacts/AllSolidityTypes.bin +1 -0
  69. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/_test-wallet.js +17 -0
  70. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/_test-wallet.ts +10 -0
  71. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/deploy.js +41 -0
  72. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/deploy.ts +41 -0
  73. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/events.js +36 -0
  74. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/events.ts +36 -0
  75. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/offline-signing.js +82 -0
  76. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/offline-signing.ts +80 -0
  77. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/read-operations.js +46 -0
  78. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/read-operations.ts +44 -0
  79. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/write-operations.js +44 -0
  80. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/write-operations.ts +44 -0
  81. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/index.d.ts +1 -0
  82. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/index.js +21 -0
  83. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/package-lock.json +597 -0
  84. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/package.json +25 -0
  85. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes.d.ts +1280 -0
  86. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes.js +14021 -0
  87. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes__factory.d.ts +11 -0
  88. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes__factory.js +29 -0
  89. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/index.d.ts +4 -0
  90. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/index.js +5 -0
  91. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/quantumcoin-shims.d.ts +25 -0
  92. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/types.d.ts +3 -0
  93. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/types.js +3 -0
  94. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/test/e2e/AllSolidityTypes.e2e.test.js +77 -0
  95. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/test/e2e/AllSolidityTypes.extra.test.js +195 -0
  96. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/README.md +83 -0
  97. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/artifacts/AllSolidityTypes.abi.json +12544 -0
  98. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/artifacts/AllSolidityTypes.bin +1 -0
  99. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/_test-wallet.js +17 -0
  100. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/_test-wallet.ts +10 -0
  101. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/deploy.js +41 -0
  102. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/deploy.ts +41 -0
  103. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/events.js +36 -0
  104. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/events.ts +36 -0
  105. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/offline-signing.js +82 -0
  106. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/offline-signing.ts +80 -0
  107. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/read-operations.js +46 -0
  108. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/read-operations.ts +44 -0
  109. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/write-operations.js +44 -0
  110. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/write-operations.ts +44 -0
  111. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/index.d.ts +1 -0
  112. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/index.js +21 -0
  113. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/package-lock.json +597 -0
  114. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/package.json +26 -0
  115. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/AllSolidityTypes.ts +13940 -0
  116. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/AllSolidityTypes__factory.ts +29 -0
  117. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/index.ts +4 -0
  118. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/quantumcoin-shims.d.ts +25 -0
  119. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/types.ts +4 -0
  120. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/test/e2e/AllSolidityTypes.e2e.test.js +77 -0
  121. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/test/e2e/AllSolidityTypes.extra.test.js +195 -0
  122. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/tsconfig.json +18 -0
  123. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/README.md +74 -0
  124. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/artifacts/SimpleERC20.abi.json +245 -0
  125. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/artifacts/SimpleERC20.bin +1 -0
  126. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/_test-wallet.js +17 -0
  127. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/_test-wallet.ts +10 -0
  128. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/deploy.js +41 -0
  129. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/deploy.ts +41 -0
  130. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/events.js +36 -0
  131. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/events.ts +36 -0
  132. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/offline-signing.js +82 -0
  133. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/offline-signing.ts +80 -0
  134. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/read-operations.js +46 -0
  135. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/read-operations.ts +44 -0
  136. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/write-operations.js +44 -0
  137. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/write-operations.ts +44 -0
  138. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/index.d.ts +1 -0
  139. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/index.js +16 -0
  140. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/package-lock.json +597 -0
  141. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/package.json +25 -0
  142. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20.d.ts +24 -0
  143. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20.js +372 -0
  144. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20__factory.d.ts +10 -0
  145. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20__factory.js +29 -0
  146. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/index.d.ts +4 -0
  147. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/index.js +5 -0
  148. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/quantumcoin-shims.d.ts +25 -0
  149. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/types.d.ts +3 -0
  150. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/types.js +3 -0
  151. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/test/e2e/SimpleERC20.e2e.test.js +90 -0
  152. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/README.md +74 -0
  153. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/artifacts/SimpleERC20.abi.json +245 -0
  154. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/artifacts/SimpleERC20.bin +1 -0
  155. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/_test-wallet.js +17 -0
  156. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/_test-wallet.ts +10 -0
  157. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/deploy.js +41 -0
  158. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/deploy.ts +41 -0
  159. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/events.js +36 -0
  160. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/events.ts +36 -0
  161. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/offline-signing.js +82 -0
  162. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/offline-signing.ts +80 -0
  163. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/read-operations.js +46 -0
  164. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/read-operations.ts +44 -0
  165. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/write-operations.js +44 -0
  166. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/write-operations.ts +44 -0
  167. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/index.d.ts +1 -0
  168. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/index.js +16 -0
  169. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/package-lock.json +597 -0
  170. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/package.json +26 -0
  171. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/SimpleERC20.ts +355 -0
  172. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/SimpleERC20__factory.ts +28 -0
  173. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/index.ts +4 -0
  174. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/quantumcoin-shims.d.ts +25 -0
  175. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/types.ts +4 -0
  176. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/test/e2e/SimpleERC20.e2e.test.js +90 -0
  177. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/tsconfig.json +18 -0
  178. package/test/e2e/generator-interface.e2e.test.js +163 -0
  179. package/test/e2e/generator-interface.e2e.test.ts +158 -0
  180. package/test/e2e/signing-context-and-fee.e2e.test.js +141 -141
  181. package/test/e2e/signing-context-and-fee.e2e.test.ts +128 -128
  182. package/test/integration/provider.test.js +88 -88
  183. package/test/unit/address-wallet.test.js +892 -751
  184. package/test/unit/address-wallet.test.ts +877 -736
  185. package/test/unit/generator.test.js +48 -1
  186. package/test/unit/generator.test.ts +48 -1
  187. package/test/unit/hashing.test.js +64 -64
  188. package/test/unit/hashing.test.ts +63 -63
  189. package/test/unit/internal-hex.test.js +32 -1
  190. package/test/unit/internal-hex.test.ts +32 -1
  191. package/test/unit/providers.test.js +51 -1
  192. package/test/unit/providers.test.ts +53 -0
  193. package/SPEC.md +0 -3784
  194. package/examples/node_modules/.bin/esbuild +0 -16
  195. package/examples/node_modules/.bin/esbuild.cmd +0 -17
  196. package/examples/node_modules/.bin/esbuild.ps1 +0 -28
  197. package/examples/node_modules/.bin/sdkgen +0 -16
  198. package/examples/node_modules/.bin/sdkgen.cmd +0 -17
  199. package/examples/node_modules/.bin/sdkgen.ps1 +0 -28
  200. package/examples/node_modules/.bin/tsx +0 -16
  201. package/examples/node_modules/.bin/tsx.cmd +0 -17
  202. package/examples/node_modules/.bin/tsx.ps1 +0 -28
  203. package/examples/node_modules/.package-lock.json +0 -235
  204. package/examples/node_modules/@esbuild/win32-x64/README.md +0 -3
  205. package/examples/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
  206. package/examples/node_modules/@esbuild/win32-x64/package.json +0 -20
  207. package/examples/node_modules/esbuild/LICENSE.md +0 -21
  208. package/examples/node_modules/esbuild/README.md +0 -3
  209. package/examples/node_modules/esbuild/bin/esbuild +0 -223
  210. package/examples/node_modules/esbuild/install.js +0 -289
  211. package/examples/node_modules/esbuild/lib/main.d.ts +0 -716
  212. package/examples/node_modules/esbuild/lib/main.js +0 -2532
  213. package/examples/node_modules/esbuild/package.json +0 -49
  214. package/examples/node_modules/get-tsconfig/LICENSE +0 -21
  215. package/examples/node_modules/get-tsconfig/README.md +0 -235
  216. package/examples/node_modules/get-tsconfig/dist/index.cjs +0 -7
  217. package/examples/node_modules/get-tsconfig/dist/index.d.cts +0 -2088
  218. package/examples/node_modules/get-tsconfig/dist/index.d.mts +0 -2088
  219. package/examples/node_modules/get-tsconfig/dist/index.mjs +0 -7
  220. package/examples/node_modules/get-tsconfig/package.json +0 -46
  221. package/examples/node_modules/quantum-coin-js-sdk/.github/workflows/publish-npmjs.yaml +0 -22
  222. package/examples/node_modules/quantum-coin-js-sdk/LICENSE +0 -21
  223. package/examples/node_modules/quantum-coin-js-sdk/LICENSE-wasm_exec.js.txt +0 -30
  224. package/examples/node_modules/quantum-coin-js-sdk/README.md +0 -1665
  225. package/examples/node_modules/quantum-coin-js-sdk/example/README.md +0 -14
  226. package/examples/node_modules/quantum-coin-js-sdk/example/conversion-example.js +0 -19
  227. package/examples/node_modules/quantum-coin-js-sdk/example/example-create-contract.js +0 -396
  228. package/examples/node_modules/quantum-coin-js-sdk/example/example-encode-decode-rlp.js +0 -225
  229. package/examples/node_modules/quantum-coin-js-sdk/example/example-event-pack-unpack.js +0 -391
  230. package/examples/node_modules/quantum-coin-js-sdk/example/example-misc.js +0 -101
  231. package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send-signRawTransaction.js +0 -318
  232. package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send.js +0 -116
  233. package/examples/node_modules/quantum-coin-js-sdk/example/example-send.js +0 -70
  234. package/examples/node_modules/quantum-coin-js-sdk/example/example-token-pack-unpack.js +0 -961
  235. package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet-version4.js +0 -35
  236. package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet.js +0 -43
  237. package/examples/node_modules/quantum-coin-js-sdk/example/example.js +0 -405
  238. package/examples/node_modules/quantum-coin-js-sdk/example/package-lock.json +0 -134
  239. package/examples/node_modules/quantum-coin-js-sdk/example/package.json +0 -15
  240. package/examples/node_modules/quantum-coin-js-sdk/index.d.ts +0 -1024
  241. package/examples/node_modules/quantum-coin-js-sdk/index.js +0 -3062
  242. package/examples/node_modules/quantum-coin-js-sdk/package.json +0 -34
  243. package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-32.json +0 -1
  244. package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-36.json +0 -1
  245. package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-48.json +0 -1
  246. package/examples/node_modules/quantum-coin-js-sdk/tests/generate-verify-vectors.js +0 -91
  247. package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.preinit.test.js +0 -41
  248. package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.test.js +0 -686
  249. package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-keytype5-context-null.test.js +0 -107
  250. package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-transaction.test.js +0 -196
  251. package/examples/node_modules/quantum-coin-js-sdk/tests/sign-verify.test.js +0 -311
  252. package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.relay.test.js +0 -131
  253. package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.rpc.test.js +0 -103
  254. package/examples/node_modules/quantum-coin-js-sdk/tests/verify-vectors.json +0 -95035
  255. package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.d.ts +0 -9
  256. package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.js +0 -16
  257. package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.d.ts +0 -0
  258. package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.js +0 -587
  259. package/examples/node_modules/resolve-pkg-maps/LICENSE +0 -21
  260. package/examples/node_modules/resolve-pkg-maps/README.md +0 -216
  261. package/examples/node_modules/resolve-pkg-maps/dist/index.cjs +0 -1
  262. package/examples/node_modules/resolve-pkg-maps/dist/index.d.cts +0 -11
  263. package/examples/node_modules/resolve-pkg-maps/dist/index.d.mts +0 -11
  264. package/examples/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
  265. package/examples/node_modules/resolve-pkg-maps/package.json +0 -42
  266. package/examples/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +0 -22
  267. package/examples/node_modules/seed-words/BUILD.md +0 -7
  268. package/examples/node_modules/seed-words/LICENSE +0 -121
  269. package/examples/node_modules/seed-words/README.md +0 -67
  270. package/examples/node_modules/seed-words/dist/seedwords.d.ts +0 -39
  271. package/examples/node_modules/seed-words/package.json +0 -27
  272. package/examples/node_modules/seed-words/seedwords.js +0 -315
  273. package/examples/node_modules/seed-words/seedwords.txt +0 -65536
  274. package/examples/node_modules/seed-words/tsconfig.json +0 -21
  275. package/examples/node_modules/tsx/LICENSE +0 -21
  276. package/examples/node_modules/tsx/README.md +0 -32
  277. package/examples/node_modules/tsx/dist/cjs/api/index.cjs +0 -1
  278. package/examples/node_modules/tsx/dist/cjs/api/index.d.cts +0 -35
  279. package/examples/node_modules/tsx/dist/cjs/api/index.d.mts +0 -35
  280. package/examples/node_modules/tsx/dist/cjs/api/index.mjs +0 -1
  281. package/examples/node_modules/tsx/dist/cjs/index.cjs +0 -1
  282. package/examples/node_modules/tsx/dist/cjs/index.mjs +0 -1
  283. package/examples/node_modules/tsx/dist/cli.cjs +0 -54
  284. package/examples/node_modules/tsx/dist/cli.mjs +0 -55
  285. package/examples/node_modules/tsx/dist/client-BQVF1NaW.mjs +0 -1
  286. package/examples/node_modules/tsx/dist/client-D6NvIMSC.cjs +0 -1
  287. package/examples/node_modules/tsx/dist/esm/api/index.cjs +0 -1
  288. package/examples/node_modules/tsx/dist/esm/api/index.d.cts +0 -35
  289. package/examples/node_modules/tsx/dist/esm/api/index.d.mts +0 -35
  290. package/examples/node_modules/tsx/dist/esm/api/index.mjs +0 -1
  291. package/examples/node_modules/tsx/dist/esm/index.cjs +0 -2
  292. package/examples/node_modules/tsx/dist/esm/index.mjs +0 -2
  293. package/examples/node_modules/tsx/dist/get-pipe-path-BHW2eJdv.mjs +0 -1
  294. package/examples/node_modules/tsx/dist/get-pipe-path-BoR10qr8.cjs +0 -1
  295. package/examples/node_modules/tsx/dist/index-7AaEi15b.mjs +0 -14
  296. package/examples/node_modules/tsx/dist/index-BWFBUo6r.cjs +0 -1
  297. package/examples/node_modules/tsx/dist/index-gbaejti9.mjs +0 -1
  298. package/examples/node_modules/tsx/dist/index-gckBtVBf.cjs +0 -14
  299. package/examples/node_modules/tsx/dist/lexer-DQCqS3nf.mjs +0 -3
  300. package/examples/node_modules/tsx/dist/lexer-DgIbo0BU.cjs +0 -3
  301. package/examples/node_modules/tsx/dist/loader.cjs +0 -1
  302. package/examples/node_modules/tsx/dist/loader.mjs +0 -1
  303. package/examples/node_modules/tsx/dist/node-features-_8ZFwP_x.mjs +0 -1
  304. package/examples/node_modules/tsx/dist/node-features-roYmp9jK.cjs +0 -1
  305. package/examples/node_modules/tsx/dist/package-CeBgXWuR.mjs +0 -1
  306. package/examples/node_modules/tsx/dist/package-Dxt5kIHw.cjs +0 -1
  307. package/examples/node_modules/tsx/dist/patch-repl.cjs +0 -1
  308. package/examples/node_modules/tsx/dist/patch-repl.mjs +0 -1
  309. package/examples/node_modules/tsx/dist/preflight.cjs +0 -1
  310. package/examples/node_modules/tsx/dist/preflight.mjs +0 -1
  311. package/examples/node_modules/tsx/dist/register-2sWVXuRQ.cjs +0 -1
  312. package/examples/node_modules/tsx/dist/register-B7jrtLTO.mjs +0 -1
  313. package/examples/node_modules/tsx/dist/register-CFH5oNdT.mjs +0 -4
  314. package/examples/node_modules/tsx/dist/register-D46fvsV_.cjs +0 -4
  315. package/examples/node_modules/tsx/dist/repl.cjs +0 -3
  316. package/examples/node_modules/tsx/dist/repl.mjs +0 -3
  317. package/examples/node_modules/tsx/dist/require-D4F1Lv60.cjs +0 -1
  318. package/examples/node_modules/tsx/dist/require-DQxpCAr4.mjs +0 -1
  319. package/examples/node_modules/tsx/dist/suppress-warnings.cjs +0 -1
  320. package/examples/node_modules/tsx/dist/suppress-warnings.mjs +0 -1
  321. package/examples/node_modules/tsx/dist/temporary-directory-B83uKxJF.cjs +0 -1
  322. package/examples/node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs +0 -1
  323. package/examples/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +0 -5
  324. package/examples/node_modules/tsx/package.json +0 -68
package/README-SDK.md CHANGED
@@ -1,807 +1,828 @@
1
- > **CAUTION:** This is an experimental SDK. Use at your own risk.
2
-
3
- # QuantumCoin.js — Comprehensive SDK Documentation
4
-
5
- This document is the **complete, detailed SDK reference** for QuantumCoin.js (ethers.js v6-compatible surface), including **every exported class/function**, their **parameters**, and links to **examples** and **tests** in this repository.
6
-
7
- > Reminder: QuantumCoin.js requires calling `Initialize()` before using features that depend on `quantum-coin-js-sdk` (address validation, ABI encoding/decoding, signing, etc.).
8
-
9
- ## Table of Contents
10
-
11
- - [Getting started](#getting-started)
12
- - [Install](#install)
13
- - [Initialization (required)](#initialization-required)
14
- - [Key differences vs ethers/Ethereum](#key-differences-vs-ethersethereum)
15
- - [Configuration (`quantumcoin/config`)](#configuration-quantumcoinconfig)
16
- - [`Config`](#config)
17
- - [`Initialize(config)`](#initializeconfig)
18
- - [`isInitialized()`](#isinitialized)
19
- - [`getConfig()`](#getconfig)
20
- - [Constants](#constants)
21
- - [Errors](#errors)
22
- - [`makeError`, `assert`, `assertArgument`, `isError`, `isCallException`](#makeerror-assert-assertargument-iserror-iscallexception)
23
- - [`ProviderError`, `TransactionError`, `ContractError`](#providererror-transactionerror-contracterror)
24
- - [Providers](#providers)
25
- - [`Provider`](#provider)
26
- - [`AbstractProvider`](#abstractprovider)
27
- - [`JsonRpcProvider` / `JsonRpcApiProvider`](#jsonrpcprovider--jsonrpcapiprovider)
28
- - [`WebSocketProvider`](#websocketprovider)
29
- - [`IpcSocketProvider`](#ipcsocketprovider)
30
- - [`BrowserProvider`](#browserprovider)
31
- - [`FallbackProvider`](#fallbackprovider)
32
- - [`FilterByBlockHash`](#filterbyblockhash)
33
- - [`Block`](#block)
34
- - [`TransactionResponse`](#transactionresponse)
35
- - [`TransactionReceipt`](#transactionreceipt)
36
- - [`Log`](#log)
37
- - [Wallets & Signers](#wallets--signers)
38
- - [`SigningKey`](#signingkey)
39
- - [`AbstractSigner`](#abstractsigner)
40
- - [`BaseWallet`](#basewallet)
41
- - [`Wallet`](#wallet)
42
- - [`NonceManager`](#noncemanager)
43
- - [`JsonRpcSigner`](#jsonrpcsigner)
44
- - [`VoidSigner`](#voidsigner)
45
- - [Contracts](#contracts)
46
- - [`Contract`](#contract)
47
- - [`ContractFactory`](#contractfactory)
48
- - [`ContractTransactionResponse`](#contracttransactionresponse)
49
- - [`ContractTransactionReceipt`](#contracttransactionreceipt)
50
- - [`EventLog`](#eventlog)
51
- - [ABI](#abi)
52
- - [Fragments (`Fragment`, `FunctionFragment`, ...)](#fragments-fragment-functionfragment-)
53
- - [`Interface`](#interface)
54
- - [`AbiCoder`](#abicoder)
55
- - [Utilities](#utilities)
56
- - [Address utilities](#address-utilities)
57
- - [Encoding utilities](#encoding-utilities)
58
- - [Hashing utilities](#hashing-utilities)
59
- - [Units](#units)
60
- - [RLP](#rlp)
61
- - [`Result` and `checkResultErrors`](#result-and-checkresulterrors)
62
- - [Typed SDK Generator (`generate-sdk.js`)](#typed-sdk-generator-generate-sdkjs)
63
- - [Overview](#overview)
64
- - [Input modes](#input-modes)
65
- - [Package scaffolding mode](#package-scaffolding-mode)
66
- - [Generated package layout](#generated-package-layout)
67
- - [Running generated transactional tests](#running-generated-transactional-tests)
68
- - [Generator tests](#generator-tests)
69
-
70
- ## Getting started
71
-
72
- ### Install
73
-
74
- ```bash
75
- npm install quantumcoin
76
- ```
77
-
78
- ### Initialization (required)
79
-
80
- ```js
81
- const { Initialize } = require("quantumcoin/config");
82
-
83
- // Initialize with defaults (chainId=123123 and default RPC endpoint)
84
- await Initialize(null);
85
- ```
86
-
87
- If you need to override the RPC endpoint used by `JsonRpcProvider` defaults:
88
-
89
- ```js
90
- const { Config, Initialize } = require("quantumcoin/config");
91
- await Initialize(new Config(123123, "https://public.rpc.quantumcoinapi.com"));
92
- ```
93
-
94
- **Example(s):**
95
- - `examples/example.js`
96
-
97
- ### Key differences vs ethers/Ethereum
98
-
99
- - **Addresses are 32 bytes** (66 hex chars including `0x`)
100
- - **Signing and ABI encoding/decoding** are delegated to `quantum-coin-js-sdk` (WASM)
101
- - **Initialize must be called** once at startup for wallet/address/ABI helpers
102
-
103
- ## Configuration (`quantumcoin/config`)
104
-
105
- ### `Config`
106
-
107
- **Constructor**
108
-
109
- - `new Config(chainId?: number, rpcEndpoint?: string)`
110
- - **chainId**: defaults to `123123`
111
- - **rpcEndpoint**: defaults to `https://public.rpc.quantumcoinapi.com`
112
-
113
- ### `Initialize(config)`
114
-
115
- - `Initialize(config: Config | null | undefined): Promise<boolean>`
116
- - If `config` is `null` / `undefined`, defaults are used
117
- - Initializes `quantum-coin-js-sdk` internally (WASM + crypto)
118
-
119
- ### `isInitialized()`
120
-
121
- - `isInitialized(): boolean`
122
- - Returns true after `Initialize(...)` succeeds
123
-
124
- ### `getConfig()`
125
-
126
- - `getConfig(): Config | null`
127
- - Returns the active config (or `null` if not initialized)
128
-
129
- ## Constants
130
-
131
- Exported from `quantumcoin`:
132
-
133
- - `version: string`
134
- - `ZeroAddress: string` (32-byte zero address)
135
- - `ZeroHash: string` (32-byte zero hash)
136
- - `MaxUint256: bigint`
137
- - `MaxUint160: bigint`
138
- - `MinInt256: bigint`
139
- - `MaxInt256: bigint`
140
- - `NumericFault: string` (=`"NUMERIC_FAULT"`)
141
- - `NumericFaultCode: string` (=`"NUMERIC_FAULT"`)
142
- - `WeiPerEther: bigint` (=`1000000000000000000n`)
143
- - `EtherSymbol: string` (=`"Ξ"`)
144
- - `N: bigint` (compat placeholder)
145
-
146
- ## Errors
147
-
148
- ### `makeError`, `assert`, `assertArgument`, `isError`, `isCallException`
149
-
150
- - `makeError(message: string, code: ErrorCode, info?: object): Error & { code, shortMessage }`
151
- - `assert(check: any, message: string, code: ErrorCode, info?: object): void`
152
- - `assertArgument(check: any, message: string, name: string, value: any): void`
153
- - `isError(error: any, code: string): boolean`
154
- - `isCallException(error: any): boolean`
155
-
156
- **Notes**
157
- - Most SDK errors are `Error`/`TypeError` with `.code` and `.shortMessage` (ethers-like).
158
-
159
- ### `ProviderError`, `TransactionError`, `ContractError`
160
-
161
- - `new ProviderError(message: string, info?: object)`
162
- - `new TransactionError(message: string, info?: object)`
163
- - `new ContractError(message: string, info?: object)`
164
-
165
- ## Providers
166
-
167
- ### `Provider`
168
-
169
- Base class extending Node’s `EventEmitter`. Used primarily for API surface parity.
170
-
171
- ### `AbstractProvider`
172
-
173
- Base provider implementation. Subclasses implement `_perform`.
174
-
175
- **Core method**
176
- - `_perform(method: string, params?: any[]): Promise<any>` (**subclass responsibility**)
177
-
178
- **Read operations**
179
- - `getBlockNumber(): Promise<number>`
180
- - `getBlock(blockNumber: number | "latest"): Promise<Block>`
181
- - `getTransaction(txHash: string): Promise<TransactionResponse | null>`
182
- - `getTransactionReceipt(txHash: string): Promise<TransactionReceipt | null>`
183
- - `getBalance(address: string): Promise<bigint>`
184
- - `getTransactionCount(address: string, blockTag?: string | null): Promise<number>`
185
- - `call(tx: TransactionRequest, blockTag?: string | null): Promise<string>`
186
- - `estimateGas(tx: TransactionRequest): Promise<bigint>`
187
- - `getCode(address: string, blockTag?: string | null): Promise<string>`
188
- - `getStorageAt(address: string, position: bigint, blockTag?: string | null): Promise<string>`
189
- - `getLogs(filter: Filter | FilterByBlockHash): Promise<Log[]>`
190
-
191
- **Write operation**
192
- - `sendTransaction(tx: string | { raw: string }): Promise<TransactionResponse>`
193
- - QuantumCoin.js expects a **signed raw transaction hex string**.
194
-
195
- **Example(s):**
196
- - `examples/example.js`
197
- - `examples/read-operations.js`
198
- - `examples/events.js`
199
-
200
- ### `JsonRpcProvider` / `JsonRpcApiProvider`
201
-
202
- HTTP JSON-RPC provider.
203
-
204
- - `new JsonRpcProvider(url?: string, chainId?: number)`
205
- - If `url` is omitted, uses config default `rpcEndpoint`
206
- - If `chainId` is omitted, defaults to `123123`
207
-
208
- **Example(s):**
209
- - `examples/example.js`
210
-
211
- ### `WebSocketProvider`
212
-
213
- WebSocket JSON-RPC provider (no extra dependencies; uses Node’s global `WebSocket`).
214
-
215
- - `new WebSocketProvider(url: string, chainId?: number)`
216
- - `destroy(): void` (closes socket, rejects pending requests)
217
-
218
- **Test(s):**
219
- - `test/integration/ws-provider.test.js`
220
-
221
- ### `IpcSocketProvider`
222
-
223
- IPC JSON-RPC provider using Node’s `net`.
224
-
225
- - `new IpcSocketProvider(path: string)`
226
- - Windows example: `\\\\.\\pipe\\geth.ipc`
227
-
228
- **Test(s):**
229
- - `test/integration/ipc-provider.test.js`
230
-
231
- ### `BrowserProvider`
232
-
233
- EIP-1193 wrapper provider (for injected browser wallets).
234
-
235
- - `new BrowserProvider(eip1193Provider: { request: Function }, network?: any, options?: BrowserProviderOptions)`
236
- - `providerInfo` is supported as an option (compat)
237
-
238
- **Core methods**
239
- - `send(method: string, params?: any[] | object): Promise<any>`
240
- - `_send(payloadOrArray): Promise<any>` (compat)
241
- - `_perform(method: string, params?: any[]): Promise<any>` (delegates to `send`)
242
- - `getRpcError(payload, error): Error`
243
- - `getSigner(addressOrIndex?: string | number): Promise<JsonRpcSigner>`
244
- - `hasSigner(addressOrIndex: string | number): Promise<boolean>`
245
-
246
- **Debug event sink**
247
- - Emits `"debug"` events:
248
- - `{ action: "sendEip1193Payload", payload: { method, params } }`
249
- - `{ action: "receiveEip1193Result", result }`
250
- - `{ action: "receiveEip1193Error", error }`
251
-
252
- **Test(s):**
253
- - `test/unit/browser-provider.test.js`
254
-
255
- Reference: ethers BrowserProvider docs: [`https://docs.ethers.org/v6/api/providers/#BrowserProvider`](https://docs.ethers.org/v6/api/providers/#BrowserProvider)
256
-
257
- ### `FallbackProvider`
258
-
259
- Simple provider wrapper that tries multiple providers in order.
260
-
261
- - `new FallbackProvider(providers: AbstractProvider | AbstractProvider[])`
262
- - `_perform(method, params)` tries each provider until one succeeds
263
-
264
- ### `FilterByBlockHash`
265
-
266
- Helper for filters pinned to a specific block hash (ethers style).
267
-
268
- - `new FilterByBlockHash(blockHash: string, address?: string | string[], topics?: (string|string[]|null)[])`
269
- - `blockHash` must be **32-byte hex**
270
- - `toJSON()` returns `{ blockHash, address, topics }`
271
-
272
- **Test(s):**
273
- - `test/unit/filter-by-blockhash.test.js`
274
-
275
- Reference: ethers FilterByBlockHash docs: [`https://docs.ethers.org/v6/api/providers/#FilterByBlockHash`](https://docs.ethers.org/v6/api/providers/#FilterByBlockHash)
276
-
277
- ### `Block`
278
-
279
- Wrapper returned by `provider.getBlock(...)`.
280
-
281
- **Properties**
282
- - `hash: string | null`
283
- - `parentHash: string | null`
284
- - `number: number | null`
285
- - `timestamp: number | null`
286
- - `transactions: any[]`
287
- - `provider: AbstractProvider | null`
288
-
289
- **Methods**
290
- - `getTransaction(indexOrHash: number | string): Promise<TransactionResponse | null>`
291
- - `getTransactionReceipt(indexOrHash: number | string): Promise<TransactionReceipt | null>`
292
- - `getPrefetchedTransactions(): any[]` (currently returns `[]`)
293
-
294
- ### `TransactionResponse`
295
-
296
- Wrapper returned by `provider.sendTransaction(...)` and `provider.getTransaction(...)`.
297
-
298
- **Properties (common)**
299
- - `hash: string`
300
- - `to: string | null`
301
- - `from: string | null`
302
- - `nonce: number | null`
303
- - `data: string`
304
- - `value: bigint`
305
- - `gasLimit: bigint | null`
306
- - `chainId: number | null`
307
- - `blockNumber: number | null`
308
- - `txType: number | null` — Transaction type (e.g. `1` for a standard transfer)
309
- - `provider: AbstractProvider | null`
310
-
311
- **Methods**
312
- - `wait(confirmations?: number | null, timeoutMs?: number | null): Promise<TransactionReceipt>`
313
-
314
- ### `TransactionReceipt`
315
-
316
- Wrapper returned by `provider.getTransactionReceipt(...)` and `tx.wait()`.
317
-
318
- **Properties (common)**
319
- - `to: string | null`
320
- - `from: string | null`
321
- - `contractAddress: string | null`
322
- - `transactionHash: string`
323
- - `blockHash: string`
324
- - `blockNumber: number | null`
325
- - `transactionIndex: number | null`
326
- - `gasUsed: bigint | null`
327
- - `status: number | null`
328
- - `logs: Log[]`
329
- - `provider: AbstractProvider | null`
330
-
331
- ### `Log`
332
-
333
- Wrapper returned by `provider.getLogs(...)`.
334
-
335
- **Properties (common)**
336
- - `address: string`
337
- - `topics: string[]`
338
- - `data: string`
339
- - `blockHash: string | null`
340
- - `blockNumber: number | null`
341
- - `transactionHash: string | null`
342
- - `transactionIndex: number | null`
343
- - `logIndex: number | null`
344
- - `removed: boolean`
345
- - `provider: AbstractProvider | null`
346
-
347
- **Methods**
348
- - `getBlock(): Promise<Block | null>`
349
- - `getTransaction(): Promise<TransactionResponse | null>`
350
- - `getTransactionReceipt(): Promise<TransactionReceipt | null>`
351
-
352
- ## Wallets & Signers
353
-
354
- ### `SigningKey`
355
-
356
- - `new SigningKey(privateKeyBytes: Uint8Array, publicKeyBytes: Uint8Array)`
357
-
358
- ### `AbstractSigner`
359
-
360
- - `new AbstractSigner(provider?: AbstractProvider | null)`
361
- - `provider: AbstractProvider | null`
362
- - `getAddress(): Promise<string>` (base throws; implemented by subclasses)
363
-
364
- ### `BaseWallet`
365
-
366
- Core signing implementation.
367
-
368
- - `new BaseWallet(signingKey: SigningKey, provider?: AbstractProvider | null, precomputed?: { address: string }, qcWallet?: any)`
369
-
370
- **Properties**
371
- - `address: string`
372
- - `privateKey: string` (getter; hex string)
373
- - `provider: AbstractProvider | null`
374
-
375
- **Methods**
376
- - `getAddress(): Promise<string>`
377
- - `signTransaction(tx: TransactionRequest): Promise<string>`
378
- - `sendTransaction(tx: TransactionRequest): Promise<TransactionResponse>`
379
-
380
- ### `Wallet`
381
-
382
- User-facing wallet class.
383
-
384
- - `new Wallet(privateKeyOrBytesOrSigningKey, provider?: AbstractProvider)`
385
-
386
- **Static methods**
387
- - `Wallet.createRandom(provider?: AbstractProvider, keyType?: number | null): Wallet` — `keyType`: `null`/`3` (default, hybrid compact) or `5` (hybrid5)
388
- - `Wallet.fromSeed(seed: number[], provider?: AbstractProvider): Wallet` — opens wallet from raw seed bytes (64/72/96 length)
389
- - `Wallet.fromEncryptedJsonSync(json: string, password: string, provider?: AbstractProvider): Wallet`
390
- - `Wallet.fromPhrase(phrase: string | string[], provider?: AbstractProvider): Wallet`
391
- - `Wallet.fromKeys(privateKey: Uint8Array | string, publicKey: Uint8Array | string, provider?: AbstractProvider): Wallet`
392
- - `Wallet.encryptSeedSync(seed: number[] | Uint8Array, password: string | Uint8Array): string` — encrypts raw seed bytes (64/72/96) into a wallet JSON string (version 5 pre-expansion format). The resulting JSON can be opened with `fromEncryptedJsonSync()` or Desktop/Mobile/Web/CLI wallet applications. Password must be at least 12 characters.
393
-
394
- **Instance methods**
395
- - `getAddress(): string`
396
- - `getBalance(blockTag?: string): Promise<bigint>`
397
- - `getTransactionCount(blockTag?: string): Promise<number>`
398
- - `encryptSync(password: string | Uint8Array): string`
399
- - `connect(provider: AbstractProvider): Wallet`
400
- - `getSigningContext(fullSign?: boolean | null): number` — returns the recommended signing context for this wallet (based on public key type). Setting `fullSign` to `true` may incur additional gas cost.
401
-
402
- **Example(s):**
403
- - `examples/wallet-offline.js`
404
-
405
- ### `NonceManager`
406
-
407
- Signer wrapper to manage nonces.
408
-
409
- - `new NonceManager(signer: AbstractSigner)`
410
-
411
- **Methods**
412
- - `getAddress(): Promise<string>`
413
- - `getTransactionCount(blockTag?: string): Promise<number>`
414
- - `sendTransaction(tx: TransactionRequest): Promise<any>`
415
- - `reset(): void`
416
- - `increment(): void`
417
-
418
- ### `JsonRpcSigner`
419
-
420
- Lightweight signer placeholder used by `BrowserProvider.getSigner(...)`.
421
-
422
- - `new JsonRpcSigner(provider, address)`
423
- - `getAddress(): Promise<string>`
424
-
425
- ### `VoidSigner`
426
-
427
- Address-only signer.
428
-
429
- - `new VoidSigner(address: string, provider?: AbstractProvider)`
430
- - `getAddress(): Promise<string>`
431
-
432
- ## Contracts
433
-
434
- ### `Contract`
435
-
436
- Dynamic contract wrapper (ethers-like).
437
-
438
- - `new Contract(address: string, abi: any[] | Interface, runner?: AbstractProvider | Wallet, bytecode?: string)`
439
-
440
- **Properties**
441
- - `address: string`
442
- - `target: string` (alias of address)
443
- - `interface: Interface`
444
- - `provider: AbstractProvider | null`
445
- - `signer: any | null`
446
-
447
- **Call / send**
448
- - `call(methodName: string, args: any[], overrides?: TransactionRequest): Promise<any>`
449
- - `send(methodName: string, args: any[], overrides?: TransactionRequest): Promise<ContractTransactionResponse>`
450
-
451
- **Logs / events**
452
- - `queryFilter(eventName: string, fromBlock?: number|string, toBlock?: number|string): Promise<EventLog[]>`
453
- - `on(eventName: string, callback: Function): this`
454
- - `once(eventName: string, callback: Function): this`
455
- - `removeListener(eventName: string, callback: Function): this`
456
- - `removeAllListeners(eventName?: string): this`
457
-
458
- **Deployment helpers**
459
- - `deployTransaction(): any | null`
460
- - `waitForDeployment(): Promise<this>`
461
- - `getDeployedCode(): Promise<string | null>`
462
-
463
- **Example(s):**
464
- - `examples/read-operations.js`
465
- - `examples/events.js`
466
-
467
- ### `ContractFactory`
468
-
469
- Deployment helper.
470
-
471
- - `new ContractFactory(abi: any[] | Interface, bytecode: string, signer: any)`
472
-
473
- **Methods**
474
- - `getDeployTransaction(...args: any[]): TransactionRequest`
475
- - `deploy(...args: any[]): Promise<Contract>`
476
- - `attach(address: string): Contract`
477
- - `connect(signer: any): ContractFactory`
478
-
479
- ### `ContractTransactionResponse`
480
-
481
- Wrapper around an underlying `TransactionResponse`.
482
-
483
- - `wait(confirmations?: number, timeoutMs?: number): Promise<any>`
484
- - `getTransaction(): any`
485
-
486
- ### `ContractTransactionReceipt`
487
-
488
- Wrapper around a receipt with convenience filters.
489
-
490
- - `getEvent(eventName: string): any | null`
491
- - `getEvents(eventName: string): any[]`
492
-
493
- ### `EventLog`
494
-
495
- Lightweight log wrapper returned by `Contract.queryFilter(...)`.
496
-
497
- ## ABI
498
-
499
- ### Fragments (`Fragment`, `FunctionFragment`, ...)
500
-
501
- Exported fragment types:
502
- - `Fragment`
503
- - `NamedFragment`
504
- - `FunctionFragment`
505
- - `EventFragment`
506
- - `ErrorFragment`
507
- - `ConstructorFragment`
508
- - `StructFragment`
509
- - `FallbackFragment`
510
-
511
- All fragments support:
512
- - `format(format?: string | null): string`
513
- - `toJSON(): any`
514
-
515
- ### `Interface`
516
-
517
- ABI encoding/decoding compatibility layer.
518
-
519
- - `new Interface(abi: any[] | Interface | null)`
520
-
521
- **Methods**
522
- - `formatJson(): string`
523
- - `format(format?: string | null): string`
524
- - `getFunction(name: string): FunctionFragment`
525
- - `getEvent(name: string): EventFragment`
526
- - `getError(name: string): ErrorFragment`
527
- - `getConstructor(): ConstructorFragment | null`
528
-
529
- **Encoding**
530
- - `encodeFunctionData(functionFragmentOrName, values?: any[] | null): string`
531
- - `decodeFunctionResult(functionFragmentOrName, data: string): any`
532
- - `encodeEventLog(eventFragmentOrName, values?: any[] | null): { topics: string[], data: string }`
533
- - `decodeEventLog(eventFragmentOrName, topics: string[], data: string): any`
534
-
535
- **Parsing**
536
- - `parseLog(log: { topics: string[], data: string }): { fragment, name, signature, topic, args }`
537
- - Uses signature topic matching and `decodeEventLog(...)`
538
-
539
- ### `AbiCoder`
540
-
541
- Minimal ABI coder for encoding/decoding tuples of values.
542
-
543
- - `encode(types: (string|any)[], values: any[]): string`
544
- - `decode(types: (string|any)[], data: string): any`
545
- - `getDefaultValue(types: (string|any)[]): any`
546
-
547
- ## Utilities
548
-
549
- ### Address utilities
550
-
551
- From `quantumcoin`:
552
-
553
- - `isAddress(address: string): boolean`
554
- - `getAddress(address: string): string`
555
- - `isAddressable(value: any): boolean`
556
- - `resolveAddress(target: any): string | Promise<string>`
557
- - `getContractAddress({ from, nonce }): string`
558
- - `getCreateAddress({ from, nonce }): string`
559
- - `getCreate2Address(from: string, salt: string, initCodeHash: string): string`
560
- - `computeAddress(publicKey: string|Uint8Array): string`
561
-
562
- **Example(s):**
563
- - `examples/wallet-offline.js`
564
-
565
- ## Solidity Types (TypeScript)
566
-
567
- QuantumCoin.js exposes core Solidity-related types for TypeScript users.
568
-
569
- - **Import path**: `quantumcoin/types`
570
-
571
- **Key exports**
572
-
573
- - `AddressLike` (currently `string`, 32-byte address)
574
- - `BytesLike` (`string | Uint8Array`)
575
- - `BigNumberish` (`string | number | bigint`)
576
- - `SolidityTypeName` (ABI type string model)
577
- - **Hard Solidity aliases** (preferred for typed wrappers):
578
- - Integers: `Uint256Like` / `Uint256`, `Int256Like` / `Int256` (and all widths `Uint8Like`…`Uint256Like`, `Int8Like`…`Int256Like`)
579
- - Fixed bytes: `Bytes32Like` / `Bytes32` (and `Bytes1Like`…`Bytes32Like`)
580
- - Arrays/tuples helpers: `SolArray<T>`, `SolFixedArray<T, N>`, `SolStruct<T>`
581
- - `SolidityInputValue<T>` / `SolidityOutputValue<T>` (advanced type-level mapping from ABI type strings to JS values; the generator no longer uses these for wrapper signatures)
582
-
583
- Example:
584
-
585
- ```ts
586
- import type { AddressLike, BigNumberish, Uint256Like, Uint256 } from "quantumcoin/types";
587
-
588
- const to: AddressLike = "0x0000000000000000000000000000000000000000000000000000000000001000";
589
- const amount: BigNumberish = "123";
590
- const asInput: Uint256Like = amount;
591
- const asOutput: Uint256 = 123n;
592
- ```
593
-
594
- ### Encoding utilities
595
-
596
- - `toUtf8String(data: BytesLike): string`
597
- - `toUtf8Bytes(str: string): Uint8Array`
598
- - `toHex(data: BytesLike): string`
599
- - `hexlify(data: BytesLike): string`
600
- - `arrayify(data: BytesLike): Uint8Array`
601
- - `isBytesLike(value: any): boolean`
602
- - `concat(items: BytesLike[]): string`
603
- - `stripZerosLeft(data: BytesLike): string`
604
- - `zeroPad(value: BytesLike, length: number): string`
605
- - `zeroPadValue(value: BytesLike, length: number): string`
606
- - `encodeBytes32String(text: string): string`
607
- - `decodeBytes32String(bytes: BytesLike): string`
608
- - `encodeBase64(data: BytesLike): string`
609
- - `decodeBase64(data: string): Uint8Array`
610
- - `encodeBase58(data: BytesLike): string`
611
- - `decodeBase58(data: string): Uint8Array`
612
- - `toUtf8CodePoints(str: string): number[]`
613
- - `solidityPacked(...)` (**throws; not implemented**)
614
- - `solidityPackedKeccak256(...)` (**throws; not implemented**)
615
- - `solidityPackedSha256(...)` (**throws; not implemented**)
616
-
617
- ### Hashing utilities
618
-
619
- - `keccak256(data: BytesLike): string`
620
- - `sha256(data: BytesLike): string`
621
- - `sha512(data: BytesLike): string`
622
- - `ripemd160(data: BytesLike): string`
623
- - `id(text: string): string` (=`keccak256(utf8Bytes(text))`)
624
- - `randomBytes(length: number): Uint8Array`
625
- - `computeHmac(algorithm: string, key: BytesLike, data: BytesLike): string`
626
- - `pbkdf2(password: BytesLike, salt: BytesLike, iterations: number, keylen: number, algorithm?: string): string`
627
- - `scrypt(password: BytesLike, salt: BytesLike, N: number, r: number, p: number, dkLen: number): Promise<string>`
628
- - `scryptSync(password: BytesLike, salt: BytesLike, N: number, r: number, p: number, dkLen: number): string`
629
-
630
- ### Units
631
-
632
- - `formatUnits(value: BigNumberish, decimals?: number): string`
633
- - `parseUnits(value: string, decimals?: number): bigint`
634
- - `formatEther(value: BigNumberish): string`
635
- - `parseEther(value: string): bigint`
636
-
637
- ### FixedNumber (fixed-point arithmetic)
638
-
639
- Fixed-point decimal arithmetic compatible with ethers.js v5/v6.
640
-
641
- **FixedFormat type:**
642
- `number | string | { signed?: boolean, width?: number, decimals?: number }`
643
-
644
- Default format: `"fixed128x18"` (signed, 128-bit, 18 decimals).
645
-
646
- **Static factories:**
647
- - `FixedNumber.fromString(value: string, format?: FixedFormat): FixedNumber`
648
- - `FixedNumber.fromValue(value: BigNumberish, decimals?: number, format?: FixedFormat): FixedNumber`
649
- - `FixedNumber.fromBytes(value: BytesLike, format?: FixedFormat): FixedNumber`
650
- - `FixedNumber.from(value: any, format?: FixedFormat): FixedNumber` — dispatches to `fromString`, `fromBytes`, or `fromValue`
651
- - `FixedNumber.isFixedNumber(value: any): boolean`
652
-
653
- **Properties (read-only):**
654
- - `format: string` — e.g. `"fixed128x18"`
655
- - `signed: boolean`
656
- - `width: number`
657
- - `decimals: number`
658
- - `value: bigint` — raw internal integer
659
-
660
- **Arithmetic (safe throws on overflow, unsafe wraps silently):**
661
- - `add(other)` / `addUnsafe(other): FixedNumber`
662
- - `sub(other)` / `subUnsafe(other): FixedNumber`
663
- - `mul(other)` / `mulUnsafe(other): FixedNumber`
664
- - `div(other)` / `divUnsafe(other): FixedNumber`
665
- - `mulSignal(other): FixedNumber` — throws on precision loss
666
- - `divSignal(other): FixedNumber` throws on precision loss
667
-
668
- **Comparison:**
669
- - `cmp(other): number` — returns `-1`, `0`, or `1`
670
- - `eq(other)`, `lt(other)`, `lte(other)`, `gt(other)`, `gte(other): boolean`
671
-
672
- **Rounding:**
673
- - `floor(): FixedNumber`
674
- - `ceiling(): FixedNumber`
675
- - `round(decimals?: number): FixedNumber`
676
-
677
- **Inspection:**
678
- - `isZero(): boolean`
679
- - `isNegative(): boolean`
680
-
681
- **Conversion:**
682
- - `toString(): string`
683
- - `toUnsafeFloat(): number`
684
- - `toFormat(format: FixedFormat): FixedNumber`
685
- - `toHexString(width?: number): string`
686
-
687
- ### RLP
688
-
689
- - `encodeRlp(value: any): string`
690
- - `decodeRlp(data: string): any`
691
-
692
- ### `Result` and `checkResultErrors`
693
-
694
- - `class Result extends Array`
695
- - `new Result(items?: any[], keys?: (null|string)[])`
696
- - `Result.fromItems(items: any[], keys?: (null|string)[]): Result`
697
- - `getValue(name: string): any`
698
- - `toArray(deep?: boolean | null): any[]`
699
- - `toObject(deep?: boolean | null): Record<string, any>`
700
- - `checkResultErrors(result: any): Array<{ error: Error, path: (string|number)[] }>`
701
-
702
- ## Typed SDK Generator (`generate-sdk.js`)
703
-
704
- ### Overview
705
-
706
- `generate-sdk.js` creates **typed contract wrappers** for one or more contracts, and can optionally scaffold a complete npm package (with examples and transactional tests).
707
-
708
- It supports generating:
709
- - **TypeScript source** (`--lang ts`, default)
710
- - **JavaScript source + TypeScript declarations** (`--lang js`)
711
-
712
- **Typing behaviour (generated wrappers)**
713
-
714
- - **Hard types**: wrapper signatures use concrete types from `quantumcoin/types` (e.g. `Uint256Like` for inputs, `Uint256` for outputs).
715
- - **Single output unwrapping**: functions returning one value return the value directly (not `[value]`).
716
- - **Multiple outputs**: returned as a tuple type (e.g. `Promise<[Uint256, Bool]>`).
717
- - **No outputs**: `Promise<void>`.
718
- - **Structs / tuples**: emitted as `export type <Name>Input` / `export type <Name>Output` and used in signatures.
719
- - **JS typing**: JS output uses JSDoc types plus `.d.ts` files; TS users still get strong types.
720
-
721
- **Entry point**
722
- - `node generate-sdk.js ...`
723
- - or `npx sdkgen ...` (when installed)
724
-
725
- ### Input modes
726
-
727
- 1) **ABI + BIN**
728
-
729
- ```bash
730
- node generate-sdk.js --abi path/to/My.abi.json --bin path/to/My.bin --name MyContract --out ./out --non-interactive
731
-
732
- # JS output
733
- node generate-sdk.js --lang js --abi path/to/My.abi.json --bin path/to/My.bin --name MyContract --out ./out --non-interactive
734
- ```
735
-
736
- 2) **Solidity sources**
737
-
738
- ```bash
739
- node generate-sdk.js --sol ".\\contracts\\A.sol,.\\contracts\\B.sol" --solc "c:\\solc\\solc.exe" --out ./out --non-interactive
740
-
741
- # Pass additional solc args (example)
742
- node generate-sdk.js --sol ".\\contracts\\A.sol" --solc "c:\\solc\\solc.exe" --solc-args "--via-ir --evm-version london" --out ./out --non-interactive
743
- ```
744
-
745
- 3) **Artifacts JSON (multi-contract ABI+BIN list)**
746
-
747
- ```bash
748
- node generate-sdk.js --artifacts-json .\\artifacts.json --out .\\out --non-interactive
749
- ```
750
-
751
- Example `artifacts.json`:
752
-
753
- ```json
754
- [
755
- { "abi": "./Alpha.abi.json", "bin": "./Alpha.bin" },
756
- { "abi": "./Beta.abi.json", "bin": "./Beta.bin", "name": "Beta" },
757
- {
758
- "name": "Gamma",
759
- "abi": "[{\"type\":\"function\",\"name\":\"set\",\"stateMutability\":\"nonpayable\",\"inputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"outputs\":[]}]",
760
- "bin": "0x6000600055..."
761
- }
762
- ]
763
- ```
764
-
765
- ### Package scaffolding mode
766
-
767
- Use `--create-package` to create a full npm package (source, tests, examples, README).
768
-
769
- ```bash
770
- node generate-sdk.js --artifacts-json .\\artifacts.json ^
771
- --lang ts ^
772
- --create-package --package-dir .\\tmp --package-name my-typed-package ^
773
- --package-description "My typed package" --package-author "me" ^
774
- --package-license MIT --package-version 0.0.1 ^
775
- --non-interactive
776
- ```
777
-
778
- ### Generated package layout
779
-
780
- When `--create-package` is used, the generator produces:
781
-
782
- - `src/` contract wrappers + factories
783
- - TS mode: `*.ts` (compiled output in `dist/` after `npm run build:ts`)
784
- - JS mode: `*.js` with `*.d.ts` types (no build step required)
785
- - `test/e2e/*.e2e.test.js` per-contract transactional tests
786
- - `examples/` deploy/read/write/events scripts
787
- - `README.md` generated by the generator (includes ABI-derived API overview)
788
- - `index.js` + `index.d.ts` (package entry shims)
789
-
790
- ### Running generated transactional tests
791
-
792
- Generated package tests broadcast transactions and require:
793
-
794
- - `QC_RPC_URL` (RPC endpoint)
795
- - `QC_CHAIN_ID` (optional, default `123123`)
796
-
797
- ### Generator tests
798
-
799
- - Unit tests:
800
- - `test/unit/generate-contract-cli.test.js`
801
- - `test/unit/generator.test.js`
802
- - `test/unit/generate-sdk-artifacts-json.test.js`
803
- - E2E generator tests (transactional; require `QC_RPC_URL` and optionally `QC_CHAIN_ID`):
804
- - `test/e2e/typed-generator.e2e.test.js`
805
- - `test/e2e/simple-erc20.generated-sdks.e2e.test.js`
806
- - `test/e2e/all-solidity-types.generated-sdks.e2e.test.js`
807
-
1
+ > **CAUTION:** This is an experimental SDK. Use at your own risk.
2
+
3
+ # QuantumCoin.js — Comprehensive SDK Documentation
4
+
5
+ This document is the **complete, detailed SDK reference** for QuantumCoin.js (ethers.js v6-compatible surface), including **every exported class/function**, their **parameters**, and links to **examples** and **tests** in this repository.
6
+
7
+ > Reminder: QuantumCoin.js requires calling `Initialize()` before using features that depend on `quantum-coin-js-sdk` (address validation, ABI encoding/decoding, signing, etc.).
8
+
9
+ ## Table of Contents
10
+
11
+ - [Getting started](#getting-started)
12
+ - [Install](#install)
13
+ - [Initialization (required)](#initialization-required)
14
+ - [Key differences vs ethers/Ethereum](#key-differences-vs-ethersethereum)
15
+ - [Configuration (`quantumcoin/config`)](#configuration-quantumcoinconfig)
16
+ - [`Config`](#config)
17
+ - [`Initialize(config)`](#initializeconfig)
18
+ - [`isInitialized()`](#isinitialized)
19
+ - [`getConfig()`](#getconfig)
20
+ - [Constants](#constants)
21
+ - [Errors](#errors)
22
+ - [`makeError`, `assert`, `assertArgument`, `isError`, `isCallException`](#makeerror-assert-assertargument-iserror-iscallexception)
23
+ - [`ProviderError`, `TransactionError`, `ContractError`](#providererror-transactionerror-contracterror)
24
+ - [Providers](#providers)
25
+ - [`Provider`](#provider)
26
+ - [`AbstractProvider`](#abstractprovider)
27
+ - [`JsonRpcProvider` / `JsonRpcApiProvider`](#jsonrpcprovider--jsonrpcapiprovider)
28
+ - [`WebSocketProvider`](#websocketprovider)
29
+ - [`IpcSocketProvider`](#ipcsocketprovider)
30
+ - [`BrowserProvider`](#browserprovider)
31
+ - [`FallbackProvider`](#fallbackprovider)
32
+ - [`FilterByBlockHash`](#filterbyblockhash)
33
+ - [`Block`](#block)
34
+ - [`TransactionResponse`](#transactionresponse)
35
+ - [`TransactionReceipt`](#transactionreceipt)
36
+ - [`Log`](#log)
37
+ - [Wallets & Signers](#wallets--signers)
38
+ - [`SigningKey`](#signingkey)
39
+ - [`AbstractSigner`](#abstractsigner)
40
+ - [`BaseWallet`](#basewallet)
41
+ - [`Wallet`](#wallet)
42
+ - [`NonceManager`](#noncemanager)
43
+ - [`JsonRpcSigner`](#jsonrpcsigner)
44
+ - [`VoidSigner`](#voidsigner)
45
+ - [Contracts](#contracts)
46
+ - [`Contract`](#contract)
47
+ - [`ContractFactory`](#contractfactory)
48
+ - [`ContractTransactionResponse`](#contracttransactionresponse)
49
+ - [`ContractTransactionReceipt`](#contracttransactionreceipt)
50
+ - [`EventLog`](#eventlog)
51
+ - [ABI](#abi)
52
+ - [Fragments (`Fragment`, `FunctionFragment`, ...)](#fragments-fragment-functionfragment-)
53
+ - [`Interface`](#interface)
54
+ - [`AbiCoder`](#abicoder)
55
+ - [Utilities](#utilities)
56
+ - [Address utilities](#address-utilities)
57
+ - [Encoding utilities](#encoding-utilities)
58
+ - [Hashing utilities](#hashing-utilities)
59
+ - [Units](#units)
60
+ - [RLP](#rlp)
61
+ - [`Result` and `checkResultErrors`](#result-and-checkresulterrors)
62
+ - [Typed SDK Generator (`generate-sdk.js`)](#typed-sdk-generator-generate-sdkjs)
63
+ - [Overview](#overview)
64
+ - [Input modes](#input-modes)
65
+ - [Package scaffolding mode](#package-scaffolding-mode)
66
+ - [Generated package layout](#generated-package-layout)
67
+ - [Running generated transactional tests](#running-generated-transactional-tests)
68
+ - [Generator tests](#generator-tests)
69
+
70
+ ## Getting started
71
+
72
+ ### Install
73
+
74
+ ```bash
75
+ npm install quantumcoin
76
+ ```
77
+
78
+ ### Initialization (required)
79
+
80
+ ```js
81
+ const { Initialize } = require("quantumcoin/config");
82
+
83
+ // Initialize with defaults (chainId=123123 and default RPC endpoint)
84
+ await Initialize(null);
85
+ ```
86
+
87
+ If you need to override the RPC endpoint used by `JsonRpcProvider` defaults:
88
+
89
+ ```js
90
+ const { Config, Initialize } = require("quantumcoin/config");
91
+ await Initialize(new Config(123123, "https://public.rpc.quantumcoinapi.com"));
92
+ ```
93
+
94
+ **Example(s):**
95
+ - `examples/example.js`
96
+
97
+ ### Key differences vs ethers/Ethereum
98
+
99
+ - **Addresses are 32 bytes** (66 hex chars including `0x`)
100
+ - **Signing and ABI encoding/decoding** are delegated to `quantum-coin-js-sdk` (WASM)
101
+ - **Initialize must be called** once at startup for wallet/address/ABI helpers
102
+
103
+ ## Configuration (`quantumcoin/config`)
104
+
105
+ ### `Config`
106
+
107
+ **Constructor**
108
+
109
+ - `new Config(chainId?: number, rpcEndpoint?: string)`
110
+ - **chainId**: defaults to `123123`
111
+ - **rpcEndpoint**: defaults to `https://public.rpc.quantumcoinapi.com`
112
+
113
+ ### `Initialize(config)`
114
+
115
+ - `Initialize(config: Config | null | undefined): Promise<boolean>`
116
+ - If `config` is `null` / `undefined`, defaults are used
117
+ - Initializes `quantum-coin-js-sdk` internally (WASM + crypto)
118
+
119
+ ### `isInitialized()`
120
+
121
+ - `isInitialized(): boolean`
122
+ - Returns true after `Initialize(...)` succeeds
123
+
124
+ ### `getConfig()`
125
+
126
+ - `getConfig(): Config | null`
127
+ - Returns the active config (or `null` if not initialized)
128
+
129
+ ## Constants
130
+
131
+ Exported from `quantumcoin`:
132
+
133
+ - `version: string`
134
+ - `ZeroAddress: string` (32-byte zero address)
135
+ - `ZeroHash: string` (32-byte zero hash)
136
+ - `MaxUint256: bigint`
137
+ - `MaxUint160: bigint`
138
+ - `MinInt256: bigint`
139
+ - `MaxInt256: bigint`
140
+ - `NumericFault: string` (=`"NUMERIC_FAULT"`)
141
+ - `NumericFaultCode: string` (=`"NUMERIC_FAULT"`)
142
+ - `WeiPerEther: bigint` (=`1000000000000000000n`)
143
+ - `EtherSymbol: string` (=`"Ξ"`)
144
+ - `N: bigint` (compat placeholder)
145
+
146
+ ## Errors
147
+
148
+ ### `makeError`, `assert`, `assertArgument`, `isError`, `isCallException`
149
+
150
+ - `makeError(message: string, code: ErrorCode, info?: object): Error & { code, shortMessage }`
151
+ - `assert(check: any, message: string, code: ErrorCode, info?: object): void`
152
+ - `assertArgument(check: any, message: string, name: string, value: any): void`
153
+ - `isError(error: any, code: string): boolean`
154
+ - `isCallException(error: any): boolean`
155
+
156
+ **Notes**
157
+ - Most SDK errors are `Error`/`TypeError` with `.code` and `.shortMessage` (ethers-like).
158
+
159
+ ### `ProviderError`, `TransactionError`, `ContractError`
160
+
161
+ - `new ProviderError(message: string, info?: object)`
162
+ - `new TransactionError(message: string, info?: object)`
163
+ - `new ContractError(message: string, info?: object)`
164
+
165
+ ## Providers
166
+
167
+ ### `Provider`
168
+
169
+ Base class extending Node’s `EventEmitter`. Used primarily for API surface parity.
170
+
171
+ ### `AbstractProvider`
172
+
173
+ Base provider implementation. Subclasses implement `_perform`.
174
+
175
+ **Core method**
176
+ - `_perform(method: string, params?: any[]): Promise<any>` (**subclass responsibility**)
177
+
178
+ **Read operations**
179
+ - `getBlockNumber(): Promise<number>`
180
+ - `getBlock(blockNumber: number | "latest"): Promise<Block>`
181
+ - `getTransaction(txHash: string): Promise<TransactionResponse | null>`
182
+ - `getTransactionReceipt(txHash: string): Promise<TransactionReceipt | null>`
183
+ - `getBalance(address: string): Promise<bigint>`
184
+ - `getTransactionCount(address: string, blockTag?: string | null): Promise<number>`
185
+ - `call(tx: TransactionRequest, blockTag?: string | null): Promise<string>`
186
+ - `estimateGas(tx: TransactionRequest): Promise<bigint>`
187
+ - `getCode(address: string, blockTag?: string | null): Promise<string>`
188
+ - `getStorageAt(address: string, position: bigint, blockTag?: string | null): Promise<string>`
189
+ - `getLogs(filter: Filter | FilterByBlockHash): Promise<Log[]>`
190
+
191
+ > **JSON-RPC QUANTITY formatting:** numeric block-tag arguments to `getBlock(n)` and `getLogs({ fromBlock: n, toBlock: n })` are encoded as spec-compliant QUANTITY hex strings — no leading zeros, with `0` encoded as `"0x0"`. This matches the [Ethereum JSON-RPC convention](https://ethereum.org/en/developers/docs/apis/json-rpc/#conventions) (e.g. `getBlock(5)` sends `"0x5"`, not `"0x05"`), so requests to spec-compliant nodes succeed for block numbers in `[1..15]`, `[256..4095]`, etc. The internal helper used is [`toQuantityHex`](./src/internal/hex.js) (aliased as `toQuantity`), which is the QuantumCoin.js equivalent of ethers.js v6 `toQuantity`. Use `normalizeHex` for **DATA** hex (addresses, bytecode, byte-arrays); use `toQuantityHex` for **QUANTITY** hex (block numbers, gas, nonces, balances).
192
+
193
+ **Write operation**
194
+ - `sendTransaction(tx: string | { raw: string }): Promise<TransactionResponse>`
195
+ - QuantumCoin.js expects a **signed raw transaction hex string**.
196
+
197
+ **Example(s):**
198
+ - `examples/example.js`
199
+ - `examples/read-operations.js`
200
+ - `examples/events.js`
201
+
202
+ ### `JsonRpcProvider` / `JsonRpcApiProvider`
203
+
204
+ HTTP JSON-RPC provider.
205
+
206
+ - `new JsonRpcProvider(url?: string, chainId?: number)`
207
+ - If `url` is omitted, uses config default `rpcEndpoint`
208
+ - If `chainId` is omitted, defaults to `123123`
209
+
210
+ **Example(s):**
211
+ - `examples/example.js`
212
+
213
+ ### `WebSocketProvider`
214
+
215
+ WebSocket JSON-RPC provider (no extra dependencies; uses Node’s global `WebSocket`).
216
+
217
+ - `new WebSocketProvider(url: string, chainId?: number)`
218
+ - `destroy(): void` (closes socket, rejects pending requests)
219
+
220
+ **Test(s):**
221
+ - `test/integration/ws-provider.test.js`
222
+
223
+ ### `IpcSocketProvider`
224
+
225
+ IPC JSON-RPC provider using Node’s `net`.
226
+
227
+ - `new IpcSocketProvider(path: string)`
228
+ - Windows example: `\\\\.\\pipe\\geth.ipc`
229
+
230
+ **Test(s):**
231
+ - `test/integration/ipc-provider.test.js`
232
+
233
+ ### `BrowserProvider`
234
+
235
+ EIP-1193 wrapper provider (for injected browser wallets).
236
+
237
+ - `new BrowserProvider(eip1193Provider: { request: Function }, network?: any, options?: BrowserProviderOptions)`
238
+ - `providerInfo` is supported as an option (compat)
239
+
240
+ **Core methods**
241
+ - `send(method: string, params?: any[] | object): Promise<any>`
242
+ - `_send(payloadOrArray): Promise<any>` (compat)
243
+ - `_perform(method: string, params?: any[]): Promise<any>` (delegates to `send`)
244
+ - `getRpcError(payload, error): Error`
245
+ - `getSigner(addressOrIndex?: string | number): Promise<JsonRpcSigner>`
246
+ - `hasSigner(addressOrIndex: string | number): Promise<boolean>`
247
+
248
+ **Debug event sink**
249
+ - Emits `"debug"` events:
250
+ - `{ action: "sendEip1193Payload", payload: { method, params } }`
251
+ - `{ action: "receiveEip1193Result", result }`
252
+ - `{ action: "receiveEip1193Error", error }`
253
+
254
+ **Test(s):**
255
+ - `test/unit/browser-provider.test.js`
256
+
257
+ Reference: ethers BrowserProvider docs: [`https://docs.ethers.org/v6/api/providers/#BrowserProvider`](https://docs.ethers.org/v6/api/providers/#BrowserProvider)
258
+
259
+ ### `FallbackProvider`
260
+
261
+ Simple provider wrapper that tries multiple providers in order.
262
+
263
+ - `new FallbackProvider(providers: AbstractProvider | AbstractProvider[])`
264
+ - `_perform(method, params)` tries each provider until one succeeds
265
+
266
+ ### `FilterByBlockHash`
267
+
268
+ Helper for filters pinned to a specific block hash (ethers style).
269
+
270
+ - `new FilterByBlockHash(blockHash: string, address?: string | string[], topics?: (string|string[]|null)[])`
271
+ - `blockHash` must be **32-byte hex**
272
+ - `toJSON()` returns `{ blockHash, address, topics }`
273
+
274
+ **Test(s):**
275
+ - `test/unit/filter-by-blockhash.test.js`
276
+
277
+ Reference: ethers FilterByBlockHash docs: [`https://docs.ethers.org/v6/api/providers/#FilterByBlockHash`](https://docs.ethers.org/v6/api/providers/#FilterByBlockHash)
278
+
279
+ ### `Block`
280
+
281
+ Wrapper returned by `provider.getBlock(...)`.
282
+
283
+ **Properties**
284
+ - `hash: string | null`
285
+ - `parentHash: string | null`
286
+ - `number: number | null`
287
+ - `timestamp: number | null`
288
+ - `transactions: any[]`
289
+ - `provider: AbstractProvider | null`
290
+
291
+ **Methods**
292
+ - `getTransaction(indexOrHash: number | string): Promise<TransactionResponse | null>`
293
+ - `getTransactionReceipt(indexOrHash: number | string): Promise<TransactionReceipt | null>`
294
+ - `getPrefetchedTransactions(): any[]` (currently returns `[]`)
295
+
296
+ ### `TransactionResponse`
297
+
298
+ Wrapper returned by `provider.sendTransaction(...)` and `provider.getTransaction(...)`.
299
+
300
+ **Properties (common)**
301
+ - `hash: string`
302
+ - `to: string | null`
303
+ - `from: string | null`
304
+ - `nonce: number | null`
305
+ - `data: string`
306
+ - `value: bigint`
307
+ - `gasLimit: bigint | null`
308
+ - `chainId: number | null`
309
+ - `blockNumber: number | null`
310
+ - `txType: number | null` — Transaction type (e.g. `1` for a standard transfer)
311
+ - `provider: AbstractProvider | null`
312
+
313
+ **Methods**
314
+ - `wait(confirmations?: number | null, timeoutMs?: number | null): Promise<TransactionReceipt>`
315
+
316
+ ### `TransactionReceipt`
317
+
318
+ Wrapper returned by `provider.getTransactionReceipt(...)` and `tx.wait()`.
319
+
320
+ **Properties (common)**
321
+ - `to: string | null`
322
+ - `from: string | null`
323
+ - `contractAddress: string | null`
324
+ - `transactionHash: string`
325
+ - `blockHash: string`
326
+ - `blockNumber: number | null`
327
+ - `transactionIndex: number | null`
328
+ - `gasUsed: bigint | null`
329
+ - `status: number | null`
330
+ - `logs: Log[]`
331
+ - `provider: AbstractProvider | null`
332
+
333
+ ### `Log`
334
+
335
+ Wrapper returned by `provider.getLogs(...)`.
336
+
337
+ **Properties (common)**
338
+ - `address: string`
339
+ - `topics: string[]`
340
+ - `data: string`
341
+ - `blockHash: string | null`
342
+ - `blockNumber: number | null`
343
+ - `transactionHash: string | null`
344
+ - `transactionIndex: number | null`
345
+ - `logIndex: number | null`
346
+ - `removed: boolean`
347
+ - `provider: AbstractProvider | null`
348
+
349
+ **Methods**
350
+ - `getBlock(): Promise<Block | null>`
351
+ - `getTransaction(): Promise<TransactionResponse | null>`
352
+ - `getTransactionReceipt(): Promise<TransactionReceipt | null>`
353
+
354
+ ## Wallets & Signers
355
+
356
+ ### `SigningKey`
357
+
358
+ - `new SigningKey(privateKeyBytes: Uint8Array, publicKeyBytes: Uint8Array)`
359
+
360
+ ### `AbstractSigner`
361
+
362
+ - `new AbstractSigner(provider?: AbstractProvider | null)`
363
+ - `provider: AbstractProvider | null`
364
+ - `getAddress(): Promise<string>` (base throws; implemented by subclasses)
365
+
366
+ ### `BaseWallet`
367
+
368
+ Core signing implementation.
369
+
370
+ - `new BaseWallet(signingKey: SigningKey, provider?: AbstractProvider | null, precomputed?: { address: string }, qcWallet?: any)`
371
+
372
+ **Properties**
373
+ - `address: string`
374
+ - `privateKey: string` (getter; hex string)
375
+ - `publicKey: string` (getter; hex string)
376
+ - `seed: string | null` (getter; pre-expansion seed as hex, or `null` if the wallet has no seed source)
377
+ - `provider: AbstractProvider | null`
378
+
379
+ **Methods**
380
+ - `getAddress(): Promise<string>`
381
+ - `signTransaction(tx: TransactionRequest): Promise<string>`
382
+ - `sendTransaction(tx: TransactionRequest): Promise<TransactionResponse>`
383
+
384
+ ### `Wallet`
385
+
386
+ User-facing wallet class.
387
+
388
+ - `new Wallet(privateKeyOrBytesOrSigningKey, provider?: AbstractProvider)`
389
+
390
+ **Static methods**
391
+ - `Wallet.createRandom(provider?: AbstractProvider, keyType?: number | null): Wallet` `keyType`: `null`/`3` (default, hybrid compact) or `5` (hybrid5)
392
+ - `Wallet.fromSeed(seed: number[], provider?: AbstractProvider): Wallet` — opens wallet from raw seed bytes (64/72/96 length)
393
+ - `Wallet.fromEncryptedJsonSync(json: string, password: string, provider?: AbstractProvider): Wallet`
394
+ - `Wallet.fromPhrase(phrase: string | string[], provider?: AbstractProvider): Wallet`
395
+ - `Wallet.fromKeys(privateKey: Uint8Array | string, publicKey: Uint8Array | string, provider?: AbstractProvider): Wallet`
396
+ - `Wallet.encryptSeedSync(seed: number[] | Uint8Array, password: string | Uint8Array): string` — encrypts raw seed bytes (64/72/96) into a wallet JSON string (version 5 pre-expansion format). The resulting JSON can be opened with `fromEncryptedJsonSync()` or Desktop/Mobile/Web/CLI wallet applications. Password must be at least 12 characters.
397
+
398
+ **Instance methods**
399
+ - `getAddress(): string`
400
+ - `getBalance(blockTag?: string): Promise<bigint>`
401
+ - `getTransactionCount(blockTag?: string): Promise<number>`
402
+ - `encryptSync(password: string | Uint8Array): string`
403
+ - `connect(provider: AbstractProvider): Wallet`
404
+ - `getPhrase(): string[] | null` — returns the seed phrase (list of words) when the wallet has a seed, else `null`. Works for `createRandom`, `fromPhrase`, `fromSeed`, and `fromEncryptedJsonSync` on a version-5 keystore. Returns `null` for `fromKeys` and for v3/v4 keystores.
405
+ - `getSigningContext(fullSign?: boolean | null): number` — returns the recommended signing context for this wallet (based on public key type). Setting `fullSign` to `true` may incur additional gas cost.
406
+
407
+ **Seed & phrase applicability**
408
+
409
+ | Factory | `seed` | `getPhrase()` |
410
+ | --- | --- | --- |
411
+ | `new Wallet(privateKey)` | `null` | `null` |
412
+ | `Wallet.createRandom(provider?, keyType?)` | non-null | 32 or 36 words |
413
+ | `Wallet.fromPhrase(phrase)` | non-null | 32 / 36 / 48 words |
414
+ | `Wallet.fromSeed(seed)` | non-null | 32 / 36 / 48 words |
415
+ | `Wallet.fromKeys(priv, pub)` | `null` | `null` |
416
+ | `Wallet.fromEncryptedJsonSync(json, pw)` — v5 keystore (from `encryptSync` on seed-bearing wallet, or `encryptSeedSync`) | non-null | original words |
417
+ | `Wallet.fromEncryptedJsonSync(json, pw)` — v3 / v4 keystore | `null` | `null` |
418
+ | `wallet.connect(provider)` | same as source | same as source |
419
+
420
+ **Example(s):**
421
+ - `examples/wallet-offline.js`
422
+
423
+ ### `NonceManager`
424
+
425
+ Signer wrapper to manage nonces.
426
+
427
+ - `new NonceManager(signer: AbstractSigner)`
428
+
429
+ **Methods**
430
+ - `getAddress(): Promise<string>`
431
+ - `getTransactionCount(blockTag?: string): Promise<number>`
432
+ - `sendTransaction(tx: TransactionRequest): Promise<any>`
433
+ - `reset(): void`
434
+ - `increment(): void`
435
+
436
+ ### `JsonRpcSigner`
437
+
438
+ Lightweight signer placeholder used by `BrowserProvider.getSigner(...)`.
439
+
440
+ - `new JsonRpcSigner(provider, address)`
441
+ - `getAddress(): Promise<string>`
442
+
443
+ ### `VoidSigner`
444
+
445
+ Address-only signer.
446
+
447
+ - `new VoidSigner(address: string, provider?: AbstractProvider)`
448
+ - `getAddress(): Promise<string>`
449
+
450
+ ## Contracts
451
+
452
+ ### `Contract`
453
+
454
+ Dynamic contract wrapper (ethers-like).
455
+
456
+ - `new Contract(address: string, abi: any[] | Interface, runner?: AbstractProvider | Wallet, bytecode?: string)`
457
+
458
+ **Properties**
459
+ - `address: string`
460
+ - `target: string` (alias of address)
461
+ - `interface: Interface`
462
+ - `provider: AbstractProvider | null`
463
+ - `signer: any | null`
464
+
465
+ **Call / send**
466
+ - `call(methodName: string, args: any[], overrides?: TransactionRequest): Promise<any>`
467
+ - `send(methodName: string, args: any[], overrides?: TransactionRequest): Promise<ContractTransactionResponse>`
468
+
469
+ **Logs / events**
470
+ - `queryFilter(eventName: string, fromBlock?: number|string, toBlock?: number|string): Promise<EventLog[]>`
471
+ - `on(eventName: string, callback: Function): this`
472
+ - `once(eventName: string, callback: Function): this`
473
+ - `removeListener(eventName: string, callback: Function): this`
474
+ - `removeAllListeners(eventName?: string): this`
475
+
476
+ **Deployment helpers**
477
+ - `deployTransaction(): any | null`
478
+ - `waitForDeployment(): Promise<this>`
479
+ - `getDeployedCode(): Promise<string | null>`
480
+
481
+ **Example(s):**
482
+ - `examples/read-operations.js`
483
+ - `examples/events.js`
484
+
485
+ ### `ContractFactory`
486
+
487
+ Deployment helper.
488
+
489
+ - `new ContractFactory(abi: any[] | Interface, bytecode: string, signer: any)`
490
+
491
+ **Methods**
492
+ - `getDeployTransaction(...args: any[]): TransactionRequest`
493
+ - `deploy(...args: any[]): Promise<Contract>`
494
+ - `attach(address: string): Contract`
495
+ - `connect(signer: any): ContractFactory`
496
+
497
+ ### `ContractTransactionResponse`
498
+
499
+ Wrapper around an underlying `TransactionResponse`.
500
+
501
+ - `wait(confirmations?: number, timeoutMs?: number): Promise<any>`
502
+ - `getTransaction(): any`
503
+
504
+ ### `ContractTransactionReceipt`
505
+
506
+ Wrapper around a receipt with convenience filters.
507
+
508
+ - `getEvent(eventName: string): any | null`
509
+ - `getEvents(eventName: string): any[]`
510
+
511
+ ### `EventLog`
512
+
513
+ Lightweight log wrapper returned by `Contract.queryFilter(...)`.
514
+
515
+ ## ABI
516
+
517
+ ### Fragments (`Fragment`, `FunctionFragment`, ...)
518
+
519
+ Exported fragment types:
520
+ - `Fragment`
521
+ - `NamedFragment`
522
+ - `FunctionFragment`
523
+ - `EventFragment`
524
+ - `ErrorFragment`
525
+ - `ConstructorFragment`
526
+ - `StructFragment`
527
+ - `FallbackFragment`
528
+
529
+ All fragments support:
530
+ - `format(format?: string | null): string`
531
+ - `toJSON(): any`
532
+
533
+ ### `Interface`
534
+
535
+ ABI encoding/decoding compatibility layer.
536
+
537
+ - `new Interface(abi: any[] | Interface | null)`
538
+
539
+ **Methods**
540
+ - `formatJson(): string`
541
+ - `format(format?: string | null): string`
542
+ - `getFunction(name: string): FunctionFragment`
543
+ - `getEvent(name: string): EventFragment`
544
+ - `getError(name: string): ErrorFragment`
545
+ - `getConstructor(): ConstructorFragment | null`
546
+
547
+ **Encoding**
548
+ - `encodeFunctionData(functionFragmentOrName, values?: any[] | null): string`
549
+ - `decodeFunctionResult(functionFragmentOrName, data: string): any`
550
+ - `encodeEventLog(eventFragmentOrName, values?: any[] | null): { topics: string[], data: string }`
551
+ - `decodeEventLog(eventFragmentOrName, topics: string[], data: string): any`
552
+
553
+ **Parsing**
554
+ - `parseLog(log: { topics: string[], data: string }): { fragment, name, signature, topic, args }`
555
+ - Uses signature topic matching and `decodeEventLog(...)`
556
+
557
+ ### `AbiCoder`
558
+
559
+ Minimal ABI coder for encoding/decoding tuples of values.
560
+
561
+ - `encode(types: (string|any)[], values: any[]): string`
562
+ - `decode(types: (string|any)[], data: string): any`
563
+ - `getDefaultValue(types: (string|any)[]): any`
564
+
565
+ ## Utilities
566
+
567
+ ### Address utilities
568
+
569
+ From `quantumcoin`:
570
+
571
+ - `isAddress(address: string): boolean`
572
+ - `getAddress(address: string): string`
573
+ - `isAddressable(value: any): boolean`
574
+ - `resolveAddress(target: any): string | Promise<string>`
575
+ - `getContractAddress({ from, nonce }): string`
576
+ - `getCreateAddress({ from, nonce }): string`
577
+ - `getCreate2Address(from: string, salt: string, initCodeHash: string): string`
578
+ - `computeAddress(publicKey: string|Uint8Array): string`
579
+
580
+ **Example(s):**
581
+ - `examples/wallet-offline.js`
582
+
583
+ ## Solidity Types (TypeScript)
584
+
585
+ QuantumCoin.js exposes core Solidity-related types for TypeScript users.
586
+
587
+ - **Import path**: `quantumcoin/types`
588
+
589
+ **Key exports**
590
+
591
+ - `AddressLike` (currently `string`, 32-byte address)
592
+ - `BytesLike` (`string | Uint8Array`)
593
+ - `BigNumberish` (`string | number | bigint`)
594
+ - `SolidityTypeName` (ABI type string model)
595
+ - **Hard Solidity aliases** (preferred for typed wrappers):
596
+ - Integers: `Uint256Like` / `Uint256`, `Int256Like` / `Int256` (and all widths `Uint8Like`…`Uint256Like`, `Int8Like`…`Int256Like`)
597
+ - Fixed bytes: `Bytes32Like` / `Bytes32` (and `Bytes1Like`…`Bytes32Like`)
598
+ - Arrays/tuples helpers: `SolArray<T>`, `SolFixedArray<T, N>`, `SolStruct<T>`
599
+ - `SolidityInputValue<T>` / `SolidityOutputValue<T>` (advanced type-level mapping from ABI type strings to JS values; the generator no longer uses these for wrapper signatures)
600
+
601
+ Example:
602
+
603
+ ```ts
604
+ import type { AddressLike, BigNumberish, Uint256Like, Uint256 } from "quantumcoin/types";
605
+
606
+ const to: AddressLike = "0x0000000000000000000000000000000000000000000000000000000000001000";
607
+ const amount: BigNumberish = "123";
608
+ const asInput: Uint256Like = amount;
609
+ const asOutput: Uint256 = 123n;
610
+ ```
611
+
612
+ ### Encoding utilities
613
+
614
+ - `toUtf8String(data: BytesLike): string`
615
+ - `toUtf8Bytes(str: string): Uint8Array`
616
+ - `toHex(data: BytesLike): string`
617
+ - `hexlify(data: BytesLike): string`
618
+ - `arrayify(data: BytesLike): Uint8Array`
619
+ - `isBytesLike(value: any): boolean`
620
+ - `concat(items: BytesLike[]): string`
621
+ - `stripZerosLeft(data: BytesLike): string`
622
+ - `zeroPad(value: BytesLike, length: number): string`
623
+ - `zeroPadValue(value: BytesLike, length: number): string`
624
+ - `encodeBytes32String(text: string): string`
625
+ - `decodeBytes32String(bytes: BytesLike): string`
626
+ - `encodeBase64(data: BytesLike): string`
627
+ - `decodeBase64(data: string): Uint8Array`
628
+ - `encodeBase58(data: BytesLike): string`
629
+ - `decodeBase58(data: string): Uint8Array`
630
+ - `toUtf8CodePoints(str: string): number[]`
631
+ - `solidityPacked(...)` (**throws; not implemented**)
632
+ - `solidityPackedKeccak256(...)` (**throws; not implemented**)
633
+ - `solidityPackedSha256(...)` (**throws; not implemented**)
634
+
635
+ ### Hashing utilities
636
+
637
+ - `keccak256(data: BytesLike): string`
638
+ - `sha256(data: BytesLike): string`
639
+ - `sha512(data: BytesLike): string`
640
+ - `ripemd160(data: BytesLike): string`
641
+ - `id(text: string): string` (=`keccak256(utf8Bytes(text))`)
642
+ - `randomBytes(length: number): Uint8Array`
643
+ - `computeHmac(algorithm: string, key: BytesLike, data: BytesLike): string`
644
+ - `pbkdf2(password: BytesLike, salt: BytesLike, iterations: number, keylen: number, algorithm?: string): string`
645
+ - `scrypt(password: BytesLike, salt: BytesLike, N: number, r: number, p: number, dkLen: number): Promise<string>`
646
+ - `scryptSync(password: BytesLike, salt: BytesLike, N: number, r: number, p: number, dkLen: number): string`
647
+
648
+ ### Units
649
+
650
+ - `formatUnits(value: BigNumberish, decimals?: number): string`
651
+ - `parseUnits(value: string, decimals?: number): bigint`
652
+ - `formatEther(value: BigNumberish): string`
653
+ - `parseEther(value: string): bigint`
654
+
655
+ ### FixedNumber (fixed-point arithmetic)
656
+
657
+ Fixed-point decimal arithmetic compatible with ethers.js v5/v6.
658
+
659
+ **FixedFormat type:**
660
+ `number | string | { signed?: boolean, width?: number, decimals?: number }`
661
+
662
+ Default format: `"fixed128x18"` (signed, 128-bit, 18 decimals).
663
+
664
+ **Static factories:**
665
+ - `FixedNumber.fromString(value: string, format?: FixedFormat): FixedNumber`
666
+ - `FixedNumber.fromValue(value: BigNumberish, decimals?: number, format?: FixedFormat): FixedNumber`
667
+ - `FixedNumber.fromBytes(value: BytesLike, format?: FixedFormat): FixedNumber`
668
+ - `FixedNumber.from(value: any, format?: FixedFormat): FixedNumber` — dispatches to `fromString`, `fromBytes`, or `fromValue`
669
+ - `FixedNumber.isFixedNumber(value: any): boolean`
670
+
671
+ **Properties (read-only):**
672
+ - `format: string` — e.g. `"fixed128x18"`
673
+ - `signed: boolean`
674
+ - `width: number`
675
+ - `decimals: number`
676
+ - `value: bigint` — raw internal integer
677
+
678
+ **Arithmetic (safe throws on overflow, unsafe wraps silently):**
679
+ - `add(other)` / `addUnsafe(other): FixedNumber`
680
+ - `sub(other)` / `subUnsafe(other): FixedNumber`
681
+ - `mul(other)` / `mulUnsafe(other): FixedNumber`
682
+ - `div(other)` / `divUnsafe(other): FixedNumber`
683
+ - `mulSignal(other): FixedNumber` — throws on precision loss
684
+ - `divSignal(other): FixedNumber` — throws on precision loss
685
+
686
+ **Comparison:**
687
+ - `cmp(other): number` — returns `-1`, `0`, or `1`
688
+ - `eq(other)`, `lt(other)`, `lte(other)`, `gt(other)`, `gte(other): boolean`
689
+
690
+ **Rounding:**
691
+ - `floor(): FixedNumber`
692
+ - `ceiling(): FixedNumber`
693
+ - `round(decimals?: number): FixedNumber`
694
+
695
+ **Inspection:**
696
+ - `isZero(): boolean`
697
+ - `isNegative(): boolean`
698
+
699
+ **Conversion:**
700
+ - `toString(): string`
701
+ - `toUnsafeFloat(): number`
702
+ - `toFormat(format: FixedFormat): FixedNumber`
703
+ - `toHexString(width?: number): string`
704
+
705
+ ### RLP
706
+
707
+ - `encodeRlp(value: any): string`
708
+ - `decodeRlp(data: string): any`
709
+
710
+ ### `Result` and `checkResultErrors`
711
+
712
+ - `class Result extends Array`
713
+ - `new Result(items?: any[], keys?: (null|string)[])`
714
+ - `Result.fromItems(items: any[], keys?: (null|string)[]): Result`
715
+ - `getValue(name: string): any`
716
+ - `toArray(deep?: boolean | null): any[]`
717
+ - `toObject(deep?: boolean | null): Record<string, any>`
718
+ - `checkResultErrors(result: any): Array<{ error: Error, path: (string|number)[] }>`
719
+
720
+ ## Typed SDK Generator (`generate-sdk.js`)
721
+
722
+ ### Overview
723
+
724
+ `generate-sdk.js` creates **typed contract wrappers** for one or more contracts, and can optionally scaffold a complete npm package (with examples and transactional tests).
725
+
726
+ It supports generating:
727
+ - **TypeScript source** (`--lang ts`, default)
728
+ - **JavaScript source + TypeScript declarations** (`--lang js`)
729
+
730
+ **Typing behaviour (generated wrappers)**
731
+
732
+ - **Hard types**: wrapper signatures use concrete types from `quantumcoin/types` (e.g. `Uint256Like` for inputs, `Uint256` for outputs).
733
+ - **Single output unwrapping**: functions returning one value return the value directly (not `[value]`).
734
+ - **Multiple outputs**: returned as a tuple type (e.g. `Promise<[Uint256, Bool]>`).
735
+ - **No outputs**: `Promise<void>`.
736
+ - **Structs / tuples**: emitted as `export type <Name>Input` / `export type <Name>Output` and used in signatures.
737
+ - **JS typing**: JS output uses JSDoc types plus `.d.ts` files; TS users still get strong types.
738
+
739
+ **Entry point**
740
+ - `node generate-sdk.js ...`
741
+ - or `npx sdkgen ...` (when installed)
742
+
743
+ ### Input modes
744
+
745
+ 1) **ABI + BIN**
746
+
747
+ ```bash
748
+ node generate-sdk.js --abi path/to/My.abi.json --bin path/to/My.bin --name MyContract --out ./out --non-interactive
749
+
750
+ # JS output
751
+ node generate-sdk.js --lang js --abi path/to/My.abi.json --bin path/to/My.bin --name MyContract --out ./out --non-interactive
752
+ ```
753
+
754
+ 2) **Solidity sources**
755
+
756
+ ```bash
757
+ node generate-sdk.js --sol ".\\contracts\\A.sol,.\\contracts\\B.sol" --solc "c:\\solc\\solc.exe" --out ./out --non-interactive
758
+
759
+ # Pass additional solc args (example)
760
+ node generate-sdk.js --sol ".\\contracts\\A.sol" --solc "c:\\solc\\solc.exe" --solc-args "--via-ir --evm-version london" --out ./out --non-interactive
761
+ ```
762
+
763
+ 3) **Artifacts JSON (multi-contract ABI+BIN list)**
764
+
765
+ ```bash
766
+ node generate-sdk.js --artifacts-json .\\artifacts.json --out .\\out --non-interactive
767
+ ```
768
+
769
+ Example `artifacts.json`:
770
+
771
+ ```json
772
+ [
773
+ { "abi": "./Alpha.abi.json", "bin": "./Alpha.bin" },
774
+ { "abi": "./Beta.abi.json", "bin": "./Beta.bin", "name": "Beta" },
775
+ {
776
+ "name": "Gamma",
777
+ "abi": "[{\"type\":\"function\",\"name\":\"set\",\"stateMutability\":\"nonpayable\",\"inputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"outputs\":[]}]",
778
+ "bin": "0x6000600055..."
779
+ }
780
+ ]
781
+ ```
782
+
783
+ ### Package scaffolding mode
784
+
785
+ Use `--create-package` to create a full npm package (source, tests, examples, README).
786
+
787
+ ```bash
788
+ node generate-sdk.js --artifacts-json .\\artifacts.json ^
789
+ --lang ts ^
790
+ --create-package --package-dir .\\tmp --package-name my-typed-package ^
791
+ --package-description "My typed package" --package-author "me" ^
792
+ --package-license MIT --package-version 0.0.1 ^
793
+ --non-interactive
794
+ ```
795
+
796
+ ### Generated package layout
797
+
798
+ When `--create-package` is used, the generator produces:
799
+
800
+ - `src/` contract wrappers + factories
801
+ - TS mode: `*.ts` (compiled output in `dist/` after `npm run build:ts`)
802
+ - JS mode: `*.js` with `*.d.ts` types (no build step required)
803
+ - `test/e2e/*.e2e.test.js` per-contract transactional tests
804
+ - `examples/` deploy/read/write/events scripts
805
+ - `README.md` generated by the generator (includes ABI-derived API overview)
806
+ - `index.js` + `index.d.ts` (package entry shims)
807
+
808
+ **Interface contracts:** if a generated contract has empty bytecode (typically a Solidity `interface` whose `.bin` is empty, or any artifact whose `bytecode` is `null`/`undefined`/`""`/`"0x"`), the generated `test/e2e/<name>.e2e.test.js` will still deploy and validate the transaction receipt status, but will **not** assert that `provider.getCode(contract.target)` is non-empty — interfaces deploy with no runtime code by design. For concrete contracts (non-empty bytecode), the bytecode assertion is preserved. Detection is done by `_isInterfaceBytecode` in `src/generator/index.js` and is exercised by the unit tests and the `generator-interface.e2e.test.js` end-to-end test listed below.
809
+
810
+ ### Running generated transactional tests
811
+
812
+ Generated package tests broadcast transactions and require:
813
+
814
+ - `QC_RPC_URL` (RPC endpoint)
815
+ - `QC_CHAIN_ID` (optional, default `123123`)
816
+
817
+ ### Generator tests
818
+
819
+ - Unit tests:
820
+ - `test/unit/generate-contract-cli.test.js`
821
+ - `test/unit/generator.test.js`
822
+ - `test/unit/generate-sdk-artifacts-json.test.js`
823
+ - E2E generator tests (transactional; require `QC_RPC_URL` and optionally `QC_CHAIN_ID`):
824
+ - `test/e2e/typed-generator.e2e.test.js`
825
+ - `test/e2e/simple-erc20.generated-sdks.e2e.test.js`
826
+ - `test/e2e/all-solidity-types.generated-sdks.e2e.test.js`
827
+ - `test/e2e/generator-interface.e2e.test.js` (verifies that the generated test for an interface contract passes against a real chain — no `provider.getCode(...)` bytecode assertion is emitted, and the deploy + receipt-status assertions succeed end-to-end)
828
+