@arkade-os/swap 0.1.0-rc.2 → 0.1.0-rc.3

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.
Files changed (34) hide show
  1. package/README.md +24 -0
  2. package/dist/advanced.cjs +7486 -0
  3. package/dist/advanced.d.cts +586 -0
  4. package/dist/advanced.d.ts +586 -0
  5. package/dist/advanced.js +304 -0
  6. package/dist/chunk-H5KFNL5O.js +3821 -0
  7. package/dist/{chunk-EOYGUCDM.js → chunk-OROIHWXD.js} +9 -2
  8. package/dist/errors-CcvUMXEF.d.cts +2197 -0
  9. package/dist/errors-Cwz3Xh72.d.ts +2197 -0
  10. package/dist/index.cjs +2801 -2826
  11. package/dist/index.d.cts +8 -2636
  12. package/dist/index.d.ts +8 -2636
  13. package/dist/index.js +66 -3687
  14. package/dist/lockupContract-BvfhGH62.d.cts +108 -0
  15. package/dist/lockupContract-BvfhGH62.d.ts +108 -0
  16. package/dist/node/index.d.cts +8 -2
  17. package/dist/node/index.d.ts +8 -2
  18. package/dist/nostr.d.cts +1 -1
  19. package/dist/nostr.d.ts +1 -1
  20. package/dist/protocol.cjs +8 -5
  21. package/dist/protocol.d.cts +8 -111
  22. package/dist/protocol.d.ts +8 -111
  23. package/dist/protocol.js +1 -4
  24. package/dist/repositories/realm/index.d.cts +2 -2
  25. package/dist/repositories/realm/index.d.ts +2 -2
  26. package/dist/repositories/sqlite/index.d.cts +2 -2
  27. package/dist/repositories/sqlite/index.d.ts +2 -2
  28. package/dist/{repository-_zU9_pM3.d.cts → repository-B8MJY64N.d.cts} +36 -10
  29. package/dist/{repository-kO95noyv.d.ts → repository-BGlWfv3c.d.ts} +36 -10
  30. package/dist/{rfq-DdBV4JO5.d.ts → rfq-CSgBQkjl.d.cts} +4 -2
  31. package/dist/{rfq-DdBV4JO5.d.cts → rfq-CSgBQkjl.d.ts} +4 -2
  32. package/dist/{watch-wMbmfN4p.d.ts → watch-BjMc3SFo.d.cts} +1 -1
  33. package/dist/{watch-CQqvwgwY.d.cts → watch-DkbPNiqf.d.ts} +1 -1
  34. package/package.json +13 -3
package/README.md CHANGED
@@ -15,6 +15,12 @@ const client = createSwapClient({ wallet, repository: new IndexedDbAssetSwapRepo
15
15
  Construction is synchronous and inert: no network, no wallet read, no repository open. The first
16
16
  call that needs one does it.
17
17
 
18
+ Market discovery needs no configuration either: the client defaults to the reference solver
19
+ registry's index for the wallet's network (`REGISTRY_URL[network]`, exported). Follow your own
20
+ registry instead with `discovery: { registryUrl }`, or opt out of registries entirely with
21
+ `discovery: { registryUrl: null }` — `discovery: { snapshot }` resolves against a fixed market
22
+ list without touching the network.
23
+
18
24
  ## The four routes
19
25
 
20
26
  Each is one `quote` → `accept` chain. `quote` returns binding, verified terms and touches nothing
@@ -51,6 +57,17 @@ ordering from the caller.
51
57
  `onchain -> arkade` is not in the union. It resolves and quotes to `UnsupportedRoute` until the
52
58
  client owns the trader's L1 refund path end to end.
53
59
 
60
+ An `arkade -> onchain` withdrawal claims the solver's L1 HTLC itself, and that claim's miner fee
61
+ comes out of the HTLC output — so the client grosses the take leg up by the claim's cost and the
62
+ recipient nets exactly the `amount` written, with the estimate folded into the reported `fee`. The
63
+ claim is built and broadcast by the client itself once the fill is claimable, signed by the
64
+ wallet's payout key and priced off a per-network fee-rate floor
65
+ (`discovery`/corridor overrides aside, that floor is the only environment-specific input). A
66
+ routing UI should raise it in congestion — the claim has a consensus deadline — via
67
+ `corridors: { onchain: { claimFeeRateSatVb } }`; set it to `null` to take the claim over manually
68
+ (the drive then reports the L1 half as your job rather than blocking it). Wire your own builder
69
+ with `corridors: { onchain: { claim } }` and it wins over the default.
70
+
54
71
  ### One call instead of two
55
72
 
56
73
  `pay`, `receive` and `exchange` are `quote` → fee ceiling → `accept`, and add no capability the
@@ -177,11 +194,18 @@ from the wallet, which is the single place that knows which operator it speaks t
177
194
  | Subpath | What it is |
178
195
  | ---------------------------------- | ----------------------------------------------------------------- |
179
196
  | `@arkade-os/swap` | the client, the verbs, the vocabulary, the error taxonomy |
197
+ | `@arkade-os/swap/advanced` | the orchestration below the verbs: the drive, corridors, RFQ wire |
180
198
  | `@arkade-os/swap/node` | the Node storage default |
181
199
  | `@arkade-os/swap/repositories/*` | the React Native backends |
182
200
  | `@arkade-os/swap/nostr` | the Nostr RFQ transport, for hand-building one |
183
201
  | `@arkade-os/swap/protocol` | the v1 building blocks, deprecated |
184
202
 
203
+ The root is a curated surface — if a name the client's modules define is not on it, it is on
204
+ `./advanced` (manual driving with `createSwapDrive`, destination claiming with `corridorSet`,
205
+ custom quote flows with `acceptQuote`/`quoteViaRfq`, record reading with `recordLeg`/`swapOf`).
206
+ "Advanced" is a deliberate deep subpath, not a second compatibility promise: those names move
207
+ with the client's internals across minor versions; the root is what stays put.
208
+
185
209
  `./nostr` is a floor and not a deprecation: the client opens the card's rendezvous itself, and the
186
210
  subpath is what keeps that an escape hatch rather than a wall. It is a separate entry point
187
211
  because `nostr-tools` is an optional peer dependency, so a consumer who never hand-builds a