diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08e7c66..91ed144 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,8 @@ jobs: if-no-files-found: ignore e2e: - runs-on: ubuntu-latest + # Playwright has no chromium build for ubuntu-latest (26.04) yet. + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/README.md b/README.md index 845504b..c463b96 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,102 @@ Lintent is LI.FI's interactive demo for the [Open Intents Framework (OIF)](https The app handles both sides of an intent: the user (intent issuer) and the solver. Each step maps to a dedicated screen so you can follow the entire flow in sequence. +## Stellar ↔ EVM Axelar corridors + +Only direct USDC escrow intents are supported, on these Axelar corridors: + +- **Mainnet**: Stellar `1201081091099710` ↔ Base `8453` and ↔ Arbitrum `42161`. +- **Testnet**: Stellar `1201081091099711` ↔ Base Sepolia `84532`. + +The deployments are public records, matching the order service's +`/api/v1/contracts`, and live in one static table per network +(`AXELAR_NETWORKS` in `src/lib/axelarNetworks.ts`): ABI generation, oracles, +Axelar chain names, Stellar input escrow/output settler, USDC (7 decimals on +Stellar, 6 on EVM), Axelarscan estimator and order API. There is no +environment flag. Pick **Mainnet** or **Testnet** in Asset Management, then a +directional button in Intent Issuance. **Explore without connecting** permits +route/quote-state inspection and historical order reads; it does not create a +wallet or authorize transactions. Freighter must use the selected network's +passphrase. + +Quotes come from the network's order API, irrespective of the general API +toggle: `new IntentApi(true)` (`https://order.li.fi`) on mainnet and +`new IntentApi(false)` (`https://order-dev.li.fi`) on testnet. The accept-list +contains exactly the corridor's two Axelar oracles with `stellar:`/`eip155:` +namespaces. Quote ID/reference, validity, oracle metadata, allowances and exact +`openIntentTx` remain bound to the selection and are saved alongside an executed +local order. Account/network/recipient/assets/amounts/settings changes and expiry +invalidate it; stale responses cannot replace a newer request. No manual-order +nonce, deadline or oracle reconstruction is used for these corridors. + +Before signing, the factory checks the requested USDC route/account/amounts, +recipient kind, both settlers/oracles, reference↔nonce, validity and allowance +targets. EVM executes the returned `to/data/value` after the returned allowance +check. Stellar decodes the returned **order ScVal**, calls `open` on the returned +escrow, simulates, then asks Freighter to sign under the selected passphrase; +the API payload is not an envelope. Wallets, RPCs, balances and receipt caches +are network-scoped. + +The selection's request generation is revocable. Clearing, replacing, refreshing +or editing it also invalidates pending execution, even if the old amount is +restored. The factory rechecks selection identity/generation and live output +amount before EVM approval/open requests and Freighter signing, after asynchronous +preparation and network checks. Only initial quote selection accepts a pre-quote +output placeholder. Revocation cannot undo an approval/signature already requested. + +Catamaran may fill and claim externally. Supply its actual fill transaction hash +in **Fill Intent** to inspect proof progress. Stellar fill events and records +identify the real claimant; reads do not require the connected EVM user to equal +that solver. Stellar claimant commitments are opaque bytes32 values, never +public keys or reconstructed G-addresses. Only the actual fill claimant may +manually finalise. This does not add native REST/WS ingestion or firm-quote +attribution to Catamaran. + +Manual proofs depend on the network's oracle ABI generation. The proof +destination is the **origin** chain. Only paid Relayed mode with positive native +gas and zero destination config is supported, and forward/reverse chain maps are +checked before publication. + +- **current** (testnet): EVM `submit(string,string,address,bytes[],bytes32,uint8)` + with the destination's Axelar name and native oracle string (Stellar C-strkey); + Stellar `submit` with the U256 destination id and the oracle address string. + Maps: EVM `chainIdMap`/`reverseChainIdMap`, Stellar `route`/`chain_name`. + Sources: EVM `7dc19ce`; Stellar `dccd29fad348d6058e0a4f97b8672fd94825ad53`. +- **legacy** (mainnet): EVM `submit(string,bytes32,address,bytes[],bytes32,uint8)` + and Stellar `submit(String,BytesN<32>,…)`, both with the destination's Axelar + name and the raw 32-byte oracle id (EVM addresses left-padded with 12 zero + bytes), which the oracle encodes by route kind. Maps: EVM `route(name)` and + `reverseChainIdMap(id) == keccak256(name)`, Stellar `route(name).chain_id` and + `chain_name`. Sources: EVM `e226659`; Stellar `5b8f3ca`. + +Gas is estimated server-side (`/axelar/gas`) for supported corridors only, via +the network's fixed `POST https://{testnet.}api.axelarscan.io/gmp/estimateGasFeeForNHops`, +`{params:[request],showDetailedFees:true}`. Requests use native oracle strings, +the table's Axelar chain names, zero native-token address, +`gasLimit:"500000"`, `gasMultiplier:"auto"` and hex receiving `execute` data. +Encoding follows Catamaran's `proof/lifecycle/native.rs` and `native_origin.rs`: +EVM calldata or Stellar **Operation XDR**, with estimate-only all-`ff` IDs. +Those IDs never authenticate or submit a proof. The one-hop echo must repeat +every request field, 7/18 native decimals and a positive decimal-string total. +Unavailable estimates disable manual publication; there is no gas floor. +Messages link to the network's Axelarscan. + +The SDK is pinned to the published P2 Git commit +`352216efb365c620a1a9dd49cb72116b8faf5b61`; no release or local link is assumed. +Normal `bun install` runs the trusted Git package's `prepare` to generate +`_esm`, `_cjs` and `_types`; no manual SDK build or copied outputs are required. +Bun's in-place Git preparation uses the consumer's build tools, so install with +devDependencies enabled: `rollup ^4.61.0`, `rollup-plugin-esbuild ^6.2.1`, +`typescript ^5.6.3` and `@types/bun ^1.3.8` (compatible newer versions are valid). +The manifest explicitly trusts `@lifi/intent`; preserve other audited trust +entries and do not blanket-approve lifecycle scripts. `bun.lock` pins the exact +Git revision and resolved build tools. Production build stages must install +devDependencies before preparing the SDK and building lintent; a +production-only install from an empty dependency tree omits required tools. + +Existing PR pushes create automatic Cloudflare previews; no new deployment +workflow is added. + ## Architecture ```mermaid diff --git a/bun.lock b/bun.lock index 84d0745..782047d 100644 --- a/bun.lock +++ b/bun.lock @@ -9,7 +9,7 @@ "@coinbase/wallet-sdk": "^4.3.6", "@coral-xyz/anchor": "^0.31", "@electric-sql/pglite": "^0.3.15", - "@lifi/intent": "0.6.0", + "@lifi/intent": "git+https://github.com/lifinance/intent.ts.git#352216efb365c620a1a9dd49cb72116b8faf5b61", "@metamask/sdk": "^0.34.0", "@safe-global/safe-apps-provider": "~0.18.6", "@safe-global/safe-apps-sdk": "^9.1.0", @@ -19,6 +19,8 @@ "@solana/wallet-adapter-phantom": "^0.9.29", "@solana/wallet-adapter-solflare": "^0.6.33", "@solana/web3.js": "^1.98", + "@stellar/freighter-api": "^6.0.1", + "@stellar/stellar-sdk": "^17.2.1", "@sveltejs/adapter-cloudflare": "^7.0.3", "@wagmi/connectors": "^7.2.1", "@wagmi/core": "^3.4.0", @@ -51,15 +53,20 @@ "prettier": "3.4.2", "prettier-plugin-svelte": "3.3.3", "prettier-plugin-tailwindcss": "0.6.11", + "rollup": "^4.61.0", + "rollup-plugin-esbuild": "^6.2.1", "svelte": "^5.0.0", "svelte-check": "^4.0.0", "tailwindcss": "^4.0.0", - "typescript": "^5.0.0", + "typescript": "^5.6.3", "typescript-eslint": "^8.20.0", "vite": "^7.1.1", }, }, }, + "trustedDependencies": [ + "@lifi/intent", + ], "overrides": { "bigint-buffer": "npm:bigint-buffer-fixed@^1.1.6", }, @@ -192,6 +199,8 @@ "@ethereumjs/util": ["@ethereumjs/util@8.1.0", "", { "dependencies": { "@ethereumjs/rlp": "^4.0.1", "ethereum-cryptography": "^2.0.0", "micro-ftch": "^0.3.1" } }, "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA=="], + "@exodus/bytes": ["@exodus/bytes@1.16.0", "", { "peerDependencies": { "@noble/hashes": "^1.8.0 || ^2.0.0" }, "optionalPeers": ["@noble/hashes"] }, "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA=="], + "@gar/promisify": ["@gar/promisify@1.1.3", "", {}, "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw=="], "@humanfs/core": ["@humanfs/core@0.19.1", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="], @@ -250,7 +259,7 @@ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.29", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ=="], - "@lifi/intent": ["@lifi/intent@0.6.0", "", { "dependencies": { "@scure/base": "^2.2.0", "borsh": "^2.0.0", "ky": "^1.12.0", "viem": "~2.45.1" } }, "sha512-GcQGXbpf8hKj9uILIq1bBh0fvFyCK+sUBSPqUX2KqT3CMtcNSHRf+d10UTm0ZGExNi/hEfbIlCYvnFXFKm/5sw=="], + "@lifi/intent": ["@lifi/intent@github:lifinance/intent.ts#352216e", { "dependencies": { "@noble/curves": "^1.9.1", "@scure/base": "^2.2.0", "borsh": "^2.0.0", "ky": "^1.12.0", "viem": "~2.45.1" } }, "lifinance-intent.ts-352216e", "sha512-hFJFuuxLaA/xowHhBa6M6DMqCkwllvKOnelThQuZnjwZw1K+y6Fc4IG0mWvAgmzZtp/rWedyjaagiFTLEz81AQ=="], "@lit-labs/ssr-dom-shim": ["@lit-labs/ssr-dom-shim@1.5.1", "", {}, "sha512-Aou5UdlSpr5whQe8AA/bZG0jMj96CoJIWbGfZ91qieWu5AWUMKw8VR/pAkQkJYvBNhmCcWnZlyyk5oze8JIqYA=="], @@ -286,10 +295,14 @@ "@msgpack/msgpack": ["@msgpack/msgpack@3.1.3", "", {}, "sha512-47XIizs9XZXvuJgoaJUIE2lFoID8ugvc0jzSHP+Ptfk8nTbnR8g788wv48N03Kx0UkAv559HWRQ3yzOgzlRNUA=="], + "@napi-rs/lzma-linux-x64-gnu": ["@napi-rs/lzma-linux-x64-gnu@1.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ=="], + "@noble/ciphers": ["@noble/ciphers@1.3.0", "", {}, "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw=="], "@noble/curves": ["@noble/curves@1.9.7", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw=="], + "@noble/ed25519": ["@noble/ed25519@3.2.0", "", {}, "sha512-criDgRlnUA09hchYrTy/JUWPIEap5rZxQe6wDWzRx51oWWpDRcUpuNzlgPxDJaOK6AsW9c0wKcj3rKRv6t+bPQ=="], + "@noble/hashes": ["@noble/hashes@1.8.0", "", {}, "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A=="], "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], @@ -334,45 +347,59 @@ "@reown/appkit-wallet": ["@reown/appkit-wallet@1.8.17-wc-circular-dependencies-fix.0", "", { "dependencies": { "@reown/appkit-common": "1.8.17-wc-circular-dependencies-fix.0", "@reown/appkit-polyfills": "1.8.17-wc-circular-dependencies-fix.0", "@walletconnect/logger": "3.0.2", "zod": "3.22.4" } }, "sha512-s0RTVNtgPtXGs+eZELVvTu1FRLuN15MyhVS//3/4XafVQkBBJarciXk9pFP71xeSHRzjYR1lXHnVw28687cUvQ=="], - "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.46.2", "", { "os": "android", "cpu": "arm" }, "sha512-Zj3Hl6sN34xJtMv7Anwb5Gu01yujyE/cLBDB2gnHTAHaWS1Z38L7kuSG+oAh0giZMqG060f/YBStXtMH6FvPMA=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.67.4", "", { "os": "android", "cpu": "arm" }, "sha512-/v/pUAPOcwp+r1Hjjdg0cBV1TE89CzGKrKh2FgkIQw2QBcIMmVPOCSfuOZStCn4Xh/98HXfo/ht6ztcssctPNg=="], + + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.67.4", "", { "os": "android", "cpu": "arm64" }, "sha512-6tmmB/P52Vt167FXXEw5auiEUgTtZz7aqUgWHqYXToIUE0HFDY6fTdAyeekjjsNk6O/8dtpSKtClxSj1mMneKQ=="], - "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.46.2", "", { "os": "android", "cpu": "arm64" }, "sha512-nTeCWY83kN64oQ5MGz3CgtPx8NSOhC5lWtsjTs+8JAJNLcP3QbLCtDDgUKQc/Ro/frpMq4SHUaHN6AMltcEoLQ=="], + "@rollup/rollup-android-x64": ["@rollup/rollup-android-x64@4.67.4", "", { "os": "android", "cpu": "x64" }, "sha512-8Z9Q4RmotVmuL4llOvqX814JNiOK1oqoBv+glG5KbpRfUiypqzz2/fxIzK4Pq129l4dT5a8Gszmpc0/XPYoFuQ=="], - "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.46.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-HV7bW2Fb/F5KPdM/9bApunQh68YVDU8sO8BvcW9OngQVN3HHHkw99wFupuUJfGR9pYLLAjcAOA6iO+evsbBaPQ=="], + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.67.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-pnq6hssxTtwuRAl6Kdi/+IDY+b1IhkUetjhUkdLAAJCssjfqtL2Oqy/FXJVJFtAWOu1oRlArIvf0Yk1O92x2HQ=="], - "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.46.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-SSj8TlYV5nJixSsm/y3QXfhspSiLYP11zpfwp6G/YDXctf3Xkdnk4woJIF5VQe0of2OjzTt8EsxnJDCdHd2xMA=="], + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.67.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-BeIrGZvHMVdJg/N+ohZfFywG/gF41684YhDj2wBvouj7m9ziP1tZDUNwzXRiDY+3WIKngaC4hiUBqVtBPGP5og=="], - "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.46.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ZyrsG4TIT9xnOlLsSSi9w/X29tCbK1yegE49RYm3tu3wF1L/B6LVMqnEWyDB26d9Ecx9zrmXCiPmIabVuLmNSg=="], + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.67.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-fRFX/oqNg/g780DKoS8RIfYcZD59Ru5O/bSeK1N7gQljBFrTxJY/q5EX4eMs5SrJf32VgVBVVYCdfPpzAwPPnQ=="], - "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.46.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-pCgHFoOECwVCJ5GFq8+gR8SBKnMO+xe5UEqbemxBpCKYQddRQMgomv1104RnLSg7nNvgKy05sLsY51+OVRyiVw=="], + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.67.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-bSrBRopG1q+0RuOsW0NtYTtIODlvNA3T3ebx5WnQVdSxWIoXFmj+rZdHUHdSLgFdZ5M6VGmekYE7r4RMGQXjfg=="], - "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.46.2", "", { "os": "linux", "cpu": "arm" }, "sha512-EtP8aquZ0xQg0ETFcxUbU71MZlHaw9MChwrQzatiE8U/bvi5uv/oChExXC4mWhjiqK7azGJBqU0tt5H123SzVA=="], + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.67.4", "", { "os": "linux", "cpu": "arm" }, "sha512-L8IvdrJVtl65g1ozwDSyjGPG+FmibhCdFUwmqTItJLw0S3+Oj4QzFs7rfgTUiK7rsPjkCLdG1/GApFxoynXFJQ=="], - "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.46.2", "", { "os": "linux", "cpu": "arm" }, "sha512-qO7F7U3u1nfxYRPM8HqFtLd+raev2K137dsV08q/LRKRLEc7RsiDWihUnrINdsWQxPR9jqZ8DIIZ1zJJAm5PjQ=="], + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.67.4", "", { "os": "linux", "cpu": "arm" }, "sha512-h7PcoQOzC31jshNpQ48J0akB9tsghjkSjSl5AZ6XsVGTxVsln7t7C4SQyw62tNVSaz2SeHgk4VT2ELbL17BSHQ=="], - "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.46.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-3dRaqLfcOXYsfvw5xMrxAk9Lb1f395gkoBYzSFcc/scgRFptRXL9DOaDpMiehf9CO8ZDRJW2z45b6fpU5nwjng=="], + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.67.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-KSPuOBNHoOl7AsVjeY1KZci8+0up0U4TFAHU5IzBYN8P+Z6cB9DZq28+JQycZW7f6WLLa/tSzhV7Rdy95bVi+g=="], - "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.46.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-fhHFTutA7SM+IrR6lIfiHskxmpmPTJUXpWIsBXpeEwNgZzZZSg/q4i6FU4J8qOGyJ0TR+wXBwx/L7Ho9z0+uDg=="], + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.67.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-0E/mKmVk1PlQeQYygIwQm0jlwjANTzGSiNBMPrFx+rdFGFj/2Axh4p6XwcrystQIqXZVudTaGsdbDpzYgJ4wSA=="], + + "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.67.4", "", { "os": "linux", "cpu": "none" }, "sha512-Fvw7dOSc2Sa9UOipRZVI0zOgdLCzsjVyD/6JuHXzUHTXFu7mMgmeX/0/bCVBIut1dz+nWz3pV4WpS/Qg0XVnxw=="], + + "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.67.4", "", { "os": "linux", "cpu": "none" }, "sha512-jzxbVHaE7V3F+P0wEK7UydQtvv7Twfdtx58jI5/3VRx1jJxyrn+qFwfXmqjVFxPhBl+zjaRs+ZJMFJw7vdHaQA=="], "@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.46.2", "", { "os": "linux", "cpu": "none" }, "sha512-i7wfGFXu8x4+FRqPymzjD+Hyav8l95UIZ773j7J7zRYc3Xsxy2wIn4x+llpunexXe6laaO72iEjeeGyUFmjKeA=="], - "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.46.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-B/l0dFcHVUnqcGZWKcWBSV2PF01YUt0Rvlurci5P+neqY/yMKchGU8ullZvIv5e8Y1C6wOn+U03mrDylP5q9Yw=="], + "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.67.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-fhtrzp9p4GjEJVaigaap9g6X9nP6xgJtKiLLXSDgpE18HXufA5aqfltGn+KAqMtVZReJZfOrXm//y5YSA9BWbA=="], + + "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.67.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-uynaF7IUHwAckV0S+yC1f5esy9gB+aqCBsPH5BOck32TYdCuAn2lVG5tvUcFnEsrviGEmRZxE1NHSOieUPYJEg=="], - "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.46.2", "", { "os": "linux", "cpu": "none" }, "sha512-32k4ENb5ygtkMwPMucAb8MtV8olkPT03oiTxJbgkJa7lJ7dZMr0GCFJlyvy+K8iq7F/iuOr41ZdUHaOiqyR3iQ=="], + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.67.4", "", { "os": "linux", "cpu": "none" }, "sha512-uaqRFdfb8eIa2bVHN/FE3ndCvR0zV2xv0AwjCfxrqSu6l6fp/54VhjfhslKlf2RIik9L1jwlt4E56PeVX6tQtQ=="], - "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.46.2", "", { "os": "linux", "cpu": "none" }, "sha512-t5B2loThlFEauloaQkZg9gxV05BYeITLvLkWOkRXogP4qHXLkWSbSHKM9S6H1schf/0YGP/qNKtiISlxvfmmZw=="], + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.67.4", "", { "os": "linux", "cpu": "none" }, "sha512-JZRow7kmxUDEASnxHuVG5itTm+nTXi9BQUABcVUnUEngC+OPwMrpx1uJ9hIA/v+IcAEBL52ktCSPXk5OJn9Jqg=="], - "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.46.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-YKjekwTEKgbB7n17gmODSmJVUIvj8CX7q5442/CK80L8nqOUbMtf8b01QkG3jOqyr1rotrAnW6B/qiHwfcuWQA=="], + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.67.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-rdrh4e+Lq9fCNKoDPaCqeHXbQCe7yl77Ukl45tlSClwYdZ1gpFGZz1XLJdYtY++FRlfL5aHvb6/0n3GDW/Nxsw=="], - "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.46.2", "", { "os": "linux", "cpu": "x64" }, "sha512-Jj5a9RUoe5ra+MEyERkDKLwTXVu6s3aACP51nkfnK9wJTraCC8IMe3snOfALkrjTYd2G1ViE1hICj0fZ7ALBPA=="], + "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.67.4", "", { "os": "linux", "cpu": "x64" }, "sha512-wL7MS4r0fYcxluF3ne2plofHZiB/LsqNCnyaUlyiKpAJLb6agPSFz7DEFCfkonWAZXMrLwCmC08b2ZEnEdJkog=="], - "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.46.2", "", { "os": "linux", "cpu": "x64" }, "sha512-7kX69DIrBeD7yNp4A5b81izs8BqoZkCIaxQaOpumcJ1S/kmqNFjPhDu1LHeVXv0SexfHQv5cqHsxLOjETuqDuA=="], + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.67.4", "", { "os": "linux", "cpu": "x64" }, "sha512-4H0XHfd2VufGjX7NjUyeue78sD0bRIoKSGjGqO+F5nSvL6jN48NAU7esdmtFEYxZXwObLtt3MJ/kHS0jASMW3g=="], - "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.46.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-wiJWMIpeaak/jsbaq2HMh/rzZxHVW1rU6coyeNNpMwk5isiPjSTx0a4YLSlYDwBH/WBvLz+EtsNqQScZTLJy3g=="], + "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.67.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-osRHQbE55pZpCLetpMsFmhkapyZnAUH73qRKMh+npi3boUom6u6hdaTTPSxlInXxwJHsn9r2uDhdz0V7Yoxx2A=="], - "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.46.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-gBgaUDESVzMgWZhcyjfs9QFK16D8K6QZpwAaVNJxYDLHWayOta4ZMjGm/vsAEy3hvlS2GosVFlBlP9/Wb85DqQ=="], + "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.67.4", "", { "os": "none", "cpu": "arm64" }, "sha512-95+exYEyOwrZePsE0czi4q7X5lxKPa21+lmyAZlwbYENITQ0Unk4HAQAFp/p+KhXBHBx9mUABXRYjOC5A1wY3Q=="], - "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.46.2", "", { "os": "win32", "cpu": "x64" }, "sha512-CvUo2ixeIQGtF6WvuB87XWqPQkoFAFqW+HUo/WzHwuHDvIwZCtjdWXoYCcr06iKGydiqTclC4jU/TNObC/xKZg=="], + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.67.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-FOXOcKhNQpO4Po+Ynan6IbtM67SrXZbgpRJWVYwz53CT5veI7sVzDwVBmWS65N5Imv+wK3SVhIPAl+C5DXXNCg=="], + + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.67.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-cklKh0gJOkAZQcWziQa3hrjxZKN+PCHZ7SPTyGJDAiBVr05ZXlEjGFCG7zFJMaVibxsmzAe1FimN4u/HBns9+Q=="], + + "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.67.4", "", { "os": "win32", "cpu": "x64" }, "sha512-AegwxJPc9bvUp8fQtlsUHkFMOMkGylWU7glyL+YD4vwG+QaYoGXYLSsQoeTD7kvoLZrVlMWNVhTg1dedY5C1VQ=="], + + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.67.4", "", { "os": "win32", "cpu": "x64" }, "sha512-RJZnrwTWj7Iq2ooBwoGbDdC65tDwYawneGcAfFMJqVUrRZMcskka6nTkBpXR/47G7kzn3EW2qupExnaBy11vwg=="], "@safe-global/safe-apps-provider": ["@safe-global/safe-apps-provider@0.18.6", "", { "dependencies": { "@safe-global/safe-apps-sdk": "^9.1.0", "events": "^3.3.0" } }, "sha512-4LhMmjPWlIO8TTDC2AwLk44XKXaK6hfBTWyljDm0HQ6TWlOEijVWNrt2s3OCVMSxlXAcEzYfqyu1daHZooTC2Q=="], @@ -498,6 +525,12 @@ "@standard-schema/spec": ["@standard-schema/spec@1.0.0", "", {}, "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA=="], + "@stellar/freighter-api": ["@stellar/freighter-api@6.0.1", "", { "dependencies": { "buffer": "6.0.3", "semver": "7.7.1" } }, "sha512-eqwakEqSg+zoLuPpSbKyrX0pG8DQFzL/J5GtbfuMCmJI+h+oiC9pQ5C6QLc80xopZQKdGt8dUAFCmDMNdAG95w=="], + + "@stellar/js-xdr": ["@stellar/js-xdr@5.0.0", "", {}, "sha512-HBDNKnxr+ecdaEmbZ0mcKkirOF8tXXEbWSw34P3wT40Tn3g+u+cCH17xAWZymzscq8cojHB8340pR8QNVaD32w=="], + + "@stellar/stellar-sdk": ["@stellar/stellar-sdk@17.4.0", "", { "dependencies": { "@exodus/bytes": "^1.15.1", "@noble/ed25519": "^3.1.0", "@noble/hashes": "^2.2.0", "@stellar/js-xdr": "^5.0.0", "@types/json-schema": "^7.0.15", "axios": "1.20.0", "bignumber.js": "^11.1.4", "commander": "^14.0.3", "eventsource": "^4.1.0", "feaxios": "^0.0.23", "smol-toml": "^1.6.1", "uint8array-extras": "^1.5.0" }, "bin": { "stellar-js": "bin/stellar-js", "stellar-sdk": "bin/stellar-js", "stellar-contract-bindings-typescript": "bin/stellar-contract-bindings-typescript" } }, "sha512-IX6gi62yWQ+6Oz56LsVEEeSViSOWJL3BkttftwVmVsu+62nLTWNVsCmTWEzwgNLT/q5HGP25OnlU+hhy2E4wwA=="], + "@sveltejs/acorn-typescript": ["@sveltejs/acorn-typescript@1.0.5", "", { "peerDependencies": { "acorn": "^8.9.0" } }, "sha512-IwQk4yfwLdibDlrXVE04jTZYlLnwsTT2PIOQQGNLWfjavGifnk1JD1LcZjZaBTRcxZu2FfPfNLOE04DSu9lqtQ=="], "@sveltejs/adapter-cloudflare": ["@sveltejs/adapter-cloudflare@7.1.3", "", { "dependencies": { "@cloudflare/workers-types": "^4.20250507.0", "worktop": "0.8.0-next.18" }, "peerDependencies": { "@sveltejs/kit": "^2.0.0", "wrangler": "^4.0.0" } }, "sha512-QdZygPQtUjc6Jd8t/yWIOJyBGELRsLk7wag18rbGU+tIpUCLpTC4qEuBDNcER8v5EDQdOqC8CJqZ8P+Bi5ybQw=="], @@ -702,7 +735,7 @@ "bigint-buffer": ["bigint-buffer-fixed@1.1.6", "", { "dependencies": { "bindings": "^1.5.0", "nan": "^2.14.2", "node-gyp": "^9.4.1" } }, "sha512-BSlDL9PxCwBn+Q3V/mrEr1sZuKNlS2py34gxNno9uVvbp2bBNSa1zkHsK3eCmh/Gv99p82TS6eLUXafoIm+EyQ=="], - "bignumber.js": ["bignumber.js@9.1.2", "", {}, "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug=="], + "bignumber.js": ["bignumber.js@11.1.5", "", {}, "sha512-6WmzCNtUnfKpbozq+hOgWaZMMzORmYBwF1xZScyoIX3QRYWeKTtxxwDOW5tIz7C9BdjkIYHGTcelCLkXg0mndw=="], "bindings": ["bindings@1.5.0", "", { "dependencies": { "file-uri-to-path": "1.0.0" } }, "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="], @@ -872,6 +905,8 @@ "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="], + "es-module-lexer": ["es-module-lexer@1.7.0", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="], + "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="], "es-set-tostringtag": ["es-set-tostringtag@2.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA=="], @@ -924,6 +959,10 @@ "events": ["events@3.3.0", "", {}, "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q=="], + "eventsource": ["eventsource@4.1.1", "", { "dependencies": { "eventsource-parser": "^3.0.1" } }, "sha512-D6bTRWh6KahHTK/m4WnjPQyEinNPf9eFLEZSEoj7d6fTibspnAVYfzHvirL7u/aoX5d9YYfIkBVAhmigUELk9w=="], + + "eventsource-parser": ["eventsource-parser@3.1.1", "", {}, "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ=="], + "exit-hook": ["exit-hook@2.2.1", "", {}, "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw=="], "exponential-backoff": ["exponential-backoff@3.1.3", "", {}, "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA=="], @@ -952,6 +991,8 @@ "fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" } }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="], + "feaxios": ["feaxios@0.0.23", "", { "dependencies": { "is-retry-allowed": "^3.0.0" } }, "sha512-eghR0A21fvbkcQBgZuMfQhrXxJzC0GNUGC9fXhBge33D+mFDTwl0aJ35zoQQn575BhyjQitRc5N4f+L4cP708g=="], + "file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="], "file-uri-to-path": ["file-uri-to-path@1.0.0", "", {}, "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="], @@ -1082,7 +1123,7 @@ "is-regex": ["is-regex@1.2.1", "", { "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g=="], - "is-retry-allowed": ["is-retry-allowed@2.2.0", "", {}, "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg=="], + "is-retry-allowed": ["is-retry-allowed@3.0.0", "", {}, "sha512-9xH0xvoggby+u0uGF7cZXdrutWiBiaFG8ZT4YFPXL8NzkyAwX3AKGLeFQLvzDpM430+nDFBZ1LHkie/8ocL06A=="], "is-stream": ["is-stream@2.0.1", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="], @@ -1386,7 +1427,9 @@ "rimraf": ["rimraf@3.0.2", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" } }, "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA=="], - "rollup": ["rollup@4.46.2", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.46.2", "@rollup/rollup-android-arm64": "4.46.2", "@rollup/rollup-darwin-arm64": "4.46.2", "@rollup/rollup-darwin-x64": "4.46.2", "@rollup/rollup-freebsd-arm64": "4.46.2", "@rollup/rollup-freebsd-x64": "4.46.2", "@rollup/rollup-linux-arm-gnueabihf": "4.46.2", "@rollup/rollup-linux-arm-musleabihf": "4.46.2", "@rollup/rollup-linux-arm64-gnu": "4.46.2", "@rollup/rollup-linux-arm64-musl": "4.46.2", "@rollup/rollup-linux-loongarch64-gnu": "4.46.2", "@rollup/rollup-linux-ppc64-gnu": "4.46.2", "@rollup/rollup-linux-riscv64-gnu": "4.46.2", "@rollup/rollup-linux-riscv64-musl": "4.46.2", "@rollup/rollup-linux-s390x-gnu": "4.46.2", "@rollup/rollup-linux-x64-gnu": "4.46.2", "@rollup/rollup-linux-x64-musl": "4.46.2", "@rollup/rollup-win32-arm64-msvc": "4.46.2", "@rollup/rollup-win32-ia32-msvc": "4.46.2", "@rollup/rollup-win32-x64-msvc": "4.46.2", "fsevents": "~2.3.2" }, "bin": "dist/bin/rollup" }, "sha512-WMmLFI+Boh6xbop+OAGo9cQ3OgX9MIg7xOQjn+pTCwOkk+FNDAeAemXkJ3HzDJrVXleLOFVa1ipuc1AmEx1Dwg=="], + "rollup": ["rollup@4.67.4", "", { "dependencies": { "@types/estree": "^1.0.10" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.67.4", "@rollup/rollup-android-arm64": "4.67.4", "@rollup/rollup-android-x64": "4.67.4", "@rollup/rollup-darwin-arm64": "4.67.4", "@rollup/rollup-darwin-x64": "4.67.4", "@rollup/rollup-freebsd-arm64": "4.67.4", "@rollup/rollup-freebsd-x64": "4.67.4", "@rollup/rollup-linux-arm-gnueabihf": "4.67.4", "@rollup/rollup-linux-arm-musleabihf": "4.67.4", "@rollup/rollup-linux-arm64-gnu": "4.67.4", "@rollup/rollup-linux-arm64-musl": "4.67.4", "@rollup/rollup-linux-loong64-gnu": "4.67.4", "@rollup/rollup-linux-loong64-musl": "4.67.4", "@rollup/rollup-linux-ppc64-gnu": "4.67.4", "@rollup/rollup-linux-ppc64-musl": "4.67.4", "@rollup/rollup-linux-riscv64-gnu": "4.67.4", "@rollup/rollup-linux-riscv64-musl": "4.67.4", "@rollup/rollup-linux-s390x-gnu": "4.67.4", "@rollup/rollup-linux-x64-gnu": "4.67.4", "@rollup/rollup-linux-x64-musl": "4.67.4", "@rollup/rollup-openbsd-x64": "4.67.4", "@rollup/rollup-openharmony-arm64": "4.67.4", "@rollup/rollup-win32-arm64-msvc": "4.67.4", "@rollup/rollup-win32-ia32-msvc": "4.67.4", "@rollup/rollup-win32-x64-gnu": "4.67.4", "@rollup/rollup-win32-x64-msvc": "4.67.4", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-Lsv3oKcz5jgOQJej/p7nfwbVEdAbDT+z6OPf/SCdI+nF+q2ENp0pTKT35ZwXAmH8g45mfrIiJeEyAqKYSYoL9Q=="], + + "rollup-plugin-esbuild": ["rollup-plugin-esbuild@6.2.1", "", { "dependencies": { "debug": "^4.4.0", "es-module-lexer": "^1.6.0", "get-tsconfig": "^4.10.0", "unplugin-utils": "^0.2.4" }, "peerDependencies": { "esbuild": ">=0.18.0", "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" } }, "sha512-jTNOMGoMRhs0JuueJrJqbW8tOwxumaWYq+V5i+PD+8ecSCVkuX27tGW7BXqDgoULQ55rO7IdNxPcnsWtshz3AA=="], "rpc-websockets": ["rpc-websockets@9.3.5", "", { "dependencies": { "@swc/helpers": "^0.5.11", "@types/uuid": "^10.0.0", "@types/ws": "^8.2.2", "buffer": "^6.0.3", "eventemitter3": "^5.0.1", "uuid": "^11.0.0", "ws": "^8.5.0" }, "optionalDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^6.0.0" } }, "sha512-4mAmr+AEhPYJ9TmDtxF3r3ZcbWy7W8kvZ4PoZYw/Xgp2J7WixjwTgiQZsoTDvch5nimmg3Ay6/0Kuh9oIvVs9A=="], @@ -1430,6 +1473,8 @@ "smart-buffer": ["smart-buffer@4.2.0", "", {}, "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="], + "smol-toml": ["smol-toml@1.9.1", "", {}, "sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ=="], + "socket.io-client": ["socket.io-client@4.8.3", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1", "engine.io-client": "~6.6.1", "socket.io-parser": "~4.2.4" } }, "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g=="], "socket.io-parser": ["socket.io-parser@4.2.5", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1" } }, "sha512-bPMmpy/5WWKHea5Y/jYAP6k74A+hvmRCQaJuJB6I/ML5JZq/KfNieUVo/3Mh7SAqn7TyFdIo6wqYHInG1MU1bQ=="], @@ -1510,6 +1555,8 @@ "ufo": ["ufo@1.6.1", "", {}, "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA=="], + "uint8array-extras": ["uint8array-extras@1.6.0", "", {}, "sha512-8iAasVS4wUx0gPLjH8Xtz2PeDzTSiy8QiLGu2DT3X5GU+egFEQhpnbtkehbAwjvDcxIERmCYcysiODFmE3Ud0Q=="], + "uint8arrays": ["uint8arrays@3.1.1", "", { "dependencies": { "multiformats": "^9.4.2" } }, "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg=="], "uncrypto": ["uncrypto@0.1.3", "", {}, "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q=="], @@ -1524,6 +1571,8 @@ "unique-slug": ["unique-slug@3.0.0", "", { "dependencies": { "imurmurhash": "^0.1.4" } }, "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w=="], + "unplugin-utils": ["unplugin-utils@0.2.5", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-gwXJnPRewT4rT7sBi/IvxKTjsms7jX7QIDLOClApuZwR49SXbrB1z2NLUZ+vDHyqCj/n58OzRRqaW+B8OZi8vg=="], + "unstorage": ["unstorage@1.17.4", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", "h3": "^1.15.5", "lru-cache": "^11.2.0", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/functions": "^2.2.12 || ^3.0.0", "@vercel/kv": "^1 || ^2 || ^3", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/functions", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw=="], "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], @@ -1674,6 +1723,8 @@ "@solana/assertions/@solana/errors": ["@solana/errors@5.5.1", "", { "dependencies": { "chalk": "5.6.2", "commander": "14.0.2" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"], "bin": { "errors": "bin/cli.mjs" } }, "sha512-vFO3p+S7HoyyrcAectnXbdsMfwUzY2zYFUc2DEe5BwpiE9J1IAxPBGjOWO6hL1bbYdBrlmjNx8DXCslqS+Kcmg=="], + "@solana/buffer-layout-utils/bignumber.js": ["bignumber.js@9.1.2", "", {}, "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug=="], + "@solana/codecs/@solana/codecs-core": ["@solana/codecs-core@2.0.0-rc.1", "", { "dependencies": { "@solana/errors": "2.0.0-rc.1" }, "peerDependencies": { "typescript": ">=5" } }, "sha512-bauxqMfSs8EHD0JKESaNmNuNvkvHSuN3bbWAF5RjOfDu2PugxHrvRebmYauvSumZ3cTfQ4HJJX6PG5rN852qyQ=="], "@solana/codecs/@solana/codecs-numbers": ["@solana/codecs-numbers@2.0.0-rc.1", "", { "dependencies": { "@solana/codecs-core": "2.0.0-rc.1", "@solana/errors": "2.0.0-rc.1" }, "peerDependencies": { "typescript": ">=5" } }, "sha512-J5i5mOkvukXn8E3Z7sGIPxsThRCgSdgTWJDQeZvucQ9PT6Y3HiVXJ0pcWiOWAoQ3RX8e/f4I3IC+wE6pZiJzDQ=="], @@ -1798,6 +1849,12 @@ "@solflare-wallet/sdk/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], + "@stellar/freighter-api/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], + + "@stellar/stellar-sdk/@noble/hashes": ["@noble/hashes@2.4.0", "", {}, "sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA=="], + + "@stellar/stellar-sdk/axios": ["axios@1.20.0", "", { "dependencies": { "follow-redirects": "^1.16.0", "form-data": "^4.0.6", "https-proxy-agent": "^5.0.1", "proxy-from-env": "^2.1.0" } }, "sha512-r8aOh8j9cGKpgQAqpzrUHnSIc6a59Y3Xf/cv8sy1DrHCkZHzQGEuoq1tARk6qSyDdtQGSDgpb9kFlruzPvrgwg=="], + "@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="], "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], @@ -1836,6 +1893,8 @@ "anymatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "axios-retry/is-retry-allowed": ["is-retry-allowed@2.2.0", "", {}, "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg=="], + "cacache/chownr": ["chownr@2.0.0", "", {}, "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ=="], "cacache/glob": ["glob@8.1.0", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="], @@ -1938,6 +1997,8 @@ "postcss-load-config/yaml": ["yaml@1.10.2", "", {}, "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="], + "rollup/@types/estree": ["@types/estree@1.0.10", "", {}, "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g=="], + "rpc-websockets/@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], "rpc-websockets/utf-8-validate": ["utf-8-validate@6.0.6", "", { "dependencies": { "node-gyp-build": "^4.3.0" } }, "sha512-q3l3P9UtEEiAHcsgsqTgf9PPjctrDWoIXW3NpOHFdRDbLvu4DLIcxHangJ4RLrWkBcKjmcs/6NkerI8T/rE4LA=="], @@ -1952,6 +2013,8 @@ "tronweb/axios": ["axios@1.18.0", "", { "dependencies": { "follow-redirects": "^1.16.0", "form-data": "^4.0.5", "https-proxy-agent": "^5.0.1", "proxy-from-env": "^2.1.0" } }, "sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw=="], + "tronweb/bignumber.js": ["bignumber.js@9.1.2", "", {}, "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug=="], + "tronweb/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], "unstorage/chokidar": ["chokidar@5.0.0", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="], @@ -1962,6 +2025,8 @@ "viem/ox": ["ox@0.11.3", "", { "dependencies": { "@adraffy/ens-normalize": "^1.11.0", "@noble/ciphers": "^1.3.0", "@noble/curves": "1.9.1", "@noble/hashes": "^1.8.0", "@scure/bip32": "^1.7.0", "@scure/bip39": "^1.6.0", "abitype": "^1.2.3", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" } }, "sha512-1bWYGk/xZel3xro3l8WGg6eq4YEKlaqvyMtVhfMFpbJzK2F6rj4EDRtqDCWVEJMkzcmEi9uW2QxsqELokOlarw=="], + "vite/rollup": ["rollup@4.46.2", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.46.2", "@rollup/rollup-android-arm64": "4.46.2", "@rollup/rollup-darwin-arm64": "4.46.2", "@rollup/rollup-darwin-x64": "4.46.2", "@rollup/rollup-freebsd-arm64": "4.46.2", "@rollup/rollup-freebsd-x64": "4.46.2", "@rollup/rollup-linux-arm-gnueabihf": "4.46.2", "@rollup/rollup-linux-arm-musleabihf": "4.46.2", "@rollup/rollup-linux-arm64-gnu": "4.46.2", "@rollup/rollup-linux-arm64-musl": "4.46.2", "@rollup/rollup-linux-loongarch64-gnu": "4.46.2", "@rollup/rollup-linux-ppc64-gnu": "4.46.2", "@rollup/rollup-linux-riscv64-gnu": "4.46.2", "@rollup/rollup-linux-riscv64-musl": "4.46.2", "@rollup/rollup-linux-s390x-gnu": "4.46.2", "@rollup/rollup-linux-x64-gnu": "4.46.2", "@rollup/rollup-linux-x64-musl": "4.46.2", "@rollup/rollup-win32-arm64-msvc": "4.46.2", "@rollup/rollup-win32-ia32-msvc": "4.46.2", "@rollup/rollup-win32-x64-msvc": "4.46.2", "fsevents": "~2.3.2" }, "bin": "dist/bin/rollup" }, "sha512-WMmLFI+Boh6xbop+OAGo9cQ3OgX9MIg7xOQjn+pTCwOkk+FNDAeAemXkJ3HzDJrVXleLOFVa1ipuc1AmEx1Dwg=="], + "wide-align/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], "wrangler/esbuild": ["esbuild@0.25.4", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.4", "@esbuild/android-arm": "0.25.4", "@esbuild/android-arm64": "0.25.4", "@esbuild/android-x64": "0.25.4", "@esbuild/darwin-arm64": "0.25.4", "@esbuild/darwin-x64": "0.25.4", "@esbuild/freebsd-arm64": "0.25.4", "@esbuild/freebsd-x64": "0.25.4", "@esbuild/linux-arm": "0.25.4", "@esbuild/linux-arm64": "0.25.4", "@esbuild/linux-ia32": "0.25.4", "@esbuild/linux-loong64": "0.25.4", "@esbuild/linux-mips64el": "0.25.4", "@esbuild/linux-ppc64": "0.25.4", "@esbuild/linux-riscv64": "0.25.4", "@esbuild/linux-s390x": "0.25.4", "@esbuild/linux-x64": "0.25.4", "@esbuild/netbsd-arm64": "0.25.4", "@esbuild/netbsd-x64": "0.25.4", "@esbuild/openbsd-arm64": "0.25.4", "@esbuild/openbsd-x64": "0.25.4", "@esbuild/sunos-x64": "0.25.4", "@esbuild/win32-arm64": "0.25.4", "@esbuild/win32-ia32": "0.25.4", "@esbuild/win32-x64": "0.25.4" }, "bin": "bin/esbuild" }, "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q=="], @@ -2204,6 +2269,12 @@ "@solflare-wallet/sdk/bs58/base-x": ["base-x@4.0.1", "", {}, "sha512-uAZ8x6r6S3aUM9rbHGVOIsR15U/ZSc82b3ymnCPsT45Gk1DDvhDPdIgB5MrhirZWt+5K0EEPQH985kNqZgNPFw=="], + "@stellar/stellar-sdk/axios/follow-redirects": ["follow-redirects@1.16.0", "", {}, "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw=="], + + "@stellar/stellar-sdk/axios/form-data": ["form-data@4.0.6", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.4", "mime-types": "^2.1.35" } }, "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ=="], + + "@stellar/stellar-sdk/axios/proxy-from-env": ["proxy-from-env@2.1.0", "", {}, "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA=="], + "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], "@wagmi/core/ox/@noble/curves": ["@noble/curves@1.9.1", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA=="], @@ -2282,6 +2353,44 @@ "unstorage/chokidar/readdirp": ["readdirp@5.0.0", "", {}, "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ=="], + "vite/rollup/@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.46.2", "", { "os": "android", "cpu": "arm" }, "sha512-Zj3Hl6sN34xJtMv7Anwb5Gu01yujyE/cLBDB2gnHTAHaWS1Z38L7kuSG+oAh0giZMqG060f/YBStXtMH6FvPMA=="], + + "vite/rollup/@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.46.2", "", { "os": "android", "cpu": "arm64" }, "sha512-nTeCWY83kN64oQ5MGz3CgtPx8NSOhC5lWtsjTs+8JAJNLcP3QbLCtDDgUKQc/Ro/frpMq4SHUaHN6AMltcEoLQ=="], + + "vite/rollup/@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.46.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-HV7bW2Fb/F5KPdM/9bApunQh68YVDU8sO8BvcW9OngQVN3HHHkw99wFupuUJfGR9pYLLAjcAOA6iO+evsbBaPQ=="], + + "vite/rollup/@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.46.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-SSj8TlYV5nJixSsm/y3QXfhspSiLYP11zpfwp6G/YDXctf3Xkdnk4woJIF5VQe0of2OjzTt8EsxnJDCdHd2xMA=="], + + "vite/rollup/@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.46.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ZyrsG4TIT9xnOlLsSSi9w/X29tCbK1yegE49RYm3tu3wF1L/B6LVMqnEWyDB26d9Ecx9zrmXCiPmIabVuLmNSg=="], + + "vite/rollup/@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.46.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-pCgHFoOECwVCJ5GFq8+gR8SBKnMO+xe5UEqbemxBpCKYQddRQMgomv1104RnLSg7nNvgKy05sLsY51+OVRyiVw=="], + + "vite/rollup/@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.46.2", "", { "os": "linux", "cpu": "arm" }, "sha512-EtP8aquZ0xQg0ETFcxUbU71MZlHaw9MChwrQzatiE8U/bvi5uv/oChExXC4mWhjiqK7azGJBqU0tt5H123SzVA=="], + + "vite/rollup/@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.46.2", "", { "os": "linux", "cpu": "arm" }, "sha512-qO7F7U3u1nfxYRPM8HqFtLd+raev2K137dsV08q/LRKRLEc7RsiDWihUnrINdsWQxPR9jqZ8DIIZ1zJJAm5PjQ=="], + + "vite/rollup/@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.46.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-3dRaqLfcOXYsfvw5xMrxAk9Lb1f395gkoBYzSFcc/scgRFptRXL9DOaDpMiehf9CO8ZDRJW2z45b6fpU5nwjng=="], + + "vite/rollup/@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.46.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-fhHFTutA7SM+IrR6lIfiHskxmpmPTJUXpWIsBXpeEwNgZzZZSg/q4i6FU4J8qOGyJ0TR+wXBwx/L7Ho9z0+uDg=="], + + "vite/rollup/@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.46.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-B/l0dFcHVUnqcGZWKcWBSV2PF01YUt0Rvlurci5P+neqY/yMKchGU8ullZvIv5e8Y1C6wOn+U03mrDylP5q9Yw=="], + + "vite/rollup/@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.46.2", "", { "os": "linux", "cpu": "none" }, "sha512-32k4ENb5ygtkMwPMucAb8MtV8olkPT03oiTxJbgkJa7lJ7dZMr0GCFJlyvy+K8iq7F/iuOr41ZdUHaOiqyR3iQ=="], + + "vite/rollup/@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.46.2", "", { "os": "linux", "cpu": "none" }, "sha512-t5B2loThlFEauloaQkZg9gxV05BYeITLvLkWOkRXogP4qHXLkWSbSHKM9S6H1schf/0YGP/qNKtiISlxvfmmZw=="], + + "vite/rollup/@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.46.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-YKjekwTEKgbB7n17gmODSmJVUIvj8CX7q5442/CK80L8nqOUbMtf8b01QkG3jOqyr1rotrAnW6B/qiHwfcuWQA=="], + + "vite/rollup/@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.46.2", "", { "os": "linux", "cpu": "x64" }, "sha512-Jj5a9RUoe5ra+MEyERkDKLwTXVu6s3aACP51nkfnK9wJTraCC8IMe3snOfALkrjTYd2G1ViE1hICj0fZ7ALBPA=="], + + "vite/rollup/@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.46.2", "", { "os": "linux", "cpu": "x64" }, "sha512-7kX69DIrBeD7yNp4A5b81izs8BqoZkCIaxQaOpumcJ1S/kmqNFjPhDu1LHeVXv0SexfHQv5cqHsxLOjETuqDuA=="], + + "vite/rollup/@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.46.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-wiJWMIpeaak/jsbaq2HMh/rzZxHVW1rU6coyeNNpMwk5isiPjSTx0a4YLSlYDwBH/WBvLz+EtsNqQScZTLJy3g=="], + + "vite/rollup/@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.46.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-gBgaUDESVzMgWZhcyjfs9QFK16D8K6QZpwAaVNJxYDLHWayOta4ZMjGm/vsAEy3hvlS2GosVFlBlP9/Wb85DqQ=="], + + "vite/rollup/@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.46.2", "", { "os": "win32", "cpu": "x64" }, "sha512-CvUo2ixeIQGtF6WvuB87XWqPQkoFAFqW+HUo/WzHwuHDvIwZCtjdWXoYCcr06iKGydiqTclC4jU/TNObC/xKZg=="], + "wide-align/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], "wide-align/string-width/is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="], @@ -2382,6 +2491,8 @@ "@solana/codecs/@solana/codecs-numbers/@solana/errors/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], + "@stellar/stellar-sdk/axios/form-data/hasown": ["hasown@2.0.4", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A=="], + "cacache/glob/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], "cacache/tar/minizlib/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..8370a01 --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,2 @@ +[test] +preload = ["./tests/setup.ts"] diff --git a/package.json b/package.json index 802577b..eaaf11a 100644 --- a/package.json +++ b/package.json @@ -39,22 +39,27 @@ "prettier": "3.4.2", "prettier-plugin-svelte": "3.3.3", "prettier-plugin-tailwindcss": "0.6.11", + "rollup": "^4.61.0", + "rollup-plugin-esbuild": "^6.2.1", "svelte": "^5.0.0", "svelte-check": "^4.0.0", "tailwindcss": "^4.0.0", - "typescript": "^5.0.0", + "typescript": "^5.6.3", "typescript-eslint": "^8.20.0", "vite": "^7.1.1" }, "lint-staged": { "*.{js,ts,svelte,css,md,json,html}": "prettier --write" }, + "trustedDependencies": [ + "@lifi/intent" + ], "dependencies": { "@base-org/account": "^2.5.1", "@coinbase/wallet-sdk": "^4.3.6", "@coral-xyz/anchor": "^0.31", "@electric-sql/pglite": "^0.3.15", - "@lifi/intent": "0.6.0", + "@lifi/intent": "git+https://github.com/lifinance/intent.ts.git#352216efb365c620a1a9dd49cb72116b8faf5b61", "@metamask/sdk": "^0.34.0", "@safe-global/safe-apps-provider": "~0.18.6", "@safe-global/safe-apps-sdk": "^9.1.0", @@ -64,6 +69,8 @@ "@solana/wallet-adapter-phantom": "^0.9.29", "@solana/wallet-adapter-solflare": "^0.6.33", "@solana/web3.js": "^1.98", + "@stellar/freighter-api": "^6.0.1", + "@stellar/stellar-sdk": "^17.2.1", "@sveltejs/adapter-cloudflare": "^7.0.3", "@wagmi/connectors": "^7.2.1", "@wagmi/core": "^3.4.0", diff --git a/src/lib/abi/axelaroracle.ts b/src/lib/abi/axelaroracle.ts new file mode 100644 index 0000000..81ef4fb --- /dev/null +++ b/src/lib/abi/axelaroracle.ts @@ -0,0 +1,87 @@ +// Fragments of lifi-oif AxelarOracle (out/AxelarOracle.sol/AxelarOracle.json). + +/** `current` generation, lifi-oif 7dc19ce (testnet). */ +export const AXELAR_ORACLE_ABI = [ + { + type: "function", + name: "isProven", + inputs: [ + { name: "remoteChainId", type: "uint256", internalType: "uint256" }, + { name: "remoteOracle", type: "bytes32", internalType: "bytes32" }, + { name: "application", type: "bytes32", internalType: "bytes32" }, + { name: "dataHash", type: "bytes32", internalType: "bytes32" } + ], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view" + }, + { + type: "function", + name: "chainIdMap", + inputs: [{ name: "key", type: "uint256" }], + outputs: [{ name: "", type: "uint256" }], + stateMutability: "view" + }, + { + type: "function", + name: "reverseChainIdMap", + inputs: [{ name: "chainId", type: "uint256" }], + outputs: [{ name: "", type: "uint256" }], + stateMutability: "view" + }, + { + type: "function", + name: "submit", + inputs: [ + { name: "destinationChain", type: "string", internalType: "string" }, + { name: "recipientOracle", type: "string", internalType: "string" }, + { name: "source", type: "address", internalType: "address" }, + { name: "payloads", type: "bytes[]", internalType: "bytes[]" }, + { name: "destinationConfig", type: "bytes32", internalType: "bytes32" }, + { name: "deliveryMode", type: "uint8", internalType: "enum AxelarOracle.DeliveryMode" } + ], + outputs: [], + stateMutability: "payable" + } +] as const; + +/** `legacy` generation, lifi-oif e226659 (mainnet). */ +export const LEGACY_AXELAR_ORACLE_ABI = [ + { + type: "function", + name: "route", + inputs: [{ name: "name", type: "string", internalType: "string" }], + outputs: [ + { + name: "r", + type: "tuple", + internalType: "struct AxelarOracle.Route", + components: [ + { name: "chainId", type: "uint256", internalType: "uint256" }, + { name: "kind", type: "uint8", internalType: "enum OracleAddress.Kind" } + ] + } + ], + stateMutability: "view" + }, + { + type: "function", + name: "reverseChainIdMap", + inputs: [{ name: "chainId", type: "uint256" }], + outputs: [{ name: "", type: "bytes32" }], + stateMutability: "view" + }, + { + type: "function", + name: "submit", + inputs: [ + { name: "destinationChain", type: "string", internalType: "string" }, + { name: "recipientOracle", type: "bytes32", internalType: "bytes32" }, + { name: "source", type: "address", internalType: "address" }, + { name: "payloads", type: "bytes[]", internalType: "bytes[]" }, + { name: "destinationConfig", type: "bytes32", internalType: "bytes32" }, + { name: "deliveryMode", type: "uint8", internalType: "enum AxelarOracle.DeliveryMode" } + ], + outputs: [], + stateMutability: "payable" + } +] as const; diff --git a/src/lib/axelarNetworks.ts b/src/lib/axelarNetworks.ts new file mode 100644 index 0000000..48eac66 --- /dev/null +++ b/src/lib/axelarNetworks.ts @@ -0,0 +1,128 @@ +import { StrKey } from "@stellar/stellar-sdk"; +import { STELLAR_MAINNET_CHAIN_ID } from "@lifi/intent"; +import { bytesToHex } from "viem"; +import { arbitrum, base, baseSepolia } from "viem/chains"; + +export const STELLAR_TESTNET_ID = 1201081091099711; + +/** + * Axelar oracle ABI generation. + * - `legacy`: lifi-oif `e226659` / intent-soroban `5b8f3ca`; submit takes the destination name + * and a raw bytes32 recipient that the oracle encodes by route kind. + * - `current`: lifi-oif `7dc19ce` / intent-soroban `dccd29f`; EVM submit takes the destination + * name, Stellar submit the numeric destination id, both a native recipient string. + */ +export type AxelarGeneration = "legacy" | "current"; +export type AxelarEvmDeployment = { + axelarName: string; + oracle: `0x${string}`; + usdc: `0x${string}`; +}; +export type AxelarNetwork = { + mainnet: boolean; + generation: AxelarGeneration; + /** `new IntentApi(productionApi)`: order.li.fi when true, order-dev.li.fi otherwise. */ + productionApi: boolean; + estimatorUrl: string; + /** Stellar contracts are C-strkeys. */ + stellar: { + chainId: number; + axelarName: string; + oracle: string; + inputEscrow: string; + outputSettler: string; + usdc: string; + }; + /** Supported EVM counterparts of the Stellar chain, keyed by chain id. */ + evm: Partial>; +}; + +// Public deployment records, matching order-service `/api/v1/contracts` per network. +export const AXELAR_NETWORKS: { mainnet: AxelarNetwork; testnet: AxelarNetwork } = { + mainnet: { + mainnet: true, + generation: "legacy", + productionApi: true, + estimatorUrl: "https://api.axelarscan.io/gmp/estimateGasFeeForNHops", + stellar: { + chainId: Number(STELLAR_MAINNET_CHAIN_ID), + axelarName: "stellar", + oracle: "CAVJORXN3EOHH5GGHOK66YTPBUFNICWGSAO3UBUG6SS75VSMGWIEQX4V", + inputEscrow: "CA5GTK5U5LYGWIJSAG6LD724NUDFONHVEHYOHOH5KWCKCX5I442QYLUN", + outputSettler: "CBNYANRIUUUTAZJSEA2FEYUHFPUNRRYPUP6URIZIG2PZXTWWYSXLL3SX", + usdc: "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75" + }, + evm: { + [base.id]: { + axelarName: "base", + oracle: "0xb7eA767b54aF5Dd8AD12Df648A399F9075D93FeE", + usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" + }, + [arbitrum.id]: { + axelarName: "arbitrum", + oracle: "0x86dd17B49ebcE5773b44490951BB80692D905BC9", + usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" + } + } + }, + testnet: { + mainnet: false, + generation: "current", + productionApi: false, + estimatorUrl: "https://testnet.api.axelarscan.io/gmp/estimateGasFeeForNHops", + stellar: { + chainId: STELLAR_TESTNET_ID, + axelarName: "stellar-2026-q1-2", + oracle: "CC7DG7L35SLE7MALNEG6QJAKG6GJNCQIIGVBA63HQ26XHEBRKBHO246J", + inputEscrow: "CBA4VPFFOASNKUN4EXC2YLSIWCWUATLDVGVCSZP4ZLDTANGFE6KWXYV5", + outputSettler: "CBH65VCEEAXLR2APAIMZVTWMGCHQ6N2ZIASI7NYQO4MIOPY4BWJR3TV5", + usdc: "CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA" + }, + evm: { + [baseSepolia.id]: { + axelarName: "base-sepolia", + oracle: "0x7bec62dd796b39ac36bbdc8a8470a77cae5c8716", + usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e" + } + } + } +}; +const networks = [AXELAR_NETWORKS.mainnet, AXELAR_NETWORKS.testnet]; + +export function stellarContractHex(address: string) { + return bytesToHex(StrKey.decodeContract(address)); +} + +export type AxelarCorridor = { + network: AxelarNetwork; + evmChainId: number; + evm: AxelarEvmDeployment; +}; +/** The supported Stellar ↔ EVM corridor between `a` and `b`, in either direction. */ +export function findAxelarCorridor( + a: number | bigint, + b: number | bigint +): AxelarCorridor | undefined { + for (const network of networks) { + const stellar = network.stellar.chainId; + const evmChainId = + Number(a) === stellar ? Number(b) : Number(b) === stellar ? Number(a) : undefined; + const evm = evmChainId === undefined ? undefined : network.evm[evmChainId]; + if (evm) return { network, evmChainId: evmChainId!, evm }; + } + return undefined; +} +export function axelarCorridor(a: number | bigint, b: number | bigint): AxelarCorridor { + const corridor = findAxelarCorridor(a, b); + if (!corridor) throw new Error(`Unsupported Axelar corridor: ${a} ↔ ${b}`); + return corridor; +} +/** Raw Stellar settler ids for the SDK's `getStellarDeployment` hook. */ +export function stellarSettlers(chainId: bigint) { + const network = networks.find(({ stellar }) => BigInt(stellar.chainId) === chainId); + if (!network) return undefined; + return { + inputEscrow: stellarContractHex(network.stellar.inputEscrow), + outputSettler: stellarContractHex(network.stellar.outputSettler) + }; +} diff --git a/src/lib/components/GetQuote.svelte b/src/lib/components/GetQuote.svelte index 1de5e62..f205400 100644 --- a/src/lib/components/GetQuote.svelte +++ b/src/lib/components/GetQuote.svelte @@ -1,256 +1,161 @@ -
- {#await quoteRequest} -
- Quote -
- {:then _} - - {#if quoteExpires !== 0} -
- - {:else} -
- - {/if} - {/await} +
+ +

+ {message}{selectedQuote ? ` · ${Math.max(0, Math.ceil((expires - now) / 1000))}s` : ""} +

+ {#if selectedQuote}

+ Reference: {selectedQuote.metadata.quoteReference} +

{/if}
diff --git a/src/lib/components/IntentListDetailRow.svelte b/src/lib/components/IntentListDetailRow.svelte index eb70b21..4cf2d91 100644 --- a/src/lib/components/IntentListDetailRow.svelte +++ b/src/lib/components/IntentListDetailRow.svelte @@ -106,4 +106,9 @@ > {row.validationPassed ? "Validation Pass" : `Invalid: ${row.validationReason}`} + {#if row.unsupportedChains.length > 0} + Unsupported chain {row.unsupportedChains.join(", ")} + {/if}
diff --git a/src/lib/components/ui/FlowStepTracker.svelte b/src/lib/components/ui/FlowStepTracker.svelte index e07ebb7..4e4a4df 100644 --- a/src/lib/components/ui/FlowStepTracker.svelte +++ b/src/lib/components/ui/FlowStepTracker.svelte @@ -9,13 +9,15 @@ scrollStepProgress, selectedOrder, onStepClick, - className = "" + className = "", + browsing = false }: { currentScreenIndex: number; scrollStepProgress: number; selectedOrder: OrderContainer | undefined; onStepClick?: (step: FlowStep) => void; className?: string; + browsing?: boolean; } = $props(); let progressRefreshTick = $state(0); @@ -47,7 +49,7 @@ selectedOrder; selectedOutputFillHashSignature; - if (!store.anyWalletConnected || !selectedOrder) { + if (!selectedOrder) { flowChecks = { allFilled: false, allValidated: false, @@ -74,8 +76,8 @@ }); const progressSteps = $derived.by(() => { - const connected = store.anyWalletConnected; - if (!connected) { + const flowAccessible = browsing || !!store.stellarAccount || store.anyWalletConnected; + if (!flowAccessible) { return [ { id: "connect", diff --git a/src/lib/config.ts b/src/lib/config.ts index e3404ca..083a9a6 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -1,3 +1,15 @@ +import { AXELAR_NETWORKS, stellarContractHex, STELLAR_TESTNET_ID } from "./axelarNetworks"; +export { + AXELAR_NETWORKS, + STELLAR_TESTNET_ID, + axelarCorridor, + findAxelarCorridor, + stellarSettlers, + type AxelarCorridor, + type AxelarGeneration, + type AxelarNetwork +} from "./axelarNetworks"; + import { createPublicClient, createWalletClient, custom, defineChain, fallback, http } from "viem"; import type { HttpTransport } from "viem"; import { @@ -20,11 +32,18 @@ import { tron } from "viem/chains"; import { + COIN_FILLER, + COMPACT, + INPUT_SETTLER_COMPACT_LIFI, + INPUT_SETTLER_ESCROW_LIFI, + MULTICHAIN_INPUT_SETTLER_COMPACT, + MULTICHAIN_INPUT_SETTLER_ESCROW, SOLANA_DEVNET_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID, SOLANA_OUTPUT_SETTLER_PDA, SOLANA_POLYMER_ORACLE_PDA, SOLANA_POLYMER_ORACLE_PROGRAM, + STELLAR_MAINNET_CHAIN_ID, TRON_MAINNET_INPUT_SETTLER, TRON_MAINNET_OUTPUT_SETTLER, TRON_MAINNET_POLYMER_ORACLE, @@ -53,16 +72,16 @@ export const pharos = defineChain({ export const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000" as const; export const BYTES32_ZERO = "0x0000000000000000000000000000000000000000000000000000000000000000" as const; -export const COMPACT = "0x00000000000000171ede64904551eeDF3C6C9788" as const; -export const INPUT_SETTLER_COMPACT_LIFI = "0x0000000000cd5f7fDEc90a03a31F79E5Fbc6A9Cf" as const; -export const INPUT_SETTLER_ESCROW_LIFI = "0x00fC00edbe7C003b006f870068c548940000223e" as const; -export const MULTICHAIN_INPUT_SETTLER_ESCROW = - "0xb912b4c38ab54b94D45Ac001484dEBcbb519Bc2B" as const; -export const MULTICHAIN_INPUT_SETTLER_COMPACT = - "0x1fccC0807F25A58eB531a0B5b4bf3dCE88808Ed7" as const; +export { + COIN_FILLER, + COMPACT, + INPUT_SETTLER_COMPACT_LIFI, + INPUT_SETTLER_ESCROW_LIFI, + MULTICHAIN_INPUT_SETTLER_COMPACT, + MULTICHAIN_INPUT_SETTLER_ESCROW +}; export const ALWAYS_OK_ALLOCATOR = "281773970620737143753120258" as const; export const POLYMER_ALLOCATOR = "116450367070547927622991121" as const; // 0x02ecC89C25A5DCB1206053530c58E002a737BD11 signing by 0x934244C8cd6BeBDBd0696A659D77C9BDfE86Efe6 -export const COIN_FILLER = "0x75220B7600c300005038432a0000f308e0000068" as const; export { TRON_MAINNET_INPUT_SETTLER, TRON_MAINNET_OUTPUT_SETTLER }; export const WORMHOLE_ORACLE: Partial> = { [ethereum.id]: "0x0000000000000000000000000000000000000000", @@ -127,6 +146,48 @@ export const POLYMER_ORACLE: Partial> = { [arcTestnet.id]: "0xe15b438C6267B0011aDa1e40fD8757Aa8Fe1E5a0" }; +// Stellar mainnet (intent-soroban). Not a viem chain: Stellar code paths must +// branch on isStellarChain before touching chainMap/clients/getClient. +export const STELLAR_CHAIN_ID = Number(STELLAR_MAINNET_CHAIN_ID); +export const STELLAR_RPC_URL = "https://mainnet.sorobanrpc.com"; +export const STELLAR_NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015"; + +export function isStellarChain(chainId: number | bigint | string) { + return [STELLAR_CHAIN_ID, STELLAR_TESTNET_ID].includes(normalizeChainId(chainId)); +} + +// Axelar GMP oracles and chain names, derived from AXELAR_NETWORKS. EVM entries are +// addresses; Stellar entries are raw 32-byte contract ids. +export const AXELAR_ORACLE: Partial> = {}; +export const AXELAR_CHAIN_NAMES: Partial> = {}; +for (const { stellar, evm } of Object.values(AXELAR_NETWORKS)) { + AXELAR_ORACLE[stellar.chainId] = stellarContractHex(stellar.oracle); + AXELAR_CHAIN_NAMES[stellar.chainId] = stellar.axelarName; + for (const [chainId, deployment] of Object.entries(evm)) { + AXELAR_ORACLE[Number(chainId)] = deployment!.oracle; + AXELAR_CHAIN_NAMES[Number(chainId)] = deployment!.axelarName; + } +} + +export type StellarNetworkMeta = { id: number; name: string; rpc: string; passphrase: string }; +export function stellarNetwork(chainId: number | bigint): StellarNetworkMeta { + if (Number(chainId) === STELLAR_CHAIN_ID) + return { + id: STELLAR_CHAIN_ID, + name: "Mainnet", + rpc: STELLAR_RPC_URL, + passphrase: STELLAR_NETWORK_PASSPHRASE + }; + if (Number(chainId) === STELLAR_TESTNET_ID) + return { + id: STELLAR_TESTNET_ID, + name: "Testnet", + rpc: "https://soroban-testnet.stellar.org", + passphrase: "Test SDF Network ; September 2015" + }; + throw new Error(`Unknown Stellar network ${chainId}`); +} + export type availableAllocators = typeof ALWAYS_OK_ALLOCATOR | typeof POLYMER_ALLOCATOR; export type availableInputSettlers = | typeof INPUT_SETTLER_COMPACT_LIFI @@ -182,12 +243,16 @@ export const chainList = (mainnet: boolean) => { ] as ChainName[]; }; -export const chainIdList = (mainnet: boolean) => { - const evm = chainList(mainnet).map((name) => chainMap[name].id); - // Solana is not in `chainMap` (see the ChainMeta note below), so it is - // appended here. Both clusters run the same deployment, verified on chain: - // see the "Verified on chain" table in tests/fixtures/solana/PREFLIGHT.md. - return [...evm, Number(mainnet ? SOLANA_MAINNET_CHAIN_ID : SOLANA_DEVNET_CHAIN_ID)]; +export const chainIdList = (mainnet: boolean): number[] => { + const evm: number[] = chainList(mainnet).map((name) => chainMap[name].id); + // Solana and Stellar are not in `chainMap` (see the ChainMeta note below), so + // they are appended here. Both Solana clusters run the same deployment, verified + // on chain: see the "Verified on chain" table in tests/fixtures/solana/PREFLIGHT.md. + return [ + ...evm, + Number(mainnet ? SOLANA_MAINNET_CHAIN_ID : SOLANA_DEVNET_CHAIN_ID), + mainnet ? STELLAR_CHAIN_ID : STELLAR_TESTNET_ID + ]; }; const chainEntries = chains.map((name) => [chainMap[name].id, chainMap[name]] as const); @@ -201,6 +266,12 @@ export type Token = { chainId: number; decimals: number; }; +export const STELLAR_TESTNET_TOKEN: Token = { + address: stellarContractHex(AXELAR_NETWORKS.testnet.stellar.usdc), + name: "usdc", + chainId: STELLAR_TESTNET_ID, + decimals: 7 +}; export const coinList = (mainnet: boolean) => { if (mainnet == true) @@ -397,10 +468,23 @@ export const coinList = (mainnet: boolean) => { name: "wsol", chainId: Number(SOLANA_MAINNET_CHAIN_ID), decimals: 9 + }, + { + address: `0x25b4fcd859aec2fa6348438c489b3c3c10c98b6d21be4fd3cb30cb68953ef977`, + name: "xlm", + chainId: STELLAR_CHAIN_ID, + decimals: 7 + }, + { + address: `0xadefce59aee52968f76061d494c2525b75659fa4296a65f499ef29e56477e496`, + name: "usdc", + chainId: STELLAR_CHAIN_ID, + decimals: 7 } ] as const; else return [ + STELLAR_TESTNET_TOKEN, { address: `0x5fd84259d66Cd46123540766Be93DFE6D43130D7`, name: "usdc", @@ -553,7 +637,7 @@ export const polymerChainIds = { tron: tron.id } as const; -export type Verifier = "wormhole" | "polymer"; +export type Verifier = "wormhole" | "polymer" | "axelar"; export function getCoin( args: @@ -567,16 +651,24 @@ export function getCoin( const { name = undefined, address = undefined } = args; const chainId = normalizeChainId(args.chainId); // EVM and Tron token ids are uint256-widened 20-byte addresses, so the low - // 20 bytes are the address. Solana mints are genuinely 32 bytes — truncating - // one would match the wrong token (or nothing) — so compare them whole. - const concatedAddress = isSolanaChain(chainId) - ? address - : "0x" + address?.replace("0x", "")?.slice(address.length - 42, address.length); + // 20 bytes are the address. Solana mints and Stellar contract ids are genuinely + // 32 bytes — truncating one would match the wrong token (or nothing) — so + // compare them whole. + const comparedAddress = + isSolanaChain(chainId) || isStellarChain(chainId) + ? address + : "0x" + address?.replace("0x", "")?.slice(address.length - 42, address.length); + if ( + chainId === STELLAR_TESTNET_ID && + (name?.toLowerCase() === "usdc" || + comparedAddress?.toLowerCase() === STELLAR_TESTNET_TOKEN.address.toLowerCase()) + ) + return STELLAR_TESTNET_TOKEN; for (const token of coinList(!isChainIdTestnet(chainId))) { // check chain first. if (token.chainId === chainId) { if (name === undefined) { - if (concatedAddress?.toLowerCase() === token.address.toLowerCase()) return token; + if (comparedAddress?.toLowerCase() === token.address.toLowerCase()) return token; } if (name?.toLowerCase() === token.name.toLowerCase()) return token; } @@ -598,6 +690,8 @@ function normalizeChainId(chainId: number | bigint | string) { export function isChainIdTestnet(chainId: number | bigint | string) { const normalized = normalizeChainId(chainId); + if (normalized === STELLAR_CHAIN_ID) return false; + if (normalized === STELLAR_TESTNET_ID) return true; const meta = chainMetaById[normalized]; if (!meta) throw new Error(`Chain is not known: ${normalized}`); return meta.testnet; @@ -605,6 +699,8 @@ export function isChainIdTestnet(chainId: number | bigint | string) { export function getChainName(chainId: number | bigint | string) { const normalized = normalizeChainId(chainId); + if (normalized === STELLAR_CHAIN_ID) return "stellar"; + if (normalized === STELLAR_TESTNET_ID) return "stellarTestnet"; const meta = chainMetaById[normalized]; if (!meta) throw new Error(`Chain is not known: ${normalized}`); return meta.name; @@ -624,6 +720,7 @@ export function getOracle(verifier: Verifier, chainId: number | bigint | string) const normalized = normalizeChainId(chainId); if (verifier === "polymer") return POLYMER_ORACLE[normalized]; if (verifier === "wormhole") return WORMHOLE_ORACLE[normalized]; + if (verifier === "axelar") return AXELAR_ORACLE[normalized]; return undefined; } diff --git a/src/lib/libraries/apiQuote.ts b/src/lib/libraries/apiQuote.ts new file mode 100644 index 0000000..0c7e6dd --- /dev/null +++ b/src/lib/libraries/apiQuote.ts @@ -0,0 +1,347 @@ +import { + IntentApi, + addressToBytes32, + stellarStrkeyToBytes32, + bytes32ToStellarContract, + encodeStellarOrder, + type StandardOrder, + type MandateOutput, + type GetQuoteOptions +} from "@lifi/intent"; +import { xdr, scValToNative } from "@stellar/stellar-sdk"; +import { bytesToHex, decodeFunctionData } from "viem"; +import { SETTLER_ESCROW_ABI } from "$lib/abi/escrow"; +import { AXELAR_ORACLE, axelarCorridor, isStellarChain, type AxelarCorridor } from "$lib/config"; +import { stellarContractHex } from "$lib/axelarNetworks"; +import { namespaceForChain } from "$lib/utils/chainType"; +import type { AppTokenContext } from "$lib/appTypes"; + +export type SelectedApiQuote = Awaited>["quotes"][number]; +export type ApiQuoteSelection = { + quote: SelectedApiQuote | undefined; + generation: number; +}; +export type ApiQuoteContext = { + inputs: AppTokenContext[]; + outputs: AppTokenContext[]; + user: string; + recipient: string; + exclusiveFor?: `0x${string}`[]; + integratorKey?: string; + mainnet?: boolean; + verifier?: string; + lockType?: "escrow" | "compact"; +}; +export const BASE_INPUT_ESCROW = "0x00fc00edbe7c003b006f870068c548940000223e" as const; +export const BASE_OUTPUT_SETTLER = "0x75220b7600c300005038432a0000f308e0000068" as const; +export function apiQuoteRequest(context: ApiQuoteContext): GetQuoteOptions { + const { inputs, outputs, user, recipient, exclusiveFor, integratorKey } = context; + if (!user || !recipient) + throw new Error("Connect the origin wallet and choose a destination recipient"); + const stellar = [...inputs, ...outputs].some(({ token }) => isStellarChain(token.chainId)); + let corridor: AxelarCorridor | undefined; + if (stellar) { + if ( + (context.verifier !== undefined && context.verifier !== "axelar") || + (context.lockType !== undefined && context.lockType !== "escrow") + ) + throw new Error("Stellar API quotes require Axelar escrow"); + if (inputs.length !== 1 || outputs.length !== 1) + throw new Error("Stellar corridor requires one USDC input and output"); + corridor = axelarCorridor(inputs[0].token.chainId, outputs[0].token.chainId); + const { network } = corridor; + if (context.mainnet !== undefined && context.mainnet !== network.mainnet) + throw new Error( + `Switch to ${network.mainnet ? "Mainnet" : "Testnet"} before requesting or executing this corridor` + ); + for (const { token } of [...inputs, ...outputs]) { + const expected = isStellarChain(token.chainId) + ? stellarContractHex(network.stellar.usdc) + : corridor.evm.usdc; + if ( + token.address.toLowerCase() !== expected.toLowerCase() || + token.decimals !== (isStellarChain(token.chainId) ? 7 : 6) + ) + throw new Error("Only the configured USDC assets are supported"); + } + } + const namespace = (id: number) => + isStellarChain(id) ? ("stellar" as const) : namespaceForChain(id); + return { + user, + userChainId: inputs[0].token.chainId, + userNamespace: namespace(inputs[0].token.chainId), + exclusiveFor, + integratorKey, + inputs: inputs.map(({ token, amount }) => ({ + sender: user, + asset: token.address, + chainId: token.chainId, + namespace: namespace(token.chainId), + amount + })), + outputs: outputs.map(({ token }) => ({ + receiver: recipient, + asset: token.address, + chainId: token.chainId, + namespace: namespace(token.chainId), + amount: 0n + })), + ...(corridor + ? { + oracle: [ + { + chainId: corridor.network.stellar.chainId, + namespace: "stellar" as const, + address: corridor.network.stellar.oracle + }, + { + chainId: corridor.evmChainId, + namespace: "eip155" as const, + address: corridor.evm.oracle.toLowerCase() + } + ] + } + : {}) + }; +} +function wire(value: string): `0x${string}` { + return value.startsWith("C") || value.startsWith("G") + ? stellarStrkeyToBytes32(value) + : addressToBytes32(value as `0x${string}`); +} +function same(a: string, b: string) { + return wire(a).toLowerCase() === wire(b).toLowerCase(); +} + +function fields(value: xdr.ScVal, names: string[]) { + if (value.type !== "scvMap") throw new Error("Invalid Stellar order struct"); + const entries = value.map; + if (!entries || entries.length !== names.length) throw new Error("Invalid Stellar order fields"); + const result: Record = {}; + for (const entry of entries) { + if (entry.key.type !== "scvSymbol") throw new Error("Invalid Stellar order field key"); + const name = entry.key.sym.toString(); + if (!names.includes(name) || result[name]) throw new Error("Invalid Stellar order field"); + result[name] = entry.val; + } + return result; +} +function uint(value: xdr.ScVal) { + if (value.type !== "scvU256" && value.type !== "scvU32") + throw new Error("Invalid Stellar integer"); + const native: unknown = scValToNative(value); + if (typeof native !== "number" && typeof native !== "bigint") + throw new Error("Invalid Stellar integer value"); + return BigInt(native); +} +function bytes(value: xdr.ScVal) { + if (value.type !== "scvBytes") throw new Error("Invalid Stellar byte field"); + return bytesToHex(value.bytes.toBytes()); +} +function contract(value: xdr.ScVal) { + const native: unknown = scValToNative(value); + if (value.type !== "scvAddress" || typeof native !== "string" || !native.startsWith("C")) + throw new Error("Invalid Stellar contract field"); + return stellarStrkeyToBytes32(native); +} +function vector(value: xdr.ScVal) { + if (value.type !== "scvVec" || !value.vec) throw new Error("Invalid Stellar vector"); + return value.vec; +} + +/** Decode for validation/storage only. Execution always sends the untouched API payload. */ +export function decodeApiQuoteOrder(quote: SelectedApiQuote): { + order: StandardOrder; + scval?: xdr.ScVal; +} { + const tx = quote.order.openIntentTx; + if (tx.chain.startsWith("eip155:")) { + const decoded = decodeFunctionData({ abi: SETTLER_ESCROW_ABI, data: tx.data as `0x${string}` }); + if (decoded.functionName !== "open") throw new Error("Quote is not an escrow open call"); + return { order: decoded.args[0] as StandardOrder }; + } + if (!tx.chain.startsWith("stellar:")) + throw new Error("Unsupported API quote execution namespace"); + const scval = xdr.ScVal.fromXDR(tx.data, "base64"); + if (scval.type !== "scvMap") + throw new Error("Quote data must be an order ScVal, not an envelope"); + const value = fields(scval, [ + "expires", + "fill_deadline", + "input_oracle", + "inputs", + "nonce", + "origin_chain", + "outputs", + "user" + ]); + const outputs: MandateOutput[] = vector(value.outputs).map((item) => { + const o = fields(item, [ + "amount", + "callback_data", + "chain_id", + "context", + "oracle", + "recipient", + "settler", + "token" + ]); + return { + oracle: bytes(o.oracle), + settler: bytes(o.settler), + chainId: uint(o.chain_id), + token: bytes(o.token), + amount: uint(o.amount), + recipient: bytes(o.recipient), + callbackData: bytes(o.callback_data), + context: bytes(o.context) + }; + }); + const user: unknown = scValToNative(value.user); + if (value.user.type !== "scvAddress" || typeof user !== "string" || !user.startsWith("G")) + throw new Error("Invalid Stellar user account"); + return { + scval, + order: { + user: stellarStrkeyToBytes32(user), + nonce: BigInt(bytes(value.nonce)), + originChainId: uint(value.origin_chain), + expires: Number(uint(value.expires)), + fillDeadline: Number(uint(value.fill_deadline)), + inputOracle: contract(value.input_oracle), + inputs: vector(value.inputs).map((item) => { + const i = fields(item, ["amount", "token"]); + return [BigInt(contract(i.token)), uint(i.amount)]; + }), + outputs + } + }; +} +export function validateApiQuote( + quote: SelectedApiQuote, + context: ApiQuoteContext, + now = Date.now() +) { + apiQuoteRequest(context); + const input = context.inputs[0]; + const output = context.outputs[0]; + const { stellar } = axelarCorridor(input.token.chainId, output.token.chainId).network; + if ( + quote.order.type !== "oif-user-open-v0" || + !quote.quoteId || + !quote.metadata.quoteReference || + (quote.validUntil !== undefined && + (!Number.isSafeInteger(quote.validUntil) || quote.validUntil * 1000 <= now)) + ) + throw new Error("Quote expired or missing identity/validity"); + if (quote.partialFill) throw new Error("Partial quotes are not supported for this corridor"); + const tx = quote.order.openIntentTx; + const expectedChain = `${isStellarChain(input.token.chainId) ? "stellar" : "eip155"}:${input.token.chainId}`; + const inputSettler = isStellarChain(input.token.chainId) + ? stellar.inputEscrow + : BASE_INPUT_ESCROW; + if (tx.chain !== expectedChain || !same(tx.to, inputSettler)) + throw new Error("Quote origin chain/escrow differs from request"); + if ( + !same(quote.metadata.oracle.input, AXELAR_ORACLE[input.token.chainId]!) || + !same(quote.metadata.oracle.output, AXELAR_ORACLE[output.token.chainId]!) + ) + throw new Error("Quote oracle deployment differs from request"); + for (const [items, expected, actor] of [ + [quote.preview.inputs, input, context.user], + [quote.preview.outputs, output, context.recipient] + ] as const) { + const p = items[0]; + if ( + items.length !== 1 || + p.chain !== + `${isStellarChain(expected.token.chainId) ? "stellar" : "eip155"}:${expected.token.chainId}` || + !same(p.asset, expected.token.address) || + !same(p.user ?? p.receiver ?? "", actor) || + !/^\d+$/.test(p.amount) || + BigInt(p.amount) <= 0n + ) + throw new Error("Quote preview differs from requested account/route/asset"); + } + if (BigInt(quote.preview.inputs[0].amount) !== input.amount) + throw new Error("Quote input amount changed"); + const decoded = decodeApiQuoteOrder(quote); + const order = decoded.order; + const out = order.outputs[0]; + const expectedOutputSettler = isStellarChain(output.token.chainId) + ? stellar.outputSettler + : BASE_OUTPUT_SETTLER; + if ( + !same(order.user, context.user) || + BigInt(order.originChainId) !== BigInt(input.token.chainId) || + order.expires * 1000 <= now || + order.fillDeadline * 1000 <= now || + !same(order.inputOracle, quote.metadata.oracle.input) || + order.inputs.length !== 1 || + BigInt(order.inputs[0][0]) !== BigInt(input.token.address) || + BigInt(order.inputs[0][1]) !== input.amount || + order.outputs.length !== 1 || + BigInt(out.chainId) !== BigInt(output.token.chainId) || + !same(out.settler, expectedOutputSettler) || + !same(out.oracle, quote.metadata.oracle.output) || + !same(out.token, output.token.address) || + !same(out.recipient, context.recipient) || + BigInt(out.amount) !== BigInt(quote.preview.outputs[0].amount) || + out.callbackData !== "0x" + ) + throw new Error("Executable order differs from requested account/route/asset/settlers"); + if ( + !/^0x[0-9a-fA-F]{1,64}$/.test(quote.metadata.quoteReference) || + BigInt(order.nonce) !== BigInt(quote.metadata.quoteReference) + ) + throw new Error("Quote reference does not match the executable nonce"); + if (decoded.scval && bytesToHex(encodeStellarOrder(order)) !== bytesToHex(decoded.scval.toXDR())) + throw new Error("Stellar order ScVal is not canonical"); + const exclusive = quote.metadata.exclusiveFor; + if ( + context.exclusiveFor?.length && + (!exclusive || !context.exclusiveFor.some((value) => same(value, exclusive))) + ) + throw new Error("Quote exclusive claimant differs from request"); + if ( + exclusive && + (!["e0", "e1"].includes(out.context.slice(2, 4)) || + !same(`0x${out.context.slice(4, 68)}`, exclusive)) + ) + throw new Error("Executable exclusive claimant differs from quote metadata"); + if (isStellarChain(output.token.chainId)) { + const expectedKind = context.recipient.startsWith("G") + ? "00" + : context.recipient.startsWith("C") + ? "01" + : undefined; + if (!expectedKind || !out.context.endsWith(expectedKind)) + throw new Error("Stellar recipient kind differs from request"); + } + if (quote.order.checks.allowances.length !== (isStellarChain(input.token.chainId) ? 0 : 1)) + throw new Error("Quote allowance set differs from the USDC escrow request"); + for (const allowance of quote.order.checks.allowances) { + if ( + isStellarChain(input.token.chainId) || + allowance.chain !== expectedChain || + !same(allowance.token, input.token.address) || + !same(allowance.user, context.user) || + !same(allowance.spender, inputSettler) || + !/^\d+$/.test(allowance.required) || + BigInt(allowance.required) !== input.amount + ) + throw new Error("Unexpected quote allowance"); + } + if (tx.value !== undefined && BigInt(tx.value) !== 0n) + throw new Error("USDC escrow quote must not spend native value"); + return { ...decoded, inputSettler: wire(inputSettler) }; +} + +/** Selection may start with a placeholder output; signing must use the selected terms. */ +export function validateApiQuoteExecution(quote: SelectedApiQuote, context: ApiQuoteContext) { + const validated = validateApiQuote(quote, context); + if (context.outputs[0].amount !== BigInt(validated.order.outputs[0].amount)) + throw new Error("Quote output amount changed"); + return validated; +} diff --git a/src/lib/libraries/axelar.ts b/src/lib/libraries/axelar.ts new file mode 100644 index 0000000..79d45b1 --- /dev/null +++ b/src/lib/libraries/axelar.ts @@ -0,0 +1,31 @@ +import axios from "axios"; +import { axelarCorridor, isStellarChain, isChainIdTestnet } from "$lib/config"; + +/** + * Gas to prepay for an Axelar message, in the source chain's base unit: the + * network's Axelarscan estimate via the /axelar/gas proxy. There is no floor; + * an unavailable estimate disables publication. + */ +export async function axelarGasFee( + sourceChainId: number | bigint, + destinationChainId: number | bigint, + payloads: `0x${string}`[], + stellarExecutor?: string +): Promise { + axelarCorridor(sourceChainId, destinationChainId); + const { data } = await axios.post<{ fee: string }>("/axelar/gas", { + sourceChainId: Number(sourceChainId), + destinationChainId: Number(destinationChainId), + payloads, + stellarExecutor + }); + if (!/^\d+$/.test(data.fee) || BigInt(data.fee) <= 0n) + throw new Error("Axelar gas estimate unavailable"); + return BigInt(data.fee); +} + +/** Axelarscan GMP page of a submit transaction; Stellar hashes carry no 0x prefix there. */ +export function axelarscanUrl(txHash: `0x${string}`, sourceChainId: number | bigint) { + const hash = isStellarChain(sourceChainId) ? txHash.replace(/^0x/, "") : txHash; + return `https://${isChainIdTestnet(sourceChainId) ? "testnet." : ""}axelarscan.io/gmp/${hash}`; +} diff --git a/src/lib/libraries/axelarEstimate.ts b/src/lib/libraries/axelarEstimate.ts new file mode 100644 index 0000000..f19ed96 --- /dev/null +++ b/src/lib/libraries/axelarEstimate.ts @@ -0,0 +1,145 @@ +import { Operation, nativeToScVal, StrKey } from "@stellar/stellar-sdk"; +import { addressToBytes32, bytes32ToStellarContract } from "@lifi/intent"; +import { bytesToHex, concatHex, encodeFunctionData, hexToBytes, parseAbi, toHex } from "viem"; +import { + AXELAR_ORACLE, + AXELAR_CHAIN_NAMES, + ADDRESS_ZERO, + axelarCorridor, + stellarSettlers, + isStellarChain +} from "$lib/config"; +import { BASE_OUTPUT_SETTLER } from "./apiQuote"; + +export type AxelarGasRequest = { + sourceChain: string; + destinationChain: string; + gasLimit: string; + gasMultiplier: string; + sourceTokenAddress: string; + sourceContractAddress: string; + destinationContractAddress: string; + executeData: string; +}; +/** Estimate-only IDs; these bytes never enter submit/approval/authentication. */ +export function buildAxelarGasRequest( + source: number, + destination: number, + payloads: `0x${string}`[], + stellarExecutor?: string +): AxelarGasRequest { + axelarCorridor(source, destination); + if ( + !Array.isArray(payloads) || + payloads.length < 1 || + payloads.length > 4 || + payloads.some( + (p) => typeof p !== "string" || !/^0x(?:[0-9a-fA-F]{2})+$/.test(p) || (p.length - 2) / 2 > 684 + ) + ) + throw new Error("Axelar Stellar message exceeds 1–4 × 684-byte payload bounds"); + const application = isStellarChain(source) + ? stellarSettlers(BigInt(source))!.outputSettler + : addressToBytes32(BASE_OUTPUT_SETTLER); + const message = concatHex([ + application, + toHex(payloads.length, { size: 2 }), + ...payloads.flatMap((p) => [toHex((p.length - 2) / 2, { size: 2 }), p]) + ]); + if ((message.length - 2) / 2 > 2778) throw new Error("Axelar message exceeds Stellar bound"); + const sender = isStellarChain(source) + ? bytes32ToStellarContract(AXELAR_ORACLE[source]!) + : AXELAR_ORACLE[source]!.toLowerCase(); + const receiver = isStellarChain(destination) + ? bytes32ToStellarContract(AXELAR_ORACLE[destination]!) + : AXELAR_ORACLE[destination]!.toLowerCase(); + const sourceName = AXELAR_CHAIN_NAMES[source]!; + let executeData: string; + if (isStellarChain(destination)) { + if (!stellarExecutor || !StrKey.isValidEd25519PublicKey(stellarExecutor)) + throw new Error("Choose a Stellar relayer account to estimate receiving execution"); + const op = Operation.invokeContractFunction({ + source: stellarExecutor, + contract: receiver, + function: "execute", + args: [ + nativeToScVal(sourceName, { type: "string" }), + nativeToScVal("f".repeat(64), { type: "string" }), + nativeToScVal(sender, { type: "string" }), + nativeToScVal(hexToBytes(message)) + ] + }); + executeData = bytesToHex(op.toXDR()); + } else { + executeData = encodeFunctionData({ + abi: parseAbi([ + "function execute(bytes32 commandId,string sourceChain,string sourceAddress,bytes payload)" + ]), + functionName: "execute", + args: [`0x${"ff".repeat(32)}`, sourceName, sender, message] + }); + } + return { + sourceChain: sourceName, + destinationChain: AXELAR_CHAIN_NAMES[destination]!, + gasLimit: "500000", + gasMultiplier: "auto", + sourceTokenAddress: ADDRESS_ZERO, + sourceContractAddress: sender, + destinationContractAddress: receiver, + executeData + }; +} +function integer(value: unknown): bigint { + if (typeof value !== "string" || !/^\d+$/.test(value) || BigInt(value) >= 2n ** 256n) + throw new Error("Invalid decimal-string gas amount"); + return BigInt(value); +} +function record(value: unknown): Record { + if (!value || typeof value !== "object" || Array.isArray(value)) + throw new Error("Invalid Axelar response object"); + return value as Record; +} +/** Only the request's own keys are bound; the echo also carries `showDetailedFees`. */ +export function parseAxelarGasResponse(raw: unknown, request: AxelarGasRequest, decimals: 7 | 18) { + const value = record(raw); + if (!Array.isArray(value.details) || value.details.length !== 1) + throw new Error("Invalid Axelar estimate hop count"); + const detail = record(value.details[0]); + const echo = record(detail.apiResponse); + const params = record(echo.params); + const token = record(record(echo.result).source_token); + if ( + echo.method !== "getFees" || + Object.entries(request).some(([key, expected]) => params[key] !== expected) || + detail.gasLimit !== request.gasLimit || + detail.executeData !== request.executeData || + typeof token.contract_address !== "string" || + token.contract_address.toLowerCase() !== ADDRESS_ZERO || + token.decimals !== decimals || + detail.totalFee !== value.totalFee + ) + throw new Error("Axelar estimate request/native asset differs"); + const total = integer(value.totalFee); + if (total <= 0n || integer(value.baseFee) + integer(value.executionFeeWithMultiplier) !== total) + throw new Error("Invalid Axelar estimate total"); + return total; +} +export async function estimateAxelarGas( + request: AxelarGasRequest, + estimatorUrl: string, + decimals: 7 | 18, + fetcher: typeof fetch = fetch +) { + const response = await fetcher(estimatorUrl, { + method: "POST", + redirect: "error", + signal: AbortSignal.timeout(10_000), + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ params: [request], showDetailedFees: true }) + }); + if (!response.ok) throw new Error(`Axelar estimator HTTP ${response.status}`); + const text = await response.text(); + if (text.length > 262144) throw new Error("Axelar gas response too large"); + return parseAxelarGasResponse(JSON.parse(text), request, decimals); +} diff --git a/src/lib/libraries/axelarSubmit.ts b/src/lib/libraries/axelarSubmit.ts new file mode 100644 index 0000000..f8649f8 --- /dev/null +++ b/src/lib/libraries/axelarSubmit.ts @@ -0,0 +1,93 @@ +import { Address, nativeToScVal, xdr } from "@stellar/stellar-sdk"; +import { addressToBytes32, bytes32ToAddress, bytes32ToStellarContract } from "@lifi/intent"; +import { encodeFunctionData, hexToBytes } from "viem"; +import { AXELAR_ORACLE_ABI, LEGACY_AXELAR_ORACLE_ABI } from "$lib/abi/axelaroracle"; +import { + AXELAR_CHAIN_NAMES, + BYTES32_ZERO, + axelarCorridor, + isStellarChain, + type AxelarGeneration +} from "$lib/config"; + +/** Where an Axelar proof goes: the order's input chain and its oracle. */ +export type AxelarSubmitRoute = { + generation: AxelarGeneration; + destinationChainId: bigint; + destinationName: string; + destinationIsStellar: boolean; + /** Raw 32-byte id: Stellar contract id or left-padded EVM address. */ + recipientOracle: `0x${string}`; +}; + +export function axelarSubmitRoute( + sourceChainId: number | bigint, + destinationChainId: number | bigint, + recipientOracle: `0x${string}` +): AxelarSubmitRoute { + const { network } = axelarCorridor(sourceChainId, destinationChainId); + return { + generation: network.generation, + destinationChainId: BigInt(destinationChainId), + destinationName: AXELAR_CHAIN_NAMES[Number(destinationChainId)]!, + destinationIsStellar: isStellarChain(destinationChainId), + recipientOracle: addressToBytes32(recipientOracle) + }; +} + +/** Legacy oracles encode the raw id by route kind; EVM ids need 12 leading zero bytes. */ +function legacyRecipient(route: AxelarSubmitRoute) { + if (!route.destinationIsStellar && BigInt(route.recipientOracle) >> 160n !== 0n) + throw new Error("EVM recipient oracle must be a left-padded 20-byte address"); + return route.recipientOracle; +} +/** Current oracles forward the native recipient string to the gateway unchanged. */ +function currentRecipient(route: AxelarSubmitRoute) { + return route.destinationIsStellar + ? bytes32ToStellarContract(route.recipientOracle) + : bytes32ToAddress(route.recipientOracle); +} + +/** EVM AxelarOracle `submit` calldata: paid Relayed mode, zero destination config. */ +export function evmAxelarSubmitData( + route: AxelarSubmitRoute, + source: `0x${string}`, + payloads: `0x${string}`[] +) { + return route.generation === "legacy" + ? encodeFunctionData({ + abi: LEGACY_AXELAR_ORACLE_ABI, + functionName: "submit", + args: [route.destinationName, legacyRecipient(route), source, payloads, BYTES32_ZERO, 0] + }) + : encodeFunctionData({ + abi: AXELAR_ORACLE_ABI, + functionName: "submit", + args: [route.destinationName, currentRecipient(route), source, payloads, BYTES32_ZERO, 0] + }); +} + +const scBytes = (hex: `0x${string}`) => nativeToScVal(hexToBytes(hex)); + +/** Stellar AxelarOracle `submit` arguments: paid Relayed mode, zero destination config. */ +export function stellarAxelarSubmitArgs( + route: AxelarSubmitRoute, + opts: { source: string; payer: string; payloads: `0x${string}`[]; gasAmount: bigint } +): xdr.ScVal[] { + const destination = + route.generation === "legacy" + ? [nativeToScVal(route.destinationName, { type: "string" }), scBytes(legacyRecipient(route))] + : [ + nativeToScVal(route.destinationChainId, { type: "u256" }), + nativeToScVal(currentRecipient(route), { type: "string" }) + ]; + return [ + ...destination, + new Address(opts.source).toScVal(), + xdr.ScVal.scvVec(opts.payloads.map(scBytes)), + new Address(opts.payer).toScVal(), + nativeToScVal(opts.gasAmount, { type: "i128" }), + scBytes(BYTES32_ZERO), + xdr.ScVal.scvVec([xdr.ScVal.scvSymbol("Relayed")]) + ]; +} diff --git a/src/lib/libraries/coreDeps.ts b/src/lib/libraries/coreDeps.ts index 0ed60d1..05de7ad 100644 --- a/src/lib/libraries/coreDeps.ts +++ b/src/lib/libraries/coreDeps.ts @@ -1,14 +1,20 @@ import { + AXELAR_NETWORKS, + AXELAR_ORACLE, COIN_FILLER, INPUT_SETTLER_COMPACT_LIFI, + isStellarChain, MULTICHAIN_INPUT_SETTLER_COMPACT, POLYMER_ORACLE, SOLANA_OUTPUT_SETTLER, SOLANA_POLYMER_OUTPUT_ORACLE, TRON_MAINNET_OUTPUT_SETTLER, - WORMHOLE_ORACLE + WORMHOLE_ORACLE, + axelarCorridor, + stellarSettlers } from "$lib/config"; import { isSolanaChain, isTronChain } from "$lib/utils/chainType"; +import { outputSettlerForStellar, stellarStrkeyToBytes32, type OrderContainer } from "@lifi/intent"; import type { IntentDeps, OrderContainerValidationDeps } from "@lifi/intent"; import { TRON_LEGACY_OUTPUT_SETTLERS, TRON_LEGACY_POLYMER_ORACLES } from "@lifi/intent"; @@ -16,7 +22,12 @@ function isNonZeroAddress(value: string | undefined): value is `0x${string}` { return !!value && value.toLowerCase() !== "0x0000000000000000000000000000000000000000"; } +function stellarOutputSettler(chainId: number | bigint) { + return outputSettlerForStellar(BigInt(chainId), stellarSettlers); +} + export const intentDeps: IntentDeps = { + getStellarDeployment: stellarSettlers, getOracle(verifier, chainId) { const key = Number(chainId); if (!Number.isFinite(key)) return undefined; @@ -24,26 +35,33 @@ export const intentDeps: IntentDeps = { if (verifier === "wormhole") { return WORMHOLE_ORACLE[key]; } + if (verifier === "axelar") return AXELAR_ORACLE[key]; return undefined; } }; export const orderValidationDeps: OrderContainerValidationDeps = { - inputSettlers: [INPUT_SETTLER_COMPACT_LIFI, MULTICHAIN_INPUT_SETTLER_COMPACT], + inputSettlers: [ + INPUT_SETTLER_COMPACT_LIFI, + MULTICHAIN_INPUT_SETTLER_COMPACT, + stellarStrkeyToBytes32(AXELAR_NETWORKS.testnet.stellar.inputEscrow) + ], allowedInputOracles({ chainId, sameChainFill }) { const key = Number(chainId); if (!Number.isFinite(key)) return undefined; const polymer = POLYMER_ORACLE[key]; const wormhole = WORMHOLE_ORACLE[key]; + const axelar = AXELAR_ORACLE[key]; const allowed: `0x${string}`[] = []; if (polymer) allowed.push(polymer); if (isNonZeroAddress(wormhole)) allowed.push(wormhole); + if (axelar) allowed.push(axelar); // Orders opened before an oracle rotation must stay displayable/provable. allowed.push(...(TRON_LEGACY_POLYMER_ORACLES[chainId.toString()] ?? [])); if (allowed.length === 0) return undefined; // Same-chain fills use the output settler as the input oracle: the // global COIN_FILLER on EVM, the per-chain settler (current or legacy) - // on Tron. + // on Tron, Solana and Stellar. if (sameChainFill) { if (isTronChain(chainId)) { allowed.push( @@ -52,6 +70,8 @@ export const orderValidationDeps: OrderContainerValidationDeps = { ); } else if (isSolanaChain(chainId)) { allowed.push(SOLANA_OUTPUT_SETTLER); + } else if (isStellarChain(chainId)) { + allowed.push(stellarOutputSettler(chainId)); } else { allowed.push(COIN_FILLER); } @@ -63,7 +83,9 @@ export const orderValidationDeps: OrderContainerValidationDeps = { if (!Number.isFinite(outKey)) return undefined; const outPolymer = POLYMER_ORACLE[outKey]; const outWormhole = WORMHOLE_ORACLE[outKey]; - if (!outPolymer && !isNonZeroAddress(outWormhole)) return undefined; + // Axelar (like Wormhole) is keyed by the OUTPUT chain's own oracle. + const outAxelar = AXELAR_ORACLE[outKey]; + if (!outPolymer && !isNonZeroAddress(outWormhole) && !outAxelar) return undefined; if (sameChainFill) { // output.oracle is the output settler; the library no longer accepts // COIN_FILLER implicitly, so the EVM case must return it explicitly. @@ -73,6 +95,7 @@ export const orderValidationDeps: OrderContainerValidationDeps = { ...(TRON_LEGACY_OUTPUT_SETTLERS[outputChainId.toString()] ?? []) ]; } + if (isStellarChain(outputChainId)) return [stellarOutputSettler(outputChainId)]; return isSolanaChain(outputChainId) ? [SOLANA_OUTPUT_SETTLER] : [COIN_FILLER]; } // A Solana OUTPUT is identified to Polymer by the oracle PROGRAM ID, not @@ -84,6 +107,7 @@ export const orderValidationDeps: OrderContainerValidationDeps = { return [SOLANA_POLYMER_OUTPUT_ORACLE]; } const allowed: `0x${string}`[] = []; + if (outAxelar) allowed.push(outAxelar); // A Solana INPUT cannot follow the rule below: its oracle is a 32-byte PDA, // and the EVM output settler reverts HasDirtyBits() on any value with // non-zero upper bytes (OutputSettlerBase.sol:175, emitNotFilled at :322), @@ -127,6 +151,7 @@ export const orderValidationDeps: OrderContainerValidationDeps = { ]; } if (isSolanaChain(chainId)) return [SOLANA_OUTPUT_SETTLER]; + if (isStellarChain(chainId)) return [stellarOutputSettler(chainId)]; return [COIN_FILLER]; }, supportsNativeOutput(chainId) { @@ -137,3 +162,17 @@ export const orderValidationDeps: OrderContainerValidationDeps = { return isTronChain(chainId) || isSolanaChain(chainId); } }; + +/** Axelar orders stay readable; only supported corridors are writable. */ +export function axelarActionBlocker(container: OrderContainer): string | undefined { + const order = container.order; + if (!("originChainId" in order)) return undefined; + if (AXELAR_ORACLE[Number(order.originChainId)]?.toLowerCase() !== order.inputOracle.toLowerCase()) + return undefined; + try { + for (const output of order.outputs) axelarCorridor(order.originChainId, output.chainId); + } catch (error) { + return (error as Error).message; + } + return undefined; +} diff --git a/src/lib/libraries/fillInfo.ts b/src/lib/libraries/fillInfo.ts new file mode 100644 index 0000000..fd0cd6e --- /dev/null +++ b/src/lib/libraries/fillInfo.ts @@ -0,0 +1,123 @@ +import { getClient, isStellarChain } from "$lib/config"; +import { encodePacked, hashStruct, keccak256, parseEventLogs } from "viem"; +import { + addressToBytes32, + compactTypes, + encodeFillDescription, + getOutputHash, + stellarAddressCommitment, + type MandateOutput, + type MultichainOrder, + type StandardOrder +} from "@lifi/intent"; +import { COIN_FILLER_ABI } from "$lib/abi/outputsettler"; +import store from "$lib/state.svelte"; +import { getStellarTransaction, stellarFillRecord, stellarFillEvent } from "./stellar"; + +export async function persistReceipt( + chainId: number | bigint, + txHash: `0x${string}`, + receipt: unknown +) { + try { + await store.saveTransactionReceipt(chainId, txHash, receipt); + } catch (error) { + console.warn("saveTransactionReceipt error", { chainId: Number(chainId), txHash, error }); + } +} + +export async function getReceiptCachedOrRpc(chainId: number | bigint, txHash: `0x${string}`) { + const cached = store.getTransactionReceipt(chainId, txHash); + if (cached && Array.isArray(cached.logs) && cached.logs.length > 0) return cached; + const receipt = await getClient(chainId).getTransactionReceipt({ hash: txHash }); + await persistReceipt(chainId, txHash, receipt); + return receipt; +} + +/** Ledger close time of a Stellar transaction: local cache first, then RPC (~7 day retention). */ +export async function fetchStellarTransaction(chainId: number | bigint, hash: `0x${string}`) { + const cached = store.getStellarTransaction(chainId, hash); + if (cached) return cached; + const tx = await getStellarTransaction(chainId, hash); + if (!tx) throw new Error(`Stellar transaction ${hash} not found (RPC keeps ~7 days)`); + await store.saveStellarTransaction(chainId, hash, tx); + return tx; +} + +/** + * 32-byte identity the connected solver fills and finalises as. A Stellar + * escrow pays the claimant whose address commitment matches the fill; EVM + * escrows pay the low 20 bytes. + */ +export function solverIdentityFor(order: StandardOrder | MultichainOrder): `0x${string}` { + if ("originChainId" in order && isStellarChain(order.originChainId)) { + const source = store.stellarAccounts[Number(order.originChainId)]; + if (!source) throw new Error("Connect a Stellar wallet on the order's origin network first"); + return stellarAddressCommitment(source); + } + if (!store.connectedAccount) throw new Error("Connect an EVM wallet first"); + return addressToBytes32(store.connectedAccount.address); +} + +/** The `OutputFilled` log for `output` in an EVM fill transaction. */ +export async function findOutputFilledLog( + output: MandateOutput, + fillTransactionHash: `0x${string}` +) { + const receipt = await getReceiptCachedOrRpc(output.chainId, fillTransactionHash); + const expectedOutputHash = hashStruct({ + types: compactTypes, + primaryType: "MandateOutput", + data: output + }); + const log = parseEventLogs({ + abi: COIN_FILLER_ABI, + eventName: "OutputFilled", + logs: receipt.logs + }).find( + (log) => + hashStruct({ types: compactTypes, primaryType: "MandateOutput", data: log.args.output }) === + expectedOutputHash + ); + if (!log) throw new Error("Could not find matching log"); + return { receipt, log }; +} + +/** + * Solver, fill timestamp and FillDescription payload of a filled output — the + * values oracles prove and escrows check on finalise. + */ +export async function getFillInfo(args: { + orderId: `0x${string}`; + output: MandateOutput; + fillTransactionHash: `0x${string}`; +}): Promise<{ solver: `0x${string}`; timestamp: number; payload: `0x${string}` }> { + const { orderId, output, fillTransactionHash } = args; + let solver: `0x${string}`; + let timestamp: number; + if (isStellarChain(output.chainId)) { + const tx = await fetchStellarTransaction(output.chainId, fillTransactionHash); + timestamp = tx.createdAt; + // Read the actual fill event, not the connected user's EVM identity. + const event = await stellarFillEvent(output.chainId, fillTransactionHash, orderId, output); + solver = event.solver; + timestamp = event.timestamp; + const record = await stellarFillRecord(output.chainId, orderId, getOutputHash(output)); + const expected = keccak256(encodePacked(["bytes32", "uint32"], [solver, timestamp])); + if (record !== expected) throw new Error("Stellar fill event and on-chain record differ"); + } else { + const { log } = await findOutputFilledLog(output, fillTransactionHash); + if ( + log.args.orderId.toLowerCase() !== orderId.toLowerCase() || + log.address.toLowerCase() !== `0x${output.settler.slice(-40)}`.toLowerCase() + ) + throw new Error("EVM fill order/emitter differs from requested output"); + solver = log.args.solver; + timestamp = Number(log.args.timestamp); + } + return { + solver, + timestamp, + payload: encodeFillDescription({ solver, orderId, timestamp, output }) + }; +} diff --git a/src/lib/libraries/fillStatus.ts b/src/lib/libraries/fillStatus.ts deleted file mode 100644 index c84ffd8..0000000 --- a/src/lib/libraries/fillStatus.ts +++ /dev/null @@ -1,41 +0,0 @@ -// One chain-aware "has this output been filled?" check. -// -// This existed in three shapes before: flowProgress had EVM and Tron branches, -// while FillIntent.svelte called `getClient` unconditionally — which throws for -// Tron and would throw for Solana too. Routing both through here means the two -// cannot drift, which is the whole reason the duplicate was a problem. - -import { getOutputHash } from "@lifi/intent"; -import type { MandateOutput } from "@lifi/intent"; -import { BYTES32_ZERO, getClient } from "$lib/config"; -import { COIN_FILLER_ABI } from "$lib/abi/outputsettler"; -import { bytes32ToAddress } from "@lifi/intent"; -import { isSolanaChain, isTronChain } from "$lib/utils/chainType"; -import { getSolanaReads } from "$lib/solana/client"; -import { readIsOutputFilled as readIsSolanaOutputFilled } from "$lib/solana/reads"; -import { getTronReads } from "$lib/tron/client"; -import { readIsOutputFilled as readIsTronOutputFilled } from "$lib/tron/reads"; - -export async function isOutputFilled( - orderId: `0x${string}`, - output: MandateOutput -): Promise { - const outputHash = getOutputHash(output); - - if (isSolanaChain(output.chainId)) { - const reads = await getSolanaReads(output.chainId); - return readIsSolanaOutputFilled(reads, { orderId, output }); - } - - if (isTronChain(output.chainId)) { - return readIsTronOutputFilled(await getTronReads(), output.settler, orderId, outputHash); - } - - const record = await getClient(output.chainId).readContract({ - address: bytes32ToAddress(output.settler), - abi: COIN_FILLER_ABI, - functionName: "getFillRecord", - args: [orderId, outputHash] - }); - return record !== BYTES32_ZERO; -} diff --git a/src/lib/libraries/flowProgress.ts b/src/lib/libraries/flowProgress.ts index c93d971..412a480 100644 --- a/src/lib/libraries/flowProgress.ts +++ b/src/lib/libraries/flowProgress.ts @@ -5,16 +5,15 @@ import { INPUT_SETTLER_ESCROW_LIFI, MULTICHAIN_INPUT_SETTLER_COMPACT, MULTICHAIN_INPUT_SETTLER_ESCROW, - getClient + getClient, + isStellarChain } from "$lib/config"; import { COIN_FILLER_ABI } from "$lib/abi/outputsettler"; import { POLYMER_ORACLE_ABI } from "$lib/abi/polymeroracle"; import { SETTLER_ESCROW_ABI } from "$lib/abi/escrow"; import { COMPACT_ABI } from "$lib/abi/compact"; import { hashStruct, keccak256 } from "viem"; -import { compactTypes } from "@lifi/intent"; -import { getOutputHash, encodeMandateOutput } from "@lifi/intent"; -import { bytes32ToAddress } from "@lifi/intent"; +import { bytes32ToAddress, compactTypes, encodeMandateOutput, getOutputHash } from "@lifi/intent"; import { containerToIntent } from "$lib/utils/intent"; import { getOrFetchRpc } from "$lib/libraries/rpcCache"; import type { MandateOutput, OrderContainer } from "@lifi/intent"; @@ -30,10 +29,15 @@ import { import { getFillDetails } from "$lib/libraries/fillEvent"; import { getTronReads } from "$lib/tron/client"; import { readIsOutputFilled, readIsProven, readOrderStatus } from "$lib/tron/reads"; +import { getFillInfo } from "./fillInfo"; +import { stellarFillRecord, stellarIsProven, stellarOrderStatus } from "./stellar"; const PROGRESS_TTL_MS = 30_000; const OrderStatus_Claimed = 2; const OrderStatus_Refunded = 3; +// The Soroban escrow's OrderStatus has no `None` variant. +const StellarOrderStatus_Claimed = 1; +const StellarOrderStatus_Refunded = 2; export type FlowCheckState = { allFilled: boolean; @@ -49,7 +53,7 @@ export function getOutputStorageKey(output: MandateOutput) { }); } -async function isOutputFilled(orderId: `0x${string}`, output: MandateOutput) { +export async function isOutputFilled(orderId: `0x${string}`, output: MandateOutput) { const outputKey = getOutputStorageKey(output); const outputHash = getOutputHash(output); if (isSolanaChain(output.chainId)) { @@ -70,8 +74,9 @@ async function isOutputFilled(orderId: `0x${string}`, output: MandateOutput) { return getOrFetchRpc( `progress:filled:${orderId}:${outputKey}`, async () => { - const outputClient = getClient(output.chainId); - const result = await outputClient.readContract({ + if (isStellarChain(output.chainId)) + return (await stellarFillRecord(output.chainId, orderId, outputHash)) !== undefined; + const result = await getClient(output.chainId).readContract({ address: bytes32ToAddress(output.settler), abi: COIN_FILLER_ABI, functionName: "getFillRecord", @@ -83,7 +88,7 @@ async function isOutputFilled(orderId: `0x${string}`, output: MandateOutput) { ); } -async function isOutputValidatedOnChain( +export async function isOutputValidatedOnChain( orderId: `0x${string}`, inputChain: bigint, orderContainer: OrderContainer, @@ -94,16 +99,26 @@ async function isOutputValidatedOnChain( // Solver and timestamp come from the OutputFilled event — the recorded // solver may be an override, not the transaction sender, and the recorded - // timestamp is the exact value hashed into the attested payload. - const { solver, timestamp } = await getFillDetails(orderId, output, fillTransactionHash); + // timestamp is the exact value hashed into the attested payload. Stellar + // fills are resolved from the Soroban fill event and cross-checked against + // the on-chain fill record. + const { solver, timestamp } = isStellarChain(output.chainId) + ? await getFillInfo({ + orderId, + output, + fillTransactionHash: fillTransactionHash as `0x${string}` + }) + : await getFillDetails(orderId, output, fillTransactionHash); - const encodedOutput = encodeMandateOutput({ - solver, - orderId, - timestamp, - output - }); - const outputHash = keccak256(encodedOutput); + const payloadHash = keccak256( + encodeMandateOutput({ + solver, + orderId, + timestamp, + output + }) + ); + const { inputOracle } = orderContainer.order; const provenCacheKey = `progress:proven:${orderId}:${inputChain.toString()}:${outputKey}:${fillTransactionHash}`; if (isSolanaChain(inputChain)) { @@ -122,9 +137,9 @@ async function isOutputValidatedOnChain( return readIsLocallyAttested(reads, { orderId, output, solver }); } return readIsProvenOnSolana(reads, { - inputOracle: orderContainer.order.inputOracle, + inputOracle, output, - payloadHash: outputHash + payloadHash }); }, { ttlMs: PROGRESS_TTL_MS } @@ -136,11 +151,11 @@ async function isOutputValidatedOnChain( async () => readIsProven( await getTronReads(), - orderContainer.order.inputOracle, + inputOracle, output.chainId, output.oracle, output.settler, - outputHash + payloadHash ), { ttlMs: PROGRESS_TTL_MS } ); @@ -149,19 +164,28 @@ async function isOutputValidatedOnChain( return getOrFetchRpc( provenCacheKey, async () => { - const sourceChainClient = getClient(inputChain); - return sourceChainClient.readContract({ - address: orderContainer.order.inputOracle, + if (isStellarChain(inputChain)) + return stellarIsProven( + inputChain, + inputOracle, + output.chainId, + output.oracle, + output.settler, + payloadHash + ); + // isProven is BaseInputOracle's, shared by the Polymer and Axelar oracles. + return getClient(inputChain).readContract({ + address: inputOracle, abi: POLYMER_ORACLE_ABI, functionName: "isProven", - args: [output.chainId, output.oracle, output.settler, outputHash] + args: [output.chainId, output.oracle, output.settler, payloadHash] }); }, { ttlMs: PROGRESS_TTL_MS } ); } -async function isInputChainFinalised(chainId: bigint, container: OrderContainer) { +export async function isInputChainFinalised(chainId: bigint, container: OrderContainer) { const { order, inputSettler } = container; const intent = containerToIntent(container); const orderId = intent.orderId(); @@ -191,6 +215,17 @@ async function isInputChainFinalised(chainId: bigint, container: OrderContainer) ); } + if (isStellarChain(chainId)) { + return getOrFetchRpc( + `progress:finalised:stellar:${chainId}:${orderId}`, + async () => { + const status = await stellarOrderStatus(chainId, orderId); + return status === StellarOrderStatus_Claimed || status === StellarOrderStatus_Refunded; + }, + { ttlMs: PROGRESS_TTL_MS } + ); + } + const inputChainClient = getClient(chainId); if ( diff --git a/src/lib/libraries/intentFactory.ts b/src/lib/libraries/intentFactory.ts index 45363e3..c0d0cc7 100644 --- a/src/lib/libraries/intentFactory.ts +++ b/src/lib/libraries/intentFactory.ts @@ -1,8 +1,17 @@ +import { + validateApiQuoteExecution, + type ApiQuoteContext, + type ApiQuoteSelection, + type SelectedApiQuote +} from "./apiQuote"; +import { openStellarApiOrder, openStellarIntent } from "./stellar"; import { getChain, getClient, INPUT_SETTLER_COMPACT_LIFI, INPUT_SETTLER_ESCROW_LIFI, + axelarCorridor, + isStellarChain, MULTICHAIN_INPUT_SETTLER_ESCROW, TRON_MAINNET_INPUT_SETTLER, type WC @@ -17,7 +26,13 @@ import type { Signature, StandardOrder } from "@lifi/intent"; -import { Intent, IntentApi, StandardSolanaIntent, addressToBytes32 } from "@lifi/intent"; +import { + Intent, + IntentApi, + StandardSolanaIntent, + StandardStellarIntent, + addressToBytes32 +} from "@lifi/intent"; import { getChainType, isSolanaChain, @@ -107,7 +122,7 @@ function toCoreTokenContext(input: AppTokenContext): TokenContext { name: input.token.name, chainId, decimals: input.token.decimals, - chainNamespace: namespaceForChain(chainId) + chainNamespace: isStellarChain(chainId) ? "stellar" : namespaceForChain(chainId) }, amount: input.amount }; @@ -115,6 +130,10 @@ function toCoreTokenContext(input: AppTokenContext): TokenContext { function toCoreCreateIntentOptions(opts: AppCreateIntentOptions): CreateIntentOptions { const account = opts.account(); + if (opts.verifier === "axelar") { + for (const output of opts.outputTokens) + axelarCorridor(opts.inputTokens[0].token.chainId, output.token.chainId); + } if (opts.lock.type === "compact") { return { exclusiveFor: opts.exclusiveFor, @@ -152,6 +171,8 @@ export class IntentFactory { intentApi: IntentApi; walletClient: WC; + apiQuoteContext?: () => ApiQuoteContext; + apiQuoteSelection?: () => ApiQuoteSelection; preHook?: (chainId: number) => Promise; postHook?: () => Promise; @@ -162,6 +183,8 @@ export class IntentFactory { mainnet: boolean; useProductionApi?: boolean | null; walletClient: WC; + apiQuoteContext?: () => ApiQuoteContext; + apiQuoteSelection?: () => ApiQuoteSelection; preHook?: (chainId: number) => Promise; postHook?: () => Promise; ordersPointer?: OrderContainer[]; @@ -170,6 +193,8 @@ export class IntentFactory { this.mainnet = mainnet; this.intentApi = new IntentApi(useProductionApi ?? mainnet); this.walletClient = walletClient; + this.apiQuoteContext = options.apiQuoteContext; + this.apiQuoteSelection = options.apiQuoteSelection; this.preHook = preHook; this.postHook = postHook; @@ -177,16 +202,104 @@ export class IntentFactory { if (ordersPointer) this.orders = ordersPointer; } + async executeApiQuote(quote: SelectedApiQuote) { + const getContext = this.apiQuoteContext; + const getSelection = this.apiQuoteSelection; + if (!getContext || !getSelection) throw new Error("Missing API quote selection context"); + const generation = getSelection().generation; + const validateCurrentQuote = () => { + const current = getSelection(); + if (current.quote !== quote || current.generation !== generation) + throw new Error("API quote selection changed"); + return validateApiQuoteExecution(quote, getContext()); + }; + const context = getContext(); + const chainId = context.inputs[0].token.chainId; + let validated = validateCurrentQuote(); + const tx = quote.order.openIntentTx; + let hash: `0x${string}`; + if (isStellarChain(chainId)) { + const source = store.stellarAccounts[chainId]; + if (source !== context.user || !validated.scval) + throw new Error("Stellar quote account changed"); + const receipt = await openStellarApiOrder(chainId, tx.to, validated.scval, source, () => { + validateCurrentQuote(); + if (store.stellarAccounts[chainId] !== source) + throw new Error("Stellar quote account changed"); + }); + hash = receipt.hash; + await store.saveStellarTransaction(chainId, hash, receipt); + } else { + if (this.preHook) await this.preHook(chainId); + const [address] = await this.walletClient.getAddresses(); + if ( + address?.toLowerCase() !== context.user.toLowerCase() || + (await this.walletClient.getChainId()) !== chainId + ) + throw new Error("Quote wallet account/network changed"); + for (const allowance of quote.order.checks.allowances) { + validated = validateCurrentQuote(); + const client = getClient(chainId); + const token = allowance.token as `0x${string}`; + const spender = allowance.spender as `0x${string}`; + const current = await client.readContract({ + address: token, + abi: ERC20_ABI, + functionName: "allowance", + args: [address, spender] + }); + if (current < BigInt(allowance.required)) { + validateCurrentQuote(); + const approval = await this.walletClient.writeContract({ + chain: getChain(chainId), + account: address, + address: token, + abi: ERC20_ABI, + functionName: "approve", + args: [spender, BigInt(allowance.required)] + }); + await client.waitForTransactionReceipt({ hash: approval }); + } + } + const [currentAddress] = await this.walletClient.getAddresses(); + if ( + currentAddress?.toLowerCase() !== address.toLowerCase() || + (await this.walletClient.getChainId()) !== chainId + ) + throw new Error("Quote wallet account/network changed before signing"); + validated = validateCurrentQuote(); + hash = await this.walletClient.sendTransaction({ + chain: getChain(chainId), + account: address, + to: tx.to as `0x${string}`, + data: tx.data as `0x${string}`, + value: BigInt(tx.value ?? "0") + }); + const receipt = await getClient(chainId).waitForTransactionReceipt({ hash }); + if (receipt.status !== "success") throw new Error("API quote open reverted"); + await store.saveTransactionReceipt(chainId, hash, receipt); + } + await this.saveOrder({ + order: validated.order, + inputSettler: isStellarChain(chainId) ? validated.inputSettler : (tx.to as `0x${string}`), + apiQuote: quote + }); + if (this.postHook) await this.postHook(); + return hash; + } + private async saveOrder(options: { order: StandardOrder | MultichainOrder; inputSettler: `0x${string}`; sponsorSignature?: Signature | NoSignature; allocatorSignature?: Signature | NoSignature; + apiQuote?: SelectedApiQuote; }) { - const { order, inputSettler, sponsorSignature, allocatorSignature } = options; + const { order, inputSettler, sponsorSignature, allocatorSignature, apiQuote } = options; - const orderContainer: OrderContainer = { + const orderContainer: OrderContainer & { apiQuote?: SelectedApiQuote } = { order, + ...(apiQuote ? { apiQuote } : {}), inputSettler, sponsorSignature: sponsorSignature ?? { type: "None", @@ -217,6 +330,8 @@ export class IntentFactory { const intent = intentInstance.order(); if (intent instanceof StandardSolanaIntent) throw new Error("Compact signing is not supported for Solana intents."); + if (intent instanceof StandardStellarIntent) + throw new Error("Stellar inputs only support escrow"); applyExclusivityOverride(intent, opts.exclusiveFor, sameChain, getChainType(inputChain)); const sponsorSignature = await signIntentCompact(intent, account(), this.walletClient); @@ -266,6 +381,8 @@ export class IntentFactory { const intent = intentInstance2.singlechain(); if (intent instanceof StandardSolanaIntent) throw new Error("Compact deposit and register is not supported for Solana intents."); + if (intent instanceof StandardStellarIntent) + throw new Error("Stellar inputs only support escrow"); applyExclusivityOverride( intent, opts.exclusiveFor, @@ -310,6 +427,13 @@ export class IntentFactory { applyIntentTimings(intentInstance3); const sameChain3 = intentInstance3.isSameChain(); const intent = intentInstance3.order(); + if (intent instanceof StandardStellarIntent) { + const open = await openStellarIntent(intent, store.stellarAccount); + if (this.postHook) await this.postHook(); + await this.saveOrder({ order: intent.asOrder(), inputSettler: intent.inputSettler }); + return [open.hash]; + } + applyExclusivityOverride( intent, opts.exclusiveFor, @@ -324,12 +448,6 @@ export class IntentFactory { const transactionHashes = await openEscrowIntent(intent, account(), this.walletClient); console.log({ tsh: transactionHashes }); - // for (const hash of transactionHashes) { - // await clients[inputChain].waitForTransactionReceipt({ - // hash: await hash - // }); - // } - if (this.postHook) await this.postHook(); await this.saveOrder({ @@ -357,6 +475,8 @@ export function escrowApprove( const { preHook, postHook, inputTokens, account } = opts; for (let i = 0; i < inputTokens.length; ++i) { const { token, amount } = inputTokens[i]; + // The Stellar escrow pulls inputs with an authorised transfer; nothing to approve. + if (isStellarChain(token.chainId)) continue; if (preHook) await preHook(token.chainId); // Solana has no approval step at all: `open` debits the user's ATA under diff --git a/src/lib/libraries/intentList.ts b/src/lib/libraries/intentList.ts index d15160c..53cb5e5 100644 --- a/src/lib/libraries/intentList.ts +++ b/src/lib/libraries/intentList.ts @@ -4,10 +4,19 @@ import { getCoin, INPUT_SETTLER_ESCROW_LIFI, INPUT_SETTLER_COMPACT_LIFI, + isStellarChain, MULTICHAIN_INPUT_SETTLER_ESCROW, - MULTICHAIN_INPUT_SETTLER_COMPACT + MULTICHAIN_INPUT_SETTLER_COMPACT, + stellarSettlers } from "../config"; -import { bytes32ToAddress, idToToken } from "@lifi/intent"; +import { + bytes32ToAddress, + bytes32ToStellarAccount, + idToToken, + inputSettlerForStellar, + STELLAR_MAINNET_CHAIN_ID +} from "@lifi/intent"; +import { toHex } from "viem"; import { containerToIntent } from "$lib/utils/intent"; import type { OrderContainerWithMeta } from "$lib/appTypes"; import type { OrderContainer, StandardOrder, MultichainOrder } from "@lifi/intent"; @@ -44,6 +53,8 @@ export type BaseIntentRow = { outputOverflow: number; validationPassed: boolean; validationReason: string; + /** Chain ids the app has no config for; such orders cannot be opened in the flow screens. */ + unsupportedChains: string[]; }; export type TimedIntentRow = BaseIntentRow & { @@ -89,7 +100,10 @@ function shortAddress(value: string, start = 6, end = 4) { } function summarizeInput(chainId: bigint, tokenId: bigint, amount: bigint): string { - const tokenAddress = idToToken(tokenId); + // Orders reloaded from the DB carry bigints as decimal strings. + const tokenAddress = isStellarChain(chainId) + ? toHex(BigInt(tokenId), { size: 32 }) + : idToToken(tokenId); const chainName = safeChainName(chainId); if (!chainName) { return `${amount.toString()} ${shortAddress(tokenAddress)} on chain-${chainId.toString()}`; @@ -142,6 +156,18 @@ function toChainScopeBadge(scope: ChainScope) { return "MultiChain"; } +export function getUnsupportedChains(order: StandardOrder | MultichainOrder): string[] { + const chainIds = + "originChainId" in order + ? [order.originChainId] + : order.inputs.map((chainInput) => chainInput.chainId); + for (const output of order.outputs) chainIds.push(output.chainId); + const unsupported = chainIds + .filter((chainId) => safeChainName(chainId) === undefined) + .map((chainId) => chainId.toString()); + return [...new Set(unsupported)]; +} + function shortHexAddress(value: `0x${string}`) { return `${value.slice(0, 6)}...${value.slice(-4)}`; } @@ -150,9 +176,17 @@ function normalizeAddress(value: string) { return value.toLowerCase(); } -function mapInputScheme(inputSettler: `0x${string}`): string | undefined { +function mapInputScheme(inputSettler: `0x${string}`, chainId?: bigint): string | undefined { const settler = normalizeAddress(inputSettler); + if ( + chainId && + isStellarChain(chainId) && + settler === normalizeAddress(inputSettlerForStellar(chainId, stellarSettlers)) + ) + return "Escrow"; if (settler === normalizeAddress(INPUT_SETTLER_ESCROW_LIFI)) return "Escrow"; + if (settler === normalizeAddress(inputSettlerForStellar(STELLAR_MAINNET_CHAIN_ID))) + return "Escrow"; if (settler === normalizeAddress(INPUT_SETTLER_COMPACT_LIFI)) return "Compact"; if (settler === normalizeAddress(MULTICHAIN_INPUT_SETTLER_ESCROW)) return "MultichainEscrow"; if (settler === normalizeAddress(MULTICHAIN_INPUT_SETTLER_COMPACT)) return "MultichainCompact"; @@ -200,8 +234,14 @@ function getContextDetails(orderContainer: OrderContainer): ContextDetails { const isExclusive = typeByte === "e0" || typeByte === "e1"; if (!isExclusive) return details; - const exclusiveFor = decodeExclusiveFor(firstContext); - if (exclusiveFor) details.exclusiveForAddress = shortHexAddress(exclusiveFor); + const stellarClaimant = "originChainId" in order && isStellarChain(order.originChainId); + const exclusiveFor = stellarClaimant + ? firstContext.length >= 68 + ? (`0x${firstContext.slice(4, 68)}` as `0x${string}`) + : undefined + : decodeExclusiveFor(firstContext); + if (exclusiveFor) + details.exclusiveForAddress = `${stellarClaimant ? "Commitment " : ""}${shortHexAddress(exclusiveFor)}`; // bytes1 + bytes32 + uint32 (big-endian) if (firstContext.length >= 76) { @@ -233,14 +273,23 @@ export function buildBaseIntentRow(orderContainer: OrderContainer): BaseIntentRo orderContainer, orderId, orderIdShort: shortAddress(orderId, 10, 4), - userShort: shortAddress(order.user, 8, 4), + userShort: shortAddress( + "originChainId" in order && isStellarChain(order.originChainId) + ? bytes32ToStellarAccount(order.user) + : order.user, + 8, + 4 + ), fillDeadline: order.fillDeadline, submitTime: withMeta.submitTime ?? withMeta.createdAt, inputCount: inputChipsRaw.length, outputCount: outputChipsRaw.length, chainScope, chainScopeBadge: toChainScopeBadge(chainScope), - inputSchemeBadge: mapInputScheme(orderContainer.inputSettler), + inputSchemeBadge: mapInputScheme( + orderContainer.inputSettler, + "originChainId" in order ? order.originChainId : undefined + ), orderTypeBadge: contextDetails.orderTypeBadge, exclusiveForAddress: contextDetails.exclusiveForAddress, exclusiveUntil: contextDetails.exclusiveUntil, @@ -249,7 +298,8 @@ export function buildBaseIntentRow(orderContainer: OrderContainer): BaseIntentRo outputChips: outputChipsRaw.slice(0, MAX_CHIPS_PER_SIDE), outputOverflow: Math.max(0, outputChipsRaw.length - MAX_CHIPS_PER_SIDE), validationPassed: validation.passed, - validationReason: validation.reason + validationReason: validation.reason, + unsupportedChains: getUnsupportedChains(order) }; } diff --git a/src/lib/libraries/solver.ts b/src/lib/libraries/solver.ts index 3ea35eb..ef46377 100644 --- a/src/lib/libraries/solver.ts +++ b/src/lib/libraries/solver.ts @@ -1,14 +1,35 @@ -import { BYTES32_ZERO, COIN_FILLER, getChain, getClient, getOracle, type WC } from "$lib/config"; -import { encodeFunctionData, hashStruct, hexToBytes, maxUint256, parseEventLogs } from "viem"; +import { + AXELAR_ORACLE, + BYTES32_ZERO, + COIN_FILLER, + axelarCorridor, + getChain, + getClient, + getOracle, + isStellarChain, + type WC +} from "$lib/config"; +import { + encodeFunctionData, + hashStruct, + hexToBytes, + keccak256, + maxUint256, + padHex, + parseEventLogs, + stringToHex +} from "viem"; import type { MandateOutput, OrderContainer } from "@lifi/intent"; import { addressToBytes32, bytes32ToAddress, bytes32ToSolanaBase58, StandardSolanaIntent, + StandardStellarIntent, TRON_LEGACY_POLYMER_ORACLES } from "@lifi/intent"; import axios from "axios"; +import { AXELAR_ORACLE_ABI, LEGACY_AXELAR_ORACLE_ABI } from "$lib/abi/axelaroracle"; import { POLYMER_ORACLE_ABI } from "$lib/abi/polymeroracle"; import { COIN_FILLER_ABI } from "$lib/abi/outputsettler"; import { ERC20_ABI } from "$lib/abi/erc20"; @@ -41,6 +62,10 @@ import { submitReceiveMessage as submitTronReceiveMessage } from "$lib/tron/writes"; import type { TronDeps } from "$lib/tron/types"; +import { axelarGasFee } from "./axelar"; +import { getFillInfo, persistReceipt, solverIdentityFor } from "./fillInfo"; +import { fillStellarOutputs, finaliseStellarIntent, submitStellarAxelar } from "./stellar"; +import { axelarSubmitRoute, evmAxelarSubmitData } from "./axelarSubmit"; async function tronDeps(): Promise { return { reads: await getTronReads(), signer: getTronSigner() }; @@ -166,18 +191,6 @@ export class Solver { return String(error); } - private static async persistReceipt( - chainId: number | bigint, - txHash: `0x${string}`, - receipt: unknown - ) { - try { - await store.saveTransactionReceipt(chainId, txHash, receipt); - } catch (error) { - console.warn("saveTransactionReceipt error", { chainId: Number(chainId), txHash, error }); - } - } - static fill( walletClient: WC, args: { @@ -199,6 +212,27 @@ export class Solver { outputs } = args; const orderId = containerToIntent(args.orderContainer).orderId(); + // A Stellar escrow pays the claimant whose address commitment matches + // the fill, so a Stellar-input order always records that commitment. + const solverBytes32 = + "originChainId" in order && isStellarChain(order.originChainId) + ? solverIdentityFor(order) + : addressToBytes32(solverAddress); + + if (isStellarChain(outputs[0].chainId)) { + if (outputs.some((output) => output.chainId !== outputs[0].chainId)) + throw new Error("Filling outputs on multiple chains with single fill call not supported"); + const fill = await fillStellarOutputs({ + orderId, + outputs, + fillDeadline: order.fillDeadline, + solver: solverBytes32, + source: store.stellarAccounts[Number(outputs[0].chainId)] + }); + await store.saveStellarTransaction(outputs[0].chainId, fill.hash, fill); + if (postHook) await postHook(); + return fill.hash; + } const outputChainId = Number(outputs[0].chainId); @@ -211,7 +245,7 @@ export class Solver { orderId, outputs, fillDeadline: Number(order.fillDeadline), - solverBytes32: addressToBytes32(solverAddress) + solverBytes32 }); if (postHook) await postHook(); return signature; @@ -222,7 +256,7 @@ export class Solver { orderId, outputs, fillDeadline: Number(order.fillDeadline), - solverBytes32: addressToBytes32(solverAddress) + solverBytes32 }); if (postHook) await postHook(); return `0x${txId.replace("0x", "")}` as `0x${string}`; @@ -268,7 +302,7 @@ export class Solver { const approveReceipt = await getClient(outputChain.id).waitForTransactionReceipt({ hash: approveTransaction }); - await Solver.persistReceipt(outputs[0].chainId, approveTransaction, approveReceipt); + await persistReceipt(outputs[0].chainId, approveTransaction, approveReceipt); } } @@ -279,12 +313,12 @@ export class Solver { value, abi: COIN_FILLER_ABI, functionName: "fillOrderOutputs", - args: [orderId, outputs, order.fillDeadline, addressToBytes32(solverAddress)] + args: [orderId, outputs, order.fillDeadline, solverBytes32] }); const fillReceipt = await getClient(outputChain.id).waitForTransactionReceipt({ hash: transactionHash }); - await Solver.persistReceipt(outputs[0].chainId, transactionHash, fillReceipt); + await persistReceipt(outputs[0].chainId, transactionHash, fillReceipt); if (postHook) await postHook(); return transactionHash; }; @@ -332,6 +366,102 @@ export class Solver { const orderId = containerToIntent(args.orderContainer).orderId(); + if ( + order.inputOracle.toLowerCase() === AXELAR_ORACLE[Number(sourceChainId)]?.toLowerCase() + ) { + const { payload } = await getFillInfo({ + orderId, + output, + fillTransactionHash: fillTransactionHash as `0x${string}` + }); + // The proof travels from the output chain to the input chain. + const route = axelarSubmitRoute(output.chainId, sourceChainId, order.inputOracle); + const fee = await axelarGasFee( + output.chainId, + sourceChainId, + [payload], + store.stellarAccounts[ + Number(isStellarChain(sourceChainId) ? sourceChainId : output.chainId) + ] + ); + + if (isStellarChain(output.chainId)) { + const submit = await submitStellarAxelar({ + chainId: output.chainId, + route, + payloads: [payload], + gasAmount: fee, + source: store.stellarAccounts[Number(output.chainId)] + }); + if (postHook) await postHook(); + return { submitTxHash: submit.hash }; + } + + const outputOracle = AXELAR_ORACLE[Number(output.chainId)]; + if (!outputOracle) throw new Error(`No Axelar oracle on chain ${output.chainId}`); + if (preHook) await preHook(Number(output.chainId)); + const client = getClient(output.chainId); + const anchor = await client.getBlock({ blockTag: "safe" }); + const name = route.destinationName; + const destinationChainId = route.destinationChainId; + let aligned: boolean; + if (route.generation === "legacy") { + const [forward, reverse] = await Promise.all([ + client.readContract({ + address: outputOracle, + abi: LEGACY_AXELAR_ORACLE_ABI, + functionName: "route", + args: [name], + blockNumber: anchor.number + }), + client.readContract({ + address: outputOracle, + abi: LEGACY_AXELAR_ORACLE_ABI, + functionName: "reverseChainIdMap", + args: [destinationChainId], + blockNumber: anchor.number + }) + ]); + aligned = + forward.chainId === destinationChainId && reverse === keccak256(stringToHex(name)); + } else { + const key = BigInt(padHex(stringToHex(name), { size: 32, dir: "right" })); + const [forward, reverse] = await Promise.all([ + client.readContract({ + address: outputOracle, + abi: AXELAR_ORACLE_ABI, + functionName: "chainIdMap", + args: [key], + blockNumber: anchor.number + }), + client.readContract({ + address: outputOracle, + abi: AXELAR_ORACLE_ABI, + functionName: "reverseChainIdMap", + args: [destinationChainId], + blockNumber: anchor.number + }) + ]); + aligned = forward === destinationChainId && reverse === key; + } + if (!aligned) throw new Error("Axelar forward/reverse chain map mismatch"); + const submitTxHash = await walletClient.sendTransaction({ + chain: getChain(output.chainId), + account: account(), + to: outputOracle, + data: evmAxelarSubmitData(route, bytes32ToAddress(output.settler), [payload]), + value: fee + }); + const result = await getClient(output.chainId).waitForTransactionReceipt({ + hash: submitTxHash, + timeout: 120_000, + pollingInterval: 2_000 + }); + await persistReceipt(output.chainId, submitTxHash, result); + if (postHook) await postHook(); + return { submitTxHash }; + } + // A Solana OUTPUT is proven by submitting the fill to Polymer, which // reads the `Prove:` log the submit instruction writes. A same-chain // Solana fill needs nothing at all: `fill` already created the @@ -458,7 +588,7 @@ export class Solver { timeout: 120_000, pollingInterval: 2_000 }); - await Solver.persistReceipt(sourceChainId, transactionHash, result); + await persistReceipt(sourceChainId, transactionHash, result); if (postHook) await postHook(); return result; } @@ -634,7 +764,7 @@ export class Solver { timeout: 120_000, pollingInterval: 2_000 }); - await Solver.persistReceipt(sourceChainId, transactionHash, result); + await persistReceipt(sourceChainId, transactionHash, result); if (postHook) await postHook(); return result; })(); @@ -657,6 +787,8 @@ export class Solver { const { preHook, postHook, account } = opts; const { orderContainer, fillTransactionHashes, sourceChainId } = args; const { order, inputSettler } = orderContainer; + if (AXELAR_ORACLE[Number(sourceChainId)]?.toLowerCase() === order.inputOracle.toLowerCase()) + for (const output of order.outputs) axelarCorridor(output.chainId, sourceChainId); const intent = containerToIntent(orderContainer); if (fillTransactionHashes.length !== order.outputs.length) { @@ -678,11 +810,14 @@ export class Solver { // solver is whatever fillerData proposed (which may be an override, not // the filling wallet), and the recorded timestamp is the exact value // hashed on-chain — deriving either from local context breaks finalise. + // Stellar fills are read from the Soroban fill event instead. const orderId = intent.orderId(); const solveParams = await Promise.all( fillTransactionHashes.map(async (fth, i) => { const output = order.outputs[i]; - const { solver, timestamp } = await getFillDetails(orderId, output, fth); + const { solver, timestamp } = isStellarChain(output.chainId) + ? await getFillInfo({ orderId, output, fillTransactionHash: fth as `0x${string}` }) + : await getFillDetails(orderId, output, fth); return { timestamp, solver }; }) ); @@ -690,18 +825,23 @@ export class Solver { // The input settler derives the order owner from solveParams[0].solver // and requires the caller to be that owner. // - // Compared as bytes32 on Solana: a Solana solver identity IS 32 bytes, so - // truncating it to the low 20 (as the EVM comparison does) would never - // match the connected wallet and would reject the rightful solver. + // Compared as bytes32 on Solana and Stellar: a Solana solver identity IS + // 32 bytes and a Stellar claimant is an address commitment, so truncating + // either to the low 20 (as the EVM comparison does) would never match the + // connected wallet and would reject the rightful solver. + const stellarSource = isStellarChain(sourceChainId); const solverBytes32 = solveParams[0].solver; - const connected = account(); - const ownerMatches = isSolanaChain(sourceChainId) - ? solverBytes32.toLowerCase() === connected.toLowerCase() - : bytes32ToAddress(solverBytes32).toLowerCase() === connected.toLowerCase(); + const connected = stellarSource ? solverIdentityFor(order) : account(); + const ownerMatches = + isSolanaChain(sourceChainId) || stellarSource + ? solverBytes32.toLowerCase() === connected.toLowerCase() + : bytes32ToAddress(solverBytes32).toLowerCase() === connected.toLowerCase(); if (!ownerMatches) { const owner = isSolanaChain(sourceChainId) ? bytes32ToSolanaBase58(solverBytes32) - : bytes32ToAddress(solverBytes32); + : stellarSource + ? solverBytes32 + : bytes32ToAddress(solverBytes32); const connectedDisplay = isSolanaChain(sourceChainId) ? bytes32ToSolanaBase58(connected) : connected; @@ -710,6 +850,16 @@ export class Solver { ); } + if (intent instanceof StandardStellarIntent) { + const finalise = await finaliseStellarIntent({ + intent, + solves: solveParams, + source: store.stellarAccounts[Number(sourceChainId)] + }); + if (postHook) await postHook(); + return finalise; + } + if (isSolanaChain(sourceChainId)) { if (!(intent instanceof StandardSolanaIntent)) { throw new Error("A Solana-input order must be a StandardSolanaIntent"); @@ -782,7 +932,7 @@ export class Solver { { cause: error as Error } ); } - await Solver.persistReceipt(sourceChainId, transactionHash, result); + await persistReceipt(sourceChainId, transactionHash, result); if (postHook) await postHook(); return result; }; diff --git a/src/lib/libraries/stellar.ts b/src/lib/libraries/stellar.ts new file mode 100644 index 0000000..32173b7 --- /dev/null +++ b/src/lib/libraries/stellar.ts @@ -0,0 +1,420 @@ +import { + Account, + Address, + Keypair, + Operation, + TransactionBuilder, + nativeToScVal, + rpc, + scValToNative, + xdr +} from "@stellar/stellar-sdk"; +import { + bytes32ToStellarContract, + encodeStellarMandateOutput, + encodeStellarOrder, + encodeStellarSolves, + encodeFillDescription, + inputSettlerForStellar, + outputSettlerForStellar, + type MandateOutput, + type StandardStellarIntent +} from "@lifi/intent"; +import { bytesToHex, hexToBytes } from "viem"; +import { AXELAR_ORACLE, stellarNetwork, stellarSettlers } from "$lib/config"; +import { signStellarTransaction } from "$lib/utils/stellarWallet"; +import { stellarAxelarSubmitArgs, type AxelarSubmitRoute } from "./axelarSubmit"; + +const stellarServer = (chainId: number | bigint) => new rpc.Server(stellarNetwork(chainId).rpc); + +const BASE_FEE = "10000"; +const TX_TIMEOUT_SECONDS = 180; +const POLL_INTERVAL_MS = 2_000; +const POLL_TIMEOUT_MS = 90_000; +// Ledgers (~5 s each) an output-token allowance stays valid for the fill. +const APPROVAL_LEDGERS = 1_000; + +const escrow = (chainId: number | bigint) => + bytes32ToStellarContract(inputSettlerForStellar(BigInt(chainId), stellarSettlers)); +const outputSettler = (chainId: number | bigint) => + bytes32ToStellarContract(outputSettlerForStellar(BigInt(chainId), stellarSettlers)); + +export type StellarTransaction = { + hash: `0x${string}`; + ledger: number; + createdAt: number; +}; + +// -- ScVal helpers ------------------------------------------------------------ // + +const scBytes = (hex: `0x${string}`) => nativeToScVal(hexToBytes(hex)); +const scI128 = (value: bigint) => nativeToScVal(value, { type: "i128" }); +const scAddress = (strkey: string) => new Address(strkey).toScVal(); +/** ScVal produced by the @lifi/intent Soroban encoders. */ +const fromLibXdr = (bytes: Uint8Array) => xdr.ScVal.fromXDR(bytes); + +// -- Plumbing ------------------------------------------------------------------ // + +function contractCall( + chainId: number | bigint, + source: Account, + contractId: string, + method: string, + args: xdr.ScVal[] +) { + return new TransactionBuilder(source, { + fee: BASE_FEE, + networkPassphrase: stellarNetwork(chainId).passphrase + }) + .addOperation( + Operation.invokeContractFunction({ contract: contractId, function: method, args }) + ) + .setTimeout(TX_TIMEOUT_SECONDS) + .build(); +} + +/** Simulates a read-only contract call and returns its return value. */ +async function simulateRead( + chainId: number | bigint, + contractId: string, + method: string, + args: xdr.ScVal[] +) { + const tx = contractCall( + chainId, + new Account(Keypair.random().publicKey(), "0"), + contractId, + method, + args + ); + const result = await stellarServer(chainId).simulateTransaction(tx); + if (!rpc.Api.isSimulationSuccess(result) || !result.result) + throw new Error( + `Stellar simulation failed: ${"error" in result ? result.error : "no return value"}` + ); + return result.result.retval; +} + +/** + * Builds, simulates (footprint + source-account auth), signs with the + * connected wallet and submits a contract call, then waits for inclusion. + */ +async function invokeStellar(opts: { + chainId: number | bigint; + source: string; + contractId: string; + method: string; + args: xdr.ScVal[]; + beforeSign?: () => void; +}): Promise { + const { chainId, source, contractId, method, args } = opts; + const server = stellarServer(chainId); + const tx = contractCall(chainId, await server.getAccount(source), contractId, method, args); + const prepared = await server.prepareTransaction(tx); + const signed = await signStellarTransaction( + prepared.toXDR(), + source, + Number(chainId), + opts.beforeSign + ); + const sent = await server.sendTransaction( + TransactionBuilder.fromXDR(signed, stellarNetwork(chainId).passphrase) + ); + if (sent.status === "ERROR") + throw new Error( + `Stellar transaction rejected: ${sent.errorResult?.toXDR("base64") ?? sent.hash}` + ); + + const deadline = Date.now() + POLL_TIMEOUT_MS; + while (Date.now() < deadline) { + const status = await server.getTransaction(sent.hash); + if (status.status === rpc.Api.GetTransactionStatus.SUCCESS) + return { hash: `0x${sent.hash}`, ledger: status.ledger, createdAt: status.createdAt }; + if (status.status === rpc.Api.GetTransactionStatus.FAILED) + throw new Error(`Stellar transaction failed: ${sent.hash}`); + const { promise, resolve } = Promise.withResolvers(); + setTimeout(resolve, POLL_INTERVAL_MS); + await promise; + } + throw new Error(`Stellar transaction not confirmed after 90 s: ${sent.hash}`); +} + +function requireSource(source: string | undefined): string { + if (!source) throw new Error("Connect a Stellar wallet first"); + return source; +} + +// -- Reads ------------------------------------------------------------------- // + +/** SAC `balance(id)` of a G account, by the token's raw 32-byte contract id. */ +export async function stellarTokenBalance( + chainId: number | bigint, + token: `0x${string}`, + account: string +): Promise { + const balance = await simulateRead(chainId, bytes32ToStellarContract(token), "balance", [ + scAddress(account) + ]); + return BigInt(scValToNative(balance)); +} + +/** Escrow `order_status`: 0 Deposited, 1 Claimed, 2 Refunded, undefined unknown. */ +export async function stellarOrderStatus( + chainId: number | bigint, + orderId: `0x${string}` +): Promise { + const status = scValToNative( + await simulateRead(chainId, escrow(chainId), "order_status", [scBytes(orderId)]) + ); + return status == null ? undefined : Number(status); +} + +/** OutputSettler fill record `keccak256(solver ‖ u32 timestamp)`, if filled. */ +export async function stellarFillRecord( + chainId: number | bigint, + orderId: `0x${string}`, + outputHash: `0x${string}` +): Promise<`0x${string}` | undefined> { + const record = scValToNative( + await simulateRead(chainId, outputSettler(chainId), "get_fill_record", [ + scBytes(orderId), + scBytes(outputHash) + ]) + ); + return record == null ? undefined : bytesToHex(record as Uint8Array); +} + +/** Stellar AxelarOracle `is_proven(chain, oracle, application, hash)`. */ +export async function stellarIsProven( + localChainId: number | bigint, + oracle: `0x${string}`, + chainId: bigint, + remoteOracle: `0x${string}`, + application: `0x${string}`, + dataHash: `0x${string}` +): Promise { + const proven = await simulateRead(localChainId, bytes32ToStellarContract(oracle), "is_proven", [ + nativeToScVal(BigInt(chainId), { type: "u256" }), + scBytes(remoteOracle), + scBytes(application), + scBytes(dataHash) + ]); + return scValToNative(proven) === true; +} + +/** Ledger and close time of an included transaction, or undefined if RPC no longer has it. */ +export async function getStellarTransaction( + chainId: number | bigint, + hash: `0x${string}` +): Promise<{ ledger: number; createdAt: number } | undefined> { + const tx = await stellarServer(chainId).getTransaction(hash.replace(/^0x/, "")); + if (tx.status === rpc.Api.GetTransactionStatus.NOT_FOUND) return undefined; + if (tx.status === rpc.Api.GetTransactionStatus.FAILED) + throw new Error(`Stellar transaction ${hash} failed`); + return { ledger: tx.ledger, createdAt: tx.createdAt }; +} + +/** Resolve an external solver from a successful, exact-output contract event. */ +export async function stellarFillEvent( + chainId: number | bigint, + hash: `0x${string}`, + orderId: `0x${string}`, + output: MandateOutput +) { + const server = stellarServer(chainId); + const tx = await server.getTransaction(hash.replace(/^0x/, "")); + if (tx.status !== rpc.Api.GetTransactionStatus.SUCCESS) + throw new Error("Stellar fill transaction not successful"); + const events = await server.getEvents({ + startLedger: tx.ledger, + endLedger: tx.ledger + 1, + filters: [ + { + type: "contract", + contractIds: [outputSettler(chainId)], + topics: [ + [xdr.ScVal.scvSymbol("output_filled").toXDR("base64"), scBytes(orderId).toXDR("base64")] + ] + } + ] + }); + for (const event of events.events) { + if ( + event.txHash !== hash.replace(/^0x/, "") || + !event.inSuccessfulContractCall || + event.contractId?.contractId() !== outputSettler(chainId) || + event.ledger !== tx.ledger || + event.topic.length !== 2 || + event.topic[0].toXDR("base64") !== xdr.ScVal.scvSymbol("output_filled").toXDR("base64") || + event.topic[1].toXDR("base64") !== scBytes(orderId).toXDR("base64") + ) + continue; + const data: unknown = scValToNative(event.value); + if ( + !data || + typeof data !== "object" || + !("payload" in data) || + !(data.payload instanceof Uint8Array) || + !("oracle" in data) || + !(data.oracle instanceof Uint8Array) || + bytesToHex(data.oracle) !== output.oracle + ) + continue; + const payload = data.payload; + if (payload.length < 72) continue; + const solver = bytesToHex(payload.subarray(4, 36)); + const timestamp = new DataView( + payload.buffer, + payload.byteOffset, + payload.byteLength + ).getUint32(68); + const expected = encodeFillDescription({ solver, orderId, timestamp, output }); + if (bytesToHex(payload) === expected) return { solver, timestamp, payload: expected }; + } + throw new Error("No matching Stellar output_filled event in successful transaction"); +} + +// -- Writes ------------------------------------------------------------------ // + +/** Escrow `open(order)`, authorised by the user as transaction source. */ +export function openStellarIntent(intent: StandardStellarIntent, source: string | undefined) { + return openStellarApiOrder( + intent.asOrder().originChainId, + bytes32ToStellarContract(intent.inputSettler), + fromLibXdr(encodeStellarOrder(intent.asOrder())), + source + ); +} + +/** The API payload is an order ScVal, not a signed transaction envelope. */ +export function openStellarApiOrder( + chainId: number | bigint, + contractId: string, + order: xdr.ScVal, + source: string | undefined, + beforeSign?: () => void +) { + if (contractId !== escrow(chainId)) throw new Error("Unexpected Stellar escrow"); + return invokeStellar({ + chainId, + source: requireSource(source), + contractId, + method: "open", + args: [order], + beforeSign + }); +} + +/** + * Approves the OutputSettler for each output token, then fills the outputs. + * The settler pulls payment with `transfer_from`, so the approvals must land + * first. + */ +export async function fillStellarOutputs(opts: { + orderId: `0x${string}`; + outputs: MandateOutput[]; + fillDeadline: number; + solver: `0x${string}`; + source: string | undefined; +}): Promise { + const { orderId, outputs, fillDeadline, solver } = opts; + const chainId = outputs[0].chainId; + const server = stellarServer(chainId); + const OUTPUT_SETTLER = outputSettler(chainId); + const source = requireSource(opts.source); + const totals: Record<`0x${string}`, bigint> = {}; + for (const output of outputs) { + const token = output.token.toLowerCase() as `0x${string}`; + totals[token] = (totals[token] ?? 0n) + BigInt(output.amount); + } + for (const [token, amount] of Object.entries(totals) as [`0x${string}`, bigint][]) { + const { sequence } = await server.getLatestLedger(); + await invokeStellar({ + chainId, + source, + contractId: bytes32ToStellarContract(token), + method: "approve", + args: [ + scAddress(source), + scAddress(OUTPUT_SETTLER), + scI128(amount), + nativeToScVal(sequence + APPROVAL_LEDGERS, { type: "u32" }) + ] + }); + } + return invokeStellar({ + chainId, + source, + contractId: OUTPUT_SETTLER, + method: "fill_order_outputs", + args: [ + scAddress(source), + scBytes(solver), + scBytes(orderId), + xdr.ScVal.scvVec(outputs.map((output) => fromLibXdr(encodeStellarMandateOutput(output)))), + nativeToScVal(Number(fillDeadline), { type: "u32" }) + ] + }); +} + +/** Escrow `finalise`, paying the inputs to the connected account. */ +export function finaliseStellarIntent(opts: { + intent: StandardStellarIntent; + solves: { solver: `0x${string}`; timestamp: number }[]; + source: string | undefined; +}) { + const source = requireSource(opts.source); + return invokeStellar({ + chainId: opts.intent.asOrder().originChainId, + source, + contractId: escrow(opts.intent.asOrder().originChainId), + method: "finalise", + args: [ + fromLibXdr(encodeStellarOrder(opts.intent.asOrder())), + fromLibXdr(encodeStellarSolves(opts.solves)), + scAddress(source), + scAddress(source) + ] + }); +} + +/** Stellar AxelarOracle `submit`: relays fill payloads proven by the OutputSettler. */ +export async function submitStellarAxelar(opts: { + chainId: number | bigint; + route: AxelarSubmitRoute; + payloads: `0x${string}`[]; + gasAmount: bigint; + source: string | undefined; +}) { + const source = requireSource(opts.source); + const { route } = opts; + if (opts.gasAmount <= 0n) throw new Error("Paid Relayed gas must be positive"); + const oracle = bytes32ToStellarContract(AXELAR_ORACLE[Number(opts.chainId)]!); + const domain = scValToNative( + await simulateRead(opts.chainId, oracle, "route", [ + nativeToScVal(route.destinationName, { type: "string" }) + ]) + ); + const reverse = await simulateRead(opts.chainId, oracle, "chain_name", [ + nativeToScVal(route.destinationChainId, { type: "u256" }) + ]); + // Legacy `route` returns the Chain struct; current returns the chain id. + const forward = route.generation === "legacy" ? domain.chain_id : domain; + if ( + BigInt(forward) !== route.destinationChainId || + scValToNative(reverse) !== route.destinationName + ) + throw new Error("Stellar Axelar forward/reverse chain map mismatch"); + return invokeStellar({ + chainId: opts.chainId, + source, + contractId: oracle, + method: "submit", + args: stellarAxelarSubmitArgs(route, { + source: outputSettler(opts.chainId), + payer: source, + payloads: opts.payloads, + gasAmount: opts.gasAmount + }) + }); +} diff --git a/src/lib/screens/FillIntent.svelte b/src/lib/screens/FillIntent.svelte index 8dcaff4..dbe509f 100644 --- a/src/lib/screens/FillIntent.svelte +++ b/src/lib/screens/FillIntent.svelte @@ -2,6 +2,8 @@ import { formatTokenAmount, getChainName, getCoin } from "$lib/config"; import type { MandateOutput, OrderContainer } from "@lifi/intent"; import { Solver } from "$lib/libraries/solver"; + import { getOutputStorageKey as outputKey, isOutputFilled } from "$lib/libraries/flowProgress"; + import { invalidateRpcPrefix } from "$lib/libraries/rpcCache"; import AwaitButton from "$lib/components/AwaitButton.svelte"; import ScreenFrame from "$lib/components/ui/ScreenFrame.svelte"; import SectionCard from "$lib/components/ui/SectionCard.svelte"; @@ -9,11 +11,8 @@ import TokenAmountChip from "$lib/components/ui/TokenAmountChip.svelte"; import store from "$lib/state.svelte"; import { containerToIntent } from "$lib/utils/intent"; - import { compactTypes } from "@lifi/intent"; - import { hashStruct } from "viem"; import { isTronBase58Address } from "$lib/utils/chainType"; import { isValidTxRef, normalizeTxRef, txRefError, txRefPlaceholder } from "$lib/utils/txRef"; - import { isOutputFilled } from "$lib/libraries/fillStatus"; import { tronBase58ToHex } from "@lifi/intent"; let { @@ -67,6 +66,7 @@ }); const postHookScroll = async () => { await postHook(); + invalidateRpcPrefix("progress:filled:"); refreshValidation += 1; }; @@ -87,20 +87,21 @@ } return arrMap; } - const outputKey = (output: MandateOutput) => - hashStruct({ - data: output, - types: compactTypes, - primaryType: "MandateOutput" - }); + // Explorers for Tron and Stellar show transaction hashes without the 0x + // prefix; normalising before validation accepts both forms. + const normalizedFillTxRef = (value: string | undefined, chainId: bigint) => { + if (!value) return undefined; + const normalized = normalizeTxRef(value, chainId); + return isValidTxRef(normalized, chainId) ? normalized : undefined; + }; const getManualFillTxInputValue = (output: MandateOutput) => { const key = outputKey(output); return manualFillTxInputs[key] ?? store.fillTransactions[key] ?? ""; }; const saveManualFillTransaction = async (output: MandateOutput) => { const key = outputKey(output); - const txHash = getManualFillTxInputValue(output).trim(); - if (!isValidTxRef(txHash, output.chainId)) { + const normalizedHash = normalizedFillTxRef(getManualFillTxInputValue(output), output.chainId); + if (!normalizedHash) { manualFillTxErrors[key] = txRefError(output.chainId); manualFillTxSaved[key] = false; return; @@ -108,7 +109,6 @@ manualFillTxSaving[key] = true; manualFillTxErrors[key] = ""; try { - const normalizedHash = normalizeTxRef(txHash, output.chainId); store.fillTransactions[key] = normalizedHash; await store.saveFillTransaction(key, normalizedHash); manualFillTxSaved[key] = true; @@ -154,11 +154,7 @@ const result = await func(); for (const output of outputs) { - const outputHash = hashStruct({ - data: output, - types: compactTypes, - primaryType: "MandateOutput" - }); + const outputHash = outputKey(output); store.fillTransactions[outputHash] = result; store .saveFillTransaction(outputHash, result) @@ -170,7 +166,7 @@
@@ -250,8 +246,8 @@ {:else} !v) ? "default" : "muted"} - buttonFunction={chainStatuses.every((v) => !v) + variant={chainStatuses.every((filled) => !filled) ? "default" : "muted"} + buttonFunction={chainStatuses.every((filled) => !filled) ? fillWrapper( chainIdAndOutputs[1], Solver.fill( diff --git a/src/lib/screens/Finalise.svelte b/src/lib/screens/Finalise.svelte index 04435d1..6b57ec1 100644 --- a/src/lib/screens/Finalise.svelte +++ b/src/lib/screens/Finalise.svelte @@ -7,31 +7,18 @@ import { Solver } from "$lib/libraries/solver"; import type { OrderContainer } from "@lifi/intent"; - import { - COMPACT, - formatTokenAmount, - getChainName, - getClient, - getCoin, - INPUT_SETTLER_COMPACT_LIFI, - INPUT_SETTLER_ESCROW_LIFI, - MULTICHAIN_INPUT_SETTLER_COMPACT, - MULTICHAIN_INPUT_SETTLER_ESCROW - } from "$lib/config"; - import { COMPACT_ABI } from "$lib/abi/compact"; - import { SETTLER_ESCROW_ABI } from "$lib/abi/escrow"; + import { formatTokenAmount, getChainName, getCoin, isStellarChain } from "$lib/config"; import { idToToken } from "@lifi/intent"; + import { toHex } from "viem"; import store from "$lib/state.svelte"; import { containerToIntent } from "$lib/utils/intent"; - import { hashStruct } from "viem"; - import { compactTypes } from "@lifi/intent"; - import { isSolanaChain, isTronChain } from "$lib/utils/chainType"; import { isValidTxRef } from "$lib/utils/txRef"; - import { getSolanaReads } from "$lib/solana/client"; - import { readIsOrderFinalised } from "$lib/solana/reads"; - import { getTronReads } from "$lib/tron/client"; - import { readOrderStatus } from "$lib/tron/reads"; - import { getOrFetchRpc } from "$lib/libraries/rpcCache"; + import { + getOutputStorageKey as outputKey, + isInputChainFinalised + } from "$lib/libraries/flowProgress"; + import { invalidateRpcPrefix } from "$lib/libraries/rpcCache"; + import { axelarActionBlocker } from "$lib/libraries/coreDeps"; let { orderContainer, @@ -44,6 +31,7 @@ postHook?: () => Promise; account: () => `0x${string}`; } = $props(); + const actionBlocker = $derived(axelarActionBlocker(orderContainer)); let refreshClaimed = $state(0); let claimedByChain = $state>({}); @@ -52,9 +40,12 @@ const getInputsForChain = (container: OrderContainer, inputChain: bigint): [bigint, bigint][] => { const { order } = container; if ("originChainId" in order) { - return order.originChainId === inputChain ? order.inputs : []; + return BigInt(order.originChainId) === BigInt(inputChain) ? order.inputs : []; } - return order.inputs.find((chainInput) => chainInput.chainId === inputChain)?.inputs ?? []; + return ( + order.inputs.find((chainInput) => BigInt(chainInput.chainId) === BigInt(inputChain)) + ?.inputs ?? [] + ); }; const allFinalised = $derived( inputChains.length > 0 && @@ -70,16 +61,10 @@ const postHookRefreshValidate = async () => { if (postHook) await postHook(); + invalidateRpcPrefix("progress:finalised:"); refreshClaimed += 1; }; - const outputKey = (output: (typeof orderContainer.order.outputs)[number]) => - hashStruct({ - data: output, - types: compactTypes, - primaryType: "MandateOutput" - }); - const fillTransactionHashesFor = (container: OrderContainer) => container.order.outputs.map((output) => store.fillTransactions[outputKey(output)]); @@ -100,75 +85,10 @@ isValidFillTxHash(store.fillTransactions[outputKey(output)], output.chainId) ); - // Order status enum - const OrderStatus_None = 0; - const OrderStatus_Deposited = 1; - const OrderStatus_Claimed = 2; - const OrderStatus_Refunded = 3; - - async function isClaimed(chainId: bigint, container: OrderContainer, _: any) { - const { order, inputSettler } = container; - const intent = containerToIntent(container); - const orderId = intent.orderId(); - - if (isSolanaChain(chainId)) { - // No status enum on Solana: finalise and refund both close order_context, - // so its absence (with consumed_order still present) is the terminal - // signal — the same Claimed-or-Refunded conflation as the branches below. - return getOrFetchRpc( - `claim:solana:${orderId}`, - async () => readIsOrderFinalised(await getSolanaReads(chainId), orderId), - { ttlMs: 30_000 } - ); - } - - if (isTronChain(chainId)) { - const orderStatus = await getOrFetchRpc( - `claim:tron:${orderId}`, - async () => readOrderStatus(await getTronReads(), inputSettler, orderId), - { ttlMs: 30_000 } - ); - return orderStatus === OrderStatus_Claimed || orderStatus === OrderStatus_Refunded; - } - - const inputChainClient = getClient(chainId); - // Determine the order type. - if ( - inputSettler === INPUT_SETTLER_ESCROW_LIFI || - inputSettler === MULTICHAIN_INPUT_SETTLER_ESCROW - ) { - // Check order status - const orderStatus = await inputChainClient.readContract({ - address: inputSettler, - abi: SETTLER_ESCROW_ABI, - functionName: "orderStatus", - args: [orderId] - }); - return orderStatus === OrderStatus_Claimed || orderStatus === OrderStatus_Refunded; - } else if ( - inputSettler === INPUT_SETTLER_COMPACT_LIFI || - inputSettler === MULTICHAIN_INPUT_SETTLER_COMPACT - ) { - // Check claim status - const flattenedInputs = "originChainId" in order ? order.inputs : order.inputs[0]?.inputs; - if (!flattenedInputs || flattenedInputs.length === 0) return false; - - const [token, allocator, resetPeriod, scope] = await inputChainClient.readContract({ - address: COMPACT, - abi: COMPACT_ABI, - functionName: "getLockDetails", - args: [flattenedInputs[0][0]] - }); - // Check if nonce is spent. - return await inputChainClient.readContract({ - address: COMPACT, - abi: COMPACT_ABI, - functionName: "hasConsumedAllocatorNonce", - args: [order.nonce, allocator] - }); - } - return false; - } + // Stellar input ids are raw 32-byte contract ids, not EVM token ids. + // Orders reloaded from the DB carry bigints as decimal strings. + const inputTokenAddress = (inputChain: bigint, tokenId: bigint) => + isStellarChain(inputChain) ? toHex(BigInt(tokenId), { size: 32 }) : idToToken(tokenId); $effect(() => { refreshClaimed; @@ -176,10 +96,7 @@ Promise.all( inputChains.map( async (inputChain) => - [ - inputChain.toString(), - await isClaimed(inputChain, orderContainer, refreshClaimed) - ] as const + [inputChain.toString(), await isInputChainFinalised(inputChain, orderContainer)] as const ) ) .then((entries) => { @@ -200,6 +117,11 @@
+

+ External Catamaran fills and claims are observed independently of your wallet. Only the fill + claimant may finalise. +

+ {#if actionBlocker}{/if} {#if allFinalised} +

+ Freighter: {store.mainnet ? "Mainnet" : "Testnet"} · {axelarNetwork.productionApi + ? "Order API" + : "Order dev API"} · USDC only · external Catamaran solver +

{#snippet headerRight()} -
- store.accountForChain(chainId)} - outputRecipient={resolvedRecipient} - > -
+ {/snippet}
@@ -409,16 +611,16 @@ type="text" size="sm" className="flex-1" - placeholder="0x... or T... (optional)" + placeholder="0x…, T… or G… (optional)" state={recipientProblem !== undefined ? "error" : "default"} bind:value={store.recipient} />
- {#if resolvedRecipient !== undefined} + {#if recipientDisplay !== undefined}

Pays out to - {formatAddressForChain(resolvedRecipient, store.outputTokens[0].token.chainId)} + {recipientDisplay} on {getChainName(store.outputTokens[0].token.chainId)}

@@ -432,9 +634,10 @@ {:else} - - - + + {#each verifierOptions as option (option.value)} + + {/each} {/if}
@@ -444,7 +647,11 @@ type="text" size="sm" className="flex-1" - placeholder="0x / base58 (optional)" + placeholder={inputOnStellar + ? "Not supported for Stellar inputs" + : "0x / base58 (optional)"} + state={inputOnStellar ? "disabled" : "default"} + disabled={inputOnStellar} bind:value={store.exclusiveFor} />
+ {#if routeBlocker} +

{routeBlocker}

+ {/if}
- {#if issueBlocker !== undefined} + {#if routeBlocker} + + {:else if issueBlocker !== undefined} + {:else if inputOnStellar && !store.stellarAccount} + store.connectStellar()}> + {#snippet name()} + Connect Freighter ({store.mainnet ? "Mainnet" : "Testnet"}) + {/snippet} + {#snippet awaiting()} + Connecting... + {/snippet} + + {:else if !originAccountConnected} + + {:else if axelarPair} + {#if !selectedQuote} + + {:else} + intentFactory.executeApiQuote(selectedQuote!)}> + {#snippet name()}Execute API quote{/snippet} + {#snippet awaiting()}Waiting for transaction…{/snippet} + + {/if} {:else if !allowanceCheck} {#snippet name()} diff --git a/src/lib/screens/ManageDeposit.svelte b/src/lib/screens/ManageDeposit.svelte index d639ab4..95026d6 100644 --- a/src/lib/screens/ManageDeposit.svelte +++ b/src/lib/screens/ManageDeposit.svelte @@ -101,6 +101,35 @@ onChange={(v) => (store.useProductionApi = v === "auto" ? null : v === "production")} />
+
+

+ Stellar {store.mainnet ? "Mainnet" : "Testnet"} wallet +

+ {#if store.stellarAccount} +
+ {store.stellarAccount.slice(0, 6)}…{store.stellarAccount.slice(-4)} + store.disconnectStellar()}> + {#snippet name()} + Disconnect + {/snippet} + {#snippet awaiting()} + Disconnecting... + {/snippet} + +
+ {:else} + store.connectStellar()}> + {#snippet name()} + Connect Freighter ({store.mainnet ? "Mainnet" : "Testnet"}) + {/snippet} + {#snippet awaiting()} + Connecting... + {/snippet} + + {/if} +
diff --git a/src/lib/screens/ReceiveMessage.svelte b/src/lib/screens/ReceiveMessage.svelte index 8b645c0..5c9fdb0 100644 --- a/src/lib/screens/ReceiveMessage.svelte +++ b/src/lib/screens/ReceiveMessage.svelte @@ -1,11 +1,13 @@