-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(arkmarket): fix invalid balance (#118)
- rewrite balance hook to avoid structuralSharing error (wevm/wagmi#4233) - use starknet price instead of ethereum for starknet balance in usd
- Loading branch information
1 parent
6906d44
commit e6092f6
Showing
21 changed files
with
228 additions
and
150 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
2 changes: 1 addition & 1 deletion
2
...ket/src/app/collection/[collectionAddress]/components/collection-items-filters-dialog.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
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
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,59 @@ | ||
import { Ethereum, Starknet } from "@ark-market/ui/icons"; | ||
|
||
import { ETH, STRK } from "~/constants/tokens"; | ||
import useBalance from "~/hooks/useBalance"; | ||
import usePrices from "~/hooks/usePrices"; | ||
|
||
interface WalletAccountBalanceProps { | ||
address: string; | ||
} | ||
|
||
export default function WalletAccountBalance({ | ||
address, | ||
}: WalletAccountBalanceProps) { | ||
const { convertInUsd } = usePrices(); | ||
const { data: ethBalance } = useBalance({ address, token: ETH }); | ||
const { data: strkBalance } = useBalance({ address, token: STRK }); | ||
|
||
const ethBalanceInUsd = convertInUsd({ | ||
amount: ethBalance?.value, | ||
token: "ethereum", | ||
}); | ||
const strkBalanceInUsd = convertInUsd({ | ||
amount: strkBalance?.value, | ||
token: "starknet", | ||
}); | ||
|
||
if (!address) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<div className="flex h-16 items-center justify-between rounded-t-lg bg-card p-4"> | ||
<div className="flex items-center gap-2.5"> | ||
<Ethereum /> | ||
<span className="font-bold">ETH</span> | ||
</div> | ||
<div className="flex flex-col items-end gap-1"> | ||
<p className="text-sm font-medium">{ethBalance?.rounded}</p> | ||
<p className="text-xs text-secondary-foreground"> | ||
${ethBalanceInUsd} | ||
</p> | ||
</div> | ||
</div> | ||
<div className="mt-0.5 flex h-16 items-center justify-between rounded-b-lg bg-card p-4"> | ||
<div className="flex items-center gap-2.5"> | ||
<Starknet /> | ||
<span className="font-bold">STRK</span> | ||
</div> | ||
<div className="flex flex-col items-end gap-1"> | ||
<p className="text-sm font-medium">{strkBalance?.rounded}</p> | ||
<p className="text-xs text-secondary-foreground"> | ||
${strkBalanceInUsd} | ||
</p> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
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
Oops, something went wrong.