
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@gemini-wallet/wagmi
Advanced tools
⚠️ Temporary Package Notice
This is a temporary standalone package that provides Gemini Wallet support for Wagmi, default connector is included wagmi@2.16.3, and @wagmi/connectors@5.9.3
please migrate to using the official @wagmi/connectors
package instead of this one. The API is identical, so migration will be seamless.
@gemini-wallet/wagmi
provides a Wagmi connector that enables easy integration of Gemini Wallet into applications using Wagmi and viem. It handles all the complexity of wallet connection, transaction signing, and account management.
npm install @gemini-wallet/wagmi @gemini-wallet/core wagmi viem
# or
yarn add @gemini-wallet/wagmi @gemini-wallet/core wagmi viem
# or
pnpm add @gemini-wallet/wagmi @gemini-wallet/core wagmi viem
When the official Wagmi integration is available, simply:
Remove this package:
npm uninstall @gemini-wallet/wagmi
Update your imports:
// Change from:
import { gemini } from "@gemini-wallet/wagmi";
// To:
import { gemini } from "@wagmi/connectors";
Keep everything else the same - the API is identical!
import { createConfig, http } from "wagmi";
import { mainnet, polygon, arbitrum } from "wagmi/chains";
import { gemini } from "@gemini-wallet/wagmi";
const config = createConfig({
chains: [mainnet, polygon, arbitrum],
connectors: [
gemini({
appMetadata: {
name: "My DApp",
description: "My awesome decentralized application",
url: "https://mydapp.com",
icons: ["https://mydapp.com/icon.png"],
},
}),
],
transports: {
[mainnet.id]: http(),
[polygon.id]: http(),
[arbitrum.id]: http(),
},
});
import { WagmiProvider } from "wagmi";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useConnect, useAccount, useDisconnect } from "wagmi";
const queryClient = new QueryClient();
function App() {
return (
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<ConnectButton />
</QueryClientProvider>
</WagmiProvider>
);
}
function ConnectButton() {
const { connect, connectors } = useConnect();
const { address, isConnected } = useAccount();
const { disconnect } = useDisconnect();
if (isConnected) {
return (
<div>
<p>Connected: {address}</p>
<button onClick={() => disconnect()}>Disconnect</button>
</div>
);
}
const geminiConnector = connectors.find((c) => c.id === "gemini");
return (
<button onClick={() => connect({ connector: geminiConnector })}>
Connect Gemini Wallet
</button>
);
}
import { gemini } from "@gemini-wallet/wagmi";
const connector = gemini({
appMetadata: {
name: "My DApp",
description: "Description of your application",
url: "https://mydapp.com",
icons: ["https://mydapp.com/icon.png", "https://mydapp.com/icon@2x.png"],
},
});
import { useAccount, useChainId } from "wagmi";
import { useEffect } from "react";
function MyComponent() {
const { address, connector } = useAccount();
const chainId = useChainId();
useEffect(() => {
if (!connector) return;
const handleAccountsChanged = (accounts: string[]) => {
console.log("Accounts changed:", accounts);
};
const handleChainChanged = (chainId: number) => {
console.log("Chain changed:", chainId);
};
const provider = connector.getProvider();
provider.then((p) => {
p.on("accountsChanged", handleAccountsChanged);
p.on("chainChanged", handleChainChanged);
});
return () => {
provider.then((p) => {
p.removeListener("accountsChanged", handleAccountsChanged);
p.removeListener("chainChanged", handleChainChanged);
});
};
}, [connector]);
return <div>Current chain: {chainId}</div>;
}
import { useSendTransaction } from "wagmi";
import { parseEther } from "viem";
function SendTransaction() {
const { sendTransaction } = useSendTransaction();
const handleSend = () => {
sendTransaction({
to: "0x742d35Cc6634C0532925a3b844Bc9e7595f7F1eD",
value: parseEther("0.01"),
});
};
return <button onClick={handleSend}>Send 0.01 ETH</button>;
}
import { useSignMessage } from "wagmi";
function SignMessage() {
const { signMessage, data, isSuccess } = useSignMessage();
const handleSign = () => {
signMessage({ message: "Hello from Gemini Wallet!" });
};
return (
<div>
<button onClick={handleSign}>Sign Message</button>
{isSuccess && <p>Signature: {data}</p>}
</div>
);
}
gemini(parameters)
Creates a Wagmi connector instance for Gemini Wallet.
parameters
(optional): Configuration object
appMetadata
(optional): Application metadata
name
: Your application namedescription
: Brief description of your appurl
: Your application URLicons
: Array of icon URLsA Wagmi connector instance with the following properties:
id
: "gemini"
name
: "Gemini Wallet"
type
: "gemini"
icon
: Gemini Wallet logoAll standard Wagmi connector methods are supported:
connect({ chainId? })
: Connect to walletdisconnect()
: Disconnect from walletgetAccounts()
: Get connected accountsgetChainId()
: Get current chain IDgetProvider()
: Get the provider instanceisAuthorized()
: Check if already authorizedswitchChain({ chainId })
: Switch to a different chainGemini Wallet supports all EVM-compatible chains. Configure your desired chains in the Wagmi config.
import { useConnect } from "wagmi";
function ConnectWithErrorHandling() {
const { connect, error, isError } = useConnect();
const handleConnect = async () => {
try {
await connect({ connector: geminiConnector });
} catch (err) {
if (err.message.includes("user rejected")) {
console.log("User cancelled connection");
}
}
};
return (
<div>
<button onClick={handleConnect}>Connect</button>
{isError && <p>Error: {error?.message}</p>}
</div>
);
}
@wagmi/connectors
when availableThis package will be deprecated once the official Wagmi integration is merged. We'll provide clear migration instructions and support during the transition.
Since this is a temporary package, we recommend contributing to the main Wagmi repository instead. However, if you find issues with this temporary implementation, please report them in our issues.
MIT License - see LICENSE for details.
FAQs
Wagmi connector for Gemini Wallet integration
We found that @gemini-wallet/wagmi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.