@dexterai/x402 3.7.1 → 3.7.2
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 +25 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -214,12 +214,32 @@ const { closed } = await channel.close();
|
|
|
214
214
|
// refunds the rest of your escrow automatically on the normal path.
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
+
Each `openBatchChannel` call opens a **new** channel: a fresh random
|
|
218
|
+
channel-config salt is generated, so a buyer can hold several independent
|
|
219
|
+
channels with the same seller over time. The salt is exposed as
|
|
220
|
+
`channel.salt` — persist it if you will later need to resume that exact
|
|
221
|
+
channel.
|
|
222
|
+
|
|
223
|
+
To resume a channel after a process restart, call `resumeBatchChannel` with
|
|
224
|
+
the wallet, network, and the **salt** of the channel being resumed (the
|
|
225
|
+
`channelId` alone is not enough — it cannot be reversed to a salt):
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { resumeBatchChannel } from '@dexterai/x402/batch-settlement';
|
|
229
|
+
|
|
230
|
+
const channel = await resumeBatchChannel({
|
|
231
|
+
wallet: evmWallet,
|
|
232
|
+
network: 'eip155:8453',
|
|
233
|
+
salt: savedSalt, // channel.salt captured at open time
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
217
237
|
Channel state auto-persists (localStorage in the browser, a file under
|
|
218
|
-
`~/.dexter-x402/channels` in Node)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
`
|
|
238
|
+
`~/.dexter-x402/channels` in Node); the resumed channel's accounting is
|
|
239
|
+
recovered from storage, or from on-chain state if storage was lost. Pass a
|
|
240
|
+
custom `store` (any `ChannelStore`) to persist elsewhere. To deterministically
|
|
241
|
+
reopen a specific channel instead of getting a fresh one, pass an explicit
|
|
242
|
+
`salt` to `openBatchChannel`.
|
|
223
243
|
|
|
224
244
|
#### Escape hatch — `forceWithdraw()` / `finalizeWithdraw()`
|
|
225
245
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexterai/x402",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"description": "Full-stack x402 SDK - add paid API monetization to any endpoint. Express middleware, React hooks, Access Pass, dynamic pricing. Solana, Base, Polygon, Arbitrum, Optimism, Avalanche, SKALE.",
|
|
5
5
|
"author": "Dexter",
|
|
6
6
|
"license": "MIT",
|