Skip to content

v2.1.0

Compare
Choose a tag to compare
@martiliones martiliones released this 23 Nov 18:06
· 5 commits to master since this release
0626686

Added

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

    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

    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:

    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:

    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:

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