diff --git a/src/modules/[chain]/account/[address].vue b/src/modules/[chain]/account/[address].vue index e8c7bc597d..61a16fc30e 100644 --- a/src/modules/[chain]/account/[address].vue +++ b/src/modules/[chain]/account/[address].vue @@ -10,8 +10,10 @@ import type { AuthAccount, Delegation, TxResponse, DelegatorRewards, UnbondingRe import type { Coin } from '@cosmjs/amino'; import Countdown from '@/components/Countdown.vue'; import { fromBase64 } from '@cosmjs/encoding'; +import { useQRCode } from '@vueuse/integrations/useQRCode'; const props = defineProps(['address', 'chain']); +const addressQrCode = useQRCode(computed(() => String(props.address || ''))); const blockchain = useBlockchain(); const stakingStore = useStakingStore(); @@ -25,6 +27,10 @@ const balances = ref([] as Coin[]); const recentReceived = ref([] as TxResponse[]); const unbonding = ref([] as UnbondingResponses[]); const unbondingTotal = ref(0); +const addressQrModal = ref(false); +const addressCopied = ref(false); +const publicKeyCopied = ref(false); +const copiedTxHash = ref(''); const chart = {}; onMounted(() => { loadAccount(props.address); @@ -111,6 +117,26 @@ function updateEvent() { loadAccount(props.address); } +async function copyAddress() { + await navigator.clipboard.writeText(props.address); + addressCopied.value = true; + window.setTimeout(() => (addressCopied.value = false), 1200); +} + +async function copyPublicKey(value: string) { + await navigator.clipboard.writeText(value); + publicKeyCopied.value = true; + window.setTimeout(() => (publicKeyCopied.value = false), 1200); +} + +async function copyTxHash(hash: string) { + await navigator.clipboard.writeText(hash); + copiedTxHash.value = hash; + window.setTimeout(() => { + if (copiedTxHash.value === hash) copiedTxHash.value = ''; + }, 1200); +} + function mapAmount(events: { type: string; attributes: { key: string; value: string }[] }[]) { if (!events) return []; return events @@ -125,20 +151,58 @@ function mapAmount(events: { type: string; attributes: { key: string; value: str
| Pub Key Type | +{{ value['@type'] }} | +
| Pub Key | +
+
+ {{ value.key }}
+
+
+ |
+
| Address | +
+
+ {{ value }}
+
+
+ |
+
| {{ String(key).replaceAll('_', ' ') }} | +