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"`
}
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 X402Response ¶ added in v0.4.0
type X402Response struct {
X402Version string `json:"x402Version"`
Error string `json:"error,omitempty"`
Accepts []PaymentOption `json:"accepts"`
}
Click to show internal directories.
Click to hide internal directories.