@arkade-os/swap 0.1.5 → 0.1.7
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/dist/advanced.cjs +228 -63
- package/dist/advanced.d.cts +6 -6
- package/dist/advanced.d.ts +6 -6
- package/dist/advanced.js +2 -2
- package/dist/{chunk-GJKGPE3S.js → chunk-QFM55KP2.js} +175 -29
- package/dist/{chunk-HDCC3JZR.js → chunk-SDPNWPGY.js} +30 -2
- package/dist/index.cjs +219 -54
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/{lockupContract-CdXh9yIr.d.ts → lockupContract-CKPFpIt9.d.ts} +1 -1
- package/dist/{lockupContract-QfbsjyXG.d.cts → lockupContract-CpJXTjX_.d.cts} +1 -1
- package/dist/{offer-BxzPQ6zh.d.cts → offer-Boxive2u.d.cts} +1 -1
- package/dist/{offer-Q1lVhrVX.d.ts → offer-Drw1k_jt.d.ts} +1 -1
- package/dist/{offerFillPlan-BfcxbVvw.d.cts → offerFillPlan-BxNkWLtw.d.cts} +2 -2
- package/dist/{offerFillPlan-C11P2ek2.d.ts → offerFillPlan-D2N4s7Xe.d.ts} +2 -2
- package/dist/protocol.cjs +83 -33
- package/dist/protocol.d.cts +11 -27
- package/dist/protocol.d.ts +11 -27
- package/dist/protocol.js +1 -1
- package/dist/repositories/realm/index.d.cts +1 -1
- package/dist/repositories/realm/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/{repository-Cut4eEkm.d.cts → repository-DFDNvcZ7.d.cts} +26 -4
- package/dist/{repository-BOQ1qYoj.d.ts → repository-Dn1V17T2.d.ts} +26 -4
- package/dist/{watch-D15U0QpD.d.ts → watch-D-mc_wfD.d.ts} +1 -1
- package/dist/{watch-D4PeBZ3H.d.cts → watch-DFNMY2K-.d.cts} +1 -1
- package/package.json +2 -2
|
@@ -220,9 +220,14 @@ interface LockupSpend {
|
|
|
220
220
|
txid?: string;
|
|
221
221
|
}
|
|
222
222
|
type LockupFate =
|
|
223
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* At least one output at the lockup is still unspent. Not over. `preimage` is `P`,
|
|
225
|
+
* hash-verified, read off a spent output while another is still live: the lockup is partly
|
|
226
|
+
* claimed and `P` is public. Read only for the receiver.
|
|
227
|
+
*/
|
|
224
228
|
{
|
|
225
229
|
fate: "open";
|
|
230
|
+
preimage?: Uint8Array;
|
|
226
231
|
}
|
|
227
232
|
/** Spent by a witness carrying a preimage that HASHES to the quote's `payment_hash`. */
|
|
228
233
|
| {
|
|
@@ -278,7 +283,9 @@ declare function readLockupFate(indexer: LockupSpendIndexer, input: {
|
|
|
278
283
|
/** `sha256(P)`, hex — the quote's `payment_hash`. */
|
|
279
284
|
paymentHash: string;
|
|
280
285
|
/** Read for the lockup's receiver, who holds no leaf that recovers a swept output:
|
|
281
|
-
* once a claim revealed `P`, swept outputs no longer hold the lockup `open`.
|
|
286
|
+
* once a claim revealed `P`, swept outputs no longer hold the lockup `open`. It also
|
|
287
|
+
* enables the partly-claimed read: `open.preimage`, `P` found on a spent output while
|
|
288
|
+
* another is still live. */
|
|
282
289
|
receiver?: boolean;
|
|
283
290
|
}): Promise<LockupFate>;
|
|
284
291
|
/**
|
|
@@ -629,14 +636,27 @@ interface RfqSwapManagerCallbacks {
|
|
|
629
636
|
* any it left behind is never re-claimed.
|
|
630
637
|
*/
|
|
631
638
|
claimLockup: (swap: ReceiveLockupSwap, vtxos: readonly LockupVtxo[], options: {
|
|
632
|
-
/**
|
|
633
|
-
*
|
|
639
|
+
/** `P` is already public on this lockup (a claim of ours, or any spend whose
|
|
640
|
+
* witness hashes to `paymentHash`), so the value gate has nothing left to
|
|
641
|
+
* protect; lets a piecemeal funding still be swept. */
|
|
634
642
|
partiallyClaimed: boolean;
|
|
635
643
|
}) => Promise<{
|
|
636
644
|
txid: string;
|
|
637
645
|
amount: number;
|
|
638
646
|
spent?: readonly LockupVtxo[];
|
|
639
647
|
}>;
|
|
648
|
+
/**
|
|
649
|
+
* The ark txids of the claims of ours the operator accepted but never finalized (see
|
|
650
|
+
* `findPendingClaims`): each has published `P`, yet its sats do not exist until finalized.
|
|
651
|
+
* Needs no keys. Called on every Lightning receive pass; wired with `finalizeClaim`, and
|
|
652
|
+
* without both a revealed `P` settles the swap as before.
|
|
653
|
+
*/
|
|
654
|
+
pendingClaims?: (swap: LightningReceiveSwap) => Promise<readonly string[]>;
|
|
655
|
+
/**
|
|
656
|
+
* Finalize them (see `finalizePendingClaim`). Called only after `pendingClaims` named one; a
|
|
657
|
+
* throw ends the pass and is retried on the next one.
|
|
658
|
+
*/
|
|
659
|
+
finalizeClaim?: (swap: LightningReceiveSwap) => Promise<void>;
|
|
640
660
|
/**
|
|
641
661
|
* Push `refundWithoutReceiver` for every output at the lockup (see
|
|
642
662
|
* `pushRefundWithoutReceiver`); return `null` for an empty lockup. Never called for a
|
|
@@ -1023,6 +1043,8 @@ declare class RfqSwapManager {
|
|
|
1023
1043
|
private arm;
|
|
1024
1044
|
private pollSwap;
|
|
1025
1045
|
private runPass;
|
|
1046
|
+
/** `none` when no claim of ours is pending; `failed` covers a pending read that failed too. */
|
|
1047
|
+
private finalizeOwnClaim;
|
|
1026
1048
|
/**
|
|
1027
1049
|
* The lockup was unilaterally exited: its outputs sit onchain, beyond any offchain
|
|
1028
1050
|
* spend. `needs_counterparty`, not terminal: it can still end either way onchain. Set
|
|
@@ -220,9 +220,14 @@ interface LockupSpend {
|
|
|
220
220
|
txid?: string;
|
|
221
221
|
}
|
|
222
222
|
type LockupFate =
|
|
223
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* At least one output at the lockup is still unspent. Not over. `preimage` is `P`,
|
|
225
|
+
* hash-verified, read off a spent output while another is still live: the lockup is partly
|
|
226
|
+
* claimed and `P` is public. Read only for the receiver.
|
|
227
|
+
*/
|
|
224
228
|
{
|
|
225
229
|
fate: "open";
|
|
230
|
+
preimage?: Uint8Array;
|
|
226
231
|
}
|
|
227
232
|
/** Spent by a witness carrying a preimage that HASHES to the quote's `payment_hash`. */
|
|
228
233
|
| {
|
|
@@ -278,7 +283,9 @@ declare function readLockupFate(indexer: LockupSpendIndexer, input: {
|
|
|
278
283
|
/** `sha256(P)`, hex — the quote's `payment_hash`. */
|
|
279
284
|
paymentHash: string;
|
|
280
285
|
/** Read for the lockup's receiver, who holds no leaf that recovers a swept output:
|
|
281
|
-
* once a claim revealed `P`, swept outputs no longer hold the lockup `open`.
|
|
286
|
+
* once a claim revealed `P`, swept outputs no longer hold the lockup `open`. It also
|
|
287
|
+
* enables the partly-claimed read: `open.preimage`, `P` found on a spent output while
|
|
288
|
+
* another is still live. */
|
|
282
289
|
receiver?: boolean;
|
|
283
290
|
}): Promise<LockupFate>;
|
|
284
291
|
/**
|
|
@@ -629,14 +636,27 @@ interface RfqSwapManagerCallbacks {
|
|
|
629
636
|
* any it left behind is never re-claimed.
|
|
630
637
|
*/
|
|
631
638
|
claimLockup: (swap: ReceiveLockupSwap, vtxos: readonly LockupVtxo[], options: {
|
|
632
|
-
/**
|
|
633
|
-
*
|
|
639
|
+
/** `P` is already public on this lockup (a claim of ours, or any spend whose
|
|
640
|
+
* witness hashes to `paymentHash`), so the value gate has nothing left to
|
|
641
|
+
* protect; lets a piecemeal funding still be swept. */
|
|
634
642
|
partiallyClaimed: boolean;
|
|
635
643
|
}) => Promise<{
|
|
636
644
|
txid: string;
|
|
637
645
|
amount: number;
|
|
638
646
|
spent?: readonly LockupVtxo[];
|
|
639
647
|
}>;
|
|
648
|
+
/**
|
|
649
|
+
* The ark txids of the claims of ours the operator accepted but never finalized (see
|
|
650
|
+
* `findPendingClaims`): each has published `P`, yet its sats do not exist until finalized.
|
|
651
|
+
* Needs no keys. Called on every Lightning receive pass; wired with `finalizeClaim`, and
|
|
652
|
+
* without both a revealed `P` settles the swap as before.
|
|
653
|
+
*/
|
|
654
|
+
pendingClaims?: (swap: LightningReceiveSwap) => Promise<readonly string[]>;
|
|
655
|
+
/**
|
|
656
|
+
* Finalize them (see `finalizePendingClaim`). Called only after `pendingClaims` named one; a
|
|
657
|
+
* throw ends the pass and is retried on the next one.
|
|
658
|
+
*/
|
|
659
|
+
finalizeClaim?: (swap: LightningReceiveSwap) => Promise<void>;
|
|
640
660
|
/**
|
|
641
661
|
* Push `refundWithoutReceiver` for every output at the lockup (see
|
|
642
662
|
* `pushRefundWithoutReceiver`); return `null` for an empty lockup. Never called for a
|
|
@@ -1023,6 +1043,8 @@ declare class RfqSwapManager {
|
|
|
1023
1043
|
private arm;
|
|
1024
1044
|
private pollSwap;
|
|
1025
1045
|
private runPass;
|
|
1046
|
+
/** `none` when no claim of ours is pending; `failed` covers a pending read that failed too. */
|
|
1047
|
+
private finalizeOwnClaim;
|
|
1026
1048
|
/**
|
|
1027
1049
|
* The lockup was unilaterally exited: its outputs sit onchain, beyond any offchain
|
|
1028
1050
|
* spend. `needs_counterparty`, not terminal: it can still end either way onchain. Set
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IWallet } from '@arkade-os/sdk';
|
|
2
|
-
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-
|
|
2
|
+
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-Dn1V17T2.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* What this watcher needs to know about an offer swap, narrower than {@link AssetSwap}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IWallet } from '@arkade-os/sdk';
|
|
2
|
-
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-
|
|
2
|
+
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-DFDNvcZ7.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* What this watcher needs to know about an offer swap, narrower than {@link AssetSwap}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkade-os/swap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Client-side Arkade Intents asset swaps: state a route, get an outcome. Pay a bolt11 invoice, receive over Lightning, exchange assets, or withdraw onchain.",
|
|
6
6
|
"repository": {
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@scure/base": "2.4.0",
|
|
105
105
|
"@scure/btc-signer": "2.4.1",
|
|
106
106
|
"light-bolt11-decoder": "3.2.0",
|
|
107
|
-
"@arkade-os/sdk": "0.5.
|
|
107
|
+
"@arkade-os/sdk": "0.5.7"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
110
|
"nostr-tools": "2.24.1"
|