Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README to reflect tests and pagination for balances #16

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading