@arkade-os/swap 0.1.6 → 0.1.8

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 (41) hide show
  1. package/dist/advanced.cjs +625 -249
  2. package/dist/advanced.d.cts +9 -8
  3. package/dist/advanced.d.ts +9 -8
  4. package/dist/advanced.js +4 -3
  5. package/dist/chunk-5QPJWOCN.js +16 -0
  6. package/dist/{chunk-QFM55KP2.js → chunk-ISWLKKSS.js} +1 -1
  7. package/dist/{chunk-7BBQ74BG.js → chunk-PDNVKH5L.js} +464 -117
  8. package/dist/{chunk-SDPNWPGY.js → chunk-ZBJGLLYV.js} +27 -16
  9. package/dist/index.cjs +641 -265
  10. package/dist/index.d.cts +7 -6
  11. package/dist/index.d.ts +7 -6
  12. package/dist/index.js +4 -3
  13. package/dist/{lockupContract-CKPFpIt9.d.ts → lockupContract-BUOsghl1.d.ts} +1 -1
  14. package/dist/{lockupContract-CpJXTjX_.d.cts → lockupContract-DguuT7NK.d.cts} +1 -1
  15. package/dist/nostr.cjs +290 -17
  16. package/dist/nostr.d.cts +2 -1
  17. package/dist/nostr.d.ts +2 -1
  18. package/dist/nostr.js +2 -1
  19. package/dist/{offer-Drw1k_jt.d.ts → offer-BhonWuKR.d.ts} +22 -17
  20. package/dist/{offer-Boxive2u.d.cts → offer-D_qHpWo2.d.cts} +22 -17
  21. package/dist/{offerFillPlan-BxNkWLtw.d.cts → offerFillPlan-Bp6-z6dS.d.cts} +3 -3
  22. package/dist/{offerFillPlan-D2N4s7Xe.d.ts → offerFillPlan-_AOLo6kh.d.ts} +3 -3
  23. package/dist/protocol.cjs +566 -185
  24. package/dist/protocol.d.cts +9 -8
  25. package/dist/protocol.d.ts +9 -8
  26. package/dist/protocol.js +14 -2
  27. package/dist/repositories/realm/index.d.cts +3 -2
  28. package/dist/repositories/realm/index.d.ts +3 -2
  29. package/dist/repositories/sqlite/index.d.cts +3 -2
  30. package/dist/repositories/sqlite/index.d.ts +3 -2
  31. package/dist/{repository-DFDNvcZ7.d.cts → repository--pfikw2R.d.cts} +1 -1
  32. package/dist/{repository-Dn1V17T2.d.ts → repository-CkKK0dGO.d.ts} +1 -1
  33. package/dist/{rfq-CP-P0PSL.d.ts → rfq-BRpo5uWU.d.cts} +14 -2
  34. package/dist/{rfq-CP-P0PSL.d.cts → rfq-IzhOCG02.d.ts} +14 -2
  35. package/dist/rfq-contract.cjs +45 -0
  36. package/dist/rfq-contract.d.cts +9 -0
  37. package/dist/rfq-contract.d.ts +9 -0
  38. package/dist/rfq-contract.js +16 -0
  39. package/dist/{watch-D-mc_wfD.d.ts → watch-DDNycuUa.d.ts} +1 -1
  40. package/dist/{watch-DFNMY2K-.d.cts → watch-pvTVFp6-.d.cts} +1 -1
  41. package/package.json +13 -3
