v2.1.0
Added
-
api.initSocket()now accepts an instance ofWebSocketClientas an argument:const socket = new WebSocketClient({ /* ... */ }) api.initSocket(socket) // instead of api.socket = socket
-
Improved the
encodeMessage()anddecodeMessage()functions to accept public keys as Uint8Array or Bufferimport {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: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
AdamantApiOptionsby addingLogLevelNameas possible value forlogLevelproperty.For example, you can now use
'log'instead ofLogLevel.Login TypeScript: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:
amountproperty inChatTransactionData(createChatTransaction()argument) is now truly optional:- amount: number | undefined; + amount?: number;