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

Add ERC721 example app #230

Merged
merged 4 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/short-dingos-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ponder/core": patch
---

Fixed transaction and block formatting to handle Arbitrum RPC data formats.
2 changes: 2 additions & 0 deletions examples/token-erc721/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Arbitrum RPC URL used for fetching blockchain data. Alchemy is recommended.
PONDER_RPC_URL_42161=
6 changes: 6 additions & 0 deletions examples/token-erc721/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
.DS_Store

.env.local
.ponder/
generated/
35 changes: 35 additions & 0 deletions examples/token-erc721/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Example ERC721 token API

This example shows how to create a GraphQL API for an ERC721 token using Ponder. It uses the Smol Brains NFT contract on Arbitrum, which emits `Transfer`, `Approval`, and `OwnershipTransferred` events.

## Sample queries

### Get all tokens currently owned by an account

```graphql
{
account(id: "0x2B8E4729672613D69e5006a97dD56A455389FB2b") {
id
tokens {
id
}
}
}
```

### Get the current owner and all transfer events for a token

```graphql
{
token(id: "7777") {
owner {
id
}
transferEvents {
from
to
timestamp
}
}
}
```
Loading