@coinbase/cdp-wagmi 0.0.98 → 0.0.100
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/dist/esm/index3.js +1 -1
- package/dist/types/index.d.ts +80 -0
- package/package.json +3 -3
package/dist/esm/index3.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -4,6 +4,86 @@ import { createConnector } from 'wagmi';
|
|
|
4
4
|
|
|
5
5
|
export declare const CDP_CONNECTOR_ID = "cdp-embedded-wallet";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Creates a wagmi-compatible connector that wraps our EIP1193 provider.
|
|
9
|
+
* Some internals referenced from https://github.com/wevm/wagmi/blob/main/packages/connectors/src/coinbaseWallet.ts
|
|
10
|
+
* In order to connect a CDP wallet the user must first sign in via our hooks or prebuilt SignIn component.
|
|
11
|
+
* The connector will automatically emit the connect event when the user is connected.
|
|
12
|
+
*
|
|
13
|
+
* @param parameters - Configuration parameters for the connector
|
|
14
|
+
* @param parameters.cdpConfig - {Config} - CDP core SDK configuration
|
|
15
|
+
* @param parameters.providerConfig - {CDPEmbeddedWalletConfig} - Configuration for the EIP1193 provider
|
|
16
|
+
* @returns A wagmi-compatible connector that wraps the EIP1193 provider
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript lines
|
|
19
|
+
* import { createCDPEmbeddedWalletConnector } from "@coinbase/cdp-wagmi";
|
|
20
|
+
* import { createConfig, http } from "wagmi";
|
|
21
|
+
* import { baseSepolia, sepolia } from "viem/chains";
|
|
22
|
+
*
|
|
23
|
+
* // Create the CDP connector
|
|
24
|
+
* const cdpConnector = createCDPEmbeddedWalletConnector({
|
|
25
|
+
* cdpConfig: {
|
|
26
|
+
* projectId: "your-project-id",
|
|
27
|
+
* },
|
|
28
|
+
* providerConfig: {
|
|
29
|
+
* chains: [baseSepolia, sepolia],
|
|
30
|
+
* transports: {
|
|
31
|
+
* [baseSepolia.id]: http(),
|
|
32
|
+
* [sepolia.id]: http(),
|
|
33
|
+
* },
|
|
34
|
+
* announceProvider: true,
|
|
35
|
+
* },
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* // Use with wagmi config
|
|
39
|
+
* const config = createConfig({
|
|
40
|
+
* chains: [baseSepolia, sepolia],
|
|
41
|
+
* connectors: [cdpConnector],
|
|
42
|
+
* transports: {
|
|
43
|
+
* [baseSepolia.id]: http(),
|
|
44
|
+
* [sepolia.id]: http(),
|
|
45
|
+
* },
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript lines
|
|
50
|
+
* import { createCDPEmbeddedWalletConnector } from "@coinbase/cdp-wagmi";
|
|
51
|
+
* import { useConnect, useAccount, useDisconnect } from "wagmi";
|
|
52
|
+
* import { baseSepolia } from "viem/chains";
|
|
53
|
+
* import { SignIn } from "@coinbase/cdp-react";
|
|
54
|
+
*
|
|
55
|
+
* // Create connector with minimal configuration
|
|
56
|
+
* const cdpConnector = createCDPEmbeddedWalletConnector({
|
|
57
|
+
* cdpConfig: {
|
|
58
|
+
* projectId: "your-project-id",
|
|
59
|
+
* },
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* function SignInComponent() {
|
|
63
|
+
* const { address } = useAccount();
|
|
64
|
+
*
|
|
65
|
+
* if (!address) {
|
|
66
|
+
* return (
|
|
67
|
+
* <SignIn />
|
|
68
|
+
* )
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* return (
|
|
72
|
+
* <WalletComponent />
|
|
73
|
+
* )
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* function WalletComponent() {
|
|
77
|
+
* const { address } = useAccount();
|
|
78
|
+
*
|
|
79
|
+
* return (
|
|
80
|
+
* <div>
|
|
81
|
+
* Connected with CDP Wallet: {address}
|
|
82
|
+
* </div>
|
|
83
|
+
* );
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
7
87
|
export declare function createCDPEmbeddedWalletConnector(parameters: {
|
|
8
88
|
cdpConfig: Config;
|
|
9
89
|
providerConfig: CDPEmbeddedWalletConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-wagmi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"react": ">=18.2.0",
|
|
20
20
|
"viem": "^2.47.0",
|
|
21
21
|
"wagmi": "^2.16.0",
|
|
22
|
-
"@coinbase/cdp-core": "^0.0.
|
|
22
|
+
"@coinbase/cdp-core": "^0.0.100"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@size-limit/webpack": "^11.2.0",
|
|
36
36
|
"@size-limit/webpack-why": "^11.2.0",
|
|
37
37
|
"size-limit": "^11.2.0",
|
|
38
|
-
"@coinbase/cdp-core": "^0.0.
|
|
38
|
+
"@coinbase/cdp-core": "^0.0.100"
|
|
39
39
|
},
|
|
40
40
|
"size-limit": [
|
|
41
41
|
{
|