@arkade-os/swap 0.1.0-rc.3 → 0.1.0-rc.31
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 +35 -4
- package/dist/advanced.cjs +6397 -3002
- package/dist/advanced.d.cts +391 -281
- package/dist/advanced.d.ts +391 -281
- package/dist/advanced.js +444 -26
- package/dist/chunk-2CAOQFSK.js +3384 -0
- package/dist/chunk-75YNMBFR.js +3028 -0
- package/dist/chunk-A3SHHRX4.js +104 -0
- package/dist/{chunk-H5KFNL5O.js → chunk-JKTIGGFR.js} +1596 -609
- package/dist/index.cjs +6804 -3666
- package/dist/index.d.cts +71 -185
- package/dist/index.d.ts +71 -185
- package/dist/index.js +146 -47
- package/dist/lockupContract-CSIUio9d.d.cts +144 -0
- package/dist/lockupContract-uj-o9rLJ.d.ts +144 -0
- package/dist/node/index.cjs +61 -10
- package/dist/node/index.d.cts +316 -615
- package/dist/node/index.d.ts +316 -615
- package/dist/node/index.js +65 -10
- package/dist/nostr.cjs +504 -52
- package/dist/nostr.d.cts +59 -70
- package/dist/nostr.d.ts +59 -70
- package/dist/nostr.js +268 -36
- package/dist/offer-C3nyUS9S.d.ts +269 -0
- package/dist/offer-DmfRrycC.d.cts +269 -0
- package/dist/offerFillPlan-BGO7-K8C.d.cts +1641 -0
- package/dist/offerFillPlan-Y1M-7i7T.d.ts +1641 -0
- package/dist/protocol.cjs +5350 -3699
- package/dist/protocol.d.cts +211 -679
- package/dist/protocol.d.ts +211 -679
- package/dist/protocol.js +212 -226
- package/dist/repositories/realm/index.cjs +55 -11
- package/dist/repositories/realm/index.d.cts +18 -30
- package/dist/repositories/realm/index.d.ts +18 -30
- package/dist/repositories/realm/index.js +49 -12
- package/dist/repositories/sqlite/index.cjs +61 -10
- package/dist/repositories/sqlite/index.d.cts +7 -6
- package/dist/repositories/sqlite/index.d.ts +7 -6
- package/dist/repositories/sqlite/index.js +57 -11
- package/dist/repository-CJx_AEvo.d.cts +2342 -0
- package/dist/repository-DgwOJVx0.d.ts +2342 -0
- package/dist/rfq-BJ8SC_Gp.d.cts +978 -0
- package/dist/rfq-BJ8SC_Gp.d.ts +978 -0
- package/dist/watch-BAyo3_bk.d.cts +74 -0
- package/dist/watch-DlkKUJou.d.ts +74 -0
- package/package.json +12 -12
- package/dist/chunk-LYCMM3VB.js +0 -1357
- package/dist/chunk-OROIHWXD.js +0 -3162
- package/dist/chunk-U7VWWTL6.js +0 -66
- package/dist/errors-CcvUMXEF.d.cts +0 -2197
- package/dist/errors-Cwz3Xh72.d.ts +0 -2197
- package/dist/lockupContract-BvfhGH62.d.cts +0 -108
- package/dist/lockupContract-BvfhGH62.d.ts +0 -108
- package/dist/repository-B8MJY64N.d.cts +0 -3452
- package/dist/repository-BGlWfv3c.d.ts +0 -3452
- package/dist/rfq-CSgBQkjl.d.cts +0 -1099
- package/dist/rfq-CSgBQkjl.d.ts +0 -1099
- package/dist/watch-BjMc3SFo.d.cts +0 -96
- package/dist/watch-DkbPNiqf.d.ts +0 -96
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Each is one `quote` → `accept` chain. `quote` returns binding, verified terms
|
|
|
27
27
|
durable; `accept` writes the record, then funds.
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
const BTC = btcOn("arkade", "bitcoin"); // arkade:bitcoin/slip44:0
|
|
30
|
+
const BTC = btcOn("arkade", "bitcoin"); // arkade:bitcoin/slip44:0 (slip44:1 on test networks)
|
|
31
31
|
const USDT = "arkade:bitcoin/asset:…";
|
|
32
32
|
|
|
33
33
|
// arkade -> lightning: pay an invoice. The amount is the invoice's.
|
|
@@ -54,8 +54,13 @@ artifact is an invoice whose claim secret has to be durable before a payer can a
|
|
|
54
54
|
off it would show a payer an invoice this client could not yet claim; the verb removes the
|
|
55
55
|
ordering from the caller.
|
|
56
56
|
|
|
57
|
-
`onchain -> arkade` is
|
|
58
|
-
|
|
57
|
+
`onchain -> arkade` is a receive too: `client.receive({ via: "onchain", amount })` returns a
|
|
58
|
+
`deposit` artifact naming the L1 HTLC to fund, for exactly its `amount`, from any bitcoin wallet.
|
|
59
|
+
The client claims the solver's Arkade lockup once it is funded. If the solver never funds it, the
|
|
60
|
+
client takes the L1 funding back itself once the HTLC's refund leaf matures, paying a boarding
|
|
61
|
+
address of this wallet fixed at quote time and signing with the wallet key the HTLC was derived
|
|
62
|
+
with. The refund is built at the same `claimFeeRateSatVb` as the `arkade -> onchain` claim; wire
|
|
63
|
+
your own with `corridors: { onchain: { refund } }`.
|
|
59
64
|
|
|
60
65
|
An `arkade -> onchain` withdrawal claims the solver's L1 HTLC itself, and that claim's miner fee
|
|
61
66
|
comes out of the HTLC output — so the client grosses the take leg up by the claim's cost and the
|
|
@@ -98,7 +103,7 @@ Asset ids are CAIP-19 with the rail as the CAIP-2 namespace, `<rail>:<network>/<
|
|
|
98
103
|
```ts
|
|
99
104
|
const asset = canonicalAssetId("BTC", {
|
|
100
105
|
network: "regtest",
|
|
101
|
-
assets: [{ ticker: "BTC", id: "arkade:regtest/slip44:
|
|
106
|
+
assets: [{ ticker: "BTC", id: "arkade:regtest/slip44:1" }],
|
|
102
107
|
});
|
|
103
108
|
```
|
|
104
109
|
|
|
@@ -179,6 +184,32 @@ though: a `Date` in a field you added comes back an ISO string, a `Set` or `Map`
|
|
|
179
184
|
and a `bigint` throws on save. The package's own records are JSON-safe by design; keep yours that
|
|
180
185
|
way too.
|
|
181
186
|
|
|
187
|
+
For bounded reads, all four backends provide `getAssetSwapsPage`,
|
|
188
|
+
`getRfqSwapsPage`, and `getSwapRecordsPage`. Pass `{ limit, after? }` with a
|
|
189
|
+
limit of 1–500, then use each result's `nextCursor` for the following page.
|
|
190
|
+
Asset swaps and swap records sort by ID. RFQ swaps sort by `(updatedAt, rfqId)`
|
|
191
|
+
and accept `{ state?, since? }`; `since` is inclusive Unix seconds. Keep the
|
|
192
|
+
filter fixed while paging. Repository collection reads use pages directly;
|
|
193
|
+
internal recovery and lifecycle paths consume every page before acting.
|
|
194
|
+
SDK transaction-history page `since` values use Unix milliseconds instead.
|
|
195
|
+
SQLite RFQ pages use a row-value comparison, so they need SQLite 3.15.0 or
|
|
196
|
+
newer.
|
|
197
|
+
|
|
198
|
+
### Restore an imported wallet
|
|
199
|
+
|
|
200
|
+
Run the core wallet's `restore()` first (addresses, contracts, history), **then** create the client:
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
await wallet.restore();
|
|
204
|
+
const client = createSwapClient({ wallet, repository: new IndexedDbAssetSwapRepository() });
|
|
205
|
+
await client.ready;
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`client.ready` rebuilds a record for every offer deposit in that history, with
|
|
209
|
+
`market: { kind: "restored" }`. A client created before `restore()` finishes rebuilds only what
|
|
210
|
+
history held at that moment, until its next construction. Corridor swaps a `0.0.x` client stored
|
|
211
|
+
are adopted the same way, with `backend: "rfq"`.
|
|
212
|
+
|
|
182
213
|
## Runtime requirements
|
|
183
214
|
|
|
184
215
|
The one global the core requires is `crypto.getRandomValues`. Node and browsers have it; React
|