@arkade-os/swap 0.1.0-rc.21 → 0.1.0-rc.23
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 +7 -2
- package/dist/advanced.cjs +875 -129
- package/dist/advanced.d.cts +158 -14
- package/dist/advanced.d.ts +158 -14
- package/dist/advanced.js +255 -4
- package/dist/{chunk-ITFCQWPG.js → chunk-DQ2DY2L2.js} +223 -11
- package/dist/{chunk-HUQQVBC4.js → chunk-MZX62KMU.js} +220 -12
- package/dist/{chunk-PVB7EBAM.js → chunk-UFJEO4VV.js} +47 -21
- package/dist/{errors-hm7aqnRM.d.cts → errors-5q4e3PnH.d.cts} +48 -16
- package/dist/{errors-C3h8ANmE.d.ts → errors-DQ35FKJf.d.ts} +48 -16
- package/dist/index.cjs +670 -185
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -3
- package/dist/node/index.d.cts +26 -4
- package/dist/node/index.d.ts +26 -4
- package/dist/nostr.cjs +12 -9
- package/dist/nostr.d.cts +1 -1
- package/dist/nostr.d.ts +1 -1
- package/dist/nostr.js +3 -1
- package/dist/{offer-Bd9Yvd8Z.d.ts → offer--IpfzhIm.d.ts} +1 -1
- package/dist/{offer-F88rtL_I.d.cts → offer-DqTXQeP1.d.cts} +1 -1
- package/dist/protocol.cjs +395 -156
- package/dist/protocol.d.cts +45 -8
- package/dist/protocol.d.ts +45 -8
- package/dist/protocol.js +10 -3
- 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-DYnRLPt-.d.ts → repository-B4rQWmS2.d.cts} +88 -20
- package/dist/{repository-BuYWGAKz.d.cts → repository-D_qvJk1S.d.ts} +88 -20
- package/dist/{rfq-60PGpQ_x.d.cts → rfq-BgdgO9OO.d.cts} +16 -7
- package/dist/{rfq-60PGpQ_x.d.ts → rfq-BgdgO9OO.d.ts} +16 -7
- package/dist/{watch-BTyiBLSd.d.ts → watch-BkPz0vf8.d.ts} +1 -1
- package/dist/{watch-M_KY-5ho.d.cts → watch-RRhKuBkh.d.cts} +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot,
|
|
2
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-
|
|
3
|
-
export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-
|
|
4
|
-
export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-
|
|
1
|
+
export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DEFAULT_MAX_REFUND_WINDOW_SECONDS, G as DiscoveryConfig, d as DiscoverySnapshot, I as DiscoverySnapshotUnavailable, J as DriveMode, N as ExchangeOptions, Q as FeeCeiling, V as InconsistentRoute, W as InsufficientFunds, Y as Market, Z as MaxFeeExceeded, _ as MissingCorridorDep, $ as NotCancellable, a5 as OperatorUnreachable, a7 as PayOptions, a8 as PayResult, a9 as QuoteCheck, aa as QuoteExpired, ac as QuoteVerificationFailed, ad as REGISTRY_URL, ae as ReceiveArtifact, af as ReceiveOptions, ag as ReceiveRequest, ah as RecoveryResult, ai as RegisteredAsset, aj as RfqAuctionPolicy, an as RfqTransportFactory, ap as SWAP_ERROR_NAMES, aq as SwapClient, ar as SwapClientConfig, au as SwapDriveRefusedError, av as SwapError, aw as SwapErrorName, ax as SwapFilter, S as SwapPolicy, ay as UnsupportedRoute, az as VerbDeps, aD as canonicalAssetId, aI as createSwapClient, aN as exchange, aT as isSwapError, a$ as pay, b3 as receive } from './errors-5q4e3PnH.cjs';
|
|
2
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-B4rQWmS2.cjs';
|
|
3
|
+
export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-B4rQWmS2.cjs';
|
|
4
|
+
export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-BgdgO9OO.cjs';
|
|
5
5
|
import { PageRequest, PageResult, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
|
|
6
6
|
export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-5r5RlgOJ.cjs';
|
|
7
7
|
import '@arkade-os/solver-discovery';
|
|
8
|
-
import './offer-
|
|
8
|
+
import './offer-DqTXQeP1.cjs';
|
|
9
9
|
|
|
10
10
|
/** Browser backend over the SDK's shared IndexedDB manager. */
|
|
11
11
|
declare class IndexedDbAssetSwapRepository implements AssetSwapRepository {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot,
|
|
2
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-
|
|
3
|
-
export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-
|
|
4
|
-
export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-
|
|
1
|
+
export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DEFAULT_MAX_REFUND_WINDOW_SECONDS, G as DiscoveryConfig, d as DiscoverySnapshot, I as DiscoverySnapshotUnavailable, J as DriveMode, N as ExchangeOptions, Q as FeeCeiling, V as InconsistentRoute, W as InsufficientFunds, Y as Market, Z as MaxFeeExceeded, _ as MissingCorridorDep, $ as NotCancellable, a5 as OperatorUnreachable, a7 as PayOptions, a8 as PayResult, a9 as QuoteCheck, aa as QuoteExpired, ac as QuoteVerificationFailed, ad as REGISTRY_URL, ae as ReceiveArtifact, af as ReceiveOptions, ag as ReceiveRequest, ah as RecoveryResult, ai as RegisteredAsset, aj as RfqAuctionPolicy, an as RfqTransportFactory, ap as SWAP_ERROR_NAMES, aq as SwapClient, ar as SwapClientConfig, au as SwapDriveRefusedError, av as SwapError, aw as SwapErrorName, ax as SwapFilter, S as SwapPolicy, ay as UnsupportedRoute, az as VerbDeps, aD as canonicalAssetId, aI as createSwapClient, aN as exchange, aT as isSwapError, a$ as pay, b3 as receive } from './errors-DQ35FKJf.js';
|
|
2
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-D_qvJk1S.js';
|
|
3
|
+
export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-D_qvJk1S.js';
|
|
4
|
+
export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-BgdgO9OO.js';
|
|
5
5
|
import { PageRequest, PageResult, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
|
|
6
6
|
export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-5r5RlgOJ.js';
|
|
7
7
|
import '@arkade-os/solver-discovery';
|
|
8
|
-
import './offer
|
|
8
|
+
import './offer--IpfzhIm.js';
|
|
9
9
|
|
|
10
10
|
/** Browser backend over the SDK's shared IndexedDB manager. */
|
|
11
11
|
declare class IndexedDbAssetSwapRepository implements AssetSwapRepository {
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
BITCOIN_RAILS,
|
|
11
11
|
BTC_ASSET_PART,
|
|
12
12
|
ClientDisposed,
|
|
13
|
+
DEFAULT_MAX_REFUND_WINDOW_SECONDS,
|
|
13
14
|
DiscoverySnapshotUnavailable,
|
|
14
15
|
InconsistentRoute,
|
|
15
16
|
InsufficientFunds,
|
|
@@ -61,10 +62,10 @@ import {
|
|
|
61
62
|
sameAsset,
|
|
62
63
|
swapHandle,
|
|
63
64
|
toAtomicDecimal
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-MZX62KMU.js";
|
|
65
66
|
import {
|
|
66
67
|
isRfqSwapTerminal
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-DQ2DY2L2.js";
|
|
68
69
|
import {
|
|
69
70
|
CLAIM_PACKET_TYPE,
|
|
70
71
|
LockupRegistrationFailed,
|
|
@@ -74,7 +75,7 @@ import {
|
|
|
74
75
|
appendArkadeScript,
|
|
75
76
|
claimPacketShape,
|
|
76
77
|
isRfqRefusalErrorCode
|
|
77
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-UFJEO4VV.js";
|
|
78
79
|
import {
|
|
79
80
|
InMemoryAssetSwapRepository,
|
|
80
81
|
assertRfqSwapPageFilter,
|
|
@@ -353,6 +354,7 @@ export {
|
|
|
353
354
|
BTC_ASSET_PART,
|
|
354
355
|
CLAIM_PACKET_TYPE,
|
|
355
356
|
ClientDisposed,
|
|
357
|
+
DEFAULT_MAX_REFUND_WINDOW_SECONDS,
|
|
356
358
|
DiscoverySnapshotUnavailable,
|
|
357
359
|
InMemoryAssetSwapRepository,
|
|
358
360
|
InconsistentRoute,
|
package/dist/node/index.d.cts
CHANGED
|
@@ -179,7 +179,8 @@ interface RfqSwapCommon {
|
|
|
179
179
|
refundLocktime: number;
|
|
180
180
|
createdAt: number;
|
|
181
181
|
updatedAt: number;
|
|
182
|
-
/**
|
|
182
|
+
/** The trader's own refund: the `refundWithoutReceiver` push that landed, or on
|
|
183
|
+
* `onchain_receive` the L1 HTLC refund. */
|
|
183
184
|
refundTxid?: string;
|
|
184
185
|
/**
|
|
185
186
|
* The ark transactions that SPENT the lockup, from the chain read that ended the swap
|
|
@@ -257,12 +258,33 @@ interface LightningReceiveSwap extends RfqSwapCommon {
|
|
|
257
258
|
* and never from a chain read — the chain's answer is `settled`. */
|
|
258
259
|
claimTxid?: string;
|
|
259
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* `onchain:BTC->arkade:BTC`. A {@link LightningReceiveSwap}'s lockup plus an L1
|
|
263
|
+
* HTLC the trader funds and must take back itself. That refund leaf does not
|
|
264
|
+
* expire, so the failure to drive against is the manager finishing the swap
|
|
265
|
+
* while the output still holds the trader's money.
|
|
266
|
+
*/
|
|
267
|
+
interface OnchainReceiveSwap extends RfqSwapCommon {
|
|
268
|
+
kind: "onchain_receive";
|
|
269
|
+
expectedAmount: number;
|
|
270
|
+
/** Its `refundLocktime` is the trader's own, NOT {@link RfqSwapCommon}'s. */
|
|
271
|
+
htlc: OnchainHtlc;
|
|
272
|
+
minConfirmations: number;
|
|
273
|
+
/** Required, unlike the send leg's optional `payoutPkScript`: without it
|
|
274
|
+
* the refund cannot be built at all. */
|
|
275
|
+
refundPkScript: Uint8Array;
|
|
276
|
+
funding?: {
|
|
277
|
+
txid: string;
|
|
278
|
+
vout: number;
|
|
279
|
+
};
|
|
280
|
+
claimTxid?: string;
|
|
281
|
+
}
|
|
260
282
|
|
|
261
283
|
/**
|
|
262
|
-
* The swap kinds this projection covers — all
|
|
263
|
-
* ride in
|
|
284
|
+
* The swap kinds this projection covers — all four the manager monitors. The onchain legs' L1 keys
|
|
285
|
+
* ride in their profiles, since no contract row or `OnchainHtlc` field can give them back.
|
|
264
286
|
*/
|
|
265
|
-
type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap;
|
|
287
|
+
type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap | OnchainReceiveSwap;
|
|
266
288
|
/** The immutable request-time half, and only what EVERY corridor has. Hex for
|
|
267
289
|
* everything binary, so the record is plain JSON and survives any
|
|
268
290
|
* structured-clone backend unchanged. */
|
package/dist/node/index.d.ts
CHANGED
|
@@ -179,7 +179,8 @@ interface RfqSwapCommon {
|
|
|
179
179
|
refundLocktime: number;
|
|
180
180
|
createdAt: number;
|
|
181
181
|
updatedAt: number;
|
|
182
|
-
/**
|
|
182
|
+
/** The trader's own refund: the `refundWithoutReceiver` push that landed, or on
|
|
183
|
+
* `onchain_receive` the L1 HTLC refund. */
|
|
183
184
|
refundTxid?: string;
|
|
184
185
|
/**
|
|
185
186
|
* The ark transactions that SPENT the lockup, from the chain read that ended the swap
|
|
@@ -257,12 +258,33 @@ interface LightningReceiveSwap extends RfqSwapCommon {
|
|
|
257
258
|
* and never from a chain read — the chain's answer is `settled`. */
|
|
258
259
|
claimTxid?: string;
|
|
259
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* `onchain:BTC->arkade:BTC`. A {@link LightningReceiveSwap}'s lockup plus an L1
|
|
263
|
+
* HTLC the trader funds and must take back itself. That refund leaf does not
|
|
264
|
+
* expire, so the failure to drive against is the manager finishing the swap
|
|
265
|
+
* while the output still holds the trader's money.
|
|
266
|
+
*/
|
|
267
|
+
interface OnchainReceiveSwap extends RfqSwapCommon {
|
|
268
|
+
kind: "onchain_receive";
|
|
269
|
+
expectedAmount: number;
|
|
270
|
+
/** Its `refundLocktime` is the trader's own, NOT {@link RfqSwapCommon}'s. */
|
|
271
|
+
htlc: OnchainHtlc;
|
|
272
|
+
minConfirmations: number;
|
|
273
|
+
/** Required, unlike the send leg's optional `payoutPkScript`: without it
|
|
274
|
+
* the refund cannot be built at all. */
|
|
275
|
+
refundPkScript: Uint8Array;
|
|
276
|
+
funding?: {
|
|
277
|
+
txid: string;
|
|
278
|
+
vout: number;
|
|
279
|
+
};
|
|
280
|
+
claimTxid?: string;
|
|
281
|
+
}
|
|
260
282
|
|
|
261
283
|
/**
|
|
262
|
-
* The swap kinds this projection covers — all
|
|
263
|
-
* ride in
|
|
284
|
+
* The swap kinds this projection covers — all four the manager monitors. The onchain legs' L1 keys
|
|
285
|
+
* ride in their profiles, since no contract row or `OnchainHtlc` field can give them back.
|
|
264
286
|
*/
|
|
265
|
-
type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap;
|
|
287
|
+
type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap | OnchainReceiveSwap;
|
|
266
288
|
/** The immutable request-time half, and only what EVERY corridor has. Hex for
|
|
267
289
|
* everything binary, so the record is plain JSON and survives any
|
|
268
290
|
* structured-clone backend unchanged. */
|
package/dist/nostr.cjs
CHANGED
|
@@ -42,13 +42,14 @@ module.exports = __toCommonJS(nostr_exports);
|
|
|
42
42
|
var import_base6 = require("@scure/base");
|
|
43
43
|
var import_solver_discovery = require("@arkade-os/solver-discovery");
|
|
44
44
|
var import_legacy2 = require("@noble/hashes/legacy.js");
|
|
45
|
-
var
|
|
45
|
+
var import_sdk6 = require("@arkade-os/sdk");
|
|
46
46
|
|
|
47
47
|
// src/onchainHtlc.ts
|
|
48
48
|
var import_base = require("@scure/base");
|
|
49
49
|
var import_sha2 = require("@noble/hashes/sha2.js");
|
|
50
50
|
var import_legacy = require("@noble/hashes/legacy.js");
|
|
51
51
|
var btc = __toESM(require("@scure/btc-signer"), 1);
|
|
52
|
+
var import_sdk = require("@arkade-os/sdk");
|
|
52
53
|
var ONCHAIN_ORDER_MARGIN_SECONDS = 2 * 60 * 60;
|
|
53
54
|
var ONCHAIN_CLAIM_MARGIN_SECONDS = 90 * 60;
|
|
54
55
|
var ONCHAIN_DUST_SATS = BigInt(330);
|
|
@@ -59,7 +60,7 @@ var L1_NETWORKS = {
|
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
// src/rfq.ts
|
|
62
|
-
var
|
|
63
|
+
var import_sdk7 = require("@arkade-os/sdk");
|
|
63
64
|
|
|
64
65
|
// src/claimPacket.ts
|
|
65
66
|
var import_base2 = require("@scure/base");
|
|
@@ -72,12 +73,12 @@ var HKDF_INFO = new TextEncoder().encode("covclaimd/preimage/v1");
|
|
|
72
73
|
|
|
73
74
|
// src/lockupContract.ts
|
|
74
75
|
var import_base3 = require("@scure/base");
|
|
75
|
-
var
|
|
76
|
+
var import_sdk2 = require("@arkade-os/sdk");
|
|
76
77
|
|
|
77
78
|
// src/offer.ts
|
|
78
79
|
var import_base5 = require("@scure/base");
|
|
79
80
|
var import_utils2 = require("@scure/btc-signer/utils.js");
|
|
80
|
-
var
|
|
81
|
+
var import_sdk5 = require("@arkade-os/sdk");
|
|
81
82
|
|
|
82
83
|
// src/swap-want-asset.program.json
|
|
83
84
|
var swap_want_asset_program_default = {
|
|
@@ -157,15 +158,15 @@ var swap_want_btc_program_default = {
|
|
|
157
158
|
// src/store.ts
|
|
158
159
|
var import_base4 = require("@scure/base");
|
|
159
160
|
var import_sha23 = require("@noble/hashes/sha2.js");
|
|
160
|
-
var
|
|
161
|
+
var import_sdk4 = require("@arkade-os/sdk");
|
|
161
162
|
|
|
162
163
|
// src/repository.ts
|
|
163
|
-
var
|
|
164
|
+
var import_sdk3 = require("@arkade-os/sdk");
|
|
164
165
|
|
|
165
166
|
// src/offer.ts
|
|
166
167
|
var swapPrograms = {
|
|
167
|
-
wantAsset:
|
|
168
|
-
wantBtc:
|
|
168
|
+
wantAsset: import_sdk5.arkade.parseArtifact(swap_want_asset_program_default),
|
|
169
|
+
wantBtc: import_sdk5.arkade.parseArtifact(swap_want_btc_program_default)
|
|
169
170
|
};
|
|
170
171
|
var FIELDS = {
|
|
171
172
|
swapPkScript: { tag: 1, width: 34 },
|
|
@@ -180,7 +181,7 @@ var FIELDS = {
|
|
|
180
181
|
exitTimelock: { tag: 12, width: 9 }
|
|
181
182
|
};
|
|
182
183
|
var NAMES = Object.fromEntries(Object.entries(FIELDS).map(([k, f]) => [f.tag, k]));
|
|
183
|
-
var ASSET_CARRIER_SATS = BigInt(
|
|
184
|
+
var ASSET_CARRIER_SATS = BigInt(import_sdk5.ASSET_CARRIER_SATS);
|
|
184
185
|
|
|
185
186
|
// src/rfq.ts
|
|
186
187
|
var ARKADE_BTC = "arkade:BTC";
|
|
@@ -296,6 +297,7 @@ var SOLO_REFUND_HEADROOM_SECONDS = 8 * SEQUENCE_GRANULARITY_SECONDS;
|
|
|
296
297
|
var MIN_CLAIM_WINDOW_SECONDS = 30 * 60;
|
|
297
298
|
|
|
298
299
|
// src/nostr.ts
|
|
300
|
+
var import_sdk8 = require("@arkade-os/sdk");
|
|
299
301
|
var import_nostr_tools = require("nostr-tools");
|
|
300
302
|
var RFQ_DIRECTED_KIND = 24859;
|
|
301
303
|
var RFQ_AD_KIND = 38859;
|
|
@@ -320,6 +322,7 @@ var closeReasons = (raw) => raw.map((entry) => {
|
|
|
320
322
|
return url ? `${url}: ${reason ?? "closed"}` : reason ?? "closed";
|
|
321
323
|
});
|
|
322
324
|
var nostrRfqTransport = (options) => {
|
|
325
|
+
(0, import_sdk8.assertTimerMs)("timeoutMs", options.timeoutMs);
|
|
323
326
|
const relays = options.relays;
|
|
324
327
|
const solverPubkey = options.solverPubkey;
|
|
325
328
|
const secretKey = options.secretKey ?? (0, import_nostr_tools.generateSecretKey)();
|
package/dist/nostr.d.cts
CHANGED
package/dist/nostr.d.ts
CHANGED
package/dist/nostr.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
expectQuote,
|
|
3
3
|
pairOf
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UFJEO4VV.js";
|
|
5
5
|
import "./chunk-A3SHHRX4.js";
|
|
6
6
|
|
|
7
7
|
// src/nostr.ts
|
|
8
|
+
import { assertTimerMs } from "@arkade-os/sdk";
|
|
8
9
|
import {
|
|
9
10
|
finalizeEvent,
|
|
10
11
|
generateSecretKey,
|
|
@@ -35,6 +36,7 @@ var closeReasons = (raw) => raw.map((entry) => {
|
|
|
35
36
|
return url ? `${url}: ${reason ?? "closed"}` : reason ?? "closed";
|
|
36
37
|
});
|
|
37
38
|
var nostrRfqTransport = (options) => {
|
|
39
|
+
assertTimerMs("timeoutMs", options.timeoutMs);
|
|
38
40
|
const relays = options.relays;
|
|
39
41
|
const solverPubkey = options.solverPubkey;
|
|
40
42
|
const secretKey = options.secretKey ?? generateSecretKey();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { asset, RelativeTimelock, ArkadeInfo, ArkTxInput, IWallet, EmulatorProvider, arkade } from '@arkade-os/sdk';
|
|
2
|
-
import { d as AssetSwapRepository } from './repository-
|
|
2
|
+
import { d as AssetSwapRepository } from './repository-D_qvJk1S.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The contracts, one per WANT side — pure data, shared verbatim with any other implementation.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { asset, RelativeTimelock, ArkadeInfo, ArkTxInput, IWallet, EmulatorProvider, arkade } from '@arkade-os/sdk';
|
|
2
|
-
import { d as AssetSwapRepository } from './repository-
|
|
2
|
+
import { d as AssetSwapRepository } from './repository-B4rQWmS2.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The contracts, one per WANT side — pure data, shared verbatim with any other implementation.
|