@@ -1,5 +1,17 @@
1
- import { asset, RelativeTimelock, OperatorInfo, ArkTxInput, Outpoint, IWallet, EmulatorProvider, arkade } from '@arkade-os/sdk';
2
- import { d as AssetSwapRepository } from './repository-DFDNvcZ7.cjs';
1
+ import { arkade, asset, RelativeTimelock, OperatorInfo, ArkTxInput, Outpoint, IWallet, EmulatorProvider } from '@arkade-os/sdk';
2
+ import { ASSET_SWAP_V2, ASSET_SWAP_V3 } from './rfq-contract.cjs';
3
+ import { d as AssetSwapRepository } from './repository--pfikw2R.cjs';
4
+
5
+ /** `asset-swap` and `sats-swap`. Exit is appended later; it is not in either artifact.
6
+ *
7
+ * @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
8
+ */
9
+ declare const swapPrograms: Record<"wantAsset" | "wantBtc", ReturnType<typeof arkade.parseArtifact>>;
10
+ type AssetSwapContractVersion = typeof ASSET_SWAP_V2 | typeof ASSET_SWAP_V3;
11
+ /** The versions every asset RFQ advertises by default, most preferred first. */
12
+ declare const ASSET_SWAP_CONTRACT_VERSIONS: readonly ["asset-swap-v3", "asset-swap-v2"];
13
+ /** Absent means {@link ASSET_SWAP_BASELINE}; an id this build cannot derive throws. */
14
+ declare const assetSwapContractVersion: (id: string | undefined) => AssetSwapContractVersion;
3
15
 
4
16
  /**
5
17
  * Coverage: whether an offer's script is in the wallet's watched set. `createOffer` promotes; the
@@ -15,15 +27,6 @@ interface CoverageRegistrationOptions {
15
27
  readonly scope?: object;
16
28
  }
17
29
 
18
- /**
19
- * The contracts, one per WANT side — pure data, shared verbatim with any other implementation.
20
- *
21
- * An offer carrying an exit delay compiles a third closure that is in neither file (see
22
- * {@link withExitClosure}); the golden in `offer.test.ts` pins the artifact it produces.
23
- *
24
- * @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
25
- */
26
- declare const swapPrograms: Record<"wantAsset" | "wantBtc", ReturnType<typeof arkade.parseArtifact>>;
27
30
  /** A full-fill offer. Exactly one field names an asset: `wantAsset` = the fill must deliver that
28
31
  * asset (the deposit is whatever the funding vtxo holds); `offerAsset` = the user deposits that
29
32
  * asset and wants sats.
@@ -58,7 +61,7 @@ interface Offer {
58
61
  *
59
62
  * @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
60
63
  */
61
- declare function offerContract(offer: Omit<Offer, "swapPkScript">, operatorPubkey: Uint8Array): InstanceType<typeof arkade.ArkadeProgramScript>;
64
+ declare function offerContract(offer: Omit<Offer, "swapPkScript">, operatorPubkey: Uint8Array, contractVersion?: AssetSwapContractVersion): InstanceType<typeof arkade.ArkadeProgramScript>;
62
65
  /** Extension packet type tag for Arkade Intents offers.
63
66
  *
64
67
  * @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
@@ -145,6 +148,8 @@ interface OfferParams {
145
148
  pkScript: Uint8Array;
146
149
  publicKey: Uint8Array;
147
150
  };
151
+ /** Defaults to {@link ASSET_SWAP_BASELINE}. */
152
+ contractVersion?: AssetSwapContractVersion;
148
153
  }
149
154
  /**
150
155
  * Everything an offer commits to, derived and encoded, with nothing written.
@@ -240,10 +245,10 @@ type FillInputOwner = "solver" | "sponsor";
240
245
  * Fill an offer — the TAKER's side, and the counterpart to {@link createOffer}. Composes the
241
246
  * `fulfill` spend; it does not weaken or reinterpret the covenant.
242
247
  *
243
- * For an ASSET want the covenant reads output 0 through `OP_INSPECTOUTASSETLOOKUP` with
244
- * `lookup_index = 0`, so the wanted asset must be the FIRST group in the packet (groups keep insertion
245
- * order) and output 0 carries only a dust carrier ({@link ASSET_CARRIER_SATS}). Every other asset in
246
- * the spend goes to the taker's payout; see {@link FillFunding}.
248
+ * `fulfill` reads the output at the spending input's index. This builder puts the deposit at
249
+ * input 0 and the maker payout at output 0. An ASSET want is the first packet group on that
250
+ * output, which carries only a dust carrier ({@link ASSET_CARRIER_SATS}). Every other asset
251
+ * goes to the taker's payout; see {@link FillFunding}.
247
252
  *
248
253
  * Writes NO local swap record: the maker learns the outcome from the chain (RFQ protocol § 7.2).
249
254
  * `fund` is explicit because only the caller knows which coins are reserved (e.g. a corridor's
@@ -266,4 +271,4 @@ declare function fillOffer(wallet: IWallet, arkServerUrl: string, offerHex: stri
266
271
  /** @deprecated Use `offerContract` from `@arkade-os/swap/protocol`. */
