diff --git a/src/@core/layouts/components/app-navbar/components/SearchBar.vue b/src/@core/layouts/components/app-navbar/components/SearchBar.vue index 70cd9b5a..681e69c5 100644 --- a/src/@core/layouts/components/app-navbar/components/SearchBar.vue +++ b/src/@core/layouts/components/app-navbar/components/SearchBar.vue @@ -84,7 +84,7 @@ export default { doQuery() { const height = /^\d+$/ const txhash = /^[A-Z\d]{64}$/ - const addr = /^[a-z]+1[a-z\d]{38}$/ + const addr = /^[a-z]+1[a-z\d]{38,58}$/ const key = this.searchQuery const c = store.state.chains.selected diff --git a/src/lang/locales/en.json b/src/lang/locales/en.json index 17fcc5d2..25eb3328 100644 --- a/src/lang/locales/en.json +++ b/src/lang/locales/en.json @@ -130,6 +130,16 @@ "acct_num": "Account Number", "seq": "Sequence", "pub_key": "Public Key", + "contract_info": "Contract Info", + "query": "Query", + "code_id": "Code ID", + "creator": "Creator", + "admin": "Admin", + "label": "Label", + "created": "Created", + "height": "Height", + "tx_index": "Tx index", + "ibc_port_id": "IBC port ID", "orig_vest": "Original Vesting", "delegated_free": "Delegated Free", "delegated_vest": "Delegated Vesting", @@ -147,5 +157,10 @@ "two_ways": "There are two ways to monitor your validators:", "pin": "Pin a validator on Uptime pages.", "link": "Specify parameters like following:" + }, + "queryContractModal": { + "title": "Query Contract", + "submit": "Query", + "reset": "Reset" } } diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 66f40733..9ebd1dca 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -633,6 +633,22 @@ export default class ChainFetch { return index < conf.api.length ? index : 0 } + async getContractInfo(address, config = null) { + return this.get(`/cosmwasm/wasm/v1/contract/${address}`, config, true).then( + data => commonProcess(data.contract_info), + ) + } + + async queryContract(address, msg, config = null) { + return this.get( + `/cosmwasm/wasm/v1/contract/${address}/smart/${encodeURIComponent( + btoa(msg), + )}`, + config, + true, + ).then(data => commonProcess(data)) + } + async resolveStarName(address) { const endpoint = 'https://rest.stargaze-apis.com' const query = toBase64(Buffer.from(JSON.stringify({ name: { address } }))) diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 876d47df..490c2b7c 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -283,6 +283,61 @@ @change="pageload" /> + + + + {{ $t('walletAccountDetail.contract_info') }} +
+ {{ $t('walletAccountDetail.query') }} +
+
+ + + + + + {{ $t('walletAccountDetail.code_id') }} + {{ contractInfo.code_id }} + + + + {{ $t('walletAccountDetail.creator') }} + {{ contractInfo.creator }} + + + + {{ $t('walletAccountDetail.admin') }} + {{ contractInfo.admin }} + + + + {{ $t('walletAccountDetail.label') }} + {{ contractInfo.label }} + + + + {{ $t('walletAccountDetail.created') }} ({{ $t('walletAccountDetail.height') }} / {{ $t('walletAccountDetail.tx_index') }}) + {{ contractInfo.created.block_height }} / {{ contractInfo.created.tx_index }} + + + + {{ $t('walletAccountDetail.ibc_port_id') }} + {{ contractInfo.ibc_port_id }} + + + + +
{ this.assets = bal }) + if (this.isContract) { + this.$http.getContractInfo(this.address).then(res => { + this.contractInfo = res + }) + } this.$http.getStakingReward(this.address).then(res => { this.reward = res }) diff --git a/src/views/components/QueryModal/index.vue b/src/views/components/QueryModal/index.vue new file mode 100644 index 00000000..a0cb3290 --- /dev/null +++ b/src/views/components/QueryModal/index.vue @@ -0,0 +1,125 @@ + + +