@arkade-os/swap 0.1.0-rc.32 → 0.1.0-rc.34
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 +265 -74
- package/dist/advanced.d.cts +13 -9
- package/dist/advanced.d.ts +13 -9
- package/dist/advanced.js +24 -6
- package/dist/{chunk-75YNMBFR.js → chunk-GBQX3FJV.js} +29 -8
- package/dist/{chunk-JKTIGGFR.js → chunk-JJINMVWB.js} +166 -11
- package/dist/{chunk-2CAOQFSK.js → chunk-RDAQR6LV.js} +3 -5
- package/dist/index.cjs +271 -98
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -3
- package/dist/{lockupContract-uj-o9rLJ.d.ts → lockupContract-BlUEw4Ry.d.ts} +6 -2
- package/dist/{lockupContract-CSIUio9d.d.cts → lockupContract-DGQkMEl3.d.cts} +6 -2
- package/dist/nostr.d.cts +1 -1
- package/dist/nostr.d.ts +1 -1
- package/dist/nostr.js +1 -1
- package/dist/{offer-DmfRrycC.d.cts → offer-DLruA4Bf.d.cts} +1 -1
- package/dist/{offer-C3nyUS9S.d.ts → offer-gSQxAA2I.d.ts} +1 -1
- package/dist/{offerFillPlan-BGO7-K8C.d.cts → offerFillPlan-BLBaR8B9.d.cts} +5 -4
- package/dist/{offerFillPlan-Y1M-7i7T.d.ts → offerFillPlan-CA9dMjDg.d.ts} +5 -4
- package/dist/protocol.cjs +35 -12
- package/dist/protocol.d.cts +8 -8
- package/dist/protocol.d.ts +8 -8
- package/dist/protocol.js +2 -2
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/{repository-CJx_AEvo.d.cts → repository-KjoxTB5l.d.ts} +1 -1
- package/dist/{repository-DgwOJVx0.d.ts → repository-UCY_eoQx.d.cts} +1 -1
- package/dist/{rfq-BJ8SC_Gp.d.cts → rfq-DS8_IMU9.d.cts} +8 -5
- package/dist/{rfq-BJ8SC_Gp.d.ts → rfq-DS8_IMU9.d.ts} +8 -5
- package/dist/{watch-DlkKUJou.d.ts → watch-fL2WVy3J.d.ts} +1 -1
- package/dist/{watch-BAyo3_bk.d.cts → watch-lFnfGaqA.d.cts} +1 -1
- package/package.json +2 -2
package/dist/advanced.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-
|
|
1
|
+
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-BLBaR8B9.cjs';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-BLBaR8B9.cjs';
|
|
3
3
|
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
4
|
-
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-
|
|
5
|
-
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-
|
|
6
|
-
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-
|
|
7
|
-
export { S as SwapRefusal } from './rfq-
|
|
4
|
+
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-UCY_eoQx.cjs';
|
|
5
|
+
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-UCY_eoQx.cjs';
|
|
6
|
+
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-DS8_IMU9.cjs';
|
|
7
|
+
export { S as SwapRefusal } from './rfq-DS8_IMU9.cjs';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
9
|
import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer-
|
|
10
|
+
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-lFnfGaqA.cjs';
|
|
11
|
+
import './offer-DLruA4Bf.cjs';
|
|
12
12
|
import 'nostr-tools';
|
|
13
13
|
|
|
14
14
|
/** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
|
|
@@ -641,7 +641,7 @@ interface CovclaimdInfo {
|
|
|
641
641
|
/** Compressed hex — feeds `requestLightningReceive`'s `emulatorPubkey`. */
|
|
642
642
|
emulatorPubkey: string;
|
|
643
643
|
}
|
|
644
|
-
/** The
|
|
644
|
+
/** The fields `POST /v1/reveal` takes. */
|
|
645
645
|
interface RevealParams {
|
|
646
646
|
/** The funded lockup's Arkade address, bech32m. */
|
|
647
647
|
swapAddress: string;
|
|
@@ -649,6 +649,8 @@ interface RevealParams {
|
|
|
649
649
|
ciphertext: string;
|
|
650
650
|
/** The covenant's `enforcePayTo` ArkadeScript, base64. */
|
|
651
651
|
arkadeScript: string;
|
|
652
|
+
/** The `minAmount` {@link ciphertext} was sealed with, in sats; omit for an unbound one. */
|
|
653
|
+
minAmount?: bigint;
|
|
652
654
|
/** The lockup's serialized taptree, hex. */
|
|
653
655
|
taptree: string;
|
|
654
656
|
}
|
|
@@ -689,6 +691,8 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
|
|
|
689
691
|
address: string;
|
|
690
692
|
/** `P`, 32 bytes, from the swap's `secrets`. */
|
|
691
693
|
preimage: Uint8Array;
|
|
694
|
+
/** Sats the lockup must carry, e.g. the record's `expectedAmount`. */
|
|
695
|
+
minAmount: bigint;
|
|
692
696
|
}): Promise<{
|
|
693
697
|
ciphertext: string;
|
|
694
698
|
}>;
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-
|
|
1
|
+
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-CA9dMjDg.js';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-CA9dMjDg.js';
|
|
3
3
|
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
4
|
-
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-
|
|
5
|
-
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-
|
|
6
|
-
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-
|
|
7
|
-
export { S as SwapRefusal } from './rfq-
|
|
4
|
+
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-KjoxTB5l.js';
|
|
5
|
+
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-KjoxTB5l.js';
|
|
6
|
+
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-DS8_IMU9.js';
|
|
7
|
+
export { S as SwapRefusal } from './rfq-DS8_IMU9.js';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
9
|
import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer-
|
|
10
|
+
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-fL2WVy3J.js';
|
|
11
|
+
import './offer-gSQxAA2I.js';
|
|
12
12
|
import 'nostr-tools';
|
|
13
13
|
|
|
14
14
|
/** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
|
|
@@ -641,7 +641,7 @@ interface CovclaimdInfo {
|
|
|
641
641
|
/** Compressed hex — feeds `requestLightningReceive`'s `emulatorPubkey`. */
|
|
642
642
|
emulatorPubkey: string;
|
|
643
643
|
}
|
|
644
|
-
/** The
|
|
644
|
+
/** The fields `POST /v1/reveal` takes. */
|
|
645
645
|
interface RevealParams {
|
|
646
646
|
/** The funded lockup's Arkade address, bech32m. */
|
|
647
647
|
swapAddress: string;
|
|
@@ -649,6 +649,8 @@ interface RevealParams {
|
|
|
649
649
|
ciphertext: string;
|
|
650
650
|
/** The covenant's `enforcePayTo` ArkadeScript, base64. */
|
|
651
651
|
arkadeScript: string;
|
|
652
|
+
/** The `minAmount` {@link ciphertext} was sealed with, in sats; omit for an unbound one. */
|
|
653
|
+
minAmount?: bigint;
|
|
652
654
|
/** The lockup's serialized taptree, hex. */
|
|
653
655
|
taptree: string;
|
|
654
656
|
}
|
|
@@ -689,6 +691,8 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
|
|
|
689
691
|
address: string;
|
|
690
692
|
/** `P`, 32 bytes, from the swap's `secrets`. */
|
|
691
693
|
preimage: Uint8Array;
|
|
694
|
+
/** Sats the lockup must carry, e.g. the record's `expectedAmount`. */
|
|
695
|
+
minAmount: bigint;
|
|
692
696
|
}): Promise<{
|
|
693
697
|
ciphertext: string;
|
|
694
698
|
}>;
|
package/dist/advanced.js
CHANGED
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
withCanonicalAmount,
|
|
137
137
|
withDepositFate,
|
|
138
138
|
withRfqState
|
|
139
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-JJINMVWB.js";
|
|
140
140
|
import {
|
|
141
141
|
ACTIVITY_TOKEN,
|
|
142
142
|
Amount,
|
|
@@ -171,15 +171,16 @@ import {
|
|
|
171
171
|
recordOutcome,
|
|
172
172
|
swapOf,
|
|
173
173
|
toAtomicDecimal
|
|
174
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-RDAQR6LV.js";
|
|
175
175
|
import {
|
|
176
176
|
ARKADE_BTC,
|
|
177
177
|
SwapRefusal,
|
|
178
178
|
assertPairLength,
|
|
179
179
|
assertPreimageMatches,
|
|
180
|
+
bindsClaimAmount,
|
|
180
181
|
rfqPair,
|
|
181
182
|
sealClaimPacket
|
|
182
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-GBQX3FJV.js";
|
|
183
184
|
import "./chunk-A3SHHRX4.js";
|
|
184
185
|
|
|
185
186
|
// src/reveal.ts
|
|
@@ -197,6 +198,13 @@ var CovclaimdRevealError = class extends Error {
|
|
|
197
198
|
this.retryable = status === 0 || status === 429 || status >= 500;
|
|
198
199
|
}
|
|
199
200
|
};
|
|
201
|
+
var assertRevealAmount = (minAmount) => {
|
|
202
|
+
if (typeof minAmount !== "bigint" || minAmount < 1n || minAmount > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
203
|
+
throw new Error(
|
|
204
|
+
`min_amount ${minAmount} is missing, not positive, or past what a JSON number carries`
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
200
208
|
var decodeKey = (value, field) => {
|
|
201
209
|
if (typeof value !== "string") throw new Error(`covclaimd info: ${field} is not a string`);
|
|
202
210
|
let bytes;
|
|
@@ -266,12 +274,19 @@ var covclaimdClient = (baseUrl, options = {}) => {
|
|
|
266
274
|
};
|
|
267
275
|
},
|
|
268
276
|
async reveal(params) {
|
|
277
|
+
const { minAmount } = params;
|
|
278
|
+
if (minAmount !== void 0) assertRevealAmount(minAmount);
|
|
269
279
|
await send("reveal", "/v1/reveal", {
|
|
270
280
|
method: "POST",
|
|
271
281
|
headers: { "content-type": "application/json" },
|
|
272
282
|
body: JSON.stringify({
|
|
273
283
|
swap_address: params.swapAddress,
|
|
274
|
-
packet: {
|
|
284
|
+
packet: {
|
|
285
|
+
ciphertext: params.ciphertext,
|
|
286
|
+
arkade_script: params.arkadeScript,
|
|
287
|
+
// covclaimd reads an absent field as unbound
|
|
288
|
+
min_amount: minAmount === void 0 ? void 0 : Number(minAmount)
|
|
289
|
+
},
|
|
275
290
|
taptree: params.taptree
|
|
276
291
|
})
|
|
277
292
|
});
|
|
@@ -293,11 +308,14 @@ async function revealClaimPacket(client, input) {
|
|
|
293
308
|
throw new Error("address does not belong to this covenant");
|
|
294
309
|
}
|
|
295
310
|
assertPreimageMatches(input.preimage, input.script.options.preimageHash);
|
|
311
|
+
assertRevealAmount(input.minAmount);
|
|
312
|
+
const minAmount = bindsClaimAmount() ? input.minAmount : void 0;
|
|
296
313
|
const { ciphertext } = await sealClaimPacket({
|
|
297
314
|
preimage: input.preimage,
|
|
298
|
-
covclaimdPubkey: (await client.info()).covclaimdPubkey
|
|
315
|
+
covclaimdPubkey: (await client.info()).covclaimdPubkey,
|
|
316
|
+
minAmount
|
|
299
317
|
});
|
|
300
|
-
await client.reveal({ swapAddress: input.address, ciphertext, ...fields });
|
|
318
|
+
await client.reveal({ swapAddress: input.address, ciphertext, minAmount, ...fields });
|
|
301
319
|
return { ciphertext };
|
|
302
320
|
}
|
|
303
321
|
|
|
@@ -1592,18 +1592,26 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
|
|
|
1592
1592
|
if (input.covclaimdPubkey.length !== 33) {
|
|
1593
1593
|
throw new Error("covclaimd pubkey must be 33-byte compressed");
|
|
1594
1594
|
}
|
|
1595
|
+
const { minAmount } = input;
|
|
1596
|
+
if (minAmount !== void 0 && (typeof minAmount !== "bigint" || minAmount < 1n || minAmount >= 1n << 64n)) {
|
|
1597
|
+
throw new Error("minAmount must be a bigint in [1, 2^64-1]");
|
|
1598
|
+
}
|
|
1595
1599
|
const ephemeralPub = secp256k1.getPublicKey(ephemeralKey, true);
|
|
1596
1600
|
const sharedX = secp256k1.getSharedSecret(ephemeralKey, input.covclaimdPubkey, true).subarray(1);
|
|
1597
1601
|
const key = hkdf(sha2563, sharedX, ephemeralPub, HKDF_INFO, 32);
|
|
1598
1602
|
if (nonce.length !== 12) throw new Error("nonce must be 12 bytes");
|
|
1599
|
-
const
|
|
1603
|
+
const amount = new Uint8Array(8);
|
|
1604
|
+
if (minAmount !== void 0) new DataView(amount.buffer).setBigUint64(0, minAmount, false);
|
|
1605
|
+
const additionalData = minAmount === void 0 ? ephemeralPub : concatBytes2(ephemeralPub, amount);
|
|
1606
|
+
const sealed = gcm(key, nonce, additionalData).encrypt(input.preimage);
|
|
1600
1607
|
const ciphertext = concatBytes2(ephemeralPub, nonce, sealed);
|
|
1601
1608
|
return {
|
|
1602
1609
|
ciphertext: base64.encode(ciphertext),
|
|
1603
1610
|
packet: base64.encode(
|
|
1604
1611
|
concatBytes2(
|
|
1605
1612
|
tlv2(TLV_CIPHERTEXT, ciphertext),
|
|
1606
|
-
tlv2(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey)
|
|
1613
|
+
tlv2(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey),
|
|
1614
|
+
minAmount === void 0 ? new Uint8Array() : tlv2(TLV_MIN_AMOUNT, amount)
|
|
1607
1615
|
)
|
|
1608
1616
|
)
|
|
1609
1617
|
};
|
|
@@ -1611,6 +1619,7 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
|
|
|
1611
1619
|
var TLV_CIPHERTEXT = 1;
|
|
1612
1620
|
var TLV_ARKADE_SCRIPT = 2;
|
|
1613
1621
|
var TLV_COVCLAIMD_PUBKEY = 3;
|
|
1622
|
+
var TLV_MIN_AMOUNT = 4;
|
|
1614
1623
|
var COMPRESSED_PUBKEY_LENGTH = 33;
|
|
1615
1624
|
var SEALED_CIPHERTEXT_LENGTH = 93;
|
|
1616
1625
|
var CLAIM_PACKET_TYPE = 4;
|
|
@@ -1679,6 +1688,11 @@ import {
|
|
|
1679
1688
|
provisionClaimSecret,
|
|
1680
1689
|
provisionRefundKey
|
|
1681
1690
|
} from "@arkade-os/sdk";
|
|
1691
|
+
|
|
1692
|
+
// src/claimAmountGate.ts
|
|
1693
|
+
var bindsClaimAmount = () => false;
|
|
1694
|
+
|
|
1695
|
+
// src/rfq.ts
|
|
1682
1696
|
var solverHex = (value, field) => {
|
|
1683
1697
|
try {
|
|
1684
1698
|
return hex5.decode(value);
|
|
@@ -2720,7 +2734,7 @@ function deriveLightningReceive(input) {
|
|
|
2720
2734
|
}
|
|
2721
2735
|
};
|
|
2722
2736
|
}
|
|
2723
|
-
var provisionReceive = async (wallet,
|
|
2737
|
+
var provisionReceive = async (wallet, params, persistBefore) => {
|
|
2724
2738
|
const secrets = await provisionClaimSecret(wallet);
|
|
2725
2739
|
if (secrets.mustPersistPreimage) {
|
|
2726
2740
|
console.warn(
|
|
@@ -2734,12 +2748,17 @@ var provisionReceive = async (wallet, covclaimdPubkey, persistBefore) => {
|
|
|
2734
2748
|
wallet.getArkadeInfo({ requireLive: true }),
|
|
2735
2749
|
wallet.getAddress()
|
|
2736
2750
|
]);
|
|
2737
|
-
const
|
|
2751
|
+
const binds = bindsClaimAmount();
|
|
2752
|
+
const claimPacket = params.covclaimdPubkey && (!binds || params.amountSide === "to") ? await sealClaimPacket({
|
|
2753
|
+
preimage,
|
|
2754
|
+
covclaimdPubkey: params.covclaimdPubkey,
|
|
2755
|
+
minAmount: binds ? BigInt(params.amount) : void 0
|
|
2756
|
+
}) : void 0;
|
|
2738
2757
|
return { secrets, paymentHash, payoutPubkey, info, payoutAddress, claimPacket };
|
|
2739
2758
|
};
|
|
2740
|
-
var quoteReceive = async (wallet, transport,
|
|
2759
|
+
var quoteReceive = async (wallet, transport, params, persistBefore, request) => {
|
|
2741
2760
|
for (let attempt = 0; ; attempt++) {
|
|
2742
|
-
const provisioned = await provisionReceive(wallet,
|
|
2761
|
+
const provisioned = await provisionReceive(wallet, params, persistBefore);
|
|
2743
2762
|
try {
|
|
2744
2763
|
return { ...provisioned, quote: await transport.requestQuote(request(provisioned)) };
|
|
2745
2764
|
} catch (error) {
|
|
@@ -2753,7 +2772,7 @@ async function requestLightningReceive(wallet, transport, params) {
|
|
|
2753
2772
|
const { secrets, paymentHash, payoutPubkey, info, payoutAddress, quote } = await quoteReceive(
|
|
2754
2773
|
wallet,
|
|
2755
2774
|
transport,
|
|
2756
|
-
params
|
|
2775
|
+
params,
|
|
2757
2776
|
"paying",
|
|
2758
2777
|
({ paymentHash: paymentHash2, payoutAddress: payoutAddress2, payoutPubkey: payoutPubkey2, claimPacket }) => lightningReceiveRequest({
|
|
2759
2778
|
rfqId,
|
|
@@ -2844,7 +2863,7 @@ async function requestOnchainReceive(wallet, transport, params) {
|
|
|
2844
2863
|
const { secrets, paymentHash, payoutPubkey, info, payoutAddress, quote } = await quoteReceive(
|
|
2845
2864
|
wallet,
|
|
2846
2865
|
transport,
|
|
2847
|
-
params
|
|
2866
|
+
params,
|
|
2848
2867
|
"funding",
|
|
2849
2868
|
({ paymentHash: paymentHash2, payoutAddress: payoutAddress2, payoutPubkey: payoutPubkey2, claimPacket }) => onchainReceiveRequest({
|
|
2850
2869
|
rfqId,
|
|
@@ -2918,6 +2937,7 @@ export {
|
|
|
2918
2937
|
rfqClaimSecretOf,
|
|
2919
2938
|
rfqClaimDestinationOf,
|
|
2920
2939
|
swapPrograms,
|
|
2940
|
+
withExitClosure,
|
|
2921
2941
|
offerContract,
|
|
2922
2942
|
OFFER_PACKET_TYPE,
|
|
2923
2943
|
encodeOffer,
|
|
@@ -2968,6 +2988,7 @@ export {
|
|
|
2968
2988
|
awaitOnchainFill,
|
|
2969
2989
|
claimOnchainFill,
|
|
2970
2990
|
classifyOnchainHtlc,
|
|
2991
|
+
bindsClaimAmount,
|
|
2971
2992
|
sealClaimPacket,
|
|
2972
2993
|
SEALED_CIPHERTEXT_LENGTH,
|
|
2973
2994
|
CLAIM_PACKET_TYPE,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
undeliveredCarry,
|
|
59
59
|
walletOperator,
|
|
60
60
|
watchOfferSwaps
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-RDAQR6LV.js";
|
|
62
62
|
import {
|
|
63
63
|
ARKADE_BTC,
|
|
64
64
|
ASSET_CARRIER_SATS,
|
|
@@ -68,6 +68,7 @@ import {
|
|
|
68
68
|
LIGHTNING_BTC,
|
|
69
69
|
LockupContractMissing,
|
|
70
70
|
NoSpendableDepositError,
|
|
71
|
+
OFFER_CONTRACT_KIND,
|
|
71
72
|
OFFER_PACKET_TYPE,
|
|
72
73
|
ONCHAIN_BTC,
|
|
73
74
|
ONCHAIN_CLAIM_VSIZE,
|
|
@@ -80,6 +81,7 @@ import {
|
|
|
80
81
|
assertFundable,
|
|
81
82
|
assertPairLength,
|
|
82
83
|
assertReceivable,
|
|
84
|
+
bindsClaimAmount,
|
|
83
85
|
buildHtlcRefund,
|
|
84
86
|
claimOnchainFill,
|
|
85
87
|
connectFillContract,
|
|
@@ -117,9 +119,11 @@ import {
|
|
|
117
119
|
rfqSecretsProfile,
|
|
118
120
|
rfqSignerOf,
|
|
119
121
|
sealClaimPacket,
|
|
122
|
+
swapPrograms,
|
|
120
123
|
unilateralClaimDelay,
|
|
121
|
-
verifyOfferAddress
|
|
122
|
-
|
|
124
|
+
verifyOfferAddress,
|
|
125
|
+
withExitClosure
|
|
126
|
+
} from "./chunk-GBQX3FJV.js";
|
|
123
127
|
import {
|
|
124
128
|
assertRfqSwapPageFilter,
|
|
125
129
|
collectAssetSwaps,
|
|
@@ -826,7 +830,7 @@ var acceptQuoteBody = async (input) => {
|
|
|
826
830
|
var registeredOfferRecord = async (input, preparation) => {
|
|
827
831
|
const { quote, wallet, corridors, now } = input;
|
|
828
832
|
const { plan } = preparation;
|
|
829
|
-
const
|
|
833
|
+
const arkade2 = corridors.get("arkade").deps;
|
|
830
834
|
const receiveIsBtc = plan.receive.asset.id === BTC_ASSET_ID;
|
|
831
835
|
const offer = await createOffer(
|
|
832
836
|
wallet,
|
|
@@ -834,7 +838,7 @@ var registeredOfferRecord = async (input, preparation) => {
|
|
|
834
838
|
// Keyed on the receive side: the covenant binds what the fill delivers.
|
|
835
839
|
wantAmount: plan.receive.atomic,
|
|
836
840
|
...receiveIsBtc ? { offerAsset: asset2.AssetId.fromString(plan.deposit.asset.id) } : { wantAsset: asset2.AssetId.fromString(plan.receive.asset.id) },
|
|
837
|
-
emulatorPubkey:
|
|
841
|
+
emulatorPubkey: arkade2.emulatorPubkey
|
|
838
842
|
},
|
|
839
843
|
{ coverageId: quote.id }
|
|
840
844
|
);
|
|
@@ -1866,6 +1870,139 @@ import {
|
|
|
1866
1870
|
} from "@arkade-os/sdk";
|
|
1867
1871
|
import { hex as hex6 } from "@scure/base";
|
|
1868
1872
|
|
|
1873
|
+
// src/migrateOfferRows.ts
|
|
1874
|
+
import { arkade } from "@arkade-os/sdk";
|
|
1875
|
+
|
|
1876
|
+
// src/legacy/swap-want-asset.program.v0.json
|
|
1877
|
+
var swap_want_asset_program_v0_default = {
|
|
1878
|
+
version: 0,
|
|
1879
|
+
name: "banco-btc-to-asset",
|
|
1880
|
+
params: [
|
|
1881
|
+
{ name: "makerWP", type: "pubkey" },
|
|
1882
|
+
{ name: "wantAmount", type: "int" },
|
|
1883
|
+
{ name: "wantAssetTxid", type: "hash" },
|
|
1884
|
+
{ name: "wantAssetGroupIndex", type: "int" },
|
|
1885
|
+
{ name: "server", type: "pubkey" },
|
|
1886
|
+
{ name: "user", type: "pubkey" }
|
|
1887
|
+
],
|
|
1888
|
+
functions: {
|
|
1889
|
+
fulfill: {
|
|
1890
|
+
tapscript: { signers: ["$server"] },
|
|
1891
|
+
arkadeScript: {
|
|
1892
|
+
asm: [
|
|
1893
|
+
0,
|
|
1894
|
+
"$wantAssetTxid",
|
|
1895
|
+
"$wantAssetGroupIndex",
|
|
1896
|
+
"INSPECTOUTASSETLOOKUP",
|
|
1897
|
+
"VERIFY",
|
|
1898
|
+
"$wantAmount",
|
|
1899
|
+
"GREATERTHANOREQUAL",
|
|
1900
|
+
"VERIFY",
|
|
1901
|
+
0,
|
|
1902
|
+
"INSPECTOUTPUTSCRIPTPUBKEY",
|
|
1903
|
+
1,
|
|
1904
|
+
"EQUALVERIFY",
|
|
1905
|
+
"$makerWP",
|
|
1906
|
+
"EQUAL"
|
|
1907
|
+
]
|
|
1908
|
+
}
|
|
1909
|
+
},
|
|
1910
|
+
cancel: {
|
|
1911
|
+
tapscript: { signers: ["$user", "$server"] }
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
// src/legacy/swap-want-btc.program.v0.json
|
|
1917
|
+
var swap_want_btc_program_v0_default = {
|
|
1918
|
+
version: 0,
|
|
1919
|
+
name: "banco-asset-to-btc",
|
|
1920
|
+
params: [
|
|
1921
|
+
{ name: "makerWP", type: "pubkey" },
|
|
1922
|
+
{ name: "wantAmount", type: "int" },
|
|
1923
|
+
{ name: "server", type: "pubkey" },
|
|
1924
|
+
{ name: "user", type: "pubkey" }
|
|
1925
|
+
],
|
|
1926
|
+
functions: {
|
|
1927
|
+
fulfill: {
|
|
1928
|
+
tapscript: { signers: ["$server"] },
|
|
1929
|
+
arkadeScript: {
|
|
1930
|
+
asm: [
|
|
1931
|
+
0,
|
|
1932
|
+
"INSPECTOUTPUTVALUE",
|
|
1933
|
+
"$wantAmount",
|
|
1934
|
+
"GREATERTHANOREQUAL",
|
|
1935
|
+
"VERIFY",
|
|
1936
|
+
0,
|
|
1937
|
+
"INSPECTOUTPUTSCRIPTPUBKEY",
|
|
1938
|
+
1,
|
|
1939
|
+
"EQUALVERIFY",
|
|
1940
|
+
"$makerWP",
|
|
1941
|
+
"EQUAL"
|
|
1942
|
+
]
|
|
1943
|
+
}
|
|
1944
|
+
},
|
|
1945
|
+
cancel: {
|
|
1946
|
+
tapscript: { signers: ["$user", "$server"] }
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
// src/migrateOfferRows.ts
|
|
1952
|
+
function withExitV0(program, exit) {
|
|
1953
|
+
if (!exit) return program;
|
|
1954
|
+
return {
|
|
1955
|
+
...program,
|
|
1956
|
+
params: [...program.params, { name: "exitDelay", type: "int" }],
|
|
1957
|
+
functions: {
|
|
1958
|
+
...program.functions,
|
|
1959
|
+
exit: { tapscript: { signers: ["$user"], csv: { type: exit, value: "$exitDelay" } } }
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
}
|
|
1963
|
+
var V0_TO_V1 = /* @__PURE__ */ new Map();
|
|
1964
|
+
for (const [v0, v1] of [
|
|
1965
|
+
[swap_want_btc_program_v0_default, swapPrograms.wantBtc],
|
|
1966
|
+
[swap_want_asset_program_v0_default, swapPrograms.wantAsset]
|
|
1967
|
+
]) {
|
|
1968
|
+
for (const exit of [void 0, "blocks", "seconds"]) {
|
|
1969
|
+
const timelock = exit && { type: exit, value: BigInt(0) };
|
|
1970
|
+
V0_TO_V1.set(
|
|
1971
|
+
JSON.stringify(withExitV0(v0, exit)),
|
|
1972
|
+
arkade.stringifyArtifact(withExitClosure(v1, timelock))
|
|
1973
|
+
);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
async function migrateV0OfferRows(contractManager) {
|
|
1977
|
+
const migrated = [];
|
|
1978
|
+
const skipped = [];
|
|
1979
|
+
for (const row of await contractManager.getUnsupportedContracts()) {
|
|
1980
|
+
if (row.type !== "arkade" || row.metadata?.kind !== OFFER_CONTRACT_KIND) continue;
|
|
1981
|
+
const program = V0_TO_V1.get(row.params.program);
|
|
1982
|
+
if (!program) {
|
|
1983
|
+
skipped.push({ script: row.script, reason: "not a bundled Program v0 offer" });
|
|
1984
|
+
continue;
|
|
1985
|
+
}
|
|
1986
|
+
try {
|
|
1987
|
+
await contractManager.createContract({
|
|
1988
|
+
type: row.type,
|
|
1989
|
+
script: row.script,
|
|
1990
|
+
address: row.address,
|
|
1991
|
+
params: { ...row.params, program },
|
|
1992
|
+
label: row.label,
|
|
1993
|
+
metadata: row.metadata
|
|
1994
|
+
});
|
|
1995
|
+
migrated.push(row.script);
|
|
1996
|
+
} catch (error) {
|
|
1997
|
+
skipped.push({
|
|
1998
|
+
script: row.script,
|
|
1999
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
return { migrated, skipped };
|
|
2004
|
+
}
|
|
2005
|
+
|
|
1869
2006
|
// src/client/legacyRecords.ts
|
|
1870
2007
|
import { assertPageRequest as assertPageRequest2 } from "@arkade-os/sdk";
|
|
1871
2008
|
var readLegacyRfqSwaps = async (repository, filter = {}) => {
|
|
@@ -2447,7 +2584,19 @@ var createSwapDrive = (config) => {
|
|
|
2447
2584
|
console.warn("[swap] v1 rfq swap adoption did not complete", error);
|
|
2448
2585
|
}
|
|
2449
2586
|
};
|
|
2587
|
+
const migrateOfferRows = async () => {
|
|
2588
|
+
if (mode === "readonly") return;
|
|
2589
|
+
try {
|
|
2590
|
+
const { skipped } = await migrateV0OfferRows(await wallet.getContractManager());
|
|
2591
|
+
for (const { script, reason } of skipped) {
|
|
2592
|
+
console.warn(`[swap] could not migrate Program v0 offer row ${script}: ${reason}`);
|
|
2593
|
+
}
|
|
2594
|
+
} catch (error) {
|
|
2595
|
+
console.warn("[swap] Program v0 offer row migration did not complete", error);
|
|
2596
|
+
}
|
|
2597
|
+
};
|
|
2450
2598
|
const restore = async () => {
|
|
2599
|
+
void track(migrateOfferRows());
|
|
2451
2600
|
if (!repository) return;
|
|
2452
2601
|
await adoptLegacyRfqSwaps(repository);
|
|
2453
2602
|
const all = await collectSwapRecords(repository);
|
|
@@ -3528,12 +3677,12 @@ var lockupOf = (derived) => ({
|
|
|
3528
3677
|
});
|
|
3529
3678
|
var covenantInputs = (input) => {
|
|
3530
3679
|
const network = networkFromArkadeInfo(input.info);
|
|
3531
|
-
const
|
|
3680
|
+
const arkade2 = input.corridors.get("arkade").deps;
|
|
3532
3681
|
return {
|
|
3533
3682
|
operatorPubkey: toXOnly(hex8.decode(input.info.signerPubkey), "ark signer key"),
|
|
3534
3683
|
// The resolved per-network pin, never operator-reported: it lands in a covenant leaf
|
|
3535
3684
|
// that decides who can move the funds.
|
|
3536
|
-
emulatorPubkey: toXOnly(hex8.decode(
|
|
3685
|
+
emulatorPubkey: toXOnly(hex8.decode(arkade2.emulatorPubkey), "emulator signer key"),
|
|
3537
3686
|
claimDelay: unilateralClaimDelay(Number(input.info.unilateralExitDelay)),
|
|
3538
3687
|
hrp: network.hrp
|
|
3539
3688
|
};
|
|
@@ -3841,7 +3990,13 @@ var quoteLightningReceive = async (input) => {
|
|
|
3841
3990
|
const payoutAddress = await input.wallet.getAddress();
|
|
3842
3991
|
const lightning = input.corridors.get("lightning").deps;
|
|
3843
3992
|
const sealTo = sealingKey(lightning);
|
|
3844
|
-
const
|
|
3993
|
+
const sealsAmount = pinned.on === "take" && input.legs.take.assetId === BTC_ASSET_ID;
|
|
3994
|
+
const binds = bindsClaimAmount();
|
|
3995
|
+
const claimPacket = sealTo !== void 0 && (!binds || sealsAmount) ? await sealClaimPacket({
|
|
3996
|
+
preimage: secrets.preimage,
|
|
3997
|
+
covclaimdPubkey: sealTo,
|
|
3998
|
+
minAmount: binds ? pinned.value : void 0
|
|
3999
|
+
}) : void 0;
|
|
3845
4000
|
const wire = await input.transport.requestQuote(
|
|
3846
4001
|
withCanonicalAmount(
|
|
3847
4002
|
lightningReceiveRequest({
|
|
@@ -4188,14 +4343,14 @@ var settle = async (deps, input, maxFee) => {
|
|
|
4188
4343
|
return deps.accept(quote);
|
|
4189
4344
|
};
|
|
4190
4345
|
var pay = async (deps, destination, options = {}) => {
|
|
4191
|
-
const
|
|
4192
|
-
if (
|
|
4346
|
+
const arkade2 = arkTarget2(destination);
|
|
4347
|
+
if (arkade2 !== void 0) {
|
|
4193
4348
|
const amount = resolveSendAmount2(
|
|
4194
4349
|
"ark",
|
|
4195
4350
|
destination,
|
|
4196
4351
|
options.amount === void 0 ? void 0 : satsOf(options.amount, "amount")
|
|
4197
4352
|
);
|
|
4198
|
-
return { kind: "payment", txid: await deps.wallet.send({ address:
|
|
4353
|
+
return { kind: "payment", txid: await deps.wallet.send({ address: arkade2, amount }) };
|
|
4199
4354
|
}
|
|
4200
4355
|
const swap = await settle(
|
|
4201
4356
|
deps,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
rfqCorridorHandlers,
|
|
25
25
|
rfqSignerOf,
|
|
26
26
|
updateAssetSwapBestEffort
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-GBQX3FJV.js";
|
|
28
28
|
import {
|
|
29
29
|
collectRfqSwaps
|
|
30
30
|
} from "./chunk-A3SHHRX4.js";
|
|
@@ -933,7 +933,6 @@ import {
|
|
|
933
933
|
isVtxoSpent,
|
|
934
934
|
matchServerCheckpoints,
|
|
935
935
|
networkFromArkadeInfo,
|
|
936
|
-
resolveCheckpointExitDelayPolicy,
|
|
937
936
|
scriptFromTapLeafScript,
|
|
938
937
|
toXOnly
|
|
939
938
|
} from "@arkade-os/sdk";
|
|
@@ -1085,9 +1084,8 @@ var operatorUnrollScript = async (operator, network) => {
|
|
|
1085
1084
|
const info = await operator.getInfo();
|
|
1086
1085
|
return assertValidServerUnrollScript(
|
|
1087
1086
|
info.checkpointTapscript,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
})
|
|
1087
|
+
network ?? networkFromArkadeInfo(info),
|
|
1088
|
+
toXOnly(hex2.decode(info.forfeitPubkey), "forfeit key")
|
|
1091
1089
|
);
|
|
1092
1090
|
};
|
|
1093
1091
|
var MAX_LOCKUP_SPEND_INPUTS = 16;
|