@atomiqlabs/sdk 8.7.4 → 8.7.6

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.
@@ -384,7 +384,7 @@ class SwapperUtils {
384
384
  const { chainInterface } = this.root._chains[token.chainId];
385
385
  if (chainInterface.shouldGetNativeTokenDrop != null)
386
386
  return chainInterface.shouldGetNativeTokenDrop(token.address);
387
- return chainInterface.getNativeCurrencyAddress() === token.address;
387
+ return chainInterface.getNativeCurrencyAddress() !== token.address;
388
388
  }
389
389
  /**
390
390
  * Returns a random signer for a given smart chain
@@ -221,7 +221,7 @@ class FromBTCLNWrapper extends IFromBTCLNWrapper_1.IFromBTCLNWrapper {
221
221
  if (decodedPr.timeExpireDate == null)
222
222
  throw new IntermediaryError_1.IntermediaryError("Invalid returned swap invoice, no expiry date field");
223
223
  const amountIn = (BigInt(decodedPr.millisatoshis) + 999n) / 1000n;
224
- const swapFeeBtc = resp.swapFee * amountIn / (resp.total - resp.swapFee);
224
+ const swapFeeBtc = resp.swapFee * amountIn / (resp.total + resp.swapFee);
225
225
  try {
226
226
  this.verifyReturnedData(resp, amountData, lp, _options, decodedPr, paymentHash);
227
227
  const [pricingInfo] = await Promise.all([
@@ -335,7 +335,7 @@ class FromBTCWrapper extends IFromBTCWrapper_1.IFromBTCWrapper {
335
335
  }, undefined, e => e instanceof RequestError_1.RequestError, abortController.signal);
336
336
  const data = new (this._swapDataDeserializer(version))(resp.data);
337
337
  data.setClaimer(recipient);
338
- const swapFeeBtc = resp.swapFee * resp.amount / (data.getAmount() - resp.swapFee);
338
+ const swapFeeBtc = resp.swapFee * resp.amount / (data.getAmount() + resp.swapFee);
339
339
  this.verifyReturnedData(recipient, resp, amountData, lp, _options, data, sequence, (await claimerBountyPrefetchPromise[version]), nativeTokenAddress);
340
340
  const [pricingInfo, signatureExpiry] = await Promise.all([
341
341
  //Get intermediary's liquidity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/sdk",
3
- "version": "8.7.4",
3
+ "version": "8.7.6",
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",
@@ -342,7 +342,7 @@ export class FromBTCLNWrapper<
342
342
  if(decodedPr.timeExpireDate==null) throw new IntermediaryError("Invalid returned swap invoice, no expiry date field");
343
343
  const amountIn = (BigInt(decodedPr.millisatoshis) + 999n) / 1000n;
344
344
 
345
- const swapFeeBtc = resp.swapFee * amountIn / (resp.total - resp.swapFee);
345
+ const swapFeeBtc = resp.swapFee * amountIn / (resp.total + resp.swapFee);
346
346
 
347
347
  try {
348
348
  this.verifyReturnedData(resp, amountData, lp, _options, decodedPr, paymentHash);
@@ -528,7 +528,7 @@ export class FromBTCWrapper<
528
528
  const data: T["Data"] = new (this._swapDataDeserializer(version))(resp.data);
529
529
  data.setClaimer(recipient);
530
530
 
531
- const swapFeeBtc = resp.swapFee * resp.amount / (data.getAmount() - resp.swapFee);
531
+ const swapFeeBtc = resp.swapFee * resp.amount / (data.getAmount() + resp.swapFee);
532
532
 
533
533
  this.verifyReturnedData(recipient, resp, amountData, lp, _options, data, sequence, (await claimerBountyPrefetchPromise[version])!, nativeTokenAddress);
534
534
  const [pricingInfo, signatureExpiry] = await Promise.all([