@atomiqlabs/sdk 8.8.3 → 8.9.1

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.
Files changed (130) hide show
  1. package/api/index.d.ts +1 -0
  2. package/api/index.js +3 -0
  3. package/dist/ApiList.d.ts +37 -0
  4. package/dist/ApiList.js +30 -0
  5. package/dist/api/ApiEndpoints.d.ts +393 -0
  6. package/dist/api/ApiEndpoints.js +2 -0
  7. package/dist/api/ApiParser.d.ts +10 -0
  8. package/dist/api/ApiParser.js +134 -0
  9. package/dist/api/ApiTypes.d.ts +157 -0
  10. package/dist/api/ApiTypes.js +75 -0
  11. package/dist/api/SerializedAction.d.ts +40 -0
  12. package/dist/api/SerializedAction.js +59 -0
  13. package/dist/api/SwapperApi.d.ts +50 -0
  14. package/dist/api/SwapperApi.js +431 -0
  15. package/dist/api/index.d.ts +5 -0
  16. package/dist/api/index.js +24 -0
  17. package/dist/events/UnifiedSwapEventListener.d.ts +4 -3
  18. package/dist/events/UnifiedSwapEventListener.js +8 -2
  19. package/dist/http/HttpUtils.d.ts +4 -2
  20. package/dist/http/HttpUtils.js +10 -4
  21. package/dist/http/paramcoders/client/StreamingFetchPromise.d.ts +2 -1
  22. package/dist/http/paramcoders/client/StreamingFetchPromise.js +3 -2
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/intermediaries/IntermediaryDiscovery.d.ts +7 -2
  26. package/dist/intermediaries/IntermediaryDiscovery.js +4 -4
  27. package/dist/intermediaries/apis/IntermediaryAPI.d.ts +171 -14
  28. package/dist/intermediaries/apis/IntermediaryAPI.js +174 -28
  29. package/dist/intermediaries/auth/SignedKeyBasedAuth.d.ts +14 -0
  30. package/dist/intermediaries/auth/SignedKeyBasedAuth.js +68 -0
  31. package/dist/storage/IUnifiedStorage.d.ts +45 -3
  32. package/dist/storage/UnifiedSwapStorage.d.ts +8 -2
  33. package/dist/storage/UnifiedSwapStorage.js +46 -8
  34. package/dist/swapper/Swapper.d.ts +41 -3
  35. package/dist/swapper/Swapper.js +93 -48
  36. package/dist/swapper/SwapperUtils.d.ts +18 -2
  37. package/dist/swapper/SwapperUtils.js +39 -1
  38. package/dist/swaps/ISwap.d.ts +70 -9
  39. package/dist/swaps/ISwap.js +28 -6
  40. package/dist/swaps/ISwapWrapper.d.ts +11 -1
  41. package/dist/swaps/ISwapWrapper.js +23 -3
  42. package/dist/swaps/escrow_swaps/IEscrowSwap.d.ts +1 -1
  43. package/dist/swaps/escrow_swaps/IEscrowSwap.js +4 -2
  44. package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.d.ts +2 -1
  45. package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.js +2 -2
  46. package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.d.ts +3 -1
  47. package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.js +3 -2
  48. package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.d.ts +47 -31
  49. package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +201 -67
  50. package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +3 -1
  51. package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +6 -6
  52. package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +82 -15
  53. package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +304 -98
  54. package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.d.ts +3 -1
  55. package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.js +6 -6
  56. package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.d.ts +75 -42
  57. package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +424 -87
  58. package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.d.ts +3 -1
  59. package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.js +7 -7
  60. package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.d.ts +54 -11
  61. package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +214 -41
  62. package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.d.ts +2 -1
  63. package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.js +7 -8
  64. package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.d.ts +3 -1
  65. package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.js +5 -5
  66. package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +76 -19
  67. package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +290 -51
  68. package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +3 -1
  69. package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +5 -5
  70. package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +53 -12
  71. package/dist/swaps/trusted/ln/LnForGasSwap.js +163 -49
  72. package/dist/swaps/trusted/ln/LnForGasWrapper.js +1 -2
  73. package/dist/swaps/trusted/onchain/OnchainForGasSwap.d.ts +14 -13
  74. package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +30 -47
  75. package/dist/swaps/trusted/onchain/OnchainForGasWrapper.d.ts +3 -1
  76. package/dist/swaps/trusted/onchain/OnchainForGasWrapper.js +4 -4
  77. package/dist/types/SwapExecutionAction.d.ts +141 -34
  78. package/dist/types/SwapExecutionAction.js +104 -0
  79. package/dist/types/SwapExecutionStep.d.ts +144 -0
  80. package/dist/types/SwapExecutionStep.js +87 -0
  81. package/dist/types/TokenAmount.d.ts +6 -0
  82. package/dist/types/TokenAmount.js +26 -1
  83. package/dist/utils/BitcoinUtils.d.ts +2 -0
  84. package/dist/utils/BitcoinUtils.js +34 -1
  85. package/dist/utils/Utils.d.ts +3 -1
  86. package/dist/utils/Utils.js +7 -1
  87. package/package.json +7 -4
  88. package/src/api/ApiEndpoints.ts +427 -0
  89. package/src/api/ApiParser.ts +138 -0
  90. package/src/api/ApiTypes.ts +229 -0
  91. package/src/api/SerializedAction.ts +97 -0
  92. package/src/api/SwapperApi.ts +545 -0
  93. package/src/api/index.ts +5 -0
  94. package/src/events/UnifiedSwapEventListener.ts +11 -3
  95. package/src/http/HttpUtils.ts +10 -4
  96. package/src/http/paramcoders/client/StreamingFetchPromise.ts +4 -2
  97. package/src/index.ts +1 -0
  98. package/src/intermediaries/IntermediaryDiscovery.ts +9 -2
  99. package/src/intermediaries/apis/IntermediaryAPI.ts +314 -30
  100. package/src/intermediaries/auth/SignedKeyBasedAuth.ts +69 -0
  101. package/src/storage/IUnifiedStorage.ts +45 -4
  102. package/src/storage/UnifiedSwapStorage.ts +42 -8
  103. package/src/swapper/Swapper.ts +134 -52
  104. package/src/swapper/SwapperUtils.ts +42 -2
  105. package/src/swaps/ISwap.ts +88 -16
  106. package/src/swaps/ISwapWrapper.ts +28 -3
  107. package/src/swaps/escrow_swaps/IEscrowSwap.ts +5 -3
  108. package/src/swaps/escrow_swaps/IEscrowSwapWrapper.ts +3 -1
  109. package/src/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.ts +4 -1
  110. package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +264 -67
  111. package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +6 -4
  112. package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +390 -89
  113. package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +6 -4
  114. package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +548 -94
  115. package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +7 -5
  116. package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +276 -45
  117. package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +7 -6
  118. package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +5 -3
  119. package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +393 -57
  120. package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +5 -3
  121. package/src/swaps/trusted/ln/LnForGasSwap.ts +211 -47
  122. package/src/swaps/trusted/ln/LnForGasWrapper.ts +1 -2
  123. package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +32 -51
  124. package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +5 -3
  125. package/src/types/SwapExecutionAction.ts +266 -43
  126. package/src/types/SwapExecutionStep.ts +224 -0
  127. package/src/types/TokenAmount.ts +36 -2
  128. package/src/utils/BitcoinUtils.ts +32 -0
  129. package/src/utils/Utils.ts +10 -1
  130. package/src/intermediaries/apis/TrustedIntermediaryAPI.ts +0 -258
