diff --git a/src/components/account/BalanceTable.vue b/src/components/account/BalanceTable.vue index b0cb64ca7..361fd1a26 100644 --- a/src/components/account/BalanceTable.vue +++ b/src/components/account/BalanceTable.vue @@ -54,7 +54,7 @@ /> - + diff --git a/src/components/account/CollectionTable.vue b/src/components/account/CollectionTable.vue new file mode 100644 index 000000000..8aa9dad6e --- /dev/null +++ b/src/components/account/CollectionTable.vue @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/account/CollectionTableController.ts b/src/components/account/CollectionTableController.ts new file mode 100644 index 000000000..0aff3d32c --- /dev/null +++ b/src/components/account/CollectionTableController.ts @@ -0,0 +1,86 @@ +/*- + * + * Hedera Mirror Node Explorer + * + * Copyright (C) 2021 - 2023 Hedera Hashgraph, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import {Nft, Nfts} from "@/schemas/HederaSchemas"; +import {ComputedRef, Ref} from "vue"; +import axios from "axios"; +import {KeyOperator, SortOrder, TableController} from "@/utils/table/TableController"; +import {Router} from "vue-router"; + +export class CollectionTableController extends TableController { + + public readonly accountId: Ref + public readonly tokenId: string + + // + // Public + // + + public constructor(router: Router, tokenId: string, accountId: Ref, pageSize: ComputedRef) { + super(router, pageSize, 10 * pageSize.value, 5000, 10, 100) + this.accountId = accountId + this.tokenId = tokenId + } + + // + // TableController + // + + public async load(serialNumber: number | null, operator: KeyOperator, order: SortOrder, limit: number): Promise { + if (this.tokenId == null || this.accountId.value == null) { + return Promise.resolve(null) + } + + const params = {} as { + limit: number + "token.id": string | undefined + serialnumber: string | undefined + order: string + } + params.limit = limit + params.order = order + params["token.id"] = this.tokenId + + if (serialNumber !== null) { + params.serialnumber = operator + ":" + serialNumber + } + + const { data } = await axios.get( + `api/v1/accounts/${this.accountId.value}/nfts`, + {params: params}, + ) + + const nfts = data.nfts ?? null + + return Promise.resolve(nfts) + } + + public keyFor(row: Nft): number { + return row.serial_number ?? 0 + } + + public stringFromKey(serialNumber: number): string { + return serialNumber.toString() + } + + public keyFromString(s: string): number | null { + return Number(s) + } +} diff --git a/src/components/account/NftsTable.vue b/src/components/account/NftsTable.vue new file mode 100644 index 000000000..8b8d123e4 --- /dev/null +++ b/src/components/account/NftsTable.vue @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/allowances/ApproveAllowanceDialog.vue b/src/components/allowances/ApproveAllowanceDialog.vue index 55e932da4..c214ee09b 100644 --- a/src/components/allowances/ApproveAllowanceDialog.vue +++ b/src/components/allowances/ApproveAllowanceDialog.vue @@ -321,7 +321,7 @@ export default defineComponent({ result ||= allowanceChoice.value !== "token" result ||= selectedSpender.value !== props.currentTokenAllowance?.spender result ||= selectedToken.value !== props.currentTokenAllowance.token_id - result ||= selectedTokenAmount.value !== props.currentTokenAllowance?.amount_granted.toString() ?? null + result ||= selectedTokenAmount.value !== (props.currentTokenAllowance?.amount_granted.toString() ?? null) } else { result = true } diff --git a/src/pages/AccountBalances.vue b/src/pages/AccountBalances.vue index 9151d0add..e7eaa16bb 100644 --- a/src/pages/AccountBalances.vue +++ b/src/pages/AccountBalances.vue @@ -26,9 +26,9 @@
- + + + + + +