@dogeos/dogeos-sdk 3.0.1 → 3.0.2

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 CHANGED
@@ -1,30 +1,85 @@
1
- # Wallet Connect SDK
1
+ # dogeos-sdk
2
2
 
3
- A lightweight React SDK to integrate crypto wallet connection into your app. It ships with a configurable wallet list modal and basic account actions. The current focus is EVM, built on top of `@tomo-inc/wallet-adaptor-base`, and supports custom wallets and chain configuration.
3
+ A lightweight React SDK for integrating crypto wallet connections into your app. It ships with a configurable wallet list modal and basic account actions. Currently focused on EVM chains, built on top of `@tomo-inc/wallet-adaptor-base`, and supports custom wallets and chain configuration.
4
4
 
5
- ## Quick Start
5
+ ## On This Page
6
+
7
+ - [Installation](#installation)
8
+ - [Setup Provider](#setup-provider)
9
+ - [Displaying the Modal](#displaying-the-modal)
10
+ - [Customize Theme](#customize-theme)
11
+ - [Account Actions](#account-actions)
12
+ - [Advanced Configuration](#advanced-configuration)
13
+ - [Additional Reference](#additional-reference)
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @dogeos/dogeos-sdk
21
+
22
+ ```
23
+
24
+ Or using yarn:
25
+
26
+ ```bash
27
+ yarn add @dogeos/dogeos-sdk
28
+
29
+ ```
30
+
31
+ Or using pnpm:
32
+
33
+ ```bash
34
+ pnpm add @dogeos/dogeos-sdk
35
+
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Setup Provider
41
+
42
+ ### Use React
43
+
44
+ Wrap your app with `WalletConnectProvider` at the root component.
6
45
 
7
46
  ```tsx
8
- // App.tsx — wrap your app with provider (comments in English)
47
+ // App.tsx
9
48
  import React from "react";
10
- import { WalletConnectProvider } from "@tomo-inc/wallet-connect-kit";
49
+ import { WalletConnectProvider } from "@dogeos/dogeos-sdk";
50
+ import "@dogeos/dogeos-sdk/style.css";
51
+ import type { WalletConfig, WalletConnectConfig, WalletConnectProtocolConfig, tomoClientId } from "@dogeos/dogeos-sdk"
52
+
53
+ const config = {
54
+ connectors?: WalletConfig[];
55
+ // Supported chains (for EVM, compatible with viem/Chain)
56
+ chains?: Partial<Record<ChainType, EvmChain[] | any[]>>;
57
+ walletConnectConfig?: WalletConnectProtocolConfig;
58
+ tomoClientId?: string;
59
+ } as WalletConnectConfig;
11
60
 
12
61
  export default function App() {
13
62
  return (
14
- <WalletConnectProvider>
63
+ <WalletConnectProvider config={config}>
15
64
  <YourApp />
16
65
  </WalletConnectProvider>
17
66
  );
18
67
  }
19
68
  ```
20
69
 
21
- ### Open modal, connect and disconnect
70
+ ---
71
+
72
+ ## Displaying the Modal
73
+
74
+ To display the modal for wallet connection, you can use the hooks provided by **dogeos-sdk**.
75
+
76
+ ### Example Code
22
77
 
23
78
  ```tsx
24
79
  import React from "react";
25
- import { useWalletConnect } from "@tomo-inc/wallet-connect-kit";
80
+ import { useWalletConnect } from "@dogeos/dogeos-sdk";
26
81
 
27
- export function ConnectButton() {
82
+ const ConnectButton = () => {
28
83
  const { openModal, isConnected, disconnect } = useWalletConnect();
29
84
 
30
85
  return (
@@ -32,26 +87,44 @@ export function ConnectButton() {
32
87
  {isConnected ? "Disconnect" : "Connect Wallet"}
33
88
  </button>
34
89
  );
35
- }
90
+ };
91
+
92
+ export default ConnectButton;
36
93
  ```
37
94
 
38
- ### Read account and sign
95
+ ### MyDoge Social Login Experience
96
+
97
+ When using the MyDoge theme, the modal will first display the social login interface, supporting:
98
+
99
+ - **Twitter Login** - Quick login with Twitter/X account
100
+ - **Google Login** - Quick login with Google account
101
+ - **Email Login** - Login with email address
102
+
103
+ Users can also select "Or connect a wallet" to directly connect traditional crypto wallets.
104
+
105
+ ---
106
+
107
+ ## Account Actions
108
+
109
+ ### Reading Account Info and Signing
110
+
111
+ After connecting a wallet, you can use the `useAccount` hook to access account information and perform signing operations.
39
112
 
40
113
  ```tsx
41
114
  import React from "react";
42
- import { useAccount } from "@tomo-inc/wallet-connect-kit";
115
+ import { useAccount } from "@dogeos/dogeos-sdk";
43
116
 
44
117
  export function AccountInfo() {
45
118
  const { address, chainId, signMessage, signInWithWallet } = useAccount();
46
119
 
47
120
  const onSignMessage = async () => {
48
121
  // Message signing for verification
49
- const sig = await signMessage?.({ message: "Hello Tomo" });
122
+ const sig = await signMessage?.({ message: "Hello MyDoge" });
50
123
  console.log("signature:", sig);
51
124
  };
52
125
 
53
126
  const onSignin = async () => {
54
- // SIW (sign-in with wallet) to get a token
127
+ // Sign in with wallet to get a token
55
128
  const token = await signInWithWallet();
56
129
  console.log("token:", token);
57
130
  };
@@ -59,7 +132,7 @@ export function AccountInfo() {
59
132
  return (
60
133
  <div>
61
134
  <div>Address: {address}</div>
62
- <div>ChainId: {chainId}</div>
135
+ <div>Chain ID: {chainId}</div>
63
136
  <button onClick={onSignMessage}>Sign Message</button>
64
137
  <button onClick={onSignin}>Sign In With Wallet</button>
65
138
  </div>
@@ -67,83 +140,93 @@ export function AccountInfo() {
67
140
  }
68
141
  ```
69
142
 
70
- ### Optional: custom wallets and chains
143
+ ### Available Account Actions
144
+
145
+ - **address** - Current connected wallet address
146
+ - **chainId** - Current connected chain ID
147
+ - **balance** - Account balance
148
+ - **chainType** - Chain type (e.g., "evm")
149
+ - **currentWallet** - Current wallet information
150
+ - **currentProvider** - Current wallet provider
151
+ - **switchChain** - Switch network
152
+ - **signMessage** - Sign message
153
+ - **signInWithWallet** - Sign in with wallet
154
+
155
+ ---
156
+
157
+ ## Additional Reference
158
+
159
+ ### SDK Exports
160
+
161
+ The SDK provides the following main exports:
162
+
163
+ - **WalletConnectProvider** - Main provider component with optional `config` prop
164
+ - **useWalletConnect** - Hook for modal control and connection state
165
+ - `{ isOpenModal, openModal, closeModal, isConnected, isConnecting, error, connect, disconnect }`
166
+ - **useAccount** - Hook for account info and actions
167
+ - `{ address, balance, chainType, chainId, currentWallet, currentProvider, switchChain, signMessage, signInWithWallet }`
168
+ - **Type Definitions**: `WalletConnectConfig`, `Chain`, `WalletProvider`, `UseAccount`, `UseWalletConnect`, `ChainType`, `ModalView`
169
+
170
+ ### Complete Example
71
171
 
72
172
  ```tsx
73
173
  import React from "react";
74
174
  import {
75
175
  WalletConnectProvider,
76
- type Chain,
77
- } from "@tomo-inc/wallet-connect-kit";
176
+ useWalletConnect,
177
+ useAccount,
178
+ } from "@dogeos/dogeos-sdk";
179
+ import "@dogeos/dogeos-sdk/style.css";
78
180
 
79
- const config = {
80
- // Custom wallet connectors (merge with defaults)
81
- connectors: [
82
- {
83
- id: "my-wallet",
84
- name: "My Wallet",
85
- namespace: "my.wallet",
86
- icon: "https://example.com/icon.png",
87
- iconBackground: "#000",
88
- downloadUrls: { chrome: "https://example.com/install" },
89
- },
90
- ],
91
- // Supported chains by chain type (compatible with viem/Chain for EVM)
92
- chains: {
93
- evm: [
94
- {
95
- id: 1,
96
- name: "Ethereum",
97
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
98
- rpcUrls: { default: { http: ["https://eth.merkle.io"] } },
99
- blockExplorers: {
100
- default: { name: "Etherscan", url: "https://etherscan.io" },
101
- },
102
- } as Chain,
103
- ],
104
- // aptos: [...],
105
- // solana: [...],
106
- },
107
- // Optional: WalletConnect protocol configuration
108
- // walletConnectConfig: { ... },
109
-
110
- // Optional: Embedded wallet configuration for social login
111
- embeddedWalletConfig: {
112
- apiKey: "your-api-key",
113
- // ... other embedded wallet settings
114
- },
115
-
116
- // Optional: Product type for UI theme (default: "tomo")
117
- prodType: "mydoge", // or "tomo"
118
- };
181
+ // Connect Button Component
182
+ function ConnectButton() {
183
+ const { openModal, isConnected, disconnect } = useWalletConnect();
184
+ const { address } = useAccount();
185
+
186
+ if (isConnected && address) {
187
+ return (
188
+ <div>
189
+ <p>
190
+ Connected: {address.slice(0, 6)}...{address.slice(-4)}
191
+ </p>
192
+ <button onClick={disconnect}>Disconnect</button>
193
+ </div>
194
+ );
195
+ }
196
+
197
+ return <button onClick={openModal}>Connect Wallet</button>;
198
+ }
199
+
200
+ // App Component
201
+ function App() {
202
+ // Configuration
203
+ const config = {};
119
204
 
120
- export function AppWithConfig() {
121
205
  return (
122
206
  <WalletConnectProvider config={config}>
123
- <YourApp />
207
+ <div>
208
+ <h1>MyDoge Wallet Connect Example</h1>
209
+ <ConnectButton />
210
+ </div>
124
211
  </WalletConnectProvider>
125
212
  );
126
213
  }
214
+
215
+ export default App;
127
216
  ```
128
217
 
129
- ## Exports
218
+ ---
130
219
 
131
- - `WalletConnectProvider` - Main provider component with optional `config` prop
132
- - `useWalletConnect` - Hook for modal control and connection state: `{ isOpenModal, openModal, closeModal, isConnected, isConnecting, error, connect, disconnect }`
133
- - `useAccount` - Hook for account info and actions: `{ address, balance, chainType, chainId, currentWallet, currentProvider, switchChain, signMessage, signInWithWallet }`
134
- - Types: `WalletConnectConfig`, `Chain`, `WalletProvider`, `UseAccount`, `UseWalletConnect`, `ChainType`, `ModalView`
135
- - Views: `MyDogeSocialLoginView` - Custom MyDoge-styled social login view with Twitter, Google login and email support
220
+ ## Support
136
221
 
137
- ### WalletConnectProvider Config
222
+ For more help or if you encounter issues, please visit:
138
223
 
139
- The `config` prop accepts:
224
+ - [GitHub Issues](https://github.com/DogeOS69/mydoge-sdk)
225
+ - [Support](support@dogeos.com)
226
+ - [Documentation](https://docs.dogeos.com)
140
227
 
141
- - `connectors?: WalletConfig[]` - Custom wallet connectors to merge with defaults
142
- - `chains?: Partial<Record<ChainType, EvmChain[] | any[]>>` - Supported chains by chain type (e.g., `{ evm: [...], aptos: [...], solana: [...] }`)
143
- - `walletConnectConfig?: WalletConnectProtocolConfig` - WalletConnect protocol configuration
144
- - `embeddedWalletConfig?: InitConfig` - Embedded wallet configuration for social login features (API key, OAuth settings, etc.)
145
- - `prodType?: ProdTypeEnum` - Product type to determine UI theme (`"tomo"` or `"mydoge"`). Controls which social login view is displayed by default
228
+ ---
146
229
 
147
- **Note:** When `prodType` is set to `"mydoge"`, the SDK will automatically use the MyDoge-styled UI theme for social login features. Set it to `"tomo"` or leave it unset for the default Tomo theme.
230
+ ## License
148
231
 
149
- For more comprehensive examples, see `EXAMPLE.md` in the same directory.
232
+ Please check the project's LICENSE file for details.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { AdaptorChainType } from '@tomo-inc/wallet-adaptor-base';
2
2
  import { Chain as Chain_2 } from 'viem/chains';
3
3
  import { Connector } from '@tomo-inc/wallet-adaptor-base';
4
- import { InitConfig } from '@tomo-inc/embedded-wallet-providers';
5
4
  import { JSX as JSX_2 } from 'react/jsx-runtime';
6
5
  import { SignInParams } from '@tomo-inc/wallet-adaptor-base';
7
6
  import { WalletConfig } from '@tomo-inc/wallet-adaptor-base';
@@ -159,9 +158,7 @@ export declare interface WalletConnectConfig {
159
158
  connectors?: WalletConfig[];
160
159
  chains?: Partial<Record<ChainType, EvmChain[] | any[]>>;
161
160
  walletConnectConfig?: WalletConnectConfig_2;
162
- embeddedWalletConfig?: InitConfig;
163
- prodType?: ProdTypeEnum;
164
- themeMode?: "light" | "dark";
161
+ tomoClientId?: string;
165
162
  }
166
163
 
167
164
  /**