UNPKG

@hashgraph/hedera-wallet-connect

Version:

A library to facilitate integrating Hedera with WalletConnect

32 lines (31 loc) 1.21 kB
import { ethers } from 'ethers'; /** * Gets message from various signing request methods by filtering out * a value that is not an address (thus is a message). * If it is a hex string, it gets converted to utf8 string * * @deprecated This function is deprecated and will be removed in the next major version. * Use `WagmiAdapter` from `@reown/appkit-adapter-wagmi` for EVM wallet connectivity instead. */ export function getSignParamsMessage(params) { const message = params.filter((p) => !ethers.isAddress(p))[0]; if (ethers.isHexString(message)) { return ethers.toUtf8String(message); } return message; } /** * Gets data from various signTypedData request methods by filtering out * a value that is not an address (thus is data). * If data is a string convert it to object * * @deprecated This function is deprecated and will be removed in the next major version. * Use `WagmiAdapter` from `@reown/appkit-adapter-wagmi` for EVM wallet connectivity instead. */ export function getSignTypedDataParamsData(params) { const data = params.filter((p) => !ethers.isAddress(p))[0]; if (typeof data === 'string') { return JSON.parse(data); } return data; }