Skip to content

Conversation

@martiliones
Copy link
Collaborator

@martiliones martiliones commented Nov 5, 2023

From changelog:

[2.1.0] - 2023-11-17

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;

…de methods (#45)

* chore: bump a version

* feat(encryptor): allow to encode message with buffer public key

* feat: allow to use buffer in `decodeMessage` as well

* feat: allow key pair instead of passphrase in `decodeMessage`

* refactor(encryptor): rewrite to ternary operator
@martiliones martiliones requested review from RealGoodProgrammer and adamant-al and removed request for RealGoodProgrammer November 17, 2023 13:33
@adamant-al
Copy link
Member

Merge and release.

@martiliones martiliones merged commit 0626686 into master Nov 19, 2023
@adamant-al
Copy link
Member

@martiliones Make a release in the repo and npmjs.

@martiliones
Copy link
Collaborator Author

@adamant-al the package was already published in npm. I just added v2.1.0 to the github releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants