@naculus/connect-appkit-react 0.8.1 → 0.10.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 +21 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -88,6 +88,27 @@ authorizations and refreshes after `revoke(entry)`. Inspect the returned
|
|
|
88
88
|
verifies its settlement in the background. Pending verification retries five
|
|
89
89
|
times at four-second intervals by default; pass `verifyRetry` to change that.
|
|
90
90
|
|
|
91
|
+
For x402 with the connected browser wallet, build the paying fetch from the
|
|
92
|
+
hook's signer. Render the component that calls `usePaymentFetch` only after
|
|
93
|
+
`pay` is available, because `usePaymentFetch` accepts a paying fetch rather
|
|
94
|
+
than `null`:
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
const { signer } = useX402Signer();
|
|
98
|
+
const pay = useMemo(
|
|
99
|
+
() => signer && createX402Fetch({ signer }),
|
|
100
|
+
[signer],
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (!pay) return null;
|
|
104
|
+
return <PaidResource pay={pay} />;
|
|
105
|
+
|
|
106
|
+
function PaidResource({ pay }: { pay: PaymentFetch }) {
|
|
107
|
+
const { payFetch } = usePaymentFetch(pay);
|
|
108
|
+
// Call payFetch(url) from an event or effect.
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
91
112
|
### Ask before executing
|
|
92
113
|
|
|
93
114
|
```tsx
|