Skip to content

Commit

Permalink
feat: update FT Genesis whitelist and auto-refresh balance query
Browse files Browse the repository at this point in the history
  • Loading branch information
AricRedemption committed Apr 10, 2024
1 parent f591d63 commit eb48578
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 31 deletions.
50 changes: 25 additions & 25 deletions src/data/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,78 +26,78 @@ export default [
logo: vemspLogoImage,
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '6d1f13d08650fddfe68d9ea301cdd95c7274f99f',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '8259e9b6606a36c1ae7634572b58e0cf1f67185e',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '17132328ded0f37f5983bcd43d7b4293b4c68152',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '7cacd8e37027685a2eaa17c4654601aaa3f19028',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '2ca791a4352138e5ab3ed4252a8271c64391cca7',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '19f1a6cdaae4d1e13a5ad1af5d40d197d9dc3394',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '50f81dc1285978effcce562b33e157d55017893a',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '098c951611c752f4ce64a4a65b2f1dbbee16ef09',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'a66547c18df1cfa67a0a6bff3fc76727b07414fc',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '57862ce54d811bcc5ad686a621f701cad51318bc',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '5a4b7274b469a27d6a5c8c4c4601b8603e22ec2a',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '5b50178bdf6dae1b170336e0d1c601f751cc8fab',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'a54dd16d255ac5462a59c9c33ef7d12b5917a63f',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '90aea875decdafe31605c4eabf1351e2c8015dc9',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'b108aba939dcbd0bddf1be0b51c50175ffd2a458',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'bf30a8f3616a6d38497babc0ef1cbbb7f3445c6d',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '21f2bf395727698f1af320b0f604a0a681dcb88e',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'e2cb8416681a853947c899cddf98e1ddfcad4deb',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '60ee8716fb3feed64459ff8fbf62661f96f7a1c4',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'b7885ea0003d686ba89933e5ffa10c4f3a511b9d',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '72cb61a1162ad410c5d6d473699acbd839117d46',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: '87eafd8cb072a775ec8a6a49d9916ca46a30e190',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'cb44507a4683054f0977d128846f31394ecb0686',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'f8630214db537b634b8cb4a9b6c220554bd166e3',
},
{
genesis: 'c9cc7bbd1010b44873959a8b1a2bcedeb62302b7',
genesis: 'e352039a3adf1f7ef76df6b85a7e904727b339f8',
},
]
10 changes: 4 additions & 6 deletions src/pages/wallet/Asset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const toTransfer = () => {
<div class="mt-8 flex flex-col items-center self-stretch">
<template v-if="asset?.queryable">
<template v-if="asset.balance">
<div class="mb-1 text-center text-3xl text-black-primary " v-if="asset.contract === 'BRC-20'">
<div class="mb-1 text-center text-3xl text-black-primary" v-if="asset.contract === 'BRC-20'">
{{ prettifyTokenBalance(asset.balance.total, asset.decimal, false, asset.symbol) }}
</div>
<div class="mb-1 text-center text-3xl text-black-primary" v-else>
Expand Down Expand Up @@ -210,9 +210,7 @@ const toTransfer = () => {
>{{ (tickersData && tickersData.tokenBalance.transferableBalance) || 0 }} {{ asset.symbol }}</span
>
</div>
<div class="w-full py-3 text-center text-sm text-gray-500" v-if="tickersLoading">
Loading BRC Tickers...
</div>
<div class="w-full py-3 text-center text-sm text-gray-500" v-if="tickersLoading">Loading BRC Tickers...</div>
<div
class="grid grid-cols-3 gap-2 w-full mt-3"
v-else-if="tickersData && tickersData.transferableList.length"
Expand All @@ -223,7 +221,7 @@ const toTransfer = () => {
class="flex flex-col items-center rounded-md bg-white aspect-square border border-[#D8D8D8] relative"
>
<div class="mt-2.5 text-[#909399] text-sm">{{ ticker.ticker }}</div>
<div class="mt-3 text-black-primary text-lg truncate">{{ ticker.amount }}</div>
<div class="mt-3 text-black-primary text-lg truncate">{{ ticker.amount }}</div>
<div
class="text-white text-xs bg-[#1E2BFF] rounded-b-md absolute bottom-0 w-full text-center pt-[5px] pb-[4px]"
>
Expand Down Expand Up @@ -267,5 +265,5 @@ const toTransfer = () => {
<div class="text-gray-500" v-else>No Service for {{ symbol }} yet.</div>
</div>
</div>
<div v-else class="w-full py-3 text-center text-sm text-gray-500">Asset Loading...</div>
<div v-else class="w-full py-3 text-center text-sm text-gray-500">Asset Loading...</div>
</template>
2 changes: 2 additions & 0 deletions src/queries/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getNet } from '@/lib/network'
import { useQuery } from '@tanstack/vue-query'
import { metaletApiV3, mvcApi } from './request'
import { SymbolTicker } from '@/lib/asset-symbol'
import { Balance_QUERY_INTERVAL } from './constants'

export type Balance = {
address: string
Expand Down Expand Up @@ -85,6 +86,7 @@ export const useBalanceQuery = (
}
}
},
refetchInterval: Balance_QUERY_INTERVAL,
...options,
})
}
2 changes: 2 additions & 0 deletions src/queries/btc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Ref, ComputedRef } from 'vue'
import { getNet } from '@/lib/network'
import { fetchBRC20Token } from './brc20s'
import { useQuery } from '@tanstack/vue-query'
import { Balance_QUERY_INTERVAL } from './constants'
import { ordersApi, metaletApiV3 } from '@/queries/request'

interface Tick {
Expand Down Expand Up @@ -69,6 +70,7 @@ export const useBRC20AssetQuery = (address: Ref<string>, options: { enabled: Com
return useQuery({
queryKey: ['BRC20Assets', { address }],
queryFn: () => fetchBRC20Token(address.value),
refetchInterval: Balance_QUERY_INTERVAL,
...options,
})
}
Expand Down
1 change: 1 addition & 0 deletions src/queries/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const Balance_QUERY_INTERVAL = 15000;
3 changes: 3 additions & 0 deletions src/queries/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ComputedRef, Ref } from 'vue'
import { type Asset } from '@/data/assets'
import { useQuery } from '@tanstack/vue-query'
import { SymbolTicker } from '@/lib/asset-symbol'
import { Balance_QUERY_INTERVAL } from './constants'

export type Token = {
codeHash: string
Expand Down Expand Up @@ -48,6 +49,7 @@ export const useMVCAssetsQuery = (address: Ref<string>, options: { enabled: Comp
},
}) as Asset
),
refetchInterval: Balance_QUERY_INTERVAL,
...options,
})
}
Expand Down Expand Up @@ -82,6 +84,7 @@ export const useMVCTokenQuery = (
} as Asset
}
},
refetchInterval: Balance_QUERY_INTERVAL,
...options,
})
}
Expand Down

0 comments on commit eb48578

Please sign in to comment.