Version 1.7.1
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.7.1] - 2023-09-28
### Fixed
- When using `QueryObject`, you must specify return type.
- Use type `DictPair` instead of `QueryArguments` alias.

## [1.7.0] - 2023-09-27
### Fixed
- Change order of generic types of `query` to `query<TReturn, TArgs>`.
### Added
- Generic type of QueryObject, `QueryObject<TReturn, TArgs>`.

## [1.6.0] - 2023-09-22
### Added
- `BlockchainUrlUndefinedException` exported.
- in IClient, `getTransactionsInfo` which fetch info about transactions on the chain.
- in IClient, `getTransactionInfo` which fetch info about a transaction.
- in IClient, `getTransactionCount` which fetch number of successful transactions on the chain.

### Fixed
- 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`).
- updating to camelCase for the abbreviations. blockchainRID -> blockchainRid.

## [1.5.10] - 2023-09-15
### Added
- 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. 

### Fixed
- encode txProof and anchroingProof that are included as arguments in iccf_proof operation
- remove check for only blockchainRid when initialize client, new flow either blockchainRid or blockchainIid need to exist.

## [1.5.9] - 2023-08-30
### Fixed 
- Set content-type to octet-stream when making post requests

## [1.5.8] - 2023-08-25
### Added
- Abillity to check if transaction is anchored, `isBlockAnchored`, `getBlockAnchoringTransaction`, 
- create client configured to anchoring chain, `getAnchoringClient`
- export ICCF types and errors
- improved error handling in get requests. When status code is not 200, it returns error 
 containing information from servers error message.
## [1.5.7] - 2023-08-15
### Added
- Export custom errors
- ICCF experimental feature, exported function called `createIccfProofTx`
## [1.5.6] - 2023-07-07

### Fixed 

- Add type `ReadonlyArray<RawGtv>` to union of `RawGtv`
- uncought promise in send transaction
## [1.5.5] - 2023-07-03

### Fixed 

- Sort string maps before encoding
- Because of postchain update, add HTTP header to accept response as binary instead of JSON
## [1.5.4] - 2023-06-28

### Fixed 

- Explicit import of Buffer
- Export type IClient
- Fix bug when using client initialized with blockchainID
## [1.5.3] - 2023-06-22

### Fixed 

- Buffer as peer dependency
## [1.5.2] - 2023-06-20

### Fixed 

- Export commonly used types
## [1.5.1] - 2023-06-20

### Fixed 

- Move lodash from devDependency to dependency
## [1.5.0] - 2023-06-14

### Added 

- support for negative numbers

## [1.4.0] - 2023-06-14

### Added 

- 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.

## [1.3.2] - 2023-04-28

### Fixed 

- bug when logger prints a bigInt
## [1.3.1] - 2023-04-26

### Fixed 

- bug when sending big integer in transaction

## [1.3.0] - 2023-04-19

### Added 

- bigInt support

## [1.2.0] - 2023-03-27

### Added 

- integration tests for merkle root calculation
### Changed

- `newSignatureProvider()` now has keyPair as optional argument. If no keyPair is provided it will instead be generated.


## [1.1.0] - 2023-02-17

### Added 

- signatureProvider interface and newSignatureProvider()

### Removed
- `RestClient.getConfirmationProof` function

### Changed

- `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
- `GTX.sign` now has two overloads, both of which are async. The GTX is now passed as first parameter. 
- `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.

 ### Fixed
 
- `gtx` is now correctly typed in both `GTX.sign` and `GTX.addSignature`


## [1.0.3] - 2023-02-03

### Added 

- Compatible with ESM, CommonJS and UMD
- Boolean support

### Changed

- A query uses postchain endpoint called ```query_gtv``` which means that data is sent and recieved in GTV-encoded format. 
- Release notes now in changelog file.
- Node 18 required when using this library in a Node environment.


## [1.0.2] - 2022-12-23

### Added

- DecodeValueGtx ensures type of RawGtx before return. (commit missed in last release)

### Changed

- Rename export from chromiaClientProvider to chromiaClient.

## [1.0.1] - 2022-12-21

### Changed
- Update types of input parameters and return types of the following functions:
    - encodeValue (serialization.ts)
    - decodeValue (serialization.ts)
    - gtvHash (src/gtv/index.ts)

- Set default logging to be less verbose

### Fixed
- Bug in function blockchainConnection (chromiaClientProvider.ts)

## [1.0.0] - 2022-12-09

### Added
- New logger accessible in index.ts.
- Enable the client to connect to a blockchain through multiple nodes running the blockchain.
- Load balancing by randomly distributing transactions and queries between nodes.
- Retry policy added for request to the blockchain.
- 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).

### Changed
- 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. 
- 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:

```javascript
{
    type: string;
    [Arg
:
    string
]:
    RawGtv;
}
```
where type is what previously was called query name.

## [0.\*.*] 
Early version of the postchain-client written in javascript.


