crosslightning-sdk-base
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -50,2 +50,3 @@ /// <reference types="node" /> | ||
nonce: number; | ||
amount: BN; | ||
}>; | ||
@@ -52,0 +53,0 @@ payLightning(bolt11PayReq: string, expirySeconds: number, maxFee: BN, url: string, requiredToken?: TokenAddress, requiredClaimerKey?: string, requiredBaseFee?: BN, requiredFeePPM?: BN): Promise<{ |
@@ -275,3 +275,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
signature: jsonBody.data.signature, | ||
nonce: jsonBody.data.nonce | ||
nonce: jsonBody.data.nonce, | ||
amount: amount | ||
}; | ||
@@ -278,0 +279,0 @@ }); |
@@ -33,3 +33,3 @@ import { SoltoBTCSwap } from "./SoltoBTCSwap"; | ||
* @param address Bitcoin on-chain address you wish to pay to | ||
* @param amount Amount of token to send, in base units | ||
* @param tokenAmount Amount of token to send, in base units | ||
* @param confirmationTarget Time preference of the transaction (in how many blocks should it confirm) | ||
@@ -43,3 +43,3 @@ * @param confirmations Confirmations required for intermediary to claim the funds from PTLC (this determines the safety of swap) | ||
*/ | ||
createExactIn(address: string, amount: BN, confirmationTarget: number, confirmations: number, url: string, requiredToken?: TokenAddress, requiredKey?: string, requiredBaseFee?: BN, requiredFeePPM?: BN): Promise<SoltoBTCSwap<T>>; | ||
createExactIn(address: string, tokenAmount: BN, confirmationTarget: number, confirmations: number, url: string, requiredToken?: TokenAddress, requiredKey?: string, requiredBaseFee?: BN, requiredFeePPM?: BN): Promise<SoltoBTCSwap<T>>; | ||
/** | ||
@@ -46,0 +46,0 @@ * Initializes the wrapper, be sure to call this before taking any other actions. |
@@ -50,3 +50,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
* @param address Bitcoin on-chain address you wish to pay to | ||
* @param amount Amount of token to send, in base units | ||
* @param tokenAmount Amount of token to send, in base units | ||
* @param confirmationTarget Time preference of the transaction (in how many blocks should it confirm) | ||
@@ -60,8 +60,8 @@ * @param confirmations Confirmations required for intermediary to claim the funds from PTLC (this determines the safety of swap) | ||
*/ | ||
createExactIn(address, amount, confirmationTarget, confirmations, url, requiredToken, requiredKey, requiredBaseFee, requiredFeePPM) { | ||
createExactIn(address, tokenAmount, confirmationTarget, confirmations, url, requiredToken, requiredKey, requiredBaseFee, requiredFeePPM) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!this.isInitialized) | ||
throw new Error("Not initialized, call init() first!"); | ||
const result = yield this.contract.payOnchainExactIn(address, amount, confirmationTarget, confirmations, url, requiredToken, requiredKey, requiredBaseFee, requiredFeePPM); | ||
const swap = new SoltoBTCSwap(this, address, amount, confirmationTarget, result.networkFee, result.swapFee, result.totalFee, result.data, result.prefix, result.timeout, result.signature, result.nonce, url); | ||
const result = yield this.contract.payOnchainExactIn(address, tokenAmount, confirmationTarget, confirmations, url, requiredToken, requiredKey, requiredBaseFee, requiredFeePPM); | ||
const swap = new SoltoBTCSwap(this, address, result.amount, confirmationTarget, result.networkFee, result.swapFee, result.totalFee, result.data, result.prefix, result.timeout, result.signature, result.nonce, url); | ||
yield swap.save(); | ||
@@ -68,0 +68,0 @@ this.swapData[result.data.getHash()] = swap; |
{ | ||
"name": "crosslightning-sdk-base", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "CrossLightning SDK chain-agnostic base", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -253,3 +253,4 @@ import * as BN from "bn.js"; | ||
signature: string, | ||
nonce: number | ||
nonce: number, | ||
amount: BN | ||
}> { | ||
@@ -376,3 +377,4 @@ const firstPart = new BN(Math.floor((Date.now()/1000)) - 700000000); | ||
signature: jsonBody.data.signature, | ||
nonce: jsonBody.data.nonce | ||
nonce: jsonBody.data.nonce, | ||
amount: amount | ||
}; | ||
@@ -379,0 +381,0 @@ } |
@@ -67,3 +67,3 @@ import {SoltoBTCSwap} from "./SoltoBTCSwap"; | ||
* @param address Bitcoin on-chain address you wish to pay to | ||
* @param amount Amount of token to send, in base units | ||
* @param tokenAmount Amount of token to send, in base units | ||
* @param confirmationTarget Time preference of the transaction (in how many blocks should it confirm) | ||
@@ -77,7 +77,7 @@ * @param confirmations Confirmations required for intermediary to claim the funds from PTLC (this determines the safety of swap) | ||
*/ | ||
async createExactIn(address: string, amount: BN, confirmationTarget: number, confirmations: number, url: string, requiredToken?: TokenAddress, requiredKey?: string, requiredBaseFee?: BN, requiredFeePPM?: BN): Promise<SoltoBTCSwap<T>> { | ||
async createExactIn(address: string, tokenAmount: BN, confirmationTarget: number, confirmations: number, url: string, requiredToken?: TokenAddress, requiredKey?: string, requiredBaseFee?: BN, requiredFeePPM?: BN): Promise<SoltoBTCSwap<T>> { | ||
if(!this.isInitialized) throw new Error("Not initialized, call init() first!"); | ||
const result = await this.contract.payOnchainExactIn(address, amount, confirmationTarget, confirmations, url, requiredToken, requiredKey, requiredBaseFee, requiredFeePPM); | ||
const result = await this.contract.payOnchainExactIn(address, tokenAmount, confirmationTarget, confirmations, url, requiredToken, requiredKey, requiredBaseFee, requiredFeePPM); | ||
@@ -87,3 +87,3 @@ const swap = new SoltoBTCSwap( | ||
address, | ||
amount, | ||
result.amount, | ||
confirmationTarget, | ||
@@ -90,0 +90,0 @@ result.networkFee, |
421642
9497