@dogeos/dogeos-sdk 3.3.0-beta.2 → 4.0.0-beta.10
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 +39 -31
- package/dist/dogeos-sdk.css +1 -1
- package/dist/index.d.ts +41 -11
- package/dist/index.js +38018 -19711
- package/package.json +37 -17
package/README.md
CHANGED
|
@@ -7,6 +7,20 @@ A lightweight React SDK for integrating crypto wallet connection functionality i
|
|
|
7
7
|
- React 18 or higher
|
|
8
8
|
- TypeScript 5 or higher (recommended)
|
|
9
9
|
|
|
10
|
+
## SDK deployment configuration
|
|
11
|
+
|
|
12
|
+
The npm package is built with deployment-owned public service destinations. The release job must provide:
|
|
13
|
+
|
|
14
|
+
- `DOGEOS_SDK_WEB3_ASSETS_BASE_URL`
|
|
15
|
+
- `DOGEOS_OIDC_AUTH_RELAY_BASE_URL`
|
|
16
|
+
- `DOGEOS_EMBEDDED_WALLET_BASE_URL`
|
|
17
|
+
- `DOGEOS_EMBEDDED_WALLET_STAGE`
|
|
18
|
+
- `DOGEOS_SDK_AUTH_SERVICE_ORIGINS` (comma-separated gateway/service origins)
|
|
19
|
+
|
|
20
|
+
The build fails when any required value is missing or invalid. These values are compiled into the published SDK and are not consumer provider options.
|
|
21
|
+
|
|
22
|
+
The SDK directory is a library-only package. Consumers resolve it through its public `dist` export.
|
|
23
|
+
|
|
10
24
|
## Installation
|
|
11
25
|
|
|
12
26
|
Install Wallet Connect Kit using your preferred package manager:
|
|
@@ -161,9 +175,9 @@ export function SignInButton() {
|
|
|
161
175
|
|
|
162
176
|
const handleSignIn = async () => {
|
|
163
177
|
try {
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
178
|
+
const proof = await signInWithWallet();
|
|
179
|
+
// Send the short-lived proof directly to your backend. Never log it or persist it in localStorage.
|
|
180
|
+
await sendProofToBackend(proof);
|
|
167
181
|
} catch (error) {
|
|
168
182
|
console.error("Sign in failed:", error);
|
|
169
183
|
}
|
|
@@ -179,7 +193,7 @@ export function SignInButton() {
|
|
|
179
193
|
|
|
180
194
|
## Configuration
|
|
181
195
|
|
|
182
|
-
`WalletConnectProvider` accepts
|
|
196
|
+
`WalletConnectProvider` accepts a `config` prop to customize the SDK's behavior.
|
|
183
197
|
|
|
184
198
|
### Basic Configuration
|
|
185
199
|
|
|
@@ -188,17 +202,7 @@ import { WalletConnectProvider } from "@dogeos/dogeos-sdk";
|
|
|
188
202
|
import type { WalletConnectKitConfig } from "@dogeos/dogeos-sdk";
|
|
189
203
|
|
|
190
204
|
const dogeConfig: WalletConnectKitConfig = {
|
|
191
|
-
// WalletConnect project ID (obtain from https://cloud.walletconnect.com)
|
|
192
|
-
walletConnectProjectId: "your-project-id",
|
|
193
|
-
|
|
194
205
|
clientId: "your-client-id",
|
|
195
|
-
// Application metadata
|
|
196
|
-
metadata: {
|
|
197
|
-
name: "My DApp",
|
|
198
|
-
description: "My decentralized application",
|
|
199
|
-
url: "https://myapp.com",
|
|
200
|
-
icons: ["https://myapp.com/icon.png"],
|
|
201
|
-
},
|
|
202
206
|
};
|
|
203
207
|
|
|
204
208
|
export function App() {
|
|
@@ -213,6 +217,7 @@ export function App() {
|
|
|
213
217
|
### Configure Supported Chains
|
|
214
218
|
|
|
215
219
|
Chains are automatically loaded by default. If you need to customize chains, use the `getChains()` method:
|
|
220
|
+
The examples below extend the `dogeConfig` object from the basic configuration example.
|
|
216
221
|
|
|
217
222
|
```tsx
|
|
218
223
|
import { WalletConnectProvider, getChains } from "@dogeos/dogeos-sdk";
|
|
@@ -228,7 +233,7 @@ export function App() {
|
|
|
228
233
|
}, []);
|
|
229
234
|
|
|
230
235
|
return (
|
|
231
|
-
<WalletConnectProvider config={{
|
|
236
|
+
<WalletConnectProvider config={{ ...dogeConfig, chains }}>
|
|
232
237
|
<YourApp />
|
|
233
238
|
</WalletConnectProvider>
|
|
234
239
|
);
|
|
@@ -253,7 +258,7 @@ export function App() {
|
|
|
253
258
|
}, []);
|
|
254
259
|
|
|
255
260
|
return (
|
|
256
|
-
<WalletConnectProvider config={{
|
|
261
|
+
<WalletConnectProvider config={{ ...dogeConfig, connectors }}>
|
|
257
262
|
<YourApp />
|
|
258
263
|
</WalletConnectProvider>
|
|
259
264
|
);
|
|
@@ -268,6 +273,7 @@ You can configure supported login methods, including basic logins (email, extern
|
|
|
268
273
|
import { WalletConnectProvider } from "@dogeos/dogeos-sdk";
|
|
269
274
|
|
|
270
275
|
const config = {
|
|
276
|
+
...dogeConfig,
|
|
271
277
|
login: {
|
|
272
278
|
// Basic login methods
|
|
273
279
|
basicLogins: ["email", "externalWallets"], // or ["email"] or ["externalWallets"]
|
|
@@ -278,7 +284,6 @@ const config = {
|
|
|
278
284
|
{ type: "x" },
|
|
279
285
|
],
|
|
280
286
|
},
|
|
281
|
-
clientId: "your-client-id",
|
|
282
287
|
};
|
|
283
288
|
|
|
284
289
|
export function App() {
|
|
@@ -290,7 +295,12 @@ export function App() {
|
|
|
290
295
|
}
|
|
291
296
|
```
|
|
292
297
|
|
|
293
|
-
|
|
298
|
+
Provider OAuth client IDs and credentials are owned by the DogeOS authentication
|
|
299
|
+
authority for each environment. Consumer applications select the enabled login
|
|
300
|
+
controls and provide only their registered DogeOS client ID. A successful SDK
|
|
301
|
+
login continues to the associated embedded wallet automatically; returning
|
|
302
|
+
wallet connections are restored by the provider without consumer session
|
|
303
|
+
plumbing.
|
|
294
304
|
|
|
295
305
|
### Configure Theme
|
|
296
306
|
|
|
@@ -301,6 +311,7 @@ import { WalletConnectProvider } from "@dogeos/dogeos-sdk";
|
|
|
301
311
|
import type { ThemeConfig } from "@dogeos/dogeos-sdk";
|
|
302
312
|
|
|
303
313
|
const config = {
|
|
314
|
+
...dogeConfig,
|
|
304
315
|
theme: {
|
|
305
316
|
themes: {
|
|
306
317
|
light: {
|
|
@@ -325,7 +336,6 @@ const config = {
|
|
|
325
336
|
},
|
|
326
337
|
},
|
|
327
338
|
} as ThemeConfig,
|
|
328
|
-
clientId: "your-client-id",
|
|
329
339
|
};
|
|
330
340
|
|
|
331
341
|
export function App() {
|
|
@@ -389,7 +399,10 @@ export function App() {
|
|
|
389
399
|
// Login configuration
|
|
390
400
|
login: {
|
|
391
401
|
basicLogins: ["email", "externalWallets"],
|
|
392
|
-
socialLogins: [
|
|
402
|
+
socialLogins: [
|
|
403
|
+
{ type: "google" },
|
|
404
|
+
{ type: "x" },
|
|
405
|
+
],
|
|
393
406
|
},
|
|
394
407
|
|
|
395
408
|
// Theme configuration
|
|
@@ -433,7 +446,7 @@ Main Provider component for wrapping your application.
|
|
|
433
446
|
```tsx
|
|
434
447
|
interface WalletConnectProviderProps {
|
|
435
448
|
children: React.ReactNode;
|
|
436
|
-
config
|
|
449
|
+
config: WalletConnectKitConfig;
|
|
437
450
|
}
|
|
438
451
|
```
|
|
439
452
|
|
|
@@ -550,7 +563,7 @@ export function MyComponent() {
|
|
|
550
563
|
}, []);
|
|
551
564
|
|
|
552
565
|
// Use chains in your config
|
|
553
|
-
const config = { chains };
|
|
566
|
+
const config = { ...dogeConfig, chains };
|
|
554
567
|
}
|
|
555
568
|
```
|
|
556
569
|
|
|
@@ -702,7 +715,7 @@ import { config } from "./wagmi-config";
|
|
|
702
715
|
export function App() {
|
|
703
716
|
return (
|
|
704
717
|
<WagmiProvider config={config}>
|
|
705
|
-
<WalletConnectProvider>
|
|
718
|
+
<WalletConnectProvider config={dogeConfig}>
|
|
706
719
|
<YourApp />
|
|
707
720
|
</WalletConnectProvider>
|
|
708
721
|
</WagmiProvider>
|
|
@@ -840,14 +853,9 @@ type ChainType = "evm" | "solana" | "aptos" | "dogecoin";
|
|
|
840
853
|
|
|
841
854
|
### What Content Security Policy entries are required?
|
|
842
855
|
|
|
843
|
-
If your app uses a restrictive CSP, allow the
|
|
856
|
+
If your app uses a restrictive CSP, allow the embedded-wallet, Social Relay, and Web3 Assets origins documented for the published SDK release you install. Those origins are compiled into the SDK by the release pipeline and cannot be overridden by the consumer app.
|
|
844
857
|
|
|
845
|
-
|
|
846
|
-
<meta
|
|
847
|
-
httpEquiv="Content-Security-Policy"
|
|
848
|
-
content="frame-src 'self' https://dogeos.embedded-wallet.tomo.inc; connect-src 'self' https://mydoge-wallet.tomo.inc https://social-relay.tomo.inc;"
|
|
849
|
-
/>
|
|
850
|
-
```
|
|
858
|
+
Use the exact origins from that release in `frame-src` and `connect-src`; do not substitute consumer-controlled endpoints.
|
|
851
859
|
|
|
852
860
|
### How to get WalletConnect Project ID?
|
|
853
861
|
|
|
@@ -869,7 +877,7 @@ const chains = await getChains();
|
|
|
869
877
|
const connectors = await getConnectors();
|
|
870
878
|
|
|
871
879
|
// Use in config
|
|
872
|
-
const config = { chains, connectors };
|
|
880
|
+
const config = { ...dogeConfig, chains, connectors };
|
|
873
881
|
```
|
|
874
882
|
|
|
875
883
|
The `getChains()` method automatically fetches chains from the backend API and includes EVM, Solana, Aptos, and Dogecoin chains. The `getConnectors()` method loads all available connectors including EIP6963, Wallet Standard, and WalletConnect wallets.
|