-
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
14 changed files
with
130 additions
and
51 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
7 changes: 7 additions & 0 deletions
7
change/@starknet-react-chains-6d856b0e-b860-43eb-819a-d712fd4c3f3c.json
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,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Update RPC urls to RPC 0.7", | ||
"packageName": "@starknet-react/chains", | ||
"email": "francesco@ceccon.me", | ||
"dependentChangeType": "patch" | ||
} |
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,62 @@ | ||
"use client"; | ||
|
||
import { useAccount, useBalance } from "@starknet-react/core"; | ||
import { DemoContainer } from "../starknet"; | ||
|
||
function AccountBalance({ account }: { account: `0x${string}` }) { | ||
const { data, error } = useBalance({ | ||
address: account, | ||
}); | ||
|
||
if (data) { | ||
return ( | ||
<div className="flex flex-col space-y-2"> | ||
<p> | ||
<span className="font-semibold">Address: </span> | ||
{account.slice(0, 6)}...{account.slice(-4)} | ||
</p> | ||
<p> | ||
<span className="font-semibold">Balance: </span> | ||
{`${data.formatted} ${data.symbol}`} | ||
</p> | ||
</div> | ||
); | ||
} | ||
|
||
if (error) { | ||
return ( | ||
<div className="flex flex-col space-y-2"> | ||
<p>Error fetching balance</p> | ||
<pre>{error.message}</pre> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col space-y-2"> | ||
<p>Loading balance...</p> | ||
</div> | ||
); | ||
} | ||
|
||
function BalanceInner() { | ||
const { address } = useAccount(); | ||
|
||
return ( | ||
<div className=""> | ||
{address ? ( | ||
<AccountBalance account={address} /> | ||
) : ( | ||
<p>Connect wallet to display its balance.</p> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export function Balance() { | ||
return ( | ||
<DemoContainer hasWallet> | ||
<BalanceInner /> | ||
</DemoContainer> | ||
); | ||
} |
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,6 @@ | ||
import Demo from "../../components/demo"; | ||
|
||
# Token Balance | ||
|
||
<Demo.Balance /> | ||
|
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
"permanent": true | ||
} | ||
] | ||
} | ||
} |
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 |
---|---|---|
|
@@ -29,5 +29,5 @@ | |
"node": ">=20", | ||
"pnpm": ">=9" | ||
}, | ||
"packageManager": "pnpm@9.7.0" | ||
"packageManager": "pnpm@9.10.0" | ||
} |
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