blockchainquery

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package blockchainquery is a thin HTTP client for the Bitwave blockchain query API. It backs `bitwave wallets sync` — the per-wallet on-chain history pull that builds local ledger entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL       string
	TokenResolver func() (string, error)
	HTTPClient    *http.Client
}

Client wraps the blockchain query API address-scan endpoint.

func New

func New(baseURL string, tokenResolver func() (string, error)) *Client

New returns a Client with a 30s default timeout. TokenResolver may be nil for unauthenticated calls (e.g. when pointing at a local dev instance).

func (*Client) ScanAddress

func (c *Client) ScanAddress(req ScanRequest) (*ScanResponse, error)

type ScanRequest

type ScanRequest struct {
	Chain           string
	Address         string
	StartTimeUnixMs int64
	EndTimeUnixMs   int64
	Cursor          string
	Limit           int
	Order           string // "asc" or "desc"; empty == server default ("desc")
	FetchPayloads   bool
}

ScanRequest is the address-scan input. Time bounds are optional (zero = unbounded).

type ScanResponse

type ScanResponse struct {
	Results    []ScanResult `json:"results"`
	NextCursor string       `json:"nextCursor,omitempty"`
}

ScanResponse mirrors the server's response. Payload is the raw aggregated BQ rows (JSON array) — see internal/adapters/bq for the row shape.

type ScanResult

type ScanResult struct {
	PrimaryKey      string          `json:"primaryKey"`
	TxnHash         string          `json:"txnHash,omitempty"`
	BlockNumber     uint64          `json:"blockNumber,omitempty"`
	BlockTimeUnixMs int64           `json:"blockTimeUnixMs,omitempty"`
	Payload         json.RawMessage `json:"payload,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL