@arkade-os/swap 0.1.0-rc.17 → 0.1.0-rc.19

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 (33) hide show
  1. package/README.md +7 -21
  2. package/dist/advanced.cjs +301 -212
  3. package/dist/advanced.d.cts +14 -7
  4. package/dist/advanced.d.ts +14 -7
  5. package/dist/advanced.js +5 -3
  6. package/dist/{chunk-BBP25BWH.js → chunk-AYKAMAP5.js} +0 -1
  7. package/dist/{chunk-QJ2MUUDO.js → chunk-USY74IT6.js} +114 -135
  8. package/dist/{chunk-CIIJT5O4.js → chunk-YN464TAH.js} +150 -142
  9. package/dist/{errors-CUKl1fFo.d.ts → errors-C3h8ANmE.d.ts} +2 -2
  10. package/dist/{errors-DQ-J_lgV.d.cts → errors-hm7aqnRM.d.cts} +2 -2
  11. package/dist/index.cjs +327 -347
  12. package/dist/index.d.cts +7 -63
  13. package/dist/index.d.ts +7 -63
  14. package/dist/index.js +3 -7
  15. package/dist/{lockupContract-iI7QGIEr.d.ts → lockupContract-5r5RlgOJ.d.cts} +2 -82
  16. package/dist/{lockupContract-CWR83JvL.d.cts → lockupContract-5r5RlgOJ.d.ts} +2 -82
  17. package/dist/node/index.d.cts +3 -2
  18. package/dist/node/index.d.ts +3 -2
  19. package/dist/nostr.js +1 -1
  20. package/dist/{offer-CJzNPS5H.d.ts → offer-Bd9Yvd8Z.d.ts} +2 -2
  21. package/dist/{offer-DCaE0YNp.d.cts → offer-F88rtL_I.d.cts} +2 -2
  22. package/dist/protocol.d.cts +86 -7
  23. package/dist/protocol.d.ts +86 -7
  24. package/dist/protocol.js +2 -2
  25. package/dist/repositories/realm/index.d.cts +1 -1
  26. package/dist/repositories/realm/index.d.ts +1 -1
  27. package/dist/repositories/sqlite/index.d.cts +1 -1
  28. package/dist/repositories/sqlite/index.d.ts +1 -1
  29. package/dist/{repository-S2OS6Yl-.d.cts → repository-BuYWGAKz.d.cts} +3 -2
  30. package/dist/{repository-V98jQmTD.d.ts → repository-DYnRLPt-.d.ts} +3 -2
  31. package/dist/{watch-3pNJbc4T.d.ts → watch-BTyiBLSd.d.ts} +1 -1
  32. package/dist/{watch-BFMXLQV-.d.cts → watch-M_KY-5ho.d.cts} +1 -1
  33. package/package.json +2 -2
package/README.md CHANGED
@@ -192,32 +192,18 @@ newer.
192
192
 
193
193
  ### Restore an imported wallet
194
194
 
195
- Register swap recovery before calling the core wallet's explicit `restore()`:
195
+ Run the core wallet's `restore()` first (addresses, contracts, history), **then** create the client:
196
196
 
197
197
  ```ts
198
- import { IndexedDbAssetSwapRepository, registerAssetSwapRestore } from "@arkade-os/swap";
199
-
200
- const repository = new IndexedDbAssetSwapRepository();
201
- const unregisterSwapRestore = registerAssetSwapRestore(wallet, {
202
- arkServerUrl,
203
- repository,
204
- onResult: ({ changes, coverageError }) => {
205
- if (coverageError) console.warn("Swap coverage was incomplete", coverageError);
206
- console.info(`Restored or updated ${changes.length} swaps`);
207
- },
208
- });
209
-
210
198
  await wallet.restore();
199
+ const client = createSwapClient({ wallet, repository: new IndexedDbAssetSwapRepository() });
200
+ await client.ready;
211
201
  ```
212
202
 
213
- Core address, contract, history, and balance recovery finishes before the swap scan. Registering
214
- again replaces the prior hook, so setup is idempotent; call `unregisterSwapRestore()` when the
215
- integration no longer owns the wallet. A proxy or custom `IWallet` must also pass `indexer` and
216
- `serverPubkey` when it does not expose them. Keep calling `restoreAssetSwapRepository` directly
217
- during ordinary startup: hooks run only for an explicit `wallet.restore()`.
218
-
219
- The client's own records need none of this: `client.ready` rebuilds a record for every offer
220
- deposit the store has no record for. Such a record carries `market: { kind: "restored" }`.
203
+ `client.ready` rebuilds a record for every offer deposit in that history, with
204
+ `market: { kind: "restored" }`. A client created before `restore()` finishes rebuilds only what
205
+ history held at that moment, until its next construction. Corridor swaps a `0.0.x` client stored
206
+ are adopted the same way, with `backend: "rfq"`.
221
207
 
222
208
  ## Runtime requirements
223
209