Skip to content

Commit

Permalink
fix tron wallet connect hook
Browse files Browse the repository at this point in the history
  • Loading branch information
arentant committed Dec 26, 2024
1 parent df99f21 commit 483b65e
Show file tree
Hide file tree
Showing 9 changed files with 1,163 additions and 544 deletions.
18 changes: 12 additions & 6 deletions components/WalletProviders/TronProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,28 @@ export default function TronProvider({ children }: { children: React.ReactNode }
}
const [adapters, setAdapters] = useState<Adapter[]>([]);
useEffect(() => {
import('@tronweb3/tronwallet-adapters').then((res) => {
import('../../lib/wallets/tron/connectors').then((res) => {
const {
BitKeepAdapter,
OkxWalletAdapter,
TokenPocketAdapter,
TronLinkAdapter,
LedgerAdapter,
// LedgerAdapter,
} = res;
const tronLinkAdapter = new TronLinkAdapter();
const ledger = new LedgerAdapter({
accountNumber: 2,
});
// const ledger = new LedgerAdapter({
// accountNumber: 2,
// });
const bitKeepAdapter = new BitKeepAdapter();
const tokenPocketAdapter = new TokenPocketAdapter();
const okxwalletAdapter = new OkxWalletAdapter();
setAdapters([tronLinkAdapter, bitKeepAdapter, tokenPocketAdapter, okxwalletAdapter, ledger])
setAdapters([
tronLinkAdapter,
bitKeepAdapter,
tokenPocketAdapter,
okxwalletAdapter,
// ledger
])
});
}, [setAdapters])

Expand Down
30 changes: 10 additions & 20 deletions components/WalletProviders/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,22 @@ import SolanaProvider from "./SolanaProvider"
import { ThemeData } from "../../Models/Theme"
import Wagmi from "./Wagmi";
import StarknetProvider from "./StarknetProvider";
import dynamic from "next/dynamic";
import { ImtblPassportProvider } from "./ImtblPassportProvider";

const TronProvider = dynamic(() => import("./TronProvider").then((comp) => comp.default), {
loading: () => null
})
import TronProvider from "./TronProvider";

const WalletsProviders: FC<{ children: JSX.Element | JSX.Element[], basePath: string, themeData: ThemeData, appName: string | undefined }> = ({ children, basePath, themeData, appName }) => {
return (
<TonConnectProvider basePath={basePath} themeData={themeData} appName={appName}>
<SolanaProvider>
<StarknetProvider>
<Wagmi>
<ImtblPassportProvider>

{
TronProvider ?
<TronProvider>
{children}
</TronProvider>
:
children
}
</ImtblPassportProvider>
</Wagmi>
</StarknetProvider>
<TronProvider>
<StarknetProvider>
<Wagmi>
<ImtblPassportProvider>
{children}
</ImtblPassportProvider>
</Wagmi>
</StarknetProvider>
</TronProvider>
</SolanaProvider>
</TonConnectProvider>
)
Expand Down
Loading

0 comments on commit 483b65e

Please sign in to comment.