moltspay 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -98,26 +98,14 @@ npx moltspay init --chain base
98
98
  # Storage: ~/.moltspay
99
99
  ```
100
100
 
101
- **Request Owner authorization (one-time):**
102
- ```bash
103
- npx moltspay auth-request --owner 0xOWNER_METAMASK --amount 50 --chain base
104
- ```
105
-
106
- **Owner signs (CLI or MetaMask):**
107
- ```bash
108
- # Owner runs this with their private key
109
- npx moltspay sign-permit \
110
- --owner 0xOWNER_METAMASK \
111
- --spender 0xAGENT_ADDRESS \
112
- --amount 50 \
113
- --deadline $(date -d '+7 days' +%s) \
114
- --nonce 0 \
115
- --chain base
116
- ```
101
+ **Owner funds the Agent (one-time):**
102
+ - Agent tells Owner its wallet address
103
+ - Owner sends USDC to the agent's address using Coinbase, MetaMask, etc.
104
+ - No complex signatures needed — just a simple transfer
117
105
 
118
- **Agent spends within allowance:**
106
+ **Agent pays for services:**
119
107
  ```bash
120
- npx moltspay spend --to 0xSERVICE_PROVIDER --amount 0.99 --chain base
108
+ npx moltspay transfer --to 0xSERVICE_PROVIDER --amount 0.99 --chain base
121
109
  ```
122
110
 
123
111
  ### Code Example (Auto-Initialize)
@@ -128,19 +116,17 @@ import { AgentWallet } from 'moltspay';
128
116
  // Auto-creates wallet on first use (no gas needed)
129
117
  const wallet = new AgentWallet({ chain: 'base' });
130
118
  console.log('Agent address:', wallet.address);
119
+ // Tell Owner to send USDC to this address
131
120
 
132
- // Generate auth request for Owner
133
- const request = await wallet.generateAuthRequest({
134
- ownerAddress: '0xOWNER...',
135
- amount: 50, // $50 USDC allowance
136
- });
137
- console.log(request.message); // Send to Owner
138
-
139
- // After Owner signs, store permit
140
- wallet.storePermit(ownerPermit);
121
+ // Check balance
122
+ const balance = await wallet.getBalance();
123
+ console.log('USDC balance:', balance.usdc);
141
124
 
142
- // Pay for services (USDC comes from Owner's wallet)
143
- const result = await wallet.spend('0xServiceProvider...', 0.99);
125
+ // Pay for services
126
+ const result = await wallet.transfer({
127
+ to: '0xServiceProvider...',
128
+ amount: 0.99,
129
+ });
144
130
  console.log('Paid:', result.txHash);
145
131
  ```
146
132