crosslightning-sdk-base
Advanced tools
Comparing version 10.0.5-beta2 to 10.0.5-beta3
@@ -284,7 +284,7 @@ /// <reference types="node" /> | ||
createFromBTCLNSwapViaLNURL<ChainIdentifier extends ChainIds<T>>(chainIdentifier: ChainIdentifier, signer: string, tokenAddress: string, lnurl: string | LNURLWithdraw, amount: BN, exactOut?: boolean, additionalParams?: Record<string, any>): Promise<FromBTCLNSwap<T[ChainIdentifier]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: BtcToken<true>, dstToken: SCToken<C>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: BtcToken<false>, dstToken: SCToken<C>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: SCToken<C>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: BtcToken<true>, dstToken: SCToken<C>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: BtcToken<false>, dstToken: SCToken<C>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: SCToken<C>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[C]>>; | ||
/** | ||
@@ -291,0 +291,0 @@ * Creates trusted LN for Gas swap |
@@ -541,3 +541,3 @@ "use strict"; | ||
*/ | ||
create(chainId, signer, srcToken, dstToken, amount, exactIn, addressLnurlLightningInvoice) { | ||
create(signer, srcToken, dstToken, amount, exactIn, addressLnurlLightningInvoice) { | ||
if (srcToken.chain === "BTC") { | ||
@@ -549,10 +549,10 @@ if (dstToken.chain === "SC") { | ||
throw new Error("LNURL must be a string!"); | ||
return this.createFromBTCLNSwapViaLNURL(chainId, signer, dstToken.address, addressLnurlLightningInvoice, amount, !exactIn); | ||
return this.createFromBTCLNSwapViaLNURL(dstToken.chainId, signer, dstToken.address, addressLnurlLightningInvoice, amount, !exactIn); | ||
} | ||
else { | ||
return this.createFromBTCLNSwap(chainId, signer, dstToken.address, amount, !exactIn); | ||
return this.createFromBTCLNSwap(dstToken.chainId, signer, dstToken.address, amount, !exactIn); | ||
} | ||
} | ||
else { | ||
return this.createFromBTCSwap(chainId, signer, dstToken.address, amount, !exactIn); | ||
return this.createFromBTCSwap(dstToken.chainId, signer, dstToken.address, amount, !exactIn); | ||
} | ||
@@ -567,3 +567,3 @@ } | ||
if (this.isValidLNURL(addressLnurlLightningInvoice)) { | ||
return this.createToBTCLNSwapViaLNURL(chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, null, null, exactIn); | ||
return this.createToBTCLNSwapViaLNURL(srcToken.chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, null, null, exactIn); | ||
} | ||
@@ -575,3 +575,3 @@ else if (this.isLightningInvoice(addressLnurlLightningInvoice)) { | ||
throw new Error("Only exact out swaps are possible with lightning invoices, use LNURL links for exact in lightning swaps!"); | ||
return this.createToBTCLNSwap(chainId, signer, srcToken.address, addressLnurlLightningInvoice); | ||
return this.createToBTCLNSwap(srcToken.chainId, signer, srcToken.address, addressLnurlLightningInvoice); | ||
} | ||
@@ -585,3 +585,3 @@ else { | ||
throw new Error("Destination bitcoin address must be a string!"); | ||
return this.createToBTCSwap(chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, exactIn); | ||
return this.createToBTCSwap(srcToken.chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, exactIn); | ||
} | ||
@@ -588,0 +588,0 @@ } |
@@ -92,7 +92,7 @@ /// <reference types="node" /> | ||
createTrustedLNForGasSwap(signer: string, amount: BN, trustedIntermediaryUrl?: string): Promise<LnForGasSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: BtcToken<true>, dstToken: SCToken<string>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: BtcToken<false>, dstToken: SCToken<string>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<string>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<string>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<string>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: BtcToken<true>, dstToken: SCToken<ChainIdentifier>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: BtcToken<false>, dstToken: SCToken<ChainIdentifier>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<ChainIdentifier>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<ChainIdentifier>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<ChainIdentifier>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
/** | ||
@@ -99,0 +99,0 @@ * Returns swaps that are in-progress and are claimable for the specific chain, optionally also for a specific signer's address |
@@ -132,3 +132,3 @@ "use strict"; | ||
create(signer, srcToken, dstToken, amount, exactIn, addressLnurlLightningInvoice) { | ||
return this.swapper.create(this.chainIdentifier, signer, srcToken, dstToken, amount, exactIn, addressLnurlLightningInvoice); | ||
return this.swapper.create(signer, srcToken, dstToken, amount, exactIn, addressLnurlLightningInvoice); | ||
} | ||
@@ -135,0 +135,0 @@ /** |
{ | ||
"name": "crosslightning-sdk-base", | ||
"version": "10.0.5-beta2", | ||
"version": "10.0.5-beta3", | ||
"description": "CrossLightning SDK chain-agnostic base", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -862,7 +862,7 @@ import {BitcoinNetwork} from "../btc/BitcoinNetwork"; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: BtcToken<true>, dstToken: SCToken<C>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: BtcToken<false>, dstToken: SCToken<C>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: SCToken<C>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: BtcToken<true>, dstToken: SCToken<C>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: BtcToken<false>, dstToken: SCToken<C>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: SCToken<C>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[C]>>; | ||
create<C extends ChainIds<T>>(signer: string, srcToken: SCToken<C>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[C]>>; | ||
/** | ||
@@ -882,3 +882,3 @@ * Creates a swap from srcToken to dstToken, of a specific token amount, either specifying input amount (exactIn=true) | ||
*/ | ||
create<C extends ChainIds<T>>(chainId: C, signer: string, srcToken: Token, dstToken: Token, amount: BN, exactIn: boolean, addressLnurlLightningInvoice?: string): Promise<ISwap<T[C]>> { | ||
create<C extends ChainIds<T>>(signer: string, srcToken: Token<C>, dstToken: Token<C>, amount: BN, exactIn: boolean, addressLnurlLightningInvoice?: string): Promise<ISwap<T[C]>> { | ||
if(srcToken.chain==="BTC") { | ||
@@ -889,8 +889,8 @@ if(dstToken.chain==="SC") { | ||
if(typeof(addressLnurlLightningInvoice)!=="string") throw new Error("LNURL must be a string!"); | ||
return this.createFromBTCLNSwapViaLNURL(chainId, signer, dstToken.address, addressLnurlLightningInvoice, amount, !exactIn); | ||
return this.createFromBTCLNSwapViaLNURL(dstToken.chainId, signer, dstToken.address, addressLnurlLightningInvoice, amount, !exactIn); | ||
} else { | ||
return this.createFromBTCLNSwap(chainId, signer, dstToken.address, amount, !exactIn); | ||
return this.createFromBTCLNSwap(dstToken.chainId, signer, dstToken.address, amount, !exactIn); | ||
} | ||
} else { | ||
return this.createFromBTCSwap(chainId, signer, dstToken.address, amount, !exactIn); | ||
return this.createFromBTCSwap(dstToken.chainId, signer, dstToken.address, amount, !exactIn); | ||
} | ||
@@ -903,3 +903,3 @@ } | ||
if(this.isValidLNURL(addressLnurlLightningInvoice)) { | ||
return this.createToBTCLNSwapViaLNURL(chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, null, null, exactIn); | ||
return this.createToBTCLNSwapViaLNURL(srcToken.chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, null, null, exactIn); | ||
} else if(this.isLightningInvoice(addressLnurlLightningInvoice)) { | ||
@@ -910,3 +910,3 @@ if(!this.isValidLightningInvoice(addressLnurlLightningInvoice)) | ||
throw new Error("Only exact out swaps are possible with lightning invoices, use LNURL links for exact in lightning swaps!"); | ||
return this.createToBTCLNSwap(chainId, signer, srcToken.address, addressLnurlLightningInvoice); | ||
return this.createToBTCLNSwap(srcToken.chainId, signer, srcToken.address, addressLnurlLightningInvoice); | ||
} else { | ||
@@ -917,3 +917,3 @@ throw new Error("Supplied parameter is not LNURL link nor lightning invoice (bolt11)!"); | ||
if(typeof(addressLnurlLightningInvoice)!=="string") throw new Error("Destination bitcoin address must be a string!"); | ||
return this.createToBTCSwap(chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, exactIn); | ||
return this.createToBTCSwap(srcToken.chainId, signer, srcToken.address, addressLnurlLightningInvoice, amount, null, null, exactIn); | ||
} | ||
@@ -920,0 +920,0 @@ } |
@@ -206,7 +206,7 @@ import {LNURLPay, LNURLWithdraw} from "../utils/LNURL"; | ||
create(signer: string, srcToken: BtcToken<true>, dstToken: SCToken<string>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: BtcToken<false>, dstToken: SCToken<string>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<string>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<string>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<string>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: BtcToken<true>, dstToken: SCToken<ChainIdentifier>, amount: BN, exactIn: boolean, lnurlWithdraw?: string): Promise<FromBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: BtcToken<false>, dstToken: SCToken<ChainIdentifier>, amount: BN, exactIn: boolean): Promise<FromBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<ChainIdentifier>, dstToken: BtcToken<false>, amount: BN, exactIn: boolean, address: string): Promise<ToBTCSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<ChainIdentifier>, dstToken: BtcToken<true>, amount: BN, exactIn: boolean, lnurlPay: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
create(signer: string, srcToken: SCToken<ChainIdentifier>, dstToken: BtcToken<true>, amount: BN, exactIn: false, lightningInvoice: string): Promise<ToBTCLNSwap<T[ChainIdentifier]>>; | ||
/** | ||
@@ -225,4 +225,4 @@ * Creates a swap from srcToken to dstToken, of a specific token amount, either specifying input amount (exactIn=true) | ||
*/ | ||
create(signer: string, srcToken: Token, dstToken: Token, amount: BN, exactIn: boolean, addressLnurlLightningInvoice?: string): Promise<ISwap<T[ChainIdentifier]>> { | ||
return this.swapper.create(this.chainIdentifier, signer, srcToken as any, dstToken as any, amount, exactIn, addressLnurlLightningInvoice); | ||
create(signer: string, srcToken: Token<ChainIdentifier>, dstToken: Token<ChainIdentifier>, amount: BN, exactIn: boolean, addressLnurlLightningInvoice?: string): Promise<ISwap<T[ChainIdentifier]>> { | ||
return this.swapper.create(signer, srcToken as any, dstToken as any, amount, exactIn, addressLnurlLightningInvoice); | ||
} | ||
@@ -229,0 +229,0 @@ |
1437030