Download Latest Version v2.4.0 source code.zip (136.3 kB)
Email in envelope

Get an email when there's a new version of ADAMANT JavaScript API library

Home / v2.1.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2023-11-19 1.8 kB
v2.1.0 source code.tar.gz 2023-11-19 113.5 kB
v2.1.0 source code.zip 2023-11-19 133.9 kB
Totals: 3 Items   249.2 kB 1

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;

Source: README.md, updated 2023-11-19