diff --git a/services/indexer/indexer.gen.go b/services/indexer/indexer.gen.go index 23e345b9..e3fd1289 100644 --- a/services/indexer/indexer.gen.go +++ b/services/indexer/indexer.gen.go @@ -1,4 +1,4 @@ -// sequence-indexer v0.4.0 12ecb31178000c1165150b0ac0f3a304ccc5a88d +// sequence-indexer v0.4.0 84ae41d7d7bbf2414cf42c51b157fb42464a9384 // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -33,13 +33,18 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "12ecb31178000c1165150b0ac0f3a304ccc5a88d" + return "84ae41d7d7bbf2414cf42c51b157fb42464a9384" } // // Client interface // +type AdminClient interface { + // Backup – starts bond DB backup in background. Only one backup at a time. Default mode incremental. + Backup(ctx context.Context, mode *BackupMode) error +} + type IndexerClient interface { AddWebhookListener(ctx context.Context, url string, filters *EventFilter, projectId *uint64) (bool, *WebhookListener, error) // Fetches a single receipt and then will stop the subscription @@ -278,6 +283,48 @@ type Asset struct { UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` } +type BackupMode uint8 + +const ( + BackupMode_INCREMENTAL BackupMode = 0 + BackupMode_COMPLETE BackupMode = 1 +) + +var BackupMode_name = map[uint8]string{ + 0: "INCREMENTAL", + 1: "COMPLETE", +} + +var BackupMode_value = map[string]uint8{ + "INCREMENTAL": 0, + "COMPLETE": 1, +} + +func (x BackupMode) String() string { + return BackupMode_name[uint8(x)] +} + +func (x BackupMode) MarshalText() ([]byte, error) { + return []byte(BackupMode_name[uint8(x)]), nil +} + +func (x *BackupMode) UnmarshalText(b []byte) error { + *x = BackupMode(BackupMode_value[string(b)]) + return nil +} + +func (x *BackupMode) Is(values ...BackupMode) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + type BloomStats struct { HitRatio string `json:"hitRatio"` FalsePositivesPercent string `json:"falsePositivesPercent"` @@ -985,6 +1032,7 @@ type TokenBalancesByContractFilter struct { ContractAddresses []prototyp.Hash `json:"contractAddresses"` AccountAddresses []prototyp.Hash `json:"accountAddresses"` ContractStatus ContractVerificationStatus `json:"contractStatus"` + TokenIDs []prototyp.BigInt `json:"tokenIDs"` } type TokenBalancesFilter struct { @@ -995,6 +1043,7 @@ type TokenBalancesFilter struct { ContractBlacklist []prototyp.Hash `json:"contractBlacklist"` OmitNativeBalances bool `json:"omitNativeBalances,omitempty"` OmitPrices bool `json:"omitPrices,omitempty"` + TokenIDs []prototyp.BigInt `json:"tokenIDs"` } // Token History @@ -1301,9 +1350,42 @@ type WebhookListener struct { // Client // +const AdminPathPrefix = "/rpc/Admin/" const IndexerPathPrefix = "/rpc/Indexer/" const IndexerGatewayPathPrefix = "/rpc/IndexerGateway/" +type adminClient struct { + client HTTPClient + urls [1]string +} + +func NewAdminClient(addr string, client HTTPClient) AdminClient { + prefix := urlBase(addr) + AdminPathPrefix + urls := [1]string{ + prefix + "Backup", + } + return &adminClient{ + client: client, + urls: urls, + } +} + +func (c *adminClient) Backup(ctx context.Context, mode *BackupMode) error { + in := struct { + Arg0 *BackupMode `json:"mode"` + }{mode} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[0], in, nil) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return err +} + type indexerClient struct { client HTTPClient urls [36]string