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

Create view for NFT drops #101

Merged
merged 2 commits into from
May 28, 2024
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
49 changes: 49 additions & 0 deletions hasura/metadata/databases/minterop/tables/mb_views_nft_drops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
table:
schema: mb_views
name: nft_drops
array_relationships:
- name: listings
using:
manual_configuration:
column_mapping:
id: indexer_metadata_id
nft_contract_id: nft_contract_id
insertion_order: null
remote_table:
name: active_listings
schema: mb_views
object_relationships:
- name: nft_contract
using:
manual_configuration:
remote_table:
schema: public
name: nft_contracts
insertion_order: null
column_mapping:
nft_contract_id: id
select_permissions:
- role: anonymous
permission:
columns:
- drop_url,
- nft_contract_id,
- sc_metadata_id,
- indexer_metadata_id,
- title
- description
- media
- reference
- reference_blob
- minter as creator
- max_supply
- minted
- royalties
- royalty_percent
- price
- minters_allowlist
- unique_minters
- starts_at
- expires_at
filter: {}
allow_aggregations: true
1 change: 1 addition & 0 deletions hasura/metadata/databases/minterop/tables/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- "!include mb_views_auctions_with_offer.yaml"
- "!include mb_views_nft_activities.yaml"
- "!include mb_views_nft_activities_rollup.yaml"
- "!include mb_views_nft_drops.yaml"
- "!include mb_views_nft_metadata_unburned.yaml"
- "!include mb_views_nft_metadata.yaml"
- "!include mb_views_nft_notifications.yaml"
Expand Down
1 change: 1 addition & 0 deletions migrations/2024-05-28-120630_nft-drops/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop view mb_views.nft_drops;
24 changes: 24 additions & 0 deletions migrations/2024-05-28-120630_nft-drops/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
create view mb_views.nft_drops as
select
reference_blob->>'drop_url' as drop_url,
nft_contract_id,
mb_internal_id as sc_metadata_id,
id as indexer_metadata_id,
title,
description,
media,
reference,
reference_blob,
minter as creator,
max_supply,
count as minted,
royalties,
royalty_percent,
price,
minters_allowlist,
unique_minters,
starts_at,
expires_at
from (select * from nft_metadata where reference_blob->>'drop_url' is not null) m
left join (select metadata_id, count(*) from nft_tokens group by metadata_id) t
on t.metadata_id = m.id;
Loading