UNPKG

@unilogin/sdk

Version:

SDK is a JS library, that communicates with relayer. SDK allows managing contract, by creating basic contract-calling messages.

14 lines (11 loc) 597 B
import {Message, PartialRequired} from '@unilogin/commons'; import {messageToSignedMessage, BlockchainService} from '@unilogin/contracts'; export class MessageConverter { constructor(private blockchainService: BlockchainService) { } async messageToSignedMessage(message: PartialRequired<Message, 'from'>, privateKey: string) { const networkVersion = await this.blockchainService.fetchHardforkVersion(); const walletVersion = await this.blockchainService.fetchWalletVersion(message.from); return messageToSignedMessage(message, privateKey, networkVersion, walletVersion); } }