@lendasat/lendaswap-sdk-pure 0.2.21-1 → 0.2.21

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.
Files changed (208) hide show
  1. package/dist/api/client.d.ts.map +1 -1
  2. package/dist/api/client.js +4 -1
  3. package/dist/api/client.js.map +1 -1
  4. package/dist/client.d.ts +1 -1
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/client.js.map +1 -1
  7. package/dist/version.d.ts +4 -0
  8. package/dist/version.d.ts.map +1 -0
  9. package/dist/version.js +6 -0
  10. package/dist/version.js.map +1 -0
  11. package/package.json +4 -1
  12. package/dist/price-feed.d.ts +0 -124
  13. package/dist/price-feed.d.ts.map +0 -1
  14. package/dist/price-feed.js +0 -178
  15. package/dist/price-feed.js.map +0 -1
  16. package/dist/src/api/client.d.ts +0 -31
  17. package/dist/src/api/client.d.ts.map +0 -1
  18. package/dist/src/api/client.js +0 -12
  19. package/dist/src/api/client.js.map +0 -1
  20. package/dist/src/arkade.d.ts +0 -36
  21. package/dist/src/arkade.d.ts.map +0 -1
  22. package/dist/src/arkade.js +0 -68
  23. package/dist/src/arkade.js.map +0 -1
  24. package/dist/src/client.d.ts +0 -760
  25. package/dist/src/client.d.ts.map +0 -1
  26. package/dist/src/client.js +0 -2169
  27. package/dist/src/client.js.map +0 -1
  28. package/dist/src/create/arkade.d.ts +0 -34
  29. package/dist/src/create/arkade.d.ts.map +0 -1
  30. package/dist/src/create/arkade.js +0 -76
  31. package/dist/src/create/arkade.js.map +0 -1
  32. package/dist/src/create/bitcoin-to-arkade.d.ts +0 -36
  33. package/dist/src/create/bitcoin-to-arkade.d.ts.map +0 -1
  34. package/dist/src/create/bitcoin-to-arkade.js +0 -69
  35. package/dist/src/create/bitcoin-to-arkade.js.map +0 -1
  36. package/dist/src/create/bitcoin.d.ts +0 -31
  37. package/dist/src/create/bitcoin.d.ts.map +0 -1
  38. package/dist/src/create/bitcoin.js +0 -67
  39. package/dist/src/create/bitcoin.js.map +0 -1
  40. package/dist/src/create/evm-to-arkade.d.ts +0 -34
  41. package/dist/src/create/evm-to-arkade.d.ts.map +0 -1
  42. package/dist/src/create/evm-to-arkade.js +0 -69
  43. package/dist/src/create/evm-to-arkade.js.map +0 -1
  44. package/dist/src/create/evm-to-bitcoin.d.ts +0 -35
  45. package/dist/src/create/evm-to-bitcoin.d.ts.map +0 -1
  46. package/dist/src/create/evm-to-bitcoin.js +0 -71
  47. package/dist/src/create/evm-to-bitcoin.js.map +0 -1
  48. package/dist/src/create/evm-to-lightning.d.ts +0 -34
  49. package/dist/src/create/evm-to-lightning.d.ts.map +0 -1
  50. package/dist/src/create/evm-to-lightning.js +0 -66
  51. package/dist/src/create/evm-to-lightning.js.map +0 -1
  52. package/dist/src/create/index.d.ts +0 -19
  53. package/dist/src/create/index.d.ts.map +0 -1
  54. package/dist/src/create/index.js +0 -18
  55. package/dist/src/create/index.js.map +0 -1
  56. package/dist/src/create/lightning.d.ts +0 -31
  57. package/dist/src/create/lightning.d.ts.map +0 -1
  58. package/dist/src/create/lightning.js +0 -72
  59. package/dist/src/create/lightning.js.map +0 -1
  60. package/dist/src/create/types.d.ts +0 -247
  61. package/dist/src/create/types.d.ts.map +0 -1
  62. package/dist/src/create/types.js +0 -5
  63. package/dist/src/create/types.js.map +0 -1
  64. package/dist/src/delegate.d.ts +0 -62
  65. package/dist/src/delegate.d.ts.map +0 -1
  66. package/dist/src/delegate.js +0 -284
  67. package/dist/src/delegate.js.map +0 -1
  68. package/dist/src/esplora.d.ts +0 -41
  69. package/dist/src/esplora.d.ts.map +0 -1
  70. package/dist/src/esplora.js +0 -47
  71. package/dist/src/esplora.js.map +0 -1
  72. package/dist/src/evm/coordinator.d.ts +0 -247
  73. package/dist/src/evm/coordinator.d.ts.map +0 -1
  74. package/dist/src/evm/coordinator.js +0 -414
  75. package/dist/src/evm/coordinator.js.map +0 -1
  76. package/dist/src/evm/htlc.d.ts +0 -238
  77. package/dist/src/evm/htlc.d.ts.map +0 -1
  78. package/dist/src/evm/htlc.js +0 -278
  79. package/dist/src/evm/htlc.js.map +0 -1
  80. package/dist/src/evm/index.d.ts +0 -9
  81. package/dist/src/evm/index.d.ts.map +0 -1
  82. package/dist/src/evm/index.js +0 -9
  83. package/dist/src/evm/index.js.map +0 -1
  84. package/dist/src/evm/signing.d.ts +0 -30
  85. package/dist/src/evm/signing.d.ts.map +0 -1
  86. package/dist/src/evm/signing.js +0 -91
  87. package/dist/src/evm/signing.js.map +0 -1
  88. package/dist/src/generated/api.d.ts +0 -2736
  89. package/dist/src/generated/api.d.ts.map +0 -1
  90. package/dist/src/generated/api.js +0 -6
  91. package/dist/src/generated/api.js.map +0 -1
  92. package/dist/src/index.d.ts +0 -18
  93. package/dist/src/index.d.ts.map +0 -1
  94. package/dist/src/index.js +0 -24
  95. package/dist/src/index.js.map +0 -1
  96. package/dist/src/node.d.ts +0 -19
  97. package/dist/src/node.d.ts.map +0 -1
  98. package/dist/src/node.js +0 -19
  99. package/dist/src/node.js.map +0 -1
  100. package/dist/src/price-calculations.d.ts +0 -109
  101. package/dist/src/price-calculations.d.ts.map +0 -1
  102. package/dist/src/price-calculations.js +0 -135
  103. package/dist/src/price-calculations.js.map +0 -1
  104. package/dist/src/redeem/arkade.d.ts +0 -65
  105. package/dist/src/redeem/arkade.d.ts.map +0 -1
  106. package/dist/src/redeem/arkade.js +0 -217
  107. package/dist/src/redeem/arkade.js.map +0 -1
  108. package/dist/src/redeem/ethereum.d.ts +0 -52
  109. package/dist/src/redeem/ethereum.d.ts.map +0 -1
  110. package/dist/src/redeem/ethereum.js +0 -206
  111. package/dist/src/redeem/ethereum.js.map +0 -1
  112. package/dist/src/redeem/gasless.d.ts +0 -41
  113. package/dist/src/redeem/gasless.d.ts.map +0 -1
  114. package/dist/src/redeem/gasless.js +0 -71
  115. package/dist/src/redeem/gasless.js.map +0 -1
  116. package/dist/src/redeem/index.d.ts +0 -49
  117. package/dist/src/redeem/index.d.ts.map +0 -1
  118. package/dist/src/redeem/index.js +0 -189
  119. package/dist/src/redeem/index.js.map +0 -1
  120. package/dist/src/redeem/types.d.ts +0 -126
  121. package/dist/src/redeem/types.d.ts.map +0 -1
  122. package/dist/src/redeem/types.js +0 -36
  123. package/dist/src/redeem/types.js.map +0 -1
  124. package/dist/src/refund/arkade.d.ts +0 -62
  125. package/dist/src/refund/arkade.d.ts.map +0 -1
  126. package/dist/src/refund/arkade.js +0 -212
  127. package/dist/src/refund/arkade.js.map +0 -1
  128. package/dist/src/refund/index.d.ts +0 -10
  129. package/dist/src/refund/index.d.ts.map +0 -1
  130. package/dist/src/refund/index.js +0 -10
  131. package/dist/src/refund/index.js.map +0 -1
  132. package/dist/src/refund/onchain.d.ts +0 -137
  133. package/dist/src/refund/onchain.d.ts.map +0 -1
  134. package/dist/src/refund/onchain.js +0 -366
  135. package/dist/src/refund/onchain.js.map +0 -1
  136. package/dist/src/signer/index.d.ts +0 -106
  137. package/dist/src/signer/index.d.ts.map +0 -1
  138. package/dist/src/signer/index.js +0 -179
  139. package/dist/src/signer/index.js.map +0 -1
  140. package/dist/src/storage/idb.d.ts +0 -70
  141. package/dist/src/storage/idb.d.ts.map +0 -1
  142. package/dist/src/storage/idb.js +0 -236
  143. package/dist/src/storage/idb.js.map +0 -1
  144. package/dist/src/storage/index.d.ts +0 -152
  145. package/dist/src/storage/index.d.ts.map +0 -1
  146. package/dist/src/storage/index.js +0 -98
  147. package/dist/src/storage/index.js.map +0 -1
  148. package/dist/src/storage/sqlite.d.ts +0 -95
  149. package/dist/src/storage/sqlite.d.ts.map +0 -1
  150. package/dist/src/storage/sqlite.js +0 -206
  151. package/dist/src/storage/sqlite.js.map +0 -1
  152. package/dist/src/storage/types.d.ts +0 -57
  153. package/dist/src/storage/types.d.ts.map +0 -1
  154. package/dist/src/storage/types.js +0 -9
  155. package/dist/src/storage/types.js.map +0 -1
  156. package/dist/src/tokens.d.ts +0 -29
  157. package/dist/src/tokens.d.ts.map +0 -1
  158. package/dist/src/tokens.js +0 -89
  159. package/dist/src/tokens.js.map +0 -1
  160. package/dist/src/usd-price.d.ts +0 -34
  161. package/dist/src/usd-price.d.ts.map +0 -1
  162. package/dist/src/usd-price.js +0 -83
  163. package/dist/src/usd-price.js.map +0 -1
  164. package/dist/tests/api-client.test.d.ts +0 -2
  165. package/dist/tests/api-client.test.d.ts.map +0 -1
  166. package/dist/tests/api-client.test.js +0 -86
  167. package/dist/tests/api-client.test.js.map +0 -1
  168. package/dist/tests/client.test.d.ts +0 -2
  169. package/dist/tests/client.test.d.ts.map +0 -1
  170. package/dist/tests/client.test.js +0 -150
  171. package/dist/tests/client.test.js.map +0 -1
  172. package/dist/tests/index.test.d.ts +0 -2
  173. package/dist/tests/index.test.d.ts.map +0 -1
  174. package/dist/tests/index.test.js +0 -8
  175. package/dist/tests/index.test.js.map +0 -1
  176. package/dist/tests/onchain-refund.test.d.ts +0 -2
  177. package/dist/tests/onchain-refund.test.d.ts.map +0 -1
  178. package/dist/tests/onchain-refund.test.js +0 -279
  179. package/dist/tests/onchain-refund.test.js.map +0 -1
  180. package/dist/tests/signer.test.d.ts +0 -2
  181. package/dist/tests/signer.test.d.ts.map +0 -1
  182. package/dist/tests/signer.test.js +0 -92
  183. package/dist/tests/signer.test.js.map +0 -1
  184. package/dist/tests/sqlite-storage.test.d.ts +0 -2
  185. package/dist/tests/sqlite-storage.test.d.ts.map +0 -1
  186. package/dist/tests/sqlite-storage.test.js +0 -160
  187. package/dist/tests/sqlite-storage.test.js.map +0 -1
  188. package/dist/tests/storage.test.d.ts +0 -2
  189. package/dist/tests/storage.test.d.ts.map +0 -1
  190. package/dist/tests/storage.test.js +0 -184
  191. package/dist/tests/storage.test.js.map +0 -1
  192. package/dist/tsconfig.tsbuildinfo +0 -1
  193. package/dist/usdt0-bridge/bridge.d.ts +0 -82
  194. package/dist/usdt0-bridge/bridge.d.ts.map +0 -1
  195. package/dist/usdt0-bridge/bridge.js +0 -56
  196. package/dist/usdt0-bridge/bridge.js.map +0 -1
  197. package/dist/usdt0-bridge/chains.d.ts +0 -41
  198. package/dist/usdt0-bridge/chains.d.ts.map +0 -1
  199. package/dist/usdt0-bridge/chains.js +0 -117
  200. package/dist/usdt0-bridge/chains.js.map +0 -1
  201. package/dist/usdt0-bridge/layerzero-tracker.d.ts +0 -34
  202. package/dist/usdt0-bridge/layerzero-tracker.d.ts.map +0 -1
  203. package/dist/usdt0-bridge/layerzero-tracker.js +0 -86
  204. package/dist/usdt0-bridge/layerzero-tracker.js.map +0 -1
  205. package/dist/usdt0-bridge/oft-abi.d.ts +0 -145
  206. package/dist/usdt0-bridge/oft-abi.d.ts.map +0 -1
  207. package/dist/usdt0-bridge/oft-abi.js +0 -117
  208. package/dist/usdt0-bridge/oft-abi.js.map +0 -1
