quantumcoin 7.0.2 → 7.0.4

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 (155) hide show
  1. package/.github/workflows/publish-npmjs.yaml +22 -22
  2. package/.gitignore +15 -15
  3. package/LICENSE +21 -21
  4. package/README-SDK.md +756 -756
  5. package/README.md +165 -152
  6. package/SPEC.md +3845 -3845
  7. package/config.d.ts +50 -50
  8. package/config.js +115 -115
  9. package/examples/AllSolidityTypes.sol +184 -184
  10. package/examples/SimpleIERC20.sol +74 -74
  11. package/examples/events.js +41 -35
  12. package/examples/events.ts +35 -0
  13. package/examples/example-generator-sdk-js.js +100 -95
  14. package/examples/example-generator-sdk-js.ts +77 -0
  15. package/examples/example-generator-sdk-ts.js +100 -95
  16. package/examples/example-generator-sdk-ts.ts +77 -0
  17. package/examples/example.js +72 -61
  18. package/examples/example.ts +61 -0
  19. package/examples/offline-signing.js +79 -0
  20. package/examples/offline-signing.ts +66 -0
  21. package/examples/package-lock.json +48 -57
  22. package/examples/package.json +32 -16
  23. package/examples/read-operations.js +32 -27
  24. package/examples/read-operations.ts +31 -0
  25. package/examples/sdk-generator-erc20.inline.json +251 -251
  26. package/examples/solidity-types.ts +43 -43
  27. package/examples/wallet-offline.js +35 -29
  28. package/examples/wallet-offline.ts +34 -0
  29. package/generate-sdk.js +1824 -1383
  30. package/index.js +12 -12
  31. package/package.json +95 -75
  32. package/scripts/copy-declarations.js +31 -0
  33. package/scripts/run-all-one-by-one.js +151 -0
  34. package/src/abi/fragments.d.ts +42 -42
  35. package/src/abi/fragments.js +63 -63
  36. package/src/abi/index.d.ts +13 -13
  37. package/src/abi/index.js +9 -9
  38. package/src/abi/interface.d.ts +128 -132
  39. package/src/abi/interface.js +590 -590
  40. package/src/abi/js-abi-coder.d.ts +8 -0
  41. package/src/abi/js-abi-coder.js +474 -474
  42. package/src/constants.d.ts +66 -61
  43. package/src/constants.js +101 -94
  44. package/src/contract/contract-factory.d.ts +28 -28
  45. package/src/contract/contract-factory.js +105 -105
  46. package/src/contract/contract.d.ts +113 -105
  47. package/src/contract/contract.js +354 -312
  48. package/src/contract/index.d.ts +9 -9
  49. package/src/contract/index.js +9 -9
  50. package/src/errors/index.d.ts +92 -92
  51. package/src/errors/index.js +188 -188
  52. package/src/generator/index.d.ts +74 -0
  53. package/src/generator/index.js +1404 -1201
  54. package/src/index.d.ts +125 -127
  55. package/src/index.js +41 -41
  56. package/src/internal/hex.d.ts +61 -61
  57. package/src/internal/hex.js +144 -144
  58. package/src/providers/extra-providers.d.ts +139 -128
  59. package/src/providers/extra-providers.js +600 -575
  60. package/src/providers/index.d.ts +17 -16
  61. package/src/providers/index.js +10 -10
  62. package/src/providers/json-rpc-provider.d.ts +12 -12
  63. package/src/providers/json-rpc-provider.js +79 -79
  64. package/src/providers/provider.d.ts +207 -196
  65. package/src/providers/provider.js +392 -359
  66. package/src/types/index.d.ts +214 -462
  67. package/src/types/index.js +9 -9
  68. package/src/utils/address.d.ts +72 -72
  69. package/src/utils/address.js +181 -182
  70. package/src/utils/encoding.d.ts +120 -120
  71. package/src/utils/encoding.js +306 -306
  72. package/src/utils/hashing.d.ts +82 -76
  73. package/src/utils/hashing.js +313 -298
  74. package/src/utils/index.d.ts +65 -55
  75. package/src/utils/index.js +13 -13
  76. package/src/utils/result.d.ts +57 -57
  77. package/src/utils/result.js +128 -128
  78. package/src/utils/rlp.d.ts +12 -12
  79. package/src/utils/rlp.js +200 -200
  80. package/src/utils/units.d.ts +29 -29
  81. package/src/utils/units.js +107 -107
  82. package/src/wallet/index.d.ts +10 -10
  83. package/src/wallet/index.js +8 -8
  84. package/src/wallet/wallet.d.ts +160 -160
  85. package/src/wallet/wallet.js +483 -489
  86. package/test/e2e/all-solidity-types.dynamic.test.js +207 -200
  87. package/test/e2e/all-solidity-types.dynamic.test.ts +191 -0
  88. package/test/e2e/all-solidity-types.fixtures.js +231 -231
  89. package/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +387 -361
  90. package/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +350 -0
  91. package/test/e2e/helpers.js +59 -47
  92. package/test/e2e/signing-context-and-fee.e2e.test.js +137 -0
  93. package/test/e2e/signing-context-and-fee.e2e.test.ts +128 -0
  94. package/test/e2e/simple-erc20.generated-sdks.e2e.test.js +168 -144
  95. package/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +141 -0
  96. package/test/e2e/transactional.test.js +245 -191
  97. package/test/e2e/transactional.test.ts +208 -0
  98. package/test/e2e/typed-generator.e2e.test.js +407 -402
  99. package/test/e2e/typed-generator.e2e.test.ts +337 -0
  100. package/test/fixtures/ConstructorParam.sol +23 -23
  101. package/test/fixtures/MultiContracts.sol +37 -37
  102. package/test/fixtures/SimpleStorage.sol +18 -18
  103. package/test/fixtures/StakingContract.abi.json +1 -1
  104. package/test/integration/ipc-provider.test.js +49 -44
  105. package/test/integration/ipc-provider.test.ts +44 -0
  106. package/test/integration/provider.test.js +88 -72
  107. package/test/integration/provider.test.ts +85 -0
  108. package/test/integration/ws-provider.test.js +41 -33
  109. package/test/integration/ws-provider.test.ts +38 -0
  110. package/test/security/malformed-input.test.js +37 -31
  111. package/test/security/malformed-input.test.ts +35 -0
  112. package/test/unit/_encrypted-output.txt +6 -0
  113. package/test/unit/_log-encrypted-jsons.js +45 -0
  114. package/test/unit/_write-keystore-fixture.js +16 -0
  115. package/test/unit/abi-interface.test.js +103 -98
  116. package/test/unit/abi-interface.test.ts +102 -0
  117. package/test/unit/address-wallet.test.js +355 -257
  118. package/test/unit/address-wallet.test.ts +342 -0
  119. package/test/unit/browser-provider.test.js +85 -82
  120. package/test/unit/browser-provider.test.ts +79 -0
  121. package/test/unit/contract.test.js +85 -82
  122. package/test/unit/contract.test.ts +83 -0
  123. package/test/unit/encoding-units-rlp.test.js +92 -89
  124. package/test/unit/encoding-units-rlp.test.ts +91 -0
  125. package/test/unit/errors.test.js +77 -74
  126. package/test/unit/errors.test.ts +76 -0
  127. package/test/unit/filter-by-blockhash.test.js +55 -52
  128. package/test/unit/filter-by-blockhash.test.ts +54 -0
  129. package/test/unit/fixtures/encrypted-keystores-48-32-36.js +9 -0
  130. package/test/unit/generate-contract-cli.test.js +42 -39
  131. package/test/unit/generate-contract-cli.test.ts +41 -0
  132. package/test/unit/generate-sdk-artifacts-json.test.js +113 -110
  133. package/test/unit/generate-sdk-artifacts-json.test.ts +110 -0
  134. package/test/unit/generator.test.js +102 -98
  135. package/test/unit/generator.test.ts +101 -0
  136. package/test/unit/hashing.test.js +68 -54
  137. package/test/unit/hashing.test.ts +67 -0
  138. package/test/unit/init.test.js +39 -36
  139. package/test/unit/init.test.ts +38 -0
  140. package/test/unit/interface.test.js +56 -53
  141. package/test/unit/interface.test.ts +54 -0
  142. package/test/unit/internal-hex.test.js +50 -47
  143. package/test/unit/internal-hex.test.ts +49 -0
  144. package/test/unit/populate-transaction.test.js +65 -0
  145. package/test/unit/populate-transaction.test.ts +64 -0
  146. package/test/unit/providers.test.js +200 -144
  147. package/test/unit/providers.test.ts +196 -0
  148. package/test/unit/result.test.js +80 -77
  149. package/test/unit/result.test.ts +79 -0
  150. package/test/unit/solidity-types.test.js +49 -46
  151. package/test/unit/solidity-types.test.ts +39 -0
  152. package/test/unit/utils.test.js +57 -54
  153. package/test/unit/utils.test.ts +56 -0
  154. package/test/verbose-logger.js +74 -0
  155. package/tsconfig.build.json +14 -0
