Skip to content

Commit

Permalink
Merge pull request #26 from EveripediaNetwork/fix-revert-web3auth-imp…
Browse files Browse the repository at this point in the history
…ort-changes

Revert web3auth import changes
  • Loading branch information
Royal-lobster authored Sep 3, 2024
2 parents 36f31fb + 619ba08 commit f582af9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-carrots-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@everipedia/iq-login": patch
---

reverts web3 import structure
23 changes: 11 additions & 12 deletions src/lib/integrations/web3-auth-connector.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import type { Wallet } from "@rainbow-me/rainbowkit";
import basePackage from "@web3auth/base";
import ethProviderPackage from "@web3auth/ethereum-provider";
import modalPackage from "@web3auth/modal";
import walletServicesPluginPackage from "@web3auth/wallet-services-plugin";
import {
WALLET_ADAPTERS,
CHAIN_NAMESPACES,
WEB3AUTH_NETWORK,
} from "@web3auth/base";
import ethereumProvider from "@web3auth/ethereum-provider";
import { Web3Auth } from "@web3auth/modal";
import { WalletServicesPlugin } from "@web3auth/wallet-services-plugin";
import { Web3AuthConnector } from "@web3auth/web3auth-wagmi-connector";
import type { Chain } from "viem";
import { createConnector } from "wagmi";

const { WALLET_ADAPTERS } = basePackage;
const { EthereumPrivateKeyProvider } = ethProviderPackage;
const { Web3Auth } = modalPackage;
const { WalletServicesPlugin } = walletServicesPluginPackage;

if (!process.env.NEXT_PUBLIC_WEB3_AUTH_CLIENT_ID) {
throw new Error("NEXT_PUBLIC_WEB3_AUTH_CLIENT_ID is not set");
}
Expand All @@ -24,7 +23,7 @@ export const rainbowWeb3AuthConnector = ({
const name = "Web3 Auth";

const chainConfig = {
chainNamespace: "eip155" as const,
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: `0x${chain.id.toString(16)}`,
rpcTarget: chain.rpcUrls.default.http[0],
displayName: chain.name,
Expand All @@ -33,7 +32,7 @@ export const rainbowWeb3AuthConnector = ({
blockExplorerUrl: chain.blockExplorers?.default.url[0] as string,
};

const privateKeyProvider = new EthereumPrivateKeyProvider({
const privateKeyProvider = new ethereumProvider.EthereumPrivateKeyProvider({
config: { chainConfig },
});

Expand All @@ -55,7 +54,7 @@ export const rainbowWeb3AuthConnector = ({
onPrimary: "#ffffff",
},
},
web3AuthNetwork: "sapphire_mainnet" as const,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
enableLogging: true,
});

Expand Down

0 comments on commit f582af9

Please sign in to comment.