-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- **feat(app): introduce Address component** - **feat(app): show raw and bech addresses** - **feat(app): improve partial intent feedback** - **feat(app): bech32 decode receiver** - **feat(app): bech32 decode/encode cosmos receive address**
- Loading branch information
Showing
7 changed files
with
89 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script lang="ts"> | ||
import type { Chain } from "$lib/types" | ||
import { toDisplayName } from "$lib/utilities/chains" | ||
import { hexAddressToBech32 } from "@unionlabs/client" | ||
import { isHex } from "viem" | ||
import ArrowLeftIcon from "virtual:icons/lucide/arrow-left" | ||
export let chains: Array<Chain> | ||
export let chainId: string | ||
export let address: string | null | ||
export let showChain = false | ||
export let showRaw = false | ||
const chain = chains.find(c => c.chain_id === chainId) ?? null | ||
const parsedAddress = | ||
chain?.rpc_type === "cosmos" && isHex(address) | ||
? hexAddressToBech32({ address, bech32Prefix: chain.addr_prefix }) | ||
: address | ||
const explorer = chain?.explorers?.at(0)?.address_url ?? null | ||
</script> | ||
|
||
<div class="flex flex-col text-xs"> | ||
<div class="flex gap-1 items-center"> | ||
{#if parsedAddress} | ||
{#if !chain} | ||
invalid chain {chainId} | ||
{:else} | ||
{#if !explorer} | ||
{parsedAddress} | ||
{:else} | ||
<a class="underline" href={`${explorer}/${parsedAddress}`}>{parsedAddress}</a> | ||
{/if}{#if showChain}<ArrowLeftIcon />{toDisplayName( | ||
chainId, | ||
chains, | ||
)}{/if} | ||
{/if} | ||
{/if} | ||
</div> | ||
{#if address && showRaw} | ||
<div class="text-muted-foreground"> | ||
RAW: {address} | ||
</div> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters