@recoilpay/intent-react 0.1.0 → 0.3.0

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
@@ -50,6 +50,16 @@ import { RecoilIntent, viemWallet } from '@recoilpay/intent-react';
50
50
  | `apiUrl` | `string` | Defaults to production (`https://api.recoilpay.com`). |
51
51
  | `session` | `IntentSession` | Share one flow between components, or inject one in tests. |
52
52
  | `className` | `string` | Added to the root element. |
53
+ | `onCashOutStarted` | `(tradeId) => void` | A cash-out opened. Store the id to bring the user back to it. |
54
+ | `onCashOutEnded` | `(trade) => void` | A cash-out settled, was refunded or failed. |
55
+ | `resumeCashOut` | `string \| null` | Show this cash-out on mount (an id from `onCashOutStarted`). |
56
+ | `offrampSession` | `OfframpSession` | Share or inject the cash-out flow. |
57
+
58
+ ## Cash out (testnet)
59
+
60
+ "cash out 50 USDC on Base Sepolia to NGN" shows the best offer and a form for the bank details. They are encrypted on the device for the solver who pays out, so neither RecoilPay nor your page's backend sees them. After the user signs, the component follows the payout and asks the user to confirm the money arrived, or to open a dispute. The USDC stays locked until they answer, so let users come back to it: save the id from `onCashOutStarted` and pass it as `resumeCashOut`. While a cash-out needs the user, the text field is disabled so a new sentence can't hide it.
61
+
62
+ Confirming and disputing are signed messages, so the wallet must support `signMessage` (`viemWallet` and `useWagmiIntentWallet` do). `useOfframp()` gives you the same flow as state for your own UI.
53
63
 
54
64
  ## Styling
55
65
 
@@ -68,7 +78,7 @@ Variables: `--rp-surface`, `--rp-raised`, `--rp-sunken`, `--rp-ink`, `--rp-ink-2
68
78
 
69
79
  ## Your own UI
70
80
 
71
- `useRecoilIntent()` gives you the same flow as React state with no markup: `phase`, `preview`, `issues`, `status`, `explorerUrl` and so on, plus `run`, `confirm` and `reset`. See `@recoilpay/intent-core` for what each field means.
81
+ `useRecoilIntent()` (and `useOfframp()` for cash-outs) gives you the same flow as React state with no markup: `phase`, `preview`, `issues`, `status`, `explorerUrl` and so on, plus `run`, `confirm` and `reset`. See `@recoilpay/intent-core` for what each field means.
72
82
 
73
83
  ```tsx
74
84
  const intent = useRecoilIntent({ wallet });