0.0.9 • Published 9 months ago
@gelatonetwork/smartwallet-react-sdk v0.0.9
@gelatonetwork/smartwallet-react-sdk
A unified React SDK for Gelato Smart Wallet that supports multiple WaaS providers.
Features
- Unified interface for Dynamic and Privy WaaS providers
- Connect button component that works with any supported provider
- Simple configuration helpers for different providers
Usage
Provider Setup
import {
GelatoSmartWalletContextProvider,
dynamic,
privy,
wagmi
} from '@gelatonetwork/smartwallet-react-sdk';
function App() {
return (
<GelatoSmartWalletContextProvider
settings={{
waas: dynamic('your-dynamic-app-id'), // or privy('your-privy-app-id')
defaultChain: yourDefaultChain,
wagmi: wagmi(yourWagmiConfig)
}}
>
<YourApp />
</GelatoSmartWalletContextProvider>
);
}Using the Connect Button
import { GelatoSmartWalletConnectButton } from '@gelatonetwork/smartwallet-react-sdk';
function ConnectWallet() {
return (
<GelatoSmartWalletConnectButton>
Connect Wallet
</GelatoSmartWalletConnectButton>
);
}Accessing Wallet Context
import { useGelatoSmartWalletProviderContext } from '@gelatonetwork/smartwallet-react-sdk';
function YourComponent() {
const { gelato, wagmi, logout, switchNetwork, type } = useGelatoSmartWalletProviderContext();
// Access the Gelato client through gelato.client
const gelatoClient = gelato.client;
// Example: Send a transaction
const execute = async () => {
if (!gelatoClient) return;
const hash = await gelatoClient.execute({
payment,
calls: [
{
to: "0x0...",
data: "0x0...",
value: 0n
}
]
});
};
}0.0.9
9 months ago
0.0.8
10 months ago
0.0.7
10 months ago
0.0.6
10 months ago
0.0.5
10 months ago
0.0.4
10 months ago
0.0.3
10 months ago
0.0.2
10 months ago
0.0.2-alpha.7
11 months ago
0.0.2-alpha.6
11 months ago
0.0.2-alpha.5
11 months ago
1.0.0-alpha.6
11 months ago
0.0.2-alpha.4
11 months ago
0.0.2-alpha.3
11 months ago
0.0.2-alpha.1
11 months ago
0.0.2-alpha.0
11 months ago