Skip to content

Commit

Permalink
feat: add tokenId to orders
Browse files Browse the repository at this point in the history
  • Loading branch information
nachomazzara committed Jul 9, 2021
1 parent 320172b commit 2a7842a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ npm run build
npm run deploy -- --network mainnet
```

If a new collection in Ethereum is added you will need to add it as following

```
npx ts-node scripts/importWearableCollection.ts --collection ../../wearable-api/data/collections/{collection_name}/index.json > src/data/wearables/{collection_name}.ts
```

checkout the docs https://thegraph.com/docs/quick-start

### Queries
Expand Down
2 changes: 2 additions & 0 deletions indexer/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Order @entity {
category: Category!
nft: NFT
nftAddress: Bytes!
tokenId: BigInt!
txHash: Bytes!
owner: Bytes!
buyer: Bytes
Expand All @@ -55,6 +56,7 @@ type Bid @entity {
category: Category!
nft: NFT
nftAddress: Bytes!
tokenId: BigInt!
bidder: Bytes
seller: Bytes
price: BigInt!
Expand Down
1 change: 1 addition & 0 deletions indexer/src/handlers/bid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function handleBidCreated(event: BidCreated): void {
bid.bidder = event.params._bidder
bid.price = event.params._price
bid.fingerprint = event.params._fingerprint
bid.tokenId = event.params._tokenId
bid.blockchainId = event.params._id.toHexString()
bid.blockNumber = event.block.number
bid.expiresAt = event.params._expiresAt.times(BigInt.fromI32(1000))
Expand Down
1 change: 1 addition & 0 deletions indexer/src/handlers/marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function handleOrderCreated(event: OrderCreated): void {
order.category = category
order.nft = nftId
order.nftAddress = event.params.nftAddress
order.tokenId = event.params.assetId
order.txHash = event.transaction.hash
order.owner = event.params.seller
order.price = event.params.priceInWei
Expand Down

0 comments on commit 2a7842a

Please sign in to comment.