-
Notifications
You must be signed in to change notification settings - Fork 39
Dialect Push Notifications
Jason Schorr edited this page Apr 19, 2022
·
2 revisions
Dialect notified through their API when an offer is made on an NFT through Auction House.
// Insert example dialect api call
- When an offer is made a
bid_receipt
is inserted into the database with acreated_at
timestamp. - When an offer is canceled the
bid_receipt
is update with acanceled_at
timestample. - When an offer is accepted the
purchase_receipt
is associated to thebid_receipt
through itspurchase_receipt
column.
POST /v1/wallets/notify
{
"type": enum("NFT_OFFER", ...),
"data": object - object typed strictly to the enum type
{
"pubkeyCurrentOwner",
"pubkeyBidder", // for notification enrichment (replace pubkey with alias/cardinal)
"bid",
}
}
Headers:
Authorization: Basic <base64(login:pass)> - going with basic
- When indexer receives a new public_bid from Metaplx auction house API call made to dialect with the contents of the offer (or enough info from them to query the offer through the Holaplex Graph API).
- Only notify dialect when the public_bid is processed for the first time.
- Can Dialect subscribe to GraphQL events over websocket? No. Holaplex make REST API call to Dialect.
- When a Holaplex feed event is record for the offer the contents of the
offer_event
is pushed to Dialect through their API. - Dialect then queries the complete details of the offer using the
bid_receipt_address
stored in the event.
create type offereventlifecycle as ENUM('Created', 'Cancelled');
create table offer_events (
bid_receipt_address varchar(48) not null unique,
feed_event_id uuid not null,
primary key (bid_receipt_address, feed_event_id),
foreign key (feed_event_id) references feed_events (id),
foreign key (bid_receipt_address) references bid_receipts (address),
lifecycle offereventlifecycle not null
);
- Make API call to Dialect when writing a
offer_event
- Show query root field for offers
query {
offer(address: "{bid_receipt_address}") {
amount
seller {
address
profile {
handle
}
}
buyer {
address
profile {
handle
}
}
}
}