Skip to content

Commit

Permalink
v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
martiliones authored Nov 19, 2023
2 parents 139778b + 13566c6 commit 0626686
Show file tree
Hide file tree
Showing 9 changed files with 445 additions and 358 deletions.
74 changes: 72 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Changelog

## [2.1.0] - 2023-11-17

### Added

- `api.initSocket()` now accepts an instance of `WebSocketClient` as an argument:

```js
const socket = new WebSocketClient({ /* ... */ })

api.initSocket(socket)
// instead of
api.socket = socket
```

- Improved the `encodeMessage()` and `decodeMessage()` functions to accept public keys as Uint8Array or Buffer

```js
import {encodeMessage, createKeypairFromPassphrase} from 'adamant-api'

const {publicKey} = createKeypairFromPassphrase('...')
const message = encodeMessage(,, publicKey) // No need to convert public key to string
```

- `decodeMessage()` allows passing a key pair instead of a passphrase:

```js
import {decodeMessage, createKeypairFromPassphrase} from 'adamant-api'

const keyPair = createKeypairFromPassphrase('...')
const message = decodeMessage(,, keyPair,) // <- It won't create a key pair from passphrase again
```

- TypeScript: Export transaction handlers TypeScript utils: `SingleTransactionHandler`, `AnyTransactionHandler`, `TransactionHandler<T extends AnyTransaction>`

### Fixed

- TypeScript: Fixed typing for `AdamantApiOptions` by adding `LogLevelName` as possible value for `logLevel` property.

For example, you can now use `'log'` instead of `LogLevel.Log` in TypeScript:

```ts
const api = new AdamantApi({ /* ... */ logLevel: 'log' })
```

- TypeScript: Added missing declaration modules to npm that led to the error:

```
Could not find a declaration file for module 'coininfo'.
/// <reference path="../../types/coininfo.d.ts" />
```

- TypeScript: `amount` property in `ChatTransactionData` (`createChatTransaction()` argument) is now truly optional:

```diff
- amount: number | undefined;
+ amount?: number;
```

## [2.0.0] - 2023-10-12

### Added
Expand Down Expand Up @@ -28,6 +86,18 @@
await api.post('transactions/process', { transaction });
```


- **getTransactionId()** method

Pass signed transaction with signature to get a transaction id as a string:

```js
import {getTransactionId} from 'adamant-api'
const id = getTransactionId(signedTransaction)
```

_See [documentation](https://github.com/Adamant-im/adamant-api-jsclient/wiki/Calculating-transaction-id) for more information._

### Fixed

- **Creating multiple instances**
Expand Down Expand Up @@ -73,7 +143,7 @@
});
```

or specify `socket` option when initializing API:
Or specify `socket` option when initializing API:

```ts
// socket.ts
Expand Down Expand Up @@ -103,7 +173,7 @@
});
```

### Removeed
### Removed

- `createTransaction()`

Expand Down
33 changes: 18 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adamant-api",
"version": "2.0.0",
"version": "2.1.0",
"description": "JavaScript API library for the ADAMANT Blockchain",
"keywords": [
"adm",
Expand Down Expand Up @@ -40,7 +40,10 @@
"main": "dist/index.js",
"src": "src/index.ts",
"types": "dist/index.d.ts",
"files": ["dist/"],
"files": [
"dist/",
"types/"
],
"scripts": {
"test": "jest",
"lint": "gts lint",
Expand All @@ -53,8 +56,8 @@
"posttest": "npm run lint"
},
"dependencies": {
"@liskhq/lisk-cryptography": "3.3.0",
"axios": "^1.5.1",
"@liskhq/lisk-cryptography": "4.0.0",
"axios": "^1.6.2",
"bignumber.js": "^9.1.2",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.5",
Expand All @@ -71,20 +74,20 @@
"tweetnacl": "^1.0.3"
},
"devDependencies": {
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",
"@types/bytebuffer": "^5.0.45",
"@types/hdkey": "^2.0.1",
"@types/ed2curve": "^0.2.2",
"@types/jest": "^29.5.5",
"@types/node": "20.8.5",
"@types/pbkdf2": "^3.1.0",
"eslint": "^8.51.0",
"@commitlint/cli": "^18.4.2",
"@commitlint/config-conventional": "^18.4.2",
"@types/bytebuffer": "^5.0.47",
"@types/hdkey": "^2.0.3",
"@types/ed2curve": "^0.2.4",
"@types/jest": "^29.5.8",
"@types/node": "20.9.1",
"@types/pbkdf2": "^3.1.2",
"eslint": "^8.54.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-jest": "^27.6.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"prettier": "^3.1.0",
"ts-jest": "^29.1.1",
"gts": "^5.2.0",
"typescript": "~5.1.6"
Expand Down
Loading

0 comments on commit 0626686

Please sign in to comment.