@@ -1,71 +0,0 @@
1
- /**
2
- * EVM to Bitcoin (on-chain) swap creation.
3
- *
4
- * Supports swapping tokens from Polygon, Arbitrum, or Ethereum to BTC on-chain
5
- * via Taproot HTLC.
6
- */
7
- import { bytesToHex } from "../signer/index.js";
8
- /**
9
- * Creates a new EVM-to-Bitcoin swap via the generic endpoint.
10
- *
11
- * Uses the chain-agnostic `/swap/evm/bitcoin` endpoint which supports any
12
- * ERC-20 token reachable through 1inch aggregation.
13
- *
14
- * @param options - The swap options.
15
- * @param ctx - The context containing API client and helper functions.
16
- * @returns The swap response and parameters for storage.
17
- * @throws Error if the swap creation fails.
18
- *
19
- * @example
20
- * ```ts
21
- * const result = await createEvmToBitcoinSwap(
22
- * {
23
- * tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC on Polygon
24
- * evmChainId: 137,
25
- * userAddress: "0x1234...",
26
- * sourceAmount: 100000000n, // 100 USDC (6 decimals)
27
- * },
28
- * { apiClient, deriveSwapParams, storeSwap }
29
- * );
30
- * console.log("EVM HTLC:", result.response.evm_htlc_address);
31
- * console.log("BTC HTLC:", result.response.btc_htlc_address);
32
- * ```
33
- */
34
- export async function createEvmToBitcoinSwap(options, ctx) {
35
- const swapParams = await ctx.deriveSwapParams();
36
- const hashLock = `0x${bytesToHex(swapParams.preimageHash)}`;
37
- // For BTC on-chain claim, the user needs their public key (compressed, 33 bytes)
38
- const claimPk = bytesToHex(swapParams.publicKey);
39
- const userId = bytesToHex(swapParams.userId);
40
- const { data, error } = await ctx.apiClient.POST("/swap/evm/bitcoin", {
41
- body: {
42
- hash_lock: hashLock,
43
- claim_pk: claimPk,
44
- user_id: userId,
45
- token_address: options.tokenAddress,
46
- evm_chain_id: options.evmChainId,
47
- user_address: options.userAddress,
48
- target_address: options.targetAddress,
49
- amount_in: options.sourceAmount
50
- ? Number(options.sourceAmount)
51
- : undefined,
52
- amount_out: options.targetAmount
53
- ? Number(options.targetAmount)
54
- : undefined,
55
- referral_code: options.referralCode,
56
- },
57
- });
58
- if (error) {
59
- throw new Error(`Failed to create swap: ${JSON.stringify(error)}`);
60
- }
61
- if (!data) {
62
- throw new Error("No swap data returned");
63
- }
64
- // Store the swap if storage is configured
65
- await ctx.storeSwap(data.id, swapParams, {
66
- ...data,
67
- direction: "evm_to_bitcoin",
68
- });
69
- return { response: data, swapParams };
70
- }
71
- //# sourceMappingURL=evm-to-bitcoin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"evm-to-bitcoin.js","sourceRoot":"","sources":["../../../src/create/evm-to-bitcoin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAgC,EAChC,GAAsB;IAEtB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAG,KAAK,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;IAC5D,iFAAiF;IACjF,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,SAAS,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ports swapping tokens from any EVM chain to pay a Lightning invoice.
5
- */
6
- import type { CreateSwapContext, EvmToLightningSwapGenericOptions, EvmToLightningSwapGenericResult } from "./types.js";
7
- /**
8
- * Creates a new EVM to Lightning swap using the chain-agnostic generic endpoint.
9
- *
10
- * This allows users to swap any ERC-20 token from any supported EVM chain
11
- * to pay a Lightning invoice.
12
- *
13
- * @param options - The swap options.
14
- * @param ctx - The context containing API client and helper functions.
15
- * @returns The swap response and parameters for storage.
16
- * @throws Error if the swap creation fails.
17
- *
18
- * @example
19
- * ```ts
20
- * const result = await createEvmToLightningSwapGeneric(
21
- * {
22
- * lightningInvoice: "lnbc...",
23
- * evmChainId: 137, // Polygon
24
- * tokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC
25
- * amountIn: 10000000, // 10 USDC (6 decimals)
26
- * userAddress: "0x1234...",
27
- * },
28
- * { apiClient, deriveSwapParams, storeSwap }
29
- * );
30
- * console.log("HTLC contract:", result.response.htlc_erc20_address);
31
- * ```
32
- */
33
- export declare function createEvmToLightningSwapGeneric(options: EvmToLightningSwapGenericOptions, ctx: CreateSwapContext): Promise<EvmToLightningSwapGenericResult>;
34
- //# sourceMappingURL=evm-to-lightning.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"evm-to-lightning.d.ts","sourceRoot":"","sources":["../../../src/create/evm-to-lightning.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,iBAAiB,EACjB,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,gCAAgC,EACzC,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,+BAA+B,CAAC,CAsC1C"}
@@ -1,66 +0,0 @@
1
- /**
2
- * EVM to Lightning swap creation.
3
- *
4
- * Supports swapping tokens from any EVM chain to pay a Lightning invoice.
5
- */
6
- import { bytesToHex } from "../signer/index.js";
7
- /**
8
- * Creates a new EVM to Lightning swap using the chain-agnostic generic endpoint.
9
- *
10
- * This allows users to swap any ERC-20 token from any supported EVM chain
11
- * to pay a Lightning invoice.
12
- *
13
- * @param options - The swap options.
14
- * @param ctx - The context containing API client and helper functions.
15
- * @returns The swap response and parameters for storage.
16
- * @throws Error if the swap creation fails.
17
- *
18
- * @example
19
- * ```ts
20
- * const result = await createEvmToLightningSwapGeneric(
21
- * {
22
- * lightningInvoice: "lnbc...",
23
- * evmChainId: 137, // Polygon
24
- * tokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC
25
- * amountIn: 10000000, // 10 USDC (6 decimals)
26
- * userAddress: "0x1234...",
27
- * },
28
- * { apiClient, deriveSwapParams, storeSwap }
29
- * );
30
- * console.log("HTLC contract:", result.response.htlc_erc20_address);
31
- * ```
32
- */
33
- export async function createEvmToLightningSwapGeneric(options, ctx) {
34
- const swapParams = await ctx.deriveSwapParams();
35
- // Note: For EVM-to-Lightning, hash_lock is derived from the Lightning invoice's payment_hash
36
- // by the server, so we don't send it here.
37
- const userId = bytesToHex(swapParams.userId);
38
- const body = {
39
- user_id: userId,
40
- lightning_invoice: options.lightningInvoice,
41
- evm_chain_id: options.evmChainId,
42
- token_address: options.tokenAddress,
43
- user_address: options.userAddress,
44
- referral_code: options.referralCode,
45
- };
46
- // Use fetch directly since the generated types don't have this endpoint yet
47
- const response = await fetch(`${ctx.baseUrl}/swap/evm/lightning`, {
48
- method: "POST",
49
- headers: {
50
- "Content-Type": "application/json",
51
- },
52
- body: JSON.stringify(body),
53
- });
54
- if (!response.ok) {
55
- const error = await response.text();
56
- throw new Error(`Failed to create swap: ${error}`);
57
- }
58
- const data = (await response.json());
59
- // Store the swap if storage is configured
60
- await ctx.storeSwap(data.id, swapParams, {
61
- ...data,
62
- direction: "evm_to_lightning",
63
- });
64
- return { response: data, swapParams };
65
- }
66
- //# sourceMappingURL=evm-to-lightning.js.map
@@ -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,CAAC,EAAE,EAAE,UAAU,EAAE;QACvC,GAAG,IAAI;QACP,SAAS,EAAE,kBAAkB;KAC9B,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACxC,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Swap creation module for Lendaswap.
3
- *
4
- * Provides swap creation logic for different source types:
5
- * - Arkade (off-chain) to EVM
6
- * - Lightning to EVM
7
- * - Bitcoin (on-chain) to EVM
8
- * - EVM to Arkade
9
- * - EVM to Lightning
10
- */
11
- export { createArkadeToEvmSwapGeneric } from "./arkade.js";
12
- export { createBitcoinToEvmSwap } from "./bitcoin.js";
13
- export { createBitcoinToArkadeSwap } from "./bitcoin-to-arkade.js";
14
- export { createEvmToArkadeSwapGeneric } from "./evm-to-arkade.js";
15
- export { createEvmToBitcoinSwap } from "./evm-to-bitcoin.js";
16
- export { createEvmToLightningSwapGeneric } from "./evm-to-lightning.js";
17
- export { createLightningToEvmSwapGeneric } from "./lightning.js";
18
- export type { ArkadeToEvmSwapOptions, ArkadeToEvmSwapResult, BitcoinToArkadeSwapOptions, BitcoinToArkadeSwapResult, BitcoinToEvmSwapOptions, BitcoinToEvmSwapResponse, BitcoinToEvmSwapResult, BtcToEvmSwapOptions, CreateSwapContext, CreateSwapOptions, CreateSwapResult, EvmChain, EvmToArkadeSwapGenericOptions, EvmToArkadeSwapGenericResult, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToBitcoinSwapOptions, EvmToBitcoinSwapResult, EvmToLightningSwapGenericOptions, EvmToLightningSwapGenericResult, EvmToLightningSwapOptions, LightningToEvmSwapGenericOptions, LightningToEvmSwapGenericResult, } from "./types.js";
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/create/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACjE,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,6BAA6B,EAC7B,4BAA4B,EAC5B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,gCAAgC,EAChC,+BAA+B,EAC/B,yBAAyB,EACzB,gCAAgC,EAChC,+BAA+B,GAChC,MAAM,YAAY,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Swap creation module for Lendaswap.
3
- *
4
- * Provides swap creation logic for different source types:
5
- * - Arkade (off-chain) to EVM
6
- * - Lightning to EVM
7
- * - Bitcoin (on-chain) to EVM
8
- * - EVM to Arkade
9
- * - EVM to Lightning
10
- */
11
- export { createArkadeToEvmSwapGeneric } from "./arkade.js";
12
- export { createBitcoinToEvmSwap } from "./bitcoin.js";
13
- export { createBitcoinToArkadeSwap } from "./bitcoin-to-arkade.js";
14
- export { createEvmToArkadeSwapGeneric } from "./evm-to-arkade.js";
15
- export { createEvmToBitcoinSwap } from "./evm-to-bitcoin.js";
16
- export { createEvmToLightningSwapGeneric } from "./evm-to-lightning.js";
17
- export { createLightningToEvmSwapGeneric } from "./lightning.js";
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/create/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Lightning to EVM swap creation.
3
- */
4
- import type { CreateSwapContext, LightningToEvmSwapGenericOptions, LightningToEvmSwapGenericResult } from "./types.js";
5
- /**
6
- * Creates a new Lightning to EVM swap using the chain-agnostic generic endpoint.
7
- *
8
- * The claiming address is derived internally from the swap's secret key,
9
- * allowing the SDK to sign gasless claims without user interaction.
10
- *
11
- * @param options - The swap options.
12
- * @param ctx - The context containing API client and helper functions.
13
- * @returns The swap response and parameters for storage.
14
- * @throws Error if the swap creation fails.
15
- *
16
- * @example
17
- * ```ts
18
- * const result = await createLightningToEvmSwapGeneric(
19
- * {
20
- * targetAddress: "0x5678...", // User's final destination
21
- * evmChainId: 137, // Polygon
22
- * tokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC on Polygon
23
- * amountIn: 100000, // 100k sats
24
- * },
25
- * { apiClient, deriveSwapParams, storeSwap }
26
- * );
27
- * console.log("Pay this invoice:", result.response.ln_invoice);
28
- * ```
29
- */
30
- export declare function createLightningToEvmSwapGeneric(options: LightningToEvmSwapGenericOptions, ctx: CreateSwapContext): Promise<LightningToEvmSwapGenericResult>;
31
- //# sourceMappingURL=lightning.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lightning.d.ts","sourceRoot":"","sources":["../../../src/create/lightning.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EACV,iBAAiB,EACjB,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,gCAAgC,EACzC,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,+BAA+B,CAAC,CA+C1C"}
@@ -1,72 +0,0 @@
1
- /**
2
- * Lightning to EVM swap creation.
3
- */
4
- import { deriveEvmAddress } from "../evm";
5
- import { bytesToHex } from "../signer/index.js";
6
- /**
7
- * Creates a new Lightning to EVM swap using the chain-agnostic generic endpoint.
8
- *
9
- * The claiming address is derived internally from the swap's secret key,
10
- * allowing the SDK to sign gasless claims without user interaction.
11
- *
12
- * @param options - The swap options.
13
- * @param ctx - The context containing API client and helper functions.
14
- * @returns The swap response and parameters for storage.
15
- * @throws Error if the swap creation fails.
16
- *
17
- * @example
18
- * ```ts
19
- * const result = await createLightningToEvmSwapGeneric(
20
- * {
21
- * targetAddress: "0x5678...", // User's final destination
22
- * evmChainId: 137, // Polygon
23
- * tokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC on Polygon
24
- * amountIn: 100000, // 100k sats
25
- * },
26
- * { apiClient, deriveSwapParams, storeSwap }
27
- * );
28
- * console.log("Pay this invoice:", result.response.ln_invoice);
29
- * ```
30
- */
31
- export async function createLightningToEvmSwapGeneric(options, ctx) {
32
- const swapParams = await ctx.deriveSwapParams();
33
- const hashLock = `0x${bytesToHex(swapParams.preimageHash)}`;
34
- const refundPk = bytesToHex(swapParams.publicKey);
35
- const userId = bytesToHex(swapParams.userId);
36
- // The claiming address is derived from the swap's secret key.
37
- // This allows the SDK to sign gasless claims internally.
38
- const claimingAddress = deriveEvmAddress(swapParams.secretKey);
39
- const body = {
40
- hash_lock: hashLock,
41
- refund_pk: refundPk,
42
- user_id: userId,
43
- claiming_address: claimingAddress,
44
- target_address: options.targetAddress,
45
- evm_chain_id: options.evmChainId,
46
- token_address: options.tokenAddress,
47
- amount_in: options.amountIn,
48
- amount_out: options.amountOut,
49
- referral_code: options.referralCode,
50
- gasless: options.gasless ?? true,
51
- };
52
- // Use fetch directly since the generated types don't have this endpoint yet
53
- const response = await fetch(`${ctx.baseUrl}/swap/lightning/evm`, {
54
- method: "POST",
55
- headers: {
56
- "Content-Type": "application/json",
57
- },
58
- body: JSON.stringify(body),
59
- });
60
- if (!response.ok) {
61
- const error = await response.text();
62
- throw new Error(`Failed to create swap: ${error}`);
63
- }
64
- const data = (await response.json());
65
- // Store the swap if storage is configured
66
- await ctx.storeSwap(data.id, swapParams, {
67
- ...data,
68
- direction: "lightning_to_evm",
69
- });
70
- return { response: data, swapParams };
71
- }
72
- //# sourceMappingURL=lightning.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lightning.js","sourceRoot":"","sources":["../../../src/create/lightning.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,OAAyC,EACzC,GAAsB;IAEtB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAG,KAAK,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;IAC5D,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAE7C,8DAA8D;IAC9D,yDAAyD;IACzD,MAAM,eAAe,GAAG,gBAAgB,CAAC,UAAU,CAAC,SA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oinToEvmSwapResponse, ApiClient, EvmToBitcoinSwapResponse as ApiEvmToBitcoinSwapResponse, ArkadeToEvmSwapResponse, BtcToArkadeSwapResponse, EvmToArkadeSwapResponse, EvmToLightningSwapResponse, LightningToEvmSwapResponse, TokenId, TokenInfo } from "../api/client.js";
5
- import type { SwapParams } from "../signer/index.js";
6
- /** Supported EVM chains for swaps */
7
- export type EvmChain = "polygon" | "arbitrum" | "ethereum" | string;
8
- /** Options for creating an Arkade or Lightning to EVM swap */
9
- export interface BtcToEvmSwapOptions {
10
- /** Target EVM address to receive tokens */
11
- targetAddress: string;
12
- /** Target token ID (e.g., "usdc_pol", "usdt_arb") */
13
- targetToken: TokenId;
14
- /** Target EVM chain */
15
- targetChain: EvmChain;
16
- /** Amount in satoshis to send (optional if targetAmount is set) */
17
- sourceAmount?: number;
18
- /** Amount of target token to receive (optional if sourceAmount is set) */
19
- targetAmount?: number;
20
- /** Optional referral code for fee exemption */
21
- referralCode?: string;
22
- }
23
- /** Options for creating a Bitcoin (on-chain) to EVM swap via the generic endpoint */
24
- export interface BitcoinToEvmSwapOptions {
25
- /** EVM address where tokens are swept after the claim (user's final destination) */
26
- targetAddress: string;
27
- /** ERC-20 contract address of the desired token on the target chain */
28
- tokenAddress: string;
29
- /** Numeric EVM chain ID: 1 (Ethereum), 137 (Polygon), 42161 (Arbitrum) */
30
- evmChainId: number;
31
- /** Amount in satoshis to send (mutually exclusive with targetAmount) */
32
- sourceAmount?: number;
33
- /** Amount of target token to receive in smallest unit (mutually exclusive with sourceAmount) */
34
- targetAmount?: number;
35
- /** Optional referral code for fee exemption */
36
- referralCode?: string;
37
- /** Whether the server should execute the DEX swap on behalf of the user (gasless claim). Defaults to true. */
38
- gasless?: boolean;
39
- }
40
- /** Response from the generic `/swap/bitcoin/evm` endpoint. */
41
- export type BitcoinToEvmSwapResponse = ApiBitcoinToEvmSwapResponse;
42
- /** Result of creating a Bitcoin (on-chain) to EVM swap */
43
- export interface BitcoinToEvmSwapResult {
44
- /** The swap response from the API */
45
- response: BitcoinToEvmSwapResponse;
46
- /** The swap parameters used (for storage/recovery) */
47
- swapParams: SwapParams;
48
- }
49
- /** Options for creating a Bitcoin (on-chain) to Arkade swap */
50
- export interface BitcoinToArkadeSwapOptions {
51
- /** Amount in satoshis to receive on Arkade */
52
- satsReceive: number;
53
- /** Target Arkade address to receive VTXOs */
54
- targetAddress: string;
55
- /** Optional referral code for fee exemption */
56
- referralCode?: string;
57
- }
58
- /** Result of creating a Bitcoin (on-chain) to Arkade swap */
59
- export interface BitcoinToArkadeSwapResult {
60
- /** The swap response from the API */
61
- response: BtcToArkadeSwapResponse;
62
- /** The swap parameters used (for storage/recovery) */
63
- swapParams: SwapParams;
64
- }
65
- /** Options for creating an EVM to Arkade swap */
66
- export interface EvmToArkadeSwapOptions {
67
- /** Source EVM chain */
68
- sourceChain: EvmChain;
69
- /** Source token ID (e.g., "usdc_pol", "usdt_arb", "usdc_eth") */
70
- sourceToken: string;
71
- /** Amount of source token to send */
72
- sourceAmount: number;
73
- /** Target Arkade address to receive BTC */
74
- targetAddress: string;
75
- /** User's EVM wallet address (for checking allowance and building transactions) */
76
- userAddress: string;
77
- /** Optional referral code for fee exemption */
78
- referralCode?: string;
79
- }
80
- /** Result of creating an EVM to Arkade swap */
81
- export interface EvmToArkadeSwapResult {
82
- /** The swap response from the API */
83
- response: EvmToArkadeSwapResponse;
84
- /** The swap parameters used (for storage/recovery) */
85
- swapParams: SwapParams;
86
- }
87
- /** Options for creating an EVM to Lightning swap (chain-specific - deprecated) */
88
- export interface EvmToLightningSwapOptions {
89
- /** Source EVM chain */
90
- sourceChain: EvmChain;
91
- /** Source token ID (e.g., "usdc_pol", "usdt_arb", "usdc_eth") */
92
- sourceToken: string;
93
- /** Lightning BOLT11 invoice to pay */
94
- bolt11Invoice: string;
95
- /** User's EVM wallet address (for checking allowance and building transactions) */
96
- userAddress: string;
97
- /** Optional referral code for fee exemption */
98
- referralCode?: string;
99
- }
100
- /** Options for creating a Lightning-to-EVM swap via the generic endpoint */
101
- export interface LightningToEvmSwapGenericOptions {
102
- /** EVM address where tokens are swept after the claim (user's final destination) */
103
- targetAddress: string;
104
- /** Numeric EVM chain ID: 1 (Ethereum), 137 (Polygon), 42161 (Arbitrum) */
105
- evmChainId: number;
106
- /** ERC-20 contract address of the desired token on the target chain */
107
- tokenAddress: string;
108
- /** Amount in satoshis to send (mutually exclusive with amountOut) */
109
- amountIn?: number;
110
- /** Amount of target token to receive in smallest unit (mutually exclusive with amountIn) */
111
- amountOut?: number;
112
- /** Optional referral code */
113
- referralCode?: string;
114
- /** Whether the server should execute the DEX swap on behalf of the user (gasless claim). Defaults to true. */
115
- gasless?: boolean;
116
- }
117
- /** Result of creating a Lightning-to-EVM swap via the generic endpoint */
118
- export interface LightningToEvmSwapGenericResult {
119
- /** The swap response from the API */
120
- response: LightningToEvmSwapResponse;
121
- /** The swap parameters used (for storage/recovery) */
122
- swapParams: SwapParams;
123
- }
124
- /** Options for creating an EVM-to-Lightning swap via the generic endpoint */
125
- export interface EvmToLightningSwapGenericOptions {
126
- /** User's Lightning invoice to receive payment. Amount is derived from the invoice. */
127
- lightningInvoice: string;
128
- /** Numeric EVM chain ID: 1 (Ethereum), 137 (Polygon), 42161 (Arbitrum) */
129
- evmChainId: number;
130
- /** ERC-20 contract address of the source token on the EVM chain */
131
- tokenAddress: string;
132
- /** User's EVM address (sender of the ERC-20 token) */
133
- userAddress: string;
134
- /** Optional referral code */
135
- referralCode?: string;
136
- }
137
- /** Result of creating an EVM-to-Lightning swap via the generic endpoint */
138
- export interface EvmToLightningSwapGenericResult {
139
- /** The swap response from the API */
140
- response: EvmToLightningSwapResponse;
141
- /** The swap parameters used (for storage/recovery) */
142
- swapParams: SwapParams;
143
- }
144
- /** Options for creating an EVM-to-Arkade swap via the generic endpoint */
145
- export interface EvmToArkadeSwapGenericOptions {
146
- /** Target Arkade address to receive BTC */
147
- targetAddress: string;
148
- /** ERC-20 contract address of the source token on the EVM chain */
149
- tokenAddress: string;
150
- /** Numeric EVM chain ID: 1 (Ethereum), 137 (Polygon), 42161 (Arbitrum) */
151
- evmChainId: number;
152
- /** User's EVM wallet address (sender of the ERC-20 token) */
153
- userAddress: string;
154
- /** Amount of source token to send in smallest units (mutually exclusive with targetAmount) */
155
- sourceAmount?: bigint;
156
- /** Desired BTC output in sats (mutually exclusive with sourceAmount) */
157
- targetAmount?: number;
158
- /** Optional referral code */
159
- referralCode?: string;
160
- }
161
- /** Result of creating an EVM-to-Arkade swap via the generic endpoint */
162
- export interface EvmToArkadeSwapGenericResult {
163
- /** The swap response from the API */
164
- response: EvmToArkadeSwapResponse;
165
- /** The swap parameters used (for storage/recovery) */
166
- swapParams: SwapParams;
167
- }
168
- /** Options for creating an EVM-to-Bitcoin (on-chain) swap via the generic endpoint */
169
- export interface EvmToBitcoinSwapOptions {
170
- /** ERC-20 contract address of the source token on the EVM chain */
171
- tokenAddress: string;
172
- /** Numeric EVM chain ID: 1 (Ethereum), 137 (Polygon), 42161 (Arbitrum) */
173
- evmChainId: number;
174
- /** User's EVM wallet address (sender of the ERC-20 token) */
175
- userAddress: string;
176
- /** User's BTC address to receive claimed funds */
177
- targetAddress: string;
178
- /** Amount of source token to send in smallest units (mutually exclusive with targetAmount) */
179
- sourceAmount?: bigint;
180
- /** Desired BTC output in sats (mutually exclusive with sourceAmount) */
181
- targetAmount?: number;
182
- /** Optional referral code */
183
- referralCode?: string;
184
- }
185
- /** Result of creating an EVM-to-Bitcoin (on-chain) swap */
186
- export interface EvmToBitcoinSwapResult {
187
- /** The swap response from the API */
188
- response: ApiEvmToBitcoinSwapResponse;
189
- /** The swap parameters used (for storage/recovery) */
190
- swapParams: SwapParams;
191
- }
192
- /** Options for creating an Arkade-to-EVM swap via the generic endpoint */
193
- export interface ArkadeToEvmSwapOptions {
194
- /**
195
- * EVM address where tokens are swept after the claim (user's final destination).
196
- * This is required and will be stored on the server for use during redemption.
197
- */
198
- targetAddress: string;
199
- /** ERC-20 contract address of the desired token on the target chain */
200
- tokenAddress: string;
201
- /** Numeric EVM chain ID: 1 (Ethereum), 137 (Polygon), 42161 (Arbitrum) */
202
- evmChainId: number;
203
- /** Amount in satoshis to send (mutually exclusive with targetAmount) */
204
- sourceAmount?: bigint;
205
- /** Amount of target token to receive in smallest unit (mutually exclusive with sourceAmount) */
206
- targetAmount?: bigint;
207
- /** Optional referral code */
208
- referralCode?: string;
209
- /** Whether the server should execute the DEX swap on behalf of the user (gasless claim). Defaults to true. */
210
- gasless?: boolean;
211
- }
212
- /** Result of creating an Arkade-to-EVM swap via the generic endpoint */
213
- export interface ArkadeToEvmSwapResult {
214
- /** The swap response from the API */
215
- response: ArkadeToEvmSwapResponse;
216
- /** The swap parameters used (for storage/recovery) */
217
- swapParams: SwapParams;
218
- }
219
- /** Options for the generic `createSwap` method that routes to the correct direction. */
220
- export interface CreateSwapOptions {
221
- sourceAsset: TokenInfo;
222
- targetAsset: TokenInfo;
223
- sourceAmount?: number;
224
- targetAmount?: number;
225
- /** Target address: EVM address, Arkade address, or Lightning invoice */
226
- targetAddress: string;
227
- /** EVM address of the user (required for EVM→* swaps) */
228
- userAddress?: string;
229
- referralCode?: string;
230
- }
231
- /** Union of all swap creation results returned by `createSwap`. */
232
- export type CreateSwapResult = ArkadeToEvmSwapResult | BitcoinToEvmSwapResult | BitcoinToArkadeSwapResult | LightningToEvmSwapGenericResult | EvmToArkadeSwapGenericResult | EvmToBitcoinSwapResult | EvmToLightningSwapGenericResult;
233
- /**
234
- * Context passed to swap creation functions.
235
- * Contains the dependencies needed from the client.
236
- */
237
- export interface CreateSwapContext {
238
- /** The API client for making requests */
239
- apiClient: ApiClient;
240
- /** The base URL for the API (for endpoints not yet in OpenAPI spec) */
241
- baseUrl: string;
242
- /** Function to derive swap parameters (auto-increments key index) */
243
- deriveSwapParams: () => Promise<SwapParams>;
244
- /** Function to store the swap in storage (if configured) */
245
- storeSwap: (swapId: string, swapParams: SwapParams, response: Record<string, unknown>, targetAddress?: string) => Promise<void>;
246
- }
247
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/create/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,wBAAwB,IAAI,2BAA2B,EACvD,SAAS,EACT,wBAAwB,IAAI,2BAA2B,EACvD,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,OAAO,EACP,SAAS,EACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,qCAAqC;AACrC,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAEpE,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,WAAW,EAAE,OAAO,CAAC;IACrB,uBAAuB;IACvB,WAAW,EAAE,QAAQ,CAAC;IACtB,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qFAAqF;AACrF,MAAM,WAAW,uBAAuB;IACtC,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8GAA8G;IAC9G,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,8DAA8D;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rC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,sDAAsD;IACtD,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,SAAS,CAAC;IACvB,WAAW,EAAE,SAAS,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,aAAa,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,sBAAsB,GACtB,yBAAyB,GACzB,+BAA+B,GAC/B,4BAA4B,GAC5B,sBAAsB,GACtB,+BAA+B,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,gBAAgB,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,4DAA4D;IAC5D,SAAS,EAAE,CACT,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,aAAa,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Types for swap creation operations.
3
- */
4
- export {};
5
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/create/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}