crosslightning-sdk-base
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -24,2 +24,13 @@ /// <reference types="node" /> | ||
}; | ||
export type LNURLPay = { | ||
type: "pay"; | ||
min: BN; | ||
max: BN; | ||
commentMaxLength: number; | ||
}; | ||
export type LNURLWithdraw = { | ||
type: "withdraw"; | ||
min: BN; | ||
max: BN; | ||
}; | ||
export declare class ClientSwapContract<T extends SwapData> { | ||
@@ -37,11 +48,3 @@ readonly btcRpc: BitcoinRpc<any>; | ||
isLNURL(str: string): boolean; | ||
isLNURLPay(str: string): Promise<{ | ||
min: BN; | ||
max: BN; | ||
commentMaxLength: number; | ||
} | null>; | ||
isLNURLWithdraw(str: string): Promise<{ | ||
min: BN; | ||
max: BN; | ||
} | null>; | ||
getLNURLType(str: string): Promise<LNURLPay | LNURLWithdraw | null>; | ||
payOnchain(address: string, amount: BN, confirmationTarget: number, confirmations: number, url: string, requiredToken?: TokenAddress, requiredClaimerKey?: string, requiredBaseFee?: BN, requiredFeePPM?: BN): Promise<{ | ||
@@ -48,0 +51,0 @@ networkFee: BN; |
@@ -72,3 +72,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
isLNURLPay(str) { | ||
getLNURLType(str) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -82,2 +82,3 @@ const lnurl = findlnurl(str); | ||
return { | ||
type: "pay", | ||
min: new BN(payRequest.minSendable).div(new BN(1000)), | ||
@@ -88,16 +89,8 @@ max: new BN(payRequest.maxSendable).div(new BN(1000)), | ||
} | ||
return null; | ||
}); | ||
} | ||
isLNURLWithdraw(str) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const lnurl = findlnurl(str); | ||
if (lnurl == null) | ||
return null; | ||
const res = yield getParams(lnurl); | ||
if (res.tag === "withdrawRequest") { | ||
const payRequest = res; | ||
return { | ||
type: "withdraw", | ||
min: new BN(payRequest.minWithdrawable).div(new BN(1000)), | ||
max: new BN(payRequest.maxWithdrawable).div(new BN(1000)), | ||
max: new BN(payRequest.maxWithdrawable).div(new BN(1000)) | ||
}; | ||
@@ -104,0 +97,0 @@ } |
{ | ||
"name": "crosslightning-sdk-base", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "CrossLightning SDK chain-agnostic base", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -58,2 +58,15 @@ import * as BN from "bn.js"; | ||
export type LNURLPay = { | ||
type: "pay", | ||
min: BN, | ||
max: BN, | ||
commentMaxLength: number | ||
} | ||
export type LNURLWithdraw= { | ||
type: "withdraw", | ||
min: BN, | ||
max: BN | ||
} | ||
export class ClientSwapContract<T extends SwapData> { | ||
@@ -114,7 +127,3 @@ | ||
async isLNURLPay(str: string): Promise<{ | ||
min: BN, | ||
max: BN, | ||
commentMaxLength: number | ||
} | null> { | ||
async getLNURLType(str: string): Promise<LNURLPay | LNURLWithdraw | null> { | ||
const lnurl = findlnurl(str); | ||
@@ -126,2 +135,3 @@ if(lnurl==null) return null; | ||
return { | ||
type: "pay", | ||
min: new BN(payRequest.minSendable).div(new BN(1000)), | ||
@@ -132,17 +142,8 @@ max: new BN(payRequest.maxSendable).div(new BN(1000)), | ||
} | ||
return null; | ||
} | ||
async isLNURLWithdraw(str: string): Promise<{ | ||
min: BN, | ||
max: BN | ||
} | null> { | ||
const lnurl = findlnurl(str); | ||
if(lnurl==null) return null; | ||
const res: any = await getParams(lnurl); | ||
if(res.tag==="withdrawRequest") { | ||
const payRequest: LNURLWithdrawParams = res; | ||
return { | ||
type: "withdraw", | ||
min: new BN(payRequest.minWithdrawable).div(new BN(1000)), | ||
max: new BN(payRequest.maxWithdrawable).div(new BN(1000)), | ||
max: new BN(payRequest.maxWithdrawable).div(new BN(1000)) | ||
} | ||
@@ -149,0 +150,0 @@ } |
452914
10252