demo

package
v0.9.0-rc9 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package demo implements HTTP handlers for obol sell demo services.

Each demo type returns a JSON response with a standard envelope:

{
  "demo": "<type>",
  "timestamp": "...",
  "payment": { "status": "...", "tx": "...", "payer": "..." },
  "data": { ... }
}

The payment block is populated from x402 ForwardAuth headers injected by Traefik after successful payment verification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlocksHandler

func BlocksHandler(erpcURL string) http.HandlerFunc

BlocksHandler returns a handler that queries eRPC for basic chain data.

func HelloHandler

func HelloHandler() http.HandlerFunc

HelloHandler returns a proof-of-payment response echoing request details.

func QuantHandler

func QuantHandler(erpcURL string) http.HandlerFunc

QuantHandler returns a handler that performs chain analysis using eRPC data. Unlike a simple RPC passthrough, it fetches multiple data points, computes derived metrics (gas statistics, tx volume), and formats a structured report.

Types

type PaymentInfo

type PaymentInfo struct {
	Status string `json:"status"`
	Tx     string `json:"tx,omitempty"`
	Payer  string `json:"payer,omitempty"`
}

PaymentInfo captures x402 payment metadata from ForwardAuth headers.

type Response

type Response struct {
	Demo      string      `json:"demo"`
	Timestamp string      `json:"timestamp"`
	Payment   PaymentInfo `json:"payment"`
	Data      any         `json:"data"`
}

Response is the standard envelope for all demo responses.

Jump to

Keyboard shortcuts

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