diff --git a/indexer/indexer.gen.go b/indexer/indexer.gen.go index 3d9d4313..16be1dc9 100644 --- a/indexer/indexer.gen.go +++ b/indexer/indexer.gen.go @@ -1,6 +1,6 @@ -// sequence-indexer v0.4.0 b1272cb0621038e4142bd24d87ccd2cfa1ac30c9 +// sequence-indexer v0.4.0 1f8f46f2ca906ad72fb7d067e38a51875db159b3 // -- -// Code generated by webrpc-gen@v0.10.x-dev with golang@v0.10.0 generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.12.x-dev with golang@v0.10.0 generator. DO NOT EDIT. // // webrpc-gen -schema=indexer.ridl -target=golang@v0.10.0 -pkg=indexer -client -out=./clients/indexer.gen.go package indexer @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "b1272cb0621038e4142bd24d87ccd2cfa1ac30c9" + return "1f8f46f2ca906ad72fb7d067e38a51875db159b3" } // @@ -51,6 +51,7 @@ type ContractInfo struct { BytecodeHash prototyp.Hash `json:"bytecodeHash" cbor:"-"` Extensions *ContractInfoExtensions `json:"extensions" cbor:"-"` ContentHash uint64 `json:"-" cbor:"-"` + UpdatedAt time.Time `json:"updatedAt" cbor:"-"` } type ContractInfoExtensions struct { @@ -60,6 +61,8 @@ type ContractInfoExtensions struct { OriginChainID uint64 `json:"originChainId" cbor:"-"` OriginAddress string `json:"originAddress" cbor:"-"` Blacklist bool `json:"blacklist,omitempty" cbor:"-"` + Verified bool `json:"verified" cbor:"-"` + VerifiedBy string `json:"verifiedBy,omitempty" cbor:"-"` } type TokenMetadata struct { @@ -77,6 +80,7 @@ type TokenMetadata struct { BackgroundColor string `json:"background_color,omitempty" cbor:"-"` AnimationUrl string `json:"animation_url,omitempty" cbor:"-"` Attributes []map[string]interface{} `json:"attributes" cbor:"-"` + UpdatedAt time.Time `json:"updatedAt" cbor:"-"` } type ContractType uint8 @@ -400,10 +404,24 @@ type RuntimeStatus struct { type RuntimeChecks struct { Running bool `json:"running"` CgoEnabled bool `json:"cgoEnabled"` + QuotaControlEnabled bool `json:"quotaControlEnabled"` SyncMode string `json:"syncMode"` PercentIndexed float64 `json:"percentIndexed"` LastBlockNum uint64 `json:"lastBlockNum"` LastBlockNumWithState uint64 `json:"lastBlockNumWithState"` + Bond *Bond `json:"bond"` +} + +type Bond struct { + Pebble *PebbleMetrics `json:"pebble"` +} + +type PebbleMetrics struct { + CompactionCount int64 `json:"compactionCount"` + CompactionEstimatedDebt uint64 `json:"compactionEstimatedDebt"` + CompactionInProgressBytes int64 `json:"compactionInProgressBytes"` + CompactionNumInProgress int64 `json:"compactionNumInProgress"` + CompactionMarkedFiles int `json:"compactionMarkedFiles"` } type EtherBalance struct { @@ -565,20 +583,44 @@ type SortBy struct { Order *SortOrder `json:"order"` } +type WebhookListener struct { + Id uint64 `json:"id"` + ProjectID uint64 `json:"projectID"` + Url string `json:"url"` + Filters *WebhookEventFilter `json:"filters"` + UpdatedAt time.Time `json:"updatedAt"` +} + +type WebhookEventFilter struct { + ContractAddresses []prototyp.Hash `json:"contractAddresses"` + TokenIDs []prototyp.BigInt `json:"tokenIDs"` + Accounts []prototyp.Hash `json:"accounts"` +} + +type MetadataOptions struct { + IncludeUnverified bool `json:"includeUnverified"` + IncludeMetadataContracts []prototyp.Hash `json:"includeMetadataContracts"` +} + type Indexer interface { Ping(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) GetChainID(ctx context.Context) (uint64, error) GetEtherBalance(ctx context.Context, accountAddress *string) (*EtherBalance, error) - GetTokenBalances(ctx context.Context, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, page *Page) (*Page, []*TokenBalance, error) - GetTokenSupplies(ctx context.Context, contractAddress string, includeMetadata *bool, page *Page) (*Page, *ContractType, []*TokenSupply, error) - GetTokenSuppliesMap(ctx context.Context, tokenMap map[string][]string, includeMetadata *bool) (map[string][]*TokenSupply, error) + GetTokenBalances(ctx context.Context, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, metadataOptions *MetadataOptions, page *Page) (*Page, []*TokenBalance, error) + GetTokenSupplies(ctx context.Context, contractAddress string, includeMetadata *bool, metadataOptions *MetadataOptions, page *Page) (*Page, *ContractType, []*TokenSupply, error) + GetTokenSuppliesMap(ctx context.Context, tokenMap map[string][]string, includeMetadata *bool, metadataOptions *MetadataOptions) (map[string][]*TokenSupply, error) GetBalanceUpdates(ctx context.Context, contractAddress string, lastBlockNumber uint64, lastBlockHash *string, page *Page) (*Page, []*TokenBalance, error) - GetTransactionHistory(ctx context.Context, filter *TransactionHistoryFilter, page *Page, includeMetadata *bool) (*Page, []*Transaction, error) + GetTransactionHistory(ctx context.Context, filter *TransactionHistoryFilter, page *Page, includeMetadata *bool, metadataOptions *MetadataOptions) (*Page, []*Transaction, error) SyncBalance(ctx context.Context, accountAddress string, contractAddress string, tokenID *string) error FetchTransactionReceipt(ctx context.Context, txnHash string, maxBlockWait *int) (*TransactionReceipt, error) FetchTransactionReceiptWithFilter(ctx context.Context, filter *Filter, maxBlockWait *int) (*TransactionReceipt, error) + GetAllWebhookListeners(ctx context.Context, projectId *uint64) ([]*WebhookListener, error) + GetWebhookListener(ctx context.Context, id uint64, projectId *uint64) (*WebhookListener, error) + AddWebhookListener(ctx context.Context, url string, filters *WebhookEventFilter, projectId *uint64) (bool, *WebhookListener, error) + UpdateWebhookListener(ctx context.Context, listener *WebhookListener, projectId *uint64) (bool, error) + RemoveWebhookListener(ctx context.Context, id uint64, projectId *uint64) (bool, error) } var WebRPCServices = map[string][]string{ @@ -596,6 +638,11 @@ var WebRPCServices = map[string][]string{ "SyncBalance", "FetchTransactionReceipt", "FetchTransactionReceiptWithFilter", + "GetAllWebhookListeners", + "GetWebhookListener", + "AddWebhookListener", + "UpdateWebhookListener", + "RemoveWebhookListener", }, } @@ -607,12 +654,12 @@ const IndexerPathPrefix = "/rpc/Indexer/" type indexerClient struct { client HTTPClient - urls [13]string + urls [18]string } func NewIndexerClient(addr string, client HTTPClient) Indexer { prefix := urlBase(addr) + IndexerPathPrefix - urls := [13]string{ + urls := [18]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -626,6 +673,11 @@ func NewIndexerClient(addr string, client HTTPClient) Indexer { prefix + "SyncBalance", prefix + "FetchTransactionReceipt", prefix + "FetchTransactionReceiptWithFilter", + prefix + "GetAllWebhookListeners", + prefix + "GetWebhookListener", + prefix + "AddWebhookListener", + prefix + "UpdateWebhookListener", + prefix + "RemoveWebhookListener", } return &indexerClient{ client: client, @@ -681,14 +733,15 @@ func (c *indexerClient) GetEtherBalance(ctx context.Context, accountAddress *str return out.Ret0, err } -func (c *indexerClient) GetTokenBalances(ctx context.Context, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, page *Page) (*Page, []*TokenBalance, error) { +func (c *indexerClient) GetTokenBalances(ctx context.Context, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, metadataOptions *MetadataOptions, page *Page) (*Page, []*TokenBalance, error) { in := struct { - Arg0 *string `json:"accountAddress"` - Arg1 *string `json:"contractAddress"` - Arg2 *string `json:"tokenID"` - Arg3 *bool `json:"includeMetadata"` - Arg4 *Page `json:"page"` - }{accountAddress, contractAddress, tokenID, includeMetadata, page} + Arg0 *string `json:"accountAddress"` + Arg1 *string `json:"contractAddress"` + Arg2 *string `json:"tokenID"` + Arg3 *bool `json:"includeMetadata"` + Arg4 *MetadataOptions `json:"metadataOptions"` + Arg5 *Page `json:"page"` + }{accountAddress, contractAddress, tokenID, includeMetadata, metadataOptions, page} out := struct { Ret0 *Page `json:"page"` Ret1 []*TokenBalance `json:"balances"` @@ -698,12 +751,13 @@ func (c *indexerClient) GetTokenBalances(ctx context.Context, accountAddress *st return out.Ret0, out.Ret1, err } -func (c *indexerClient) GetTokenSupplies(ctx context.Context, contractAddress string, includeMetadata *bool, page *Page) (*Page, *ContractType, []*TokenSupply, error) { +func (c *indexerClient) GetTokenSupplies(ctx context.Context, contractAddress string, includeMetadata *bool, metadataOptions *MetadataOptions, page *Page) (*Page, *ContractType, []*TokenSupply, error) { in := struct { - Arg0 string `json:"contractAddress"` - Arg1 *bool `json:"includeMetadata"` - Arg2 *Page `json:"page"` - }{contractAddress, includeMetadata, page} + Arg0 string `json:"contractAddress"` + Arg1 *bool `json:"includeMetadata"` + Arg2 *MetadataOptions `json:"metadataOptions"` + Arg3 *Page `json:"page"` + }{contractAddress, includeMetadata, metadataOptions, page} out := struct { Ret0 *Page `json:"page"` Ret1 *ContractType `json:"contractType"` @@ -714,11 +768,12 @@ func (c *indexerClient) GetTokenSupplies(ctx context.Context, contractAddress st return out.Ret0, out.Ret1, out.Ret2, err } -func (c *indexerClient) GetTokenSuppliesMap(ctx context.Context, tokenMap map[string][]string, includeMetadata *bool) (map[string][]*TokenSupply, error) { +func (c *indexerClient) GetTokenSuppliesMap(ctx context.Context, tokenMap map[string][]string, includeMetadata *bool, metadataOptions *MetadataOptions) (map[string][]*TokenSupply, error) { in := struct { Arg0 map[string][]string `json:"tokenMap"` Arg1 *bool `json:"includeMetadata"` - }{tokenMap, includeMetadata} + Arg2 *MetadataOptions `json:"metadataOptions"` + }{tokenMap, includeMetadata, metadataOptions} out := struct { Ret0 map[string][]*TokenSupply `json:"supplies"` }{} @@ -743,12 +798,13 @@ func (c *indexerClient) GetBalanceUpdates(ctx context.Context, contractAddress s return out.Ret0, out.Ret1, err } -func (c *indexerClient) GetTransactionHistory(ctx context.Context, filter *TransactionHistoryFilter, page *Page, includeMetadata *bool) (*Page, []*Transaction, error) { +func (c *indexerClient) GetTransactionHistory(ctx context.Context, filter *TransactionHistoryFilter, page *Page, includeMetadata *bool, metadataOptions *MetadataOptions) (*Page, []*Transaction, error) { in := struct { Arg0 *TransactionHistoryFilter `json:"filter"` Arg1 *Page `json:"page"` Arg2 *bool `json:"includeMetadata"` - }{filter, page, includeMetadata} + Arg3 *MetadataOptions `json:"metadataOptions"` + }{filter, page, includeMetadata, metadataOptions} out := struct { Ret0 *Page `json:"page"` Ret1 []*Transaction `json:"transactions"` @@ -795,6 +851,72 @@ func (c *indexerClient) FetchTransactionReceiptWithFilter(ctx context.Context, f return out.Ret0, err } +func (c *indexerClient) GetAllWebhookListeners(ctx context.Context, projectId *uint64) ([]*WebhookListener, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + }{projectId} + out := struct { + Ret0 []*WebhookListener `json:"listeners"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[13], in, &out) + return out.Ret0, err +} + +func (c *indexerClient) GetWebhookListener(ctx context.Context, id uint64, projectId *uint64) (*WebhookListener, error) { + in := struct { + Arg0 uint64 `json:"id"` + Arg1 *uint64 `json:"projectId"` + }{id, projectId} + out := struct { + Ret0 *WebhookListener `json:"listener"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[14], in, &out) + return out.Ret0, err +} + +func (c *indexerClient) AddWebhookListener(ctx context.Context, url string, filters *WebhookEventFilter, projectId *uint64) (bool, *WebhookListener, error) { + in := struct { + Arg0 string `json:"url"` + Arg1 *WebhookEventFilter `json:"filters"` + Arg2 *uint64 `json:"projectId"` + }{url, filters, projectId} + out := struct { + Ret0 bool `json:"status"` + Ret1 *WebhookListener `json:"listener"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[15], in, &out) + return out.Ret0, out.Ret1, err +} + +func (c *indexerClient) UpdateWebhookListener(ctx context.Context, listener *WebhookListener, projectId *uint64) (bool, error) { + in := struct { + Arg0 *WebhookListener `json:"listener"` + Arg1 *uint64 `json:"projectId"` + }{listener, projectId} + out := struct { + Ret0 bool `json:"status"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[16], in, &out) + return out.Ret0, err +} + +func (c *indexerClient) RemoveWebhookListener(ctx context.Context, id uint64, projectId *uint64) (bool, error) { + in := struct { + Arg0 uint64 `json:"id"` + Arg1 *uint64 `json:"projectId"` + }{id, projectId} + out := struct { + Ret0 bool `json:"status"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[17], in, &out) + return out.Ret0, err +} + // HTTPClient is the interface used by generated clients to send HTTP requests. // It is fulfilled by *(net/http).Client, which is sufficient for most users. // Users can provide their own implementation for special retry policies. diff --git a/metadata/metadata.gen.go b/metadata/metadata.gen.go index 357323c0..b7f05fe8 100644 --- a/metadata/metadata.gen.go +++ b/metadata/metadata.gen.go @@ -1,6 +1,6 @@ -// sequence-metadata v0.4.0 cfb30e2d7e41a5270c5c51c7fc4369234fc7b3f3 +// sequence-metadata v0.4.0 ef61b3481a4dd4aa5b6a283701d4c15001552e0e // -- -// Code generated by webrpc-gen@v0.10.x-dev with golang@v0.10.0 generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.12.x-dev with golang@v0.10.0 generator. DO NOT EDIT. // // webrpc-gen -schema=metadata.ridl -target=golang@v0.10.0 -pkg=metadata -client -out=./clients/metadata.gen.go package metadata @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "cfb30e2d7e41a5270c5c51c7fc4369234fc7b3f3" + return "ef61b3481a4dd4aa5b6a283701d4c15001552e0e" } // @@ -236,6 +236,7 @@ type ContractIndex struct { BytecodeHash prototyp.Hash `json:"bytecodeHash" db:"bytecode_hash"` NotFound bool `json:"notFound,omitempty"` SearchCol string `json:"-" db:"search_col"` + UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` } type TokenIndex struct { @@ -245,7 +246,10 @@ type TokenIndex struct { TokenID prototyp.BigInt `json:"tokenId" db:"token_id"` Metadata map[string]interface{} `json:"metadata" db:"metadata"` SearchColumn string `json:"-" db:"search_col"` - NotFound bool `json:"notFound,omitempty"` + NotFound bool `json:"notFound,omitempty" db:"not_found"` + LastFetched *time.Time `json:"lastFetched,omitempty" db:"last_fetched"` + FetchCount *uint8 `json:"fetchCount,omitempty" db:"fetch_count"` + UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` } type ContractInfo struct { @@ -260,6 +264,7 @@ type ContractInfo struct { BytecodeHash prototyp.Hash `json:"bytecodeHash" cbor:"-"` Extensions *ContractInfoExtensions `json:"extensions" cbor:"-"` ContentHash uint64 `json:"-" cbor:"-"` + UpdatedAt time.Time `json:"updatedAt" cbor:"-"` } type ContractInfoExtensions struct { @@ -269,6 +274,8 @@ type ContractInfoExtensions struct { OriginChainID uint64 `json:"originChainId" cbor:"-"` OriginAddress string `json:"originAddress" cbor:"-"` Blacklist bool `json:"blacklist,omitempty" cbor:"-"` + Verified bool `json:"verified" cbor:"-"` + VerifiedBy string `json:"verifiedBy,omitempty" cbor:"-"` } type TokenMetadata struct { @@ -286,6 +293,7 @@ type TokenMetadata struct { BackgroundColor string `json:"background_color,omitempty" cbor:"-"` AnimationUrl string `json:"animation_url,omitempty" cbor:"-"` Attributes []map[string]interface{} `json:"attributes" cbor:"-"` + UpdatedAt time.Time `json:"updatedAt" cbor:"-"` } type PropertyFilter struct { @@ -337,7 +345,8 @@ type Metadata interface { GetContractInfoBatch(ctx context.Context, chainID string, contractAddresses []string) (map[string]*ContractInfo, error) SearchContractInfo(ctx context.Context, contractAddress string) ([]*ContractInfo, error) SearchContractInfoBatch(ctx context.Context, contractAddresses []string) (map[string][]*ContractInfo, error) - SearchMetadata(ctx context.Context, filter string) ([]*TokenMetadata, []*ContractInfo, error) + SearchMetadata(ctx context.Context, filter string, chainID *string, types []*ContractType, excludeTokenMetadata *bool) ([]*TokenMetadata, []*ContractInfo, error) + ProjectSetTokenMetadata(ctx context.Context, projectID *uint64, chainID string, tokenMetadata *TokenMetadata) (bool, error) GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error) GetNiftyswapUnitPrices(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]string, error) GetNiftyswapUnitPricesWithQuantities(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]*GetNiftyswapUnitPricesResponse, error) @@ -359,6 +368,7 @@ var WebRPCServices = map[string][]string{ "SearchContractInfo", "SearchContractInfoBatch", "SearchMetadata", + "ProjectSetTokenMetadata", "GetNiftyswapTokenQuantity", "GetNiftyswapUnitPrices", "GetNiftyswapUnitPricesWithQuantities", @@ -373,12 +383,12 @@ const MetadataPathPrefix = "/rpc/Metadata/" type metadataClient struct { client HTTPClient - urls [17]string + urls [18]string } func NewMetadataClient(addr string, client HTTPClient) Metadata { prefix := urlBase(addr) + MetadataPathPrefix - urls := [17]string{ + urls := [18]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -393,6 +403,7 @@ func NewMetadataClient(addr string, client HTTPClient) Metadata { prefix + "SearchContractInfo", prefix + "SearchContractInfoBatch", prefix + "SearchMetadata", + prefix + "ProjectSetTokenMetadata", prefix + "GetNiftyswapTokenQuantity", prefix + "GetNiftyswapUnitPrices", prefix + "GetNiftyswapUnitPricesWithQuantities", @@ -567,10 +578,13 @@ func (c *metadataClient) SearchContractInfoBatch(ctx context.Context, contractAd return out.Ret0, err } -func (c *metadataClient) SearchMetadata(ctx context.Context, filter string) ([]*TokenMetadata, []*ContractInfo, error) { +func (c *metadataClient) SearchMetadata(ctx context.Context, filter string, chainID *string, types []*ContractType, excludeTokenMetadata *bool) ([]*TokenMetadata, []*ContractInfo, error) { in := struct { - Arg0 string `json:"filter"` - }{filter} + Arg0 string `json:"filter"` + Arg1 *string `json:"chainID"` + Arg2 []*ContractType `json:"types"` + Arg3 *bool `json:"excludeTokenMetadata"` + }{filter, chainID, types, excludeTokenMetadata} out := struct { Ret0 []*TokenMetadata `json:"tokenMetadata"` Ret1 []*ContractInfo `json:"contractInfo"` @@ -580,6 +594,20 @@ func (c *metadataClient) SearchMetadata(ctx context.Context, filter string) ([]* return out.Ret0, out.Ret1, err } +func (c *metadataClient) ProjectSetTokenMetadata(ctx context.Context, projectID *uint64, chainID string, tokenMetadata *TokenMetadata) (bool, error) { + in := struct { + Arg0 *uint64 `json:"projectID"` + Arg1 string `json:"chainID"` + Arg2 *TokenMetadata `json:"tokenMetadata"` + }{projectID, chainID, tokenMetadata} + out := struct { + Ret0 bool `json:"ok"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[14], in, &out) + return out.Ret0, err +} + func (c *metadataClient) GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error) { in := struct { Arg0 string `json:"chainID"` @@ -590,7 +618,7 @@ func (c *metadataClient) GetNiftyswapTokenQuantity(ctx context.Context, chainID Ret0 map[string]string `json:"quantity"` }{} - err := doJSONRequest(ctx, c.client, c.urls[14], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[15], in, &out) return out.Ret0, err } @@ -605,7 +633,7 @@ func (c *metadataClient) GetNiftyswapUnitPrices(ctx context.Context, chainID str Ret0 map[string]string `json:"prices"` }{} - err := doJSONRequest(ctx, c.client, c.urls[15], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[16], in, &out) return out.Ret0, err } @@ -620,7 +648,7 @@ func (c *metadataClient) GetNiftyswapUnitPricesWithQuantities(ctx context.Contex Ret0 map[string]*GetNiftyswapUnitPricesResponse `json:"prices"` }{} - err := doJSONRequest(ctx, c.client, c.urls[16], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[17], in, &out) return out.Ret0, err }