mpc

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MPCSupportedCurrencies

func MPCSupportedCurrencies() []currency.Type

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

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

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

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

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.

Jump to

Keyboard shortcuts

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