@@ -1,251 +1,251 @@
1
- [
2
- {
3
- "name": "SimpleERC20",
4
- "abi": [
5
- {
6
- "inputs": [
7
- {
8
- "internalType": "string",
9
- "name": "_name",
10
- "type": "string"
11
- },
12
- {
13
- "internalType": "string",
14
- "name": "_symbol",
15
- "type": "string"
16
- },
17
- {
18
- "internalType": "uint256",
19
- "name": "_initialSupply",
20
- "type": "uint256"
21
- }
22
- ],
23
- "stateMutability": "nonpayable",
24
- "type": "constructor"
25
- },
26
- {
27
- "anonymous": false,
28
- "inputs": [
29
- {
30
- "indexed": true,
31
- "internalType": "address",
32
- "name": "owner",
33
- "type": "address"
34
- },
35
- {
36
- "indexed": true,
37
- "internalType": "address",
38
- "name": "spender",
39
- "type": "address"
40
- },
41
- {
42
- "indexed": false,
43
- "internalType": "uint256",
44
- "name": "value",
45
- "type": "uint256"
46
- }
47
- ],
48
- "name": "Approval",
49
- "type": "event"
50
- },
51
- {
52
- "anonymous": false,
53
- "inputs": [
54
- {
55
- "indexed": true,
56
- "internalType": "address",
57
- "name": "from",
58
- "type": "address"
59
- },
60
- {
61
- "indexed": true,
62
- "internalType": "address",
63
- "name": "to",
64
- "type": "address"
65
- },
66
- {
67
- "indexed": false,
68
- "internalType": "uint256",
69
- "name": "value",
70
- "type": "uint256"
71
- }
72
- ],
73
- "name": "Transfer",
74
- "type": "event"
75
- },
76
- {
77
- "inputs": [
78
- {
79
- "internalType": "address",
80
- "name": "",
81
- "type": "address"
82
- },
83
- {
84
- "internalType": "address",
85
- "name": "",
86
- "type": "address"
87
- }
88
- ],
89
- "name": "allowance",
90
- "outputs": [
91
- {
92
- "internalType": "uint256",
93
- "name": "",
94
- "type": "uint256"
95
- }
96
- ],
97
- "stateMutability": "view",
98
- "type": "function"
99
- },
100
- {
101
- "inputs": [
102
- {
103
- "internalType": "address",
104
- "name": "spender",
105
- "type": "address"
106
- },
107
- {
108
- "internalType": "uint256",
109
- "name": "value",
110
- "type": "uint256"
111
- }
112
- ],
113
- "name": "approve",
114
- "outputs": [
115
- {
116
- "internalType": "bool",
117
- "name": "",
118
- "type": "bool"
119
- }
120
- ],
121
- "stateMutability": "nonpayable",
122
- "type": "function"
123
- },
124
- {
125
- "inputs": [
126
- {
127
- "internalType": "address",
128
- "name": "",
129
- "type": "address"
130
- }
131
- ],
132
- "name": "balanceOf",
133
- "outputs": [
134
- {
135
- "internalType": "uint256",
136
- "name": "",
137
- "type": "uint256"
138
- }
139
- ],
140
- "stateMutability": "view",
141
- "type": "function"
142
- },
143
- {
144
- "inputs": [],
145
- "name": "decimals",
146
- "outputs": [
147
- {
148
- "internalType": "uint8",
149
- "name": "",
150
- "type": "uint8"
151
- }
152
- ],
153
- "stateMutability": "view",
154
- "type": "function"
155
- },
156
- {
157
- "inputs": [],
158
- "name": "name",
159
- "outputs": [
160
- {
161
- "internalType": "string",
162
- "name": "",
163
- "type": "string"
164
- }
165
- ],
166
- "stateMutability": "view",
167
- "type": "function"
168
- },
169
- {
170
- "inputs": [],
171
- "name": "symbol",
172
- "outputs": [
173
- {
174
- "internalType": "string",
175
- "name": "",
176
- "type": "string"
177
- }
178
- ],
179
- "stateMutability": "view",
180
- "type": "function"
181
- },
182
- {
183
- "inputs": [],
184
- "name": "totalSupply",
185
- "outputs": [
186
- {
187
- "internalType": "uint256",
188
- "name": "",
189
- "type": "uint256"
190
- }
191
- ],
192
- "stateMutability": "view",
193
- "type": "function"
194
- },
195
- {
196
- "inputs": [
197
- {
198
- "internalType": "address",
199
- "name": "to",
200
- "type": "address"
201
- },
202
- {
203
- "internalType": "uint256",
204
- "name": "value",
205
- "type": "uint256"
206
- }
207
- ],
208
- "name": "transfer",
209
- "outputs": [
210
- {
211
- "internalType": "bool",
212
- "name": "",
213
- "type": "bool"
214
- }
215
- ],
216
- "stateMutability": "nonpayable",
217
- "type": "function"
218
- },
219
- {
220
- "inputs": [
221
- {
222
- "internalType": "address",
223
- "name": "from",
224
- "type": "address"
225
- },
226
- {
227
- "internalType": "address",
228
- "name": "to",
229
- "type": "address"
230
- },
231
- {
232
- "internalType": "uint256",
233
- "name": "value",
234
- "type": "uint256"
235
- }
236
- ],
237
- "name": "transferFrom",
238
- "outputs": [
239
- {
240
- "internalType": "bool",
241
- "name": "",
242
- "type": "bool"
243
- }
244
- ],
245
- "stateMutability": "nonpayable",
246
- "type": "function"
247
- }
248
- ],
249
- "bin": "0x608060405234801561001057600080fd5b506040516108ab3803806108ab8339818101604052606081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156100ff57600080fd5b90830190602082018581111561011457600080fd5b825164010000000081118282018810171561012e57600080fd5b82525081516020918201929091019080838360005b8381101561015b578181015183820152602001610143565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b5060405260209081015185519093506101a79250600091860190610264565b5081516101bb906001906020850190610264565b506101c633826101ce565b505050610305565b8161020f576040805162461bcd60e51b815260206004820152600c60248201526b4d494e545f544f5f5a45524f60a01b604482015290519081900360640190fd5b60028054820190556000828152600360209081526040808320805485019055805184815290518593927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a35050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261029a57600085556102e0565b82601f106102b357805160ff19168380011785556102e0565b828001600101855582156102e0579182015b828111156102e05782518255916020019190600101906102c5565b506102ec9291506102f0565b5090565b5b808211156102ec57600081556001016102f1565b610597806103146000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461018f57806370a08231146101ad57806395d89b41146101ca578063a9059cbb146101d2578063dd62ed3e146101f557610093565b806306fdde0314610098578063095ea7b31461011557806318160ddd1461014c57806323b872dd14610166575b600080fd5b6100a0610218565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100da5781810151838201526020016100c2565b50505050905090810190601f1680156101075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101386004803603604081101561012b57600080fd5b50803590602001356102a6565b604080519115158252519081900360200190f35b610154610301565b60408051918252519081900360200190f35b6101386004803603606081101561017c57600080fd5b5080359060208101359060400135610307565b6101976103d6565b6040805160ff9092168252519081900360200190f35b610154600480360360208110156101c357600080fd5b50356103db565b6100a06103ed565b610138600480360360408110156101e857600080fd5b5080359060200135610447565b6101546004803603604081101561020b57600080fd5b508035906020013561045d565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561029e5780601f106102735761010080835404028352916020019161029e565b820191906000526020600020905b81548152906001019060200180831161028157829003601f168201915b505050505081565b3360008181526004602090815260408083208684528252808320859055805185815290519293869390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600083815260046020908152604080832033845290915281205482811015610362576040805162461bcd60e51b8152602060048201526009602482015268414c4c4f57414e434560b81b604482015290519081900360640190fd5b60001981146103c05760008581526004602090815260408083203380855290835292819020868503908190558151908152905188927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35b6103cb85858561047a565b506001949350505050565b601281565b60036020526000908152604090205481565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561029e5780601f106102735761010080835404028352916020019161029e565b600061045433848461047a565b50600192915050565b600460209081526000928352604080842090915290825290205481565b816104b6576040805162461bcd60e51b8152602060048201526007602482015266544f5f5a45524f60c81b604482015290519081900360640190fd5b60008381526003602052604090205481811015610504576040805162461bcd60e51b815260206004820152600760248201526642414c414e434560c81b604482015290519081900360640190fd5b600084815260036020908152604080832085850390558583529182902080548501905581518481529151859287927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35050505056fea26469706673582212202ed1f601becde0e5fba43ade631c5e20fa87ca86747a7c41488643b1eb14a89664736f6c63430007060033"
250
- }
251
- ]
1
+ [
2
+ {
3
+ "name": "SimpleERC20",
4
+ "abi": [
5
+ {
6
+ "inputs": [
7
+ {
8
+ "internalType": "string",
9
+ "name": "_name",
10
+ "type": "string"
11
+ },
12
+ {
13
+ "internalType": "string",
14
+ "name": "_symbol",
15
+ "type": "string"
16
+ },
17
+ {
18
+ "internalType": "uint256",
19
+ "name": "_initialSupply",
20
+ "type": "uint256"
21
+ }
22
+ ],
23
+ "stateMutability": "nonpayable",
24
+ "type": "constructor"
25
+ },
26
+ {
27
+ "anonymous": false,
28
+ "inputs": [
29
+ {
30
+ "indexed": true,
31
+ "internalType": "address",
32
+ "name": "owner",
33
+ "type": "address"
34
+ },
35
+ {
36
+ "indexed": true,
37
+ "internalType": "address",
38
+ "name": "spender",
39
+ "type": "address"
40
+ },
41
+ {
42
+ "indexed": false,
43
+ "internalType": "uint256",
44
+ "name": "value",
45
+ "type": "uint256"
46
+ }
47
+ ],
48
+ "name": "Approval",
49
+ "type": "event"
50
+ },
51
+ {
52
+ "anonymous": false,
53
+ "inputs": [
54
+ {
55
+ "indexed": true,
56
+ "internalType": "address",
57
+ "name": "from",
58
+ "type": "address"
59
+ },
60
+ {
61
+ "indexed": true,
62
+ "internalType": "address",
63
+ "name": "to",
64
+ "type": "address"
65
+ },
66
+ {
67
+ "indexed": false,
68
+ "internalType": "uint256",
69
+ "name": "value",
70
+ "type": "uint256"
71
+ }
72
+ ],
73
+ "name": "Transfer",
74
+ "type": "event"
75
+ },
76
+ {
77
+ "inputs": [
78
+ {
79
+ "internalType": "address",
80
+ "name": "",
81
+ "type": "address"
82
+ },
83
+ {
84
+ "internalType": "address",
85
+ "name": "",
86
+ "type": "address"
87
+ }
88
+ ],
89
+ "name": "allowance",
90
+ "outputs": [
91
+ {
92
+ "internalType": "uint256",
93
+ "name": "",
94
+ "type": "uint256"
95
+ }
96
+ ],
97
+ "stateMutability": "view",
98
+ "type": "function"
99
+ },
100
+ {
101
+ "inputs": [
102
+ {
103
+ "internalType": "address",
104
+ "name": "spender",
105
+ "type": "address"
106
+ },
107
+ {
108
+ "internalType": "uint256",
109
+ "name": "value",
110
+ "type": "uint256"
111
+ }
112
+ ],
113
+ "name": "approve",
114
+ "outputs": [
115
+ {
116
+ "internalType": "bool",
117
+ "name": "",
118
+ "type": "bool"
119
+ }
120
+ ],
121
+ "stateMutability": "nonpayable",
122
+ "type": "function"
123
+ },
124
+ {
125
+ "inputs": [
126
+ {
127
+ "internalType": "address",
128
+ "name": "",
129
+ "type": "address"
130
+ }
131
+ ],
132
+ "name": "balanceOf",
133
+ "outputs": [
134
+ {
135
+ "internalType": "uint256",
136
+ "name": "",
137
+ "type": "uint256"
138
+ }
139
+ ],
140
+ "stateMutability": "view",
141
+ "type": "function"
142
+ },
143
+ {
144
+ "inputs": [],
145
+ "name": "decimals",
146
+ "outputs": [
147
+ {
148
+ "internalType": "uint8",
149
+ "name": "",
150
+ "type": "uint8"
151
+ }
152
+ ],
153
+ "stateMutability": "view",
154
+ "type": "function"
155
+ },
156
+ {
157
+ "inputs": [],
158
+ "name": "name",
159
+ "outputs": [
160
+ {
161
+ "internalType": "string",
162
+ "name": "",
163
+ "type": "string"
164
+ }
165
+ ],
166
+ "stateMutability": "view",
167
+ "type": "function"
168
+ },
169
+ {
170
+ "inputs": [],
171
+ "name": "symbol",
172
+ "outputs": [
173
+ {
174
+ "internalType": "string",
175
+ "name": "",
176
+ "type": "string"
177
+ }
178
+ ],
179
+ "stateMutability": "view",
180
+ "type": "function"
181
+ },
182
+ {
183
+ "inputs": [],
184
+ "name": "totalSupply",
185
+ "outputs": [
186
+ {
187
+ "internalType": "uint256",
188
+ "name": "",
189
+ "type": "uint256"
190
+ }
191
+ ],
192
+ "stateMutability": "view",
193
+ "type": "function"
194
+ },
195
+ {
196
+ "inputs": [
197
+ {
198
+ "internalType": "address",
199
+ "name": "to",
200
+ "type": "address"
201
+ },
202
+ {
203
+ "internalType": "uint256",
204
+ "name": "value",
205
+ "type": "uint256"
206
+ }
207
+ ],
208
+ "name": "transfer",
209
+ "outputs": [
210
+ {
211
+ "internalType": "bool",
212
+ "name": "",
213
+ "type": "bool"
214
+ }
215
+ ],
216
+ "stateMutability": "nonpayable",
217
+ "type": "function"
218
+ },
219
+ {
220
+ "inputs": [
221
+ {
222
+ "internalType": "address",
223
+ "name": "from",
224
+ "type": "address"
225
+ },
226
+ {
227
+ "internalType": "address",
228
+ "name": "to",
229
+ "type": "address"
230
+ },
231
+ {
232
+ "internalType": "uint256",
233
+ "name": "value",
234
+ "type": "uint256"
235
+ }
236
+ ],
237
+ "name": "transferFrom",
238
+ "outputs": [
239
+ {
240
+ "internalType": "bool",
241
+ "name": "",
242
+ "type": "bool"
243
+ }
244
+ ],
245
+ "stateMutability": "nonpayable",
246
+ "type": "function"
247
+ }
248
+ ],
249
+ "bin": "0x608060405234801561001057600080fd5b506040516108ab3803806108ab8339818101604052606081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156100ff57600080fd5b90830190602082018581111561011457600080fd5b825164010000000081118282018810171561012e57600080fd5b82525081516020918201929091019080838360005b8381101561015b578181015183820152602001610143565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b5060405260209081015185519093506101a79250600091860190610264565b5081516101bb906001906020850190610264565b506101c633826101ce565b505050610305565b8161020f576040805162461bcd60e51b815260206004820152600c60248201526b4d494e545f544f5f5a45524f60a01b604482015290519081900360640190fd5b60028054820190556000828152600360209081526040808320805485019055805184815290518593927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a35050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261029a57600085556102e0565b82601f106102b357805160ff19168380011785556102e0565b828001600101855582156102e0579182015b828111156102e05782518255916020019190600101906102c5565b506102ec9291506102f0565b5090565b5b808211156102ec57600081556001016102f1565b610597806103146000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461018f57806370a08231146101ad57806395d89b41146101ca578063a9059cbb146101d2578063dd62ed3e146101f557610093565b806306fdde0314610098578063095ea7b31461011557806318160ddd1461014c57806323b872dd14610166575b600080fd5b6100a0610218565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100da5781810151838201526020016100c2565b50505050905090810190601f1680156101075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101386004803603604081101561012b57600080fd5b50803590602001356102a6565b604080519115158252519081900360200190f35b610154610301565b60408051918252519081900360200190f35b6101386004803603606081101561017c57600080fd5b5080359060208101359060400135610307565b6101976103d6565b6040805160ff9092168252519081900360200190f35b610154600480360360208110156101c357600080fd5b50356103db565b6100a06103ed565b610138600480360360408110156101e857600080fd5b5080359060200135610447565b6101546004803603604081101561020b57600080fd5b508035906020013561045d565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561029e5780601f106102735761010080835404028352916020019161029e565b820191906000526020600020905b81548152906001019060200180831161028157829003601f168201915b505050505081565b3360008181526004602090815260408083208684528252808320859055805185815290519293869390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600083815260046020908152604080832033845290915281205482811015610362576040805162461bcd60e51b8152602060048201526009602482015268414c4c4f57414e434560b81b604482015290519081900360640190fd5b60001981146103c05760008581526004602090815260408083203380855290835292819020868503908190558151908152905188927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35b6103cb85858561047a565b506001949350505050565b601281565b60036020526000908152604090205481565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561029e5780601f106102735761010080835404028352916020019161029e565b600061045433848461047a565b50600192915050565b600460209081526000928352604080842090915290825290205481565b816104b6576040805162461bcd60e51b8152602060048201526007602482015266544f5f5a45524f60c81b604482015290519081900360640190fd5b60008381526003602052604090205481811015610504576040805162461bcd60e51b815260206004820152600760248201526642414c414e434560c81b604482015290519081900360640190fd5b600084815260036020908152604080832085850390558583529182902080548501905581518481529151859287927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35050505056fea26469706673582212202ed1f601becde0e5fba43ade631c5e20fa87ca86747a7c41488643b1eb14a89664736f6c63430007060033"
250
+ }
251
+ ]
@@ -1,43 +1,43 @@
1
- /**
2
- * TypeScript-only example: core Solidity types.
3
- *
4
- * This file is intended for developers using QuantumCoin.js from TypeScript.
5
- * It is not executed by `npm run example`.
6
- */
7
-
8
- import type {
9
- AddressLike,
10
- BigNumberish,
11
- BytesLike,
12
- SolidityInputValue,
13
- SolidityOutputValue,
14
- SolidityTypeName,
15
- } from "quantumcoin/types";
16
-
17
- // AddressLike is currently a string (32-byte QuantumCoin address).
18
- const addr: AddressLike = "0x0000000000000000000000000000000000000000000000000000000000001000";
19
-
20
- // BigNumberish is accepted for uint/int inputs (string | number | bigint).
21
- const amount: BigNumberish = "123";
22
-
23
- // BytesLike is a hex string or Uint8Array.
24
- const data: BytesLike = "0x1234";
25
-
26
- // Generic mappings for ABI input/output values:
27
- type T1 = SolidityInputValue<"uint256">; // BigNumberish
28
- type T2 = SolidityOutputValue<"uint256">; // bigint
29
- type T3 = SolidityInputValue<"address">; // AddressLike
30
- type T4 = SolidityOutputValue<"address">; // string
31
-
32
- // Example: using SolidityTypeName
33
- const t: SolidityTypeName = "bytes32";
34
-
35
- void addr;
36
- void amount;
37
- void data;
38
- void t;
39
- void (null as any as T1);
40
- void (null as any as T2);
41
- void (null as any as T3);
42
- void (null as any as T4);
43
-
1
+ /**
2
+ * TypeScript-only example: core Solidity types.
3
+ *
4
+ * This file is intended for developers using QuantumCoin.js from TypeScript.
5
+ * It is not executed by `npm run example`.
6
+ */
7
+
8
+ import type {
9
+ AddressLike,
10
+ BigNumberish,
11
+ BytesLike,
12
+ SolidityInputValue,
13
+ SolidityOutputValue,
14
+ SolidityTypeName,
15
+ } from "quantumcoin/types";
16
+
17
+ // AddressLike is currently a string (32-byte QuantumCoin address).
18
+ const addr: AddressLike = "0x0000000000000000000000000000000000000000000000000000000000001000";
19
+
20
+ // BigNumberish is accepted for uint/int inputs (string | number | bigint).
21
+ const amount: BigNumberish = "123";
22
+
23
+ // BytesLike is a hex string or Uint8Array.
24
+ const data: BytesLike = "0x1234";
25
+
26
+ // Generic mappings for ABI input/output values:
27
+ type T1 = SolidityInputValue<"uint256">; // BigNumberish
28
+ type T2 = SolidityOutputValue<"uint256">; // bigint
29
+ type T3 = SolidityInputValue<"address">; // AddressLike
30
+ type T4 = SolidityOutputValue<"address">; // string
31
+
32
+ // Example: using SolidityTypeName
33
+ const t: SolidityTypeName = "bytes32";
34
+
35
+ void addr;
36
+ void amount;
37
+ void data;
38
+ void t;
39
+ void (null as any as T1);
40
+ void (null as any as T2);
41
+ void (null as any as T3);
42
+ void (null as any as T4);
43
+
@@ -1,29 +1,35 @@
1
- /**
2
- * Example: Offline wallet operations (no blockchain connectivity required).
3
- */
4
-
5
- const { Initialize } = require("../config");
6
- const { Wallet, verifyMessage } = require("..");
7
-
8
- async function walletOffline() {
9
- await Initialize(null);
10
-
11
- const wallet = Wallet.createRandom();
12
- console.log("Wallet address:", wallet.address);
13
-
14
- const msg = "Hello, QuantumCoin!";
15
- const sig = wallet.signMessageSync(msg);
16
- console.log("Signature:", sig.slice(0, 18) + "...");
17
-
18
- const recovered = verifyMessage(msg, sig);
19
- console.log("Recovered address:", recovered);
20
-
21
- const json = wallet.encryptSync("mySecurePassword123");
22
- console.log("Encrypted wallet JSON length:", json.length);
23
- }
24
-
25
- walletOffline().catch((e) => {
26
- console.error(e);
27
- process.exitCode = 1;
28
- });
29
-
1
+ /**
2
+ * Example: Offline wallet operations (no blockchain connectivity required).
3
+ * Run with VERBOSE=1 for wallet addresses and recovered address.
4
+ */
5
+
6
+ const { Initialize } = require("../config");
7
+ const { Wallet, verifyMessage } = require("..");
8
+ const { logExample, logAddress } = require("../test/verbose-logger");
9
+
10
+ async function walletOffline() {
11
+ logExample("wallet-offline.js", "starting");
12
+ await Initialize(null);
13
+
14
+ const wallet = Wallet.createRandom();
15
+ console.log("Wallet address:", wallet.address);
16
+ logAddress("wallet", wallet.address);
17
+
18
+ const msg = "Hello, QuantumCoin!";
19
+ const sig = wallet.signMessageSync(msg);
20
+ console.log("Signature:", sig.slice(0, 18) + "...");
21
+
22
+ const recovered = verifyMessage(msg, sig);
23
+ console.log("Recovered address:", recovered);
24
+ logAddress("recovered", recovered);
25
+
26
+ const json = wallet.encryptSync("mySecurePassword123");
27
+ console.log("Encrypted wallet JSON length:", json.length);
28
+ logExample("wallet-offline.js", "encryptSync", { jsonLength: json.length });
29
+ }
30
+
31
+ walletOffline().catch((e) => {
32
+ console.error(e);
33
+ process.exitCode = 1;
34
+ });
35
+