@arkade-os/swap 0.1.0-rc.19 → 0.1.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.cjs +4 -1
- package/dist/advanced.js +3 -3
- package/dist/{chunk-USY74IT6.js → chunk-HUQQVBC4.js} +2 -2
- package/dist/{chunk-YN464TAH.js → chunk-ITFCQWPG.js} +1 -1
- package/dist/{chunk-AYKAMAP5.js → chunk-PVB7EBAM.js} +4 -1
- package/dist/index.cjs +4 -1
- package/dist/index.js +3 -3
- package/dist/nostr.js +1 -1
- package/dist/protocol.cjs +7 -3
- package/dist/protocol.js +6 -5
- package/package.json +6 -6
package/dist/advanced.cjs
CHANGED
|
@@ -569,6 +569,9 @@ async function deriveOffer(wallet, params) {
|
|
|
569
569
|
if (Boolean(params.wantAsset) === Boolean(params.offerAsset)) {
|
|
570
570
|
throw new Error("set exactly one of wantAsset (BTC->asset) or offerAsset (asset->BTC)");
|
|
571
571
|
}
|
|
572
|
+
if (params.wantAmount < BigInt(1)) {
|
|
573
|
+
throw new Error("wantAmount must be positive: a zero want lets anyone take the deposit");
|
|
574
|
+
}
|
|
572
575
|
const [info, maker] = await Promise.all([
|
|
573
576
|
// requireLive: this binds signerPubkey into the covenant, and a snapshot could derive an
|
|
574
577
|
// address the operator no longer co-signs for — fail closed instead
|
|
@@ -838,7 +841,7 @@ function onchainHtlcScript(params, network) {
|
|
|
838
841
|
"CHECKSIG"
|
|
839
842
|
]);
|
|
840
843
|
const payment = btc.p2tr(
|
|
841
|
-
btc.
|
|
844
|
+
btc.taprootNumsKey(),
|
|
842
845
|
btc.taprootListToTree([{ script: claim }, { script: refund }]),
|
|
843
846
|
L1_NETWORKS[network],
|
|
844
847
|
true
|
package/dist/advanced.js
CHANGED
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
withCanonicalAmount,
|
|
145
145
|
withDepositFate,
|
|
146
146
|
withRfqState
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-HUQQVBC4.js";
|
|
148
148
|
import {
|
|
149
149
|
ACTIVITY_TOKEN,
|
|
150
150
|
CORRIDOR_PASS,
|
|
@@ -159,12 +159,12 @@ import {
|
|
|
159
159
|
onchainCorridor,
|
|
160
160
|
readsChain,
|
|
161
161
|
recordOutcome
|
|
162
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-ITFCQWPG.js";
|
|
163
163
|
import {
|
|
164
164
|
SwapRefusal,
|
|
165
165
|
assertPreimageMatches,
|
|
166
166
|
sealClaimPacket
|
|
167
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-PVB7EBAM.js";
|
|
168
168
|
import "./chunk-A3SHHRX4.js";
|
|
169
169
|
|
|
170
170
|
// src/reveal.ts
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
toRestoreTx,
|
|
37
37
|
walletOperator,
|
|
38
38
|
watchOfferSwaps
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-ITFCQWPG.js";
|
|
40
40
|
import {
|
|
41
41
|
ARKADE_BTC,
|
|
42
42
|
ASSET_CARRIER_SATS,
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
sealClaimPacket,
|
|
85
85
|
unilateralClaimDelay,
|
|
86
86
|
verifyOfferAddress
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-PVB7EBAM.js";
|
|
88
88
|
import {
|
|
89
89
|
assertRfqSwapPageFilter,
|
|
90
90
|
collectAssetSwaps,
|
|
@@ -552,6 +552,9 @@ async function deriveOffer(wallet, params) {
|
|
|
552
552
|
if (Boolean(params.wantAsset) === Boolean(params.offerAsset)) {
|
|
553
553
|
throw new Error("set exactly one of wantAsset (BTC->asset) or offerAsset (asset->BTC)");
|
|
554
554
|
}
|
|
555
|
+
if (params.wantAmount < BigInt(1)) {
|
|
556
|
+
throw new Error("wantAmount must be positive: a zero want lets anyone take the deposit");
|
|
557
|
+
}
|
|
555
558
|
const [info, maker] = await Promise.all([
|
|
556
559
|
// requireLive: this binds signerPubkey into the covenant, and a snapshot could derive an
|
|
557
560
|
// address the operator no longer co-signs for — fail closed instead
|
|
@@ -953,7 +956,7 @@ function onchainHtlcScript(params, network) {
|
|
|
953
956
|
"CHECKSIG"
|
|
954
957
|
]);
|
|
955
958
|
const payment = btc.p2tr(
|
|
956
|
-
btc.
|
|
959
|
+
btc.taprootNumsKey(),
|
|
957
960
|
btc.taprootListToTree([{ script: claim }, { script: refund }]),
|
|
958
961
|
L1_NETWORKS[network],
|
|
959
962
|
true
|
package/dist/index.cjs
CHANGED
|
@@ -172,7 +172,7 @@ function onchainHtlcScript(params, network) {
|
|
|
172
172
|
"CHECKSIG"
|
|
173
173
|
]);
|
|
174
174
|
const payment = btc.p2tr(
|
|
175
|
-
btc.
|
|
175
|
+
btc.taprootNumsKey(),
|
|
176
176
|
btc.taprootListToTree([{ script: claim }, { script: refund }]),
|
|
177
177
|
L1_NETWORKS[network],
|
|
178
178
|
true
|
|
@@ -1015,6 +1015,9 @@ async function deriveOffer(wallet, params) {
|
|
|
1015
1015
|
if (Boolean(params.wantAsset) === Boolean(params.offerAsset)) {
|
|
1016
1016
|
throw new Error("set exactly one of wantAsset (BTC->asset) or offerAsset (asset->BTC)");
|
|
1017
1017
|
}
|
|
1018
|
+
if (params.wantAmount < BigInt(1)) {
|
|
1019
|
+
throw new Error("wantAmount must be positive: a zero want lets anyone take the deposit");
|
|
1020
|
+
}
|
|
1018
1021
|
const [info, maker] = await Promise.all([
|
|
1019
1022
|
// requireLive: this binds signerPubkey into the covenant, and a snapshot could derive an
|
|
1020
1023
|
// address the operator no longer co-signs for — fail closed instead
|
package/dist/index.js
CHANGED
|
@@ -61,10 +61,10 @@ import {
|
|
|
61
61
|
sameAsset,
|
|
62
62
|
swapHandle,
|
|
63
63
|
toAtomicDecimal
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-HUQQVBC4.js";
|
|
65
65
|
import {
|
|
66
66
|
isRfqSwapTerminal
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-ITFCQWPG.js";
|
|
68
68
|
import {
|
|
69
69
|
CLAIM_PACKET_TYPE,
|
|
70
70
|
LockupRegistrationFailed,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
appendArkadeScript,
|
|
75
75
|
claimPacketShape,
|
|
76
76
|
isRfqRefusalErrorCode
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-PVB7EBAM.js";
|
|
78
78
|
import {
|
|
79
79
|
InMemoryAssetSwapRepository,
|
|
80
80
|
assertRfqSwapPageFilter,
|
package/dist/nostr.js
CHANGED
package/dist/protocol.cjs
CHANGED
|
@@ -248,7 +248,7 @@ function onchainHtlcScript(params, network) {
|
|
|
248
248
|
"CHECKSIG"
|
|
249
249
|
]);
|
|
250
250
|
const payment = btc.p2tr(
|
|
251
|
-
btc.
|
|
251
|
+
btc.taprootNumsKey(),
|
|
252
252
|
btc.taprootListToTree([{ script: claim }, { script: refund }]),
|
|
253
253
|
L1_NETWORKS[network],
|
|
254
254
|
true
|
|
@@ -1016,6 +1016,9 @@ async function deriveOffer(wallet, params) {
|
|
|
1016
1016
|
if (Boolean(params.wantAsset) === Boolean(params.offerAsset)) {
|
|
1017
1017
|
throw new Error("set exactly one of wantAsset (BTC->asset) or offerAsset (asset->BTC)");
|
|
1018
1018
|
}
|
|
1019
|
+
if (params.wantAmount < BigInt(1)) {
|
|
1020
|
+
throw new Error("wantAmount must be positive: a zero want lets anyone take the deposit");
|
|
1021
|
+
}
|
|
1019
1022
|
const [info, maker] = await Promise.all([
|
|
1020
1023
|
// requireLive: this binds signerPubkey into the covenant, and a snapshot could derive an
|
|
1021
1024
|
// address the operator no longer co-signs for — fail closed instead
|
|
@@ -4913,6 +4916,7 @@ var factsOf = (raw, decode, now) => {
|
|
|
4913
4916
|
if (facts.expiresAt <= now) return void 0;
|
|
4914
4917
|
return facts;
|
|
4915
4918
|
};
|
|
4919
|
+
var contradicts = (req, facts) => req.amount !== void 0 && req.amount !== facts.amountSats && req.amount !== import_sdk18.BIP21.amountSats(req.raw);
|
|
4916
4920
|
var solverLightningRendezvous = (markets, amountSats, fallbackEmulatorPubkey) => solverRendezvous(markets, "lightning", amountSats, fallbackEmulatorPubkey);
|
|
4917
4921
|
function solverLightningRail(deps) {
|
|
4918
4922
|
const rendezvousFor = async (amountSats) => solverLightningRendezvous(await deps.discover(), amountSats, deps.fallbackEmulatorPubkey);
|
|
@@ -4923,7 +4927,7 @@ function solverLightningRail(deps) {
|
|
|
4923
4927
|
if ((0, import_sdk18.assetsOf)(req).length > 0) return false;
|
|
4924
4928
|
const facts = factsOf(req.raw, deps.decodeInvoice, Math.floor(Date.now() / 1e3));
|
|
4925
4929
|
if (!facts) return false;
|
|
4926
|
-
if (req
|
|
4930
|
+
if (contradicts(req, facts)) return false;
|
|
4927
4931
|
return await rendezvousFor(facts.amountSats) !== void 0;
|
|
4928
4932
|
},
|
|
4929
4933
|
quote: async (req, ctx) => {
|
|
@@ -4934,7 +4938,7 @@ function solverLightningRail(deps) {
|
|
|
4934
4938
|
`${SOLVER_LIGHTNING_RAIL}: the request carries no payable BOLT11 invoice (amountless, expired, or undecodable)`
|
|
4935
4939
|
);
|
|
4936
4940
|
}
|
|
4937
|
-
if (req
|
|
4941
|
+
if (contradicts(req, facts)) {
|
|
4938
4942
|
throw new Error(
|
|
4939
4943
|
`${SOLVER_LIGHTNING_RAIL}: the request names ${req.amount} sats but the invoice is for ${facts.amountSats} \u2014 the payee is paid the invoice`
|
|
4940
4944
|
);
|
package/dist/protocol.js
CHANGED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
updateRfqSwapRecord,
|
|
44
44
|
validatePlan,
|
|
45
45
|
watchOfferSwaps
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-ITFCQWPG.js";
|
|
47
47
|
import {
|
|
48
48
|
ARKADE_BTC,
|
|
49
49
|
ASSET_CARRIER_SATS,
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
verifyLockupAddress,
|
|
125
125
|
verifyOfferAddress,
|
|
126
126
|
verifyReceiveInvoice
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-PVB7EBAM.js";
|
|
128
128
|
import {
|
|
129
129
|
collectRfqSwaps
|
|
130
130
|
} from "./chunk-A3SHHRX4.js";
|
|
@@ -429,7 +429,7 @@ var solverRendezvous = (markets, payoutCorridor, amountSats, fallbackEmulatorPub
|
|
|
429
429
|
};
|
|
430
430
|
|
|
431
431
|
// src/payment/solverLightning.ts
|
|
432
|
-
import { assertNoAssets as assertNoAssets2, assetsOf as assetsOf3, invoiceTarget, makeHandle as makeHandle3 } from "@arkade-os/sdk";
|
|
432
|
+
import { assertNoAssets as assertNoAssets2, assetsOf as assetsOf3, BIP21, invoiceTarget, makeHandle as makeHandle3 } from "@arkade-os/sdk";
|
|
433
433
|
|
|
434
434
|
// src/payment/solverOnchain.ts
|
|
435
435
|
import {
|
|
@@ -561,6 +561,7 @@ var factsOf = (raw, decode, now) => {
|
|
|
561
561
|
if (facts.expiresAt <= now) return void 0;
|
|
562
562
|
return facts;
|
|
563
563
|
};
|
|
564
|
+
var contradicts = (req, facts) => req.amount !== void 0 && req.amount !== facts.amountSats && req.amount !== BIP21.amountSats(req.raw);
|
|
564
565
|
var solverLightningRendezvous = (markets, amountSats, fallbackEmulatorPubkey) => solverRendezvous(markets, "lightning", amountSats, fallbackEmulatorPubkey);
|
|
565
566
|
function solverLightningRail(deps) {
|
|
566
567
|
const rendezvousFor = async (amountSats) => solverLightningRendezvous(await deps.discover(), amountSats, deps.fallbackEmulatorPubkey);
|
|
@@ -571,7 +572,7 @@ function solverLightningRail(deps) {
|
|
|
571
572
|
if (assetsOf3(req).length > 0) return false;
|
|
572
573
|
const facts = factsOf(req.raw, deps.decodeInvoice, Math.floor(Date.now() / 1e3));
|
|
573
574
|
if (!facts) return false;
|
|
574
|
-
if (req
|
|
575
|
+
if (contradicts(req, facts)) return false;
|
|
575
576
|
return await rendezvousFor(facts.amountSats) !== void 0;
|
|
576
577
|
},
|
|
577
578
|
quote: async (req, ctx) => {
|
|
@@ -582,7 +583,7 @@ function solverLightningRail(deps) {
|
|
|
582
583
|
`${SOLVER_LIGHTNING_RAIL}: the request carries no payable BOLT11 invoice (amountless, expired, or undecodable)`
|
|
583
584
|
);
|
|
584
585
|
}
|
|
585
|
-
if (req
|
|
586
|
+
if (contradicts(req, facts)) {
|
|
586
587
|
throw new Error(
|
|
587
588
|
`${SOLVER_LIGHTNING_RAIL}: the request names ${req.amount} sats but the invoice is for ${facts.amountSats} \u2014 the payee is paid the invoice`
|
|
588
589
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkade-os/swap",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Client-side Arkade Intents asset swaps: state a route, get an outcome. Pay a bolt11 invoice, receive over Lightning, exchange assets, or withdraw onchain.",
|
|
6
6
|
"repository": {
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@arkade-os/solver-discovery": "0.2.7",
|
|
101
101
|
"@noble/ciphers": "2.1.1",
|
|
102
|
-
"@noble/curves": "2.0
|
|
103
|
-
"@noble/hashes": "2.0
|
|
104
|
-
"@scure/base": "2.
|
|
105
|
-
"@scure/btc-signer": "2.
|
|
102
|
+
"@noble/curves": "2.4.0",
|
|
103
|
+
"@noble/hashes": "2.4.0",
|
|
104
|
+
"@scure/base": "2.4.0",
|
|
105
|
+
"@scure/btc-signer": "2.4.1",
|
|
106
106
|
"light-bolt11-decoder": "3.2.0",
|
|
107
|
-
"@arkade-os/sdk": "0.5.0-rc.
|
|
107
|
+
"@arkade-os/sdk": "0.5.0-rc.17"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
110
|
"nostr-tools": "^2.12.0"
|