@@ -39,6 +39,7 @@ import { LNURLPay } from "../types/lnurl/LNURLPay";
39
39
  import { NotNever } from "../utils/TypeUtils";
40
40
  import { LightningInvoiceCreateService } from "../types/wallets/LightningInvoiceCreateService";
41
41
  import { SwapSide } from "../enums/SwapSide";
42
+ import { IntermediaryAPI } from "../intermediaries/apis/IntermediaryAPI";
42
43
  import { BitcoinWalletUtxo, IBitcoinWallet } from "../bitcoin/wallet/IBitcoinWallet";
43
44
  import { MinimalBitcoinWalletInterface } from "../types/wallets/MinimalBitcoinWalletInterface";
44
45
  /**
@@ -99,8 +100,9 @@ export type SwapperOptions = {
99
100
  noTimers?: boolean;
100
101
  /**
101
102
  * By setting this flag, the swapper doesn't subscribe to on-chain events. To make sure the swap states are
102
- * properly updated you should call the {@link Swapper._syncSwaps} function periodically. This flag should be
103
- * set when you run an environment that doesn't support long-running timers and websocket connections - e.g.
103
+ * properly updated you should either call the {@link Swapper._syncSwaps} function periodically, or use the
104
+ * {@link Swapper._pollChainEvents} function to manually poll for on-chain events. This flag should be set
105
+ * when you run an environment that doesn't support long-running timers and websocket connections - e.g.
104
106
  * serverless environments like Azure Function Apps or AWS Lambda
105
107
  */
106
108
  noEvents?: boolean;
