-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
215 additions
and
117 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
37 changes: 37 additions & 0 deletions
37
.../components/crypto-assets/stacks/stx20-token-asset-list/stx20-token-asset-item.layout.tsx
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,37 @@ | ||
import { styled } from 'leather-styles/jsx'; | ||
|
||
import { formatBalance } from '@app/common/format-balance'; | ||
import type { Stx20Token } from '@app/query/stacks/stacks-client'; | ||
import { Stx20AvatarIcon } from '@app/ui/components/avatar/stx20-avatar-icon'; | ||
import { ItemLayout } from '@app/ui/components/item-layout/item-layout'; | ||
import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip'; | ||
import { Pressable } from '@app/ui/pressable/pressable'; | ||
|
||
interface Stx20TokenAssetItemLayoutProps { | ||
token: Stx20Token; | ||
} | ||
export function Stx20TokenAssetItemLayout({ token }: Stx20TokenAssetItemLayoutProps) { | ||
const balanceAsString = token.balance.amount.toString(); | ||
const formattedBalance = formatBalance(balanceAsString); | ||
|
||
return ( | ||
<Pressable my="space.02"> | ||
<ItemLayout | ||
flagImg={<Stx20AvatarIcon />} | ||
titleLeft={token.tokenData.ticker} | ||
captionLeft="STX-20" | ||
titleRight={ | ||
<BasicTooltip | ||
asChild | ||
label={formattedBalance.isAbbreviated ? balanceAsString : undefined} | ||
side="left" | ||
> | ||
<styled.span data-testid={token.tokenData.ticker} fontWeight={500} textStyle="label.02"> | ||
{formattedBalance.value} | ||
</styled.span> | ||
</BasicTooltip> | ||
} | ||
/> | ||
</Pressable> | ||
); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/app/components/crypto-assets/stacks/stx20-token-asset-list/stx20-token-asset-list.tsx
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,12 @@ | ||
import type { Stx20Token } from '@app/query/stacks/stacks-client'; | ||
|
||
import { Stx20TokenAssetItemLayout } from './stx20-token-asset-item.layout'; | ||
|
||
interface Stx20TokenAssetListProps { | ||
tokens: Stx20Token[]; | ||
} | ||
export function Stx20TokenAssetList({ tokens }: Stx20TokenAssetListProps) { | ||
return tokens.map((token, i) => ( | ||
<Stx20TokenAssetItemLayout key={`${token.tokenData.ticker}${i}`} token={token} /> | ||
)); | ||
} |
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,11 @@ | ||
import type { Stx20Token } from '@app/query/stacks/stacks-client'; | ||
import { useStx20Tokens } from '@app/query/stacks/stx20/stx20-tokens.hooks'; | ||
|
||
interface Stx20TokensLoaderProps { | ||
address: string; | ||
children(tokens: Stx20Token[]): React.ReactNode; | ||
} | ||
export function Stx20TokensLoader({ address, children }: Stx20TokensLoaderProps) { | ||
const { data: tokens = [] } = useStx20Tokens(address); | ||
return children(tokens); | ||
} |
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
29 changes: 0 additions & 29 deletions
29
src/app/features/asset-list/components/bitcoin-fungible-tokens-asset-list.tsx
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
2 changes: 1 addition & 1 deletion
2
...tcoin/ordinals/brc20/brc-20.utils.spec.ts → ...ordinals/brc20/brc20-tokens.utils.spec.ts
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import BigNumber from 'bignumber.js'; | ||
|
||
import { createMoney } from '@shared/models/money.model'; | ||
|
||
import type { Stx20Balance, Stx20Token } from '../stacks-client'; | ||
import { useStx20BalancesQuery } from './stx20-tokens.query'; | ||
|
||
function makeStx20Token(token: Stx20Balance): Stx20Token { | ||
return { | ||
balance: createMoney(new BigNumber(token.balance), token.ticker, 0), | ||
marketData: null, | ||
tokenData: token, | ||
}; | ||
} | ||
|
||
export function useStx20Tokens(address: string) { | ||
return useStx20BalancesQuery(address, { | ||
select: resp => resp.map(balance => makeStx20Token(balance)), | ||
}); | ||
} |
Oops, something went wrong.