@anywalletkit/protocol-swap2-layerswap 0.0.0-stage → 0.1.1

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 (58) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +97 -2
  3. package/dist/activity.cjs +122 -0
  4. package/dist/activity.cjs.map +1 -0
  5. package/dist/activity.d.cts +15 -0
  6. package/dist/activity.d.ts +15 -0
  7. package/dist/activity.js +10 -0
  8. package/dist/activity.js.map +1 -0
  9. package/dist/chunk-5QTIHCE4.js +99 -0
  10. package/dist/chunk-5QTIHCE4.js.map +1 -0
  11. package/dist/chunk-KCAZCR4I.js +27 -0
  12. package/dist/chunk-KCAZCR4I.js.map +1 -0
  13. package/dist/chunk-TEL62A5J.js +564 -0
  14. package/dist/chunk-TEL62A5J.js.map +1 -0
  15. package/dist/chunk-WEMNS3LY.js +21 -0
  16. package/dist/chunk-WEMNS3LY.js.map +1 -0
  17. package/dist/chunk-ZKT24QPJ.js +123 -0
  18. package/dist/chunk-ZKT24QPJ.js.map +1 -0
  19. package/dist/chunk-ZTFJO6AI.js +410 -0
  20. package/dist/chunk-ZTFJO6AI.js.map +1 -0
  21. package/dist/config.cjs +143 -0
  22. package/dist/config.cjs.map +1 -0
  23. package/dist/config.d.cts +74 -0
  24. package/dist/config.d.ts +74 -0
  25. package/dist/config.js +31 -0
  26. package/dist/config.js.map +1 -0
  27. package/dist/index.cjs +1189 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +84 -0
  30. package/dist/index.d.ts +84 -0
  31. package/dist/index.js +126 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/pins.cjs +557 -0
  34. package/dist/pins.cjs.map +1 -0
  35. package/dist/pins.d.cts +6 -0
  36. package/dist/pins.d.ts +6 -0
  37. package/dist/pins.js +11 -0
  38. package/dist/pins.js.map +1 -0
  39. package/dist/protocol.cjs +1052 -0
  40. package/dist/protocol.cjs.map +1 -0
  41. package/dist/protocol.d.cts +19 -0
  42. package/dist/protocol.d.ts +19 -0
  43. package/dist/protocol.js +11 -0
  44. package/dist/protocol.js.map +1 -0
  45. package/dist/provider.cjs +1039 -0
  46. package/dist/provider.cjs.map +1 -0
  47. package/dist/provider.d.cts +23 -0
  48. package/dist/provider.d.ts +23 -0
  49. package/dist/provider.js +16 -0
  50. package/dist/provider.js.map +1 -0
  51. package/dist/verify.cjs +554 -0
  52. package/dist/verify.cjs.map +1 -0
  53. package/dist/verify.d.cts +169 -0
  54. package/dist/verify.d.ts +169 -0
  55. package/dist/verify.js +46 -0
  56. package/dist/verify.js.map +1 -0
  57. package/module.json +64 -0
  58. package/package.json +100 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config.ts"],"sourcesContent":["import {namespace} from \"@anywalletkit/protocol-swap2-core/util\";\n\n/**\n * Layerswap (layerswap.io) — what this module pins and which chains it serves.\n *\n * Layerswap is a solver bridge: the source leg pays Layerswap on the source chain, and Layerswap pays the recipient\n * out of its own liquidity on the destination chain (or chains CCTP / a native rollup bridge / a DEX hop behind it).\n * The recipient, the destination and the minimum live in Layerswap's records under the swap id, not on chain: the\n * module reads the swap back and holds every field to the request before anything is signed (see `verify.ts`).\n */\n\n/** Layerswap's v2 API. One base URL for mainnet and testnet: the API key picks the environment. */\nexport const LAYERSWAP_API = \"https://api.layerswap.io/api/v2\";\n\n/**\n * LayerswapDepository (github.com/layerswap/layerswap-depository, `evm/src/LayerswapDepository.sol`; audited by\n * Hexens, March 2026). It holds nothing: `depositNative(id, receiver)` / `depositERC20(id, token, receiver, amount)`\n * forward the input in the same call to a receiver on the contract's own whitelist and emit\n * `Deposited(id, token, receiver, amount)`, `id` being the swap's sequence number. Deployed at one address; read on\n * 2026-12-01 on every EVM chain Layerswap lists (public RPCs from its `/networks`): runtime code keccak\n * `0xe2c5b091…` on each chain below, owner `0xB6103502673173ab5Df6A57Ac3017Db4e16af399`, not paused, whitelist\n * exactly {@link LAYERSWAP_RECEIVERS}. A second contract of the same code at `0x8f00775A…B038` (Ethereum, Mantle)\n * whitelists its own owner only and is not Layerswap's live one: it is never a target here.\n */\nexport const LAYERSWAP_DEPOSITORY = \"0xe226e4825cb215abafad98fdd400583eab6a594f\";\n\n/**\n * The solver addresses the Depository forwards to (`getWhitelistedAddresses()`, the same two on every chain on\n * 2026-12-01; 0x2fc6…befe is the address Layerswap has paid out of since 2022). A deposit naming any other receiver\n * is refused even if Layerswap's owner key whitelists it later: a new receiver ships in a module release, after it\n * is read on chain. Both are plain accounts (no code).\n */\nexport const LAYERSWAP_RECEIVERS: readonly string[] = Object.freeze([\n \"0x2fc617e933a52713247ce25730f6695920b3befe\",\n \"0x08b00ceee2fb66029b53d76110b19eeaabfd1e65\",\n]);\n\n/** `depositNative(bytes32,address)` and `depositERC20(bytes32,address,address,uint256)`. */\nexport const DEPOSIT_NATIVE_SELECTOR = \"0x80a6de92\";\nexport const DEPOSIT_ERC20_SELECTOR = \"0xf4371f63\";\n\n/**\n * EVM chains a deposit can leave from: the Depository at {@link LAYERSWAP_DEPOSITORY} with the pinned code, owner and\n * whitelist (read 2026-12-01). Layerswap also lists Flare, Cronos, Rootstock, Telos, Fuse, Flow, Citrea and 0G (no\n * Depository there) and Mode (its Depository did not answer the reads): those are destinations only.\n */\nexport const LAYERSWAP_DEPOSITORY_CHAINS: readonly number[] = Object.freeze([\n 1, 10, 56, 100, 130, 137, 143, 146, 169, 196, 204, 252, 324, 360, 480, 988, 999, 1329, 1868, 2020, 2741, 2818, 4217,\n 4326, 4663, 5000, 5042, 8217, 8453, 9745, 13371, 42161, 42220, 42793, 43114, 48900, 57073, 59144, 60808, 80094, 99901,\n 167000, 534352, 747474, 7777777,\n]);\n\n/** Every EVM chain Layerswap listed on 2026-12-01 (`GET /networks`, type `evm`), as a destination. */\nexport const LAYERSWAP_EVM_CHAINS: readonly number[] = Object.freeze([\n ...LAYERSWAP_DEPOSITORY_CHAINS, 14, 25, 30, 40, 122, 747, 4114, 16661, 34443,\n].sort((a, b) => a - b));\n\n/** The non-EVM chains this module serves, by our CAIP-2 id → Layerswap's network name. */\nexport const LAYERSWAP_NON_EVM: Readonly<Record<string, string>> = Object.freeze({\n \"solana:mainnet\": \"SOLANA_MAINNET\",\n \"ton:-239\": \"TON_MAINNET\",\n \"tron:728126428\": \"TRON_MAINNET\",\n \"bitcoin:mainnet\": \"BITCOIN_MAINNET\",\n});\n\n/**\n * How the source leg is funded, per source family:\n * - EVM: the Depository (`use_depository`), pinned above.\n * - Solana: the wallet flow — Layerswap's serialized transfer with the swap's sequence number as a top-level memo.\n * The deposit-address flow costs a sweep (≈ $0.36 on 100 USDC, 2026-12-01).\n * - TON: the wallet flow — a transfer (or jetton transfer) with the swap's comment. TON has no deposit address.\n * - Tron: the wallet flow — a TRC-20 transfer with the memo in `raw_data.data`. The deposit-address flow costs\n * ≈ $4 a swap (2026-12-01).\n * - Bitcoin: a deposit address minted for the swap (`use_deposit_address`): the wallet flow needs an OP_RETURN\n * output the Bitcoin account does not write; the address costs ≈ 0.03 % (2026-12-01).\n */\nexport type LayerswapFunding = \"depository\" | \"wallet\" | \"deposit_address\";\n\nexport function fundingFor(sourceChain: string): LayerswapFunding | null {\n const ns = namespace(sourceChain);\n if (ns === \"eip155\") return LAYERSWAP_DEPOSITORY_CHAINS.includes(evmChainId(sourceChain) ?? -1) ? \"depository\" : null;\n if (ns === \"solana\" || ns === \"ton\" || ns === \"tron\") return sourceChain in LAYERSWAP_NON_EVM ? \"wallet\" : null;\n if (ns === \"bitcoin\") return sourceChain in LAYERSWAP_NON_EVM ? \"deposit_address\" : null;\n return null;\n}\n\n/** `eip155:<id>` → id, else null. */\nexport function evmChainId(caip2: string): number | null {\n const m = /^eip155:([1-9]\\d{0,9})$/.exec(caip2);\n return m ? Number(m[1]) : null;\n}\n\n/**\n * Whether this module names the chain, and how: the numeric chain id for EVM (matched against `chain_id` in\n * Layerswap's network list), the network name otherwise; null for a chain this module does not serve. Requests carry\n * the `name` from Layerswap's list for either.\n */\nexport function layerswapNetwork(caip2: string): string | null {\n const id = evmChainId(caip2);\n if (id !== null) return LAYERSWAP_EVM_CHAINS.includes(id) ? String(id) : null;\n return Object.prototype.hasOwnProperty.call(LAYERSWAP_NON_EVM, caip2) ? LAYERSWAP_NON_EVM[caip2]! : null;\n}\n\n/** Layerswap's network name for a chain as its responses name it (EVM by chain id). */\nexport function sameNetwork(caip2: string, network: {name?: unknown; chain_id?: unknown} | null | undefined): boolean {\n if (!network) return false;\n const id = evmChainId(caip2);\n if (id !== null) return String(network.chain_id ?? \"\") === String(id);\n return network.name === LAYERSWAP_NON_EVM[caip2];\n}\n\nexport const layerswap = {\n supportsChain(chain: string): boolean {\n return layerswapNetwork(chain) !== null;\n },\n /** A route this module can try: a source with a funding method, any served destination, never the same chain. */\n supports(from: string, to: string): boolean {\n return from !== to && fundingFor(from) !== null && layerswapNetwork(to) !== null;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAYjB,IAAM,gBAAgB;AAYtB,IAAM,uBAAuB;AAQ7B,IAAM,sBAAyC,OAAO,OAAO;AAAA,EAClE;AAAA,EACA;AACF,CAAC;AAGM,IAAM,0BAA0B;AAChC,IAAM,yBAAyB;AAO/B,IAAM,8BAAiD,OAAO,OAAO;AAAA,EAC1E;AAAA,EAAG;AAAA,EAAI;AAAA,EAAI;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAC/G;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAAO;AAAA,EAChH;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAQ;AAC1B,CAAC;AAGM,IAAM,uBAA0C,OAAO,OAAO;AAAA,EACnE,GAAG;AAAA,EAA6B;AAAA,EAAI;AAAA,EAAI;AAAA,EAAI;AAAA,EAAI;AAAA,EAAK;AAAA,EAAK;AAAA,EAAM;AAAA,EAAO;AACzE,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC;AAGhB,IAAM,oBAAsD,OAAO,OAAO;AAAA,EAC/E,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,mBAAmB;AACrB,CAAC;AAeM,SAAS,WAAW,aAA8C;AACvE,QAAM,SAAK,uBAAU,WAAW;AAChC,MAAI,OAAO,SAAU,QAAO,4BAA4B,SAAS,WAAW,WAAW,KAAK,EAAE,IAAI,eAAe;AACjH,MAAI,OAAO,YAAY,OAAO,SAAS,OAAO,OAAQ,QAAO,eAAe,oBAAoB,WAAW;AAC3G,MAAI,OAAO,UAAW,QAAO,eAAe,oBAAoB,oBAAoB;AACpF,SAAO;AACT;AAGO,SAAS,WAAW,OAA8B;AACvD,QAAM,IAAI,0BAA0B,KAAK,KAAK;AAC9C,SAAO,IAAI,OAAO,EAAE,CAAC,CAAC,IAAI;AAC5B;AAOO,SAAS,iBAAiB,OAA8B;AAC7D,QAAM,KAAK,WAAW,KAAK;AAC3B,MAAI,OAAO,KAAM,QAAO,qBAAqB,SAAS,EAAE,IAAI,OAAO,EAAE,IAAI;AACzE,SAAO,OAAO,UAAU,eAAe,KAAK,mBAAmB,KAAK,IAAI,kBAAkB,KAAK,IAAK;AACtG;AAGO,SAAS,YAAY,OAAe,SAA2E;AACpH,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,KAAK,WAAW,KAAK;AAC3B,MAAI,OAAO,KAAM,QAAO,OAAO,QAAQ,YAAY,EAAE,MAAM,OAAO,EAAE;AACpE,SAAO,QAAQ,SAAS,kBAAkB,KAAK;AACjD;AAEO,IAAM,YAAY;AAAA,EACvB,cAAc,OAAwB;AACpC,WAAO,iBAAiB,KAAK,MAAM;AAAA,EACrC;AAAA;AAAA,EAEA,SAAS,MAAc,IAAqB;AAC1C,WAAO,SAAS,MAAM,WAAW,IAAI,MAAM,QAAQ,iBAAiB,EAAE,MAAM;AAAA,EAC9E;AACF;","names":[]}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Layerswap (layerswap.io) — what this module pins and which chains it serves.
