Documentation
¶
Index ¶
Constants ¶
const (
// TrackerV1Prefix is the url prefix for the bridge tracker service
TrackerV1Prefix = "/tracker/v1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the HTTP service of the bridge tracker: the REST and WebSocket endpoints served on the shared HTTP server. Each endpoint's business logic is built once, at construction time, into its own command/handler object below — the API struct only wires routes to them, it does not hold the supervised registry, logger or instance identity itself.
func NewAPI ¶
func NewAPI( logger aggkitcommon.Logger, configSHA1 string, supervised domain.SupervisedRegistry, registerResolveTimeout time.Duration, cors aggkitcommon.CORSConfig, ) *API
NewAPI returns the tracker HTTP service serving the given supervised registry. registerResolveTimeout is how long GetTxStatus waits, the first time a tx is registered, for the tracking engine's immediate resolution attempt to produce an update before answering (see getTxStatusCommand); <= 0 disables the wait. cors governs which origins may open the WebSocket endpoint (see wsHandler)
func (*API) RegisterRoutes ¶
RegisterRoutes registers all bridge tracker routes on router. Route-level documentation (see swagger.json/swagger.yaml, generated via `make generate-swagger-docs`) lives on the actual handler each route dispatches to: getTxStatusCommand.Execute, healthCommand.Execute and wsHandler.TxStatusWSHandler
type BridgeEventData ¶
type BridgeEventData struct {
// LeafType is the string representation of the kind of leaf the bridge created (asset or message)
LeafType string `json:"leaf_type"`
// OriginNetwork is the network where the bridged asset originates from
OriginNetwork uint32 `json:"origin_network"`
// OriginAddress is the address of the asset on the origin network
OriginAddress common.Address `json:"origin_address"`
// DestinationNetwork is the network the bridge exits to (0 -> Mainnet)
DestinationNetwork uint32 `json:"destination_network"`
// DestinationAddress is the address that receives the asset on the destination network
DestinationAddress common.Address `json:"destination_address"`
// Amount is the amount of the asset being bridged, as a decimal string — a plain JSON
// number would risk losing precision on wei-scale amounts in clients that decode numbers
// as float64 (e.g. JavaScript)
Amount string `json:"amount"`
// DepositCount is the index of the bridge leaf in the origin exit tree
DepositCount uint32 `json:"deposit_count"`
}
BridgeEventData holds the fields taken directly from the on-chain BridgeEvent log, as opposed to context resolved around it (block number/index/timestamp, tracking network) — see BridgeStatus
type BridgeStatus ¶
type BridgeStatus struct {
// BridgeType is the string representation of the bridge's direction (e.g. "L1->L2")
BridgeType string `json:"bridge_type"`
// BlockNumber is the block, on the origin network, where the BridgeEvent was emitted
BlockNumber uint64 `json:"block_number"`
// LogIndex is the position of the BridgeEvent log within BlockNumber
LogIndex uint32 `json:"log_index"`
// BlockTimestamp is the timestamp of the block, on the origin network, where the BridgeEvent was emitted
BlockTimestamp uint64 `json:"block_timestamp"`
// Event holds the facts unpacked directly from the on-chain BridgeEvent log
Event BridgeEventData `json:"event"`
}
BridgeStatus is part of the response of GET /tracker/v1/tx/{txHash} (see TrackingData), identifying the bridge that TrackingData.AllSteps describes
type BridgeStepPath ¶
type BridgeStepPath struct {
// StepIndex is this step's position within the parent TrackingData.AllSteps list
StepIndex int `json:"step_index"`
// StepName is the string representation of the bridge step (e.g. "PendingInclusion")
StepName string `json:"step_name"`
// Status is the string representation of the step's status (e.g. "done")
Status string `json:"status"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
ExpectedDuration *types.Duration `json:"expected_duration,omitempty"`
// Result is the data the step has produced so far; its shape depends on Step:
// *types.GERUpdateResult (StepWaitingGERUpdate), *types.InjectedGERResult
// (StepWaitingGERInjection), *types.LERUpdateResult (StepWaitingLERUpdate),
// *types.PendingInclusionResult (StepPendingInclusion), *types.CertificateData
// (StepCertificatePending), *types.L1SettledGERResult (StepWaitL1SettledGER) or
// *types.ClaimResult (StepWaitingClaim). nil until
// the step produces one, and for steps that never do. Most steps only set this once Done,
// but StepCertificatePending (Status still InProgress) may already carry the certificate's
// current, not yet settled, status — see domain.ErrCertificateNotSettled
Result any `json:"result,omitempty"`
// Error carries the error details when Status is types.StepStatusError, nil otherwise
Error *types.ErrorStep `json:"error,omitempty"`
}
BridgeStepPath describes one step of the expected path of a bridge, as returned by the API
type TrackingData ¶
type TrackingData struct {
// TrackingStatus is the string representation of the bridge's lifecycle status
TrackingStatus string `json:"tracking_status"`
// NetworkID is the network of the request (0 -> Mainnet)
NetworkID uint32 `json:"network_id"`
// TxHash is the transaction hash of the request
TxHash common.Hash `json:"tx_hash"`
// BridgeStatus is nil until the tracker resolves the bridge; from then on it carries
// the full BridgeStatus. Marshaled explicitly as null while unresolved (no omitempty)
// so clients can poll on its presence without an extra field to check
BridgeStatus *BridgeStatus `json:"bridge_status"`
// StepIndex is the index into AllSteps of the step that explains TrackingStatus: the
// step currently in progress when Running, the step in error when Error, or the last
// step (Claimed) when Finished. nil while BridgeStatus/AllSteps are nil
StepIndex *int `json:"step_index"`
// AllSteps holds all expected steps of the bridge's route; GER/LER, certificate and
// claim data are reported per step in each entry's Result. nil while BridgeStatus is nil
AllSteps []BridgeStepPath `json:"all_steps"`
// Error mirrors whatever currently explains the bridge not progressing, if anything: a
// terminal give-up to even resolve it (e.g. the tx does not exist on the network or is
// not a bridge transaction — TrackingStatus is Error and BridgeStatus/StepIndex/AllSteps
// stay nil forever), a transient FindBridge failure still being retried (TrackingStatus
// is unaffected), or the same error already nested in AllSteps[StepIndex].Error once the
// bridge is otherwise resolved. nil while nothing has failed
Error *types.ErrorStep `json:"error"`
}
TrackingData is the body of every GET /tracker/v1/network/{network_id}/tx/{tx_hash} response (always 200 OK) and of every WebSocket "status" message: TrackingStatus carries the bridge's full lifecycle, and BridgeStatus carries the detail behind it once resolved