@lendasat/lendaswap-sdk-pure 0.0.1 → 0.0.2
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.
- package/README.md +59 -12
- package/dist/arkade.d.ts +32 -0
- package/dist/arkade.d.ts.map +1 -0
- package/dist/arkade.js +44 -0
- package/dist/arkade.js.map +1 -0
- package/dist/client.d.ts +87 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +284 -57
- package/dist/client.js.map +1 -1
- package/dist/create/bitcoin-to-arkade.d.ts +36 -0
- package/dist/create/bitcoin-to-arkade.d.ts.map +1 -0
- package/dist/create/bitcoin-to-arkade.js +69 -0
- package/dist/create/bitcoin-to-arkade.js.map +1 -0
- package/dist/create/index.d.ts +2 -1
- package/dist/create/index.d.ts.map +1 -1
- package/dist/create/index.js +1 -0
- package/dist/create/index.js.map +1 -1
- package/dist/create/types.d.ts +21 -5
- package/dist/create/types.d.ts.map +1 -1
- package/dist/esplora.d.ts +18 -15
- package/dist/esplora.d.ts.map +1 -1
- package/dist/esplora.js +14 -13
- package/dist/esplora.js.map +1 -1
- package/dist/generated/api.d.ts +2 -2
- package/dist/generated/api.d.ts.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/price-calculations.d.ts +135 -0
- package/dist/price-calculations.d.ts.map +1 -0
- package/dist/price-calculations.js +171 -0
- package/dist/price-calculations.js.map +1 -0
- package/dist/price-feed.d.ts +124 -0
- package/dist/price-feed.d.ts.map +1 -0
- package/dist/price-feed.js +178 -0
- package/dist/price-feed.js.map +1 -0
- package/dist/storage/idb.d.ts +7 -0
- package/dist/storage/idb.d.ts.map +1 -1
- package/dist/storage/idb.js +89 -1
- package/dist/storage/idb.js.map +1 -1
- package/dist/tokens.d.ts +24 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +54 -0
- package/dist/tokens.js.map +1 -0
- package/dist/usd-price.d.ts +83 -0
- package/dist/usd-price.d.ts.map +1 -0
- package/dist/usd-price.js +166 -0
- package/dist/usd-price.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,24 +11,39 @@ npm install @lendasat/lendaswap-sdk-pure
|
|
|
11
11
|
|
|
12
12
|
## Supported Swaps
|
|
13
13
|
|
|
14
|
-
This SDK
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
14
|
+
This SDK supports the following swap directions:
|
|
15
|
+
|
|
16
|
+
### BTC to EVM
|
|
17
|
+
|
|
18
|
+
| Source | Target | Status |
|
|
19
|
+
| ------------ | --------------------------- | --------- |
|
|
20
|
+
| Lightning | Polygon (USDC, USDT) | Supported |
|
|
21
|
+
| Lightning | Arbitrum (USDC, USDT) | Supported |
|
|
22
|
+
| Lightning | Ethereum (USDC, USDT, WBTC) | Supported |
|
|
23
|
+
| Arkade | Polygon (USDC, USDT) | Supported |
|
|
24
|
+
| Arkade | Arbitrum (USDC, USDT) | Supported |
|
|
25
|
+
| Arkade | Ethereum (USDC, USDT, WBTC) | Supported |
|
|
26
|
+
| On-chain BTC | Polygon (USDC, USDT) | Supported |
|
|
27
|
+
| On-chain BTC | Arbitrum (USDC, USDT) | Supported |
|
|
28
|
+
| On-chain BTC | Ethereum (USDC, USDT, WBTC) | Supported |
|
|
29
|
+
|
|
30
|
+
### EVM to BTC
|
|
31
|
+
|
|
32
|
+
| Source | Target | Status |
|
|
33
|
+
| --------------------------- | --------- | --------- |
|
|
34
|
+
| Polygon (USDC, USDT) | Arkade | Supported |
|
|
35
|
+
| Polygon (USDC, USDT) | Lightning | Supported |
|
|
36
|
+
| Arbitrum (USDC, USDT) | Arkade | Supported |
|
|
37
|
+
| Arbitrum (USDC, USDT) | Lightning | Supported |
|
|
38
|
+
| Ethereum (USDC, USDT, WBTC) | Arkade | Supported |
|
|
39
|
+
| Ethereum (USDC, USDT, WBTC) | Lightning | Supported |
|
|
24
40
|
|
|
25
41
|
**Refund support:**
|
|
26
42
|
|
|
27
43
|
- Lightning swaps: Auto-expire, no refund needed
|
|
28
44
|
- Arkade swaps: Off-chain refund via Arkade protocol
|
|
29
45
|
- On-chain BTC swaps: On-chain refund transaction after timelock
|
|
30
|
-
|
|
31
|
-
> More swap directions (e.g., EVM to BTC) will be added in future versions.
|
|
46
|
+
- EVM swaps: On-chain refund after timelock expires
|
|
32
47
|
|
|
33
48
|
## Usage
|
|
34
49
|
|
|
@@ -113,6 +128,38 @@ console.log(`Send BTC to: ${result.response.btc_htlc_address}`);
|
|
|
113
128
|
console.log(`Swap ID: ${result.response.id}`);
|
|
114
129
|
```
|
|
115
130
|
|
|
131
|
+
#### EVM to Arkade
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
const result = await client.createEvmToArkadeSwap({
|
|
135
|
+
sourceToken: "usdc_pol", // or "usdc_arb", "usdc_eth", "usdt_*", "wbtc_eth"
|
|
136
|
+
sourceChain: "polygon", // or "arbitrum", "ethereum"
|
|
137
|
+
sourceAmount: 100000000n, // Amount in token's smallest unit (e.g., 6 decimals for USDC)
|
|
138
|
+
targetAddress: "ark1...", // Your Arkade address
|
|
139
|
+
evmAddress: "0x...", // Your EVM address (for funding the HTLC)
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Fund the EVM HTLC (approve + createSwap)
|
|
143
|
+
console.log(`HTLC Address: ${result.response.htlc_address}`);
|
|
144
|
+
console.log(`Swap ID: ${result.response.id}`);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### EVM to Lightning
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
const result = await client.createEvmToLightningSwap({
|
|
151
|
+
sourceToken: "usdc_pol",
|
|
152
|
+
sourceChain: "polygon",
|
|
153
|
+
sourceAmount: 100000000n,
|
|
154
|
+
targetAddress: "lnbc...", // Lightning invoice
|
|
155
|
+
evmAddress: "0x...",
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Fund the EVM HTLC
|
|
159
|
+
console.log(`HTLC Address: ${result.response.htlc_address}`);
|
|
160
|
+
console.log(`Swap ID: ${result.response.id}`);
|
|
161
|
+
```
|
|
162
|
+
|
|
116
163
|
### Monitor Swap Status
|
|
117
164
|
|
|
118
165
|
```typescript
|
package/dist/arkade.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arkade VHTLC query utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for querying VHTLC state from the Arkade indexer.
|
|
5
|
+
*/
|
|
6
|
+
/** VHTLC amounts breakdown */
|
|
7
|
+
export interface VhtlcAmounts {
|
|
8
|
+
/** Amount that can be spent (in satoshis) */
|
|
9
|
+
spendable: number;
|
|
10
|
+
/** Amount already spent (in satoshis) */
|
|
11
|
+
spent: number;
|
|
12
|
+
/** Amount that can be recovered via refund (in satoshis) */
|
|
13
|
+
recoverable: number;
|
|
14
|
+
}
|
|
15
|
+
/** Parameters for querying VHTLC amounts */
|
|
16
|
+
export interface GetVhtlcAmountsParams {
|
|
17
|
+
/** The Arkade VHTLC address */
|
|
18
|
+
vhtlcAddress: string;
|
|
19
|
+
/** The Bitcoin network (e.g. "bitcoin", "signet") */
|
|
20
|
+
network: string;
|
|
21
|
+
/** Optional Arkade server URL override. Falls back to network-based defaults. */
|
|
22
|
+
arkadeServerUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Queries the Arkade indexer for spendable, spent, and recoverable balances
|
|
26
|
+
* at a VHTLC address.
|
|
27
|
+
*
|
|
28
|
+
* @param params - The VHTLC address and network to query.
|
|
29
|
+
* @returns The VHTLC amounts in satoshis.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getVhtlcAmounts(params: GetVhtlcAmountsParams): Promise<VhtlcAmounts>;
|
|
32
|
+
//# sourceMappingURL=arkade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arkade.d.ts","sourceRoot":"","sources":["../src/arkade.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,8BAA8B;AAC9B,MAAM,WAAW,YAAY;IAC3B,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,4CAA4C;AAC5C,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,YAAY,CAAC,CA8BvB"}
|
package/dist/arkade.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arkade VHTLC query utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for querying VHTLC state from the Arkade indexer.
|
|
5
|
+
*/
|
|
6
|
+
import { ArkAddress, RestIndexerProvider, } from "@arkade-os/sdk";
|
|
7
|
+
import { hex } from "@scure/base";
|
|
8
|
+
/** Default Arkade server URLs by network */
|
|
9
|
+
const DEFAULT_ARKADE_URLS = {
|
|
10
|
+
bitcoin: "https://arkade.computer",
|
|
11
|
+
signet: "https://signet.arkade.computer",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Queries the Arkade indexer for spendable, spent, and recoverable balances
|
|
15
|
+
* at a VHTLC address.
|
|
16
|
+
*
|
|
17
|
+
* @param params - The VHTLC address and network to query.
|
|
18
|
+
* @returns The VHTLC amounts in satoshis.
|
|
19
|
+
*/
|
|
20
|
+
export async function getVhtlcAmounts(params) {
|
|
21
|
+
const { vhtlcAddress, network, arkadeServerUrl } = params;
|
|
22
|
+
// Decode the Arkade address to get the pkScript for indexer queries
|
|
23
|
+
const decoded = ArkAddress.decode(vhtlcAddress);
|
|
24
|
+
const pkScript = hex.encode(decoded.pkScript);
|
|
25
|
+
// Determine Arkade server URL: explicit override > network default
|
|
26
|
+
const serverUrl = arkadeServerUrl ?? DEFAULT_ARKADE_URLS[network];
|
|
27
|
+
if (!serverUrl) {
|
|
28
|
+
throw new Error(`Unknown network for Arkade: ${network}`);
|
|
29
|
+
}
|
|
30
|
+
const indexerProvider = new RestIndexerProvider(serverUrl);
|
|
31
|
+
// Query each category separately
|
|
32
|
+
const [spendableResult, spentResult, recoverableResult] = await Promise.all([
|
|
33
|
+
indexerProvider.getVtxos({ scripts: [pkScript], spendableOnly: true }),
|
|
34
|
+
indexerProvider.getVtxos({ scripts: [pkScript], spentOnly: true }),
|
|
35
|
+
indexerProvider.getVtxos({ scripts: [pkScript], recoverableOnly: true }),
|
|
36
|
+
]);
|
|
37
|
+
const sum = (vtxos) => vtxos.reduce((acc, v) => acc + v.value, 0);
|
|
38
|
+
return {
|
|
39
|
+
spendable: sum(spendableResult.vtxos),
|
|
40
|
+
spent: sum(spentResult.vtxos),
|
|
41
|
+
recoverable: sum(recoverableResult.vtxos),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=arkade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arkade.js","sourceRoot":"","sources":["../src/arkade.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,UAAU,EAEV,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,4CAA4C;AAC5C,MAAM,mBAAmB,GAA2B;IAClD,OAAO,EAAE,yBAAyB;IAClC,MAAM,EAAE,gCAAgC;CACzC,CAAC;AAsBF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UA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AW,CAAC,KAAK,CAAC;QAC7B,WAAW,EAAE,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ApiClient, type AssetPair, type GetSwapResponse, type QuoteResponse, type TokenInfo } from "./api/client.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type VhtlcAmounts } from "./arkade.js";
|
|
3
|
+
import { type BitcoinToArkadeSwapOptions, type BitcoinToArkadeSwapResult, type BitcoinToEvmSwapOptions, type BitcoinToEvmSwapResult, type BtcToEvmSwapOptions, type BtcToEvmSwapResult, type EvmToArkadeSwapOptions, type EvmToArkadeSwapResult, type EvmToLightningSwapOptions, type EvmToLightningSwapResult } from "./create/index.js";
|
|
3
4
|
import { type ClaimResult } from "./redeem/index.js";
|
|
4
5
|
import { Signer, type SwapParams } from "./signer/index.js";
|
|
5
|
-
import { type StoredSwap, type SwapStorage, type WalletStorage } from "./storage
|
|
6
|
-
export type { BitcoinToEvmSwapOptions, BitcoinToEvmSwapResult, BtcToEvmSwapOptions, BtcToEvmSwapResult, EvmChain, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToLightningSwapOptions, EvmToLightningSwapResult, } from "./create/index.js";
|
|
6
|
+
import { type StoredSwap, type SwapStorage, type WalletStorage } from "./storage";
|
|
7
|
+
export type { BitcoinToArkadeSwapOptions, BitcoinToArkadeSwapResult, BitcoinToEvmSwapOptions, BitcoinToEvmSwapResult, BtcToEvmSwapOptions, BtcToEvmSwapResult, EvmChain, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToLightningSwapOptions, EvmToLightningSwapResult, } from "./create/index.js";
|
|
7
8
|
export type { BitcoinToEvmSwapResponse } from "./create/types.js";
|
|
8
9
|
export type { ClaimResult, EthereumClaimData } from "./redeem/index.js";
|
|
9
10
|
/** Result of attempting a refund */
|
|
@@ -43,6 +44,8 @@ export interface ArkadeRefundOptions {
|
|
|
43
44
|
/** Arkade server URL (optional, uses default based on network) */
|
|
44
45
|
arkadeServerUrl?: string;
|
|
45
46
|
}
|
|
47
|
+
/** General refund options — the method picks the right variant based on swap type */
|
|
48
|
+
export type RefundOptions = OnchainRefundOptions | ArkadeRefundOptions;
|
|
46
49
|
/** Options for Arkade (off-chain) claim */
|
|
47
50
|
export interface ArkadeClaimOptions {
|
|
48
51
|
/** Destination Arkade address to receive claimed BTC */
|
|
@@ -75,6 +78,8 @@ export interface ClientConfig {
|
|
|
75
78
|
apiKey?: string;
|
|
76
79
|
/** Optional Esplora API URL for broadcasting Bitcoin transactions. */
|
|
77
80
|
esploraUrl?: string;
|
|
81
|
+
/** Optional Arkade server URL (e.g. "https://arkade.computer"). Falls back to network-based defaults. */
|
|
82
|
+
arkadeServerUrl?: string;
|
|
78
83
|
}
|
|
79
84
|
/**
|
|
80
85
|
* Builder for creating a Lendaswap client with a fluent API.
|
|
@@ -124,6 +129,17 @@ export declare class ClientBuilder {
|
|
|
124
129
|
* @returns The builder instance for chaining.
|
|
125
130
|
*/
|
|
126
131
|
withEsploraUrl(esploraUrl: string): this;
|
|
132
|
+
/**
|
|
133
|
+
* Sets the Arkade server URL for VHTLC operations (claim, refund, amounts).
|
|
134
|
+
*
|
|
135
|
+
* If not set, defaults are used based on the network:
|
|
136
|
+
* - bitcoin: https://arkade.computer
|
|
137
|
+
* - signet: wa
|
|
138
|
+
*
|
|
139
|
+
* @param arkadeServerUrl - The Arkade server base URL.
|
|
140
|
+
* @returns The builder instance for chaining.
|
|
141
|
+
*/
|
|
142
|
+
withArkadeServerUrl(arkadeServerUrl: string): this;
|
|
127
143
|
/**
|
|
128
144
|
* Sets the storage backend for signer data (mnemonic and key index).
|
|
129
145
|
* @param storage - The storage implementation to use.
|
|
@@ -218,6 +234,15 @@ export declare class Client {
|
|
|
218
234
|
* @returns The BIP39 mnemonic phrase.
|
|
219
235
|
*/
|
|
220
236
|
getMnemonic(): string;
|
|
237
|
+
/**
|
|
238
|
+
* Loads a mnemonic phrase, replacing the current signer.
|
|
239
|
+
*
|
|
240
|
+
* The new mnemonic is persisted to storage if storage is configured.
|
|
241
|
+
*
|
|
242
|
+
* @param mnemonic - The BIP39 mnemonic phrase to load.
|
|
243
|
+
* @throws Error if the mnemonic is invalid.
|
|
244
|
+
*/
|
|
245
|
+
loadMnemonic(mnemonic: string): Promise<void>;
|
|
221
246
|
/**
|
|
222
247
|
* Gets the user ID extended public key for wallet recovery.
|
|
223
248
|
*
|
|
@@ -325,6 +350,41 @@ export declare class Client {
|
|
|
325
350
|
* ```
|
|
326
351
|
*/
|
|
327
352
|
getStoredSwap(id: string): Promise<StoredSwap | null>;
|
|
353
|
+
/**
|
|
354
|
+
* Gets all stored swaps from local storage.
|
|
355
|
+
*
|
|
356
|
+
* @returns Array of all stored swap data, or empty array if no storage is configured.
|
|
357
|
+
*/
|
|
358
|
+
listAllSwaps(): Promise<StoredSwap[]>;
|
|
359
|
+
deleteSwap(id: string): Promise<void>;
|
|
360
|
+
clearSwapStorage(): Promise<void>;
|
|
361
|
+
/**
|
|
362
|
+
* Recovers all swaps associated with the current wallet from the server.
|
|
363
|
+
*
|
|
364
|
+
* Sends the user's xpub to the server, which returns all swaps belonging
|
|
365
|
+
* to that wallet. For each recovered swap, re-derives the keys using the
|
|
366
|
+
* swap's derivation index and stores it locally.
|
|
367
|
+
*
|
|
368
|
+
* After recovery, the key index is set to `highest_index + 1` so that
|
|
369
|
+
* new swaps don't reuse derivation indices.
|
|
370
|
+
*
|
|
371
|
+
* @returns The recovered swaps stored locally.
|
|
372
|
+
*/
|
|
373
|
+
recoverSwaps(): Promise<StoredSwap[]>;
|
|
374
|
+
/**
|
|
375
|
+
* Gets VHTLC amounts for an Arkade swap.
|
|
376
|
+
*
|
|
377
|
+
* Queries the Arkade indexer for spendable, spent, and recoverable balances
|
|
378
|
+
* at the VHTLC address associated with a swap. Works for:
|
|
379
|
+
* - BTC → EVM swaps where the source asset is Arkade
|
|
380
|
+
* - EVM → BTC swaps where the target asset is Arkade
|
|
381
|
+
*
|
|
382
|
+
* Reads swap data from local storage (does not contact the server).
|
|
383
|
+
*
|
|
384
|
+
* @param id - The UUID of the swap.
|
|
385
|
+
* @returns The VHTLC amounts in satoshis.
|
|
386
|
+
*/
|
|
387
|
+
amountsForSwap(id: string): Promise<VhtlcAmounts>;
|
|
328
388
|
/**
|
|
329
389
|
* Claims a swap by revealing the preimage.
|
|
330
390
|
*
|
|
@@ -407,7 +467,7 @@ export declare class Client {
|
|
|
407
467
|
* }
|
|
408
468
|
* ```
|
|
409
469
|
*/
|
|
410
|
-
refundSwap(id: string, options?:
|
|
470
|
+
refundSwap(id: string, options?: RefundOptions): Promise<RefundResult>;
|
|
411
471
|
/**
|
|
412
472
|
* Creates a new Arkade to EVM swap.
|
|
413
473
|
*
|
|
@@ -471,6 +531,29 @@ export declare class Client {
|
|
|
471
531
|
* ```
|
|
472
532
|
*/
|
|
473
533
|
createBitcoinToEvmSwap(options: BitcoinToEvmSwapOptions): Promise<BitcoinToEvmSwapResult>;
|
|
534
|
+
/**
|
|
535
|
+
* Creates a new Bitcoin (on-chain) to Arkade swap.
|
|
536
|
+
*
|
|
537
|
+
* The user sends on-chain BTC to a Taproot HTLC address and receives
|
|
538
|
+
* Arkade VTXOs after the server funds the Arkade VHTLC.
|
|
539
|
+
*
|
|
540
|
+
* Automatically derives swap parameters and increments the key index.
|
|
541
|
+
*
|
|
542
|
+
* @param options - The swap options.
|
|
543
|
+
* @returns The swap response and parameters for storage.
|
|
544
|
+
* @throws Error if the swap creation fails.
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```ts
|
|
548
|
+
* const result = await client.createBitcoinToArkadeSwap({
|
|
549
|
+
* satsReceive: 100000, // 100k sats to receive on Arkade
|
|
550
|
+
* targetAddress: "ark1q...", // Arkade address
|
|
551
|
+
* });
|
|
552
|
+
* console.log("Send BTC to:", result.response.btc_htlc_address);
|
|
553
|
+
* console.log("Amount to send:", result.response.source_amount, "sats");
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
createBitcoinToArkadeSwap(options: BitcoinToArkadeSwapOptions): Promise<BitcoinToArkadeSwapResult>;
|
|
474
557
|
/**
|
|
475
558
|
* Creates a new EVM to Arkade swap.
|
|
476
559
|
*
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,SAAS,EAKd,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAQvB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAc,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,qBAAqB,EACrB,yB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