From f28b4d911975fdaed212020e6109fe661959c001 Mon Sep 17 00:00:00 2001 From: guillermo dieguez Date: Thu, 30 Apr 2026 11:31:17 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20app:=20route=20owner=20rpc=20thr?= =?UTF-8?q?ough=20alchemy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/chubby-flowers-learn.md | 5 +++++ src/utils/alchemyChains.ts | 9 +++++++++ src/utils/wagmi/owner.ts | 9 ++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .changeset/chubby-flowers-learn.md create mode 100644 src/utils/alchemyChains.ts diff --git a/.changeset/chubby-flowers-learn.md b/.changeset/chubby-flowers-learn.md new file mode 100644 index 0000000000..ef5c441dd7 --- /dev/null +++ b/.changeset/chubby-flowers-learn.md @@ -0,0 +1,5 @@ +--- +"@exactly/mobile": patch +--- + +🐛 route owner rpc through alchemy diff --git a/src/utils/alchemyChains.ts b/src/utils/alchemyChains.ts new file mode 100644 index 0000000000..ff65072674 --- /dev/null +++ b/src/utils/alchemyChains.ts @@ -0,0 +1,9 @@ +import * as accountKitInfra from "@account-kit/infra"; + +import type { Chain } from "viem"; + +export default new Map( + Object.values(accountKitInfra) + .filter((c): c is Chain => typeof c === "object" && "id" in c && typeof c.id === "number") + .map((c) => [c.id, c]), +); diff --git a/src/utils/wagmi/owner.ts b/src/utils/wagmi/owner.ts index ccc13f1a79..ba1d16d2d3 100644 --- a/src/utils/wagmi/owner.ts +++ b/src/utils/wagmi/owner.ts @@ -6,15 +6,22 @@ import { http } from "viem"; import * as chains from "viem/chains"; import { createConfig, createStorage, custom, injected } from "wagmi"; +import alchemyAPIKey from "@exactly/common/alchemyAPIKey"; import chain from "@exactly/common/generated/chain"; +import alchemyChainById from "../alchemyChains"; import publicClient from "../publicClient"; const config = createConfig({ chains: [chain, ...Object.values(chains)], connectors: [miniAppConnector(), injected()], transports: { - ...Object.fromEntries(Object.values(chains).map((c) => [c.id, http()])), + ...Object.fromEntries( + Object.values(chains).map((c) => [ + c.id, + http(alchemyChainById.get(c.id)?.rpcUrls.alchemy?.http[0]?.concat(`/${alchemyAPIKey}`)), + ]), + ), [chain.id]: custom(publicClient), }, storage: createStorage({ key: "wagmi.owner", storage: AsyncStorage }),