@@ -130,7 +132,7 @@ export type SwapperOptions = {
130
132
  * want to only create a swap, and then later on retrieve it with the `swapper.getSwapById()` function.
131
133
  *
132
134
  * Setting this to `false` means the SDK only saves and persists swaps that are considered initiated, i.e. when
133
- * `commit()`, `execute()` or `waitTillPayment` is called (or their respective txs... prefixed variations). This
135
+ * `commit()`, `execute()` or `waitTillPayment()` is called (or their respective txs... prefixed variations). This
134
136
  * might save calls to the persistent storage for swaps that are never initiated. This is useful in e.g.
135
137
  * frontend implementations where the frontend holds the swap object reference until it is initiated anyway, not
136
138
  * necessitating the saving of the swap data to the persistent storage until it is actually initiated.
@@ -141,6 +143,18 @@ export type SwapperOptions = {
141
143
  * (as checked from multiple server sources) it adjusts the `Date.now()` function to return proper actual time.
142
144
  */
143
145
  automaticClockDriftCorrection?: boolean;
146
+ /**
147
+ * Used in centralized API deployments to allow higher rate limits from LPs
148
+ */
149
+ signedKeyBasedAuth?: {
150
+ certificate: string;
151
+ privateKey: string;
152
+ };
153
+ /**
154
+ * If you set the option to `true` the chains for which the RPC is unresponsive are skipped and not initialized
155
+ * letting the swapper continue with only the available chains with responsive RPCs
156
+ */
157
+ gracefullyHandleChainErrors?: boolean;
144
158
  };
145
159
  /**
146
160
  * Type representing multiple blockchain configurations
@@ -248,6 +262,10 @@ export declare class Swapper<T extends MultiChain> extends EventEmitter<{
248
262
  * Pricing API used by the SDK
249
263
  */
250
264
  readonly prices: ISwapPrice<T>;
265
+ /**
266
+ * API for contacting LPs
267
+ */
268
+ readonly lpApi: IntermediaryAPI;
251
269
  /**
252
270
  * Intermediary discovery instance
253
271
  */
@@ -267,6 +285,10 @@ export declare class Swapper<T extends MultiChain> extends EventEmitter<{
267
285
  * Initializes the swap storage and loads existing swaps, needs to be called before any other action
268
286
  */
269
287
  init(): Promise<void>;
288
+ /**
289
+ * Whether the SDK is initialized (after {@link init} is called)
290
+ */
291
+ isInitialized(): boolean;
270
292
  /**
271
293
  * Stops listening for onchain events and closes this Swapper instance
272
294
  */
@@ -553,6 +575,14 @@ export declare class Swapper<T extends MultiChain> extends EventEmitter<{
553
575
  * Returns all swaps for the specific chain, and optionally also for a specific signer's address
554
576
  */
555
577
  getAllSwaps<C extends ChainIds<T>>(chainId: C, signer?: string): Promise<ISwap<T[C]>[]>;
578
+ /**
579
+ * Returns all swaps which are pending (i.e. not in their final state yet)
580
+ */
581
+ getPendingSwaps(): Promise<ISwap[]>;
582
+ /**
583
+ * Returns swaps which are pending (i.e. not in their final state yet) for the specific chain, and optionally also for a specific signer's address
584
+ */
585
+ getPendingSwaps<C extends ChainIds<T>>(chainId: C, signer?: string): Promise<ISwap<T[C]>[]>;
556
586
  /**
557
587
  * Returns all swaps where an action is required (either claim or refund)
558
588
  */
@@ -614,6 +644,14 @@ export declare class Swapper<T extends MultiChain> extends EventEmitter<{
614
644
  * @param signer Optional signer to only run swap sync for swaps initiated by this signer
615
645
  */
616
646
  _syncSwaps<C extends ChainIds<T>>(chainId?: C, signer?: string): Promise<void>;
647
+ /**
648
+ * When the swapper is initiated with the `noEvents` config this function allows you to manually poll for on-chain
649
+ * events. It returns an events cursor which you should save and pass to the next call to the `poll()` function.
650
+ *
651
+ * @param chainId Chain for which to poll the chain events listener for
652
+ * @param lastEventCursorState Event cursor state returned from the last call to the `poll()` function
653
+ */
654
+ _pollChainEvents<C extends ChainIds<T>>(chainId: C, lastEventCursorState?: any): Promise<any>;
617
655
  /**
618
656
  * Recovers swaps from on-chain historical data.
619
657
  *
@@ -35,7 +35,9 @@ const LNURLPay_1 = require("../types/lnurl/LNURLPay");
35
35
  const RetryUtils_1 = require("../utils/RetryUtils");
36
36
  const IEscrowSwap_1 = require("../swaps/escrow_swaps/IEscrowSwap");
37
37
  const LightningInvoiceCreateService_1 = require("../types/wallets/LightningInvoiceCreateService");
38
+ const IntermediaryAPI_1 = require("../intermediaries/apis/IntermediaryAPI");
38
39
  const BitcoinWalletUtils_1 = require("../utils/BitcoinWalletUtils");
40
+ const SignedKeyBasedAuth_1 = require("../intermediaries/auth/SignedKeyBasedAuth");
39
41
  /**
40
42
  * Core orchestrator for all atomiq swap operations
41
43
  *
@@ -88,6 +90,10 @@ class Swapper extends events_1.EventEmitter {
88
90
  this._tokensByTicker[chainId] ??= {};
89
91
  this._tokens[chainId][tokenData.address] = this._tokensByTicker[chainId][tokenData.ticker] = tokenData;
90
92
  }
93
+ const lpApi = new IntermediaryAPI_1.IntermediaryAPI(this.options.signedKeyBasedAuth != null
94
+ ? (0, SignedKeyBasedAuth_1.getSignedKeyBasedAuthHandler)(this.options.signedKeyBasedAuth.certificate, this.options.signedKeyBasedAuth.privateKey)
95
+ : undefined);
96
+ this.lpApi = lpApi;
91
97
  this.swapStateListener = (swap) => {
92
98
  this.emit("swapState", swap);
93
99
  };
@@ -118,35 +124,35 @@ class Swapper extends events_1.EventEmitter {
118
124
  const unifiedSwapStorage = new UnifiedSwapStorage_1.UnifiedSwapStorage(storageHandler, this.options.noSwapCache);
119
125
  const unifiedChainEvents = new UnifiedSwapEventListener_1.UnifiedSwapEventListener(unifiedSwapStorage, chainEvents);
120
126
  const wrappers = {};
121
- wrappers[SwapType_1.SwapType.TO_BTCLN] = new ToBTCLNWrapper_1.ToBTCLNWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, {
127
+ wrappers[SwapType_1.SwapType.TO_BTCLN] = new ToBTCLNWrapper_1.ToBTCLNWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, lpApi, {
122
128
  getRequestTimeout: this.options.getRequestTimeout,
123
129
  postRequestTimeout: this.options.postRequestTimeout,
124
130
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
125
131
  });
126
- wrappers[SwapType_1.SwapType.TO_BTC] = new ToBTCWrapper_1.ToBTCWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, this._bitcoinRpc, {
132
+ wrappers[SwapType_1.SwapType.TO_BTC] = new ToBTCWrapper_1.ToBTCWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, this._bitcoinRpc, lpApi, {
127
133
  getRequestTimeout: this.options.getRequestTimeout,
128
134
  postRequestTimeout: this.options.postRequestTimeout,
129
135
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
130
136
  bitcoinNetwork: this._btcNetwork
131
137
  });
132
- wrappers[SwapType_1.SwapType.FROM_BTCLN] = new FromBTCLNWrapper_1.FromBTCLNWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, lightningApi, {
138
+ wrappers[SwapType_1.SwapType.FROM_BTCLN] = new FromBTCLNWrapper_1.FromBTCLNWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, lightningApi, lpApi, {
133
139
  getRequestTimeout: this.options.getRequestTimeout,
134
140
  postRequestTimeout: this.options.postRequestTimeout,
135
141
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
136
142
  unsafeSkipLnNodeCheck: this.bitcoinNetwork === base_1.BitcoinNetwork.TESTNET4 || this.bitcoinNetwork === base_1.BitcoinNetwork.REGTEST
137
143
  });
138
- wrappers[SwapType_1.SwapType.FROM_BTC] = new FromBTCWrapper_1.FromBTCWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, versionedContracts, this._bitcoinRpc, {
144
+ wrappers[SwapType_1.SwapType.FROM_BTC] = new FromBTCWrapper_1.FromBTCWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, versionedContracts, this._bitcoinRpc, lpApi, {
139
145
  getRequestTimeout: this.options.getRequestTimeout,
140
146
  postRequestTimeout: this.options.postRequestTimeout,
141
147
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
142
148
  bitcoinNetwork: this._btcNetwork
143
149
  });
144
- wrappers[SwapType_1.SwapType.TRUSTED_FROM_BTCLN] = new LnForGasWrapper_1.LnForGasWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], {
150
+ wrappers[SwapType_1.SwapType.TRUSTED_FROM_BTCLN] = new LnForGasWrapper_1.LnForGasWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], lpApi, {
145
151
  getRequestTimeout: this.options.getRequestTimeout,
146
152
  postRequestTimeout: this.options.postRequestTimeout,
147
153
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
148
154
  });
149
- wrappers[SwapType_1.SwapType.TRUSTED_FROM_BTC] = new OnchainForGasWrapper_1.OnchainForGasWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], bitcoinRpc, {
155
+ wrappers[SwapType_1.SwapType.TRUSTED_FROM_BTC] = new OnchainForGasWrapper_1.OnchainForGasWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], bitcoinRpc, lpApi, {
150
156
  getRequestTimeout: this.options.getRequestTimeout,
151
157
  postRequestTimeout: this.options.postRequestTimeout,
152
158
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
@@ -154,7 +160,7 @@ class Swapper extends events_1.EventEmitter {
154
160
  });
155
161
  // This is gated on the default version of the contracts
156
162
  if (spvVaultContract != null) {
157
- wrappers[SwapType_1.SwapType.SPV_VAULT_FROM_BTC] = new SpvFromBTCWrapper_1.SpvFromBTCWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, versionedContracts, bitcoinRpc, {
163
+ wrappers[SwapType_1.SwapType.SPV_VAULT_FROM_BTC] = new SpvFromBTCWrapper_1.SpvFromBTCWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, versionedContracts, bitcoinRpc, lpApi, {
158
164
  getRequestTimeout: this.options.getRequestTimeout,
159
165
  postRequestTimeout: this.options.postRequestTimeout,
160
166
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
@@ -163,7 +169,7 @@ class Swapper extends events_1.EventEmitter {
163
169
  }
164
170
  // This is gated on the default version of the contracts
165
171
  if (swapContract.supportsInitWithoutClaimer) {
166
- wrappers[SwapType_1.SwapType.FROM_BTCLN_AUTO] = new FromBTCLNAutoWrapper_1.FromBTCLNAutoWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, lightningApi, this.messenger, {
172
+ wrappers[SwapType_1.SwapType.FROM_BTCLN_AUTO] = new FromBTCLNAutoWrapper_1.FromBTCLNAutoWrapper(key, unifiedSwapStorage, unifiedChainEvents, chainInterface, pricing, this._tokens[chainId], versions, lightningApi, this.messenger, lpApi, {
167
173
  getRequestTimeout: this.options.getRequestTimeout,
168
174
  postRequestTimeout: this.options.postRequestTimeout,
169
175
  saveUninitializedSwaps: this.options.saveUninitializedSwaps,
@@ -190,10 +196,10 @@ class Swapper extends events_1.EventEmitter {
190
196
  });
191
197
  const contracts = (0, Utils_1.objectMap)(chainsData, (data) => data.versions ?? { [data.defaultVersion ?? "v1"]: { swapContract: data.swapContract, spvVaultContract: data.spvVaultContract } });
192
198
  if (options.intermediaryUrl != null) {
193
- this.intermediaryDiscovery = new IntermediaryDiscovery_1.IntermediaryDiscovery(contracts, options.registryUrl, Array.isArray(options.intermediaryUrl) ? options.intermediaryUrl : [options.intermediaryUrl], options.getRequestTimeout);
199
+ this.intermediaryDiscovery = new IntermediaryDiscovery_1.IntermediaryDiscovery(contracts, lpApi, options.registryUrl, Array.isArray(options.intermediaryUrl) ? options.intermediaryUrl : [options.intermediaryUrl], options.getRequestTimeout);
194
200
  }
195
201
  else {
196
- this.intermediaryDiscovery = new IntermediaryDiscovery_1.IntermediaryDiscovery(contracts, options.registryUrl, undefined, options.getRequestTimeout);
202
+ this.intermediaryDiscovery = new IntermediaryDiscovery_1.IntermediaryDiscovery(contracts, lpApi, options.registryUrl, undefined, options.getRequestTimeout);
197
203
  }
198
204
  this.intermediaryDiscovery.on("removed", (intermediaries) => {
199
205
  this.emit("lpsRemoved", intermediaries);
@@ -203,7 +209,7 @@ class Swapper extends events_1.EventEmitter {
203
209
  });
204
210
  }
205
211
  async _init() {
206
- this.logger.debug("init(): Initializing swapper...");
212
+ this.logger.debug("init(): Initializing swapper");
207
213
  const abortController = new AbortController();
208
214
  const promises = [];
209
215
  let automaticClockDriftCorrectionPromise = undefined;
@@ -240,40 +246,48 @@ class Swapper extends events_1.EventEmitter {
240
246
  for (let chainIdentifier in this._chains) {
241
247
  chainPromises.push((async () => {
242
248
  const { chainInterface, versionedContracts, unifiedChainEvents, unifiedSwapStorage, wrappers, reviver } = this._chains[chainIdentifier];
243
- const _chainInterface = chainInterface;
244
- if (_chainInterface.verifyNetwork != null) {
245
- await _chainInterface.verifyNetwork(this.bitcoinNetwork);
246
- }
247
- for (let contractVersion in versionedContracts) {
248
- await versionedContracts[contractVersion].swapContract.start();
249
- this.logger.debug("init(): Intialized swap contract: " + chainIdentifier + ` version: ${contractVersion}`);
249
+ try {
250
+ const _chainInterface = chainInterface;
251
+ if (_chainInterface.verifyNetwork != null) {
252
+ await _chainInterface.verifyNetwork(this.bitcoinNetwork);
253
+ }
254
+ for (let contractVersion in versionedContracts) {
255
+ await versionedContracts[contractVersion].swapContract.start();
256
+ this.logger.debug("init(): Intialized swap contract: " + chainIdentifier + ` version: ${contractVersion}`);
257
+ }
258
+ await unifiedSwapStorage.init();
259
+ if (unifiedSwapStorage.storage instanceof IndexedDBUnifiedStorage_1.IndexedDBUnifiedStorage) {
260
+ //Try to migrate the data here
261
+ const storagePrefix = chainIdentifier === "SOLANA" ?
262
+ "SOLv4-" + this.bitcoinNetwork + "-Swaps-" :
263
+ "atomiqsdk-" + this.bitcoinNetwork + chainIdentifier + "-Swaps-";
264
+ await unifiedSwapStorage.storage.tryMigrate([
265
+ [storagePrefix + "FromBTC", SwapType_1.SwapType.FROM_BTC],
266
+ [storagePrefix + "FromBTCLN", SwapType_1.SwapType.FROM_BTCLN],
267
+ [storagePrefix + "ToBTC", SwapType_1.SwapType.TO_BTC],
268
+ [storagePrefix + "ToBTCLN", SwapType_1.SwapType.TO_BTCLN]
269
+ ], (obj) => {
270
+ const swap = reviver(obj);
271
+ if (swap._randomNonce == null) {
272
+ const oldIdentifierHash = swap.getId();
273
+ swap._randomNonce = (0, Utils_1.randomBytes)(16).toString("hex");
274
+ const newIdentifierHash = swap.getId();
275
+ this.logger.info("init(): Found older swap version without randomNonce, replacing, old hash: " + oldIdentifierHash +
276
+ " new hash: " + newIdentifierHash);
277
+ }
278
+ return swap;
279
+ });
280
+ }
281
+ await unifiedChainEvents.start(this.options.noEvents);
282
+ this.logger.debug("init(): Initialized events: " + chainIdentifier);
250
283
  }
251
- await unifiedSwapStorage.init();
252
- if (unifiedSwapStorage.storage instanceof IndexedDBUnifiedStorage_1.IndexedDBUnifiedStorage) {
253
- //Try to migrate the data here
254
- const storagePrefix = chainIdentifier === "SOLANA" ?
255
- "SOLv4-" + this.bitcoinNetwork + "-Swaps-" :
256
- "atomiqsdk-" + this.bitcoinNetwork + chainIdentifier + "-Swaps-";
257
- await unifiedSwapStorage.storage.tryMigrate([
258
- [storagePrefix + "FromBTC", SwapType_1.SwapType.FROM_BTC],
259
- [storagePrefix + "FromBTCLN", SwapType_1.SwapType.FROM_BTCLN],
260
- [storagePrefix + "ToBTC", SwapType_1.SwapType.TO_BTC],
261
- [storagePrefix + "ToBTCLN", SwapType_1.SwapType.TO_BTCLN]
262
- ], (obj) => {
263
- const swap = reviver(obj);
264
- if (swap._randomNonce == null) {
265
- const oldIdentifierHash = swap.getId();
266
- swap._randomNonce = (0, Utils_1.randomBytes)(16).toString("hex");
267
- const newIdentifierHash = swap.getId();
268
- this.logger.info("init(): Found older swap version without randomNonce, replacing, old hash: " + oldIdentifierHash +
269
- " new hash: " + newIdentifierHash);
270
- }
271
- return swap;
272
- });
284
+ catch (e) {
285
+ if (!this.options.gracefullyHandleChainErrors)
286
+ throw e;
287
+ this.logger.error(`init(): Failed to initialize ${chainIdentifier} (skipped): `, e);
288
+ delete this._chains[chainIdentifier];
289
+ return;
273
290
  }
274
- if (!this.options.noEvents)
275
- await unifiedChainEvents.start();
276
- this.logger.debug("init(): Intialized events: " + chainIdentifier);
277
291
  for (let key in wrappers) {
278
292
  // this.logger.debug("init(): Initializing "+SwapType[key]+": "+chainIdentifier);
279
293
  await wrappers[key].init(this.options.noTimers, this.options.dontCheckPastSwaps);
@@ -307,6 +321,12 @@ class Swapper extends events_1.EventEmitter {
307
321
  throw e;
308
322
  }
309
323
  }
324
+ /**
325
+ * Whether the SDK is initialized (after {@link init} is called)
326
+ */
327
+ isInitialized() {
328
+ return this.initialized;
329
+ }
310
330
  /**
311
331
  * Stops listening for onchain events and closes this Swapper instance
312
332
  */
@@ -834,6 +854,10 @@ class Swapper extends events_1.EventEmitter {
834
854
  * @param options Options for the swap
835
855
  */
836
856
  swap(_srcToken, _dstToken, _amount, exactIn, src, dst, options) {
857
+ if (typeof (src) === "string")
858
+ src = this.Utils.stripAddress(src);
859
+ if (typeof (dst) === "string")
860
+ dst = this.Utils.stripAddress(dst);
837
861
  const srcToken = typeof (_srcToken) === "string" ? this.getToken(_srcToken) : _srcToken;
838
862
  const dstToken = typeof (_dstToken) === "string" ? this.getToken(_dstToken) : _dstToken;
839
863
  const amount = _amount == null ? null : (typeof (_amount) === "bigint" ? _amount : (0, Utils_1.fromDecimal)(_amount, exactIn ? srcToken.decimals : dstToken.decimals));
@@ -979,7 +1003,7 @@ class Swapper extends events_1.EventEmitter {
979
1003
  return await unifiedSwapStorage.query([queryParams], reviver);
980
1004
  }
981
1005
  }
982
- async getActionableSwaps(chainId, signer) {
1006
+ async getPendingSwaps(chainId, signer) {
983
1007
  if (chainId == null) {
984
1008
  const res = await Promise.all(Object.keys(this._chains).map((chainId) => {
985
1009
  const { unifiedSwapStorage, reviver, wrappers } = this._chains[chainId];
@@ -994,7 +1018,7 @@ class Swapper extends events_1.EventEmitter {
994
1018
  }
995
1019
  return unifiedSwapStorage.query(queryParams, reviver);
996
1020
  }));
997
- return res.flat().filter(swap => swap.requiresAction());
1021
+ return res.flat();
998
1022
  }
999
1023
  else {
1000
1024
  const { unifiedSwapStorage, reviver, wrappers } = this._chains[chainId];
@@ -1007,7 +1031,15 @@ class Swapper extends events_1.EventEmitter {
1007
1031
  swapTypeQueryParams.push({ key: "state", value: wrapper._pendingSwapStates });
1008
1032
  queryParams.push(swapTypeQueryParams);
1009
1033
  }
1010
- return (await unifiedSwapStorage.query(queryParams, reviver)).filter(swap => swap.requiresAction());
1034
+ return await unifiedSwapStorage.query(queryParams, reviver);
1035
+ }
1036
+ }
1037
+ async getActionableSwaps(chainId, signer) {
1038
+ if (chainId == null) {
1039
+ return (await this.getPendingSwaps()).filter(swap => swap.requiresAction());
1040
+ }
1041
+ else {
1042
+ return (await this.getPendingSwaps(chainId, signer)).filter(swap => swap.requiresAction());
1011
1043
  }
1012
1044
  }
1013
1045
  async getRefundableSwaps(chainId, signer) {
@@ -1189,8 +1221,8 @@ class Swapper extends events_1.EventEmitter {
1189
1221
  removeSwaps.push(...result.removeSwaps);
1190
1222
  }
1191
1223
  this.logger.debug("_syncSwaps(): Done syncing " + swaps.length + " swaps, saving " + changedSwaps.length + " changed swaps, removing " + removeSwaps.length + " swaps!");
1192
- await unifiedSwapStorage.saveAll(changedSwaps);
1193
- await unifiedSwapStorage.removeAll(removeSwaps);
1224
+ await unifiedSwapStorage.saveAll(changedSwaps, true);
1225
+ await unifiedSwapStorage.removeAll(removeSwaps, true);
1194
1226
  changedSwaps.forEach(swap => swap._emitEvent());
1195
1227
  removeSwaps.forEach(swap => swap._emitEvent());
1196
1228
  }
@@ -1244,6 +1276,19 @@ class Swapper extends events_1.EventEmitter {
1244
1276
  await this.syncSwapsForChain(chainId, signer);
1245
1277
  }
1246
1278
  }
1279
+ /**
1280
+ * When the swapper is initiated with the `noEvents` config this function allows you to manually poll for on-chain
1281
+ * events. It returns an events cursor which you should save and pass to the next call to the `poll()` function.
1282
+ *
1283
+ * @param chainId Chain for which to poll the chain events listener for
1284
+ * @param lastEventCursorState Event cursor state returned from the last call to the `poll()` function
1285
+ */
1286
+ async _pollChainEvents(chainId, lastEventCursorState) {
1287
+ const chain = this._chains[chainId];
1288
+ if (chain == null)
1289
+ throw new Error(`Invalid chain id ${chainId}!`);
1290
+ return chain.unifiedChainEvents.poll(lastEventCursorState);
1291
+ }
1247
1292
  /**
1248
1293
  * Recovers swaps from on-chain historical data.
1249
1294
  *
@@ -100,6 +100,14 @@ export declare class SwapperUtils<T extends MultiChain> {
100
100
  max?: TokenAmount;
101
101
  amount?: TokenAmount;
102
102
  } | null;
103
+ /**
104
+ * Strips the URL encoding around `bitcoin:` and `lightning:` addresses, leaving just the raw address
105
+ *
106
+ * @param addressString Address to strip
107
+ *
108
+ * @returns Raw clean address
109
+ */
110
+ stripAddress(addressString: string): string;
103
111
  /**
104
112
  * Returns a random PSBT that can be used for fee estimation for SPV vault (UTXO-controlled vault) based swaps
105
113
  * {@link SwapType.SPV_VAULT_FROM_BTC}, the last output (the LP output) is omitted to allow for coinselection
@@ -151,11 +159,11 @@ export declare class SwapperUtils<T extends MultiChain> {
151
159
  */
152
160
  randomSigner<ChainIdentifier extends ChainIds<T>>(chainIdentifier: ChainIdentifier): T[ChainIdentifier]["Signer"];
153
161
  /**
154
- * Returns a random address for a given smart chain
162
+ * Returns a random address for a given smart chain or bitcoin
155
163
  *
156
164
  * @param chainIdentifier
157
165
  */
158
- randomAddress<ChainIdentifier extends ChainIds<T>>(chainIdentifier: ChainIdentifier): string;
166
+ randomAddress<ChainIdentifier extends ChainIds<T>>(chainIdentifier: ChainIdentifier | "BITCOIN"): string;
159
167
  /**
160
168
  * Signs and broadcasts the supplied smart chain transaction
161
169
  *
@@ -175,6 +183,14 @@ export declare class SwapperUtils<T extends MultiChain> {
175
183
  * @param onBeforePublish Callback invoked before a transaction is sent (invoked for every transaction to be sent)
176
184
  */
177
185
  sendSignedAndConfirm<ChainIdentifier extends ChainIds<T>>(chainIdentifier: ChainIdentifier, txs: T[ChainIdentifier]["SignedTXType"][], abortSignal?: AbortSignal, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
186
+ /**
187
+ * Prepares a set of unsigned transactions for signing, by adding required nonces or recent blockhashes, might
188
+ * also add hints of account deployment on e.g. Starknet
189
+ *
190
+ * @param chainIdentifier A chain for which to prepare the txs
191
+ * @param txs Transactions to prepare
192
+ */
193
+ prepareUnsignedTransactions<ChainIdentifier extends ChainIds<T>>(chainIdentifier: ChainIdentifier, txs: T[ChainIdentifier]["TX"][]): Promise<T[ChainIdentifier]["TX"][]>;
178
194
  /**
179
195
  * Serializes an unsigned smart chain transaction
180
196
  *
@@ -284,6 +284,22 @@ class SwapperUtils {
284
284
  return resultLightningInvoice;
285
285
  return this.parseSmartchainAddress(addressString);
286
286
  }
287
+ /**
288
+ * Strips the URL encoding around `bitcoin:` and `lightning:` addresses, leaving just the raw address
289
+ *
290
+ * @param addressString Address to strip
291
+ *
292
+ * @returns Raw clean address
293
+ */
294
+ stripAddress(addressString) {
295
+ if (addressString.startsWith("lightning:") || addressString.startsWith("bitcoin:")) {
296
+ addressString = addressString.substring(addressString.indexOf(":") + 1);
297
+ const delimeterIndex = addressString.indexOf("?");
298
+ if (delimeterIndex !== -1)
299
+ addressString = addressString.substring(0, delimeterIndex);
300
+ }
301
+ return addressString;
302
+ }
287
303
  /**
288
304
  * Returns a random PSBT that can be used for fee estimation for SPV vault (UTXO-controlled vault) based swaps
289
305
  * {@link SwapType.SPV_VAULT_FROM_BTC}, the last output (the LP output) is omitted to allow for coinselection
@@ -397,11 +413,18 @@ class SwapperUtils {
397
413
  return this.root._chains[chainIdentifier].chainInterface.randomSigner();
398
414
  }
399
415
  /**
400
- * Returns a random address for a given smart chain
416
+ * Returns a random address for a given smart chain or bitcoin
401
417
  *
402
418
  * @param chainIdentifier
403
419
  */
404
420
  randomAddress(chainIdentifier) {
421
+ if (chainIdentifier === "BITCOIN") {
422
+ // Return random p2wkh address
423
+ return (0, btc_signer_1.Address)(this.bitcoinNetwork).encode({
424
+ type: "wpkh",
425
+ hash: (0, Utils_1.randomBytes)(20)
426
+ });
427
+ }
405
428
  if (this.root._chains[chainIdentifier] == null)
406
429
  throw new Error("Invalid chain identifier! Unknown chain: " + chainIdentifier);
407
430
  return this.root._chains[chainIdentifier].chainInterface.randomAddress();
@@ -433,6 +456,21 @@ class SwapperUtils {
433
456
  throw new Error("Invalid chain identifier! Unknown chain: " + chainIdentifier);
434
457
  return this.root._chains[chainIdentifier].chainInterface.sendSignedAndConfirm(txs, true, abortSignal, false, onBeforePublish);
435
458
  }
459
+ /**
460
+ * Prepares a set of unsigned transactions for signing, by adding required nonces or recent blockhashes, might
461
+ * also add hints of account deployment on e.g. Starknet
462
+ *
463
+ * @param chainIdentifier A chain for which to prepare the txs
464
+ * @param txs Transactions to prepare
465
+ */
466
+ prepareUnsignedTransactions(chainIdentifier, txs) {
467
+ if (this.root._chains[chainIdentifier] == null)
468
+ throw new Error("Invalid chain identifier! Unknown chain: " + chainIdentifier);
469
+ const chainInterface = this.root._chains[chainIdentifier].chainInterface;
470
+ if (chainInterface.prepareTxs == null)
471
+ throw new Error("Chain doesn't support tx preparation, chainId: " + chainIdentifier);
472
+ return chainInterface.prepareTxs(txs);
473
+ }
436
474
  /**
437
475
  * Serializes an unsigned smart chain transaction
438
476
  *
@@ -13,6 +13,7 @@ import { SwapExecutionAction } from "../types/SwapExecutionAction";
13
13
  import { LoggerType } from "../utils/Logger";
14
14
  import { PriceInfoType } from "../types/PriceInfoType";
15
15
  import { SwapStateInfo } from "../types/SwapStateInfo";
16
+ import { SwapExecutionStep } from "../types/SwapExecutionStep";
16
17
  /**
17
18
  * Initialization data for creating a swap
18
19
  *
@@ -124,6 +125,12 @@ export declare abstract class ISwap<T extends ChainType = ChainType, D extends S
124
125
  * @internal
125
126
  */
126
127
  _contractVersion?: string;
128
+ /**
129
+ * Storage specific metadata that can be used for e.g. optimistic concurrency
130
+ *
131
+ * @internal
132
+ */
133
+ _meta?: any;
127
134
  /**
128
135
  * Event emitter emitting `"swapState"` event when swap's state changes
129
136
  */
@@ -163,12 +170,6 @@ export declare abstract class ISwap<T extends ChainType = ChainType, D extends S
163
170
  * @internal
164
171
  */
165
172
  protected waitTillState(targetState: S, type?: "eq" | "gte" | "neq", abortSignal?: AbortSignal): Promise<void>;
166
- /**
167
- * Returns a list of steps or transactions required to finish and settle the swap
168
- *
169
- * @param options Additional options for executing the swap
170
- */
171
- abstract txsExecute(options?: any): Promise<SwapExecutionAction<T>[]>;
172
173
  /**
173
174
  * Executes the swap with the provided wallet, the exact arguments for this functions differ for various swap
174
175
  * types. Check the `execute()` function signature in the respective swap class to see the required arguments.
@@ -185,6 +186,12 @@ export declare abstract class ISwap<T extends ChainType = ChainType, D extends S
185
186
  * @internal
186
187
  */
187
188
  protected tryRecomputeSwapPrice(): void;
189
+ /**
190
+ * Returns the specific state along with the human-readable description of that state
191
+ *
192
+ * @internal
193
+ */
194
+ protected _getStateInfo(state: S): SwapStateInfo<S>;
188
195
  /**
189
196
  * Re-fetches & revalidates the price data based on the current market prices
190
197
  */
@@ -209,6 +216,13 @@ export declare abstract class ISwap<T extends ChainType = ChainType, D extends S
209
216
  * @internal
210
217
  */
211
218
  protected checkSigner(signer: T["Signer"] | string): void;
219
+ /**
220
+ * Await and prepares a list of passed transactions
221
+ *
222
+ * @param txsPromise
223
+ * @internal
224
+ */
225
+ protected prepareTransactions(txsPromise: Promise<T["TX"][]>): Promise<T["TX"][]>;
212
226
  /**
213
227
  * Returns an escrow hash of the swap
214
228
  *
@@ -312,10 +326,57 @@ export declare abstract class ISwap<T extends ChainType = ChainType, D extends S
312
326
  */
313
327
  getStateInfo(): SwapStateInfo<S>;
314
328
  /**
315
- * Returns a state-dependent set of actions for the user to execute, or empty array if there is currently
316
- * no action required from the user to execute.
329
+ * Returns a current state-dependent action for the user to execute, or `undefined` if there is no more action
330
+ * required for this swap - this means that the swap is probably finished (either expired, failed or settled).
331
+ *
332
+ * @param options Optional options argument for the additional action context (i.e. passing bitcoin wallet info to
333
+ * get funded PSBTs or passing the externally-generated swap secret), see the actual type in the respective swap
334
+ * classes
335
+ */
336
+ abstract getExecutionAction(options?: any): Promise<SwapExecutionAction | undefined>;
337
+ /**
338
+ * Returns a list of execution steps the user has to go through for a given swap, to see the possible execution
339
+ * steps check out {@link SwapExecutionStep}.
340
+ *
341
+ * @param options Optional options argument for the additional steps context (i.e. automatic settlement timeout),
342
+ * see the actual type in the respective swap classes
343
+ */
344
+ abstract getExecutionSteps(options?: any): Promise<SwapExecutionStep[]>;
345
+ /**
346
+ * Returns the current action and the full execution steps for a given swap. Prefer this to calling
347
+ * {@link getExecutionSteps} and {@link getExecutionAction} separately - if called sequentially they might
348
+ * return the respective steps/actions in different states if you hit the state transition boundary.
349
+ *
350
+ * @param options Optional options argument for the additional execution status context, see the actual type in
351
+ * the respective swap classes
352
+ */
353
+ abstract getExecutionStatus(options?: {
354
+ skipBuildingAction?: boolean;
355
+ } & any): Promise<{
356
+ steps: SwapExecutionStep[];
357
+ currentAction: SwapExecutionAction | undefined;
358
+ stateInfo: SwapStateInfo<S>;
359
+ }>;
360
+ /**
361
+ * Submits signed transactions obtained from the execution action back to the swap.
362
+ *
363
+ * @remarks This endpoint will also wait till the submitted transactions are confirmed (on a smart-chain side)
364
+ * and till the swap state change is observed from the authoritative chain/intermediary state.
365
+ *
366
+ * If invalid transactions are submitted, i.e. sending a simple noop or transfer transaction instead of the
367
+ * expected tx, this call may wait indefinitely unless aborted via the AbortSignal.
368
+ *
369
+ * @param txs Signed transactions
370
+ * @param abortSignal Abort signal
371
+ * @param requiredStates Optional list of states that the swap has to be in for the transactions to be
372
+ * submitted, else throws
373
+ * @param idempotent Whether the tx submission should be handled idempotently, meaning if any of the supplied
374
+ * transactions are already processed as e.g. init, claim, refund or execution transactions the function just
375
+ * returns these transaction IDs without actually submitting them
376
+ *
377
+ * @internal
317
378
  */
318
- abstract getCurrentActions(): Promise<SwapExecutionAction<T>[]>;
379
+ abstract _submitExecutionTransactions(txs: (T["SignedTXType"] | string | any)[], abortSignal?: AbortSignal, requiredStates?: S[], idempotent?: boolean): Promise<string[]>;
319
380
  /**
320
381
  * Returns output amount of the swap, user receives this much
321
382
  */