@gelatonetwork/smartwallet-react-privy 1.0.0-alpha.6 → 1.0.0
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 +308 -8
- package/_dist/components/connect.js +1 -1
- package/_dist/components/connect.js.map +1 -1
- package/_dist/index.d.ts +1 -1
- package/_dist/index.d.ts.map +1 -1
- package/_dist/index.js +4 -1
- package/_dist/index.js.map +1 -1
- package/_dist/provider.d.ts.map +1 -1
- package/_dist/provider.js +45 -30
- package/_dist/provider.js.map +1 -1
- package/_dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -20
- package/src/components/connect.tsx +1 -1
- package/src/index.ts +7 -1
- package/src/provider.tsx +70 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,328 @@
|
|
|
1
1
|
# @gelatonetwork/smartwallet-react-privy
|
|
2
2
|
|
|
3
|
-
## 1.0.0
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3f0c94e: DEPRECATED: All @gelatonetwork/smartwallet packages are deprecated. Please migrate to @gelatocloud/gasless.
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
- @gelatonetwork/smartwallet@0.1.0
|
|
9
|
-
- @gelatonetwork/smartwallet-react-types@1.0.0
|
|
11
|
+
- Updated dependencies [3f0c94e]
|
|
12
|
+
- @gelatonetwork/smartwallet@0.1.0
|
|
13
|
+
- @gelatonetwork/smartwallet-react-types@1.0.0
|
|
10
14
|
|
|
11
|
-
##
|
|
15
|
+
## 0.0.28
|
|
12
16
|
|
|
13
|
-
###
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [2166cc0]
|
|
20
|
+
- @gelatonetwork/smartwallet@0.0.28
|
|
21
|
+
- @gelatonetwork/smartwallet-react-types@0.0.28
|
|
22
|
+
|
|
23
|
+
## 0.0.27
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [df67749]
|
|
28
|
+
- @gelatonetwork/smartwallet@0.0.27
|
|
29
|
+
- @gelatonetwork/smartwallet-react-types@0.0.27
|
|
30
|
+
|
|
31
|
+
## 0.0.26
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [bee90b2]
|
|
36
|
+
- @gelatonetwork/smartwallet@0.0.26
|
|
37
|
+
- @gelatonetwork/smartwallet-react-types@0.0.26
|
|
38
|
+
|
|
39
|
+
## 0.0.25
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [5deab72]
|
|
44
|
+
- @gelatonetwork/smartwallet@0.0.25
|
|
45
|
+
- @gelatonetwork/smartwallet-react-types@0.0.25
|
|
46
|
+
|
|
47
|
+
## 0.0.24
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- 6d5a518: chore: bump dependencies
|
|
52
|
+
- Updated dependencies [6d5a518]
|
|
53
|
+
- @gelatonetwork/smartwallet@0.0.24
|
|
54
|
+
- @gelatonetwork/smartwallet-react-types@0.0.24
|
|
55
|
+
|
|
56
|
+
## 0.0.23
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [9b9badd]
|
|
61
|
+
- @gelatonetwork/smartwallet@0.0.23
|
|
62
|
+
- @gelatonetwork/smartwallet-react-types@0.0.23
|
|
63
|
+
|
|
64
|
+
## 0.0.22
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- fa5b7b4: fix: privy network switch and login issues
|
|
69
|
+
- 90c8314: feat: allow passing clientId for privy
|
|
70
|
+
- Updated dependencies [90c8314]
|
|
71
|
+
- Updated dependencies [7bd5914]
|
|
72
|
+
- @gelatonetwork/smartwallet-react-types@0.0.22
|
|
73
|
+
- @gelatonetwork/smartwallet@0.0.22
|
|
74
|
+
|
|
75
|
+
## 0.0.21
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- 4c94ad5: feat: custom network definition for waas providers
|
|
80
|
+
- Updated dependencies [4c94ad5]
|
|
81
|
+
- Updated dependencies [1320278]
|
|
82
|
+
- Updated dependencies [b13bb97]
|
|
83
|
+
- Updated dependencies [41fb5f7]
|
|
84
|
+
- Updated dependencies [76be45b]
|
|
85
|
+
- Updated dependencies [0213d77]
|
|
86
|
+
- Updated dependencies [0213d77]
|
|
87
|
+
- Updated dependencies [bbc4a33]
|
|
88
|
+
- @gelatonetwork/smartwallet-react-types@0.0.21
|
|
89
|
+
- @gelatonetwork/smartwallet@0.0.21
|
|
90
|
+
|
|
91
|
+
## 0.0.20
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [c02e775]
|
|
96
|
+
- @gelatonetwork/smartwallet@0.0.20
|
|
97
|
+
- @gelatonetwork/smartwallet-react-types@0.0.20
|
|
98
|
+
|
|
99
|
+
## 0.0.19
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- Updated dependencies [c8d03bd]
|
|
104
|
+
- @gelatonetwork/smartwallet@0.0.19
|
|
105
|
+
- @gelatonetwork/smartwallet-react-types@0.0.19
|
|
106
|
+
|
|
107
|
+
## 0.0.18
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- Updated dependencies [ba8e9e7]
|
|
112
|
+
- Updated dependencies [7789b61]
|
|
113
|
+
- @gelatonetwork/smartwallet@0.0.18
|
|
114
|
+
- @gelatonetwork/smartwallet-react-types@0.0.18
|
|
115
|
+
|
|
116
|
+
## 0.0.17
|
|
117
|
+
|
|
118
|
+
### Patch Changes
|
|
119
|
+
|
|
120
|
+
- 69c8072: fix: prepare authorization properly
|
|
121
|
+
- Updated dependencies [69c8072]
|
|
122
|
+
- Updated dependencies [69c8072]
|
|
123
|
+
- @gelatonetwork/smartwallet@0.0.17
|
|
124
|
+
- @gelatonetwork/smartwallet-react-types@0.0.17
|
|
125
|
+
|
|
126
|
+
## 0.0.16
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- Updated dependencies [2de3895]
|
|
131
|
+
- @gelatonetwork/smartwallet@0.0.16
|
|
132
|
+
- @gelatonetwork/smartwallet-react-types@0.0.16
|
|
133
|
+
|
|
134
|
+
## 0.0.15
|
|
135
|
+
|
|
136
|
+
### Patch Changes
|
|
137
|
+
|
|
138
|
+
- fa0d8ad: feat: allow privy supported networks to be passed by the user
|
|
139
|
+
- Updated dependencies [fa0d8ad]
|
|
140
|
+
- Updated dependencies [3338755]
|
|
141
|
+
- @gelatonetwork/smartwallet-react-types@0.0.15
|
|
142
|
+
- @gelatonetwork/smartwallet@0.0.15
|
|
143
|
+
|
|
144
|
+
## 0.0.14
|
|
145
|
+
|
|
146
|
+
### Patch Changes
|
|
147
|
+
|
|
148
|
+
- Updated dependencies [238aff8]
|
|
149
|
+
- @gelatonetwork/smartwallet@0.0.14
|
|
150
|
+
- @gelatonetwork/smartwallet-react-types@0.0.14
|
|
151
|
+
|
|
152
|
+
## 0.0.13
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- Updated dependencies [3c59577]
|
|
157
|
+
- @gelatonetwork/smartwallet@0.0.13
|
|
158
|
+
- @gelatonetwork/smartwallet-react-types@0.0.13
|
|
159
|
+
|
|
160
|
+
## 0.0.12
|
|
161
|
+
|
|
162
|
+
### Patch Changes
|
|
14
163
|
|
|
164
|
+
- Updated dependencies [dd8473c]
|
|
165
|
+
- Updated dependencies [05357f6]
|
|
166
|
+
- Updated dependencies [4b80977]
|
|
167
|
+
- Updated dependencies [7be9f8f]
|
|
168
|
+
- Updated dependencies [788b7a7]
|
|
169
|
+
- @gelatonetwork/smartwallet@0.0.12
|
|
170
|
+
- @gelatonetwork/smartwallet-react-types@0.0.12
|
|
171
|
+
|
|
172
|
+
## 0.0.11
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- Updated dependencies [a2944cc]
|
|
177
|
+
- @gelatonetwork/smartwallet@0.0.11
|
|
178
|
+
- @gelatonetwork/smartwallet-react-types@0.0.11
|
|
179
|
+
|
|
180
|
+
## 0.0.10
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- Updated dependencies [10f007d]
|
|
185
|
+
- @gelatonetwork/smartwallet@0.0.10
|
|
186
|
+
- @gelatonetwork/smartwallet-react-types@0.0.10
|
|
187
|
+
|
|
188
|
+
## 0.0.9
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- Updated dependencies [34454ca]
|
|
193
|
+
- Updated dependencies [966c807]
|
|
194
|
+
- @gelatonetwork/smartwallet@0.0.9
|
|
195
|
+
- @gelatonetwork/smartwallet-react-types@0.0.9
|
|
196
|
+
|
|
197
|
+
## 0.0.8
|
|
198
|
+
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- Updated dependencies [a0b5854]
|
|
202
|
+
- @gelatonetwork/smartwallet@0.0.8
|
|
203
|
+
- @gelatonetwork/smartwallet-react-types@0.0.8
|
|
204
|
+
|
|
205
|
+
## 0.0.7
|
|
206
|
+
|
|
207
|
+
### Patch Changes
|
|
208
|
+
|
|
209
|
+
- 707d1a4: feat: smart accounts
|
|
210
|
+
- 707d1a4: feat: prepare and send calls
|
|
211
|
+
- Updated dependencies [707d1a4]
|
|
212
|
+
- Updated dependencies [707d1a4]
|
|
213
|
+
- @gelatonetwork/smartwallet-react-types@0.0.7
|
|
214
|
+
- @gelatonetwork/smartwallet@0.0.7
|
|
215
|
+
|
|
216
|
+
## 0.0.6
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- Updated dependencies [e7e770a]
|
|
221
|
+
- Updated dependencies [cf3022d]
|
|
222
|
+
- @gelatonetwork/smartwallet@0.0.6
|
|
223
|
+
- @gelatonetwork/smartwallet-react-types@0.0.6
|
|
224
|
+
|
|
225
|
+
## 0.0.5
|
|
226
|
+
|
|
227
|
+
### Patch Changes
|
|
228
|
+
|
|
229
|
+
- Updated dependencies [83104fb]
|
|
230
|
+
- @gelatonetwork/smartwallet@0.0.5
|
|
231
|
+
- @gelatonetwork/smartwallet-react-types@0.0.5
|
|
232
|
+
|
|
233
|
+
## 0.0.4
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- Updated dependencies [661273b]
|
|
238
|
+
- @gelatonetwork/smartwallet@0.0.4
|
|
239
|
+
- @gelatonetwork/smartwallet-react-types@0.0.4
|
|
240
|
+
|
|
241
|
+
## 0.0.3
|
|
242
|
+
|
|
243
|
+
### Patch Changes
|
|
244
|
+
|
|
245
|
+
- Updated dependencies [e605a7d]
|
|
246
|
+
- Updated dependencies [203f43d]
|
|
247
|
+
- Updated dependencies [86b38da]
|
|
248
|
+
- @gelatonetwork/smartwallet@0.0.3
|
|
249
|
+
- @gelatonetwork/smartwallet-react-types@0.0.3
|
|
250
|
+
|
|
251
|
+
## 0.0.2
|
|
252
|
+
|
|
253
|
+
### Patch Changes
|
|
254
|
+
|
|
255
|
+
- a4745d0: feat: provide gelato smart wallet client from react component
|
|
15
256
|
- e0b9f69: feat: support kernel wallet (7702)
|
|
257
|
+
- 9d15eea: feat: allow passing gelato apiKey
|
|
258
|
+
- 2ef980a: chore: make every dependency static versioned
|
|
259
|
+
- 5f11604: chore: add readmes
|
|
260
|
+
- a7add59: fix: versioning
|
|
261
|
+
- 8ab4de1: refactor: switchNetwork method to accept chainId
|
|
262
|
+
- 6055f9b: chore: bump packages
|
|
263
|
+
- 03ad775: chore: improve DX for defaultChain
|
|
264
|
+
- 5474e52: chore: alpha release
|
|
265
|
+
- 1f2c254: fix: peer dependency
|
|
266
|
+
- Updated dependencies [a4745d0]
|
|
267
|
+
- Updated dependencies [e0b9f69]
|
|
268
|
+
- Updated dependencies [9d15eea]
|
|
269
|
+
- Updated dependencies [49a40ae]
|
|
270
|
+
- Updated dependencies [2bdff53]
|
|
271
|
+
- Updated dependencies [2ef980a]
|
|
272
|
+
- Updated dependencies [b928e65]
|
|
273
|
+
- Updated dependencies [5f11604]
|
|
274
|
+
- Updated dependencies [a7add59]
|
|
275
|
+
- Updated dependencies [8ab4de1]
|
|
276
|
+
- Updated dependencies [9d15eea]
|
|
277
|
+
- Updated dependencies [6055f9b]
|
|
278
|
+
- Updated dependencies [ef7be72]
|
|
279
|
+
- Updated dependencies [ffa3302]
|
|
280
|
+
- Updated dependencies [5474e52]
|
|
281
|
+
- Updated dependencies [1d5eacb]
|
|
282
|
+
- Updated dependencies [575b36b]
|
|
283
|
+
- Updated dependencies [1f2c254]
|
|
284
|
+
- Updated dependencies [576b744]
|
|
285
|
+
- Updated dependencies [576b744]
|
|
286
|
+
- Updated dependencies [d69774c]
|
|
287
|
+
- Updated dependencies [6895459]
|
|
288
|
+
- @gelatonetwork/smartwallet-react-types@0.0.2
|
|
289
|
+
- @gelatonetwork/smartwallet@0.0.2
|
|
290
|
+
|
|
291
|
+
## 0.0.2-alpha.7
|
|
16
292
|
|
|
17
293
|
### Patch Changes
|
|
18
294
|
|
|
295
|
+
- 2ef980a: chore: make every dependency static versioned
|
|
296
|
+
- Updated dependencies [2ef980a]
|
|
297
|
+
- @gelatonetwork/smartwallet@0.0.2-alpha.7
|
|
298
|
+
- @gelatonetwork/smartwallet-react-types@0.0.2-alpha.7
|
|
299
|
+
|
|
300
|
+
## 0.0.2-alpha.6
|
|
301
|
+
|
|
302
|
+
### Patch Changes
|
|
303
|
+
|
|
304
|
+
- 8ab4de1: refactor: switchNetwork method to accept chainId
|
|
305
|
+
- 6055f9b: chore: bump packages
|
|
306
|
+
- Updated dependencies [8ab4de1]
|
|
307
|
+
- Updated dependencies [6055f9b]
|
|
308
|
+
- Updated dependencies [1d5eacb]
|
|
309
|
+
- Updated dependencies [575b36b]
|
|
310
|
+
- @gelatonetwork/smartwallet-react-types@0.0.2-alpha.6
|
|
311
|
+
- @gelatonetwork/smartwallet@0.0.2-alpha.6
|
|
312
|
+
|
|
313
|
+
## 0.0.2-alpha.5
|
|
314
|
+
|
|
315
|
+
### Patch Changes
|
|
316
|
+
|
|
317
|
+
- e0b9f69: feat: support kernel wallet (7702)
|
|
19
318
|
- 03ad775: chore: improve DX for defaultChain
|
|
20
319
|
- Updated dependencies [e0b9f69]
|
|
21
320
|
- Updated dependencies [49a40ae]
|
|
321
|
+
- Updated dependencies [2bdff53]
|
|
22
322
|
- Updated dependencies [b928e65]
|
|
23
323
|
- Updated dependencies [ffa3302]
|
|
24
|
-
- @gelatonetwork/smartwallet-react-types@
|
|
25
|
-
- @gelatonetwork/smartwallet@0.
|
|
324
|
+
- @gelatonetwork/smartwallet-react-types@0.0.2-alpha.5
|
|
325
|
+
- @gelatonetwork/smartwallet@0.0.2-alpha.5
|
|
26
326
|
|
|
27
327
|
## 0.0.2-alpha.4
|
|
28
328
|
|
|
@@ -4,6 +4,6 @@ export const GelatoSmartWalletPrivyConnectButton = ({ children }) => {
|
|
|
4
4
|
const { ready, authenticated } = usePrivy();
|
|
5
5
|
const { login } = useLogin();
|
|
6
6
|
const disableLogin = !ready || (ready && authenticated);
|
|
7
|
-
return (_jsx("button", {
|
|
7
|
+
return (_jsx("button", { disabled: disableLogin, onClick: login, type: "button", children: children }));
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=connect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/components/connect.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAO1D,MAAM,CAAC,MAAM,mCAAmC,GAAiD,CAAC,EAChG,QAAQ,EACT,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC5C,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE7B,MAAM,YAAY,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,aAAa,CAAC,CAAC;IAExD,OAAO,CACL,iBAAQ,
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/components/connect.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAO1D,MAAM,CAAC,MAAM,mCAAmC,GAAiD,CAAC,EAChG,QAAQ,EACT,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC5C,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE7B,MAAM,YAAY,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,aAAa,CAAC,CAAC;IAExD,OAAO,CACL,iBAAQ,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,YAC1D,QAAQ,GACF,CACV,CAAC;AACJ,CAAC,CAAC"}
|
package/_dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { GelatoSmartWalletPrivyContextProvider, useGelatoSmartWalletPrivyContext } from "./provider.js";
|
|
2
1
|
export { GelatoSmartWalletPrivyConnectButton } from "./components/connect.js";
|
|
2
|
+
export { GelatoSmartWalletPrivyContextProvider, useGelatoSmartWalletPrivyContext } from "./provider.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/_dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACL,qCAAqC,EACrC,gCAAgC,EACjC,MAAM,eAAe,CAAC"}
|
package/_dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
console.warn("[@gelatonetwork/smartwallet-react-privy] DEPRECATED: This package is deprecated. " +
|
|
2
|
+
"Please migrate to @gelatocloud/gasless. " +
|
|
3
|
+
"See https://github.com/gelatodigital/gasless");
|
|
2
4
|
export { GelatoSmartWalletPrivyConnectButton } from "./components/connect.js";
|
|
5
|
+
export { GelatoSmartWalletPrivyContextProvider, useGelatoSmartWalletPrivyContext } from "./provider.js";
|
|
3
6
|
//# sourceMappingURL=index.js.map
|
package/_dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,CACV,mFAAmF;IACjF,0CAA0C;IAC1C,8CAA8C,CACjD,CAAC;AAEF,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACL,qCAAqC,EACrC,gCAAgC,EACjC,MAAM,eAAe,CAAC"}
|
package/_dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAKrE,OAAO,KAAK,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAsB3C,eAAO,MAAM,gCAAgC,8BAQ5C,CAAC;AAEF,KAAK,kCAAkC,GAAG,MAAM,CAAC,aAAa,CAAC;AAqI/D,eAAO,MAAM,qCAAqC,EAAE,EAAE,CAAC,kCAAkC,CAgCxF,CAAC"}
|
package/_dist/provider.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createGelatoSmartWalletClient } from "@gelatonetwork/smartwallet";
|
|
3
3
|
import { PrivyProvider, usePrivy, useSignAuthorization, useWallets } from "@privy-io/react-auth";
|
|
4
|
-
import {
|
|
4
|
+
import { createConfig, WagmiProvider } from "@privy-io/wagmi";
|
|
5
5
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
6
6
|
import { ChainId } from "caip";
|
|
7
|
-
import { createContext, useContext, useEffect, useState } from "react";
|
|
7
|
+
import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
8
8
|
import { createWalletClient, custom } from "viem";
|
|
9
|
+
import { prepareAuthorization } from "viem/actions";
|
|
9
10
|
import * as chains from "viem/chains";
|
|
10
11
|
import { extractChain } from "viem/utils";
|
|
11
12
|
const GelatoSmartWalletPrivyProviderContext = createContext(undefined);
|
|
@@ -16,41 +17,57 @@ export const useGelatoSmartWalletPrivyContext = () => {
|
|
|
16
17
|
}
|
|
17
18
|
return context;
|
|
18
19
|
};
|
|
19
|
-
const GelatoSmartWalletPrivyInternal = ({ children, wagmi, apiKey,
|
|
20
|
+
const GelatoSmartWalletPrivyInternal = ({ children, wagmi, apiKey, scw }) => {
|
|
20
21
|
const { ready, authenticated, logout } = usePrivy();
|
|
21
22
|
const { wallets, ready: walletsReady } = useWallets();
|
|
22
23
|
const { signAuthorization } = useSignAuthorization();
|
|
23
24
|
const [smartWalletClient, setSmartWalletClient] = useState(null);
|
|
24
|
-
const
|
|
25
|
+
const currentChainIdRef = useRef(null);
|
|
26
|
+
const logoutWrapper = useCallback(async () => {
|
|
25
27
|
if (!smartWalletClient) {
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
30
|
setSmartWalletClient(null);
|
|
29
31
|
await logout();
|
|
30
|
-
};
|
|
31
|
-
const switchNetwork = async (
|
|
32
|
-
if (!smartWalletClient) {
|
|
32
|
+
}, [smartWalletClient, logout]);
|
|
33
|
+
const switchNetwork = useCallback(async (chainId) => {
|
|
34
|
+
if (!smartWalletClient || !wallets || wallets.length === 0) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
37
|
const primaryWallet = wallets[0];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
try {
|
|
39
|
+
await primaryWallet.switchChain(chainId);
|
|
40
|
+
// The useEffect will handle recreating the client with the new chain
|
|
41
|
+
// We don't need to manually call smartWalletClient.switchChain
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error("Failed to switch network:", error);
|
|
45
|
+
}
|
|
46
|
+
}, [smartWalletClient, wallets]);
|
|
39
47
|
useEffect(() => {
|
|
40
48
|
if (!ready || !walletsReady) {
|
|
41
49
|
return;
|
|
42
50
|
}
|
|
43
51
|
if (!authenticated || !wallets || wallets.length === 0) {
|
|
44
52
|
setSmartWalletClient(null);
|
|
53
|
+
currentChainIdRef.current = null;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const primaryWallet = wallets[0];
|
|
57
|
+
const walletChainId = primaryWallet.chainId;
|
|
58
|
+
// Only recreate the client if the chain ID changes
|
|
59
|
+
if (currentChainIdRef.current === walletChainId && smartWalletClient) {
|
|
45
60
|
return;
|
|
46
61
|
}
|
|
47
62
|
const fetchWalletClient = async () => {
|
|
48
|
-
const primaryWallet = wallets[0];
|
|
49
63
|
try {
|
|
50
64
|
// Privy wallet provides chainId in CAIP2 format
|
|
51
65
|
const { reference: chainId } = ChainId.parse(primaryWallet.chainId);
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
const chain = extractChain({
|
|
67
|
+
chains: Object.values(chains),
|
|
68
|
+
// biome-ignore lint/suspicious/noExplicitAny: chainId type override
|
|
69
|
+
id: Number(chainId)
|
|
70
|
+
});
|
|
54
71
|
if (!chain) {
|
|
55
72
|
return;
|
|
56
73
|
}
|
|
@@ -60,44 +77,42 @@ const GelatoSmartWalletPrivyInternal = ({ children, wagmi, apiKey, wallet }) =>
|
|
|
60
77
|
chain,
|
|
61
78
|
transport: custom(provider)
|
|
62
79
|
});
|
|
63
|
-
client.signAuthorization = async (parameters) => {
|
|
64
|
-
const
|
|
65
|
-
const contractAddress = parameters.contractAddress ?? parameters.address;
|
|
66
|
-
if (!contractAddress) {
|
|
67
|
-
throw new Error("Contract address is required");
|
|
68
|
-
}
|
|
80
|
+
client.account.signAuthorization = async (parameters) => {
|
|
81
|
+
const preparedAuthorization = await prepareAuthorization(client, parameters);
|
|
69
82
|
const signedAuthorization = await signAuthorization({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
nonce
|
|
83
|
+
chainId: preparedAuthorization.chainId,
|
|
84
|
+
contractAddress: preparedAuthorization.address,
|
|
85
|
+
nonce: preparedAuthorization.nonce
|
|
73
86
|
});
|
|
74
87
|
return signedAuthorization;
|
|
75
88
|
};
|
|
76
|
-
const walletClientGelato = createGelatoSmartWalletClient(client, { apiKey,
|
|
89
|
+
const walletClientGelato = await createGelatoSmartWalletClient(client, { apiKey, scw });
|
|
77
90
|
setSmartWalletClient(walletClientGelato);
|
|
91
|
+
currentChainIdRef.current = walletChainId;
|
|
78
92
|
}
|
|
79
93
|
catch (error) {
|
|
80
94
|
console.error("Failed to get wallet client:", error);
|
|
81
95
|
}
|
|
82
96
|
};
|
|
83
97
|
fetchWalletClient();
|
|
84
|
-
}, [ready,
|
|
98
|
+
}, [ready, walletsReady, authenticated, apiKey, scw, signAuthorization]);
|
|
85
99
|
return (_jsx(GelatoSmartWalletPrivyProviderContext.Provider, { value: {
|
|
86
100
|
gelato: {
|
|
87
101
|
client: smartWalletClient
|
|
88
102
|
},
|
|
103
|
+
logout: logoutWrapper,
|
|
104
|
+
switchNetwork,
|
|
89
105
|
wagmi: {
|
|
90
106
|
config: wagmi.config
|
|
91
|
-
}
|
|
92
|
-
logout: logoutWrapper,
|
|
93
|
-
switchNetwork
|
|
107
|
+
}
|
|
94
108
|
}, children: children }));
|
|
95
109
|
};
|
|
96
110
|
export const GelatoSmartWalletPrivyContextProvider = ({ children, settings }) => {
|
|
97
111
|
const queryClient = new QueryClient();
|
|
98
112
|
const wagmiConfig = settings.wagmi ? createConfig(settings.wagmi.config) : undefined;
|
|
99
|
-
return (_jsx(PrivyProvider, { appId: settings.waas.appId, config: {
|
|
100
|
-
defaultChain: settings.defaultChain ?? settings.wagmi?.config?.chains?.[0] ?? chains.sepolia
|
|
101
|
-
|
|
113
|
+
return (_jsx(PrivyProvider, { appId: settings.waas.appId, clientId: settings.waas.clientId, config: {
|
|
114
|
+
defaultChain: settings.defaultChain ?? settings.wagmi?.config?.chains?.[0] ?? chains.sepolia,
|
|
115
|
+
supportedChains: settings.waas.customChains?.supportedChains
|
|
116
|
+
}, children: _jsx(GelatoSmartWalletPrivyInternal, { apiKey: settings.apiKey, scw: settings.scw, wagmi: { config: wagmiConfig }, children: wagmiConfig ? (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(WagmiProvider, { config: wagmiConfig, children: children }) })) : (children) }) }));
|
|
102
117
|
};
|
|
103
118
|
//# sourceMappingURL=provider.js.map
|
package/_dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,6BAA6B,EAE9B,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACjG,O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