postchain-client 2.0.0 → 2.0.1

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 (74) hide show
  1. package/README.md +11 -0
  2. package/built/cjs/index.js +138 -1421
  3. package/built/cjs/index.js.map +1 -1
  4. package/built/esm/index.js +12400 -13410
  5. package/built/esm/index.js.map +1 -1
  6. package/built/index.d.ts +0 -1
  7. package/built/index.js +0 -2
  8. package/built/index.js.map +1 -1
  9. package/built/src/ICCF/IccfProofTxMaterialBuilder.d.ts +3 -2
  10. package/built/src/ICCF/IccfProofTxMaterialBuilder.js +23 -10
  11. package/built/src/ICCF/IccfProofTxMaterialBuilder.js.map +1 -1
  12. package/built/src/blockchainClient/blockchainClient.js +7 -3
  13. package/built/src/blockchainClient/blockchainClient.js.map +1 -1
  14. package/built/src/blockchainClient/failoverStrategies.js +2 -1
  15. package/built/src/blockchainClient/failoverStrategies.js.map +1 -1
  16. package/built/src/blockchainClient/nodeManager.d.ts +3 -0
  17. package/built/src/blockchainClient/nodeManager.js +7 -0
  18. package/built/src/blockchainClient/nodeManager.js.map +1 -1
  19. package/built/src/blockchainClient/types.d.ts +1 -0
  20. package/built/src/blockchainClient/utils.d.ts +11 -1
  21. package/built/src/blockchainClient/utils.js +14 -1
  22. package/built/src/blockchainClient/utils.js.map +1 -1
  23. package/built/src/gtv/index.d.ts +2 -2
  24. package/built/src/gtv/index.js +4 -6
  25. package/built/src/gtv/index.js.map +1 -1
  26. package/built/test/pcctf/getSuites.test.js +106 -0
  27. package/built/test/pcctf/getSuites.test.js.map +1 -0
  28. package/built/test/pcctf/helpers.d.ts +92 -0
  29. package/built/test/pcctf/helpers.js +239 -0
  30. package/built/test/pcctf/helpers.js.map +1 -0
  31. package/built/test/unit/blockchainClient/client.test.js +2 -0
  32. package/built/test/unit/blockchainClient/client.test.js.map +1 -1
  33. package/built/test/unit/failoverStrategies.test.js +1 -1
  34. package/built/test/unit/failoverStrategies.test.js.map +1 -1
  35. package/built/umd/index.js +14393 -13535
  36. package/built/umd/index.js.map +1 -1
  37. package/package.json +8 -4
  38. package/built/src/merkle/binarytree.d.ts +0 -131
  39. package/built/src/merkle/binarytree.js +0 -146
  40. package/built/src/merkle/binarytree.js.map +0 -1
  41. package/built/src/merkle/binarytreefactory.d.ts +0 -86
  42. package/built/src/merkle/binarytreefactory.js +0 -251
  43. package/built/src/merkle/binarytreefactory.js.map +0 -1
  44. package/built/src/merkle/merkleHelper.d.ts +0 -17
  45. package/built/src/merkle/merkleHelper.js +0 -109
  46. package/built/src/merkle/merkleHelper.js.map +0 -1
  47. package/built/src/merkle/merklehashcalculator.d.ts +0 -37
  48. package/built/src/merkle/merklehashcalculator.js +0 -73
  49. package/built/src/merkle/merklehashcalculator.js.map +0 -1
  50. package/built/src/merkle/path.d.ts +0 -151
  51. package/built/src/merkle/path.js +0 -306
  52. package/built/src/merkle/path.js.map +0 -1
  53. package/built/src/merkle/proof/merklehashcarrier.d.ts +0 -17
  54. package/built/src/merkle/proof/merklehashcarrier.js +0 -23
  55. package/built/src/merkle/proof/merklehashcarrier.js.map +0 -1
  56. package/built/src/merkle/proof/merklehashsummaryfactory.d.ts +0 -53
  57. package/built/src/merkle/proof/merklehashsummaryfactory.js +0 -82
  58. package/built/src/merkle/proof/merklehashsummaryfactory.js.map +0 -1
  59. package/built/src/merkle/proof/merkleproof.d.ts +0 -36
  60. package/built/src/merkle/proof/merkleproof.js +0 -61
  61. package/built/src/merkle/proof/merkleproof.js.map +0 -1
  62. package/built/src/merkle/proof/merkleprooftree.d.ts +0 -124
  63. package/built/src/merkle/proof/merkleprooftree.js +0 -117
  64. package/built/src/merkle/proof/merkleprooftree.js.map +0 -1
  65. package/built/src/merkle/proof/merkleprooftreefactory.d.ts +0 -47
  66. package/built/src/merkle/proof/merkleprooftreefactory.js +0 -123
  67. package/built/src/merkle/proof/merkleprooftreefactory.js.map +0 -1
  68. package/built/src/merkle/types.d.ts +0 -11
  69. package/built/src/merkle/types.js +0 -2
  70. package/built/src/merkle/types.js.map +0 -1
  71. package/built/test/unit/merkle/merkleHelper/merkleHelperTest.js +0 -85
  72. package/built/test/unit/merkle/merkleHelper/merkleHelperTest.js.map +0 -1
  73. package/changelog.md +0 -637
  74. /package/built/test/{unit/merkle/merkleHelper/merkleHelperTest.d.ts → pcctf/getSuites.test.d.ts} +0 -0
