@arkade-os/swap 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RIC5ZTZK.js → chunk-XXWOODUE.js} +46 -1
- package/dist/index.cjs +391 -40
- package/dist/index.d.cts +115 -6
- package/dist/index.d.ts +115 -6
- package/dist/index.js +322 -21
- package/dist/nostr.d.cts +1 -1
- package/dist/nostr.d.ts +1 -1
- package/dist/nostr.js +1 -1
- 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-CfE18Fif.d.ts → repository-DaK1RzRq.d.cts} +4 -1
- package/dist/{repository-B02vsgcV.d.cts → repository-DlLvj_y6.d.ts} +4 -1
- package/dist/{rfq-DkckzRKK.d.ts → rfq-DzsmhXX3.d.cts} +31 -4
- package/dist/{rfq-DkckzRKK.d.cts → rfq-DzsmhXX3.d.ts} +31 -4
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VHTLC,
|
|
1
|
+
import { VHTLC, IWallet, ProvisionedKey, ProvisionedClaimSecret, asset } from '@arkade-os/sdk';
|
|
2
2
|
|
|
3
3
|
/** L1 confirmation-depth and reorg margin between dependent timelocks. */
|
|
4
4
|
declare const ONCHAIN_ORDER_MARGIN_SECONDS: number;
|
|
@@ -46,6 +46,13 @@ declare const newPreimage: () => Uint8Array;
|
|
|
46
46
|
/** `sha256(P)`, hex — the wire `payment_hash`, same convention as BOLT11. */
|
|
47
47
|
declare const paymentHashOf: (preimage: Uint8Array) => string;
|
|
48
48
|
type OnchainNetwork = "bitcoin" | "testnet" | "regtest";
|
|
49
|
+
/**
|
|
50
|
+
* The `payoutPkScript` {@link buildHtlcClaim} pays the fill to. Resolved EARLY:
|
|
51
|
+
* the claim's output is the spender's own choice, so nothing that survives a
|
|
52
|
+
* send screen names it, and a destination that cannot be encoded must be
|
|
53
|
+
* refused before the swap is negotiated rather than at claim time.
|
|
54
|
+
*/
|
|
55
|
+
declare const l1ScriptForAddress: (address: string, network: OnchainNetwork) => Uint8Array;
|
|
49
56
|
interface OnchainHtlcParams {
|
|
50
57
|
/** `sha256(P)`, hex; the HASH160 commitment is derived internally. */
|
|
51
58
|
paymentHash: string;
|
|
@@ -129,8 +136,9 @@ interface ChainUtxo extends HtlcUtxo {
|
|
|
129
136
|
interface ChainSource {
|
|
130
137
|
/** Confirmed+mempool outputs paying a script; used to detect the fill. */
|
|
131
138
|
getScriptUtxos(pkScript: Uint8Array): Promise<ChainUtxo[]>;
|
|
132
|
-
/** The spend of an outpoint, if any — where P is extracted from.
|
|
133
|
-
|
|
139
|
+
/** The spend of an outpoint, if any — where P is extracted from. A
|
|
140
|
+
* provider omitting the spender txid still lists it in `pkScript`'s history. */
|
|
141
|
+
getSpendingTx(txid: string, vout: number, pkScript: Uint8Array): Promise<{
|
|
134
142
|
txHex: string;
|
|
135
143
|
} | null>;
|
|
136
144
|
broadcast(txHex: string): Promise<string>;
|
|
@@ -367,6 +375,25 @@ declare const assertFundable: (input: {
|
|
|
367
375
|
/** "send" = arkade->onchain (the L1 timelock-order gate applies). */
|
|
368
376
|
direction: "send" | "receive";
|
|
369
377
|
};
|
|
378
|
+
/**
|
|
379
|
+
* The most this client will pay: the GREATER of the two bounds, because a
|
|
380
|
+
* flat fee is a large proportion of a small swap (420 sats is 8.4% of
|
|
381
|
+
* 5_000, 0.084% of 500_000). Absent means no ceiling. OMIT a bound rather
|
|
382
|
+
* than zeroing it: `{ bps: 0 }` alone is a ceiling of zero, indistinguishable
|
|
383
|
+
* from "free or nothing". `{}` IS refused.
|
|
384
|
+
*/
|
|
385
|
+
maxFee?: {
|
|
386
|
+
/** Integer, 0..10_000 (10_000 = 100%). Out of range throws `max_fee_out_of_range`. */
|
|
387
|
+
bps?: number;
|
|
388
|
+
/** Non-negative integer. Out of range throws `max_fee_out_of_range`. */
|
|
389
|
+
sats?: number;
|
|
390
|
+
/**
|
|
391
|
+
* To-units per from-unit, required for a CROSS-ASSET pair. Must come
|
|
392
|
+
* from a source of YOUR OWN — the solver's own feed would check it
|
|
393
|
+
* against its own number. Needs a looser tolerance than same-asset.
|
|
394
|
+
*/
|
|
395
|
+
referenceRate?: number;
|
|
396
|
+
};
|
|
370
397
|
}) => void;
|
|
371
398
|
interface RfqTransport {
|
|
372
399
|
requestQuote(payload: Record<string, unknown>): Promise<RfqQuote>;
|
|
@@ -1030,4 +1057,4 @@ declare function requestOnchainReceive(wallet: IWallet, arkServerUrl: string, tr
|
|
|
1030
1057
|
secrets: ProvisionedClaimSecret;
|
|
1031
1058
|
}>;
|
|
1032
1059
|
|
|
1033
|
-
export {
|
|
1060
|
+
export { lightningSendRequest as $, ARKADE_ASSET as A, type RfqStatus as B, type ChainSource as C, SwapRefusal as D, arkadeAssetLeg as E, arkadeSwapRequest as F, assertFundable as G, type HtlcUtxo as H, type InvoiceFacts as I, assertReceivable as J, awaitOnchainFill as K, LIGHTNING_BTC as L, MAX_MIN_CONFIRMATIONS as M, buildHtlcClaim as N, type OnchainNetwork as O, buildHtlcRefund as P, claimOnchainFill as Q, type RfqTransport as R, SOLO_REFUND_HEADROOM_SECONDS as S, classifyOnchainHtlc as T, deriveLightningReceive as U, deriveOnchainReceive as V, deriveOnchainSend as W, extractPreimage as X, httpTransport as Y, l1ScriptForAddress as Z, lightningReceiveRequest as _, type OnchainHtlc as a, lightningSendVtxoScript as a0, newPreimage as a1, newRfqId as a2, offerTermsFromQuote as a3, onchainHtlcScript as a4, onchainReceiveRequest as a5, onchainSendRequest as a6, paymentHashOf as a7, receiveVtxoScript as a8, relayTransport as a9, requestLightningReceive as aa, requestOnchainReceive as ab, rfqPair as ac, unilateralClaimDelay as ad, unilateralRefundDelay as ae, unilateralRefundWithoutReceiverDelay as af, verifyLockupAddress as ag, verifyReceiveInvoice as ah, type OnchainHtlcParams as b, requestLightningSend as c, ARKADE_BTC as d, AddressMismatch as e, type ChainUtxo as f, LIGHTNING_RECEIVE_PAIR as g, LIGHTNING_SEND_PAIR as h, LOCKTIME_THRESHOLD as i, type LightningReceiveTreeParams as j, type LightningSendTreeParams as k, MIN_CLAIM_WINDOW_SECONDS as l, MIN_HEADROOM_SECONDS as m, ONCHAIN_BTC as n, ONCHAIN_CLAIM_MARGIN_SECONDS as o, ONCHAIN_DUST_SATS as p, ONCHAIN_ORDER_MARGIN_SECONDS as q, requestOnchainSend as r, ONCHAIN_RECEIVE_PAIR as s, ONCHAIN_SECONDS_PER_BLOCK as t, ONCHAIN_SEND_PAIR as u, type OnchainHtlcPhase as v, RFQ_TERMINAL_STATES as w, type RelaySocket as x, type RfqQuote as y, type RfqRefusalReason as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VHTLC,
|
|
1
|
+
import { VHTLC, IWallet, ProvisionedKey, ProvisionedClaimSecret, asset } from '@arkade-os/sdk';
|
|
2
2
|
|
|
3
3
|
/** L1 confirmation-depth and reorg margin between dependent timelocks. */
|
|
4
4
|
declare const ONCHAIN_ORDER_MARGIN_SECONDS: number;
|
|
@@ -46,6 +46,13 @@ declare const newPreimage: () => Uint8Array;
|
|
|
46
46
|
/** `sha256(P)`, hex — the wire `payment_hash`, same convention as BOLT11. */
|
|
47
47
|
declare const paymentHashOf: (preimage: Uint8Array) => string;
|
|
48
48
|
type OnchainNetwork = "bitcoin" | "testnet" | "regtest";
|
|
49
|
+
/**
|
|
50
|
+
* The `payoutPkScript` {@link buildHtlcClaim} pays the fill to. Resolved EARLY:
|
|
51
|
+
* the claim's output is the spender's own choice, so nothing that survives a
|
|
52
|
+
* send screen names it, and a destination that cannot be encoded must be
|
|
53
|
+
* refused before the swap is negotiated rather than at claim time.
|
|
54
|
+
*/
|
|
55
|
+
declare const l1ScriptForAddress: (address: string, network: OnchainNetwork) => Uint8Array;
|
|
49
56
|
interface OnchainHtlcParams {
|
|
50
57
|
/** `sha256(P)`, hex; the HASH160 commitment is derived internally. */
|
|
51
58
|
paymentHash: string;
|
|
@@ -129,8 +136,9 @@ interface ChainUtxo extends HtlcUtxo {
|
|
|
129
136
|
interface ChainSource {
|
|
130
137
|
/** Confirmed+mempool outputs paying a script; used to detect the fill. */
|
|
131
138
|
getScriptUtxos(pkScript: Uint8Array): Promise<ChainUtxo[]>;
|
|
132
|
-
/** The spend of an outpoint, if any — where P is extracted from.
|
|
133
|
-
|
|
139
|
+
/** The spend of an outpoint, if any — where P is extracted from. A
|
|
140
|
+
* provider omitting the spender txid still lists it in `pkScript`'s history. */
|
|
141
|
+
getSpendingTx(txid: string, vout: number, pkScript: Uint8Array): Promise<{
|
|
134
142
|
txHex: string;
|
|
135
143
|
} | null>;
|
|
136
144
|
broadcast(txHex: string): Promise<string>;
|
|
@@ -367,6 +375,25 @@ declare const assertFundable: (input: {
|
|
|
367
375
|
/** "send" = arkade->onchain (the L1 timelock-order gate applies). */
|
|
368
376
|
direction: "send" | "receive";
|
|
369
377
|
};
|
|
378
|
+
/**
|
|
379
|
+
* The most this client will pay: the GREATER of the two bounds, because a
|
|
380
|
+
* flat fee is a large proportion of a small swap (420 sats is 8.4% of
|
|
381
|
+
* 5_000, 0.084% of 500_000). Absent means no ceiling. OMIT a bound rather
|
|
382
|
+
* than zeroing it: `{ bps: 0 }` alone is a ceiling of zero, indistinguishable
|
|
383
|
+
* from "free or nothing". `{}` IS refused.
|
|
384
|
+
*/
|
|
385
|
+
maxFee?: {
|
|
386
|
+
/** Integer, 0..10_000 (10_000 = 100%). Out of range throws `max_fee_out_of_range`. */
|
|
387
|
+
bps?: number;
|
|
388
|
+
/** Non-negative integer. Out of range throws `max_fee_out_of_range`. */
|
|
389
|
+
sats?: number;
|
|
390
|
+
/**
|
|
391
|
+
* To-units per from-unit, required for a CROSS-ASSET pair. Must come
|
|
392
|
+
* from a source of YOUR OWN — the solver's own feed would check it
|
|
393
|
+
* against its own number. Needs a looser tolerance than same-asset.
|
|
394
|
+
*/
|
|
395
|
+
referenceRate?: number;
|
|
396
|
+
};
|
|
370
397
|
}) => void;
|
|
371
398
|
interface RfqTransport {
|
|
372
399
|
requestQuote(payload: Record<string, unknown>): Promise<RfqQuote>;
|
|
@@ -1030,4 +1057,4 @@ declare function requestOnchainReceive(wallet: IWallet, arkServerUrl: string, tr
|
|
|
1030
1057
|
secrets: ProvisionedClaimSecret;
|
|
1031
1058
|
}>;
|
|
1032
1059
|
|
|
1033
|
-
export {
|
|
1060
|
+
export { lightningSendRequest as $, ARKADE_ASSET as A, type RfqStatus as B, type ChainSource as C, SwapRefusal as D, arkadeAssetLeg as E, arkadeSwapRequest as F, assertFundable as G, type HtlcUtxo as H, type InvoiceFacts as I, assertReceivable as J, awaitOnchainFill as K, LIGHTNING_BTC as L, MAX_MIN_CONFIRMATIONS as M, buildHtlcClaim as N, type OnchainNetwork as O, buildHtlcRefund as P, claimOnchainFill as Q, type RfqTransport as R, SOLO_REFUND_HEADROOM_SECONDS as S, classifyOnchainHtlc as T, deriveLightningReceive as U, deriveOnchainReceive as V, deriveOnchainSend as W, extractPreimage as X, httpTransport as Y, l1ScriptForAddress as Z, lightningReceiveRequest as _, type OnchainHtlc as a, lightningSendVtxoScript as a0, newPreimage as a1, newRfqId as a2, offerTermsFromQuote as a3, onchainHtlcScript as a4, onchainReceiveRequest as a5, onchainSendRequest as a6, paymentHashOf as a7, receiveVtxoScript as a8, relayTransport as a9, requestLightningReceive as aa, requestOnchainReceive as ab, rfqPair as ac, unilateralClaimDelay as ad, unilateralRefundDelay as ae, unilateralRefundWithoutReceiverDelay as af, verifyLockupAddress as ag, verifyReceiveInvoice as ah, type OnchainHtlcParams as b, requestLightningSend as c, ARKADE_BTC as d, AddressMismatch as e, type ChainUtxo as f, LIGHTNING_RECEIVE_PAIR as g, LIGHTNING_SEND_PAIR as h, LOCKTIME_THRESHOLD as i, type LightningReceiveTreeParams as j, type LightningSendTreeParams as k, MIN_CLAIM_WINDOW_SECONDS as l, MIN_HEADROOM_SECONDS as m, ONCHAIN_BTC as n, ONCHAIN_CLAIM_MARGIN_SECONDS as o, ONCHAIN_DUST_SATS as p, ONCHAIN_ORDER_MARGIN_SECONDS as q, requestOnchainSend as r, ONCHAIN_RECEIVE_PAIR as s, ONCHAIN_SECONDS_PER_BLOCK as t, ONCHAIN_SEND_PAIR as u, type OnchainHtlcPhase as v, RFQ_TERMINAL_STATES as w, type RelaySocket as x, type RfqQuote as y, type RfqRefusalReason as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkade-os/swap",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Client-side Arkade Intents asset swaps: discover markets, quote, create/track/cancel offers, restore from chain.",
|
|
6
6
|
"repository": {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@noble/hashes": "2.0.1",
|
|
71
71
|
"@scure/base": "2.0.0",
|
|
72
72
|
"@scure/btc-signer": "2.0.1",
|
|
73
|
-
"@arkade-os/sdk": "0.4.
|
|
73
|
+
"@arkade-os/sdk": "0.4.69"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"nostr-tools": "^2.12.0"
|