@dogeos/dogeos-sdk 3.3.0-beta.3 → 4.0.0-beta.4
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 +42 -31
- package/dist/dogeos-sdk.css +1 -1
- package/dist/index.d.ts +27 -11
- package/dist/index.js +37727 -19833
- package/package.json +37 -17
package/README.md
CHANGED
|
@@ -7,6 +7,24 @@ 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. The reference demo supplies only its normal `WalletConnectProvider` configuration; it cannot replace SDK service destinations or provider credentials.
|
|
21
|
+
|
|
22
|
+
The SDK directory is a library-only package. The private reference consumer,
|
|
23
|
+
its Vite entrypoint and application tests live in
|
|
24
|
+
[`apps/sdk-demo`](../../apps/sdk-demo/README.md). Use `pnpm watch:demo` from the
|
|
25
|
+
repository root for the supported SDK-and-app development loop; the app still
|
|
26
|
+
resolves this package through its public `dist` export.
|
|
27
|
+
|
|
10
28
|
## Installation
|
|
11
29
|
|
|
12
30
|
Install Wallet Connect Kit using your preferred package manager:
|
|
@@ -161,9 +179,9 @@ export function SignInButton() {
|
|
|
161
179
|
|
|
162
180
|
const handleSignIn = async () => {
|
|
163
181
|
try {
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
182
|
+
const proof = await signInWithWallet();
|
|
183
|
+
// Send the short-lived proof directly to your backend. Never log it or persist it in localStorage.
|
|
184
|
+
await sendProofToBackend(proof);
|
|
167
185
|
} catch (error) {
|
|
168
186
|
console.error("Sign in failed:", error);
|
|
169
187
|
}
|
|
@@ -179,7 +197,7 @@ export function SignInButton() {
|
|
|
179
197
|
|
|
180
198
|
## Configuration
|
|
181
199
|
|
|
182
|
-
`WalletConnectProvider` accepts
|
|
200
|
+
`WalletConnectProvider` accepts a `config` prop to customize the SDK's behavior.
|
|
183
201
|
|
|
184
202
|
### Basic Configuration
|
|
185
203
|
|
|
@@ -188,17 +206,7 @@ import { WalletConnectProvider } from "@dogeos/dogeos-sdk";
|
|
|
188
206
|
import type { WalletConnectKitConfig } from "@dogeos/dogeos-sdk";
|
|
189
207
|
|
|
190
208
|
const dogeConfig: WalletConnectKitConfig = {
|
|
191
|
-
// WalletConnect project ID (obtain from https://cloud.walletconnect.com)
|
|
192
|
-
walletConnectProjectId: "your-project-id",
|
|
193
|
-
|
|
194
209
|
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
210
|
};
|
|
203
211
|
|
|
204
212
|
export function App() {
|
|
@@ -213,6 +221,7 @@ export function App() {
|
|
|
213
221
|
### Configure Supported Chains
|
|
214
222
|
|
|
215
223
|
Chains are automatically loaded by default. If you need to customize chains, use the `getChains()` method:
|
|
224
|
+
The examples below extend the `dogeConfig` object from the basic configuration example.
|
|
216
225
|
|
|
217
226
|
```tsx
|
|
218
227
|
import { WalletConnectProvider, getChains } from "@dogeos/dogeos-sdk";
|
|
@@ -228,7 +237,7 @@ export function App() {
|
|
|
228
237
|
}, []);
|
|
229
238
|
|
|
230
239
|
return (
|
|
231
|
-
<WalletConnectProvider config={{
|
|
240
|
+
<WalletConnectProvider config={{ ...dogeConfig, chains }}>
|
|
232
241
|
<YourApp />
|
|
233
242
|
</WalletConnectProvider>
|
|
234
243
|
);
|
|
@@ -253,7 +262,7 @@ export function App() {
|
|
|
253
262
|
}, []);
|
|
254
263
|
|
|
255
264
|
return (
|
|
256
|
-
<WalletConnectProvider config={{
|
|
265
|
+
<WalletConnectProvider config={{ ...dogeConfig, connectors }}>
|
|
257
266
|
<YourApp />
|
|
258
267
|
</WalletConnectProvider>
|
|
259
268
|
);
|
|
@@ -268,6 +277,7 @@ You can configure supported login methods, including basic logins (email, extern
|
|
|
268
277
|
import { WalletConnectProvider } from "@dogeos/dogeos-sdk";
|
|
269
278
|
|
|
270
279
|
const config = {
|
|
280
|
+
...dogeConfig,
|
|
271
281
|
login: {
|
|
272
282
|
// Basic login methods
|
|
273
283
|
basicLogins: ["email", "externalWallets"], // or ["email"] or ["externalWallets"]
|
|
@@ -278,7 +288,6 @@ const config = {
|
|
|
278
288
|
{ type: "x" },
|
|
279
289
|
],
|
|
280
290
|
},
|
|
281
|
-
clientId: "your-client-id",
|
|
282
291
|
};
|
|
283
292
|
|
|
284
293
|
export function App() {
|
|
@@ -290,7 +299,11 @@ export function App() {
|
|
|
290
299
|
}
|
|
291
300
|
```
|
|
292
301
|
|
|
293
|
-
|
|
302
|
+
Provider credentials, browser delivery, session reconciliation, and service
|
|
303
|
+
destinations are SDK-owned. Consumer applications select the enabled login
|
|
304
|
+
controls and provide their registered DogeOS client ID. A successful SDK login
|
|
305
|
+
continues to the associated embedded wallet automatically; returning wallet
|
|
306
|
+
connections are restored by the provider without consumer session plumbing.
|
|
294
307
|
|
|
295
308
|
### Configure Theme
|
|
296
309
|
|
|
@@ -301,6 +314,7 @@ import { WalletConnectProvider } from "@dogeos/dogeos-sdk";
|
|
|
301
314
|
import type { ThemeConfig } from "@dogeos/dogeos-sdk";
|
|
302
315
|
|
|
303
316
|
const config = {
|
|
317
|
+
...dogeConfig,
|
|
304
318
|
theme: {
|
|
305
319
|
themes: {
|
|
306
320
|
light: {
|
|
@@ -325,7 +339,6 @@ const config = {
|
|
|
325
339
|
},
|
|
326
340
|
},
|
|
327
341
|
} as ThemeConfig,
|
|
328
|
-
clientId: "your-client-id",
|
|
329
342
|
};
|
|
330
343
|
|
|
331
344
|
export function App() {
|
|
@@ -389,7 +402,10 @@ export function App() {
|
|
|
389
402
|
// Login configuration
|
|
390
403
|
login: {
|
|
391
404
|
basicLogins: ["email", "externalWallets"],
|
|
392
|
-
socialLogins: [
|
|
405
|
+
socialLogins: [
|
|
406
|
+
{ type: "google" },
|
|
407
|
+
{ type: "x" },
|
|
408
|
+
],
|
|
393
409
|
},
|
|
394
410
|
|
|
395
411
|
// Theme configuration
|
|
@@ -433,7 +449,7 @@ Main Provider component for wrapping your application.
|
|
|
433
449
|
```tsx
|
|
434
450
|
interface WalletConnectProviderProps {
|
|
435
451
|
children: React.ReactNode;
|
|
436
|
-
config
|
|
452
|
+
config: WalletConnectKitConfig;
|
|
437
453
|
}
|
|
438
454
|
```
|
|
439
455
|
|
|
@@ -550,7 +566,7 @@ export function MyComponent() {
|
|
|
550
566
|
}, []);
|
|
551
567
|
|
|
552
568
|
// Use chains in your config
|
|
553
|
-
const config = { chains };
|
|
569
|
+
const config = { ...dogeConfig, chains };
|
|
554
570
|
}
|
|
555
571
|
```
|
|
556
572
|
|
|
@@ -702,7 +718,7 @@ import { config } from "./wagmi-config";
|
|
|
702
718
|
export function App() {
|
|
703
719
|
return (
|
|
704
720
|
<WagmiProvider config={config}>
|
|
705
|
-
<WalletConnectProvider>
|
|
721
|
+
<WalletConnectProvider config={dogeConfig}>
|
|
706
722
|
<YourApp />
|
|
707
723
|
</WalletConnectProvider>
|
|
708
724
|
</WagmiProvider>
|
|
@@ -840,14 +856,9 @@ type ChainType = "evm" | "solana" | "aptos" | "dogecoin";
|
|
|
840
856
|
|
|
841
857
|
### What Content Security Policy entries are required?
|
|
842
858
|
|
|
843
|
-
If your app uses a restrictive CSP, allow the
|
|
859
|
+
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
860
|
|
|
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
|
-
```
|
|
861
|
+
Use the exact origins from that release in `frame-src` and `connect-src`; do not substitute consumer-controlled endpoints.
|
|
851
862
|
|
|
852
863
|
### How to get WalletConnect Project ID?
|
|
853
864
|
|
|
@@ -869,7 +880,7 @@ const chains = await getChains();
|
|
|
869
880
|
const connectors = await getConnectors();
|
|
870
881
|
|
|
871
882
|
// Use in config
|
|
872
|
-
const config = { chains, connectors };
|
|
883
|
+
const config = { ...dogeConfig, chains, connectors };
|
|
873
884
|
```
|
|
874
885
|
|
|
875
886
|
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.
|