@coinbase/cdp-hooks 0.0.33 → 0.0.34
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/README.md +155 -7
- package/dist/esm/index.js +18 -15
- package/dist/esm/index3.js +95 -85
- package/dist/types/index.d.ts +17 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -153,6 +153,27 @@ function App() {
|
|
|
153
153
|
|
|
154
154
|
* When `createAccountOnLogin` is set to `"evm-smart"`, new users will automatically get both an EOA and a Smart Account.
|
|
155
155
|
|
|
156
|
+
#### Solana Configuration
|
|
157
|
+
|
|
158
|
+
You can configure the provider to create Solana accounts for new users:
|
|
159
|
+
|
|
160
|
+
```tsx lines
|
|
161
|
+
function App() {
|
|
162
|
+
return (
|
|
163
|
+
<CDPHooksProvider
|
|
164
|
+
config={{
|
|
165
|
+
projectId: "your-project-id",
|
|
166
|
+
createAccountOnLogin: "solana", // Creates Solana accounts instead of EVM accounts
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
<App />
|
|
170
|
+
</CDPHooksProvider>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
* When `createAccountOnLogin` is set to `"solana"`, new users will automatically get a Solana account instead of EVM accounts.
|
|
176
|
+
|
|
156
177
|
### Sign In a User
|
|
157
178
|
|
|
158
179
|
End user authentication proceeds in two steps:
|
|
@@ -184,8 +205,17 @@ function SignIn() {
|
|
|
184
205
|
});
|
|
185
206
|
|
|
186
207
|
console.log("Signed in user:", user);
|
|
187
|
-
|
|
188
|
-
|
|
208
|
+
|
|
209
|
+
// Access different account types based on configuration
|
|
210
|
+
if (user.evmAccounts?.length > 0) {
|
|
211
|
+
console.log("User EVM address (EOA):", user.evmAccounts[0]);
|
|
212
|
+
}
|
|
213
|
+
if (user.evmSmartAccounts?.length > 0) {
|
|
214
|
+
console.log("User Smart Account:", user.evmSmartAccounts[0]);
|
|
215
|
+
}
|
|
216
|
+
if (user.solanaAccounts?.length > 0) {
|
|
217
|
+
console.log("User Solana address:", user.solanaAccounts[0]);
|
|
218
|
+
}
|
|
189
219
|
} catch (error) {
|
|
190
220
|
console.error("Sign in failed:", error);
|
|
191
221
|
}
|
|
@@ -334,11 +364,129 @@ function UserInformation() {
|
|
|
334
364
|
<div>
|
|
335
365
|
<h2>User Information</h2>
|
|
336
366
|
<p>User ID: {user.userId}</p>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
<p>
|
|
340
|
-
|
|
341
|
-
|
|
367
|
+
|
|
368
|
+
<>
|
|
369
|
+
<p>EVM Address (EOA): {evmAddress}</p>
|
|
370
|
+
{user.evmSmartAccounts?.[0] && (
|
|
371
|
+
<p>Smart Account: {user.evmSmartAccounts[0]}</p>
|
|
372
|
+
)}
|
|
373
|
+
</>
|
|
374
|
+
|
|
375
|
+
{emailAddress && <p>Email Address: {emailAddress}</p>}
|
|
376
|
+
</div>
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Working with Solana
|
|
382
|
+
|
|
383
|
+
When your application is configured with `createAccountOnLogin: "solana"`, you can use Solana-specific hooks to interact with Solana accounts.
|
|
384
|
+
|
|
385
|
+
#### Access Solana Address
|
|
386
|
+
|
|
387
|
+
Use the `useSolanaAddress` hook to get the user's primary Solana address:
|
|
388
|
+
|
|
389
|
+
```tsx lines
|
|
390
|
+
import { useSolanaAddress } from "@coinbase/cdp-hooks";
|
|
391
|
+
|
|
392
|
+
function SolanaWallet() {
|
|
393
|
+
const { solanaAddress } = useSolanaAddress();
|
|
394
|
+
|
|
395
|
+
if (!solanaAddress) {
|
|
396
|
+
return <div>No Solana wallet connected</div>;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return (
|
|
400
|
+
<div>
|
|
401
|
+
<h3>Your Solana Wallet</h3>
|
|
402
|
+
<p>Address: {solanaAddress}</p>
|
|
403
|
+
</div>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
#### Sign a Solana Transaction
|
|
409
|
+
|
|
410
|
+
Use the `useSignSolanaTransaction` hook to sign Solana transactions:
|
|
411
|
+
|
|
412
|
+
```tsx lines
|
|
413
|
+
import { useSignSolanaTransaction, useSolanaAddress } from "@coinbase/cdp-hooks";
|
|
414
|
+
|
|
415
|
+
function SolanaTransactionSigner() {
|
|
416
|
+
const { signSolanaTransaction } = useSignSolanaTransaction();
|
|
417
|
+
const { solanaAddress } = useSolanaAddress();
|
|
418
|
+
|
|
419
|
+
const handleSignTransaction = async () => {
|
|
420
|
+
if (!solanaAddress) return;
|
|
421
|
+
|
|
422
|
+
try {
|
|
423
|
+
const result = await signSolanaTransaction({
|
|
424
|
+
solanaAccount: solanaAddress,
|
|
425
|
+
transaction: "base64-encoded-solana-transaction" // Your Solana transaction here
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
console.log("Signed Transaction:", result.signedTransaction);
|
|
429
|
+
// The signedTransaction can now be broadcast to the Solana network
|
|
430
|
+
} catch (error) {
|
|
431
|
+
console.error("Failed to sign transaction:", error);
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
if (!solanaAddress) {
|
|
436
|
+
return <div>Please connect your Solana wallet first</div>;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return (
|
|
440
|
+
<div>
|
|
441
|
+
<h3>Sign Solana Transaction</h3>
|
|
442
|
+
<button onClick={handleSignTransaction}>
|
|
443
|
+
Sign Transaction
|
|
444
|
+
</button>
|
|
445
|
+
</div>
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
#### Send a Solana Transaction
|
|
451
|
+
|
|
452
|
+
Use the `useSendSolanaTransaction` hook to sign and send Solana transactions in a single action. This is supported on:
|
|
453
|
+
- Solana Mainnet
|
|
454
|
+
- Solana Devnet
|
|
455
|
+
|
|
456
|
+
```tsx lines
|
|
457
|
+
import { useSendSolanaTransaction, useSolanaAddress } from "@coinbase/cdp-hooks";
|
|
458
|
+
|
|
459
|
+
function SolanaTransactionSender() {
|
|
460
|
+
const { sendSolanaTransaction } = useSendSolanaTransaction();
|
|
461
|
+
const { solanaAddress } = useSolanaAddress();
|
|
462
|
+
|
|
463
|
+
const handleSendTransaction = async () => {
|
|
464
|
+
if (!solanaAddress) return;
|
|
465
|
+
|
|
466
|
+
try {
|
|
467
|
+
const result = await sendSolanaTransaction({
|
|
468
|
+
solanaAccount: solanaAddress,
|
|
469
|
+
network: "solana-devnet", // or "solana" for mainnet
|
|
470
|
+
transaction: "base64-encoded-solana-transaction" // Your Solana transaction here
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
console.log("Transaction Signature:", result.transactionSignature);
|
|
474
|
+
// The transaction has been broadcast to the Solana network
|
|
475
|
+
} catch (error) {
|
|
476
|
+
console.error("Failed to send transaction:", error);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
if (!solanaAddress) {
|
|
481
|
+
return <div>Please connect your Solana wallet first</div>;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return (
|
|
485
|
+
<div>
|
|
486
|
+
<h3>Send Solana Transaction</h3>
|
|
487
|
+
<button onClick={handleSendTransaction}>
|
|
488
|
+
Send Transaction
|
|
489
|
+
</button>
|
|
342
490
|
</div>
|
|
343
491
|
);
|
|
344
492
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import { APIError as n } from "@coinbase/cdp-core";
|
|
2
2
|
import { CDPContext as i, CDPHooksProvider as u } from "./index2.js";
|
|
3
|
-
import { useConfig as o, useCurrentUser as
|
|
3
|
+
import { useConfig as o, useCurrentUser as t, useEnforceAuthenticated as S, useEnforceUnauthenticated as m, useEvmAddress as d, useExportEvmAccount as E, useGetAccessToken as c, useIsInitialized as g, useIsSignedIn as f, useSendEvmTransaction as v, useSendSolanaTransaction as T, useSendUserOperation as p, useSignEvmHash as I, useSignEvmMessage as l, useSignEvmTransaction as A, useSignEvmTypedData as P, useSignInWithEmail as h, useSignInWithSms as x, useSignOut as C, useSignSolanaTransaction as O, useSolanaAddress as U, useVerifyEmailOTP as y, useVerifySmsOTP as D, useWaitForUserOperation as W } from "./index3.js";
|
|
4
4
|
export {
|
|
5
5
|
n as APIError,
|
|
6
6
|
i as CDPContext,
|
|
7
7
|
u as CDPHooksProvider,
|
|
8
8
|
o as useConfig,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
t as useCurrentUser,
|
|
10
|
+
S as useEnforceAuthenticated,
|
|
11
|
+
m as useEnforceUnauthenticated,
|
|
12
|
+
d as useEvmAddress,
|
|
13
|
+
E as useExportEvmAccount,
|
|
14
|
+
c as useGetAccessToken,
|
|
15
15
|
g as useIsInitialized,
|
|
16
16
|
f as useIsSignedIn,
|
|
17
17
|
v as useSendEvmTransaction,
|
|
18
|
+
T as useSendSolanaTransaction,
|
|
18
19
|
p as useSendUserOperation,
|
|
19
20
|
I as useSignEvmHash,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
l as useSignEvmMessage,
|
|
22
|
+
A as useSignEvmTransaction,
|
|
23
|
+
P as useSignEvmTypedData,
|
|
24
|
+
h as useSignInWithEmail,
|
|
25
|
+
x as useSignInWithSms,
|
|
25
26
|
C as useSignOut,
|
|
26
|
-
O as
|
|
27
|
-
U as
|
|
28
|
-
|
|
27
|
+
O as useSignSolanaTransaction,
|
|
28
|
+
U as useSolanaAddress,
|
|
29
|
+
y as useVerifyEmailOTP,
|
|
30
|
+
D as useVerifySmsOTP,
|
|
31
|
+
W as useWaitForUserOperation
|
|
29
32
|
};
|
package/dist/esm/index3.js
CHANGED
|
@@ -1,77 +1,84 @@
|
|
|
1
|
-
import { getAccessToken as y, sendUserOperation as O, signInWithEmail as
|
|
2
|
-
import { useState as u, useEffect as
|
|
1
|
+
import { getAccessToken as y, sendUserOperation as O, signInWithEmail as A, signInWithSms as I, verifyEmailOTP as U, verifySmsOTP as P, signOut as k, signEvmHash as C, signEvmTransaction as W, sendEvmTransaction as H, signEvmMessage as x, signEvmTypedData as b, exportEvmAccount as D, signSolanaTransaction as M, sendSolanaTransaction as V, getUserOperation as F } from "@coinbase/cdp-core";
|
|
2
|
+
import { useState as u, useEffect as f, useMemo as z, useCallback as h } from "react";
|
|
3
3
|
import { useCDP as p } from "./index2.js";
|
|
4
|
-
import { useAutoPolling as
|
|
5
|
-
import { getPublicClient as
|
|
6
|
-
const
|
|
7
|
-
const { config:
|
|
8
|
-
return { config:
|
|
9
|
-
},
|
|
10
|
-
const { isInitialized:
|
|
11
|
-
return { isInitialized:
|
|
12
|
-
},
|
|
13
|
-
const { isSignedIn:
|
|
14
|
-
return { isSignedIn:
|
|
15
|
-
},
|
|
16
|
-
const { currentUser:
|
|
17
|
-
return { currentUser:
|
|
18
|
-
},
|
|
19
|
-
const { currentUser:
|
|
4
|
+
import { useAutoPolling as G } from "./index4.js";
|
|
5
|
+
import { getPublicClient as j } from "./index5.js";
|
|
6
|
+
const Q = () => {
|
|
7
|
+
const { config: n } = p();
|
|
8
|
+
return { config: n };
|
|
9
|
+
}, X = () => {
|
|
10
|
+
const { isInitialized: n } = p();
|
|
11
|
+
return { isInitialized: n };
|
|
12
|
+
}, Y = () => ({ signInWithEmail: S(A) }), Z = () => ({ signInWithSms: S(I) }), _ = () => ({ verifyEmailOTP: S(U) }), $ = () => ({ verifySmsOTP: S(P) }), R = () => {
|
|
13
|
+
const { isSignedIn: n } = p();
|
|
14
|
+
return { isSignedIn: n };
|
|
15
|
+
}, w = () => {
|
|
16
|
+
const { currentUser: n } = p();
|
|
17
|
+
return { currentUser: n };
|
|
18
|
+
}, nn = () => ({ signOut: i(k) }), en = () => ({ getAccessToken: y }), tn = () => {
|
|
19
|
+
const { currentUser: n } = w();
|
|
20
|
+
return {
|
|
21
|
+
evmAddress: n?.evmSmartAccounts?.[0] ?? n?.evmAccounts?.[0] ?? null
|
|
22
|
+
};
|
|
23
|
+
}, rn = () => {
|
|
24
|
+
const { currentUser: n } = w();
|
|
20
25
|
return {
|
|
21
|
-
|
|
26
|
+
solanaAddress: n?.solanaAccounts?.[0] ?? null
|
|
22
27
|
};
|
|
23
|
-
},
|
|
24
|
-
const [
|
|
25
|
-
async (
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
+
}, sn = () => ({ signEvmHash: i(C) }), an = () => ({ signEvmTransaction: i(W) }), on = () => {
|
|
29
|
+
const [n, e] = u(null), [s, t] = u(null), [c, l] = u(null), { config: a } = p(), d = i(
|
|
30
|
+
async (g) => {
|
|
31
|
+
const o = await H(g);
|
|
32
|
+
return e({ hash: o.transactionHash, network: g.network }), l(null), t(null), o;
|
|
28
33
|
}
|
|
29
34
|
);
|
|
30
|
-
|
|
31
|
-
if (!
|
|
35
|
+
f(() => {
|
|
36
|
+
if (!n) return;
|
|
32
37
|
(async () => {
|
|
33
38
|
try {
|
|
34
|
-
const
|
|
35
|
-
hash:
|
|
39
|
+
const E = await j(n.network, a).waitForTransactionReceipt({
|
|
40
|
+
hash: n.hash
|
|
36
41
|
});
|
|
37
|
-
t(
|
|
38
|
-
} catch (
|
|
39
|
-
|
|
42
|
+
t(E);
|
|
43
|
+
} catch (o) {
|
|
44
|
+
l(o instanceof Error ? o : new Error(String(o)));
|
|
40
45
|
}
|
|
41
46
|
})();
|
|
42
|
-
}, [
|
|
43
|
-
const m =
|
|
47
|
+
}, [n]);
|
|
48
|
+
const m = z(() => n ? s ? { status: "success", receipt: s } : c ? { status: "error", error: c } : { status: "pending", hash: n.hash } : { status: "idle" }, [n, s, c]);
|
|
44
49
|
return {
|
|
45
50
|
sendEvmTransaction: d,
|
|
46
51
|
data: m
|
|
47
52
|
};
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
}, cn = () => ({ signEvmMessage: i(x) }), un = () => ({ signEvmTypedData: i(b) }), pn = () => ({ exportEvmAccount: i(D) }), dn = () => ({ signSolanaTransaction: i(M) }), mn = () => ({
|
|
54
|
+
sendSolanaTransaction: i(V)
|
|
55
|
+
}), i = (n) => {
|
|
56
|
+
const { isSignedIn: e } = p();
|
|
57
|
+
return h(
|
|
51
58
|
async (...t) => {
|
|
52
|
-
if (!
|
|
59
|
+
if (!e)
|
|
53
60
|
throw new Error("User is not authenticated");
|
|
54
|
-
return
|
|
61
|
+
return n(...t);
|
|
55
62
|
},
|
|
56
|
-
[
|
|
63
|
+
[e, n]
|
|
57
64
|
);
|
|
58
|
-
},
|
|
59
|
-
const { isSignedIn:
|
|
60
|
-
return
|
|
65
|
+
}, S = (n) => {
|
|
66
|
+
const { isSignedIn: e } = p();
|
|
67
|
+
return h(
|
|
61
68
|
async (...t) => {
|
|
62
|
-
if (
|
|
69
|
+
if (e)
|
|
63
70
|
throw new Error("User is already authenticated. Please sign out first.");
|
|
64
|
-
return
|
|
71
|
+
return n(...t);
|
|
65
72
|
},
|
|
66
|
-
[
|
|
73
|
+
[e, n]
|
|
67
74
|
);
|
|
68
|
-
},
|
|
69
|
-
const [
|
|
75
|
+
}, ln = () => {
|
|
76
|
+
const [n, e] = u(void 0), { status: s, data: t, error: c } = q(n);
|
|
70
77
|
return {
|
|
71
|
-
sendUserOperation:
|
|
78
|
+
sendUserOperation: i(
|
|
72
79
|
async (a) => {
|
|
73
80
|
const d = await O(a);
|
|
74
|
-
return
|
|
81
|
+
return e({
|
|
75
82
|
userOperationHash: d.userOperationHash,
|
|
76
83
|
evmSmartAccount: a.evmSmartAccount,
|
|
77
84
|
network: a.network
|
|
@@ -79,20 +86,20 @@ const L = () => {
|
|
|
79
86
|
}
|
|
80
87
|
),
|
|
81
88
|
data: t,
|
|
82
|
-
error:
|
|
89
|
+
error: c,
|
|
83
90
|
status: s
|
|
84
91
|
};
|
|
85
|
-
},
|
|
86
|
-
const { userOperationHash:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}, [
|
|
90
|
-
const v =
|
|
91
|
-
return
|
|
92
|
+
}, q = (n = {}) => {
|
|
93
|
+
const { userOperationHash: e, evmSmartAccount: s, network: t, enabled: c } = n, [l, a] = u("idle"), [d, m] = u(void 0), [g, o] = u(void 0), { currentUser: E } = w();
|
|
94
|
+
f(() => {
|
|
95
|
+
e && s && t && (a(c !== !1 ? "pending" : "idle"), m(void 0), o(void 0));
|
|
96
|
+
}, [e, s, t, c]);
|
|
97
|
+
const v = c !== !1 && !!(e && s && t && E);
|
|
98
|
+
return G(
|
|
92
99
|
{
|
|
93
100
|
pollFn: async () => {
|
|
94
|
-
const r = await
|
|
95
|
-
userOperationHash:
|
|
101
|
+
const r = await F({
|
|
102
|
+
userOperationHash: e,
|
|
96
103
|
evmSmartAccount: s,
|
|
97
104
|
network: t
|
|
98
105
|
});
|
|
@@ -105,41 +112,44 @@ const L = () => {
|
|
|
105
112
|
m(r), a("success");
|
|
106
113
|
else if (r.status === "failed") {
|
|
107
114
|
const T = r.receipts?.[0]?.revert?.message || "User operation failed";
|
|
108
|
-
|
|
115
|
+
o(new Error(T)), a("error");
|
|
109
116
|
} else
|
|
110
117
|
m(r), a("error");
|
|
111
118
|
},
|
|
112
119
|
onError: (r) => {
|
|
113
|
-
|
|
120
|
+
o(r), a("error");
|
|
114
121
|
}
|
|
115
122
|
},
|
|
116
|
-
[
|
|
123
|
+
[e, s, t, v]
|
|
117
124
|
), {
|
|
118
|
-
status:
|
|
125
|
+
status: l,
|
|
119
126
|
data: d,
|
|
120
|
-
error:
|
|
127
|
+
error: g
|
|
121
128
|
};
|
|
122
129
|
};
|
|
123
130
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
131
|
+
Q as useConfig,
|
|
132
|
+
w as useCurrentUser,
|
|
133
|
+
i as useEnforceAuthenticated,
|
|
134
|
+
S as useEnforceUnauthenticated,
|
|
135
|
+
tn as useEvmAddress,
|
|
136
|
+
pn as useExportEvmAccount,
|
|
137
|
+
en as useGetAccessToken,
|
|
138
|
+
X as useIsInitialized,
|
|
139
|
+
R as useIsSignedIn,
|
|
140
|
+
on as useSendEvmTransaction,
|
|
141
|
+
mn as useSendSolanaTransaction,
|
|
142
|
+
ln as useSendUserOperation,
|
|
143
|
+
sn as useSignEvmHash,
|
|
144
|
+
cn as useSignEvmMessage,
|
|
145
|
+
an as useSignEvmTransaction,
|
|
146
|
+
un as useSignEvmTypedData,
|
|
147
|
+
Y as useSignInWithEmail,
|
|
148
|
+
Z as useSignInWithSms,
|
|
149
|
+
nn as useSignOut,
|
|
150
|
+
dn as useSignSolanaTransaction,
|
|
151
|
+
rn as useSolanaAddress,
|
|
152
|
+
_ as useVerifyEmailOTP,
|
|
153
|
+
$ as useVerifySmsOTP,
|
|
154
|
+
q as useWaitForUserOperation
|
|
145
155
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ import { ReactNode } from 'react';
|
|
|
16
16
|
import { SendEvmTransactionOptions } from '@coinbase/cdp-core';
|
|
17
17
|
import { SendEvmTransactionResult } from '@coinbase/cdp-core';
|
|
18
18
|
import { SendEvmTransactionWithEndUserAccountBodyNetwork } from '@coinbase/cdp-core';
|
|
19
|
+
import { SendSolanaTransactionOptions } from '@coinbase/cdp-core';
|
|
20
|
+
import { SendSolanaTransactionResult } from '@coinbase/cdp-core';
|
|
19
21
|
import { SendUserOperationOptions } from '@coinbase/cdp-core';
|
|
20
22
|
import { SendUserOperationResult } from '@coinbase/cdp-core';
|
|
21
23
|
import { SignEvmHashOptions } from '@coinbase/cdp-core';
|
|
@@ -30,6 +32,9 @@ import { SignInWithEmailOptions } from '@coinbase/cdp-core';
|
|
|
30
32
|
import { SignInWithEmailResult } from '@coinbase/cdp-core';
|
|
31
33
|
import { SignInWithSmsOptions } from '@coinbase/cdp-core';
|
|
32
34
|
import { SignInWithSmsResult } from '@coinbase/cdp-core';
|
|
35
|
+
import { SignSolanaTransactionOptions } from '@coinbase/cdp-core';
|
|
36
|
+
import { SignSolanaTransactionResult } from '@coinbase/cdp-core';
|
|
37
|
+
import { SolanaAddress } from '@coinbase/cdp-core';
|
|
33
38
|
import { TransactionReceipt } from 'viem';
|
|
34
39
|
import { Transport } from 'viem';
|
|
35
40
|
import { User } from '@coinbase/cdp-core';
|
|
@@ -154,6 +159,10 @@ export declare const useSendEvmTransaction: () => {
|
|
|
154
159
|
data: TransactionState;
|
|
155
160
|
};
|
|
156
161
|
|
|
162
|
+
export declare const useSendSolanaTransaction: () => {
|
|
163
|
+
sendSolanaTransaction: (options: SendSolanaTransactionOptions) => Promise<SendSolanaTransactionResult>;
|
|
164
|
+
};
|
|
165
|
+
|
|
157
166
|
export declare const useSendUserOperation: () => UseSendUserOperationReturnType;
|
|
158
167
|
|
|
159
168
|
export declare type UseSendUserOperationReturnType = {
|
|
@@ -191,6 +200,14 @@ export declare const useSignOut: () => {
|
|
|
191
200
|
signOut: () => Promise<void>;
|
|
192
201
|
};
|
|
193
202
|
|
|
203
|
+
export declare const useSignSolanaTransaction: () => {
|
|
204
|
+
signSolanaTransaction: (options: SignSolanaTransactionOptions) => Promise<SignSolanaTransactionResult>;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export declare const useSolanaAddress: () => {
|
|
208
|
+
solanaAddress: SolanaAddress | null;
|
|
209
|
+
};
|
|
210
|
+
|
|
194
211
|
export declare const useVerifyEmailOTP: () => {
|
|
195
212
|
verifyEmailOTP: (options: VerifyEmailOTPOptions) => Promise<VerifyEmailOTPResult>;
|
|
196
213
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-hooks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": ">=18.2.0",
|
|
17
|
-
"@coinbase/cdp-core": "^0.0.
|
|
17
|
+
"@coinbase/cdp-core": "^0.0.34"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@size-limit/webpack": "^11.2.0",
|
|
30
30
|
"@size-limit/webpack-why": "^11.2.0",
|
|
31
31
|
"size-limit": "^11.2.0",
|
|
32
|
-
"@coinbase/cdp-core": "^0.0.
|
|
32
|
+
"@coinbase/cdp-core": "^0.0.34"
|
|
33
33
|
},
|
|
34
34
|
"size-limit": [
|
|
35
35
|
{
|