Skip to content

Commit

Permalink
Update README to reflect tests and pagination for balances (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilamanov authored Jan 23, 2025
2 parents 7fa410f + c8c360a commit 0ced925
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,29 @@ Fetches token balances for a specific wallet address.
import { useTokenBalances } from "@duneanalytics/hooks";

const MyComponent = ({ account }) => {
const { data, isLoading, error } = useTokenBalances(account.address, {});
const { data, isLoading, error, nextPage, previousPage, currentPage } =
useTokenBalances(account.address, {});

if (isLoading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;

return (
<ul>
{data.balances.map((balance) => (
<li key={balance.tokenSymbol}>
{balance.tokenSymbol}: {balance.amount}
</li>
))}
</ul>
<div>
<ul>
{data.balances.map((balance) => (
<li key={balance.tokenSymbol}>
{balance.tokenSymbol}: {balance.amount}
</li>
))}
</ul>
<button onClick={previousPage} disabled={currentPage === 0}>
Previous Page
</button>
<button onClick={nextPage} disabled={!data.next_offset}>
Next Page
</button>
<p>Current Page: {currentPage + 1}</p>
</div>
);
};
```
Expand Down Expand Up @@ -151,6 +161,12 @@ _note you can also use `minor` or `major` instead of `patch` to bump the version
npm version patch
```

When you make any changes, please make sure that the tests pass.

```bash
npm test
```

Then run the following commands to deploy the package to the npm registry:

```bash
Expand Down

0 comments on commit 0ced925

Please sign in to comment.