|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## [2.1.0] - 2023-11-17 |
| 4 | + |
| 5 | +### Added |
| 6 | + |
| 7 | +- `api.initSocket()` now accepts an instance of `WebSocketClient` as an argument: |
| 8 | + |
| 9 | + ```js |
| 10 | + const socket = new WebSocketClient({ /* ... */ }) |
| 11 | + |
| 12 | + api.initSocket(socket) |
| 13 | + // instead of |
| 14 | + api.socket = socket |
| 15 | + ``` |
| 16 | + |
| 17 | +- Improved the `encodeMessage()` and `decodeMessage()` functions to accept public keys as Uint8Array or Buffer |
| 18 | + |
| 19 | + ```js |
| 20 | + import {encodeMessage, createKeypairFromPassphrase} from 'adamant-api' |
| 21 | + |
| 22 | + const {publicKey} = createKeypairFromPassphrase('...') |
| 23 | + const message = encodeMessage(,, publicKey) // No need to convert public key to string |
| 24 | + ``` |
| 25 | + |
| 26 | +- `decodeMessage()` allows passing a key pair instead of a passphrase: |
| 27 | + |
| 28 | + ```js |
| 29 | + import {decodeMessage, createKeypairFromPassphrase} from 'adamant-api' |
| 30 | + |
| 31 | + const keyPair = createKeypairFromPassphrase('...') |
| 32 | + const message = decodeMessage(,, keyPair,) // <- It won't create a key pair from passphrase again |
| 33 | + ``` |
| 34 | + |
| 35 | +- TypeScript: Export transaction handlers TypeScript utils: `SingleTransactionHandler`, `AnyTransactionHandler`, `TransactionHandler<T extends AnyTransaction>` |
| 36 | + |
| 37 | +### Fixed |
| 38 | + |
| 39 | +- TypeScript: Fixed typing for `AdamantApiOptions` by adding `LogLevelName` as possible value for `logLevel` property. |
| 40 | + |
| 41 | + For example, you can now use `'log'` instead of `LogLevel.Log` in TypeScript: |
| 42 | + |
| 43 | + ```ts |
| 44 | + const api = new AdamantApi({ /* ... */ logLevel: 'log' }) |
| 45 | + ``` |
| 46 | + |
| 47 | +- TypeScript: Added missing declaration modules to npm that led to the error: |
| 48 | + |
| 49 | + ``` |
| 50 | + Could not find a declaration file for module 'coininfo'. |
| 51 | + /// <reference path="../../types/coininfo.d.ts" /> |
| 52 | + ``` |
| 53 | + |
| 54 | +- TypeScript: `amount` property in `ChatTransactionData` (`createChatTransaction()` argument) is now truly optional: |
| 55 | + |
| 56 | + ```diff |
| 57 | + - amount: number | undefined; |
| 58 | + + amount?: number; |
| 59 | + ``` |
| 60 | + |
3 | 61 | ## [2.0.0] - 2023-10-12 |
4 | 62 |
|
5 | 63 | ### Added |
|
28 | 86 | await api.post('transactions/process', { transaction }); |
29 | 87 | ``` |
30 | 88 |
|
| 89 | + |
| 90 | +- **getTransactionId()** method |
| 91 | + |
| 92 | + Pass signed transaction with signature to get a transaction id as a string: |
| 93 | + |
| 94 | + ```js |
| 95 | + import {getTransactionId} from 'adamant-api' |
| 96 | + const id = getTransactionId(signedTransaction) |
| 97 | + ``` |
| 98 | + |
| 99 | + _See [documentation](https://github.com/Adamant-im/adamant-api-jsclient/wiki/Calculating-transaction-id) for more information._ |
| 100 | + |
31 | 101 | ### Fixed |
32 | 102 |
|
33 | 103 | - **Creating multiple instances** |
|
73 | 143 | }); |
74 | 144 | ``` |
75 | 145 |
|
76 | | - or specify `socket` option when initializing API: |
| 146 | + Or specify `socket` option when initializing API: |
77 | 147 |
|
78 | 148 | ```ts |
79 | 149 | // socket.ts |
|
103 | 173 | }); |
104 | 174 | ``` |
105 | 175 |
|
106 | | -### Removeed |
| 176 | +### Removed |
107 | 177 |
|
108 | 178 | - `createTransaction()` |
109 | 179 |
|
|
0 commit comments