@atomiqlabs/sdk 8.7.6 → 8.7.7

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.
@@ -606,6 +606,8 @@ class Swapper extends events_1.EventEmitter {
606
606
  async createFromBTCSwapNew(chainIdentifier, recipient, tokenAddress, amount, exactOut = false, additionalParams = this.options.defaultAdditionalParameters, options) {
607
607
  if (this._chains[chainIdentifier] == null)
608
608
  throw new Error("Invalid chain identifier! Unknown chain: " + chainIdentifier);
609
+ if (this._chains[chainIdentifier].wrappers[SwapType_1.SwapType.SPV_VAULT_FROM_BTC] == null)
610
+ throw new Error("Chain " + chainIdentifier + " doesn't support new BTC swap protocol (spv vault swaps)!");
609
611
  if (!this._chains[chainIdentifier].chainInterface.isValidAddress(recipient, true))
610
612
  throw new Error("Invalid " + chainIdentifier + " address");
611
613
  recipient = this._chains[chainIdentifier].chainInterface.normalizeAddress(recipient);
@@ -706,6 +708,8 @@ class Swapper extends events_1.EventEmitter {
706
708
  async createFromBTCLNSwapNew(chainIdentifier, recipient, tokenAddress, amount, exactOut = false, additionalParams = this.options.defaultAdditionalParameters, options) {
707
709
  if (this._chains[chainIdentifier] == null)
708
710
  throw new Error("Invalid chain identifier! Unknown chain: " + chainIdentifier);
711
+ if (this._chains[chainIdentifier].wrappers[SwapType_1.SwapType.FROM_BTCLN_AUTO] == null)
712
+ throw new Error("Chain " + chainIdentifier + " doesn't support new lightning swap protocol (from btcln auto)!");
709
713
  if (!this._chains[chainIdentifier].chainInterface.isValidAddress(recipient, true))
710
714
  throw new Error("Invalid " + chainIdentifier + " address");
711
715
  recipient = this._chains[chainIdentifier].chainInterface.normalizeAddress(recipient);
@@ -732,6 +736,8 @@ class Swapper extends events_1.EventEmitter {
732
736
  async createFromBTCLNSwapNewViaLNURL(chainIdentifier, recipient, tokenAddress, lnurl, amount, exactOut = false, additionalParams = this.options.defaultAdditionalParameters, options) {
733
737
  if (this._chains[chainIdentifier] == null)
734
738
  throw new Error("Invalid chain identifier! Unknown chain: " + chainIdentifier);
739
+ if (this._chains[chainIdentifier].wrappers[SwapType_1.SwapType.FROM_BTCLN_AUTO] == null)
740
+ throw new Error("Chain " + chainIdentifier + " doesn't support new lightning swap protocol (from btcln auto)!");
735
741
  if (typeof (lnurl) === "string" && !this.Utils.isValidLNURL(lnurl))
736
742
  throw new Error("Invalid LNURL-withdraw link");
737
743
  if (!this._chains[chainIdentifier].chainInterface.isValidAddress(recipient, true))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/sdk",
3
- "version": "8.7.6",
3
+ "version": "8.7.7",
4
4
  "description": "atomiq labs SDK for cross-chain swaps between smart chains and bitcoin",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -1108,6 +1108,7 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
1108
1108
  options?: SpvFromBTCOptions
1109
1109
  ): Promise<SpvFromBTCSwap<T[ChainIdentifier]>> {
1110
1110
  if(this._chains[chainIdentifier]==null) throw new Error("Invalid chain identifier! Unknown chain: "+chainIdentifier);
1111
+ if(this._chains[chainIdentifier].wrappers[SwapType.SPV_VAULT_FROM_BTC]==null) throw new Error("Chain "+chainIdentifier+" doesn't support new BTC swap protocol (spv vault swaps)!");
1111
1112
  if(!this._chains[chainIdentifier].chainInterface.isValidAddress(recipient, true)) throw new Error("Invalid "+chainIdentifier+" address");
1112
1113
  recipient = this._chains[chainIdentifier].chainInterface.normalizeAddress(recipient);
1113
1114
  const amountData = {
@@ -1285,6 +1286,7 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
1285
1286
  options?: FromBTCLNAutoOptions
1286
1287
  ): Promise<FromBTCLNAutoSwap<T[ChainIdentifier]>> {
1287
1288
  if(this._chains[chainIdentifier]==null) throw new Error("Invalid chain identifier! Unknown chain: "+chainIdentifier);
1289
+ if(this._chains[chainIdentifier].wrappers[SwapType.FROM_BTCLN_AUTO]==null) throw new Error("Chain "+chainIdentifier+" doesn't support new lightning swap protocol (from btcln auto)!");
1288
1290
  if(!this._chains[chainIdentifier].chainInterface.isValidAddress(recipient, true)) throw new Error("Invalid "+chainIdentifier+" address");
1289
1291
  recipient = this._chains[chainIdentifier].chainInterface.normalizeAddress(recipient);
1290
1292
  const amountData = {
@@ -1331,6 +1333,7 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
1331
1333
  options?: FromBTCLNAutoOptions
1332
1334
  ): Promise<FromBTCLNAutoSwap<T[ChainIdentifier]>> {
1333
1335
  if(this._chains[chainIdentifier]==null) throw new Error("Invalid chain identifier! Unknown chain: "+chainIdentifier);
1336
+ if(this._chains[chainIdentifier].wrappers[SwapType.FROM_BTCLN_AUTO]==null) throw new Error("Chain "+chainIdentifier+" doesn't support new lightning swap protocol (from btcln auto)!");
1334
1337
  if(typeof(lnurl)==="string" && !this.Utils.isValidLNURL(lnurl)) throw new Error("Invalid LNURL-withdraw link");
1335
1338
  if(!this._chains[chainIdentifier].chainInterface.isValidAddress(recipient, true)) throw new Error("Invalid "+chainIdentifier+" address");
1336
1339
  recipient = this._chains[chainIdentifier].chainInterface.normalizeAddress(recipient);