From 777ba4d5d04bfe9648ca3431d1b3e203cb2ee5b9 Mon Sep 17 00:00:00 2001
From: liangping <18786721@qq.com>
Date: Wed, 3 May 2023 18:00:18 +0800
Subject: [PATCH] wellformat permission
---
src/modules/[chain]/cosmwasm/index.vue | 5 ++++-
src/stores/useFormatter.ts | 16 ++++++++++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/modules/[chain]/cosmwasm/index.vue b/src/modules/[chain]/cosmwasm/index.vue
index a844e595..b1b0ed68 100644
--- a/src/modules/[chain]/cosmwasm/index.vue
+++ b/src/modules/[chain]/cosmwasm/index.vue
@@ -26,7 +26,10 @@ wasmStore.wasmClient.getWasmCodeList().then(x =>{
{{ v.code_id }} |
{{ v.creator }} |
{{ v.data_hash }} |
- {{ v.instantiate_permission }} |
+
+ {{ v.instantiate_permission?.permission }}
+ {{ v.instantiate_permission?.address }}
+ |
diff --git a/src/stores/useFormatter.ts b/src/stores/useFormatter.ts
index 07f8ea59..f931444c 100644
--- a/src/stores/useFormatter.ts
+++ b/src/stores/useFormatter.ts
@@ -8,7 +8,7 @@ import updateLocale from 'dayjs/plugin/updateLocale'
import utc from 'dayjs/plugin/utc'
import localeData from 'dayjs/plugin/localeData'
import { useStakingStore } from "./useStakingStore";
-import { fromBase64, fromBech32, toHex } from "@cosmjs/encoding";
+import { fromBase64, fromBech32, fromHex, toHex } from "@cosmjs/encoding";
import { consensusPubkeyToHexAddress } from "@/libs";
import { useBankStore } from "./useBankStore";
import type { DenomTrace } from "@/types";
@@ -183,7 +183,19 @@ export const useFormatter = defineStore('formatter', {
},
multiLine(v: string) {
return v? v.replaceAll("\\n","\n"): ""
- }
+ },
+ hexToString(hex: string) {
+ if(hex) {
+ return new TextDecoder().decode(fromHex(hex))
+ }
+ return ""
+ },
+ base64ToString(hex: string) {
+ if(hex) {
+ return new TextDecoder().decode(fromBase64(hex))
+ }
+ return ""
+ }
}
})