Mechanisms

mechanisms/evm/upto/server

github.com/x402-foundation/x402/go/v2/mechanisms/evm/upto/server

import "github.com/x402-foundation/x402/go/v2/mechanisms/evm/upto/server"

Constants

Source: mechanisms/evm/upto/server/errors.go:4

const (
	ErrAmountMustBeString    = "invalid_upto_evm_server_amount_must_be_string"
	ErrAssetAddressRequired  = "invalid_upto_evm_server_asset_address_required"
	ErrFailedToParsePrice    = "invalid_upto_evm_server_failed_to_parse_price"
	ErrUnsupportedPriceType  = "invalid_upto_evm_server_unsupported_price_type"
	ErrFailedToConvertAmount = "invalid_upto_evm_server_failed_to_convert_amount"
	ErrNoAssetSpecified      = "invalid_upto_evm_server_no_asset_specified"
	ErrFailedToParseAmount   = "invalid_upto_evm_server_failed_to_parse_amount"
	ErrInvalidPayToAddress   = "invalid_upto_evm_server_invalid_payto_address"
	ErrAmountRequired        = "invalid_upto_evm_server_amount_required"
	ErrInvalidAmount         = "invalid_upto_evm_server_invalid_amount"
	ErrInvalidAsset          = "invalid_upto_evm_server_invalid_asset"
	ErrInvalidTokenAmount    = "invalid_upto_evm_server_invalid_token_amount"
)

Functions

func NewUptoEvmScheme() *UptoEvmScheme

Source: mechanisms/evm/upto/server/scheme.go:22

Types

type UptoEvmScheme

Source: mechanisms/evm/upto/server/scheme.go:18

UptoEvmScheme implements the SchemeNetworkServer interface for EVM upto payments (V2). Always uses Permit2 (no EIP-3009 path).

type UptoEvmScheme struct {
	// contains filtered or unexported fields
}

func EnhancePaymentRequirements( ctx context.Context, requirements types.PaymentRequirements, supportedKind types.SupportedKind, extensionKeys []string, ) (types.PaymentRequirements, error)

Source: mechanisms/evm/upto/server/scheme.go:171

EnhancePaymentRequirements adds upto payment requirements.

func GetAssetDecimals(asset string, network x402.Network) int

Source: mechanisms/evm/upto/server/scheme.go:34

GetAssetDecimals implements AssetDecimalsProvider. Returns the decimal precision for the given asset on the given network, falling back to 6 if the asset is not recognized.

func ParsePrice(price x402.Price, network x402.Network) (x402.AssetAmount, error)

Source: mechanisms/evm/upto/server/scheme.go:47

func RegisterMoneyParser(parser x402.MoneyParser) *UptoEvmScheme

Source: mechanisms/evm/upto/server/scheme.go:42

func Scheme) Scheme() string

Source: mechanisms/evm/upto/server/scheme.go:28

func ValidatePaymentRequirements(requirements x402.PaymentRequirements) error

Source: mechanisms/evm/upto/server/scheme.go:235

ValidatePaymentRequirements validates that requirements are valid for this scheme.