UNPKG

@xpla/xpla

Version:

<p align="center"> <img src="https://user-images.githubusercontent.com/545047/188804067-28e67e5e-0214-4449-ab04-2e0c564a6885.svg" width="80"> </p>

12 lines (11 loc) 427 B
import { defaultPublicKeyConfig } from './defaults'; export function getAccountFromAuth(auth, pubKeyConfig = defaultPublicKeyConfig) { const publicKey = auth.getPublicKey(pubKeyConfig.isCompressed); const pubKeyHash = pubKeyConfig.hash(publicKey); return { algo: auth.algo, publicKey, cosmosAddress: pubKeyHash.toBech32('xpla'), ethereumAddress: pubKeyHash.toPrefixedHex(), }; }