Documentation
¶
Index ¶
- func MPCSupportedCurrencies() []currency.Type
- type Config
- type MPCProcessor
- func (mp *MPCProcessor) Authorize(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (mp *MPCProcessor) Capture(ctx context.Context, transactionID string, amount currency.Cents) (*processor.PaymentResult, error)
- func (mp *MPCProcessor) Charge(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (mp *MPCProcessor) EstimateFee(ctx context.Context, req processor.PaymentRequest) (currency.Cents, error)
- func (mp *MPCProcessor) GenerateAddress(ctx context.Context, customerID string, chain string) (string, error)
- func (mp *MPCProcessor) GetBalance(ctx context.Context, address string, chain string) (*processor.Balance, error)
- func (mp *MPCProcessor) GetTransaction(ctx context.Context, txID string) (*processor.Transaction, error)
- func (mp *MPCProcessor) IsAvailable(ctx context.Context) bool
- func (mp *MPCProcessor) Refund(ctx context.Context, req processor.RefundRequest) (*processor.RefundResult, error)
- func (mp *MPCProcessor) SupportedChains() []string
- func (mp *MPCProcessor) Type() processor.ProcessorType
- func (mp *MPCProcessor) ValidateWebhook(ctx context.Context, payload []byte, signature string) (*processor.WebhookEvent, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MPCSupportedCurrencies ¶
MPCSupportedCurrencies returns cryptocurrencies supported by MPC.
Types ¶
type Config ¶
type Config struct {
KMSEndpoint string // Hanzo KMS API endpoint
MPCEndpoint string // Hanzo MPC Signer endpoint
APIKey string // API key for authentication
}
Config holds MPC processor configuration.
func DefaultConfig ¶ added in v1.37.0
func DefaultConfig() Config
DefaultConfig reads configuration from environment variables.
type MPCProcessor ¶
type MPCProcessor struct {
*processor.BaseProcessor
// contains filtered or unexported fields
}
MPCProcessor implements the processor.CryptoProcessor interface using Hanzo KMS (control plane) + MPC Signer (signing backend).
func NewProcessor ¶
func NewProcessor(cfg Config) *MPCProcessor
NewProcessor creates a new MPC processor.
func (*MPCProcessor) Authorize ¶
func (mp *MPCProcessor) Authorize(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
Authorize creates a pending transaction in the MPC policy engine for approval.
func (*MPCProcessor) Capture ¶
func (mp *MPCProcessor) Capture(ctx context.Context, transactionID string, amount currency.Cents) (*processor.PaymentResult, error)
Capture approves and executes a previously authorized transaction.
func (*MPCProcessor) Charge ¶
func (mp *MPCProcessor) Charge(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
Charge processes a crypto payment by creating and signing a transaction via MPC.
func (*MPCProcessor) EstimateFee ¶
func (mp *MPCProcessor) EstimateFee(ctx context.Context, req processor.PaymentRequest) (currency.Cents, error)
EstimateFee estimates transaction fees based on chain type.
func (*MPCProcessor) GenerateAddress ¶
func (mp *MPCProcessor) GenerateAddress(ctx context.Context, customerID string, chain string) (string, error)
GenerateAddress creates a new MPC wallet and returns the chain-specific address. Calls MPC API: POST /api/v1/vaults/{vaultID}/wallets
func (*MPCProcessor) GetBalance ¶
func (mp *MPCProcessor) GetBalance(ctx context.Context, address string, chain string) (*processor.Balance, error)
GetBalance retrieves the balance for an address on a given chain. Calls MPC service for balance lookup or chain RPC.
func (*MPCProcessor) GetTransaction ¶
func (mp *MPCProcessor) GetTransaction(ctx context.Context, txID string) (*processor.Transaction, error)
GetTransaction retrieves transaction details from the MPC service.
func (*MPCProcessor) IsAvailable ¶
func (mp *MPCProcessor) IsAvailable(ctx context.Context) bool
IsAvailable checks if the MPC and KMS services are reachable.
func (*MPCProcessor) Refund ¶
func (mp *MPCProcessor) Refund(ctx context.Context, req processor.RefundRequest) (*processor.RefundResult, error)
Refund signs a refund transaction via MPC (outbound transfer back to source).
func (*MPCProcessor) SupportedChains ¶
func (mp *MPCProcessor) SupportedChains() []string
SupportedChains returns blockchain networks supported by MPC.
func (*MPCProcessor) Type ¶
func (mp *MPCProcessor) Type() processor.ProcessorType
Type returns the processor type.
func (*MPCProcessor) ValidateWebhook ¶
func (mp *MPCProcessor) ValidateWebhook(ctx context.Context, payload []byte, signature string) (*processor.WebhookEvent, error)
ValidateWebhook validates an incoming blockchain event notification. The MPC service sends webhook events for transaction confirmations.