@arkade-os/swap 0.1.3 → 0.1.4
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 +1 -1
- package/dist/advanced.cjs +14 -11
- package/dist/advanced.d.cts +8 -8
- package/dist/advanced.d.ts +8 -8
- package/dist/advanced.js +5 -3
- package/dist/{chunk-2AQYBSF5.js → chunk-7BBQ74BG.js} +13 -13
- package/dist/{chunk-G5QURHVP.js → chunk-GJKGPE3S.js} +3 -3
- package/dist/{chunk-6HKTAZLJ.js → chunk-HDCC3JZR.js} +12 -10
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -3
- package/dist/{lockupContract-D-OpxRSX.d.ts → lockupContract-CdXh9yIr.d.ts} +1 -1
- package/dist/{lockupContract-AwSwif9u.d.cts → lockupContract-QfbsjyXG.d.cts} +1 -1
- package/dist/node/index.cjs +37 -37
- package/dist/node/index.js +37 -37
- package/dist/nostr.d.cts +1 -1
- package/dist/nostr.d.ts +1 -1
- package/dist/nostr.js +1 -1
- package/dist/{offer-BEcW5o7V.d.cts → offer-BxzPQ6zh.d.cts} +11 -11
- package/dist/{offer-4Ir1bRQV.d.ts → offer-Q1lVhrVX.d.ts} +11 -11
- package/dist/{offerFillPlan-DvrHfYoH.d.cts → offerFillPlan-CvKlB246.d.cts} +16 -11
- package/dist/{offerFillPlan-bsyVMum3.d.ts → offerFillPlan-_PhFt4B1.d.ts} +16 -11
- package/dist/protocol.cjs +12 -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.cjs +37 -37
- package/dist/repositories/sqlite/index.d.cts +3 -3
- package/dist/repositories/sqlite/index.d.ts +3 -3
- package/dist/repositories/sqlite/index.js +37 -37
- package/dist/{repository-ChRNknNn.d.ts → repository-BOQ1qYoj.d.ts} +7 -7
- package/dist/{repository-BW42Dtct.d.cts → repository-Cut4eEkm.d.cts} +7 -7
- package/dist/{rfq-C0tHOvn6.d.cts → rfq-CP-P0PSL.d.cts} +7 -7
- package/dist/{rfq-C0tHOvn6.d.ts → rfq-CP-P0PSL.d.ts} +7 -7
- package/dist/{watch-B_Q0ddHg.d.ts → watch-D15U0QpD.d.ts} +1 -1
- package/dist/{watch-CpnfqYCE.d.cts → watch-D4PeBZ3H.d.cts} +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IWallet, NetworkName, Network, SignerSet, OnchainProvider,
|
|
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-
|
|
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-
|
|
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-Cut4eEkm.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';
|
|
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-
|
|
5
|
+
import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-BxzPQ6zh.cjs';
|
|
6
6
|
import * as nostr_tools from 'nostr-tools';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -29,8 +29,8 @@ interface CorridorBase {
|
|
|
29
29
|
readonly network: Network;
|
|
30
30
|
/** The operator's signer set, for the rotation-aware recipient check. */
|
|
31
31
|
readonly signerSet: SignerSet;
|
|
32
|
-
/**
|
|
33
|
-
* `EMULATOR_PUBKEYS` does not pin. */
|
|
32
|
+
/** Override for the key of the operator's cosigner that emulates Arkade Script, 33-byte
|
|
33
|
+
* compressed hex. Required on `testnet` and `signet`, which `EMULATOR_PUBKEYS` does not pin. */
|
|
34
34
|
readonly emulatorPubkey?: string;
|
|
35
35
|
/** For hosts without a global `fetch`, and for tests. */
|
|
36
36
|
readonly fetchImpl?: typeof fetch;
|
|
@@ -160,9 +160,13 @@ declare function resolveCorridorDeps<C extends Corridor>(corridor: C, overrides:
|
|
|
160
160
|
* service-worker boundary is a bare `Error`). Covenant derivations read live, since a snapshot can
|
|
161
161
|
* bind a signer key the operator no longer co-signs for; `resolve()` takes the offline fallback.
|
|
162
162
|
*/
|
|
163
|
+
declare const liveOperatorInfo: (wallet: IWallet, opts?: {
|
|
164
|
+
requireLive?: boolean;
|
|
165
|
+
}) => Promise<OperatorInfo>;
|
|
166
|
+
/** @deprecated Use {@link liveOperatorInfo}. */
|
|
163
167
|
declare const liveArkadeInfo: (wallet: IWallet, opts?: {
|
|
164
168
|
requireLive?: boolean;
|
|
165
|
-
}) => Promise<
|
|
169
|
+
}) => Promise<OperatorInfo>;
|
|
166
170
|
/**
|
|
167
171
|
* The one operator read, made once for all three corridors. `getNetwork` stays fail-closed: an
|
|
168
172
|
* unknown network name is not "unreachable", and resolving it to mainnet params is what it prevents.
|
|
@@ -174,7 +178,7 @@ declare const resolveCorridorBase: (input: {
|
|
|
174
178
|
fetchImpl?: typeof fetch;
|
|
175
179
|
/** The client's storage, threaded so the arkade dep can default to it. */
|
|
176
180
|
repository?: AssetSwapRepository;
|
|
177
|
-
/** Defaults to `true` — see {@link
|
|
181
|
+
/** Defaults to `true` — see {@link liveOperatorInfo}. */
|
|
178
182
|
requireLive?: boolean;
|
|
179
183
|
}) => Promise<CorridorBase>;
|
|
180
184
|
|
|
@@ -1154,7 +1158,7 @@ interface RfqQuoteInput {
|
|
|
1154
1158
|
readonly amount?: PinnedAmount;
|
|
1155
1159
|
readonly wallet: IWallet;
|
|
1156
1160
|
/** Live, per section 6: a snapshot binds a covenant to a key that may have rotated. */
|
|
1157
|
-
readonly info:
|
|
1161
|
+
readonly info: OperatorInfo;
|
|
1158
1162
|
/**
|
|
1159
1163
|
* The corridor modules, unresolved: resolution refuses a dep overridden to nothing, so each
|
|
1160
1164
|
* route resolves only the corridors it uses.
|
|
@@ -1250,7 +1254,8 @@ interface SwapClientConfig {
|
|
|
1250
1254
|
/** Dependency overrides only: they never enable a route or pick a solver. */
|
|
1251
1255
|
readonly corridors?: CorridorOverrides;
|
|
1252
1256
|
readonly policy?: SwapPolicy;
|
|
1253
|
-
/**
|
|
1257
|
+
/** Override for the key of the operator's cosigner that emulates Arkade Script, 33-byte
|
|
1258
|
+
* compressed hex. */
|
|
1254
1259
|
readonly emulatorPubkey?: string;
|
|
1255
1260
|
/** Overrides the wallet's own connection; for tests and a second operator. */
|
|
1256
1261
|
readonly operator?: SwapOperator;
|
|
@@ -1668,4 +1673,4 @@ interface BuildOfferFillPlanOpts {
|
|
|
1668
1673
|
declare function buildOfferFillPlan(wallet: IWallet, arkServerUrl: string, offerHex: string, opts: BuildOfferFillPlanOpts): Promise<JointGraph>;
|
|
1669
1674
|
declare function verifyOfferFillPlan(plan: JointGraph): boolean;
|
|
1670
1675
|
|
|
1671
|
-
export { type JointGraph as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, type DiscoveryIndex as D, type CorridorOverrides as E, type CorridorPass as F, type CorridorRfqPreparation as G, DEFAULT_MAX_REFUND_WINDOW_SECONDS as H, type DiscoveryConfig as I, type DiscoveryIndexInput as J, DiscoverySnapshotUnavailable as K, type LightningCorridorDeps as L, type MarketCandidate as M, type DriveMode as N, type OnchainCorridorDeps as O, type DriveRefusal as P, type ExchangeOptions as Q, FEED_TTL_MS as R, type SwapPolicy as S, type FeeCeiling as T, type FeedFetch as U, type FeedQuoteInput as V, type FillSponsor as W, type FillSponsorFare as X, INDEXED_NETWORKS as Y, InconsistentRoute as Z, InsufficientFunds as _, type ArkadeCorridorDeps as a, feedSpread as a$, type LockupOwner as a0, type Market as a1, type MarketLeg as a2, MaxFeeExceeded as a3, MissingCorridorDep as a4, NotCancellable as a5, OFFER_FILL_OWNERS as a6, OFFER_FILL_TEMPLATE as a7, ONCHAIN_CLAIM_FEE_RATE_SATVB as a8, type ObservationSeam as a9, type SwapDrive as aA, type SwapDriveConfig as aB, SwapDriveRefusedError as aC, type SwapError as aD, type SwapErrorName as aE, type SwapFilter as aF, UnsupportedRoute as aG, type VerbDeps as aH, acceptQuote as aI, attesting as aJ, buildOfferFillPlan as aK, cancelSwap as aL, canonicalAssetId as aM, cardMarketOf as aN, chooseMarket as aO, conflictingFields as aP, corridorSet as aQ, createNostrTransportFactory as aR, createSwapClient as aS, createSwapDrive as aT, deepFreeze as aU, digestJointGraph as aV, discoveryIndex as aW, eligibleMarkets as aX, enforceFeeCeiling as aY, exchange as aZ, feedFetch as a_, type OfferPreparation as aa, type OnchainClaim as ab, type OnchainRefund as ac, OperatorUnreachable as ad, type ParsedRfqQuote as ae, type PayOptions as af, type PayResult as ag, type QuoteCheck as ah, QuoteExpired as ai, type QuotePreparation as aj, QuoteVerificationFailed as ak, REGISTRY_URL as al, type ReceiveArtifact as am, type ReceiveOptions as an, type ReceiveRequest as ao, type RecoveryResult as ap, type RegisteredAsset as aq, type RfqAuctionPolicy as ar, type RfqPreparation as as, type RfqQuoteInput as at, type RfqRendezvous as au, type RfqTransportFactory as av, type RouteSide as aw, SWAP_ERROR_NAMES as ax, type SwapClient as ay, type SwapClientConfig as az, type CorridorSet as b, isAddressable as b0, isCardMarket as b1, isIndexedNetwork as b2, isSwapError as b3, isUsableCard as b4, liveArkadeInfo as b5,
|
|
1676
|
+
export { type JointGraph as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, type DiscoveryIndex as D, type CorridorOverrides as E, type CorridorPass as F, type CorridorRfqPreparation as G, DEFAULT_MAX_REFUND_WINDOW_SECONDS as H, type DiscoveryConfig as I, type DiscoveryIndexInput as J, DiscoverySnapshotUnavailable as K, type LightningCorridorDeps as L, type MarketCandidate as M, type DriveMode as N, type OnchainCorridorDeps as O, type DriveRefusal as P, type ExchangeOptions as Q, FEED_TTL_MS as R, type SwapPolicy as S, type FeeCeiling as T, type FeedFetch as U, type FeedQuoteInput as V, type FillSponsor as W, type FillSponsorFare as X, INDEXED_NETWORKS as Y, InconsistentRoute as Z, InsufficientFunds as _, type ArkadeCorridorDeps as a, feedSpread as a$, type LockupOwner as a0, type Market as a1, type MarketLeg as a2, MaxFeeExceeded as a3, MissingCorridorDep as a4, NotCancellable as a5, OFFER_FILL_OWNERS as a6, OFFER_FILL_TEMPLATE as a7, ONCHAIN_CLAIM_FEE_RATE_SATVB as a8, type ObservationSeam as a9, type SwapDrive as aA, type SwapDriveConfig as aB, SwapDriveRefusedError as aC, type SwapError as aD, type SwapErrorName as aE, type SwapFilter as aF, UnsupportedRoute as aG, type VerbDeps as aH, acceptQuote as aI, attesting as aJ, buildOfferFillPlan as aK, cancelSwap as aL, canonicalAssetId as aM, cardMarketOf as aN, chooseMarket as aO, conflictingFields as aP, corridorSet as aQ, createNostrTransportFactory as aR, createSwapClient as aS, createSwapDrive as aT, deepFreeze as aU, digestJointGraph as aV, discoveryIndex as aW, eligibleMarkets as aX, enforceFeeCeiling as aY, exchange as aZ, feedFetch as a_, type OfferPreparation as aa, type OnchainClaim as ab, type OnchainRefund as ac, OperatorUnreachable as ad, type ParsedRfqQuote as ae, type PayOptions as af, type PayResult as ag, type QuoteCheck as ah, QuoteExpired as ai, type QuotePreparation as aj, QuoteVerificationFailed as ak, REGISTRY_URL as al, type ReceiveArtifact as am, type ReceiveOptions as an, type ReceiveRequest as ao, type RecoveryResult as ap, type RegisteredAsset as aq, type RfqAuctionPolicy as ar, type RfqPreparation as as, type RfqQuoteInput as at, type RfqRendezvous as au, type RfqTransportFactory as av, type RouteSide as aw, SWAP_ERROR_NAMES as ax, type SwapClient as ay, type SwapClientConfig as az, type CorridorSet as b, isAddressable as b0, isCardMarket as b1, isIndexedNetwork as b2, isSwapError as b3, isUsableCard as b4, liveArkadeInfo as b5, liveOperatorInfo as b6, marketBackendOf as b7, marketKeyOf as b8, marketOf as b9, marketRefOf as ba, nostrTransportFactory as bb, parseRfqQuote as bc, pay as bd, quoteFromFeed as be, quoteViaRfq as bf, readableRecord as bg, receive as bh, resolveCorridorBase as bi, resolveCorridorDeps as bj, rfqLeg as bk, rfqPairFor as bl, swapRecordOf as bm, toDiscoveryLeg as bn, unsignedPsbtBytes as bo, usableMarkets as bp, verifyJointGraph as bq, verifyOfferFillPlan as br, verifyPlanLegs as bs, withCanonicalAmount as bt, type DiscoveryLeg as c, type DiscoverySnapshot as d, AcceptConflict as e, type AcceptInput as f, type AcceptOptions as g, AmbiguousDestination as h, AmountEncodingUnsupported as i, AmountMismatch as j, type AssetRfqPreparation as k, type AttestingRfqTransport as l, CORRIDOR_FACTORIES as m, type CancelInput as n, type CancelOutcome as o, type ClaimedDestination as p, ClientDisposed as q, type CorridorBase as r, type CorridorClaim as s, type CorridorCovenant as t, type CorridorDeadline as u, type CorridorDeps as v, type CorridorDepsByCorridor as w, type CorridorDrive as x, type CorridorLockup as y, type CorridorModule as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IWallet, NetworkName, Network, SignerSet, OnchainProvider,
|
|
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-
|
|
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-
|
|
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-BOQ1qYoj.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';
|
|
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-
|
|
5
|
+
import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-Q1lVhrVX.js';
|
|
6
6
|
import * as nostr_tools from 'nostr-tools';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -29,8 +29,8 @@ interface CorridorBase {
|
|
|
29
29
|
readonly network: Network;
|
|
30
30
|
/** The operator's signer set, for the rotation-aware recipient check. */
|
|
31
31
|
readonly signerSet: SignerSet;
|
|
32
|
-
/**
|
|
33
|
-
* `EMULATOR_PUBKEYS` does not pin. */
|
|
32
|
+
/** Override for the key of the operator's cosigner that emulates Arkade Script, 33-byte
|
|
33
|
+
* compressed hex. Required on `testnet` and `signet`, which `EMULATOR_PUBKEYS` does not pin. */
|
|
34
34
|
readonly emulatorPubkey?: string;
|
|
35
35
|
/** For hosts without a global `fetch`, and for tests. */
|
|
36
36
|
readonly fetchImpl?: typeof fetch;
|
|
@@ -160,9 +160,13 @@ declare function resolveCorridorDeps<C extends Corridor>(corridor: C, overrides:
|
|
|
160
160
|
* service-worker boundary is a bare `Error`). Covenant derivations read live, since a snapshot can
|
|
161
161
|
* bind a signer key the operator no longer co-signs for; `resolve()` takes the offline fallback.
|
|
162
162
|
*/
|
|
163
|
+
declare const liveOperatorInfo: (wallet: IWallet, opts?: {
|
|
164
|
+
requireLive?: boolean;
|
|
165
|
+
}) => Promise<OperatorInfo>;
|
|
166
|
+
/** @deprecated Use {@link liveOperatorInfo}. */
|
|
163
167
|
declare const liveArkadeInfo: (wallet: IWallet, opts?: {
|
|
164
168
|
requireLive?: boolean;
|
|
165
|
-
}) => Promise<
|
|
169
|
+
}) => Promise<OperatorInfo>;
|
|
166
170
|
/**
|
|
167
171
|
* The one operator read, made once for all three corridors. `getNetwork` stays fail-closed: an
|
|
168
172
|
* unknown network name is not "unreachable", and resolving it to mainnet params is what it prevents.
|
|
@@ -174,7 +178,7 @@ declare const resolveCorridorBase: (input: {
|
|
|
174
178
|
fetchImpl?: typeof fetch;
|
|
175
179
|
/** The client's storage, threaded so the arkade dep can default to it. */
|
|
176
180
|
repository?: AssetSwapRepository;
|
|
177
|
-
/** Defaults to `true` — see {@link
|
|
181
|
+
/** Defaults to `true` — see {@link liveOperatorInfo}. */
|
|
178
182
|
requireLive?: boolean;
|
|
179
183
|
}) => Promise<CorridorBase>;
|
|
180
184
|
|
|
@@ -1154,7 +1158,7 @@ interface RfqQuoteInput {
|
|
|
1154
1158
|
readonly amount?: PinnedAmount;
|
|
1155
1159
|
readonly wallet: IWallet;
|
|
1156
1160
|
/** Live, per section 6: a snapshot binds a covenant to a key that may have rotated. */
|
|
1157
|
-
readonly info:
|
|
1161
|
+
readonly info: OperatorInfo;
|
|
1158
1162
|
/**
|
|
1159
1163
|
* The corridor modules, unresolved: resolution refuses a dep overridden to nothing, so each
|
|
1160
1164
|
* route resolves only the corridors it uses.
|
|
@@ -1250,7 +1254,8 @@ interface SwapClientConfig {
|
|
|
1250
1254
|
/** Dependency overrides only: they never enable a route or pick a solver. */
|
|
1251
1255
|
readonly corridors?: CorridorOverrides;
|
|
1252
1256
|
readonly policy?: SwapPolicy;
|
|
1253
|
-
/**
|
|
1257
|
+
/** Override for the key of the operator's cosigner that emulates Arkade Script, 33-byte
|
|
1258
|
+
* compressed hex. */
|
|
1254
1259
|
readonly emulatorPubkey?: string;
|
|
1255
1260
|
/** Overrides the wallet's own connection; for tests and a second operator. */
|
|
1256
1261
|
readonly operator?: SwapOperator;
|
|
@@ -1668,4 +1673,4 @@ interface BuildOfferFillPlanOpts {
|
|
|
1668
1673
|
declare function buildOfferFillPlan(wallet: IWallet, arkServerUrl: string, offerHex: string, opts: BuildOfferFillPlanOpts): Promise<JointGraph>;
|
|
1669
1674
|
declare function verifyOfferFillPlan(plan: JointGraph): boolean;
|
|
1670
1675
|
|
|
1671
|
-
export { type JointGraph as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, type DiscoveryIndex as D, type CorridorOverrides as E, type CorridorPass as F, type CorridorRfqPreparation as G, DEFAULT_MAX_REFUND_WINDOW_SECONDS as H, type DiscoveryConfig as I, type DiscoveryIndexInput as J, DiscoverySnapshotUnavailable as K, type LightningCorridorDeps as L, type MarketCandidate as M, type DriveMode as N, type OnchainCorridorDeps as O, type DriveRefusal as P, type ExchangeOptions as Q, FEED_TTL_MS as R, type SwapPolicy as S, type FeeCeiling as T, type FeedFetch as U, type FeedQuoteInput as V, type FillSponsor as W, type FillSponsorFare as X, INDEXED_NETWORKS as Y, InconsistentRoute as Z, InsufficientFunds as _, type ArkadeCorridorDeps as a, feedSpread as a$, type LockupOwner as a0, type Market as a1, type MarketLeg as a2, MaxFeeExceeded as a3, MissingCorridorDep as a4, NotCancellable as a5, OFFER_FILL_OWNERS as a6, OFFER_FILL_TEMPLATE as a7, ONCHAIN_CLAIM_FEE_RATE_SATVB as a8, type ObservationSeam as a9, type SwapDrive as aA, type SwapDriveConfig as aB, SwapDriveRefusedError as aC, type SwapError as aD, type SwapErrorName as aE, type SwapFilter as aF, UnsupportedRoute as aG, type VerbDeps as aH, acceptQuote as aI, attesting as aJ, buildOfferFillPlan as aK, cancelSwap as aL, canonicalAssetId as aM, cardMarketOf as aN, chooseMarket as aO, conflictingFields as aP, corridorSet as aQ, createNostrTransportFactory as aR, createSwapClient as aS, createSwapDrive as aT, deepFreeze as aU, digestJointGraph as aV, discoveryIndex as aW, eligibleMarkets as aX, enforceFeeCeiling as aY, exchange as aZ, feedFetch as a_, type OfferPreparation as aa, type OnchainClaim as ab, type OnchainRefund as ac, OperatorUnreachable as ad, type ParsedRfqQuote as ae, type PayOptions as af, type PayResult as ag, type QuoteCheck as ah, QuoteExpired as ai, type QuotePreparation as aj, QuoteVerificationFailed as ak, REGISTRY_URL as al, type ReceiveArtifact as am, type ReceiveOptions as an, type ReceiveRequest as ao, type RecoveryResult as ap, type RegisteredAsset as aq, type RfqAuctionPolicy as ar, type RfqPreparation as as, type RfqQuoteInput as at, type RfqRendezvous as au, type RfqTransportFactory as av, type RouteSide as aw, SWAP_ERROR_NAMES as ax, type SwapClient as ay, type SwapClientConfig as az, type CorridorSet as b, isAddressable as b0, isCardMarket as b1, isIndexedNetwork as b2, isSwapError as b3, isUsableCard as b4, liveArkadeInfo as b5,
|
|
1676
|
+
export { type JointGraph as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, type DiscoveryIndex as D, type CorridorOverrides as E, type CorridorPass as F, type CorridorRfqPreparation as G, DEFAULT_MAX_REFUND_WINDOW_SECONDS as H, type DiscoveryConfig as I, type DiscoveryIndexInput as J, DiscoverySnapshotUnavailable as K, type LightningCorridorDeps as L, type MarketCandidate as M, type DriveMode as N, type OnchainCorridorDeps as O, type DriveRefusal as P, type ExchangeOptions as Q, FEED_TTL_MS as R, type SwapPolicy as S, type FeeCeiling as T, type FeedFetch as U, type FeedQuoteInput as V, type FillSponsor as W, type FillSponsorFare as X, INDEXED_NETWORKS as Y, InconsistentRoute as Z, InsufficientFunds as _, type ArkadeCorridorDeps as a, feedSpread as a$, type LockupOwner as a0, type Market as a1, type MarketLeg as a2, MaxFeeExceeded as a3, MissingCorridorDep as a4, NotCancellable as a5, OFFER_FILL_OWNERS as a6, OFFER_FILL_TEMPLATE as a7, ONCHAIN_CLAIM_FEE_RATE_SATVB as a8, type ObservationSeam as a9, type SwapDrive as aA, type SwapDriveConfig as aB, SwapDriveRefusedError as aC, type SwapError as aD, type SwapErrorName as aE, type SwapFilter as aF, UnsupportedRoute as aG, type VerbDeps as aH, acceptQuote as aI, attesting as aJ, buildOfferFillPlan as aK, cancelSwap as aL, canonicalAssetId as aM, cardMarketOf as aN, chooseMarket as aO, conflictingFields as aP, corridorSet as aQ, createNostrTransportFactory as aR, createSwapClient as aS, createSwapDrive as aT, deepFreeze as aU, digestJointGraph as aV, discoveryIndex as aW, eligibleMarkets as aX, enforceFeeCeiling as aY, exchange as aZ, feedFetch as a_, type OfferPreparation as aa, type OnchainClaim as ab, type OnchainRefund as ac, OperatorUnreachable as ad, type ParsedRfqQuote as ae, type PayOptions as af, type PayResult as ag, type QuoteCheck as ah, QuoteExpired as ai, type QuotePreparation as aj, QuoteVerificationFailed as ak, REGISTRY_URL as al, type ReceiveArtifact as am, type ReceiveOptions as an, type ReceiveRequest as ao, type RecoveryResult as ap, type RegisteredAsset as aq, type RfqAuctionPolicy as ar, type RfqPreparation as as, type RfqQuoteInput as at, type RfqRendezvous as au, type RfqTransportFactory as av, type RouteSide as aw, SWAP_ERROR_NAMES as ax, type SwapClient as ay, type SwapClientConfig as az, type CorridorSet as b, isAddressable as b0, isCardMarket as b1, isIndexedNetwork as b2, isSwapError as b3, isUsableCard as b4, liveArkadeInfo as b5, liveOperatorInfo as b6, marketBackendOf as b7, marketKeyOf as b8, marketOf as b9, marketRefOf as ba, nostrTransportFactory as bb, parseRfqQuote as bc, pay as bd, quoteFromFeed as be, quoteViaRfq as bf, readableRecord as bg, receive as bh, resolveCorridorBase as bi, resolveCorridorDeps as bj, rfqLeg as bk, rfqPairFor as bl, swapRecordOf as bm, toDiscoveryLeg as bn, unsignedPsbtBytes as bo, usableMarkets as bp, verifyJointGraph as bq, verifyOfferFillPlan as br, verifyPlanLegs as bs, withCanonicalAmount as bt, type DiscoveryLeg as c, type DiscoverySnapshot as d, AcceptConflict as e, type AcceptInput as f, type AcceptOptions as g, AmbiguousDestination as h, AmountEncodingUnsupported as i, AmountMismatch as j, type AssetRfqPreparation as k, type AttestingRfqTransport as l, CORRIDOR_FACTORIES as m, type CancelInput as n, type CancelOutcome as o, type ClaimedDestination as p, ClientDisposed as q, type CorridorBase as r, type CorridorClaim as s, type CorridorCovenant as t, type CorridorDeadline as u, type CorridorDeps as v, type CorridorDepsByCorridor as w, type CorridorDrive as x, type CorridorLockup as y, type CorridorModule as z };
|
package/dist/protocol.cjs
CHANGED
|
@@ -1091,7 +1091,7 @@ async function deriveOffer(wallet, params) {
|
|
|
1091
1091
|
})()
|
|
1092
1092
|
]);
|
|
1093
1093
|
const operatorPubKey = import_base5.hex.decode((0, import_sdk5.toXOnlySignerHex)(info.signerPubkey));
|
|
1094
|
-
const network = (0, import_sdk5.
|
|
1094
|
+
const network = (0, import_sdk5.networkFromOperatorInfo)(info);
|
|
1095
1095
|
const emuKey = import_base5.hex.decode(
|
|
1096
1096
|
(0, import_sdk5.toXOnlySignerHex)((0, import_sdk5.resolveEmulatorPubkey)(network, params.emulatorPubkey))
|
|
1097
1097
|
);
|
|
@@ -1245,7 +1245,7 @@ async function connectFillContract(wallet, arkServerUrl, offer, opts = {}) {
|
|
|
1245
1245
|
const { swapAddress, emulator, emulatorPubkey } = opts;
|
|
1246
1246
|
const contractManager = await wallet.getContractManager();
|
|
1247
1247
|
const client = await import_sdk5.arkade.Arkade.connect({
|
|
1248
|
-
arkade: new import_sdk5.
|
|
1248
|
+
arkade: new import_sdk5.RestOperatorProvider(arkServerUrl),
|
|
1249
1249
|
indexer: new import_sdk5.RestIndexerProvider(arkServerUrl),
|
|
1250
1250
|
identity: wallet.identity,
|
|
1251
1251
|
contractManager,
|
|
@@ -1615,7 +1615,7 @@ var init_offer = __esm({
|
|
|
1615
1615
|
derivingClient = (wallet, info, contractManager) => import_sdk5.arkade.Arkade.connect({
|
|
1616
1616
|
arkade: { getInfo: async () => info },
|
|
1617
1617
|
identity: wallet.identity,
|
|
1618
|
-
network: (0, import_sdk5.
|
|
1618
|
+
network: (0, import_sdk5.networkFromOperatorInfo)(info),
|
|
1619
1619
|
contractManager
|
|
1620
1620
|
});
|
|
1621
1621
|
NoSpendableDepositError = class extends Error {
|
|
@@ -1732,7 +1732,7 @@ async function requestLightningSend(wallet, transport, params) {
|
|
|
1732
1732
|
);
|
|
1733
1733
|
}
|
|
1734
1734
|
const operatorPubkey = (0, import_sdk6.toXOnly)(import_base6.hex.decode(info.signerPubkey), "ark signer key");
|
|
1735
|
-
const network = (0, import_sdk6.
|
|
1735
|
+
const network = (0, import_sdk6.networkFromOperatorInfo)(info);
|
|
1736
1736
|
const derived = deriveLightningSend({
|
|
1737
1737
|
quote,
|
|
1738
1738
|
paymentHash: params.invoice.paymentHash,
|
|
@@ -1785,7 +1785,7 @@ async function requestArkadeSwap(wallet, transport, params) {
|
|
|
1785
1785
|
const makerPkScript = info === void 0 ? ownPkScript : resolveReceivePkScript(
|
|
1786
1786
|
receiveAddress,
|
|
1787
1787
|
ownPkScript,
|
|
1788
|
-
(0, import_sdk6.
|
|
1788
|
+
(0, import_sdk6.networkFromOperatorInfo)(info).hrp,
|
|
1789
1789
|
(0, import_sdk6.toXOnly)(import_base6.hex.decode(info.signerPubkey), "ark signer key")
|
|
1790
1790
|
);
|
|
1791
1791
|
const pair = rfqPair(
|
|
@@ -1945,7 +1945,7 @@ async function requestOnchainSend(wallet, transport, params) {
|
|
|
1945
1945
|
quote,
|
|
1946
1946
|
paymentHash,
|
|
1947
1947
|
payoutPubkey: params.payoutPubkey,
|
|
1948
|
-
...
|
|
1948
|
+
...operatorTerms(info, params.emulatorPubkey),
|
|
1949
1949
|
l1Network: l1NetworkFromArk(info.network),
|
|
1950
1950
|
refundAddress,
|
|
1951
1951
|
senderPubkey
|
|
@@ -2040,7 +2040,7 @@ async function requestLightningReceive(wallet, transport, params) {
|
|
|
2040
2040
|
paymentHash,
|
|
2041
2041
|
payoutPubkey,
|
|
2042
2042
|
payoutAddress,
|
|
2043
|
-
...
|
|
2043
|
+
...operatorTerms(info, params.emulatorPubkey)
|
|
2044
2044
|
});
|
|
2045
2045
|
const now = Math.floor(Date.now() / 1e3);
|
|
2046
2046
|
const { payDeadline } = verifyReceiveInvoice({
|
|
@@ -2133,7 +2133,7 @@ async function requestOnchainReceive(wallet, transport, params) {
|
|
|
2133
2133
|
payoutPubkey,
|
|
2134
2134
|
payoutAddress,
|
|
2135
2135
|
refundPubkey: params.refundPubkey,
|
|
2136
|
-
...
|
|
2136
|
+
...operatorTerms(info, params.emulatorPubkey),
|
|
2137
2137
|
l1Network: l1NetworkFromArk(info.network)
|
|
2138
2138
|
});
|
|
2139
2139
|
assertFundable({
|
|
@@ -2165,7 +2165,7 @@ async function requestOnchainReceive(wallet, transport, params) {
|
|
|
2165
2165
|
secrets
|
|
2166
2166
|
};
|
|
2167
2167
|
}
|
|
2168
|
-
var import_base6, import_solver_discovery, import_legacy2, import_sdk6, import_sdk7, solverHex, quoteSats, quoteAmountSats, quoteExpectedSats, ARKADE_BTC, LIGHTNING_BTC, ONCHAIN_BTC, arkadeAssetLeg, rfqPair, LIGHTNING_SEND_PAIR, LIGHTNING_RECEIVE_PAIR, ONCHAIN_SEND_PAIR, ONCHAIN_RECEIVE_PAIR, RFQ_TERMINAL_STATES, RFQ_REFUSAL_ERROR_CODES, isRfqRefusalErrorCode, REFUSAL_FIELDS, REFUSAL_UNITS, safeInteger, safeRefusalDetail, refusalMessage, SwapRefusal, AddressMismatch, newRfqId, lightningSendRequest, arkadeSwapRequest, canonicalAssetAmount, normalizeHexBytes, normalizeMakerPkScript, normalizeMakerPublicKey, MIN_HEADROOM_SECONDS, assertFinite, MAX_PAIR_LENGTH, assertPairLength, verifyLockupAddress, LOCKUP_SHAPE_VARIANTS, matchQuotedLockup, assertFundable, expectQuote, pairOf, httpTransport, relayTransport, SEQUENCE_GRANULARITY_SECONDS, SOLO_REFUND_HEADROOM_SECONDS, unilateralClaimDelay, unilateralRefundDelay, unilateralRefundWithoutReceiverDelay, seconds, suiteVhtlc, quotedSoloRefundDelay, offerTermsFromQuote, verifyOfferAddress, assertArkadeFundable, quoteCarrierSats, l1NetworkFromArk,
|
|
2168
|
+
var import_base6, import_solver_discovery, import_legacy2, import_sdk6, import_sdk7, solverHex, quoteSats, quoteAmountSats, quoteExpectedSats, ARKADE_BTC, LIGHTNING_BTC, ONCHAIN_BTC, arkadeAssetLeg, rfqPair, LIGHTNING_SEND_PAIR, LIGHTNING_RECEIVE_PAIR, ONCHAIN_SEND_PAIR, ONCHAIN_RECEIVE_PAIR, RFQ_TERMINAL_STATES, RFQ_REFUSAL_ERROR_CODES, isRfqRefusalErrorCode, REFUSAL_FIELDS, REFUSAL_UNITS, safeInteger, safeRefusalDetail, refusalMessage, SwapRefusal, AddressMismatch, newRfqId, lightningSendRequest, arkadeSwapRequest, canonicalAssetAmount, normalizeHexBytes, normalizeMakerPkScript, normalizeMakerPublicKey, MIN_HEADROOM_SECONDS, assertFinite, MAX_PAIR_LENGTH, assertPairLength, verifyLockupAddress, LOCKUP_SHAPE_VARIANTS, matchQuotedLockup, assertFundable, expectQuote, pairOf, httpTransport, relayTransport, SEQUENCE_GRANULARITY_SECONDS, SOLO_REFUND_HEADROOM_SECONDS, unilateralClaimDelay, unilateralRefundDelay, unilateralRefundWithoutReceiverDelay, seconds, suiteVhtlc, quotedSoloRefundDelay, offerTermsFromQuote, verifyOfferAddress, assertArkadeFundable, quoteCarrierSats, l1NetworkFromArk, operatorTerms, onchainSendRequest, lightningReceiveRequest, onchainReceiveRequest, assertQuotedAmount, MIN_CLAIM_WINDOW_SECONDS, verifyReceiveInvoice, assertReceivable, matchReceiveLockup, provisionReceive, quoteReceive;
|
|
2169
2169
|
var init_rfq = __esm({
|
|
2170
2170
|
"src/rfq.ts"() {
|
|
2171
2171
|
"use strict";
|
|
@@ -2730,8 +2730,8 @@ var init_rfq = __esm({
|
|
|
2730
2730
|
return published > 0n ? published : ASSET_CARRIER_SATS;
|
|
2731
2731
|
};
|
|
2732
2732
|
l1NetworkFromArk = (network) => network === "bitcoin" ? "bitcoin" : network === "regtest" ? "regtest" : "testnet";
|
|
2733
|
-
|
|
2734
|
-
const network = (0, import_sdk6.
|
|
2733
|
+
operatorTerms = (info, emulatorPubkey) => {
|
|
2734
|
+
const network = (0, import_sdk6.networkFromOperatorInfo)(info);
|
|
2735
2735
|
return {
|
|
2736
2736
|
operatorPubkey: (0, import_sdk6.toXOnly)(import_base6.hex.decode(info.signerPubkey), "ark signer key"),
|
|
2737
2737
|
emulatorPubkey: (0, import_sdk6.toXOnly)(
|
|
@@ -3577,7 +3577,7 @@ var operatorUnrollScript = async (operator, network) => {
|
|
|
3577
3577
|
const info = await operator.getInfo();
|
|
3578
3578
|
return (0, import_sdk8.assertValidServerUnrollScript)(
|
|
3579
3579
|
info.checkpointTapscript,
|
|
3580
|
-
network ?? (0, import_sdk8.
|
|
3580
|
+
network ?? (0, import_sdk8.networkFromOperatorInfo)(info),
|
|
3581
3581
|
(0, import_sdk8.toXOnly)(import_base7.hex.decode(info.forfeitPubkey), "forfeit key")
|
|
3582
3582
|
);
|
|
3583
3583
|
};
|
package/dist/protocol.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ProvisionedKey, ProvisionedClaimSecret, RestIndexerProvider, Transaction, ActivityResolver, IWallet, Network, OnchainProvider, VHTLC, Identity, Asset, PaymentRail } from '@arkade-os/sdk';
|
|
2
|
-
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-
|
|
3
|
-
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-
|
|
4
|
-
import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-
|
|
5
|
-
export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-
|
|
6
|
-
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-
|
|
2
|
+
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-Cut4eEkm.cjs';
|
|
3
|
+
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-Cut4eEkm.cjs';
|
|
4
|
+
import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-CP-P0PSL.cjs';
|
|
5
|
+
export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-CP-P0PSL.cjs';
|
|
6
|
+
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-QfbsjyXG.cjs';
|
|
7
7
|
import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
|
|
8
|
-
import { O as Offer } from './offer-
|
|
9
|
-
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-
|
|
10
|
-
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-
|
|
8
|
+
import { O as Offer } from './offer-BxzPQ6zh.cjs';
|
|
9
|
+
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-BxzPQ6zh.cjs';
|
|
10
|
+
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-D4PeBZ3H.cjs';
|
|
11
11
|
|
|
12
12
|
/** Which wallet key signs this leg, at `profile.signer`. Omitted entirely (not blank) by a corridor
|
|
13
13
|
* whose leg this wallet never signs. */
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ProvisionedKey, ProvisionedClaimSecret, RestIndexerProvider, Transaction, ActivityResolver, IWallet, Network, OnchainProvider, VHTLC, Identity, Asset, PaymentRail } from '@arkade-os/sdk';
|
|
2
|
-
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-
|
|
3
|
-
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-
|
|
4
|
-
import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-
|
|
5
|
-
export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-
|
|
6
|
-
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-
|
|
2
|
+
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-BOQ1qYoj.js';
|
|
3
|
+
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-BOQ1qYoj.js';
|
|
4
|
+
import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-CP-P0PSL.js';
|
|
5
|
+
export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-CP-P0PSL.js';
|
|
6
|
+
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-CdXh9yIr.js';
|
|
7
7
|
import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
|
|
8
|
-
import { O as Offer } from './offer-
|
|
9
|
-
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-
|
|
10
|
-
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-
|
|
8
|
+
import { O as Offer } from './offer-Q1lVhrVX.js';
|
|
9
|
+
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-Q1lVhrVX.js';
|
|
10
|
+
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-D15U0QpD.js';
|
|
11
11
|
|
|
12
12
|
/** Which wallet key signs this leg, at `profile.signer`. Omitted entirely (not blank) by a corridor
|
|
13
13
|
* whose leg this wallet never signs. */
|
package/dist/protocol.js
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
validatePlan,
|
|
43
43
|
watchMarkets,
|
|
44
44
|
watchOfferSwaps
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-GJKGPE3S.js";
|
|
46
46
|
import {
|
|
47
47
|
ARKADE_BTC,
|
|
48
48
|
ASSET_CARRIER_SATS,
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
verifyLockupAddress,
|
|
129
129
|
verifyOfferAddress,
|
|
130
130
|
verifyReceiveInvoice
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-7BBQ74BG.js";
|
|
132
132
|
import {
|
|
133
133
|
collectRfqSwaps
|
|
134
134
|
} from "./chunk-A3SHHRX4.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RealmLike } from '@arkade-os/sdk/repositories/realm';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-Cut4eEkm.cjs';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
|
-
import '../../rfq-
|
|
5
|
+
import '../../rfq-CP-P0PSL.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Realm backend for React Native.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RealmLike } from '@arkade-os/sdk/repositories/realm';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-BOQ1qYoj.js';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
|
-
import '../../rfq-
|
|
5
|
+
import '../../rfq-CP-P0PSL.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Realm backend for React Native.
|
|
@@ -75,46 +75,46 @@ var SQLiteAssetSwapRepository = class {
|
|
|
75
75
|
* while `initPromise` stayed resolved and every later statement failed with
|
|
76
76
|
* `no such table`. */
|
|
77
77
|
async init() {
|
|
78
|
-
await this.withTx(async () => {
|
|
79
|
-
await
|
|
78
|
+
await this.withTx(async (tx) => {
|
|
79
|
+
await tx.run(`CREATE TABLE IF NOT EXISTS ${this.swaps} (
|
|
80
80
|
id TEXT PRIMARY KEY,
|
|
81
81
|
status TEXT NOT NULL,
|
|
82
82
|
created_at INTEGER NOT NULL,
|
|
83
83
|
data TEXT NOT NULL
|
|
84
84
|
)`);
|
|
85
|
-
await
|
|
85
|
+
await tx.run(
|
|
86
86
|
`CREATE INDEX IF NOT EXISTS idx_${this.prefix}asset_swaps_status ON ${this.swaps} (status)`
|
|
87
87
|
);
|
|
88
|
-
await
|
|
88
|
+
await tx.run(
|
|
89
89
|
`CREATE INDEX IF NOT EXISTS idx_${this.prefix}asset_swaps_created_at ON ${this.swaps} (created_at)`
|
|
90
90
|
);
|
|
91
|
-
await
|
|
91
|
+
await tx.run(`CREATE TABLE IF NOT EXISTS ${this.rfqSwaps} (
|
|
92
92
|
rfq_id TEXT PRIMARY KEY,
|
|
93
93
|
state TEXT NOT NULL,
|
|
94
94
|
updated_at INTEGER NOT NULL,
|
|
95
95
|
data TEXT NOT NULL
|
|
96
96
|
)`);
|
|
97
|
-
await
|
|
97
|
+
await tx.run(
|
|
98
98
|
`CREATE INDEX IF NOT EXISTS idx_${this.prefix}rfq_updated ON ${this.rfqSwaps} (updated_at, rfq_id)`
|
|
99
99
|
);
|
|
100
|
-
await
|
|
100
|
+
await tx.run(
|
|
101
101
|
`CREATE INDEX IF NOT EXISTS idx_${this.prefix}rfq_swaps_history ON ${this.rfqSwaps} (state, updated_at, rfq_id)`
|
|
102
102
|
);
|
|
103
|
-
await
|
|
104
|
-
await
|
|
103
|
+
await tx.run(`DROP INDEX IF EXISTS idx_${this.prefix}rfq_swaps_page`);
|
|
104
|
+
await tx.run(
|
|
105
105
|
`CREATE INDEX IF NOT EXISTS idx_${this.prefix}rfq_swaps_state ON ${this.rfqSwaps} (state)`
|
|
106
106
|
);
|
|
107
|
-
await
|
|
107
|
+
await tx.run(`CREATE TABLE IF NOT EXISTS ${this.swapRecords} (
|
|
108
108
|
id TEXT PRIMARY KEY,
|
|
109
109
|
family TEXT NOT NULL,
|
|
110
110
|
updated_at INTEGER NOT NULL,
|
|
111
111
|
data TEXT NOT NULL
|
|
112
112
|
)`);
|
|
113
|
-
await
|
|
113
|
+
await tx.run(
|
|
114
114
|
`CREATE INDEX IF NOT EXISTS idx_${this.prefix}swap_records_family ON ${this.swapRecords} (family)`
|
|
115
115
|
);
|
|
116
|
-
await
|
|
117
|
-
await
|
|
116
|
+
await tx.run(`CREATE TABLE IF NOT EXISTS ${this.scanned} (txid TEXT PRIMARY KEY)`);
|
|
117
|
+
await tx.run(
|
|
118
118
|
`CREATE TABLE IF NOT EXISTS ${this.markets} (cache_key TEXT PRIMARY KEY, data TEXT NOT NULL)`
|
|
119
119
|
);
|
|
120
120
|
});
|
|
@@ -122,7 +122,7 @@ var SQLiteAssetSwapRepository = class {
|
|
|
122
122
|
/** Every write, including the single-statement ones. The chain serializes
|
|
123
123
|
* transaction *blocks*, not bare statements: one issued between a
|
|
124
124
|
* neighbour's BEGIN IMMEDIATE and its COMMIT becomes part of that
|
|
125
|
-
* transaction and dies with it. `fn` must
|
|
125
|
+
* transaction and dies with it. `fn` must use its supplied raw executor — no
|
|
126
126
|
* repository method, no `ensureInit` — since `runInTransaction` cannot
|
|
127
127
|
* nest. */
|
|
128
128
|
withTx(fn) {
|
|
@@ -130,8 +130,8 @@ var SQLiteAssetSwapRepository = class {
|
|
|
130
130
|
}
|
|
131
131
|
async saveSwap(swap) {
|
|
132
132
|
await this.ensureInit();
|
|
133
|
-
await this.withTx(async () => {
|
|
134
|
-
await
|
|
133
|
+
await this.withTx(async (tx) => {
|
|
134
|
+
await tx.run(
|
|
135
135
|
`INSERT OR REPLACE INTO ${this.swaps} (id, status, created_at, data)
|
|
136
136
|
VALUES (?, ?, ?, ?)`,
|
|
137
137
|
[swap.id, swap.status, swap.createdAt, JSON.stringify(swap)]
|
|
@@ -143,8 +143,8 @@ var SQLiteAssetSwapRepository = class {
|
|
|
143
143
|
}
|
|
144
144
|
async saveRfqSwap(record) {
|
|
145
145
|
await this.ensureInit();
|
|
146
|
-
await this.withTx(async () => {
|
|
147
|
-
await
|
|
146
|
+
await this.withTx(async (tx) => {
|
|
147
|
+
await tx.run(
|
|
148
148
|
`INSERT OR REPLACE INTO ${this.rfqSwaps} (rfq_id, state, updated_at, data)
|
|
149
149
|
VALUES (?, ?, ?, ?)`,
|
|
150
150
|
[record.rfqId, record.state, record.updatedAt, JSON.stringify(record)]
|
|
@@ -194,14 +194,14 @@ var SQLiteAssetSwapRepository = class {
|
|
|
194
194
|
}
|
|
195
195
|
async removeRfqSwap(rfqId) {
|
|
196
196
|
await this.ensureInit();
|
|
197
|
-
await this.withTx(async () => {
|
|
198
|
-
await
|
|
197
|
+
await this.withTx(async (tx) => {
|
|
198
|
+
await tx.run(`DELETE FROM ${this.rfqSwaps} WHERE rfq_id = ?`, [rfqId]);
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
async saveSwapRecord(record) {
|
|
202
202
|
await this.ensureInit();
|
|
203
|
-
await this.withTx(async () => {
|
|
204
|
-
await
|
|
203
|
+
await this.withTx(async (tx) => {
|
|
204
|
+
await tx.run(
|
|
205
205
|
`INSERT OR REPLACE INTO ${this.swapRecords} (id, family, updated_at, data)
|
|
206
206
|
VALUES (?, ?, ?, ?)`,
|
|
207
207
|
[record.id, record.family, record.updatedAt, JSON.stringify(record)]
|
|
@@ -234,8 +234,8 @@ var SQLiteAssetSwapRepository = class {
|
|
|
234
234
|
}
|
|
235
235
|
async removeSwapRecord(id) {
|
|
236
236
|
await this.ensureInit();
|
|
237
|
-
await this.withTx(async () => {
|
|
238
|
-
await
|
|
237
|
+
await this.withTx(async (tx) => {
|
|
238
|
+
await tx.run(`DELETE FROM ${this.swapRecords} WHERE id = ?`, [id]);
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
async getScannedTxids() {
|
|
@@ -247,10 +247,10 @@ var SQLiteAssetSwapRepository = class {
|
|
|
247
247
|
await this.ensureInit();
|
|
248
248
|
const all = [...txids];
|
|
249
249
|
if (all.length === 0) return;
|
|
250
|
-
await this.withTx(async () => {
|
|
250
|
+
await this.withTx(async (tx) => {
|
|
251
251
|
for (let i = 0; i < all.length; i += INSERT_CHUNK) {
|
|
252
252
|
const chunk = all.slice(i, i + INSERT_CHUNK);
|
|
253
|
-
await
|
|
253
|
+
await tx.run(
|
|
254
254
|
`INSERT OR IGNORE INTO ${this.scanned} (txid) VALUES ${chunk.map(() => "(?)").join(", ")}`,
|
|
255
255
|
chunk
|
|
256
256
|
);
|
|
@@ -267,11 +267,11 @@ var SQLiteAssetSwapRepository = class {
|
|
|
267
267
|
}
|
|
268
268
|
async saveCachedMarkets(network, registry, entry) {
|
|
269
269
|
await this.ensureInit();
|
|
270
|
-
await this.withTx(async () => {
|
|
271
|
-
await
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
);
|
|
270
|
+
await this.withTx(async (tx) => {
|
|
271
|
+
await tx.run(`INSERT OR REPLACE INTO ${this.markets} (cache_key, data) VALUES (?, ?)`, [
|
|
272
|
+
marketsCacheKey(network, registry),
|
|
273
|
+
JSON.stringify(entry)
|
|
274
|
+
]);
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
277
|
/** Every table in one transaction: clearing swaps but keeping scanned txids
|
|
@@ -279,12 +279,12 @@ var SQLiteAssetSwapRepository = class {
|
|
|
279
279
|
* partial clear must not be observable. */
|
|
280
280
|
async clear() {
|
|
281
281
|
await this.ensureInit();
|
|
282
|
-
await this.withTx(async () => {
|
|
283
|
-
await
|
|
284
|
-
await
|
|
285
|
-
await
|
|
286
|
-
await
|
|
287
|
-
await
|
|
282
|
+
await this.withTx(async (tx) => {
|
|
283
|
+
await tx.run(`DELETE FROM ${this.swaps}`);
|
|
284
|
+
await tx.run(`DELETE FROM ${this.rfqSwaps}`);
|
|
285
|
+
await tx.run(`DELETE FROM ${this.swapRecords}`);
|
|
286
|
+
await tx.run(`DELETE FROM ${this.scanned}`);
|
|
287
|
+
await tx.run(`DELETE FROM ${this.markets}`);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
290
|
async [Symbol.asyncDispose]() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-Cut4eEkm.cjs';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
|
-
import '../../rfq-
|
|
5
|
+
import '../../rfq-CP-P0PSL.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* SQLite backend over the SDK's `SQLExecutor`, so any driver plugs in
|
|
@@ -53,7 +53,7 @@ declare class SQLiteAssetSwapRepository implements AssetSwapRepository {
|
|
|
53
53
|
/** Every write, including the single-statement ones. The chain serializes
|
|
54
54
|
* transaction *blocks*, not bare statements: one issued between a
|
|
55
55
|
* neighbour's BEGIN IMMEDIATE and its COMMIT becomes part of that
|
|
56
|
-
* transaction and dies with it. `fn` must
|
|
56
|
+
* transaction and dies with it. `fn` must use its supplied raw executor — no
|
|
57
57
|
* repository method, no `ensureInit` — since `runInTransaction` cannot
|
|
58
58
|
* nest. */
|
|
59
59
|
private withTx;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-BOQ1qYoj.js';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
|
-
import '../../rfq-
|
|
5
|
+
import '../../rfq-CP-P0PSL.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* SQLite backend over the SDK's `SQLExecutor`, so any driver plugs in
|
|
@@ -53,7 +53,7 @@ declare class SQLiteAssetSwapRepository implements AssetSwapRepository {
|
|
|
53
53
|
/** Every write, including the single-statement ones. The chain serializes
|
|
54
54
|
* transaction *blocks*, not bare statements: one issued between a
|
|
55
55
|
* neighbour's BEGIN IMMEDIATE and its COMMIT becomes part of that
|
|
56
|
-
* transaction and dies with it. `fn` must
|
|
56
|
+
* transaction and dies with it. `fn` must use its supplied raw executor — no
|
|
57
57
|
* repository method, no `ensureInit` — since `runInTransaction` cannot
|
|
58
58
|
* nest. */
|
|
59
59
|
private withTx;
|