New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

crosslightning-intermediary

Package Overview
Dependencies
Maintainers
1
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crosslightning-intermediary - npm Package Compare versions

Comparing version 6.0.10 to 6.0.11

1

dist/swaps/frombtcln_abstract/FromBtcLnAbs.d.ts

@@ -19,2 +19,3 @@ import * as BN from "bn.js";

safetyFactor: BN;
invoiceTimeoutSeconds?: number;
minCltv: BN;

@@ -21,0 +22,0 @@ refundInterval: number;

33

dist/swaps/frombtcln_abstract/FromBtcLnAbs.js

@@ -31,2 +31,3 @@ "use strict";

this.config = config;
this.config.invoiceTimeoutSeconds = this.config.invoiceTimeoutSeconds || 60;
}

@@ -271,8 +272,11 @@ /**

const useToken = invoiceData.data.getToken();
// const invoiceAmount: BN = new BN(invoice.received);
// const fee: BN = invoiceData.swapFee;
//
// const invoiceAmountInToken = await this.swapPricing.getFromBtcSwapAmount(invoiceAmount, useToken);
// const feeInToken = await this.swapPricing.getFromBtcSwapAmount(fee, useToken, true);
//
// const sendAmount: BN = invoiceAmountInToken.sub(feeInToken);
const sendAmount = yield invoiceData.data.getAmount();
const balance = yield this.swapContract.getBalance(useToken, true);
const invoiceAmount = new BN(invoice.received);
const fee = invoiceData.swapFee;
const invoiceAmountInToken = yield this.swapPricing.getFromBtcSwapAmount(invoiceAmount, useToken);
const feeInToken = yield this.swapPricing.getFromBtcSwapAmount(fee, useToken, true);
const sendAmount = invoiceAmountInToken.sub(feeInToken);
const cancelAndRemove = () => __awaiter(this, void 0, void 0, function* () {

@@ -338,3 +342,2 @@ if (invoiceData.state !== FromBtcLnSwapAbs_1.FromBtcLnSwapState.CREATED)

* amount: string amount (in sats) of the invoice
* expiry: number expiry time of the invoice (in seconds)
* token: string Desired token to swap

@@ -352,3 +355,3 @@ * exactOut: boolean Whether the swap should be an exact out instead of exact in swap

amount: Utils_1.FieldTypeEnum.BN,
expiry: Utils_1.FieldTypeEnum.Number,
//expiry: FieldTypeEnum.Number,
token: (val) => val != null &&

@@ -433,8 +436,8 @@ typeof (val) === "string" &&

}
if (parsedBody.expiry <= 0) {
res.status(400).json({
msg: "Invalid request body (expiry)"
});
return;
}
// if(parsedBody.expiry<=0) {
// res.status(400).json({
// msg: "Invalid request body (expiry)"
// });
// return;
// }
const swapFee = this.config.baseFee.add(amountBD.mul(this.config.feePPM).div(new BN(1000000)));

@@ -463,3 +466,3 @@ const swapFeeInToken = yield this.swapPricing.getFromBtcSwapAmount(swapFee, useToken, true);

cltv_delta: this.config.minCltv.add(new BN(5)).toString(10),
expires_at: new Date(Date.now() + (parsedBody.expiry * 1000)).toISOString(),
expires_at: new Date(Date.now() + (this.config.invoiceTimeoutSeconds * 1000)).toISOString(),
id: parsedBody.paymentHash,

@@ -488,3 +491,3 @@ tokens: amountBD.toString(10),

const totalSecurityDeposit = baseSD.add(variableSD);
createdSwap.data = yield this.swapContract.createSwapData(crosslightning_base_1.ChainSwapType.HTLC, this.swapContract.getAddress(), parsedBody.address, useToken, null, parsedBody.paymentHash, null, null, 0, false, true, totalSecurityDeposit, new BN(0));
createdSwap.data = yield this.swapContract.createSwapData(crosslightning_base_1.ChainSwapType.HTLC, this.swapContract.getAddress(), parsedBody.address, useToken, total, parsedBody.paymentHash, null, null, 0, false, true, totalSecurityDeposit, new BN(0));
yield PluginManager_1.PluginManager.swapStateChange(createdSwap);

@@ -491,0 +494,0 @@ yield this.storageManager.saveData(parsedBody.paymentHash, createdSwap);

{
"name": "crosslightning-intermediary",
"version": "6.0.10",
"version": "6.0.11",
"description": "Main functionality implementation for intermediary node, easily extensible to any chain",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -36,2 +36,3 @@ import * as BN from "bn.js";

safetyFactor: BN,
invoiceTimeoutSeconds?: number,

@@ -69,2 +70,3 @@ minCltv: BN,

this.config = config;
this.config.invoiceTimeoutSeconds = this.config.invoiceTimeoutSeconds || 60;
}

@@ -341,12 +343,13 @@

// const invoiceAmount: BN = new BN(invoice.received);
// const fee: BN = invoiceData.swapFee;
//
// const invoiceAmountInToken = await this.swapPricing.getFromBtcSwapAmount(invoiceAmount, useToken);
// const feeInToken = await this.swapPricing.getFromBtcSwapAmount(fee, useToken, true);
//
// const sendAmount: BN = invoiceAmountInToken.sub(feeInToken);
const sendAmount: BN = await invoiceData.data.getAmount();
const balance: BN = await this.swapContract.getBalance(useToken, true);
const invoiceAmount: BN = new BN(invoice.received);
const fee: BN = invoiceData.swapFee;
const invoiceAmountInToken = await this.swapPricing.getFromBtcSwapAmount(invoiceAmount, useToken);
const feeInToken = await this.swapPricing.getFromBtcSwapAmount(fee, useToken, true);
const sendAmount: BN = invoiceAmountInToken.sub(feeInToken);
const cancelAndRemove = async () => {

@@ -430,3 +433,2 @@ if(invoiceData.state!==FromBtcLnSwapState.CREATED) return;

}
}

@@ -441,3 +443,2 @@

* amount: string amount (in sats) of the invoice
* expiry: number expiry time of the invoice (in seconds)
* token: string Desired token to swap

@@ -456,3 +457,3 @@ * exactOut: boolean Whether the swap should be an exact out instead of exact in swap

amount: FieldTypeEnum.BN,
expiry: FieldTypeEnum.Number,
//expiry: FieldTypeEnum.Number,
token: (val: string) => val!=null &&

@@ -546,8 +547,8 @@ typeof(val)==="string" &&

if(parsedBody.expiry<=0) {
res.status(400).json({
msg: "Invalid request body (expiry)"
});
return;
}
// if(parsedBody.expiry<=0) {
// res.status(400).json({
// msg: "Invalid request body (expiry)"
// });
// return;
// }
const swapFee = this.config.baseFee.add(amountBD.mul(this.config.feePPM).div(new BN(1000000)));

@@ -579,3 +580,3 @@ const swapFeeInToken = await this.swapPricing.getFromBtcSwapAmount(swapFee, useToken, true);

cltv_delta: this.config.minCltv.add(new BN(5)).toString(10),
expires_at: new Date(Date.now()+(parsedBody.expiry*1000)).toISOString(),
expires_at: new Date(Date.now()+(this.config.invoiceTimeoutSeconds*1000)).toISOString(),
id: parsedBody.paymentHash,

@@ -618,3 +619,3 @@ tokens: amountBD.toString(10),

useToken,
null,
total,
parsedBody.paymentHash,

@@ -621,0 +622,0 @@ null,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc