quantumcoin 7.0.15 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/README-SDK.md +44 -0
  2. package/README.md +1 -1
  3. package/generate-sdk.js +8 -6
  4. package/package.json +22 -4
  5. package/src/abi/interface.d.ts +133 -128
  6. package/src/abi/js-abi-coder.d.ts +8 -8
  7. package/src/constants.d.ts +61 -61
  8. package/src/contract/contract-factory.d.ts +28 -28
  9. package/src/contract/contract.d.ts +121 -113
  10. package/src/contract/index.d.ts +1 -0
  11. package/src/errors/index.d.ts +10 -2
  12. package/src/errors/index.js +1 -1
  13. package/src/generator/index.d.ts +109 -81
  14. package/src/index.d.ts +126 -123
  15. package/src/internal/event-emitter.d.ts +76 -0
  16. package/src/internal/event-emitter.js +144 -0
  17. package/src/internal/hex.d.ts +27 -4
  18. package/src/internal/hex.js +7 -3
  19. package/src/providers/extra-providers.d.ts +141 -139
  20. package/src/providers/extra-providers.js +15 -1
  21. package/src/providers/index.d.ts +18 -18
  22. package/src/providers/json-rpc-provider.d.ts +1 -0
  23. package/src/providers/provider.d.ts +233 -222
  24. package/src/providers/provider.js +1 -1
  25. package/src/utils/encoding.js +16 -4
  26. package/src/utils/fixednumber.d.ts +57 -57
  27. package/src/utils/hashing.d.ts +79 -76
  28. package/src/utils/hashing.js +68 -177
  29. package/src/utils/index.d.ts +1 -1
  30. package/src/utils/rlp.js +1 -1
  31. package/src/wallet/wallet.d.ts +54 -29
  32. package/src/wallet/wallet.js +3 -3
  33. package/.github/workflows/publish-npmjs.yaml +0 -22
  34. package/.gitignore +0 -15
  35. package/examples/AllSolidityTypes.sol +0 -184
  36. package/examples/SimpleIERC20.sol +0 -74
  37. package/examples/events.js +0 -41
  38. package/examples/events.ts +0 -35
  39. package/examples/example-generated-sdk-js/README.md +0 -65
  40. package/examples/example-generated-sdk-js/examples/_test-wallet.js +0 -17
  41. package/examples/example-generated-sdk-js/examples/deploy.js +0 -41
  42. package/examples/example-generated-sdk-js/examples/events.js +0 -36
  43. package/examples/example-generated-sdk-js/examples/read-operations.js +0 -46
  44. package/examples/example-generated-sdk-js/examples/write-operations.js +0 -44
  45. package/examples/example-generated-sdk-js/index.d.ts +0 -1
  46. package/examples/example-generated-sdk-js/index.js +0 -15
  47. package/examples/example-generated-sdk-js/package-lock.json +0 -59
  48. package/examples/example-generated-sdk-js/package.json +0 -22
  49. package/examples/example-generated-sdk-js/src/SimpleERC20.d.ts +0 -19
  50. package/examples/example-generated-sdk-js/src/SimpleERC20.js +0 -353
  51. package/examples/example-generated-sdk-js/src/SimpleERC20__factory.d.ts +0 -10
  52. package/examples/example-generated-sdk-js/src/SimpleERC20__factory.js +0 -29
  53. package/examples/example-generated-sdk-js/src/index.d.ts +0 -4
  54. package/examples/example-generated-sdk-js/src/index.js +0 -5
  55. package/examples/example-generated-sdk-js/src/quantumcoin-shims.d.ts +0 -23
  56. package/examples/example-generated-sdk-js/src/types.d.ts +0 -3
  57. package/examples/example-generated-sdk-js/src/types.js +0 -3
  58. package/examples/example-generated-sdk-js/test/e2e/SimpleERC20.e2e.test.js +0 -78
  59. package/examples/example-generated-sdk-ts/README.md +0 -65
  60. package/examples/example-generated-sdk-ts/examples/_test-wallet.js +0 -17
  61. package/examples/example-generated-sdk-ts/examples/deploy.js +0 -41
  62. package/examples/example-generated-sdk-ts/examples/events.js +0 -36
  63. package/examples/example-generated-sdk-ts/examples/read-operations.js +0 -46
  64. package/examples/example-generated-sdk-ts/examples/write-operations.js +0 -44
  65. package/examples/example-generated-sdk-ts/index.d.ts +0 -1
  66. package/examples/example-generated-sdk-ts/index.js +0 -15
  67. package/examples/example-generated-sdk-ts/package-lock.json +0 -59
  68. package/examples/example-generated-sdk-ts/package.json +0 -23
  69. package/examples/example-generated-sdk-ts/src/SimpleERC20.ts +0 -334
  70. package/examples/example-generated-sdk-ts/src/SimpleERC20__factory.ts +0 -28
  71. package/examples/example-generated-sdk-ts/src/index.ts +0 -4
  72. package/examples/example-generated-sdk-ts/src/quantumcoin-shims.d.ts +0 -23
  73. package/examples/example-generated-sdk-ts/src/types.ts +0 -4
  74. package/examples/example-generated-sdk-ts/test/e2e/SimpleERC20.e2e.test.js +0 -78
  75. package/examples/example-generated-sdk-ts/tsconfig.json +0 -14
  76. package/examples/example-generator-sdk-js.js +0 -100
  77. package/examples/example-generator-sdk-js.ts +0 -77
  78. package/examples/example-generator-sdk-ts.js +0 -100
  79. package/examples/example-generator-sdk-ts.ts +0 -77
  80. package/examples/example.js +0 -67
  81. package/examples/example.ts +0 -56
  82. package/examples/node_modules/.bin/esbuild +0 -16
  83. package/examples/node_modules/.bin/esbuild.cmd +0 -17
  84. package/examples/node_modules/.bin/esbuild.ps1 +0 -28
  85. package/examples/node_modules/.bin/sdkgen +0 -16
  86. package/examples/node_modules/.bin/sdkgen.cmd +0 -17
  87. package/examples/node_modules/.bin/sdkgen.ps1 +0 -28
  88. package/examples/node_modules/.bin/tsx +0 -16
  89. package/examples/node_modules/.bin/tsx.cmd +0 -17
  90. package/examples/node_modules/.bin/tsx.ps1 +0 -28
  91. package/examples/node_modules/.package-lock.json +0 -144
  92. package/examples/node_modules/@esbuild/win32-x64/README.md +0 -3
  93. package/examples/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
  94. package/examples/node_modules/@esbuild/win32-x64/package.json +0 -20
  95. package/examples/node_modules/esbuild/LICENSE.md +0 -21
  96. package/examples/node_modules/esbuild/README.md +0 -3
  97. package/examples/node_modules/esbuild/bin/esbuild +0 -223
  98. package/examples/node_modules/esbuild/install.js +0 -289
  99. package/examples/node_modules/esbuild/lib/main.d.ts +0 -716
  100. package/examples/node_modules/esbuild/lib/main.js +0 -2532
  101. package/examples/node_modules/esbuild/package.json +0 -49
  102. package/examples/node_modules/get-tsconfig/LICENSE +0 -21
  103. package/examples/node_modules/get-tsconfig/README.md +0 -235
  104. package/examples/node_modules/get-tsconfig/dist/index.cjs +0 -7
  105. package/examples/node_modules/get-tsconfig/dist/index.d.cts +0 -2088
  106. package/examples/node_modules/get-tsconfig/dist/index.d.mts +0 -2088
  107. package/examples/node_modules/get-tsconfig/dist/index.mjs +0 -7
  108. package/examples/node_modules/get-tsconfig/package.json +0 -46
  109. package/examples/node_modules/quantum-coin-js-sdk/LICENSE +0 -21
  110. package/examples/node_modules/quantum-coin-js-sdk/LICENSE-wasm_exec.js.txt +0 -30
  111. package/examples/node_modules/quantum-coin-js-sdk/README.md +0 -1689
  112. package/examples/node_modules/quantum-coin-js-sdk/example/README.md +0 -14
  113. package/examples/node_modules/quantum-coin-js-sdk/example/conversion-example.js +0 -19
  114. package/examples/node_modules/quantum-coin-js-sdk/example/example-create-contract.js +0 -396
  115. package/examples/node_modules/quantum-coin-js-sdk/example/example-encode-decode-rlp.js +0 -225
  116. package/examples/node_modules/quantum-coin-js-sdk/example/example-event-pack-unpack.js +0 -391
  117. package/examples/node_modules/quantum-coin-js-sdk/example/example-misc.js +0 -100
  118. package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send-signRawTransaction.js +0 -318
  119. package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send.js +0 -115
  120. package/examples/node_modules/quantum-coin-js-sdk/example/example-send.js +0 -69
  121. package/examples/node_modules/quantum-coin-js-sdk/example/example-token-pack-unpack.js +0 -960
  122. package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet-version4.js +0 -34
  123. package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet.js +0 -43
  124. package/examples/node_modules/quantum-coin-js-sdk/example/example.js +0 -405
  125. package/examples/node_modules/quantum-coin-js-sdk/example/package-lock.json +0 -56
  126. package/examples/node_modules/quantum-coin-js-sdk/example/package.json +0 -15
  127. package/examples/node_modules/quantum-coin-js-sdk/index.d.ts +0 -1047
  128. package/examples/node_modules/quantum-coin-js-sdk/index.js +0 -3182
  129. package/examples/node_modules/quantum-coin-js-sdk/package.json +0 -34
  130. package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-32.json +0 -1
  131. package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-36.json +0 -1
  132. package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-48.json +0 -1
  133. package/examples/node_modules/quantum-coin-js-sdk/tests/generate-verify-vectors.js +0 -91
  134. package/examples/node_modules/quantum-coin-js-sdk/tests/get-gas-price.test.js +0 -59
  135. package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.preinit.test.js +0 -41
  136. package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.test.js +0 -1389
  137. package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-keytype5-context-null.test.js +0 -107
  138. package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-transaction.test.js +0 -196
  139. package/examples/node_modules/quantum-coin-js-sdk/tests/sign-verify.test.js +0 -311
  140. package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.relay.test.js +0 -131
  141. package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.rpc.test.js +0 -103
  142. package/examples/node_modules/quantum-coin-js-sdk/tests/verify-vectors.json +0 -95035
  143. package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.d.ts +0 -9
  144. package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.js +0 -16
  145. package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.d.ts +0 -0
  146. package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.js +0 -587
  147. package/examples/node_modules/resolve-pkg-maps/LICENSE +0 -21
  148. package/examples/node_modules/resolve-pkg-maps/README.md +0 -216
  149. package/examples/node_modules/resolve-pkg-maps/dist/index.cjs +0 -1
  150. package/examples/node_modules/resolve-pkg-maps/dist/index.d.cts +0 -11
  151. package/examples/node_modules/resolve-pkg-maps/dist/index.d.mts +0 -11
  152. package/examples/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
  153. package/examples/node_modules/resolve-pkg-maps/package.json +0 -42
  154. package/examples/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +0 -22
  155. package/examples/node_modules/seed-words/BUILD.md +0 -7
  156. package/examples/node_modules/seed-words/LICENSE +0 -121
  157. package/examples/node_modules/seed-words/README.md +0 -67
  158. package/examples/node_modules/seed-words/dist/seedwords.d.ts +0 -39
  159. package/examples/node_modules/seed-words/package.json +0 -27
  160. package/examples/node_modules/seed-words/seedwords.js +0 -315
  161. package/examples/node_modules/seed-words/seedwords.txt +0 -65536
  162. package/examples/node_modules/seed-words/tsconfig.json +0 -21
  163. package/examples/node_modules/tsx/LICENSE +0 -21
  164. package/examples/node_modules/tsx/README.md +0 -32
  165. package/examples/node_modules/tsx/dist/cjs/api/index.cjs +0 -1
  166. package/examples/node_modules/tsx/dist/cjs/api/index.d.cts +0 -35
  167. package/examples/node_modules/tsx/dist/cjs/api/index.d.mts +0 -35
  168. package/examples/node_modules/tsx/dist/cjs/api/index.mjs +0 -1
  169. package/examples/node_modules/tsx/dist/cjs/index.cjs +0 -1
  170. package/examples/node_modules/tsx/dist/cjs/index.mjs +0 -1
  171. package/examples/node_modules/tsx/dist/cli.cjs +0 -54
  172. package/examples/node_modules/tsx/dist/cli.mjs +0 -55
  173. package/examples/node_modules/tsx/dist/client-BQVF1NaW.mjs +0 -1
  174. package/examples/node_modules/tsx/dist/client-D6NvIMSC.cjs +0 -1
  175. package/examples/node_modules/tsx/dist/esm/api/index.cjs +0 -1
  176. package/examples/node_modules/tsx/dist/esm/api/index.d.cts +0 -35
  177. package/examples/node_modules/tsx/dist/esm/api/index.d.mts +0 -35
  178. package/examples/node_modules/tsx/dist/esm/api/index.mjs +0 -1
  179. package/examples/node_modules/tsx/dist/esm/index.cjs +0 -2
  180. package/examples/node_modules/tsx/dist/esm/index.mjs +0 -2
  181. package/examples/node_modules/tsx/dist/get-pipe-path-BHW2eJdv.mjs +0 -1
  182. package/examples/node_modules/tsx/dist/get-pipe-path-BoR10qr8.cjs +0 -1
  183. package/examples/node_modules/tsx/dist/index-7AaEi15b.mjs +0 -14
  184. package/examples/node_modules/tsx/dist/index-BWFBUo6r.cjs +0 -1
  185. package/examples/node_modules/tsx/dist/index-gbaejti9.mjs +0 -1
  186. package/examples/node_modules/tsx/dist/index-gckBtVBf.cjs +0 -14
  187. package/examples/node_modules/tsx/dist/lexer-DQCqS3nf.mjs +0 -3
  188. package/examples/node_modules/tsx/dist/lexer-DgIbo0BU.cjs +0 -3
  189. package/examples/node_modules/tsx/dist/loader.cjs +0 -1
  190. package/examples/node_modules/tsx/dist/loader.mjs +0 -1
  191. package/examples/node_modules/tsx/dist/node-features-_8ZFwP_x.mjs +0 -1
  192. package/examples/node_modules/tsx/dist/node-features-roYmp9jK.cjs +0 -1
  193. package/examples/node_modules/tsx/dist/package-CeBgXWuR.mjs +0 -1
  194. package/examples/node_modules/tsx/dist/package-Dxt5kIHw.cjs +0 -1
  195. package/examples/node_modules/tsx/dist/patch-repl.cjs +0 -1
  196. package/examples/node_modules/tsx/dist/patch-repl.mjs +0 -1
  197. package/examples/node_modules/tsx/dist/preflight.cjs +0 -1
  198. package/examples/node_modules/tsx/dist/preflight.mjs +0 -1
  199. package/examples/node_modules/tsx/dist/register-2sWVXuRQ.cjs +0 -1
  200. package/examples/node_modules/tsx/dist/register-B7jrtLTO.mjs +0 -1
  201. package/examples/node_modules/tsx/dist/register-CFH5oNdT.mjs +0 -4
  202. package/examples/node_modules/tsx/dist/register-D46fvsV_.cjs +0 -4
  203. package/examples/node_modules/tsx/dist/repl.cjs +0 -3
  204. package/examples/node_modules/tsx/dist/repl.mjs +0 -3
  205. package/examples/node_modules/tsx/dist/require-D4F1Lv60.cjs +0 -1
  206. package/examples/node_modules/tsx/dist/require-DQxpCAr4.mjs +0 -1
  207. package/examples/node_modules/tsx/dist/suppress-warnings.cjs +0 -1
  208. package/examples/node_modules/tsx/dist/suppress-warnings.mjs +0 -1
  209. package/examples/node_modules/tsx/dist/temporary-directory-B83uKxJF.cjs +0 -1
  210. package/examples/node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs +0 -1
  211. package/examples/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +0 -5
  212. package/examples/node_modules/tsx/package.json +0 -68
  213. package/examples/offline-signing.js +0 -77
  214. package/examples/offline-signing.ts +0 -65
  215. package/examples/package-lock.json +0 -596
  216. package/examples/package.json +0 -32
  217. package/examples/read-operations.js +0 -32
  218. package/examples/read-operations.ts +0 -31
  219. package/examples/sdk-generator-erc20.inline.json +0 -251
  220. package/examples/solidity-types.ts +0 -43
  221. package/examples/wallet-offline.js +0 -36
  222. package/examples/wallet-offline.ts +0 -26
  223. package/scripts/copy-declarations.js +0 -31
  224. package/scripts/run-all-one-by-one.js +0 -151
  225. package/test/e2e/all-solidity-types.dynamic.test.js +0 -207
  226. package/test/e2e/all-solidity-types.dynamic.test.ts +0 -191
  227. package/test/e2e/all-solidity-types.fixtures.js +0 -231
  228. package/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +0 -387
  229. package/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +0 -350
  230. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/README.md +0 -83
  231. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/artifacts/AllSolidityTypes.abi.json +0 -12544
  232. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/artifacts/AllSolidityTypes.bin +0 -1
  233. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/_test-wallet.js +0 -17
  234. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/_test-wallet.ts +0 -10
  235. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/deploy.js +0 -41
  236. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/deploy.ts +0 -41
  237. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/events.js +0 -36
  238. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/events.ts +0 -36
  239. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/offline-signing.js +0 -82
  240. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/offline-signing.ts +0 -80
  241. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/read-operations.js +0 -46
  242. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/read-operations.ts +0 -44
  243. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/write-operations.js +0 -44
  244. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/write-operations.ts +0 -44
  245. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/index.d.ts +0 -1
  246. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/index.js +0 -21
  247. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/package-lock.json +0 -597
  248. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/package.json +0 -25
  249. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes.d.ts +0 -1280
  250. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes.js +0 -14021
  251. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes__factory.d.ts +0 -11
  252. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes__factory.js +0 -31
  253. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/index.d.ts +0 -4
  254. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/index.js +0 -5
  255. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/quantumcoin-shims.d.ts +0 -25
  256. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/types.d.ts +0 -3
  257. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/types.js +0 -3
  258. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/test/e2e/AllSolidityTypes.e2e.test.js +0 -77
  259. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/test/e2e/AllSolidityTypes.extra.test.js +0 -195
  260. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/README.md +0 -83
  261. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/artifacts/AllSolidityTypes.abi.json +0 -12544
  262. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/artifacts/AllSolidityTypes.bin +0 -1
  263. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/_test-wallet.js +0 -17
  264. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/_test-wallet.ts +0 -10
  265. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/deploy.js +0 -41
  266. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/deploy.ts +0 -41
  267. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/events.js +0 -36
  268. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/events.ts +0 -36
  269. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/offline-signing.js +0 -82
  270. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/offline-signing.ts +0 -80
  271. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/read-operations.js +0 -46
  272. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/read-operations.ts +0 -44
  273. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/write-operations.js +0 -44
  274. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/write-operations.ts +0 -44
  275. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/index.d.ts +0 -1
  276. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/index.js +0 -21
  277. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/package-lock.json +0 -597
  278. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/package.json +0 -26
  279. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/AllSolidityTypes.ts +0 -13940
  280. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/AllSolidityTypes__factory.ts +0 -31
  281. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/index.ts +0 -4
  282. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/quantumcoin-shims.d.ts +0 -25
  283. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/types.ts +0 -4
  284. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/test/e2e/AllSolidityTypes.e2e.test.js +0 -77
  285. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/test/e2e/AllSolidityTypes.extra.test.js +0 -195
  286. package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/tsconfig.json +0 -18
  287. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/README.md +0 -74
  288. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/artifacts/SimpleERC20.abi.json +0 -245
  289. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/artifacts/SimpleERC20.bin +0 -1
  290. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/_test-wallet.js +0 -17
  291. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/_test-wallet.ts +0 -10
  292. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/deploy.js +0 -41
  293. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/deploy.ts +0 -41
  294. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/events.js +0 -36
  295. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/events.ts +0 -36
  296. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/offline-signing.js +0 -82
  297. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/offline-signing.ts +0 -80
  298. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/read-operations.js +0 -46
  299. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/read-operations.ts +0 -44
  300. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/write-operations.js +0 -44
  301. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/write-operations.ts +0 -44
  302. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/index.d.ts +0 -1
  303. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/index.js +0 -16
  304. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/package-lock.json +0 -597
  305. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/package.json +0 -25
  306. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20.d.ts +0 -24
  307. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20.js +0 -378
  308. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20__factory.d.ts +0 -10
  309. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20__factory.js +0 -31
  310. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/index.d.ts +0 -4
  311. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/index.js +0 -5
  312. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/quantumcoin-shims.d.ts +0 -25
  313. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/types.d.ts +0 -3
  314. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/types.js +0 -3
  315. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/test/e2e/SimpleERC20.e2e.test.js +0 -90
  316. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/README.md +0 -74
  317. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/artifacts/SimpleERC20.abi.json +0 -245
  318. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/artifacts/SimpleERC20.bin +0 -1
  319. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/_test-wallet.js +0 -17
  320. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/_test-wallet.ts +0 -10
  321. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/deploy.js +0 -41
  322. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/deploy.ts +0 -41
  323. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/events.js +0 -36
  324. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/events.ts +0 -36
  325. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/offline-signing.js +0 -82
  326. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/offline-signing.ts +0 -80
  327. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/read-operations.js +0 -46
  328. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/read-operations.ts +0 -44
  329. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/write-operations.js +0 -44
  330. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/write-operations.ts +0 -44
  331. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/index.d.ts +0 -1
  332. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/index.js +0 -16
  333. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/package-lock.json +0 -597
  334. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/package.json +0 -26
  335. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/SimpleERC20.ts +0 -361
  336. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/SimpleERC20__factory.ts +0 -30
  337. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/index.ts +0 -4
  338. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/quantumcoin-shims.d.ts +0 -25
  339. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/types.ts +0 -4
  340. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/test/e2e/SimpleERC20.e2e.test.js +0 -90
  341. package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/tsconfig.json +0 -18
  342. package/test/e2e/generator-interface.e2e.test.js +0 -165
  343. package/test/e2e/generator-interface.e2e.test.ts +0 -160
  344. package/test/e2e/helpers.js +0 -59
  345. package/test/e2e/signing-context-and-fee.e2e.test.js +0 -141
  346. package/test/e2e/signing-context-and-fee.e2e.test.ts +0 -128
  347. package/test/e2e/simple-erc20.generated-sdks.e2e.test.js +0 -168
  348. package/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +0 -141
  349. package/test/e2e/transactional.test.js +0 -245
  350. package/test/e2e/transactional.test.ts +0 -208
  351. package/test/e2e/typed-generator.e2e.test.js +0 -407
  352. package/test/e2e/typed-generator.e2e.test.ts +0 -337
  353. package/test/fixtures/ConstructorParam.sol +0 -23
  354. package/test/fixtures/MultiContracts.sol +0 -37
  355. package/test/fixtures/SimpleStorage.sol +0 -18
  356. package/test/fixtures/StakingContract.abi.json +0 -1
  357. package/test/integration/ipc-provider.test.js +0 -49
  358. package/test/integration/ipc-provider.test.ts +0 -44
  359. package/test/integration/provider.test.js +0 -88
  360. package/test/integration/provider.test.ts +0 -85
  361. package/test/integration/ws-provider.test.js +0 -41
  362. package/test/integration/ws-provider.test.ts +0 -38
  363. package/test/security/abi-decoder-bounds.test.js +0 -122
  364. package/test/security/contract-overrides.test.js +0 -112
  365. package/test/security/generator-injection.test.js +0 -195
  366. package/test/security/malformed-input.test.js +0 -330
  367. package/test/security/malformed-input.test.ts +0 -35
  368. package/test/security/rpc-numeric-bounds.test.js +0 -81
  369. package/test/security/rpc-trust.test.js +0 -202
  370. package/test/unit/_encrypted-output.txt +0 -6
  371. package/test/unit/_log-encrypted-jsons.js +0 -45
  372. package/test/unit/_write-keystore-fixture.js +0 -16
  373. package/test/unit/abi-interface.test.js +0 -110
  374. package/test/unit/abi-interface.test.ts +0 -109
  375. package/test/unit/address-wallet.test.js +0 -945
  376. package/test/unit/address-wallet.test.ts +0 -899
  377. package/test/unit/browser-provider.test.js +0 -85
  378. package/test/unit/browser-provider.test.ts +0 -79
  379. package/test/unit/contract.test.js +0 -85
  380. package/test/unit/contract.test.ts +0 -83
  381. package/test/unit/encoding-units-rlp.test.js +0 -127
  382. package/test/unit/encoding-units-rlp.test.ts +0 -91
  383. package/test/unit/errors.test.js +0 -77
  384. package/test/unit/errors.test.ts +0 -76
  385. package/test/unit/filter-by-blockhash.test.js +0 -55
  386. package/test/unit/filter-by-blockhash.test.ts +0 -54
  387. package/test/unit/fixednumber.test.js +0 -656
  388. package/test/unit/fixednumber.test.ts +0 -660
  389. package/test/unit/fixtures/encrypted-keystores-48-32-36.js +0 -9
  390. package/test/unit/generate-contract-cli.test.js +0 -42
  391. package/test/unit/generate-contract-cli.test.ts +0 -41
  392. package/test/unit/generate-sdk-artifacts-json.test.js +0 -113
  393. package/test/unit/generate-sdk-artifacts-json.test.ts +0 -110
  394. package/test/unit/generator.test.js +0 -149
  395. package/test/unit/generator.test.ts +0 -148
  396. package/test/unit/hashing.test.js +0 -64
  397. package/test/unit/hashing.test.ts +0 -63
  398. package/test/unit/init.test.js +0 -39
  399. package/test/unit/init.test.ts +0 -38
  400. package/test/unit/interface.test.js +0 -56
  401. package/test/unit/interface.test.ts +0 -54
  402. package/test/unit/internal-hex.test.js +0 -81
  403. package/test/unit/internal-hex.test.ts +0 -80
  404. package/test/unit/populate-transaction.test.js +0 -98
  405. package/test/unit/populate-transaction.test.ts +0 -64
  406. package/test/unit/providers.test.js +0 -305
  407. package/test/unit/providers.test.ts +0 -304
  408. package/test/unit/result.test.js +0 -80
  409. package/test/unit/result.test.ts +0 -79
  410. package/test/unit/solidity-types.test.js +0 -49
  411. package/test/unit/solidity-types.test.ts +0 -39
  412. package/test/unit/utils.test.js +0 -57
  413. package/test/unit/utils.test.ts +0 -56
  414. package/test/verbose-logger.js +0 -74
  415. package/tsconfig.build.json +0 -14
