Skip to content

Commit 0626686

Browse files
authored
v2.1.0
#43
2 parents 139778b + 13566c6 commit 0626686

File tree

9 files changed

+445
-358
lines changed

9 files changed

+445
-358
lines changed

CHANGELOG.md

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,63 @@
11
# Changelog
22

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+
361
## [2.0.0] - 2023-10-12
462

563
### Added
@@ -28,6 +86,18 @@
2886
await api.post('transactions/process', { transaction });
2987
```
3088

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+
31101
### Fixed
32102

33103
- **Creating multiple instances**
@@ -73,7 +143,7 @@
73143
});
74144
```
75145

76-
or specify `socket` option when initializing API:
146+
Or specify `socket` option when initializing API:
77147

78148
```ts
79149
// socket.ts
@@ -103,7 +173,7 @@
103173
});
104174
```
105175

106-
### Removeed
176+
### Removed
107177

108178
- `createTransaction()`
109179

package.json

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adamant-api",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "JavaScript API library for the ADAMANT Blockchain",
55
"keywords": [
66
"adm",
@@ -40,7 +40,10 @@
4040
"main": "dist/index.js",
4141
"src": "src/index.ts",
4242
"types": "dist/index.d.ts",
43-
"files": ["dist/"],
43+
"files": [
44+
"dist/",
45+
"types/"
46+
],
4447
"scripts": {
4548
"test": "jest",
4649
"lint": "gts lint",
@@ -53,8 +56,8 @@
5356
"posttest": "npm run lint"
5457
},
5558
"dependencies": {
56-
"@liskhq/lisk-cryptography": "3.3.0",
57-
"axios": "^1.5.1",
59+
"@liskhq/lisk-cryptography": "4.0.0",
60+
"axios": "^1.6.2",
5861
"bignumber.js": "^9.1.2",
5962
"bip39": "^3.1.0",
6063
"bitcoinjs-lib": "^6.1.5",
@@ -71,20 +74,20 @@
7174
"tweetnacl": "^1.0.3"
7275
},
7376
"devDependencies": {
74-
"@commitlint/cli": "^17.7.2",
75-
"@commitlint/config-conventional": "^17.7.0",
76-
"@types/bytebuffer": "^5.0.45",
77-
"@types/hdkey": "^2.0.1",
78-
"@types/ed2curve": "^0.2.2",
79-
"@types/jest": "^29.5.5",
80-
"@types/node": "20.8.5",
81-
"@types/pbkdf2": "^3.1.0",
82-
"eslint": "^8.51.0",
77+
"@commitlint/cli": "^18.4.2",
78+
"@commitlint/config-conventional": "^18.4.2",
79+
"@types/bytebuffer": "^5.0.47",
80+
"@types/hdkey": "^2.0.3",
81+
"@types/ed2curve": "^0.2.4",
82+
"@types/jest": "^29.5.8",
83+
"@types/node": "20.9.1",
84+
"@types/pbkdf2": "^3.1.2",
85+
"eslint": "^8.54.0",
8386
"eslint-config-google": "^0.14.0",
84-
"eslint-plugin-jest": "^27.4.2",
87+
"eslint-plugin-jest": "^27.6.0",
8588
"husky": "^8.0.3",
8689
"jest": "^29.7.0",
87-
"prettier": "^3.0.3",
90+
"prettier": "^3.1.0",
8891
"ts-jest": "^29.1.1",
8992
"gts": "^5.2.0",
9093
"typescript": "~5.1.6"

0 commit comments

Comments
 (0)