-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
18 changed files
with
382 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
explorer/src/lib/components/token-list-details/TokenListDetails.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<svelte:options immutable={true} /> | ||
|
||
<script> | ||
import { AppAnchor, DetailList, ListItem } from "$lib/components"; | ||
import { calculateAdaptiveCharCount, middleEllipsis } from "$lib/dusk/string"; | ||
import { onMount } from "svelte"; | ||
/** @type {Token} */ | ||
export let data; | ||
/** @type {Boolean} */ | ||
export let displayTooltips = false; | ||
/** @type {number} */ | ||
let screenWidth = window.innerWidth; | ||
onMount(() => { | ||
const resizeObserver = new ResizeObserver((entries) => { | ||
const entry = entries[0]; | ||
screenWidth = entry.contentRect.width; | ||
}); | ||
resizeObserver.observe(document.body); | ||
return () => resizeObserver.disconnect(); | ||
}); | ||
$: adaptiveCharCount = calculateAdaptiveCharCount( | ||
screenWidth, | ||
320, | ||
1024, | ||
4, | ||
25 | ||
); | ||
$: tokensContractID = middleEllipsis(data.contractId, adaptiveCharCount); | ||
</script> | ||
|
||
<DetailList> | ||
<!-- TOKEN NAME --> | ||
<ListItem tooltipText={displayTooltips ? "The name of the token." : ""}> | ||
<svelte:fragment slot="term">Token</svelte:fragment> | ||
<svelte:fragment slot="definition"> | ||
<AppAnchor href={`/tokens/token/${data.token}`}>{data.token}</AppAnchor> | ||
</svelte:fragment> | ||
</ListItem> | ||
|
||
<!-- TOTAL CURRENT SUPPLY --> | ||
<ListItem | ||
tooltipText={displayTooltips | ||
? "The total amount of tokens currently in circulation." | ||
: ""} | ||
> | ||
<svelte:fragment slot="term">Total Current Supply</svelte:fragment> | ||
<svelte:fragment slot="definition"> | ||
{data.totalCurrentSupply} | ||
</svelte:fragment> | ||
</ListItem> | ||
|
||
<!-- MAX CIRCULATING SUPPLY --> | ||
<ListItem | ||
tooltipText={displayTooltips | ||
? "The maximum number of tokens that can ever exist." | ||
: ""} | ||
> | ||
<svelte:fragment slot="term">Max Circulating Supply</svelte:fragment> | ||
<svelte:fragment slot="definition"> | ||
{data.maxCirculatingSupply} | ||
</svelte:fragment> | ||
</ListItem> | ||
|
||
<!-- TICKER SYMBOL --> | ||
<ListItem | ||
tooltipText={displayTooltips | ||
? "The ticker symbol used to identify the token." | ||
: ""} | ||
> | ||
<svelte:fragment slot="term">Ticker</svelte:fragment> | ||
<svelte:fragment slot="definition"> | ||
{data.ticker} | ||
</svelte:fragment> | ||
</ListItem> | ||
|
||
<!-- CONTRACT ID --> | ||
<ListItem | ||
tooltipText={displayTooltips | ||
? "The unique contract address of the token on the blockchain." | ||
: ""} | ||
> | ||
<svelte:fragment slot="term">Contract ID</svelte:fragment> | ||
<svelte:fragment slot="definition"> | ||
{tokensContractID} | ||
</svelte:fragment> | ||
</ListItem> | ||
|
||
<!-- PRICE --> | ||
<ListItem | ||
tooltipText={displayTooltips | ||
? "The current price of the token in USD." | ||
: ""} | ||
> | ||
<svelte:fragment slot="term">Price</svelte:fragment> | ||
<svelte:fragment slot="definition"> | ||
{data.price} | ||
</svelte:fragment> | ||
</ListItem> | ||
</DetailList> |
56 changes: 56 additions & 0 deletions
56
explorer/src/lib/components/tokens-table/TokensTable.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<svelte:options immutable={true} /> | ||
|
||
<script> | ||
import { ownPairs } from "lamb"; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableRow, | ||
} from "$lib/components/table"; | ||
import { AppAnchor } from "$lib/components"; | ||
import { makeClassName, middleEllipsis } from "$lib/dusk/string"; | ||
/** @type {string | undefined} */ | ||
export let className = undefined; | ||
/** @type {Token[]} */ | ||
export let data; | ||
const HASH_CHARS_LENGTH = 10; | ||
$: classes = makeClassName(["tokens-table", className]); | ||
</script> | ||
|
||
<Table className={classes}> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell type="th">Token</TableCell> | ||
<TableCell type="th">Total Current Supply</TableCell> | ||
<TableCell type="th">Max Circulating Supply</TableCell> | ||
<TableCell type="th">Ticker</TableCell> | ||
<TableCell type="th">Contract ID</TableCell> | ||
<TableCell type="th">Price ($)</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{#each data as token (token)} | ||
<TableRow> | ||
<TableCell> | ||
<AppAnchor href={`/tokens/token?name=${token.token}`} | ||
>{token.token}</AppAnchor | ||
></TableCell | ||
> | ||
<TableCell>{token.totalCurrentSupply}</TableCell> | ||
<TableCell>{token.maxCirculatingSupply}</TableCell> | ||
<TableCell>{token.ticker}</TableCell> | ||
<TableCell | ||
>{middleEllipsis(token.contractId, HASH_CHARS_LENGTH)}</TableCell | ||
> | ||
<TableCell>{token.price}</TableCell> | ||
</TableRow> | ||
{/each} | ||
</TableBody> | ||
</Table> |
4 changes: 0 additions & 4 deletions
4
explorer/src/lib/components/transactions-card/TransactionsCard.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type Token = { | ||
token: string; | ||
totalCurrentSupply: string; | ||
maxCirculatingSupply: string; | ||
ticker: string; | ||
contractId: string; | ||
price: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[ | ||
{ | ||
"token": "Ethereum", | ||
"totalCurrentSupply": "120,000,000", | ||
"maxCirculatingSupply": "∞", | ||
"ticker": "ETH", | ||
"contractId": "0x123abc456def789ghi123jkl456mno789pqr012stu345vwx678yz", | ||
"price": "3,200.50" | ||
}, | ||
{ | ||
"token": "Bitcoin", | ||
"totalCurrentSupply": "19,500,000", | ||
"maxCirculatingSupply": "21,000,000", | ||
"ticker": "BTC", | ||
"contractId": "N/A", | ||
"price": "42,500.75" | ||
}, | ||
{ | ||
"token": "Solana", | ||
"totalCurrentSupply": "550,000,000", | ||
"maxCirculatingSupply": "∞", | ||
"ticker": "SOL", | ||
"contractId": "0x789ghi123jkl456mno789pqr012stu345vwx678yzabc123def456", | ||
"price": "150.25" | ||
}, | ||
{ | ||
"token": "USDC", | ||
"totalCurrentSupply": "32,000,000,000", | ||
"maxCirculatingSupply": "∞", | ||
"ticker": "USDC", | ||
"contractId": "0x987xyz654mno321stu456vwx789pqr012abc345def678ghi123jkl", | ||
"price": "1.00" | ||
}, | ||
{ | ||
"token": "Polygon", | ||
"totalCurrentSupply": "9,300,000,000", | ||
"maxCirculatingSupply": "10,000,000,000", | ||
"ticker": "MATIC", | ||
"contractId": "0x456uvw321rst852zxc147bnd963qwe258lop357mnb741poi963lkj", | ||
"price": "1.75" | ||
}, | ||
{ | ||
"token": "Dai", | ||
"totalCurrentSupply": "5,000,000,000", | ||
"maxCirculatingSupply": "∞", | ||
"ticker": "DAI", | ||
"contractId": "0x321abc654def789ghi123jkl456mno789pqr012stu345vwx678yz", | ||
"price": "1.00" | ||
}, | ||
{ | ||
"token": "Chainlink", | ||
"totalCurrentSupply": "467,000,000", | ||
"maxCirculatingSupply": "1,000,000,000", | ||
"ticker": "LINK", | ||
"contractId": "0x963qwe852rty147bnm258lop357mnb741poi963lkj654def789ghi", | ||
"price": "17.60" | ||
}, | ||
{ | ||
"token": "Avalanche", | ||
"totalCurrentSupply": "377,000,000", | ||
"maxCirculatingSupply": "720,000,000", | ||
"ticker": "AVAX", | ||
"contractId": "0x852zxc147bnd963qwe258lop357mnb741poi963lkj321rst456uvw", | ||
"price": "35.40" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { redirect } from "@sveltejs/kit"; | ||
|
||
export const load = ({}) => { | ||
const featureTokensEnabled = import.meta.env.VITE_FEATURE_TOKENS === "true"; | ||
|
||
if (!featureTokensEnabled) { | ||
throw redirect(302, "/"); | ||
} | ||
}; |
Oops, something went wrong.