package/changelog.md DELETED
@@ -1,637 +0,0 @@
1
- Version 2.0.0
2
-
3
- # Changelog
4
-
5
- All notable changes to this project will be documented in this file.
6
-
7
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
-
10
- ## [x.x.x]
11
-
12
- ### Fixed
13
-
14
- - Fixed a bug of `sendTransaction` that did not consider status polling assignements through `client.config`, but instead, did only considering assignements through `config`
15
-
16
- ### Added
17
-
18
- - Support for response headers `X-Transaction-Timestamp`
19
- - Support for contentType `application/octet-stream` in `GET` requests
20
- - An optional attribute `transactionTimestamp` to the type `ResponseObject` that is filled through response headers
21
- - The client function `getWaitingTransactions` that fetches a list of waiting transaction RIDs from a specified blockchain
22
- - The client function `getWaitingTransaction` that fetches a specific waiting transaction's binary data and the transaction's timestamp from the specified blockchain
23
- - The client function `getRejectedTransactions` that fetches a list of rejected transactions with their rejection reasons from a specified blockchain
24
- - The types `WaitingTransaction`, `RejectedTransaction` and `RejectedTransactionResponse`
25
- - A new zod validation function `isRawGtx` that parses an `unknown` value and returns `value is RawGtx`
26
- - The zod validation function `validateStatusObject` that parses an `unknown` input and returns `StatusObject` or an error
27
- - The value `Pending` in the enum `ResponseStatus`, that indicates a `TransactionReceipt` has been created in its initial state, without receiving any confirmation yet from the `Dapp` or `System` clusters.
28
- - A new zod validation function `isRawGtx` that parses an `unknown` value and returns value is RawGtx
29
- - The type `GtvExtra`
30
-
31
- ### Changed
32
-
33
- - Renamed `StatusObject` to `TransactionStatusReponse`
34
- - The response type of the function `getTransactionStatus` from `Promise<TransactionReceipt | StatusObject>` to `Promise<StatusObject>`
35
- - `Web3EventMap` refactored to generic
36
- - The custom error `UnexpectedStatusError` constructor argument `error` type from `any` to `string | undefined`
37
- - The client query function `getBlocks` argument `callback` type changed from `TransactionInfo[]` to `BlockInfo[]`
38
- - The client query function `getBlocksInfo` argument `callback` type changed from `TransactionInfo[]` to `BlockInfo[]`
39
- - The type `QueryObject` has now a default type of `RawGtv` for `TReturn` and a phantom `_returnType` field to preserve the return type at compile time, without runtime impact
40
- - The argument `response` of the type `QueryCallback` changed from `TReturn` to `TReturn | null`
41
- - The function `callbackPromiseBuilder` to use generics `<T, U = T>` for stronger type safety and replaced all `any` type usages with typed parameters
42
- - The property `rspBody` of the function `handlePostResponsePromisified` was changed from `any` to `RawGtv | null | undefined`
43
- - Made `handlePostResponse` generic by adding `<T extends RawGtv>` and updated its callback type from `ClientCallback<RawGtv>` to `ClientCallback<T>`
44
- - The function `convertToPrintable` has now return type of `string`. In addition, the input argument `responseObject` type was changed from `any` to `unknown`
45
- - The argument `value` type of the function `checkGtvType` from `any` to `unknown`
46
- - The argument `value` type of the function `checkGtxType` from `any` to `unknown`
47
- - The argument `obj` type of the function `gtvHash` from `any` to `RawGtv`
48
- - The custom error `UnexpectedArgumentTypeError` constructor argument `typedArg` type from `any` to `ASNValue`
49
- - The `gtvExtra` type attribute from `any` to `GtvExtra`
50
-
51
- ### Removed
52
-
53
- - The function `signRawTransaction`
54
- - Moved the function `requestWithFailoverStrategy` from `./failoverStrategies` to `./requestWithFailoverStrategy`
55
- - The deprecated client function `getTransactionRid`. The function `calculateTransactionRid` that can be found in `src/utils/calculateTransactionRid` should be used instead, to calculate the transaction rid
56
- - The deprecated client function `getBlocksInfo`. The client function `getBlocks` should be used instead
57
- - The deprecated client function `encodeTransaction`. The function `encodeTransaction` that can be found in `src/utils/encodeTransaction.ts` should be used instead
58
- - The deprecated client function `decodeTransactionToGtx`. The function `decodeTransactionToGtx` that can be found in `src/utils/encodeTransaction.ts` should be used instead
59
- - The type `Web3EventMap` that was used to handle the event types of `Web3EventEmitter`
60
-
61
- ## [1.22.0]
62
-
63
- ### Added
64
-
65
- - The validation functions `isTransactionInfo` and `isTransactionInfoArray`
66
- - The optional input arguments `afterTime` and `signerPubKey` to the client function `getTransactionsInfo`. These input arguments are used as query parameters for the GET api `/transactions/{blockchainRid}/`
67
-
68
- ### Fixed
69
-
70
- - Merkle hash calculation corrected for big arrays
71
- - Changed logging to warn instead of error when the feature endpoint `/config/{blockchainRid}/features` is not available
72
-
73
- ## [1.21.1]
74
-
75
- ### Fixed
76
-
77
- - An issue of the `createClient` functions `sendTransaction` and `signAndSendUniqueTransaction` that did performed a directory chain query to `cm_get_blockchain_api_urls` and that was causing local integration tests to fail, as well as local development (when running local nodes)
78
-
79
- ### Added
80
-
81
- - The type `ClientConfig` to have a new parameter `merkleHashVersion` that can be used to specify the merkle hash version to be used. If not provided, the function will try to get the merkle hash version from the dapp, by using the feature endpoint `/config/{blockchainRid}/features`.
82
-
83
- ## [1.21.0]
84
-
85
- ### Changed
86
-
87
- - Various input types of `Buffer` or `string` to `BufferId` (`Buffer | string`) for function parameters that expected transaction RIDs or blockchain RIDs. The following functions are affected:
88
- - `getTransaction` parameter `transactionRid`
89
- - `getTransactionStatus` parameter `transactionRid`
90
- - `getTransactionInfo` parameter `transactionRid`
91
- - `getTransactionConfirmationLevel` parameter `transactionRid`
92
- - `getConfirmationProof` parameter `txRID`
93
- - `getClusterAnchoringTransactionConfirmation` parameter `transactionRid`
94
- - `getSystemAnchoringTransactionConfirmation` parameter `anchoredTxRid`
95
- - `getGTXFromBufferOrTransactionOrOperation` parameter `blockchainRid`
96
- - `ConfirmationProofException` constructor parameter `transactionRid`
97
- - `createIccfProofTx` parameters `txToProveRid`, `sourceBlockchainRid` and `targetBlockchainRid`
98
- - `getBlockAnchoringTransaction` parameter `txRid`
99
- - `isBlockAnchored` parameter `txRid`
100
- - `getAnchoringClient` parameter `dappBlockchainRid`
101
- - `fetchAndVerifyTransaction` parameter `txToProveRID`
102
- - `composeProofTransactionObject` parameter `sourceBlockchainRid`
103
- - The `client` function `getClusterAnchoringTransactionConfirmation` now takes an additional input argument of `anchoringClient`
104
- - The `client` function `getSystemAnchoringTransactionConfirmation` now takes two additional input arguments of `anchoringClient` and `systemAnchoringChainRid`
105
- - Changed the response type of the function `getSystemAnchoringChain` to now return `Buffer` instead of `Buffer | null`. The function will instead
106
- throw a `SystemChainException` instead if `null` is returned from the query, informing the user an invalid client was provided.
107
- - The `client` function `getClusterAnchoringTransactionConfirmation` now takes an additional input argument of `anchoringClient`
108
- - The `client` function `getSystemAnchoringTransactionConfirmation` now takes two additional input arguments of `anchoringClient` and `systemAnchoringChainRid`
109
- - Changed the response type of the function `getSystemAnchoringChain` to now return `Buffer` instead of `Buffer | null`. The function will instead
110
- throw a `SystemChainException` instead if `null` is returned from the query, informing the user an invalid client was provided.
111
- - Updated the types `ClientConfig` and `NetworkSettings` to contain separate status polling configurations (interval and count),
112
- allowing for different polling setups for dapp, cluster and system requests
113
- - Updated the polling functions `getBlockAnchoringTransaction` and `awaitGetAnchoringTransactionForBlockRid` to receive the correct status polling properties
114
- - The function `checkDigestSignature` to expect a `Buffer` signature instead of `Buffer` or `undefined`.
115
-
116
- ### Added
117
-
118
- - The function `ensureString` that receives a `BufferId` and returns a hex string in upper case
119
- - Updated the interface `TransactionReceipt` to contain the optional parameters `clusterAnchoringClientBrid` and `systemAnchoringClientBrid` that are populated
120
- once a transaction is anchored in Cluster Anchoring Chain and System Anchoring Chain
121
- - The utility function `getAnchoringClientAndSystemChainRid` that returns the type `AnchoringClientAndSystemBrid` providing it with a dapp `client`.
122
- This utility function should be used to provide the correct inputs for the client functions `clusterAnchoringClientBrid` and `systemAnchoringClientBrid`
123
- - The type `AnchoringClientAndSystemBrid` that returns an `anchoringClient` and the `systemAnchoringChainBridString`
124
- - The types `TransactionsCount` and `TransactionConfirmationProof`
125
- - Several zod validation functions, to be used for the api responses under the type `ResponseObject` and property `rspBody`
126
- - The function `getSystemAnchoringTransaction` that returns a system anchored transaction or null if the cluster anchoring transaction is not anchored in the system anchoring chain
127
- - The client function `getAnchoringStatusForBlockRid` that returns `BlockAnchoringState`
128
- - The type `BlockAnchoringState` to be used as return type for `getAnchoringStatusForBlockRid`
129
- - Created the utility function `setStatusPolling` that can be used to initialize default status polling properties if not specified
130
- - The type `StatusPolling` to be used for the dapp, cluster and system polling config in the types `ClientConfig` and `NetworkSettings`
131
- - Promi event enums `TransactionEvent` with values `ClusterAnchorConfirmed`, `SystemAnchorConfirmed`, `DappConfirmed`, `DappReceived`, `Signed`
132
- - Promi events are emitted in the order of the transaction lifecycle/confirmation steps
133
-
134
- ### Fixed
135
-
136
- - The `client` function `getClusterAnchoringTransactionConfirmation` now takes an additional input argument of `anchoringClient`
137
- - The `client` function `getSystemAnchoringTransactionConfirmation` now takes two additional input arguments of `anchoringClient` and `systemAnchoringChainRid`
138
- - Changed the response type of the function `getSystemAnchoringChain` to now return `Buffer` instead of `Buffer | null`. The function will instead
139
- throw a `SystemChainException` instead if `null` is returned from the query, informing the user an invalid client was provided.
140
- - Changed the generic `ResponseObject` to a strict type. The property `rspBody` is of type `unknown` and it is validated for each different case
141
- using zod validation functions for the expected type
142
- - An issue in the function `checkGTXSignatures` that will now return `false` if the `gtx.signatures` array is empty or not an array
143
-
144
- ### Removed
145
-
146
- - The types `GetBlocksResponse` and `GetBlockResponse`
147
- - The promi event "sent" is no longer emitted
148
-
149
- ## [1.20.2]
150
-
151
- ### Fixed
152
-
153
- - Resolved an issue where retrieving an anchoring transaction and its ICCF proof could result in mismatch if the queries were made against unsynchronized nodes
154
-
155
- ## [1.20.1]
156
-
157
- ### Fixed
158
-
159
- - An issue with the escaping of characters in the generated package.json content of the esm build
160
- - Added @types/bn.js as runtime dependencies to fix the missing decleration one gets after installing postchain-client and trying to transpile from typescript to javascript
161
-
162
- ## [1.20.0]
163
-
164
- ### Added
165
-
166
- - The function nullable `getTransactionConfirmationLevel` in `createClient` that expects a `transactionRid` and returns a `TransactionReceipt`
167
- that indicates the last successful confirmation of a transaction, as well as an anchoring transaction if the transaction is added in a block (Cluster Anchoring Confirmation).
168
- - The function `getClusterAnchoringTransactionConfirmation` in `createClient`, that given a `transactionRid` will return an anchoring transaction
169
- - Added `rollup-plugin-visualizer` to the Rollup configuration for bundle analysis.
170
- - Added tests coverage scripts in package.json
171
- - Created the client function `getSystemAnchoringTransactionConfirmation` that returns a system anchored transaction based on the provided anchored transaction rid
172
- - Added the util function `getSystemAnchoringChain` that queries the directory client and returns the system anchoring chain rid
173
- - Extended the logic of the function `sendTransaction`, `signAndSendUniqueTransaction` and `getTransactionConfirmationLevel` to also include system anchoring cluster confirmation
174
- - Added the type `BufferId = string | Buffer` that also supports `ensureBuffer`
175
-
176
- ### Fixed
177
-
178
- - A bug in the function `getAnchoringTransactionForBlockRid` that was not handling nullable response, given the query
179
- `get_anchoring_transaction_for_block_rid` can return null
180
- - Moved validation tests from the `src/blockchainClient/validation` to `test/unit/validation`
181
- - Fixed a bug in the function `getAnchoringClient` that did not set the created client network settings to the one provided as input argument to the function
182
-
183
- ### Changed
184
-
185
- - Extended the `createClient` functions `sendTransaction` and `signAndSendUniqueTransaction` to accept a new input parameter `confirmationLevel`
186
- that will resolve the promise based on the configurable confirmation selection and will emit a “sent” promiEvent with the confirmation status in each confirmation step
187
- - Extended the parameters of the types `ClientConfig` and `NetworkSettings` to contain `directoryChainRid`
188
- - Extended the function `getBlockAnchoringTransaction` to retrieve an anchoring transaction with polling
189
- - Updated the callback type of `getTransactionStatus` to `RestClientCallback<TransactionReceipt> | RestClientCallback<StatusObject>`
190
- - Updated the callback type of `getTransactionConfirmationLevel` to `RestClientCallback<StatusObject | TransactionReceipt>`
191
- - Updated the callback type of `getClusterAnchoringTransactionConfirmation` to `RestClientCallback<TransactionReceipt>`
192
- - Updated the rest client `postTransaction` function, to support binary formatted transactions
193
-
194
- ## [1.19.1]
195
-
196
- ### Fixed
197
-
198
- - bumped secp256k1 dependency to 4.0.4, to fix vulnerability
199
-
200
- ## [1.19.0]
201
-
202
- ### Added
203
-
204
- - added new request strategy `Query Majority`. (See README for more information)
205
- - new `getBlocks` method that has additional query params to search for blocks
206
-
207
- ### Fixed
208
-
209
- - bug in decodeTransactionToGtx that occurs when data has Bigint values
210
-
211
- ### Deprecated
212
-
213
- - `getBlocksInfo` method in `IClient` interface. Use `getBlocks` instead.
214
-
215
- ## [1.18.0]
216
-
217
- ### Changed
218
-
219
- - release pipeline
220
- - replace node.js server with MSW in iccf unit tests
221
- - replace node.js server with MSW in restClient unit tests
222
- - replace node.js server with MSW in blockChainClient utils' unit tests
223
-
224
- ### Added
225
-
226
- - the possibliity to set `useStickyNode` in the config of `blockchainClient` and `restClient`.
227
- - release guideline
228
- - dumpGtx and dumpGtv util functions for debugging purposes. This functions transforms a GTX or GTV object into a human-readable string.
229
-
230
- ## [1.17.0]
231
-
232
- ### Added
233
-
234
- - `getAppStructure` method to `IClient` interface that returns app structure in JSON format
235
-
236
- ### Changed
237
-
238
- - Husky will no longer install in CI
239
- - Added deprecation annotation as a function signature overload for `setLogLevel`
240
- - pipelines for version release
241
- - rework ResponseObject and add generic types TData, TErorr to it
242
- - add RetryRequestProps type to RetryRequest and singleEndpoint methods
243
-
244
- ### Fixed
245
-
246
- - typos across all app
247
- - Updates wrong types for nodeUrl and nodeUrlPool in MissingNodeUrlError
248
-
249
- ## [1.16.1]
250
-
251
- ### Added
252
-
253
- - `convertToRellOperation` is now part of pcl public API
254
-
255
- ## [1.16.0]
256
-
257
- ### Changed
258
-
259
- - Separated non-backend dependent functions from interface `IClient`. Functions `getTransactionRid`, `encodeTransaction`, and `decodeTransactionToGtx` have been extracted and are now separate utility functions.
260
- - Renamed `getTransactionRid` to `calculateTransactionRid` for clarity. Its input type has been changed to `RawGtxBody`. Conversion functions have been introduced to facilitate this transition.
261
- - Modified the input type of `encodeTransaction` to `GTX`.
262
-
263
- - Use PascalCase for types and class names:
264
- - `getTransactionRidException` -> `GetTransactionRidException`.
265
- - `transactionInfoInBlockResponse`-> `TransactionInfoInBlockResponse`.
266
- - `transactionInfoInBlock` -> `TransactionInfoInBlock`.
267
- - change `npm install` to `npm ci` command
268
-
269
- - split unit tests for `sendTransaction` to separate file. Replace Express mock server with MSW.
270
- - rework validation for client and server errors. Now it covers all 4xx and status codes.
271
- - Replace node server with MSW for unit tests in blockchainClient.test.ts.
272
-
273
- ### Added
274
-
275
- - function for fetching information about the latest block for a chain. The funcition is added to the `IClient` interface and is called `getLatestBlock`.
276
- - verify if changelog changed in pipeline to prevent merging branch without updating it
277
- - create a custom error which include the http status code. Exported as `CustomError`.
278
- - automate integration tests to get BRID from running test node.
279
- - strictNullChecks in tsconfig.json to provide better type checking
280
-
281
- ### Fixed
282
-
283
- - bug in retryRequest function which in some cases treated https errors as a successfull request.
284
-
285
- ## [1.15.2]
286
-
287
- ### Fixed
288
-
289
- - promiEvent ts error in npm package
290
-
291
- ## [1.15.1]
292
-
293
- ### Changed
294
-
295
- - Removed library dependency: `web3-core-promievent`.
296
- - The type `Web3PromiEvent` is now exported publicly.
297
-
298
- ## [1.15.0]
299
-
300
- ### Changed
301
-
302
- - The types `RawGtxBody` and `RawGtxOp`are now exported publicly.
303
- - function `getDigestToSignFromRawGtxBody`is now exported publicly.
304
- - Changes `SignatureProvider` type callback method `sign()` to provide a paramater of type `rawGtxBody` instead of a `digest`. This change is implemented to make it possible to review the content of a transaction before signing.
305
-
306
- ## [1.14.0]
307
-
308
- ### Added
309
-
310
- - better input validation for blockChainClient
311
-
312
- ### Fixed
313
-
314
- - logLevel=ERROR will now only logs errors
315
- - getConfirmationProof will now properly retrieve the transaction index
316
-
317
- ## [1.13.0]
318
-
319
- ### Added
320
-
321
- - Both `sendTransaction` and `signAndSendUniqueTransaction` now takes a new flag parameter `doStatusPolling` which can be set to either `true` or `false`. Setting the flag to `false` will prevent any further automatic status polling requests from being sent for the transaction. The method will in this case return with a final transaction status of `waiting`.
322
- - logLevel can be enum with values: [DEBUG, INFO, WARNING, ERROR]
323
- - logger can be configured through node env i.e. LOG_LEVEL=DEBUG
324
- - add `disable` method to logger
325
- - Adds a `createStubClient` function returning an `IClient`. All methods returning a `Promise` return a rejected `Promise`, all methods which return `Web3PromiEvent` return a rejected `Web3PromiEvent` and other methods just throw an `Error`.
326
-
327
- ### Fixed
328
-
329
- - bug in return type of `getAnchoringTransactionForBlockRid`.
330
- - enhanced the README by providing a more detailed guide on creating a client, including an expanded description of its configuration settings.
331
-
332
- ## [1.12.0]
333
-
334
- ### Added
335
-
336
- - Node URLs in the pool will be marked as 'unreachable' if a request returns a 50\* status. This feature, part of FailoverConfig, suspends a node's usage for a default duration of 30,000 milliseconds (5 minutes). Clients can be configure during initialization for tailored duration.
337
-
338
- ## [1.11.0]
339
-
340
- ### Added
341
-
342
- - Adds client method `getBlockInfo` to enable the user to fetch the data for a single block by providing either `height` or `txRid`.
343
-
344
- ## [1.10.0]
345
-
346
- ### Changed
347
-
348
- - `pollingInterval` has changed name to `statusPollInterval` in `NetworkSettings`. The reason is to easier understand what the polling interval is used for.
349
- - `sendTransaction` and `signAndSendUniqueTransaction` continue polling the status of the transaction if the last returned status was `unknown`. Previously only status `waiting` triggered new fetching. To avoid polling infinitely, a maximum number has been added. It is configurable when creating a client, see section Added.
350
- - remove index signature in exported type `GTX`.
351
-
352
- ```
353
- export type GTX = {
354
- [x: string]: unknown; // <---- removed
355
- blockchainRid: Buffer;
356
- operations: RellOperation[];
357
- signers: Buffer[];
358
- signatures?: Buffer[];
359
- };
360
- ```
361
-
362
- ### Added
363
-
364
- - possibility to configure the maximum number of times `sendTransaction` and`signAndSendUniqueTransaction` should poll for the status before quitting. It is included in `NetworkSettings` and is called `statusPollCount`. Default value is 20.
365
-
366
- ### Fixed
367
-
368
- - `@types/node` as `devDependencies` instead of `dependencies`.
369
-
370
- ## [1.9.0]
371
-
372
- ### Added
373
-
374
- - add the package `events` as peer-dependency. Solves users issue of missing `events` when using the lib in a non Node environment.
375
- - function in IClient for fetching blocks info for a chain. It is called `getBlocksInfo`.
376
-
377
- ### Fixed
378
-
379
- - correct small mistakes in README.
380
- - fix bug in function `getDigestToSignFromBody`. It should take an input as type `RawGtxBody` instead of `GtxBody`. The function is renamed to `getDigestToSignFromRawGtxBody`.
381
- - correct mistake in README in the instructions of a function called `askUserBToSign`.
382
-
383
- ## [1.8.1]
384
-
385
- ### Fixed
386
-
387
- - export enum `FailoverStrategy`.
388
-
389
- ## [1.8.0]
390
-
391
- ### Changed
392
-
393
- - Type called `KeyPair` changed from having `pubKey`as optional to being mandatory.
394
- - `signTransaction` and `signAndSendUniqueTransaction` no longer accept `signMethod` as type `PrivKey`, instead it have to be a `KeyPair` or `SignatureProvider`.
395
- - Changed plugin `commonJS()` of ESM build-step in `Rollup.config.mjs` to transform mixed modules to ESM modules.
396
- - Moved up plugin `resolve()` of ESM build-step in `Rollup.config.mjs` to top of plugin list.
397
-
398
- ### Fixed
399
-
400
- - randomly pick node from `directoryNodeUrlPool` when querying for the brid of directory chain.
401
- - `txRejectedError` to have public properties.
402
-
403
- ## [1.7.1] - 2023-09-28
404
-
405
- ### Fixed
406
-
407
- - When using `QueryObject`, you must specify return type.
408
- - Use type `DictPair` instead of `QueryArguments` alias.
409
-
410
- ## [1.7.0] - 2023-09-27
411
-
412
- ### Fixed
413
-
414
- - Change order of generic types of `query` to `query<TReturn, TArgs>`.
415
-
416
- ### Added
417
-
418
- - Generic type of QueryObject, `QueryObject<TReturn, TArgs>`.
419
-
420
- ## [1.6.0] - 2023-09-22
421
-
422
- ### Added
423
-
424
- - `BlockchainUrlUndefinedException` exported.
425
- - in IClient, `getTransactionsInfo` which fetch info about transactions on the chain.
426
- - in IClient, `getTransactionInfo` which fetch info about a transaction.
427
- - in IClient, `getTransactionCount` which fetch number of successful transactions on the chain.
428
-
429
- ### Fixed
430
-
431
- - bug in `TxRejectedError`, the error will print the rejection reason if it exist. From the error it is possible to get `shortReason`, `rellLine`, and `operation` (used like `error.operation`).
432
- - updating to camelCase for the abbreviations. blockchainRID -> blockchainRid.
433
-
434
- ## [1.5.10] - 2023-09-15
435
-
436
- ### Added
437
-
438
- - Ability to choose a failover strategy for a client. The following three are available: `AbortOnError`, `TryNextOnError`, `SingleEndpoint`. A description can be found in the README.
439
-
440
- ### Fixed
441
-
442
- - encode txProof and anchroingProof that are included as arguments in iccf_proof operation
443
- - remove check for only blockchainRid when initialize client, new flow either blockchainRid or blockchainIid need to exist.
444
-
445
- ## [1.5.9] - 2023-08-30
446
-
447
- ### Fixed
448
-
449
- - Set content-type to octet-stream when making post requests
450
-
451
- ## [1.5.8] - 2023-08-25
452
-
453
- ### Added
454
-
455
- - Abillity to check if transaction is anchored, `isBlockAnchored`, `getBlockAnchoringTransaction`,
456
- - create client configured to anchoring chain, `getAnchoringClient`
457
- - export ICCF types and errors
458
- - improved error handling in get requests. When status code is not 200, it returns error
459
- containing information from servers error message.
460
-
461
- ## [1.5.7] - 2023-08-15
462
-
463
- ### Added
464
-
465
- - Export custom errors
466
- - ICCF experimental feature, exported function called `createIccfProofTx`
467
-
468
- ## [1.5.6] - 2023-07-07
469
-
470
- ### Fixed
471
-
472
- - Add type `ReadonlyArray<RawGtv>` to union of `RawGtv`
473
- - uncought promise in send transaction
474
-
475
- ## [1.5.5] - 2023-07-03
476
-
477
- ### Fixed
478
-
479
- - Sort string maps before encoding
480
- - Because of postchain update, add HTTP header to accept response as binary instead of JSON
481
-
482
- ## [1.5.4] - 2023-06-28
483
-
484
- ### Fixed
485
-
486
- - Explicit import of Buffer
487
- - Export type IClient
488
- - Fix bug when using client initialized with blockchainID
489
-
490
- ## [1.5.3] - 2023-06-22
491
-
492
- ### Fixed
493
-
494
- - Buffer as peer dependency
495
-
496
- ## [1.5.2] - 2023-06-20
497
-
498
- ### Fixed
499
-
500
- - Export commonly used types
501
-
502
- ## [1.5.1] - 2023-06-20
503
-
504
- ### Fixed
505
-
506
- - Move lodash from devDependency to dependency
507
-
508
- ## [1.5.0] - 2023-06-14
509
-
510
- ### Added
511
-
512
- - support for negative numbers
513
-
514
- ## [1.4.0] - 2023-06-14
515
-
516
- ### Added
517
-
518
- - simplifyed API, exported as `createClient` from `index.js`, simplifies usage by reducing boilerplate code for users. Its design focuses on streamlining the API and minimizing setup complexities, resulting in a more user-friendly experience.
519
-
520
- ## [1.3.2] - 2023-04-28
521
-
522
- ### Fixed
523
-
524
- - bug when logger prints a bigInt
525
-
526
- ## [1.3.1] - 2023-04-26
527
-
528
- ### Fixed
529
-
530
- - bug when sending big integer in transaction
531
-
532
- ## [1.3.0] - 2023-04-19
533
-
534
- ### Added
535
-
536
- - bigInt support
537
-
538
- ## [1.2.0] - 2023-03-27
539
-
540
- ### Added
541
-
542
- - integration tests for merkle root calculation
543
-
544
- ### Changed
545
-
546
- - `newSignatureProvider()` now has keyPair as optional argument. If no keyPair is provided it will instead be generated.
547
-
548
- ## [1.1.0] - 2023-02-17
549
-
550
- ### Added
551
-
552
- - signatureProvider interface and newSignatureProvider()
553
-
554
- ### Removed
555
-
556
- - `RestClient.getConfirmationProof` function
557
-
558
- ### Changed
559
-
560
- - `ITransaction.sign` now can be used with a single argument, which can implement the signatureProvider interface or be the privKey. This function is now async
561
- - `GTX.sign` now has two overloads, both of which are async. The GTX is now passed as first parameter.
562
- - `RestClient.query`and `GtxClient.query` now has two overloads, the new signature takes the query name and query arguments as separate inputs. The old signature is marked as depricated an will be removed in the future.
563
-
564
- ### Fixed
565
-
566
- - `gtx` is now correctly typed in both `GTX.sign` and `GTX.addSignature`
567
-
568
- ## [1.0.3] - 2023-02-03
569
-
570
- ### Added
571
-
572
- - Compatible with ESM, CommonJS and UMD
573
- - Boolean support
574
-
575
- ### Changed
576
-
577
- - A query uses postchain endpoint called `query_gtv` which means that data is sent and recieved in GTV-encoded format.
578
- - Release notes now in changelog file.
579
- - Node 18 required when using this library in a Node environment.
580
-
581
- ## [1.0.2] - 2022-12-23
582
-
583
- ### Added
584
-
585
- - DecodeValueGtx ensures type of RawGtx before return. (commit missed in last release)
586
-
587
- ### Changed
588
-
589
- - Rename export from chromiaClientProvider to chromiaClient.
590
-
591
- ## [1.0.1] - 2022-12-21
592
-
593
- ### Changed
594
-
595
- - Update types of input parameters and return types of the following functions:
596
-
597
- - encodeValue (serialization.ts)
598
- - decodeValue (serialization.ts)
599
- - gtvHash (src/gtv/index.ts)
600
-
601
- - Set default logging to be less verbose
602
-
603
- ### Fixed
604
-
605
- - Bug in function blockchainConnection (chromiaClientProvider.ts)
606
-
607
- ## [1.0.0] - 2022-12-09
608
-
609
- ### Added
610
-
611
- - New logger accessible in index.ts.
612
- - Enable the client to connect to a blockchain through multiple nodes running the blockchain.
613
- - Load balancing by randomly distributing transactions and queries between nodes.
614
- - Retry policy added for request to the blockchain.
615
- - Enables you to discover the nodes running your blockchain by querying D1 with your dapp´s blockchain RID. Read more in the Chromia client providers [Readme](./src/chromia/README.md).
616
-
617
- ### Changed
618
-
619
- - Previously a rest client was initialized with one string containing the address of the node running your blockchain. Now an instance of the rest client is initiated with a list of strings representing the addresses of the nodes where your dapp is running.
620
- - Previously a rest client query was called with two parameters; queryName and queryObject. Now this call only takes one parameter called queryObject, which is defined as:
621
-
622
- ```javascript
623
- {
624
- type: string;
625
- [Arg
626
- :
627
- string
628
- ]:
629
- RawGtv;
630
- }
631
- ```
632
-
633
- where type is what previously was called query name.
634
-
635
- ## [0.\*.*]
636
-
637
- Early version of the postchain-client written in javascript.