@dogeos/dogeos-sdk 4.0.7-beta.0 → 4.1.0-beta.0

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
@@ -66,6 +66,8 @@ export default function App() {
66
66
  }
67
67
  ```
68
68
 
69
+ The stylesheet only styles SDK UI: the modal, toasts and `WalletConnectEmbed`. Your page keeps its own reset, fonts and colors. If you leave out the import, the provider adds the same stylesheet when it mounts. It adds its stylesheets as constructed stylesheets, which a Content Security Policy without `'unsafe-inline'` in `style-src` allows. Browsers without constructed stylesheets (before Safari 16.4) get `<style>` elements instead, which such a policy blocks; importing `style.css` covers the stylesheet there, but not `config.theme` colors. To restyle SDK UI, target elements inside `.dogeos-sdk`.
70
+
69
71
  `openModal()` opens the connection flow. Once connected, it opens the account view. Use `disconnect()` from `useWalletConnect()` to disconnect the active wallet.
70
72
 
71
73
  In Next.js App Router, put the provider in a client component, as above. See the [Next.js setup guide](https://docs.dogeos.com/en/sdk#nextjs) for a layout example.
@@ -110,15 +112,17 @@ Use the state that matches what your app needs.
110
112
  | `walletStatus` | Embedded wallet state: `disabled`, `initializing`, `ready`, `unavailable` or `error`. |
111
113
  | `isWalletReady` | The embedded wallet is ready to accept login. |
112
114
 
115
+ `WalletConnectProvider` renders your app straight away outside MyDoge. In an Android in-app browser (a WebView), the embedded wallet, and with email or social sign-in configured also restoring a saved connection, wait until the page finishes loading, for up to 5 seconds, before they start: MyDoge's in-app browser can still identify itself until then. `walletStatus` reports `initializing` meanwhile. Inside MyDoge the provider shows a short "Preparing wallet connection…" status in place of your app while the native wallet gets ready, with a Retry button if it takes longer than 5 seconds. On some older Android devices MyDoge identifies itself late, so your app can render once in browser mode and then mount again in native mode.
116
+
113
117
  Inside MyDoge, the SDK selects the native wallet automatically. Keep your normal provider configuration and connection button. A native or external wallet can be connected while the embedded wallet is disabled, so do not require `isWalletReady` for all wallet actions. See [native wallet connections](https://docs.dogeos.com/en/sdk/embedded-wallets#native-first-connection-in-mydoge).
114
118
 
115
119
  ## Inside the MyDoge app
116
120
 
117
121
  In MyDoge's dApp browser the native app answers every wallet request, and the SDK shows none of its own wallet UI and opens no popups. The same code works in a browser and in MyDoge:
118
122
 
119
- - `openModal()` asks MyDoge to connect, or opens MyDoge's account sheet when a wallet is already connected.
120
- - `WalletConnectEmbed` shows a small MyDoge card with Connect, Account and Disconnect buttons instead of the wallet list.
121
- - A first visit does not prompt on page load. MyDoge reconnects a dApp the user already approved; otherwise the SDK waits for the user to tap connect.
123
+ - `openModal()` asks MyDoge to connect. When a wallet is already connected, it opens MyDoge's account sheet on MyDoge builds that support it; on builds without it, including 3.1.1 (build 652) and earlier, it does nothing and logs a warning, so give users a Disconnect button and, if you support several networks, a `switchChain()` control.
124
+ - `WalletConnectEmbed` shows a small MyDoge card with Connect, Account and Disconnect buttons instead of the wallet list. Its Account button needs the same account-sheet support.
125
+ - A first visit does not prompt on page load. A saved connection is restored, and MyDoge builds that support it also reconnect a dApp the user already approved; otherwise the SDK waits for the user to tap connect.
122
126
  - `disconnect()` also revokes the dApp's approval in MyDoge.
123
127
  - DogeOS email and social sign-in (`useDogeOSAuth().login()`) reject with `DogeOSHostError`. Use `signInWithWallet()` and verify the signature on your server.
124
128
 
@@ -195,6 +199,48 @@ export function WalletPanel() {
195
199
  }
196
200
  ```
197
201
 
202
+ `WalletConnectEmbed` also takes these props:
203
+
204
+ - `initialView`: the picker it starts on and returns to, `"walletList"` or `"walletSearch"`. By default it follows `config.login`.
205
+ - `hideHeader`: leaves out the starting view's title, for a page that gives the embed its own heading. Controls in that row, such as a link to the wallet list, stay. Later views keep their titles.
206
+ - `keepPickerAfterConnect`: keeps the picker on screen after a wallet connects, instead of showing the account view. Connecting another wallet, its errors and the install guide still show.
207
+
208
+ Inside MyDoge the embed is always the MyDoge card, whatever these props say.
209
+
210
+ ## Link a second wallet
211
+
212
+ To let a signed-in user prove they own another wallet, for example to link it to their account, render a second `WalletConnectProvider` around an embed. Configure it so it doesn't take over the page's main connection:
213
+
214
+ ```tsx
215
+ "use client";
216
+
217
+ import { WalletConnectEmbed, WalletConnectProvider, type WalletConnectKitConfig } from "@dogeos/dogeos-sdk";
218
+
219
+ const linkConfig: WalletConnectKitConfig = {
220
+ clientId: process.env.NEXT_PUBLIC_DOGEOS_CLIENT_ID!,
221
+ login: { basicLogins: ["externalWallets"], socialLogins: [] },
222
+ // Connect only when the user picks a wallet, and save nothing.
223
+ autoRestore: false,
224
+ persistConnection: false,
225
+ // Ask an EVM wallet to show its account picker even for a site it already approved.
226
+ forceAccountSelection: { blockedAddresses: alreadyLinkedAddresses },
227
+ };
228
+
229
+ export function LinkWallet() {
230
+ return (
231
+ <WalletConnectProvider config={linkConfig}>
232
+ <WalletConnectEmbed initialView="walletSearch" hideHeader keepPickerAfterConnect />
233
+ </WalletConnectProvider>
234
+ );
235
+ }
236
+ ```
237
+
238
+ - `autoRestore: false` skips restoring a saved connection on load, and inside MyDoge the silent reconnect too. It does not cover the DogeOS sign-in: on a page where the user is signed in, a provider that offers social logins connects their Social Wallet on load. The `login` line above keeps the link provider to external wallets, so that doesn't happen.
239
+ - `persistConnection: false` saves no reconnect hint, and leaves the main provider's alone.
240
+ - `forceAccountSelection` applies to EVM browser wallets; MyDoge and the embedded wallet ignore it. Before connecting it asks the wallet for the site's account permission again (EIP-2255), which makes most wallets show their picker. If the wallet supports no such request and returns one of `blockedAddresses`, the connection fails with a message asking the user to disconnect the site in their wallet. `revokePermissions: true` revokes the permission first, for wallets that skip their picker otherwise. The permission is per site, so that also disconnects a main connection to the same wallet on the page.
241
+
242
+ Ask for a signature from the connected wallet to prove ownership, and check it on your server.
243
+
198
244
  ## Link to another dApp from inside MyDoge
199
245
 
200
246
  In MyDoge's in-app browser, a plain `https` link to another dApp loads in your dApp's browser session. The wallet stays bound to your dApp's origin, so the other dApp can't connect. Link to it with a `mydoge://dapp` URL instead: MyDoge then opens the target as its own dApp with its own wallet session. The user sees the target's details screen and taps **Open**; your dApp closes only then.