quantumcoin 7.0.3 → 7.0.5

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 +758 -754
  5. package/README.md +165 -150
  6. package/SPEC.md +3845 -3843
  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 -73
  20. package/examples/offline-signing.ts +66 -0
  21. package/examples/package-lock.json +596 -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 -1490
  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 -114
  47. package/src/contract/contract.js +354 -354
  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 -1404
  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 +208 -203
  65. package/src/providers/provider.js +393 -371
  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 +168 -160
  85. package/src/wallet/wallet.js +500 -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 -368
  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 +141 -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 -151
  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 -404
  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 +392 -257
  118. package/test/unit/address-wallet.test.ts +379 -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 -99
  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 -62
  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,203 +1,208 @@
1
- export type BytesLike = import("../types").BytesLike;
2
- export type AddressLike = import("../types").AddressLike;
3
- export type BigNumberish = import("../types").BigNumberish;
4
- export type TransactionRequest = {
5
- to?: AddressLike | undefined;
6
- from?: AddressLike | undefined;
7
- value?: BigNumberish | undefined;
8
- data?: BytesLike | undefined;
9
- gasLimit?: BigNumberish | undefined;
10
- gasPrice?: BigNumberish | undefined;
11
- nonce?: number | undefined;
12
- chainId?: number | undefined;
13
- /**
14
- * Optional remark field (hex, max 32 bytes)
15
- */
16
- remarks?: string | undefined;
17
- };
18
- export type Filter = {
19
- address?: (string | string[]) | undefined;
20
- topics?: (string | string[] | null)[] | undefined;
21
- fromBlock?: (number | string) | undefined;
22
- toBlock?: (number | string) | undefined;
23
- blockHash?: string | undefined;
24
- };
25
- /**
26
- * Base Provider class.
27
- */
28
- export class Provider {
29
- }
30
- /**
31
- * AbstractProvider base class (ethers-like).
32
- */
33
- export class AbstractProvider extends Provider {
34
- /**
35
- * Implemented by subclasses to perform JSON-RPC.
36
- * @param {string} method
37
- * @param {any[]=} params
38
- * @returns {Promise<any>}
39
- */
40
- _perform(method: string, params?: any[] | undefined): Promise<any>;
41
- getBlockNumber(): Promise<number>;
42
- /**
43
- * @param {number|"latest"} blockNumber
44
- * @returns {Promise<Block>}
45
- */
46
- getBlock(blockNumber: number | "latest"): Promise<Block>;
47
- /**
48
- * @param {string} txHash
49
- * @returns {Promise<TransactionResponse>}
50
- */
51
- getTransaction(txHash: string): Promise<TransactionResponse>;
52
- /**
53
- * @param {string} txHash
54
- * @returns {Promise<TransactionReceipt>}
55
- */
56
- getTransactionReceipt(txHash: string): Promise<TransactionReceipt>;
57
- /**
58
- * @param {string} address
59
- * @returns {Promise<bigint>}
60
- */
61
- getBalance(address: AddressLike): Promise<bigint>;
62
- /**
63
- * @param {string} address
64
- * @param {string=} blockTag
65
- * @returns {Promise<number>}
66
- */
67
- getTransactionCount(address: AddressLike, blockTag?: string | undefined): Promise<number>;
68
- /**
69
- * Broadcasts a signed transaction.
70
- * @param {TransactionRequest|string} tx
71
- * @returns {Promise<TransactionResponse>}
72
- */
73
- sendTransaction(tx: TransactionRequest | string): Promise<TransactionResponse>;
74
- /**
75
- * Broadcast a signed raw transaction.
76
- * Alias of sendTransaction(rawTx) for clarity in offline signing flows.
77
- * @param {string} rawTx
78
- * @returns {Promise<TransactionResponse>}
79
- */
80
- sendRawTransaction(rawTx: string): Promise<TransactionResponse>;
81
- /**
82
- * Perform a call (read-only) and return hex data.
83
- * @param {TransactionRequest} tx
84
- * @param {string=} blockTag
85
- * @returns {Promise<string>}
86
- */
87
- call(tx: TransactionRequest, blockTag?: string | undefined): Promise<string>;
88
- /**
89
- * Estimate gas for a call/transaction.
90
- * @param {TransactionRequest} tx
91
- * @returns {Promise<bigint>}
92
- */
93
- estimateGas(tx: TransactionRequest): Promise<bigint>;
94
- /**
95
- * @param {string} address
96
- * @param {string=} blockTag
97
- * @returns {Promise<string>}
98
- */
99
- getCode(address: AddressLike, blockTag?: string | undefined): Promise<string>;
100
- /**
101
- * @param {string} address
102
- * @param {bigint} position
103
- * @param {string=} blockTag
104
- * @returns {Promise<string>}
105
- */
106
- getStorageAt(address: AddressLike, position: bigint, blockTag?: string | undefined): Promise<string>;
107
- /**
108
- * @param {Filter} filter
109
- * @returns {Promise<Log[]>}
110
- */
111
- getLogs(filter: Filter): Promise<Log[]>;
112
- }
113
- /**
114
- * Minimal Block wrapper (ethers-like).
115
- */
116
- export class Block {
117
- /**
118
- * @param {any} block
119
- * @param {AbstractProvider=} provider
120
- */
121
- constructor(block: any, provider?: AbstractProvider | undefined);
122
- provider: AbstractProvider;
123
- hash: any;
124
- parentHash: any;
125
- number: number;
126
- timestamp: number;
127
- transactions: any;
128
- getTransaction(indexOrHash: any): Promise<TransactionResponse>;
129
- getTransactionReceipt(indexOrHash: any): Promise<TransactionReceipt>;
130
- getPrefetchedTransactions(): any[];
131
- }
132
- /**
133
- * Minimal TransactionResponse wrapper (ethers-like).
134
- */
135
- export class TransactionResponse {
136
- /**
137
- * @param {any} tx
138
- * @param {AbstractProvider=} provider
139
- */
140
- constructor(tx: any, provider?: AbstractProvider | undefined);
141
- provider: AbstractProvider;
142
- hash: any;
143
- to: any;
144
- from: any;
145
- nonce: number;
146
- data: any;
147
- value: any;
148
- gasLimit: any;
149
- gasPrice: any;
150
- chainId: number;
151
- blockNumber: number;
152
- /**
153
- * Wait for confirmations.
154
- * @param {number=} confirmations
155
- * @param {number=} timeoutMs
156
- * @returns {Promise<TransactionReceipt>}
157
- */
158
- wait(confirmations?: number | undefined, timeoutMs?: number | undefined): Promise<TransactionReceipt>;
159
- }
160
- /**
161
- * Minimal TransactionReceipt wrapper (ethers-like).
162
- */
163
- export class TransactionReceipt {
164
- /**
165
- * @param {any} receipt
166
- * @param {AbstractProvider=} provider
167
- */
168
- constructor(receipt: any, provider?: AbstractProvider | undefined);
169
- provider: AbstractProvider;
170
- to: any;
171
- from: any;
172
- contractAddress: any;
173
- transactionHash: any;
174
- blockHash: any;
175
- blockNumber: number;
176
- transactionIndex: number;
177
- gasUsed: any;
178
- status: number;
179
- logs: any;
180
- }
181
- /**
182
- * Minimal Log wrapper (ethers-like).
183
- */
184
- export class Log {
185
- /**
186
- * @param {any} log
187
- * @param {AbstractProvider=} provider
188
- */
189
- constructor(log: any, provider?: AbstractProvider | undefined);
190
- provider: AbstractProvider;
191
- address: any;
192
- topics: any;
193
- data: any;
194
- blockHash: any;
195
- blockNumber: number;
196
- transactionHash: any;
197
- transactionIndex: number;
198
- logIndex: number;
199
- removed: boolean;
200
- getBlock(): Promise<Block>;
201
- getTransaction(): Promise<TransactionResponse>;
202
- getTransactionReceipt(): Promise<TransactionReceipt>;
203
- }
1
+ export type BytesLike = import("../utils/encoding").BytesLike;
2
+ export type TransactionRequest = {
3
+ to?: string | undefined;
4
+ from?: string | undefined;
5
+ value?: (bigint | string | number) | undefined;
6
+ data?: string | undefined;
7
+ gasLimit?: (bigint | string | number) | undefined;
8
+ gasPrice?: (bigint | string | number) | undefined;
9
+ nonce?: number | undefined;
10
+ chainId?: number | undefined;
11
+ /**
12
+ * Optional remark field (hex, max 32 bytes)
13
+ */
14
+ remarks?: string | undefined;
15
+ /**
16
+ * Optional signing context (0, 1, 2, or null). Passed to SDK TransactionSigningRequest; default null.
17
+ */
18
+ signingContext?: (number | null) | undefined;
19
+ };
20
+ export type Filter = {
21
+ address?: (string | string[]) | undefined;
22
+ topics?: (string | string[] | null)[] | undefined;
23
+ fromBlock?: (number | string) | undefined;
24
+ toBlock?: (number | string) | undefined;
25
+ blockHash?: string | undefined;
26
+ };
27
+ /**
28
+ * Base Provider class.
29
+ */
30
+ export class Provider {
31
+ }
32
+ /**
33
+ * AbstractProvider base class (ethers-like).
34
+ */
35
+ export class AbstractProvider extends Provider {
36
+ /**
37
+ * Implemented by subclasses to perform JSON-RPC.
38
+ * @param {string} method
39
+ * @param {any[]=} params
40
+ * @returns {Promise<any>}
41
+ */
42
+ _perform(method: string, params?: any[] | undefined): Promise<any>;
43
+ getBlockNumber(): Promise<number>;
44
+ /**
45
+ * @param {number|"latest"} blockNumber
46
+ * @returns {Promise<Block>}
47
+ */
48
+ getBlock(blockNumber: number | "latest"): Promise<Block>;
49
+ /**
50
+ * @param {string} txHash
51
+ * @returns {Promise<TransactionResponse>}
52
+ */
53
+ getTransaction(txHash: string): Promise<TransactionResponse>;
54
+ /**
55
+ * @param {string} txHash
56
+ * @returns {Promise<TransactionReceipt>}
57
+ */
58
+ getTransactionReceipt(txHash: string): Promise<TransactionReceipt>;
59
+ /**
60
+ * @param {string} address
61
+ * @returns {Promise<bigint>}
62
+ */
63
+ getBalance(address: string): Promise<bigint>;
64
+ /**
65
+ * @param {string} address
66
+ * @param {string=} blockTag
67
+ * @returns {Promise<number>}
68
+ */
69
+ getTransactionCount(address: string, blockTag?: string | undefined): Promise<number>;
70
+ /**
71
+ * Broadcasts a signed transaction.
72
+ * @param {TransactionRequest|string} tx
73
+ * @returns {Promise<TransactionResponse>}
74
+ */
75
+ sendTransaction(tx: TransactionRequest | string): Promise<TransactionResponse>;
76
+ /**
77
+ * Broadcast a signed raw transaction.
78
+ * Alias of sendTransaction(rawTx) for clarity when doing offline signing flows.
79
+ *
80
+ * @param {string} rawTx
81
+ * @returns {Promise<TransactionResponse>}
82
+ */
83
+ sendRawTransaction(rawTx: string): Promise<TransactionResponse>;
84
+ /**
85
+ * Perform a call (read-only) and return hex data.
86
+ * @param {TransactionRequest} tx
87
+ * @param {string=} blockTag
88
+ * @returns {Promise<string>}
89
+ */
90
+ call(tx: TransactionRequest, blockTag?: string | undefined): Promise<string>;
91
+ /**
92
+ * Estimate gas for a call/transaction.
93
+ * @param {TransactionRequest} tx
94
+ * @returns {Promise<bigint>}
95
+ */
96
+ estimateGas(tx: TransactionRequest): Promise<bigint>;
97
+ /**
98
+ * @param {string} address
99
+ * @param {string=} blockTag
100
+ * @returns {Promise<string>}
101
+ */
102
+ getCode(address: string, blockTag?: string | undefined): Promise<string>;
103
+ /**
104
+ * @param {string} address
105
+ * @param {bigint} position
106
+ * @param {string=} blockTag
107
+ * @returns {Promise<string>}
108
+ */
109
+ getStorageAt(address: string, position: bigint, blockTag?: string | undefined): Promise<string>;
110
+ /**
111
+ * @param {Filter} filter
112
+ * @returns {Promise<Log[]>}
113
+ */
114
+ getLogs(filter: Filter): Promise<Log[]>;
115
+ }
116
+ /**
117
+ * Minimal Block wrapper (ethers-like).
118
+ */
119
+ export class Block {
120
+ /**
121
+ * @param {any} block
122
+ * @param {AbstractProvider=} provider
123
+ */
124
+ constructor(block: any, provider?: AbstractProvider | undefined);
125
+ provider: AbstractProvider;
126
+ hash: any;
127
+ parentHash: any;
128
+ number: number;
129
+ timestamp: number;
130
+ transactions: any;
131
+ getTransaction(indexOrHash: any): Promise<TransactionResponse>;
132
+ getTransactionReceipt(indexOrHash: any): Promise<TransactionReceipt>;
133
+ getPrefetchedTransactions(): any[];
134
+ }
135
+ /**
136
+ * Minimal TransactionResponse wrapper (ethers-like).
137
+ */
138
+ export class TransactionResponse {
139
+ /**
140
+ * @param {any} tx
141
+ * @param {AbstractProvider=} provider
142
+ */
143
+ constructor(tx: any, provider?: AbstractProvider | undefined);
144
+ provider: AbstractProvider;
145
+ hash: any;
146
+ to: any;
147
+ from: any;
148
+ nonce: number;
149
+ data: any;
150
+ value: any;
151
+ gasLimit: any;
152
+ gasPrice: any;
153
+ chainId: number;
154
+ blockNumber: number;
155
+ txType: number | null;
156
+ remarks: string;
157
+ /**
158
+ * Wait for confirmations.
159
+ * @param {number=} confirmations
160
+ * @param {number=} timeoutMs
161
+ * @returns {Promise<TransactionReceipt>}
162
+ */
163
+ wait(confirmations?: number | undefined, timeoutMs?: number | undefined): Promise<TransactionReceipt>;
164
+ }
165
+ /**
166
+ * Minimal TransactionReceipt wrapper (ethers-like).
167
+ */
168
+ export class TransactionReceipt {
169
+ /**
170
+ * @param {any} receipt
171
+ * @param {AbstractProvider=} provider
172
+ */
173
+ constructor(receipt: any, provider?: AbstractProvider | undefined);
174
+ provider: AbstractProvider;
175
+ to: any;
176
+ from: any;
177
+ contractAddress: any;
178
+ transactionHash: any;
179
+ blockHash: any;
180
+ blockNumber: number;
181
+ transactionIndex: number;
182
+ gasUsed: any;
183
+ status: number;
184
+ logs: any;
185
+ }
186
+ /**
187
+ * Minimal Log wrapper (ethers-like).
188
+ */
189
+ export class Log {
190
+ /**
191
+ * @param {any} log
192
+ * @param {AbstractProvider=} provider
193
+ */
194
+ constructor(log: any, provider?: AbstractProvider | undefined);
195
+ provider: AbstractProvider;
196
+ address: any;
197
+ topics: any;
198
+ data: any;
199
+ blockHash: any;
200
+ blockNumber: number;
201
+ transactionHash: any;
202
+ transactionIndex: number;
203
+ logIndex: number;
204
+ removed: boolean;
205
+ getBlock(): Promise<Block>;
206
+ getTransaction(): Promise<TransactionResponse>;
207
+ getTransactionReceipt(): Promise<TransactionReceipt>;
208
+ }