@@ -1,337 +0,0 @@
1
- /**
2
- * @testCategory e2e
3
- * @blockchainRequired write
4
- * @transactional true
5
- * End-to-end test for the typed contract generator.
6
- */
7
-
8
- import { describe, it } from "node:test";
9
- import assert from "node:assert/strict";
10
- import fs from "node:fs";
11
- import path from "node:path";
12
- import os from "node:os";
13
- import { execFileSync, spawnSync } from "node:child_process";
14
-
15
- import { getRpcUrl, getChainId, getSolcPath, assertSolcExists, logE2eConfig } from "./helpers";
16
- import { logSuite, logTest } from "../verbose-logger";
17
-
18
- function getNpmCmd(): string {
19
- return process.platform === "win32" ? "npm.cmd" : "npm";
20
- }
21
-
22
- function run(cmd: string, args: string[], cwd: string, env: NodeJS.ProcessEnv): { status: number | null; stdout: string; stderr: string; error?: Error } {
23
- const res = spawnSync(cmd, args, {
24
- cwd,
25
- env,
26
- encoding: "utf8",
27
- stdio: "pipe",
28
- shell: false,
29
- windowsHide: true,
30
- });
31
- if (res.error) throw res.error;
32
- return res;
33
- }
34
-
35
- function _quoteIfNeeded(s: unknown): string {
36
- if (typeof s !== "string") return String(s);
37
- return /[ \t"]/g.test(s) ? `"${s.replace(/"/g, '\\"')}"` : s;
38
- }
39
-
40
- function runNpm(args: string[], cwd: string, env: NodeJS.ProcessEnv) {
41
- if (process.platform === "win32") {
42
- const cmd = `${getNpmCmd()} ${args.map(_quoteIfNeeded).join(" ")}`;
43
- return run("cmd.exe", ["/d", "/s", "/c", cmd], cwd, env);
44
- }
45
- return run(getNpmCmd(), args, cwd, env);
46
- }
47
-
48
- function compileSolidity({ solcPath, solPath, contractName }: { solcPath: string; solPath: string; contractName: string }) {
49
- const out = execFileSync(solcPath, ["--optimize", "--combined-json", "abi,bin", solPath], { encoding: "utf8" });
50
- const parsed = JSON.parse(out);
51
- const key = Object.keys(parsed.contracts || {}).find((k) => k.endsWith(`:${contractName}`));
52
- if (!key) throw new Error(`Compiled contract ${contractName} not found in solc output`);
53
- const c = parsed.contracts[key];
54
- const abi = JSON.parse(c.abi);
55
- const bin = c.bin || "";
56
- return { abi, bin };
57
- }
58
-
59
- describe("typed contract generator package e2e", () => {
60
- it("generates a package and runs its transactional tests", async (t: { skip: (msg: string) => void }) => {
61
- logSuite("typed contract generator package e2e");
62
- logTest("generates a package and runs its transactional tests", {});
63
- const rpcUrl = getRpcUrl();
64
- if (!rpcUrl) {
65
- t.skip("QC_RPC_URL not provided");
66
- return;
67
- }
68
- logE2eConfig();
69
- const chainId = getChainId();
70
- const solcPath = getSolcPath();
71
- assertSolcExists(solcPath);
72
-
73
- const repoRoot = path.resolve(__dirname, "..", "..");
74
- const fixtureSol = path.join(repoRoot, "test", "fixtures", "ConstructorParam.sol");
75
- const contractName = "ConstructorParam";
76
-
77
- const tmpBase = fs.mkdtempSync(path.join(os.tmpdir(), "qcgen-"));
78
- const pkgName = `qcgen-${Date.now()}`;
79
- const pkgDir = tmpBase;
80
- const pkgRoot = path.join(pkgDir, pkgName);
81
-
82
- let succeeded = false;
83
- try {
84
- const { abi, bin } = compileSolidity({ solcPath, solPath: fixtureSol, contractName });
85
-
86
- const abiPath = path.join(tmpBase, `${contractName}.abi.json`);
87
- const binPath = path.join(tmpBase, `${contractName}.bin`);
88
- fs.writeFileSync(abiPath, JSON.stringify(abi, null, 2), "utf8");
89
- fs.writeFileSync(binPath, bin.trim().startsWith("0x") ? bin.trim() : `0x${bin.trim()}`, "utf8");
90
-
91
- const generatorCli = path.join(repoRoot, "generate-sdk.js");
92
- const gen = run(
93
- process.execPath,
94
- [
95
- generatorCli,
96
- "--abi", abiPath,
97
- "--bin", binPath,
98
- "--name", contractName,
99
- "--create-package",
100
- "--package-dir", pkgDir,
101
- "--package-name", pkgName,
102
- "--package-description", "Temporary typed-contract package generated by quantumcoin.js e2e tests",
103
- "--package-author", "quantumcoin.js test",
104
- "--package-license", "MIT",
105
- "--package-version", "0.0.1",
106
- "--non-interactive",
107
- ],
108
- repoRoot,
109
- process.env,
110
- );
111
- assert.equal(gen.status, 0, `generator failed:\n${gen.stdout}\n${gen.stderr}`);
112
-
113
- assert.ok(fs.existsSync(path.join(pkgRoot, "package.json")));
114
- assert.ok(fs.existsSync(path.join(pkgRoot, "tsconfig.json")));
115
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", `${contractName}.ts`)));
116
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", `${contractName}__factory.ts`)));
117
- assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", `${contractName}.e2e.test.js`)));
118
- assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "deploy.js")));
119
- assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "read-operations.js")));
120
- assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "write-operations.js")));
121
- assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "events.js")));
122
- assert.ok(fs.existsSync(path.join(pkgRoot, "index.js")));
123
- assert.ok(fs.existsSync(path.join(pkgRoot, "index.d.ts")));
124
- assert.ok(fs.existsSync(path.join(pkgRoot, "README.md")));
125
-
126
- const readme = fs.readFileSync(path.join(pkgRoot, "README.md"), "utf8");
127
- assert.ok(readme.includes(contractName));
128
-
129
- if (!fs.existsSync(path.join(pkgRoot, "node_modules"))) {
130
- const install = runNpm(["install", "--no-fund", "--no-audit"], pkgRoot, process.env);
131
- assert.equal(install.status, 0, `npm install failed:\n${install.stdout}\n${install.stderr}`);
132
- }
133
-
134
- const env = { ...process.env, QC_RPC_URL: rpcUrl, QC_CHAIN_ID: String(chainId) };
135
- const testRun = runNpm(["test"], pkgRoot, env);
136
- assert.equal(testRun.status, 0, `generated package tests failed:\n${testRun.stdout}\n${testRun.stderr}`);
137
-
138
- succeeded = true;
139
- } finally {
140
- if (succeeded) {
141
- fs.rmSync(tmpBase, { recursive: true, force: true });
142
- } else {
143
- console.error("Generated package kept at:", pkgRoot);
144
- }
145
- }
146
- }, { timeout: 1_800_000 });
147
-
148
- it("generates a package from artifacts JSON input (multiple contracts) and runs its transactional tests", async (t: { skip: (msg: string) => void }) => {
149
- const rpcUrl = getRpcUrl();
150
- if (!rpcUrl) {
151
- t.skip("QC_RPC_URL not provided");
152
- return;
153
- }
154
-
155
- const chainId = getChainId();
156
- const solcPath = getSolcPath();
157
- assertSolcExists(solcPath);
158
-
159
- const repoRoot = path.resolve(__dirname, "..", "..");
160
- const fixtureCtorSol = path.join(repoRoot, "test", "fixtures", "ConstructorParam.sol");
161
- const fixtureMultiSol = path.join(repoRoot, "test", "fixtures", "MultiContracts.sol");
162
-
163
- const tmpBase = fs.mkdtempSync(path.join(os.tmpdir(), "qcgen-json-"));
164
- const pkgName = `qcgen-json-${Date.now()}`;
165
- const pkgDir = tmpBase;
166
- const pkgRoot = path.join(pkgDir, pkgName);
167
-
168
- let succeeded = false;
169
- try {
170
- const ctorName = "ConstructorParam";
171
- const alphaName = "Alpha";
172
-
173
- const { abi: ctorAbi, bin: ctorBin } = compileSolidity({ solcPath, solPath: fixtureCtorSol, contractName: ctorName });
174
- const { abi: alphaAbi, bin: alphaBin } = compileSolidity({ solcPath, solPath: fixtureMultiSol, contractName: alphaName });
175
-
176
- const ctorAbiPath = path.join(tmpBase, `${ctorName}.abi.json`);
177
- const ctorBinPath = path.join(tmpBase, `${ctorName}.bin`);
178
- fs.writeFileSync(ctorAbiPath, JSON.stringify(ctorAbi, null, 2), "utf8");
179
- fs.writeFileSync(ctorBinPath, ctorBin.trim().startsWith("0x") ? ctorBin.trim() : `0x${ctorBin.trim()}`, "utf8");
180
-
181
- const alphaAbiPath = path.join(tmpBase, `${alphaName}.abi.json`);
182
- const alphaBinPath = path.join(tmpBase, `${alphaName}.bin`);
183
- fs.writeFileSync(alphaAbiPath, JSON.stringify(alphaAbi, null, 2), "utf8");
184
- fs.writeFileSync(alphaBinPath, alphaBin.trim().startsWith("0x") ? alphaBin.trim() : `0x${alphaBin.trim()}`, "utf8");
185
-
186
- const artifactsJsonPath = path.join(tmpBase, "artifacts.json");
187
- fs.writeFileSync(
188
- artifactsJsonPath,
189
- JSON.stringify(
190
- [
191
- { abi: path.basename(alphaAbiPath), bin: path.basename(alphaBinPath) },
192
- { abi: path.basename(ctorAbiPath), bin: path.basename(ctorBinPath) },
193
- ],
194
- null,
195
- 2,
196
- ),
197
- "utf8",
198
- );
199
-
200
- const generatorCli = path.join(repoRoot, "generate-sdk.js");
201
- const gen = run(
202
- process.execPath,
203
- [
204
- generatorCli,
205
- "--artifacts-json", artifactsJsonPath,
206
- "--create-package",
207
- "--package-dir", pkgDir,
208
- "--package-name", pkgName,
209
- "--package-description", "Temporary typed-contract package generated from artifacts JSON input",
210
- "--package-author", "quantumcoin.js test",
211
- "--package-license", "MIT",
212
- "--package-version", "0.0.1",
213
- "--non-interactive",
214
- ],
215
- repoRoot,
216
- process.env,
217
- );
218
- assert.equal(gen.status, 0, `generator failed:\n${gen.stdout}\n${gen.stderr}`);
219
-
220
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha.ts")));
221
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha__factory.ts")));
222
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "ConstructorParam.ts")));
223
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "ConstructorParam__factory.ts")));
224
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "index.ts")));
225
- assert.ok(fs.existsSync(path.join(pkgRoot, "index.js")));
226
- assert.ok(fs.existsSync(path.join(pkgRoot, "index.d.ts")));
227
- assert.ok(fs.existsSync(path.join(pkgRoot, "README.md")));
228
- assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "Alpha.e2e.test.js")));
229
- assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "ConstructorParam.e2e.test.js")));
230
- assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "all-contracts.e2e.test.js")));
231
- assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "deploy-Alpha.js")));
232
- assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "deploy-ConstructorParam.js")));
233
-
234
- const readme = fs.readFileSync(path.join(pkgRoot, "README.md"), "utf8");
235
- assert.ok(readme.includes("Alpha"));
236
- assert.ok(readme.includes("ConstructorParam"));
237
-
238
- if (!fs.existsSync(path.join(pkgRoot, "node_modules"))) {
239
- const install = runNpm(["install", "--no-fund", "--no-audit"], pkgRoot, process.env);
240
- assert.equal(install.status, 0, `npm install failed:\n${install.stdout}\n${install.stderr}`);
241
- }
242
-
243
- const env = { ...process.env, QC_RPC_URL: rpcUrl, QC_CHAIN_ID: String(chainId) };
244
- const testRun = runNpm(["test"], pkgRoot, env);
245
- assert.equal(testRun.status, 0, `generated package tests failed:\n${testRun.stdout}\n${testRun.stderr}`);
246
-
247
- succeeded = true;
248
- } finally {
249
- if (succeeded) {
250
- fs.rmSync(tmpBase, { recursive: true, force: true });
251
- } else {
252
- console.error("Generated package kept at:", pkgRoot);
253
- }
254
- }
255
- }, { timeout: 1_800_000 });
256
-
257
- it("generates a package from Solidity input (multiple contracts) and runs its transactional tests", async (t: { skip: (msg: string) => void }) => {
258
- const rpcUrl = getRpcUrl();
259
- if (!rpcUrl) {
260
- t.skip("QC_RPC_URL not provided");
261
- return;
262
- }
263
-
264
- const chainId = getChainId();
265
- const solcPath = getSolcPath();
266
- assertSolcExists(solcPath);
267
-
268
- const repoRoot = path.resolve(__dirname, "..", "..");
269
- const fixtureSol = path.join(repoRoot, "test", "fixtures", "MultiContracts.sol");
270
-
271
- const tmpBase = fs.mkdtempSync(path.join(os.tmpdir(), "qcgen-sol-"));
272
- const pkgName = `qcgen-sol-${Date.now()}`;
273
- const pkgDir = tmpBase;
274
- const pkgRoot = path.join(pkgDir, pkgName);
275
-
276
- let succeeded = false;
277
- try {
278
- const generatorCli = path.join(repoRoot, "generate-sdk.js");
279
- const gen = run(
280
- process.execPath,
281
- [
282
- generatorCli,
283
- "--sol", fixtureSol,
284
- "--solc", solcPath,
285
- "--create-package",
286
- "--package-dir", pkgDir,
287
- "--package-name", pkgName,
288
- "--package-description", "Temporary typed-contract package generated from Solidity input",
289
- "--package-author", "quantumcoin.js test",
290
- "--package-license", "MIT",
291
- "--package-version", "0.0.1",
292
- "--non-interactive",
293
- ],
294
- repoRoot,
295
- process.env,
296
- );
297
- assert.equal(gen.status, 0, `generator failed:\n${gen.stdout}\n${gen.stderr}`);
298
-
299
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha.ts")));
300
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha__factory.ts")));
301
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Beta.ts")));
302
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Beta__factory.ts")));
303
- assert.ok(fs.existsSync(path.join(pkgRoot, "src", "index.ts")));
304
- assert.ok(fs.existsSync(path.join(pkgRoot, "index.js")));
305
- assert.ok(fs.existsSync(path.join(pkgRoot, "index.d.ts")));
306
- assert.ok(fs.existsSync(path.join(pkgRoot, "README.md")));
307
- assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Alpha.abi.json")));
308
- assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Alpha.bin")));
309
- assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Beta.abi.json")));
310
- assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Beta.bin")));
311
- assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "Alpha.e2e.test.js")));
312
- assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "Beta.e2e.test.js")));
313
- assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "all-contracts.e2e.test.js")));
314
-
315
- const alphaTs = fs.readFileSync(path.join(pkgRoot, "src", "Alpha.ts"), "utf8");
316
- assert.ok(alphaTs.includes("Alpha contract for multi-contract generator test."));
317
- assert.ok(alphaTs.includes("Set a new value in Alpha."));
318
-
319
- if (!fs.existsSync(path.join(pkgRoot, "node_modules"))) {
320
- const install = runNpm(["install", "--no-fund", "--no-audit"], pkgRoot, process.env);
321
- assert.equal(install.status, 0, `npm install failed:\n${install.stdout}\n${install.stderr}`);
322
- }
323
-
324
- const env = { ...process.env, QC_RPC_URL: rpcUrl, QC_CHAIN_ID: String(chainId) };
325
- const testRun = runNpm(["test"], pkgRoot, env);
326
- assert.equal(testRun.status, 0, `generated package tests failed:\n${testRun.stdout}\n${testRun.stderr}`);
327
-
328
- succeeded = true;
329
- } finally {
330
- if (succeeded) {
331
- fs.rmSync(tmpBase, { recursive: true, force: true });
332
- } else {
333
- console.error("Generated package kept at:", pkgRoot);
334
- }
335
- }
336
- }, { timeout: 1_800_000 });
337
- });
@@ -1,23 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
3
-
4
- /**
5
- * @title ConstructorParam
6
- * @notice Example contract used by generator E2E tests.
7
- */
8
- contract ConstructorParam {
9
- uint256 public value;
10
-
11
- event ValueChanged(uint256 newValue);
12
-
13
- constructor(uint256 initialValue) {
14
- value = initialValue;
15
- }
16
-
17
- /// @notice Set a new stored value.
18
- function set(uint256 newValue) public {
19
- value = newValue;
20
- emit ValueChanged(newValue);
21
- }
22
- }
23
-
@@ -1,37 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
3
-
4
- /**
5
- * @title Alpha
6
- * @notice Alpha contract for multi-contract generator test.
7
- */
8
- contract Alpha {
9
- uint256 public value;
10
-
11
- constructor(uint256 initialValue) {
12
- value = initialValue;
13
- }
14
-
15
- /// @notice Set a new value in Alpha.
16
- function set(uint256 newValue) public {
17
- value = newValue;
18
- }
19
- }
20
-
21
- /**
22
- * @title Beta
23
- * @notice Beta contract for multi-contract generator test.
24
- */
25
- contract Beta {
26
- uint256 public value;
27
-
28
- constructor(uint256 initialValue) {
29
- value = initialValue;
30
- }
31
-
32
- /// @notice Set a new value in Beta.
33
- function set(uint256 newValue) public {
34
- value = newValue;
35
- }
36
- }
37
-
@@ -1,18 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
3
-
4
- contract SimpleStorage {
5
- uint256 private storedValue;
6
-
7
- event ValueChanged(uint256 newValue);
8
-
9
- function set(uint256 value) public {
10
- storedValue = value;
11
- emit ValueChanged(value);
12
- }
13
-
14
- function get() public view returns (uint256) {
15
- return storedValue;
16
- }
17
- }
18
-
@@ -1 +0,0 @@
1
- [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"oldValidatorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newValidatorAddress","type":"address"}],"name":"OnChangeValidator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawalQuantity","type":"uint256"}],"name":"OnCompletePartialWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"netBalance","type":"uint256"}],"name":"OnCompleteWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"OnIncreaseDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawalBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"withdrawalQuantity","type":"uint256"}],"name":"OnInitiatePartialWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"validatorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTime","type":"uint256"}],"name":"OnNewDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"address","name":"validatorAddress","type":"address"}],"name":"OnPauseValidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"address","name":"validatorAddress","type":"address"}],"name":"OnResumeValidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"OnReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"slashedAmount","type":"uint256"}],"name":"OnSlashing","type":"event"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"addDepositorReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"},{"internalType":"uint256","name":"slashAmount","type":"uint256"}],"name":"addDepositorSlashing","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValidatorAddress","type":"address"}],"name":"changeValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"completePartialWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"completeWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"didDepositorEverExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"didValidatorEverExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"doesDepositorExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"doesValidatorExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getBalanceOfDepositor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDepositorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"getDepositorOfValidator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getDepositorRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getDepositorSlashings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getNetBalanceOfDepositor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"getStakingDetails","outputs":[{"components":[{"internalType":"address","name":"Depositor","type":"address"},{"internalType":"address","name":"Validator","type":"address"},{"internalType":"uint256","name":"Balance","type":"uint256"},{"internalType":"uint256","name":"NetBalance","type":"uint256"},{"internalType":"uint256","name":"BlockRewards","type":"uint256"},{"internalType":"uint256","name":"Slashings","type":"uint256"},{"internalType":"bool","name":"IsValidationPaused","type":"bool"},{"internalType":"uint256","name":"WithdrawalBlock","type":"uint256"},{"internalType":"uint256","name":"WithdrawalAmount","type":"uint256"},{"internalType":"uint256","name":"LastNilBlockNumber","type":"uint256"},{"internalType":"uint256","name":"NilBlockCount","type":"uint256"}],"internalType":"struct IStakingContract.StakingDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalDepositedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getValidatorOfDepositor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getWithdrawalBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increaseDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"initiatePartialWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"isValidationPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listValidators","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"newDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pauseValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"resetNilBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resumeValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"setNilBlock","outputs":[],"stateMutability":"nonpayable","type":"function"}]
@@ -1,49 +0,0 @@
1
- /**
2
- * @testCategory integration
3
- * @blockchainRequired readonly
4
- * @transactional false
5
- * @description Read-only IPC JSON-RPC integration tests against a local geth IPC endpoint
6
- * Run with VERBOSE=1 for test names, block number/hash.
7
- */
8
-
9
- const { describe, it } = require("node:test");
10
- const assert = require("node:assert/strict");
11
-
12
- const qc = require("../../index");
13
- const { logSuite, logTest } = require("../verbose-logger");
14
-
15
- const IPC = process.env.QC_ENDPOINT || process.env.QC_IPC_PATH || "\\\\.\\pipe\\geth.ipc";
16
-
17
- describe("IpcSocketProvider (readonly)", () => {
18
- it("getBlockNumber and getBlock('latest') work over IPC", async (t) => {
19
- logSuite("IpcSocketProvider (readonly)");
20
- logTest("getBlockNumber and getBlock('latest') work over IPC", { endpoint: IPC });
21
- const provider = qc.getProvider(IPC);
22
- try {
23
- const bn = await provider.getBlockNumber();
24
- logTest("getBlockNumber (ipc)", { blockNumber: bn });
25
- assert.ok(Number.isInteger(bn) && bn >= 0);
26
-
27
- const latest = await provider.getBlock("latest");
28
- logTest("getBlock('latest') (ipc)", { blockNumber: latest.number, blockHash: latest.hash });
29
- assert.ok(latest && typeof latest === "object");
30
- assert.ok(typeof latest.number === "number" && latest.number >= bn);
31
- // best-effort sanity: hash often exists on latest blocks
32
- assert.ok(latest.hash == null || typeof latest.hash === "string");
33
-
34
- // Print a JSON-safe summary (avoid circular refs like latest.provider)
35
- const latestSummary = {
36
- number: latest.number,
37
- hash: latest.hash,
38
- parentHash: latest.parentHash,
39
- timestamp: latest.timestamp,
40
- transactionsCount: Array.isArray(latest.transactions) ? latest.transactions.length : null,
41
- };
42
- // This shows up in TAP output as "# ..."
43
- console.log("IPC latest block:", JSON.stringify(latestSummary));
44
- } catch (e) {
45
- t.skip(`IPC endpoint unavailable (${IPC}): ${e && e.message ? e.message : String(e)}`);
46
- }
47
- });
48
- });
49
-
@@ -1,44 +0,0 @@
1
- /**
2
- * @testCategory integration
3
- * @blockchainRequired readonly
4
- * @transactional false
5
- * @description Read-only IPC JSON-RPC integration tests against a local geth IPC endpoint
6
- */
7
-
8
- import { describe, it } from "node:test";
9
- import assert from "node:assert/strict";
10
-
11
- import qc from "../../index";
12
- import { logSuite, logTest } from "../verbose-logger";
13
-
14
- const IPC = process.env.QC_ENDPOINT || process.env.QC_IPC_PATH || "\\\\.\\pipe\\geth.ipc";
15
-
16
- describe("IpcSocketProvider (readonly)", () => {
17
- it("getBlockNumber and getBlock('latest') work over IPC", async (t: { skip: (msg: string) => void }) => {
18
- logSuite("IpcSocketProvider (readonly)");
19
- logTest("getBlockNumber and getBlock('latest') work over IPC", { endpoint: IPC });
20
- const provider = qc.getProvider(IPC);
21
- try {
22
- const bn = await provider.getBlockNumber();
23
- logTest("getBlockNumber (ipc)", { blockNumber: bn });
24
- assert.ok(Number.isInteger(bn) && bn >= 0);
25
-
26
- const latest = await provider.getBlock("latest");
27
- logTest("getBlock('latest') (ipc)", { blockNumber: latest.number, blockHash: latest.hash });
28
- assert.ok(latest && typeof latest === "object");
29
- assert.ok(typeof latest.number === "number" && latest.number >= bn);
30
- assert.ok(latest.hash == null || typeof latest.hash === "string");
31
-
32
- const latestSummary = {
33
- number: latest.number,
34
- hash: latest.hash,
35
- parentHash: latest.parentHash,
36
- timestamp: latest.timestamp,
37
- transactionsCount: Array.isArray(latest.transactions) ? latest.transactions.length : null,
38
- };
39
- console.log("IPC latest block:", JSON.stringify(latestSummary));
40
- } catch (e) {
41
- t.skip(`IPC endpoint unavailable (${IPC}): ${e && (e as Error).message ? (e as Error).message : String(e)}`);
42
- }
43
- });
44
- });
@@ -1,88 +0,0 @@
1
- /**
2
- * @testCategory integration
3
- * @blockchainRequired readonly
4
- * @transactional false
5
- * @description Read-only integration tests. Endpoint from QC_ENDPOINT or QC_RPC_URL (default: public RPC).
6
- * Works with HTTP, WebSocket, or IPC; use QC_ENDPOINT=\\.\pipe\geth.ipc to run over IPC.
7
- * Run with VERBOSE=1 or QC_VERBOSE=1 for test names, addresses, block numbers.
8
- */
9
-
10
- const { describe, it } = require("node:test");
11
- const assert = require("node:assert/strict");
12
-
13
- const { Initialize } = require("../../config");
14
- const qc = require("../../index");
15
- const { logSuite, logTest, logAddress } = require("../verbose-logger");
16
-
17
- const DEFAULT_RPC = "https://public.rpc.quantumcoinapi.com";
18
- const CHAIN_ID = 123123;
19
- const STAKING_CONTRACT = "0x" + "00".repeat(30) + "10" + "00"; // ...1000 (32-byte address)
20
-
21
- const ENDPOINT = process.env.QC_ENDPOINT || process.env.QC_RPC_URL || DEFAULT_RPC;
22
- const isPublicRpc = ENDPOINT === DEFAULT_RPC;
23
-
24
- describe("Provider (readonly)", () => {
25
- it("getBlockNumber returns a block number", async (t) => {
26
- logSuite("Provider (readonly)");
27
- logTest("getBlockNumber returns a block number", { endpoint: ENDPOINT, chainId: CHAIN_ID });
28
- const provider = qc.getProvider(ENDPOINT, CHAIN_ID);
29
- try {
30
- const bn = await provider.getBlockNumber();
31
- logTest("getBlockNumber returns a block number", { blockNumber: bn });
32
- assert.ok(Number.isInteger(bn) && bn >= 0);
33
- if (isPublicRpc) assert.ok(bn > 3000000, "public chain height");
34
- } catch (e) {
35
- t.skip(`network unavailable: ${e && e.message ? e.message : String(e)}`);
36
- }
37
- });
38
-
39
- it("getBlock('latest') works", async (t) => {
40
- logTest("getBlock('latest') works", {});
41
- const provider = qc.getProvider(ENDPOINT, CHAIN_ID);
42
- try {
43
- const latest = await provider.getBlockNumber();
44
- const block = await provider.getBlock("latest");
45
- logTest("getBlock('latest') works", { blockNumber: block.number, blockHash: block.hash });
46
- assert.ok(block && typeof block === "object");
47
- assert.ok(typeof block.number === "number" && block.number >= latest);
48
- if (isPublicRpc && latest >= 3386000) {
49
- const b = await provider.getBlock(3386000);
50
- assert.equal(b.number, 3386000);
51
- }
52
- } catch (e) {
53
- t.skip(`network unavailable: ${e && e.message ? e.message : String(e)}`);
54
- }
55
- });
56
-
57
- it("getBalance works for an address", async (t) => {
58
- logTest("getBalance works for an address", {});
59
- logAddress("staking_contract", STAKING_CONTRACT);
60
- const provider = qc.getProvider(ENDPOINT, CHAIN_ID);
61
- try {
62
- const bal = await provider.getBalance(STAKING_CONTRACT);
63
- logTest("getBalance works for an address", { balance: bal.toString() });
64
- assert.equal(typeof bal, "bigint");
65
- assert.ok(bal >= 0n);
66
- } catch (e) {
67
- t.skip(`network unavailable: ${e && e.message ? e.message : String(e)}`);
68
- }
69
- });
70
-
71
- it("contract read operations work (staking contract when available)", async (t) => {
72
- logTest("contract read operations work (staking contract when available)", {});
73
- logAddress("staking_contract", STAKING_CONTRACT);
74
- await Initialize(null);
75
- const provider = qc.getProvider(ENDPOINT, CHAIN_ID);
76
- try {
77
- const abi = require("../fixtures/StakingContract.abi.json");
78
- const contract = new qc.Contract(STAKING_CONTRACT, abi, provider);
79
- const count = await contract.getDepositorCount();
80
- const value = Array.isArray(count) ? count[0] : count;
81
- logTest("contract read operations work", { depositorCount: value != null ? String(value) : null });
82
- assert.ok(value != null);
83
- } catch (e) {
84
- t.skip(`network/ABI unavailable: ${e && e.message ? e.message : String(e)}`);
85
- }
86
- });
87
- });
88
-