postchain-client 2.0.1 → 2.0.2

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