@gelatonetwork/smartwallet-react-sdk 0.0.2-alpha.0 → 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 +33 -0
- package/README.md +78 -2
- package/_dist/components/connect.js +2 -2
- package/_dist/index.d.ts +1 -1
- package/_dist/provider.d.ts +1 -1
- package/_dist/provider.js +2 -2
- package/_dist/tsconfig.tsbuildinfo +1 -1
- package/_dist/utils/index.d.ts +1 -1
- package/package.json +10 -16
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,38 @@
|
|
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
|
+
|
26
|
+
## 0.0.2-alpha.1
|
27
|
+
|
28
|
+
### Patch Changes
|
29
|
+
|
30
|
+
- 1f2c254: fix: peer dependency
|
31
|
+
- Updated dependencies [1f2c254]
|
32
|
+
- @gelatonetwork/smartwallet-react-dynamic@0.0.2-alpha.1
|
33
|
+
- @gelatonetwork/smartwallet-react-privy@0.0.2-alpha.1
|
34
|
+
- @gelatonetwork/smartwallet-react-types@0.0.2-alpha.1
|
35
|
+
|
3
36
|
## 0.0.2-alpha.0
|
4
37
|
|
5
38
|
### 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
|
+
```
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
-
import { GelatoSmartWalletDynamicConnectButton } from "@
|
3
|
-
import { GelatoSmartWalletPrivyConnectButton } from "@
|
2
|
+
import { GelatoSmartWalletDynamicConnectButton } from "@gelatonetwork/smartwallet-react-dynamic";
|
3
|
+
import { GelatoSmartWalletPrivyConnectButton } from "@gelatonetwork/smartwallet-react-privy";
|
4
4
|
import { useGelatoSmartWalletProviderContext } from "../provider.js";
|
5
5
|
import { isDynamic } from "../utils/index.js";
|
6
6
|
export const GelatoSmartWalletConnectButton = ({ children }) => {
|
package/_dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { wallet } from "@
|
1
|
+
import type { wallet } from "@gelatonetwork/smartwallet-react-types";
|
2
2
|
export { GelatoSmartWalletContextProvider, useGelatoSmartWalletProviderContext } from "./provider.js";
|
3
3
|
export { GelatoSmartWalletConnectButton } from "./components/connect.js";
|
4
4
|
export declare const dynamic: (appId: string) => {
|
package/_dist/provider.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { wallet } from "@
|
1
|
+
import type { wallet } from "@gelatonetwork/smartwallet-react-types";
|
2
2
|
import type React from "react";
|
3
3
|
interface GelatoSmartWalletProviderContextType extends wallet.ProviderContext {
|
4
4
|
type: wallet.ProviderType;
|
package/_dist/provider.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
-
import { GelatoSmartWalletDynamicContextProvider, useGelatoSmartWalletDynamicContext } from "@
|
3
|
-
import { GelatoSmartWalletPrivyContextProvider, useGelatoSmartWalletPrivyContext } from "@
|
2
|
+
import { GelatoSmartWalletDynamicContextProvider, useGelatoSmartWalletDynamicContext } from "@gelatonetwork/smartwallet-react-dynamic";
|
3
|
+
import { GelatoSmartWalletPrivyContextProvider, useGelatoSmartWalletPrivyContext } from "@gelatonetwork/smartwallet-react-privy";
|
4
4
|
import { createContext, useContext } from "react";
|
5
5
|
import { isDynamic } from "./utils/index.js";
|
6
6
|
const GelatoSmartWalletProviderContext = createContext(undefined);
|