Indexer
Querying Brick with less expensive RPC calls
Last updated
Querying Brick with less expensive RPC calls
Last updated
The Brick indexer source can be found here
Based on the Aleph Indexer Framework, it is currently configured to be posting specific Aleph Messages for the Fishnet dApp, for which Brick was initially developed for:
A more general version of the indexer should be available here
To run the indexer locally, follow these steps:
Open indexer/brick/.env.defaults
and set the SOLANA RPC.
From root you can run the indexer with: npm run start:indexer
When the indexer started, the indexer usually starts at https://localhost:8080. There you can query it through the GraphiQL UI or using the sdk.
Provides user purchases and sales, discriminate sales and purchases by checking the signer of the event.
{
transactions(user: "rikiFB2VznT2izUT7UffzWCn1X4gNmGutX7XEqFdpRR") {
id
timestamp
type
account
signer
... on RegisterBuyCnftEvent {
info {
systemProgram
tokenProgramV0
rent
logWrapper
bubblegumProgram
compressionProgram
tokenMetadataProgram
signer
seller
marketplaceAuth
marketplace
product
paymentMint
productMint
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
metadata
masterEdition
treeAuthority
merkleTree
params {
amount
name
symbol
uri
}
}
}
... on RegisterBuyCounterEvent {
info {
systemProgram
tokenProgramV0
rent
signer
seller
marketplaceAuth
marketplace
product
payment
paymentMint
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
amount
}
}
... on RegisterBuyTokenEvent {
info {
systemProgram
tokenProgramV0
tokenProgram2022
signer
seller
marketplaceAuth
marketplace
product
productMint
paymentMint
buyerTokenVault
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
amount
}
}
... on RegisterBuyEvent {
info {
systemProgram
tokenProgramV0
rent
signer
seller
marketplaceAuth
marketplace
product
payment
paymentMint
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
amount
}
}
}
}
Provides you the instruction history of an specific account (can be a user o a program account).
{
events(account: "5WnQLqDpc35PodFDBH6ZAWzDonvt4SF9R9wHq7mhMBG") {
id
timestamp
type
account
signer
... on AcceptAccessEvent {
info {
systemProgram
tokenProgram2022
associatedTokenProgram
rent
signer
receiver
marketplace
request
accessMint
accessVault
}
}
... on AirdropAccessEvent {
info {
systemProgram
tokenProgram2022
associatedTokenProgram
rent
signer
receiver
marketplace
accessMint
accessVault
}
}
... on EditProductEvent {
info {
signer
product
paymentMint
productPrice
}
}
... on EditMarketplaceEvent {
info {
signer
marketplace
rewardMint
discountMint
params {
fee
feeReduction
sellerReward
buyerReward
useCnfts
deliverToken
transferable
chainCounter
permissionless
rewardsEnabled
feePayer
}
}
}
... on InitBountyEvent {
info {
systemProgram
tokenProgramV0
associatedTokenProgram
rent
signer
marketplace
rewardMint
bountyVault
}
}
... on InitMarketplaceEvent {
info {
systemProgram
tokenProgram2022
tokenProgramV0
rent
signer
marketplace
accessMint
rewardMint
discountMint
bountyVault
params {
fee
feeReduction
sellerReward
buyerReward
useCnfts
deliverToken
transferable
chainCounter
permissionless
rewardsEnabled
accessMintBump
feePayer
}
}
}
... on InitProductTreeEvent {
info {
tokenMetadataProgram
logWrapper
bubblegumProgram
compressionProgram
tokenProgramV0
associatedTokenProgram
rent
signer
marketplace
product
productMint
paymentMint
accessMint
productMintVault
accessVault
masterEdition
metadata
merkleTree
treeAuthority
params {
firstId
secondId
productPrice
maxDepth
maxBufferSize
name
metadataUrl
feeBasisPoints
}
}
}
... on InitProductEvent {
info {
systemProgram
tokenProgram2022
rent
signer
marketplace
product
productMint
paymentMint
accessMint
accessVault
params {
firstId
secondId
productPrice
productMintBump
}
}
}
... on InitRewardVaultEvent {
info {
systemProgram
tokenProgramV0
associatedTokenProgram
rent
signer
marketplace
reward
rewardMint
rewardVault
}
}
... on InitRewardEvent {
info {
systemProgram
tokenProgramV0
rent
signer
marketplace
reward
rewardMint
rewardVault
}
}
... on RegisterBuyCnftEvent {
info {
systemProgram
tokenProgramV0
rent
logWrapper
bubblegumProgram
compressionProgram
tokenMetadataProgram
signer
seller
marketplaceAuth
marketplace
product
paymentMint
productMint
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
metadata
masterEdition
treeAuthority
merkleTree
params {
amount
name
symbol
uri
}
}
}
... on RegisterBuyCounterEvent {
info {
systemProgram
tokenProgramV0
rent
signer
seller
marketplaceAuth
marketplace
product
payment
paymentMint
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
amount
}
}
... on RegisterBuyTokenEvent {
info {
systemProgram
tokenProgramV0
tokenProgram2022
signer
seller
marketplaceAuth
marketplace
product
productMint
paymentMint
buyerTokenVault
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
amount
}
}
... on RegisterBuyEvent {
info {
systemProgram
tokenProgramV0
rent
signer
seller
marketplaceAuth
marketplace
product
payment
paymentMint
buyerTransferVault
sellerTransferVault
marketplaceTransferVault
bountyVault
sellerReward
sellerRewardVault
buyerReward
buyerRewardVault
amount
}
}
... on RequestAccessEvent {
info {
systemProgram
rent
signer
marketplace
request
}
}
... on UpdateTreeEvent {
info {
payer
signer
marketplace
product
treeAuthority
merkleTree
logWrapper
systemProgram
bubblegumProgram
compressionProgram
params {
maxDepth
maxBufferSize
}
}
}
... on WithdrawRewardEvent {
info {
tokenProgramV0
signer
marketplace
reward
rewardMint
receiverVault
rewardVault
}
}
}
}
The current state and human-readable content of all program accounts can be queries like this:
{
accounts {
address
type
data {
...on Marketplace {
authority
tokenConfig {
useCnfts
deliverToken
transferable
chainCounter
}
permissionConfig {
accessMint
permissionless
}
feesConfig {
discountMint
fee
feeReduction
feePayer
}
rewardsConfig {
rewardMint
bountyVaults
sellerReward
buyerReward
rewardsEnabled
}
}
...on Product {
authority
firstId
secondId
marketplace
productMint
merkleTree
sellerConfig {
paymentMint
productPrice
}
bumps {
bump
mintBump
}
}
...on Reward {
authority
marketplace
rewardVaults
bumps {
bump
vaultBumps
}
}
...on Access {
authority
marketplace
bump
}
...on Payment {
units
bump
}
}
}
}