pub struct Wallet { /* private fields */ }Expand description
Wallet implementation for x402 payments
Implementations§
Source§impl Wallet
impl Wallet
Sourcepub fn new(private_key: String, network: String) -> Self
pub fn new(private_key: String, network: String) -> Self
Create a new wallet instance
§Security Note
In production, the private key should be loaded from:
- Hardware wallets (Ledger, Trezor)
- Encrypted key stores
- Secure environment variables
- Key management services (AWS KMS, Azure Key Vault)
Sourcepub fn create_signed_payment_payload(
&self,
requirements: &PaymentRequirements,
from_address: &str,
) -> Result<PaymentPayload>
pub fn create_signed_payment_payload( &self, requirements: &PaymentRequirements, from_address: &str, ) -> Result<PaymentPayload>
Create a payment payload with real EIP-712 signature
This is the production-ready implementation that:
- Generates cryptographically secure random nonce
- Creates proper EIP-712 message hash
- Signs with the user’s private key
- Verifies the signature before returning
Sourcepub fn get_network_config(&self) -> Result<WalletNetworkConfig>
pub fn get_network_config(&self) -> Result<WalletNetworkConfig>
Get network configuration for the current network
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Wallet
impl RefUnwindSafe for Wallet
impl Send for Wallet
impl Sync for Wallet
impl Unpin for Wallet
impl UnwindSafe for Wallet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more