forked from cerc-io/cosmos-explorer
add funds
This commit is contained in:
parent
6dc3af51e6
commit
a648f8de5a
@ -7,15 +7,16 @@ import type {
|
|||||||
PaginabledContracts,
|
PaginabledContracts,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import DynamicComponent from '@/components/dynamic/DynamicComponent.vue';
|
import DynamicComponent from '@/components/dynamic/DynamicComponent.vue';
|
||||||
import { useFormatter, useTxDialog } from '@/stores';
|
import { useBankStore, useBlockchain, useFormatter, useTxDialog } from '@/stores';
|
||||||
import PaginationBar from '@/components/PaginationBar.vue';
|
import PaginationBar from '@/components/PaginationBar.vue';
|
||||||
import { PageRequest } from '@/types';
|
import { PageRequest, type PaginatedBalances } from '@/types';
|
||||||
|
|
||||||
const props = defineProps(['code_id', 'chain']);
|
const props = defineProps(['code_id', 'chain']);
|
||||||
|
|
||||||
const pageRequest = ref(new PageRequest());
|
const pageRequest = ref(new PageRequest());
|
||||||
const response = ref({} as PaginabledContracts);
|
const response = ref({} as PaginabledContracts);
|
||||||
|
|
||||||
|
const chainStore = useBlockchain()
|
||||||
const wasmStore = useWasmStore();
|
const wasmStore = useWasmStore();
|
||||||
function loadContract(pageNum: number) {
|
function loadContract(pageNum: number) {
|
||||||
const pr = new PageRequest();
|
const pr = new PageRequest();
|
||||||
@ -32,12 +33,18 @@ const infoDialog = ref(false);
|
|||||||
const info = ref({} as ContractInfo);
|
const info = ref({} as ContractInfo);
|
||||||
const state = ref({} as PaginabledContractStates);
|
const state = ref({} as PaginabledContractStates);
|
||||||
const selected = ref('');
|
const selected = ref('');
|
||||||
|
const balances = ref({} as PaginatedBalances)
|
||||||
|
|
||||||
function showInfo(address: string) {
|
function showInfo(address: string) {
|
||||||
wasmStore.wasmClient.getWasmContracts(address).then((x) => {
|
wasmStore.wasmClient.getWasmContracts(address).then((x) => {
|
||||||
info.value = x.contract_info;
|
info.value = x.contract_info;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function showFunds(address: string) {
|
||||||
|
chainStore.rpc.getBankBalances(address).then(res => {
|
||||||
|
balances.value = res
|
||||||
|
})
|
||||||
|
}
|
||||||
function showState(address: string) {
|
function showState(address: string) {
|
||||||
selected.value = address;
|
selected.value = address;
|
||||||
pageload(1);
|
pageload(1);
|
||||||
@ -128,9 +135,14 @@ const result = ref('');
|
|||||||
@click="showInfo(v)"
|
@click="showInfo(v)"
|
||||||
for="modal-contract-detail"
|
for="modal-contract-detail"
|
||||||
class="btn btn-primary btn-xs text-xs mr-2"
|
class="btn btn-primary btn-xs text-xs mr-2"
|
||||||
>contract</label
|
>Contract</label
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
@click="showFunds(v)"
|
||||||
|
for="modal-contract-funds"
|
||||||
|
class="btn btn-primary btn-xs text-xs mr-2"
|
||||||
|
>Funds</label
|
||||||
>
|
>
|
||||||
|
|
||||||
<label
|
<label
|
||||||
class="btn btn-primary btn-xs text-xs mr-2"
|
class="btn btn-primary btn-xs text-xs mr-2"
|
||||||
for="modal-contract-states"
|
for="modal-contract-states"
|
||||||
@ -178,7 +190,7 @@ const result = ref('');
|
|||||||
|
|
||||||
<input type="checkbox" id="modal-contract-detail" class="modal-toggle" />
|
<input type="checkbox" id="modal-contract-detail" class="modal-toggle" />
|
||||||
<label for="modal-contract-detail" class="modal cursor-pointer">
|
<label for="modal-contract-detail" class="modal cursor-pointer">
|
||||||
<label class="modal-box relative p-2" for="">
|
<label class="modal-box !w-11/12 !max-w-5xl relative p-2" for="">
|
||||||
<div>
|
<div>
|
||||||
<div class="flex items-center justify-between px-3 pt-2">
|
<div class="flex items-center justify-between px-3 pt-2">
|
||||||
<div class="text-lg">Contract Detail</div>
|
<div class="text-lg">Contract Detail</div>
|
||||||
@ -196,6 +208,28 @@ const result = ref('');
|
|||||||
</label>
|
</label>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<input type="checkbox" id="modal-contract-funds" class="modal-toggle" />
|
||||||
|
<label for="modal-contract-funds" class="modal cursor-pointer">
|
||||||
|
<label class="modal-box relative p-2" for="">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center justify-between px-3 pt-2">
|
||||||
|
<div class="text-lg">Contract Balances</div>
|
||||||
|
<label
|
||||||
|
for="modal-contract-funds"
|
||||||
|
class="btn btn-sm btn-circle"
|
||||||
|
>✕</label
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<ul class="menu mt-5">
|
||||||
|
<li v-for="b in balances.balances" >
|
||||||
|
<a class="flex justify-between"><span>{{ format.formatToken(b) }}</span> {{ b.amount }} </a>
|
||||||
|
</li>
|
||||||
|
<li v-if="balances.pagination?.total === '0'" class="my-10 text-center"> No Escrowed Assets</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="checkbox" id="modal-contract-states" class="modal-toggle" />
|
<input type="checkbox" id="modal-contract-states" class="modal-toggle" />
|
||||||
<label for="modal-contract-states" class="modal cursor-pointer">
|
<label for="modal-contract-states" class="modal cursor-pointer">
|
||||||
<label class="modal-box !w-11/12 !max-w-5xl" for="">
|
<label class="modal-box !w-11/12 !max-w-5xl" for="">
|
||||||
@ -203,7 +237,6 @@ const result = ref('');
|
|||||||
<div class="flex items-center justify-between px-3 pt-2 mb-4">
|
<div class="flex items-center justify-between px-3 pt-2 mb-4">
|
||||||
<div class="text-lg">Contract States</div>
|
<div class="text-lg">Contract States</div>
|
||||||
<label
|
<label
|
||||||
@click="infoDialog = false"
|
|
||||||
for="modal-contract-states"
|
for="modal-contract-states"
|
||||||
class="btn btn-sm btn-circle"
|
class="btn btn-sm btn-circle"
|
||||||
>✕</label
|
>✕</label
|
||||||
@ -240,7 +273,6 @@ const result = ref('');
|
|||||||
<div class="flex items-center justify-between px-3 pt-2 mb-4">
|
<div class="flex items-center justify-between px-3 pt-2 mb-4">
|
||||||
<div class="text-lg font-semibold">Query Contract</div>
|
<div class="text-lg font-semibold">Query Contract</div>
|
||||||
<label
|
<label
|
||||||
@click="infoDialog = false"
|
|
||||||
for="modal-contract-query"
|
for="modal-contract-query"
|
||||||
class="btn btn-sm btn-circle"
|
class="btn btn-sm btn-circle"
|
||||||
>✕</label
|
>✕</label
|
||||||
|
Loading…
Reference in New Issue
Block a user