Skip to content

Commit

Permalink
feat(console): add metamask
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 committed Aug 22, 2024
1 parent 7692f97 commit b2d8d9c
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 33 deletions.
1 change: 1 addition & 0 deletions apps/deploy-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@cosmjs/encoding": "^0.32.4",
"@cosmjs/proto-signing": "^0.32.4",
"@cosmjs/stargate": "^0.32.4",
"@cosmos-kit/cosmos-extension-metamask": "^0.10.0",
"@cosmos-kit/cosmostation-extension": "^2.12.2",
"@cosmos-kit/keplr": "^2.12.2",
"@cosmos-kit/leap-extension": "^2.12.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,31 @@ import { useChain } from "@cosmos-kit/react";
import { akash, akashSandbox, akashTestnet, assetLists } from "@src/chains";
import networkStore from "@src/store/networkStore";
import { customRegistry } from "@src/utils/customRegistry";
import { useEffect, useState } from "react";
import { CosmosMetamaskExtensionWallet } from "@cosmos-kit/cosmos-extension-metamask";

type Props = {
children: React.ReactNode;
};

export function CustomChainProvider({ children }: Props) {
const [metamask, setMetamask] = useState<CosmosMetamaskExtensionWallet[]>([]);

useEffect(() => {
import("@cosmos-kit/cosmos-extension-metamask").then(module => {
setMetamask(module.wallets);
});
}, []);

if (!metamask.length) {
return null;
}

return (
<ChainProvider
chains={[akash, akashSandbox, akashTestnet]}
assetLists={assetLists}
wallets={[...keplr, ...leap, ...cosmostation]}
wallets={[...keplr, ...leap, ...cosmostation, ...metamask]}
sessionOptions={{
duration: 31_556_926_000, // 1 year
callback: () => {
Expand Down
223 changes: 191 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b2d8d9c

Please sign in to comment.