3
+ *
4
+ * Layerswap is a solver bridge: the source leg pays Layerswap on the source chain, and Layerswap pays the recipient
5
+ * out of its own liquidity on the destination chain (or chains CCTP / a native rollup bridge / a DEX hop behind it).
6
+ * The recipient, the destination and the minimum live in Layerswap's records under the swap id, not on chain: the
7
+ * module reads the swap back and holds every field to the request before anything is signed (see `verify.ts`).
8
+ */
9
+ /** Layerswap's v2 API. One base URL for mainnet and testnet: the API key picks the environment. */
10
+ declare const LAYERSWAP_API = "https://api.layerswap.io/api/v2";
11
+ /**
12
+ * LayerswapDepository (github.com/layerswap/layerswap-depository, `evm/src/LayerswapDepository.sol`; audited by
13
+ * Hexens, March 2026). It holds nothing: `depositNative(id, receiver)` / `depositERC20(id, token, receiver, amount)`
14
+ * forward the input in the same call to a receiver on the contract's own whitelist and emit
15
+ * `Deposited(id, token, receiver, amount)`, `id` being the swap's sequence number. Deployed at one address; read on
16
+ * 2026-12-01 on every EVM chain Layerswap lists (public RPCs from its `/networks`): runtime code keccak
17
+ * `0xe2c5b091…` on each chain below, owner `0xB6103502673173ab5Df6A57Ac3017Db4e16af399`, not paused, whitelist
18
+ * exactly {@link LAYERSWAP_RECEIVERS}. A second contract of the same code at `0x8f00775A…B038` (Ethereum, Mantle)
19
+ * whitelists its own owner only and is not Layerswap's live one: it is never a target here.
20
+ */
21
+ declare const LAYERSWAP_DEPOSITORY = "0xe226e4825cb215abafad98fdd400583eab6a594f";
22
+ /**
23
+ * The solver addresses the Depository forwards to (`getWhitelistedAddresses()`, the same two on every chain on
24
+ * 2026-12-01; 0x2fc6…befe is the address Layerswap has paid out of since 2022). A deposit naming any other receiver
25
+ * is refused even if Layerswap's owner key whitelists it later: a new receiver ships in a module release, after it
26
+ * is read on chain. Both are plain accounts (no code).
27
+ */
28
+ declare const LAYERSWAP_RECEIVERS: readonly string[];
29
+ /** `depositNative(bytes32,address)` and `depositERC20(bytes32,address,address,uint256)`. */
30
+ declare const DEPOSIT_NATIVE_SELECTOR = "0x80a6de92";
31
+ declare const DEPOSIT_ERC20_SELECTOR = "0xf4371f63";
32
+ /**
33
+ * EVM chains a deposit can leave from: the Depository at {@link LAYERSWAP_DEPOSITORY} with the pinned code, owner and
34
+ * whitelist (read 2026-12-01). Layerswap also lists Flare, Cronos, Rootstock, Telos, Fuse, Flow, Citrea and 0G (no
35
+ * Depository there) and Mode (its Depository did not answer the reads): those are destinations only.
36
+ */
37
+ declare const LAYERSWAP_DEPOSITORY_CHAINS: readonly number[];
38
+ /** Every EVM chain Layerswap listed on 2026-12-01 (`GET /networks`, type `evm`), as a destination. */
39
+ declare const LAYERSWAP_EVM_CHAINS: readonly number[];
40
+ /** The non-EVM chains this module serves, by our CAIP-2 id → Layerswap's network name. */
41
+ declare const LAYERSWAP_NON_EVM: Readonly<Record<string, string>>;
42
+ /**
43
+ * How the source leg is funded, per source family:
44
+ * - EVM: the Depository (`use_depository`), pinned above.
45
+ * - Solana: the wallet flow — Layerswap's serialized transfer with the swap's sequence number as a top-level memo.
46
+ * The deposit-address flow costs a sweep (≈ $0.36 on 100 USDC, 2026-12-01).
47
+ * - TON: the wallet flow — a transfer (or jetton transfer) with the swap's comment. TON has no deposit address.
48
+ * - Tron: the wallet flow — a TRC-20 transfer with the memo in `raw_data.data`. The deposit-address flow costs
49
+ * ≈ $4 a swap (2026-12-01).
50
+ * - Bitcoin: a deposit address minted for the swap (`use_deposit_address`): the wallet flow needs an OP_RETURN
51
+ * output the Bitcoin account does not write; the address costs ≈ 0.03 % (2026-12-01).
52
+ */
53
+ type LayerswapFunding = "depository" | "wallet" | "deposit_address";
54
+ declare function fundingFor(sourceChain: string): LayerswapFunding | null;
55
+ /** `eip155:<id>` → id, else null. */
56
+ declare function evmChainId(caip2: string): number | null;
57
+ /**
58
+ * Whether this module names the chain, and how: the numeric chain id for EVM (matched against `chain_id` in
59
+ * Layerswap's network list), the network name otherwise; null for a chain this module does not serve. Requests carry
60
+ * the `name` from Layerswap's list for either.
61
+ */
62
+ declare function layerswapNetwork(caip2: string): string | null;
63
+ /** Layerswap's network name for a chain as its responses name it (EVM by chain id). */
64
+ declare function sameNetwork(caip2: string, network: {
65
+ name?: unknown;
66
+ chain_id?: unknown;
67
+ } | null | undefined): boolean;
68
+ declare const layerswap: {
69
+ supportsChain(chain: string): boolean;
70
+ /** A route this module can try: a source with a funding method, any served destination, never the same chain. */
71
+ supports(from: string, to: string): boolean;
72
+ };
73
+
74
+ export { DEPOSIT_ERC20_SELECTOR, DEPOSIT_NATIVE_SELECTOR, LAYERSWAP_API, LAYERSWAP_DEPOSITORY, LAYERSWAP_DEPOSITORY_CHAINS, LAYERSWAP_EVM_CHAINS, LAYERSWAP_NON_EVM, LAYERSWAP_RECEIVERS, type LayerswapFunding, evmChainId, fundingFor, layerswap, layerswapNetwork, sameNetwork };
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Layerswap (layerswap.io) — what this module pins and which chains it serves.
3
+ *
4
+ * Layerswap is a solver bridge: the source leg pays Layerswap on the source chain, and Layerswap pays the recipient
5
+ * out of its own liquidity on the destination chain (or chains CCTP / a native rollup bridge / a DEX hop behind it).
6
+ * The recipient, the destination and the minimum live in Layerswap's records under the swap id, not on chain: the
7
+ * module reads the swap back and holds every field to the request before anything is signed (see `verify.ts`).
8
+ */
9
+ /** Layerswap's v2 API. One base URL for mainnet and testnet: the API key picks the environment. */
10
+ declare const LAYERSWAP_API = "https://api.layerswap.io/api/v2";
11
+ /**
12
+ * LayerswapDepository (github.com/layerswap/layerswap-depository, `evm/src/LayerswapDepository.sol`; audited by
13
+ * Hexens, March 2026). It holds nothing: `depositNative(id, receiver)` / `depositERC20(id, token, receiver, amount)`
14
+ * forward the input in the same call to a receiver on the contract's own whitelist and emit
15
+ * `Deposited(id, token, receiver, amount)`, `id` being the swap's sequence number. Deployed at one address; read on
16
+ * 2026-12-01 on every EVM chain Layerswap lists (public RPCs from its `/networks`): runtime code keccak
17
+ * `0xe2c5b091…` on each chain below, owner `0xB6103502673173ab5Df6A57Ac3017Db4e16af399`, not paused, whitelist
18
+ * exactly {@link LAYERSWAP_RECEIVERS}. A second contract of the same code at `0x8f00775A…B038` (Ethereum, Mantle)
19
+ * whitelists its own owner only and is not Layerswap's live one: it is never a target here.
20
+ */
21
+ declare const LAYERSWAP_DEPOSITORY = "0xe226e4825cb215abafad98fdd400583eab6a594f";
22
+ /**
23
+ * The solver addresses the Depository forwards to (`getWhitelistedAddresses()`, the same two on every chain on
24
+ * 2026-12-01; 0x2fc6…befe is the address Layerswap has paid out of since 2022). A deposit naming any other receiver
25
+ * is refused even if Layerswap's owner key whitelists it later: a new receiver ships in a module release, after it
26
+ * is read on chain. Both are plain accounts (no code).
27
+ */
28
+ declare const LAYERSWAP_RECEIVERS: readonly string[];
29
+ /** `depositNative(bytes32,address)` and `depositERC20(bytes32,address,address,uint256)`. */
30
+ declare const DEPOSIT_NATIVE_SELECTOR = "0x80a6de92";
31
+ declare const DEPOSIT_ERC20_SELECTOR = "0xf4371f63";
32
+ /**
33
+ * EVM chains a deposit can leave from: the Depository at {@link LAYERSWAP_DEPOSITORY} with the pinned code, owner and
34
+ * whitelist (read 2026-12-01). Layerswap also lists Flare, Cronos, Rootstock, Telos, Fuse, Flow, Citrea and 0G (no
35
+ * Depository there) and Mode (its Depository did not answer the reads): those are destinations only.
36
+ */
37
+ declare const LAYERSWAP_DEPOSITORY_CHAINS: readonly number[];
38
+ /** Every EVM chain Layerswap listed on 2026-12-01 (`GET /networks`, type `evm`), as a destination. */
39
+ declare const LAYERSWAP_EVM_CHAINS: readonly number[];
40
+ /** The non-EVM chains this module serves, by our CAIP-2 id → Layerswap's network name. */
41
+ declare const LAYERSWAP_NON_EVM: Readonly<Record<string, string>>;
42
+ /**
43
+ * How the source leg is funded, per source family:
44
+ * - EVM: the Depository (`use_depository`), pinned above.
45
+ * - Solana: the wallet flow — Layerswap's serialized transfer with the swap's sequence number as a top-level memo.
46
+ * The deposit-address flow costs a sweep (≈ $0.36 on 100 USDC, 2026-12-01).
47
+ * - TON: the wallet flow — a transfer (or jetton transfer) with the swap's comment. TON has no deposit address.
48
+ * - Tron: the wallet flow — a TRC-20 transfer with the memo in `raw_data.data`. The deposit-address flow costs
49
+ * ≈ $4 a swap (2026-12-01).
50
+ * - Bitcoin: a deposit address minted for the swap (`use_deposit_address`): the wallet flow needs an OP_RETURN
51
+ * output the Bitcoin account does not write; the address costs ≈ 0.03 % (2026-12-01).
52
+ */
53
+ type LayerswapFunding = "depository" | "wallet" | "deposit_address";
54
+ declare function fundingFor(sourceChain: string): LayerswapFunding | null;
55
+ /** `eip155:<id>` → id, else null. */
56
+ declare function evmChainId(caip2: string): number | null;
57
+ /**
58
+ * Whether this module names the chain, and how: the numeric chain id for EVM (matched against `chain_id` in
59
+ * Layerswap's network list), the network name otherwise; null for a chain this module does not serve. Requests carry
60
+ * the `name` from Layerswap's list for either.
61
+ */
62
+ declare function layerswapNetwork(caip2: string): string | null;
63
+ /** Layerswap's network name for a chain as its responses name it (EVM by chain id). */
64
+ declare function sameNetwork(caip2: string, network: {
65
+ name?: unknown;
66
+ chain_id?: unknown;
67
+ } | null | undefined): boolean;
68
+ declare const layerswap: {
69
+ supportsChain(chain: string): boolean;
70
+ /** A route this module can try: a source with a funding method, any served destination, never the same chain. */
71
+ supports(from: string, to: string): boolean;
72
+ };
73
+
74
+ export { DEPOSIT_ERC20_SELECTOR, DEPOSIT_NATIVE_SELECTOR, LAYERSWAP_API, LAYERSWAP_DEPOSITORY, LAYERSWAP_DEPOSITORY_CHAINS, LAYERSWAP_EVM_CHAINS, LAYERSWAP_NON_EVM, LAYERSWAP_RECEIVERS, type LayerswapFunding, evmChainId, fundingFor, layerswap, layerswapNetwork, sameNetwork };
package/dist/config.js ADDED
@@ -0,0 +1,31 @@
1
+ import {
2
+ DEPOSIT_ERC20_SELECTOR,
3
+ DEPOSIT_NATIVE_SELECTOR,
4
+ LAYERSWAP_API,
5
+ LAYERSWAP_DEPOSITORY,
6
+ LAYERSWAP_DEPOSITORY_CHAINS,
7
+ LAYERSWAP_EVM_CHAINS,
8
+ LAYERSWAP_NON_EVM,
9
+ LAYERSWAP_RECEIVERS,
10
+ evmChainId,
11
+ fundingFor,
12
+ layerswap,
13
+ layerswapNetwork,
14
+ sameNetwork
15
+ } from "./chunk-ZKT24QPJ.js";
16
+ export {
17
+ DEPOSIT_ERC20_SELECTOR,
18
+ DEPOSIT_NATIVE_SELECTOR,
19
+ LAYERSWAP_API,
20
+ LAYERSWAP_DEPOSITORY,
21
+ LAYERSWAP_DEPOSITORY_CHAINS,
22
+ LAYERSWAP_EVM_CHAINS,
23
+ LAYERSWAP_NON_EVM,
24
+ LAYERSWAP_RECEIVERS,
25
+ evmChainId,
26
+ fundingFor,
27
+ layerswap,
28
+ layerswapNetwork,
29
+ sameNetwork
30
+ };
31
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}