267
272
  declare const offerVtxoScript: typeof offerContract;
268
273
 
269
- export { ASSET_CARRIER_SATS as A, type CoverageRegistrationOptions as C, type DerivedOffer as D, type FillFunding as F, NoSpendableDepositError as N, type Offer as O, type FillOutpoint as a, type FillInputOwner as b, OFFER_PACKET_TYPE as c, OfferCovenantMismatchError as d, cancelOffer as e, createOffer as f, decodeOffer as g, encodeOffer as h, fillOffer as i, offerVtxoScript as j, offerContract as o, swapPrograms as s };
274
+ export { ASSET_CARRIER_SATS as A, type CoverageRegistrationOptions as C, type DerivedOffer as D, type FillFunding as F, NoSpendableDepositError as N, type Offer as O, type FillOutpoint as a, type FillInputOwner as b, ASSET_SWAP_CONTRACT_VERSIONS as c, type AssetSwapContractVersion as d, OFFER_PACKET_TYPE as e, OfferCovenantMismatchError as f, assetSwapContractVersion as g, cancelOffer as h, createOffer as i, decodeOffer as j, encodeOffer as k, fillOffer as l, offerVtxoScript as m, offerContract as o, swapPrograms as s };
@@ -1,8 +1,8 @@
1
1
  import { IWallet, NetworkName, Network, SignerSet, OnchainProvider, OperatorInfo, VHTLC, ProvisionedKey, ProvisionedClaimSecret, Transaction } from '@arkade-os/sdk';
2
- import { bd as SwapOperator, d as AssetSwapRepository, m as Pubkey, bf as RfqSwapManagerCallbacks, C as Corridor, I as Instrument, bg as RfqSwapActionName, N as NetworkRef, A as AssetId, ao as SnapshotRef, a4 as MarketBackend, X as CardMarketRef, a5 as MarketRef, E as AssetRef, r as AmountOn, ap as Swap, Y as CorridorId, _ as DepositArtifact, l as QuoteInput, a9 as Quote, ae as RankedBid, as as SwapUpdate, au as Unsubscribe, S as SwapRecord, Q as QuoteId, a7 as Outcome, L as LockupSpendIndexer, bc as SwapContractRegistry, j as ResolvedEndpoint, P as PinnedAmount, D as AssetPaymentTerms, B as AssetPaymentInput, O as OfferSwapRecord, G as AssetSwapId, aq as SwapFamily, i as RouteResolution } from './repository-DFDNvcZ7.cjs';
3
- import { I as InvoiceFacts, C as ChainSource, R as RfqQuote, e as RfqTransport, L as LightningSendContractParams, f as LightningReceiveContractParams, O as OnchainHtlc, g as OnchainHtlcParams, h as OnchainNetwork, S as SwapRefusal } from './rfq-CP-P0PSL.cjs';
2
+ import { bd as SwapOperator, d as AssetSwapRepository, m as Pubkey, bf as RfqSwapManagerCallbacks, C as Corridor, I as Instrument, bg as RfqSwapActionName, N as NetworkRef, A as AssetId, ao as SnapshotRef, a4 as MarketBackend, X as CardMarketRef, a5 as MarketRef, E as AssetRef, r as AmountOn, ap as Swap, Y as CorridorId, _ as DepositArtifact, l as QuoteInput, a9 as Quote, ae as RankedBid, as as SwapUpdate, au as Unsubscribe, S as SwapRecord, Q as QuoteId, a7 as Outcome, L as LockupSpendIndexer, bc as SwapContractRegistry, j as ResolvedEndpoint, P as PinnedAmount, D as AssetPaymentTerms, B as AssetPaymentInput, O as OfferSwapRecord, G as AssetSwapId, aq as SwapFamily, i as RouteResolution } from './repository--pfikw2R.cjs';
3
+ import { I as InvoiceFacts, C as ChainSource, R as RfqQuote, e as RfqTransport, L as LightningSendContractParams, f as LightningReceiveContractParams, O as OnchainHtlc, g as OnchainHtlcParams, h as OnchainNetwork, S as SwapRefusal } from './rfq-BRpo5uWU.cjs';
4
4
  import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
