@gelatonetwork/smartwallet-react-sdk 0.0.2-alpha.1 → 0.0.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +78 -2
- package/_dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# @gelatonetwork/smartwallet-react-sdk
|
2
2
|
|
3
|
+
## 0.0.2-alpha.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- fix: versioning
|
8
|
+
- Updated dependencies
|
9
|
+
- @gelatonetwork/smartwallet-react-dynamic@0.0.2-alpha.3
|
10
|
+
- @gelatonetwork/smartwallet-react-privy@0.0.2-alpha.3
|
11
|
+
- @gelatonetwork/smartwallet-react-types@0.0.2-alpha.3
|
12
|
+
|
13
|
+
## 0.0.2-alpha.2
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- 5f11604: chore: add readmes
|
18
|
+
- Updated dependencies [a4745d0]
|
19
|
+
- Updated dependencies [9d15eea]
|
20
|
+
- Updated dependencies [5f11604]
|
21
|
+
- Updated dependencies [b495e5d]
|
22
|
+
- @gelatonetwork/smartwallet-react-dynamic@0.0.2-alpha.2
|
23
|
+
- @gelatonetwork/smartwallet-react-privy@0.0.2-alpha.2
|
24
|
+
- @gelatonetwork/smartwallet-react-types@0.0.2-alpha.2
|
25
|
+
|
3
26
|
## 0.0.2-alpha.1
|
4
27
|
|
5
28
|
### Patch Changes
|
package/README.md
CHANGED
@@ -1,3 +1,79 @@
|
|
1
|
-
#
|
1
|
+
# @gelatonetwork/smartwallet-react-sdk
|
2
2
|
|
3
|
-
|
3
|
+
A unified React SDK for Gelato Smart Wallet that supports multiple WaaS providers.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- Unified interface for Dynamic and Privy WaaS providers
|
8
|
+
- Connect button component that works with any supported provider
|
9
|
+
- Simple configuration helpers for different providers
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
### Provider Setup
|
14
|
+
|
15
|
+
```tsx
|
16
|
+
import {
|
17
|
+
GelatoSmartWalletContextProvider,
|
18
|
+
dynamic,
|
19
|
+
privy,
|
20
|
+
wagmi
|
21
|
+
} from '@gelatonetwork/smartwallet-react-sdk';
|
22
|
+
|
23
|
+
function App() {
|
24
|
+
return (
|
25
|
+
<GelatoSmartWalletContextProvider
|
26
|
+
settings={{
|
27
|
+
waas: dynamic('your-dynamic-app-id'), // or privy('your-privy-app-id')
|
28
|
+
defaultChain: yourDefaultChain,
|
29
|
+
wagmi: wagmi(yourWagmiConfig)
|
30
|
+
}}
|
31
|
+
>
|
32
|
+
<YourApp />
|
33
|
+
</GelatoSmartWalletContextProvider>
|
34
|
+
);
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
### Using the Connect Button
|
39
|
+
|
40
|
+
```tsx
|
41
|
+
import { GelatoSmartWalletConnectButton } from '@gelatonetwork/smartwallet-react-sdk';
|
42
|
+
|
43
|
+
function ConnectWallet() {
|
44
|
+
return (
|
45
|
+
<GelatoSmartWalletConnectButton>
|
46
|
+
Connect Wallet
|
47
|
+
</GelatoSmartWalletConnectButton>
|
48
|
+
);
|
49
|
+
}
|
50
|
+
```
|
51
|
+
|
52
|
+
### Accessing Wallet Context
|
53
|
+
|
54
|
+
```tsx
|
55
|
+
import { useGelatoSmartWalletProviderContext } from '@gelatonetwork/smartwallet-react-sdk';
|
56
|
+
|
57
|
+
function YourComponent() {
|
58
|
+
const { gelato, wagmi, logout, switchNetwork, type } = useGelatoSmartWalletProviderContext();
|
59
|
+
|
60
|
+
// Access the Gelato client through gelato.client
|
61
|
+
const gelatoClient = gelato.client;
|
62
|
+
|
63
|
+
// Example: Send a transaction
|
64
|
+
const execute = async () => {
|
65
|
+
if (!gelatoClient) return;
|
66
|
+
|
67
|
+
const hash = await gelatoClient.execute({
|
68
|
+
payment,
|
69
|
+
calls: [
|
70
|
+
{
|
71
|
+
to: "0x0...",
|
72
|
+
data: "0x0...",
|
73
|
+
value: 0n
|
74
|
+
}
|
75
|
+
]
|
76
|
+
});
|
77
|
+
};
|
78
|
+
}
|
79
|
+
```
|