From 3b202758849addba5154757066b34144100875c8 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 31 Mar 2026 13:11:19 +0200 Subject: [PATCH 1/4] Support selecting intent api env --- src/lib/components/GetQuote.svelte | 6 ++-- src/lib/libraries/intentFactory.ts | 5 ++-- src/lib/screens/IssueIntent.svelte | 2 ++ src/lib/screens/ManageDeposit.svelte | 44 ++++++++++++++++++++-------- src/lib/state.svelte.ts | 1 + src/routes/+page.svelte | 2 +- 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/src/lib/components/GetQuote.svelte b/src/lib/components/GetQuote.svelte index d304356..3bb606c 100644 --- a/src/lib/components/GetQuote.svelte +++ b/src/lib/components/GetQuote.svelte @@ -10,7 +10,8 @@ inputTokens, outputTokens = $bindable(), account, - mainnet + mainnet, + useProductionApi }: { exclusiveFor: string; useExclusiveForQuoteRequest?: boolean; @@ -18,12 +19,13 @@ outputTokens: AppTokenContext[]; account: () => `0x${string}`; mainnet: boolean; + useProductionApi: boolean | null; } = $props(); const toRawAddress = (value: string): `0x${string}` | undefined => isAddress(value, { strict: false }) ? (value as `0x${string}`) : undefined; - const intentApi = $derived(new IntentApi(mainnet)); + const intentApi = $derived(new IntentApi(useProductionApi ?? mainnet)); async function getQuoteAndSet() { try { diff --git a/src/lib/libraries/intentFactory.ts b/src/lib/libraries/intentFactory.ts index 5e9ccf2..2e7f194 100644 --- a/src/lib/libraries/intentFactory.ts +++ b/src/lib/libraries/intentFactory.ts @@ -111,14 +111,15 @@ export class IntentFactory { constructor(options: { mainnet: boolean; + useProductionApi?: boolean | null; walletClient: WC; preHook?: (chainId: number) => Promise; postHook?: () => Promise; ordersPointer?: OrderContainer[]; }) { - const { mainnet, walletClient, preHook, postHook, ordersPointer } = options; + const { mainnet, useProductionApi, walletClient, preHook, postHook, ordersPointer } = options; this.mainnet = mainnet; - this.intentApi = new IntentApi(mainnet); + this.intentApi = new IntentApi(useProductionApi ?? mainnet); this.walletClient = walletClient; this.preHook = preHook; diff --git a/src/lib/screens/IssueIntent.svelte b/src/lib/screens/IssueIntent.svelte index 105c6a1..96f0914 100644 --- a/src/lib/screens/IssueIntent.svelte +++ b/src/lib/screens/IssueIntent.svelte @@ -67,6 +67,7 @@ const intentFactory = $derived( new IntentFactory({ mainnet: store.mainnet, + useProductionApi: store.useProductionApi, walletClient: store.walletClient, preHook, postHook: postHookScroll, @@ -222,6 +223,7 @@ bind:exclusiveFor={store.exclusiveFor} useExclusiveForQuoteRequest={store.useExclusiveForQuoteRequest} mainnet={store.mainnet} + useProductionApi={store.useProductionApi} inputTokens={store.inputTokens} bind:outputTokens={store.outputTokens} {account} diff --git a/src/lib/screens/ManageDeposit.svelte b/src/lib/screens/ManageDeposit.svelte index 1e59847..d639ab4 100644 --- a/src/lib/screens/ManageDeposit.svelte +++ b/src/lib/screens/ManageDeposit.svelte @@ -69,18 +69,38 @@ >
-
-

Network

- (store.mainnet = v === "mainnet")} - /> +
+
+

Network

+ (store.mainnet = v === "mainnet")} + /> +
+
+

Intent API

+ (store.useProductionApi = v === "auto" ? null : v === "production")} + /> +
diff --git a/src/lib/state.svelte.ts b/src/lib/state.svelte.ts index fa84279..e6ce9ba 100644 --- a/src/lib/state.svelte.ts +++ b/src/lib/state.svelte.ts @@ -46,6 +46,7 @@ function generateUUID(): string { class Store { mainnet = $state(true); + useProductionApi = $state(null); orders = $state([]); async loadOrdersFromDb() { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 3b6bdc1..ac2492e 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -36,7 +36,7 @@ }); }); - const intentApi = $derived(new IntentApi(store.mainnet)); + const intentApi = $derived(new IntentApi(store.useProductionApi ?? store.mainnet)); let disconnectWs: (() => void) | undefined; From bcb98367b65a3e9a7b3ed04b4943631e0971d50a Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 31 Mar 2026 13:18:18 +0200 Subject: [PATCH 2/4] arcTestnet --- src/lib/config.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/lib/config.ts b/src/lib/config.ts index 7495ebc..ec41db2 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -11,7 +11,8 @@ import { bsc, katana, megaeth, - optimism + optimism, + arcTestnet } from "viem/chains"; export const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000" as const; @@ -64,14 +65,22 @@ export const chainMap = { katana, megaeth, bsc, - polygon + polygon, + arcTestnet } as const; type ChainName = keyof typeof chainMap; export const chains = Object.keys(chainMap) as ChainName[]; export const chainList = (mainnet: boolean) => { if (mainnet == true) { return ["ethereum", "base", "arbitrum", "megaeth", "katana", "polygon", "bsc"] as ChainName[]; - } else return ["sepolia", "optimismSepolia", "baseSepolia", "arbitrumSepolia"] as ChainName[]; + } else + return [ + "sepolia", + "optimismSepolia", + "baseSepolia", + "arbitrumSepolia", + "arcTestnet" + ] as ChainName[]; }; export const chainIdList = (mainnet: boolean) => { @@ -281,6 +290,12 @@ export const coinList = (mainnet: boolean) => { name: "weth", chainId: arbitrumSepolia.id, decimals: 18 + }, + { + address: `0x3600000000000000000000000000000000000006`, + name: "usdc", + chainId: arcTestnet.id, + decimals: 6 } ] as const; }; @@ -323,7 +338,8 @@ export const polymerChainIds = { megaeth: megaeth.id, katana: katana.id, bsc: bsc.id, - polygon: polygon.id + polygon: polygon.id, + arcTestnet: arcTestnet.id } as const; export type Verifier = "wormhole" | "polymer"; @@ -490,6 +506,10 @@ export const clients = { http("https://optimism-sepolia-rpc.publicnode.com"), ...optimismSepolia.rpcUrls.default.http.map((v) => http(v)) ]) + }), + arcTestnet: createPublicClient({ + chain: arcTestnet, + transport: fallback([...arcTestnet.rpcUrls.default.http.map((v) => http(v))]) }) } as const; From 30b2b861f2ed564fcc7d2ac5857c4c760c9ab1f3 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 31 Mar 2026 13:19:18 +0200 Subject: [PATCH 3/4] new testnet polymer oracles --- src/lib/config.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/config.ts b/src/lib/config.ts index ec41db2..f3c2b68 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -42,10 +42,11 @@ export const POLYMER_ORACLE: Partial> = { [polygon.id]: "0x0000003E06000007A224AeE90052fA6bb46d43C9", [bsc.id]: "0x0000003E06000007A224AeE90052fA6bb46d43C9", // testnet - [sepolia.id]: "0x00d5b500ECa100F7cdeDC800eC631Aca00BaAC00", - [baseSepolia.id]: "0x00d5b500ECa100F7cdeDC800eC631Aca00BaAC00", - [arbitrumSepolia.id]: "0x00d5b500ECa100F7cdeDC800eC631Aca00BaAC00", - [optimismSepolia.id]: "0x00d5b500ECa100F7cdeDC800eC631Aca00BaAC00" + [sepolia.id]: "0xe15b438C6267B0011aDa1e40fD8757Aa8Fe1E5a0", + [baseSepolia.id]: "0xe15b438C6267B0011aDa1e40fD8757Aa8Fe1E5a0", + [arbitrumSepolia.id]: "0xe15b438C6267B0011aDa1e40fD8757Aa8Fe1E5a0", + [optimismSepolia.id]: "0xe15b438C6267B0011aDa1e40fD8757Aa8Fe1E5a0", + [arcTestnet.id]: "0xe15b438C6267B0011aDa1e40fD8757Aa8Fe1E5a0" }; export type availableAllocators = typeof ALWAYS_OK_ALLOCATOR | typeof POLYMER_ALLOCATOR; From de74aad4592129776ae6be12287b2b9b275c9339 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 31 Mar 2026 14:10:49 +0200 Subject: [PATCH 4/4] Fix USDC address --- src/lib/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/config.ts b/src/lib/config.ts index f3c2b68..122936a 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -293,7 +293,7 @@ export const coinList = (mainnet: boolean) => { decimals: 18 }, { - address: `0x3600000000000000000000000000000000000006`, + address: `0x3600000000000000000000000000000000000000`, name: "usdc", chainId: arcTestnet.id, decimals: 6