diff --git a/src/lib/abi/escrow.ts b/src/lib/abi/escrow.ts index ae77c24..25a9ae9 100644 --- a/src/lib/abi/escrow.ts +++ b/src/lib/abi/escrow.ts @@ -408,7 +408,7 @@ export const SETTLER_ESCROW_ABI = [ } ], outputs: [], - stateMutability: "nonpayable" + stateMutability: "payable" }, { type: "function", diff --git a/src/lib/components/InputTokenModal.svelte b/src/lib/components/InputTokenModal.svelte index aa607cc..addd1f3 100644 --- a/src/lib/components/InputTokenModal.svelte +++ b/src/lib/components/InputTokenModal.svelte @@ -74,9 +74,7 @@ active = false; } - const uniqueInputTokens = $derived([ - ...new Set(store.availableTokens.map((v) => v.name).filter((v) => v !== "eth")) - ]); + const uniqueInputTokens = $derived([...new Set(store.availableTokens.map((v) => v.name))]); // svelte-ignore state_referenced_locally let selectedTokenName = $state(currentInputTokens[0].token.name); diff --git a/src/lib/config.ts b/src/lib/config.ts index 508a694..84c3c9e 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -399,7 +399,7 @@ export const coinList = (mainnet: boolean) => { address: ADDRESS_ZERO, name: "eth", chainId: arbitrumSepolia.id, - decimals: 6 + decimals: 18 }, { address: `0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14`, diff --git a/src/lib/libraries/intentExecution.ts b/src/lib/libraries/intentExecution.ts index 6c125cb..2e91f20 100644 --- a/src/lib/libraries/intentExecution.ts +++ b/src/lib/libraries/intentExecution.ts @@ -24,6 +24,7 @@ import { isTronChain } from "$lib/utils/chainType"; import type { TxRef } from "$lib/utils/txRef"; import { getTronReads, getTronSigner } from "$lib/tron/client"; import { openEscrow as openTronEscrow } from "$lib/tron/writes"; +import { nativeValueOfInputs } from "$lib/tron/encode"; import { getSolanaReads } from "$lib/solana/client"; import { createSolanaPrograms } from "$lib/solana/program"; import { getSolanaSigner } from "$lib/solana/wallet"; @@ -122,6 +123,7 @@ export async function openEscrowIntent( } await switchWalletChain(walletClient, Number(order.originChainId)); const chain = getChain(order.originChainId); + const nativeValue = nativeValueOfInputs(order.inputs); return [ await walletClient.writeContract({ chain, @@ -129,7 +131,8 @@ export async function openEscrowIntent( address: INPUT_SETTLER_ESCROW_LIFI, abi: SETTLER_ESCROW_ABI, functionName: "open", - args: [order] + args: [order], + ...(nativeValue > 0n ? { value: nativeValue } : {}) }) ]; } @@ -142,6 +145,13 @@ export async function openEscrowIntent( if (tronComponent) { throw new Error("Multichain orders with Tron inputs are not supported"); } + // The multichain settler's open is nonpayable, so native inputs cannot be escrowed. + const nativeComponent = components.find( + ({ orderComponent }) => nativeValueOfInputs(orderComponent.inputs) > 0n + ); + if (nativeComponent) { + throw new Error("Multichain orders with native inputs are not supported"); + } const results: `0x${string}`[] = []; for (const { chainId, orderComponent } of components) { const chain = getChain(chainId);