schema

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MPL-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxAlreadyExecuted = errors.New("err_transaction_already_executed")
	ErrPaymentFailed     = errors.New("err_payment_failed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// ChargeAddress is the address where prepaid fees should be transferred
	ChargeAddress string `json:"Charge-Address"`
	// SettlementAddress is the node’s settlement address (e.g. cold wallet or revenue sink)
	SettlementAddress string `json:"-"`

	AxToken      string   `json:"Ax-Token"`
	TxFee        *big.Int `json:"Tx-Fee"`
	SpawnFee     *big.Int `json:"Spawn-Fee"`
	ResidencyFee *big.Int `json:"Residency-Fee"`

	DailyLimit int64 `json:"Daily-Limit"`

	DeveloperShareRatio *big.Int `json:"Developer-Share-Ratio"`
}

type IDB

type IDB interface {
	IsWhitelist(accid string) bool
	SetWhitelist(accid string, enabled bool) error

	IsExecuted(txHash string) bool
	MarkExecuted(txHash string) error

	SponsorTotal(sponsor string) *big.Int
	SponsorBreakdown(sponsor string) map[string]*big.Int
	BeneficiaryTotal(beneficiary string) *big.Int
	BeneficiaryBreakdown(beneficiary string) map[string]*big.Int
	TotalPending(beneficiary string) *big.Int
	AllPending() map[string]*big.Int

	Deposit(sponsor, beneficiary string, amount *big.Int) error
	Withdraw(sponsor, beneficiary string, amount *big.Int) error

	CanCover(beneficiary string, delta *big.Int) bool
	UseOnce(beneficiary, pid string, fee *big.Int) error
	SpawnFee(beneficiary, pid string, fee *big.Int) error
	ResidencyFee(pid string, fee *big.Int) error
	// devFees pid -> fee
	SettleTxFee(beneficiary string, devShareRatio *big.Int) (nodeFee *big.Int, devFees map[string]*big.Int, err error)

	DailyUsage(accid string) int64
	IncrDailyUsage(accid string) error
	ResetDailyUsage() error

	//////////////////////
	Checkpoint() (data string, err error)
	Restore(data string) error
}

type PaymentOption added in v0.4.0

type PaymentOption struct {
	Scheme   string `json:"scheme"`
	Network  string `json:"network"`
	Resource string `json:"resource"`
	PayTo    string `json:"payTo"`
	Asset    string `json:"asset"`
	Amount   string `json:"amount"`
}

type X402Response added in v0.4.0

type X402Response struct {
	X402Version string          `json:"x402Version"`
	Error       string          `json:"error,omitempty"`
	Accepts     []PaymentOption `json:"accepts"`
}

Jump to

Keyboard shortcuts

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