@arkade-os/swap 0.1.0-rc.16 → 0.1.0-rc.18
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 +6 -21
- package/dist/advanced.cjs +179 -95
- package/dist/advanced.d.cts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +3 -3
- package/dist/{chunk-RX3WPV5D.js → chunk-7FCXWHBU.js} +26 -4
- package/dist/{chunk-BBP25BWH.js → chunk-AYKAMAP5.js} +0 -1
- package/dist/{chunk-3RSH73P4.js → chunk-RVRXQU2E.js} +76 -157
- package/dist/{errors-O-27mWDX.d.cts → errors-B7boQfoR.d.cts} +3 -2
- package/dist/{errors-DYGuDb4G.d.ts → errors-DtvJU2MN.d.ts} +3 -2
- package/dist/index.cjs +162 -225
- package/dist/index.d.cts +5 -61
- package/dist/index.d.ts +5 -61
- package/dist/index.js +3 -7
- package/dist/{lockupContract-Bz8T0pYL.d.ts → lockupContract-5r5RlgOJ.d.cts} +2 -80
- package/dist/{lockupContract-C-4zimb4.d.cts → lockupContract-5r5RlgOJ.d.ts} +2 -80
- package/dist/nostr.js +1 -1
- package/dist/{offer-CJzNPS5H.d.ts → offer-Byp0FNO6.d.ts} +1 -1
- package/dist/{offer-DCaE0YNp.d.cts → offer-D9xdNCZS.d.cts} +1 -1
- package/dist/protocol.cjs +17 -3
- package/dist/protocol.d.cts +84 -5
- package/dist/protocol.d.ts +84 -5
- package/dist/protocol.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -192,32 +192,17 @@ newer.
|
|
|
192
192
|
|
|
193
193
|
### Restore an imported wallet
|
|
194
194
|
|
|
195
|
-
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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.
|
|
221
206
|
|
|
222
207
|
## Runtime requirements
|
|
223
208
|
|