Skip to content

Commit

Permalink
Update token list
Browse files Browse the repository at this point in the history
  • Loading branch information
polarker committed Nov 18, 2023
1 parent 433a0ed commit 7f59ad7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"preview": "vite preview"
},
"dependencies": {
"@alephium/token-list": "^0.0.10",
"@alephium/token-list": "^0.0.12",
"@alephium/web3": "^0.21.0",
"@alephium/web3-react": "^0.21.0",
"@emotion/react": "^11.11.1",
Expand Down
5 changes: 2 additions & 3 deletions src/components/Token/TokenInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box, Center, Stack, TextInput, rem } from '@mantine/core'
import { useCallback, useState } from 'react'
import { getTokenMetadata, useAlephium } from '../../utils/utils'
import { getTokenMetadata, useAlephium, useNetworkId } from '../../utils/utils'
import {
FungibleTokenMetaData,
addressFromTokenId,
Expand All @@ -10,8 +10,6 @@ import {
import MyTable from '../Misc/MyTable'
import CopyText from '../Misc/CopyText'

const network = 'devnet'

type TokenInfo = FungibleTokenMetaData & {
verified: boolean
tokenId: string
Expand All @@ -22,6 +20,7 @@ function TokenInfo() {
const [value, setValue] = useState('')
const [tokenInfo, setTokenInfo] = useState<TokenInfo>()
const nodeProvider = useAlephium()
const [network] = useNetworkId()

const searchToken = useCallback(async (tokenId: string) => {
setValue(tokenId)
Expand Down
18 changes: 11 additions & 7 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ export function useAlephium(): NodeProvider {

export function useExplorer(): ExplorerProvider {
const [network] = useNetworkId()
const explorerProvider = useMemo(() => new ExplorerProvider(
network === 'mainnet'
? mainnet_explorer_backend_url
: network === 'testnet'
? testnet_explorer_backend_url
: devnet_explorer_backend_url
), [network])
const explorerProvider = useMemo(
() =>
new ExplorerProvider(
network === 'mainnet'
? mainnet_explorer_backend_url
: network === 'testnet'
? testnet_explorer_backend_url
: devnet_explorer_backend_url
),
[network]
)

useEffect(() => {
web3.setCurrentExplorerProvider(explorerProvider)
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"@alephium/web3" "^0.21.0"
bowser "^2.11.0"

"@alephium/token-list@^0.0.10":
version "0.0.10"
resolved "https://registry.npmjs.org/@alephium/token-list/-/token-list-0.0.10.tgz"
integrity sha512-HzPETn+JBykR761YdC5zr1rB/2ui5AHMwaFYer5UuhtVnV8Hlzspe/Pp+5zXmILGtx4u2PWjDEoqHRIuejcXlA==
"@alephium/token-list@^0.0.12":
version "0.0.12"
resolved "https://registry.yarnpkg.com/@alephium/token-list/-/token-list-0.0.12.tgz#b3148d1985b945068b090d946356c2c9fafb3649"
integrity sha512-4/hEmkHpnvl3ttkc8Z5sW97uf4Y/5MLqDFeUKSoB3EDdCmHb6Soa3tc1XkS0rexT92aYf0Bvrwh70V1uia9scw==
dependencies:
cross-fetch "^3.1.8"

Expand Down

0 comments on commit 7f59ad7

Please sign in to comment.