5
- import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-Boxive2u.cjs';
5
+ import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-D_qHpWo2.cjs';
6
6
  import * as nostr_tools from 'nostr-tools';
7
7
 
8
8
  /**
@@ -1,8 +1,8 @@
1
1
  import { IWallet, NetworkName, Network, SignerSet, OnchainProvider, OperatorInfo, VHTLC, ProvisionedKey, ProvisionedClaimSecret, Transaction } from '@arkade-os/sdk';
2
- import { bd as SwapOperator, d as AssetSwapRepository, m as Pubkey, bf as RfqSwapManagerCallbacks, C as Corridor, I as Instrument, bg as RfqSwapActionName, N as NetworkRef, A as AssetId, ao as SnapshotRef, a4 as MarketBackend, X as CardMarketRef, a5 as MarketRef, E as AssetRef, r as AmountOn, ap as Swap, Y as CorridorId, _ as DepositArtifact, l as QuoteInput, a9 as Quote, ae as RankedBid, as as SwapUpdate, au as Unsubscribe, S as SwapRecord, Q as QuoteId, a7 as Outcome, L as LockupSpendIndexer, bc as SwapContractRegistry, j as ResolvedEndpoint, P as PinnedAmount, D as AssetPaymentTerms, B as AssetPaymentInput, O as OfferSwapRecord, G as AssetSwapId, aq as SwapFamily, i as RouteResolution } from './repository-Dn1V17T2.js';
3
- import { I as InvoiceFacts, C as ChainSource, R as RfqQuote, e as RfqTransport, L as LightningSendContractParams, f as LightningReceiveContractParams, O as OnchainHtlc, g as OnchainHtlcParams, h as OnchainNetwork, S as SwapRefusal } from './rfq-CP-P0PSL.js';
2
+ import { bd as SwapOperator, d as AssetSwapRepository, m as Pubkey, bf as RfqSwapManagerCallbacks, C as Corridor, I as Instrument, bg as RfqSwapActionName, N as NetworkRef, A as AssetId, ao as SnapshotRef, a4 as MarketBackend, X as CardMarketRef, a5 as MarketRef, E as AssetRef, r as AmountOn, ap as Swap, Y as CorridorId, _ as DepositArtifact, l as QuoteInput, a9 as Quote, ae as RankedBid, as as SwapUpdate, au as Unsubscribe, S as SwapRecord, Q as QuoteId, a7 as Outcome, L as LockupSpendIndexer, bc as SwapContractRegistry, j as ResolvedEndpoint, P as PinnedAmount, D as AssetPaymentTerms, B as AssetPaymentInput, O as OfferSwapRecord, G as AssetSwapId, aq as SwapFamily, i as RouteResolution } from './repository-CkKK0dGO.js';
3
+ import { I as InvoiceFacts, C as ChainSource, R as RfqQuote, e as RfqTransport, L as LightningSendContractParams, f as LightningReceiveContractParams, O as OnchainHtlc, g as OnchainHtlcParams, h as OnchainNetwork, S as SwapRefusal } from './rfq-IzhOCG02.js';
4
4
  import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
5
- import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-Drw1k_jt.js';
5
+ import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-BhonWuKR.js';
6
6
  import * as nostr_tools from 'nostr-tools';
7
7
 
8
8
  /**