@arkade-os/swap 0.1.0-rc.13 → 0.1.0-rc.14

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 CHANGED
@@ -5555,6 +5555,14 @@ var RfqSwapManager = class {
5555
5555
  this.setState(swap, "claimed");
5556
5556
  this.emitAction(swap, "claimLockup");
5557
5557
  } catch (error) {
5558
+ const ark = (0, import_sdk22.isArkError)(error) ? error : (0, import_sdk22.maybeArkError)(error);
5559
+ if ((0, import_sdk22.isArkError)(ark, import_sdk22.ArkErrorName.VTXO_ALREADY_SPENT)) {
5560
+ if (swap.claimFailure !== void 0) {
5561
+ delete swap.claimFailure;
5562
+ this.touch(swap);
5563
+ }
5564
+ return;
5565
+ }
5558
5566
  swap.claimFailure = errorMessage(error);
5559
5567
  this.touch(swap);
5560
5568
  this.emitFailed(swap, error);
package/dist/advanced.js CHANGED
@@ -135,7 +135,7 @@ import {
135
135
  withCanonicalAmount,
136
136
  withDepositFate,
137
137
  withRfqState
138
- } from "./chunk-SC3SAY3X.js";
138
+ } from "./chunk-PVLLQMX6.js";
139
139
  import {
140
140
  ACTIVITY_TOKEN,
141
141
  CORRIDOR_PASS,
@@ -150,7 +150,7 @@ import {
150
150
  onchainCorridor,
151
151
  readsChain,
152
152
  recordOutcome
153
- } from "./chunk-ZDFMD4FA.js";
153
+ } from "./chunk-CCGJHRJW.js";
154
154
  import {
155
155
  SwapRefusal,
156
156
  sealClaimPacket
@@ -1433,7 +1433,10 @@ function shouldRetainRfqSwap(record, now) {
1433
1433
  // src/swapManager.ts
1434
1434
  import { hex as hex6 } from "@scure/base";
1435
1435
  import {
1436
- isContractVtxoEvent
1436
+ ArkErrorName,
1437
+ isArkError,
1438
+ isContractVtxoEvent,
1439
+ maybeArkError
1437
1440
  } from "@arkade-os/sdk";
1438
1441
  function nextOnchainAction(input) {
1439
1442
  switch (input.phase.phase) {
@@ -2244,6 +2247,14 @@ var RfqSwapManager = class {
2244
2247
  this.setState(swap, "claimed");
2245
2248
  this.emitAction(swap, "claimLockup");
2246
2249
  } catch (error) {
2250
+ const ark = isArkError(error) ? error : maybeArkError(error);
2251
+ if (isArkError(ark, ArkErrorName.VTXO_ALREADY_SPENT)) {
2252
+ if (swap.claimFailure !== void 0) {
2253
+ delete swap.claimFailure;
2254
+ this.touch(swap);
2255
+ }
2256
+ return;
2257
+ }
2247
2258
  swap.claimFailure = errorMessage(error);
2248
2259
  this.touch(swap);
2249
2260
  this.emitFailed(swap, error);
@@ -33,7 +33,7 @@ import {
33
33
  spendTxidsOf,
34
34
  walletOperator,
35
35
  watchOfferSwaps
36
- } from "./chunk-ZDFMD4FA.js";
36
+ } from "./chunk-CCGJHRJW.js";
37
37
  import {
38
38
  ARKADE_BTC,
39
39
  AddressMismatch,
package/dist/index.cjs CHANGED
@@ -5517,6 +5517,14 @@ var RfqSwapManager = class {
5517
5517
  this.setState(swap, "claimed");
5518
5518
  this.emitAction(swap, "claimLockup");
5519
5519
  } catch (error) {
5520
+ const ark = (0, import_sdk22.isArkError)(error) ? error : (0, import_sdk22.maybeArkError)(error);
5521
+ if ((0, import_sdk22.isArkError)(ark, import_sdk22.ArkErrorName.VTXO_ALREADY_SPENT)) {
5522
+ if (swap.claimFailure !== void 0) {
5523
+ delete swap.claimFailure;
5524
+ this.touch(swap);
5525
+ }
5526
+ return;
5527
+ }
5520
5528
  swap.claimFailure = errorMessage(error);
5521
5529
  this.touch(swap);
5522
5530
  this.emitFailed(swap, error);
package/dist/index.js CHANGED
@@ -57,11 +57,11 @@ import {
57
57
  sameAsset,
58
58
  swapHandle,
59
59
  toAtomicDecimal
60
- } from "./chunk-SC3SAY3X.js";
60
+ } from "./chunk-PVLLQMX6.js";
61
61
  import {
62
62
  isRfqSwapTerminal,
63
63
  restoreAssetSwaps
64
- } from "./chunk-ZDFMD4FA.js";
64
+ } from "./chunk-CCGJHRJW.js";
65
65
  import {
66
66
  CLAIM_PACKET_TYPE,
67
67
  LockupRegistrationFailed,
package/dist/protocol.cjs CHANGED
@@ -3927,6 +3927,14 @@ var RfqSwapManager = class {
3927
3927
  this.setState(swap, "claimed");
3928
3928
  this.emitAction(swap, "claimLockup");
3929
3929
  } catch (error) {
3930
+ const ark = (0, import_sdk9.isArkError)(error) ? error : (0, import_sdk9.maybeArkError)(error);
3931
+ if ((0, import_sdk9.isArkError)(ark, import_sdk9.ArkErrorName.VTXO_ALREADY_SPENT)) {
3932
+ if (swap.claimFailure !== void 0) {
3933
+ delete swap.claimFailure;
3934
+ this.touch(swap);
3935
+ }
3936
+ return;
3937
+ }
3930
3938
  swap.claimFailure = errorMessage(error);
3931
3939
  this.touch(swap);
3932
3940
  this.emitFailed(swap, error);
package/dist/protocol.js CHANGED
@@ -43,7 +43,7 @@ import {
43
43
  updateRfqSwapRecord,
44
44
  validatePlan,
45
45
  watchOfferSwaps
46
- } from "./chunk-ZDFMD4FA.js";
46
+ } from "./chunk-CCGJHRJW.js";
47
47
  import {
48
48
  ARKADE_BTC,
49
49
  ASSET_CARRIER_SATS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/swap",
3
- "version": "0.1.0-rc.13",
3
+ "version": "0.1.0-rc.14",
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": {
@@ -104,7 +104,7 @@
104
104
  "@scure/base": "2.0.0",
105
105
  "@scure/btc-signer": "2.0.1",
106
106
  "light-bolt11-decoder": "3.2.0",
107
- "@arkade-os/sdk": "0.5.0-rc.10"
107
+ "@arkade-os/sdk": "0.5.0-rc.11"
108
108
  },
109
109
  "peerDependencies": {
110
110
  "nostr-tools": "^2.12.0"