envoylabs / whoami-ui

A UI for the whoami NFT-based nameservice
whoami-ui.vercel.app
Apache License 2.0
9 stars 3 forks source link

Copy address field should support multiple chains #116

Open the-frey opened 2 years ago

the-frey commented 2 years ago

To make the app less juno-specific, we should make it clear that the Juno address mapping could be multiple chains - and probably expose this more easily to the end user.

In the stakedrop viewer this was trivial using "bech32": "^2.0.0",:

const { bech32 } = require('bech32');

const DENOM = process.env.DENOM || 'juno';

const getDenom = () =>
  R.toLower(DENOM)

const getJunoAddress = (cosmosAddress) =>
  bech32.encode(getDenom(), bech32.decode(cosmosAddress).words);

In this case I guess we'd be switching between a whitelisted set of denom prefixes.