@dogeos/dogeos-sdk 4.0.6-beta.2 → 4.0.7-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 +71 -0
- package/dist/dogeos-sdk.css +1 -1
- package/dist/index.d.ts +88 -0
- package/dist/index.js +12009 -11478
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,16 @@ export declare type DogeOSEmbeddedWalletInitConfig = Omit<EmbeddedWalletConfig,
|
|
|
206
206
|
stage: EmbeddedWalletStage;
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Thrown inside MyDoge for a call that would open a web sign-in popup, such
|
|
211
|
+
* as `useDogeOSAuth().login()` or `reauthenticate()`. Use `signInWithWallet()`
|
|
212
|
+
* there instead.
|
|
213
|
+
*/
|
|
214
|
+
export declare class DogeOSHostError extends Error {
|
|
215
|
+
readonly code: "unavailable_in_native_host";
|
|
216
|
+
constructor(message: string);
|
|
217
|
+
}
|
|
218
|
+
|
|
209
219
|
/**
|
|
210
220
|
* An email flow plus its original delivery verifier. Keep this object in
|
|
211
221
|
* volatile memory only. If its runtime is interrupted, discard it and surface
|
|
@@ -362,8 +372,40 @@ export declare function getConnectors(): Promise<WalletConfig[]>;
|
|
|
362
372
|
|
|
363
373
|
export declare type GetConnectorsReturnType = Promise<WalletConfig[]>;
|
|
364
374
|
|
|
375
|
+
/**
|
|
376
|
+
* The href for a link to another dApp: the `mydoge://dapp` link inside MyDoge,
|
|
377
|
+
* so the target gets its own wallet session, and `targetUrl` itself elsewhere.
|
|
378
|
+
* It validates `targetUrl` the same way in both cases.
|
|
379
|
+
*/
|
|
380
|
+
export declare function getDappHref(targetUrl: string, { inMyDoge }: {
|
|
381
|
+
inMyDoge: boolean;
|
|
382
|
+
}): string;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Build the `mydoge://dapp` link that opens `targetUrl` as its own dApp session
|
|
386
|
+
* in MyDoge (3.1.1 build 652 or later). `targetUrl` is the complete, unencoded
|
|
387
|
+
* https URL. It is normalized by the URL parser (so stray whitespace or an
|
|
388
|
+
* unescaped space can't make MyDoge reject the link) and then encoded once.
|
|
389
|
+
*/
|
|
390
|
+
export declare function getMyDogeDappLink(targetUrl: string): string;
|
|
391
|
+
|
|
365
392
|
declare const idBrand: unique symbol;
|
|
366
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Resolve whether this page runs inside the MyDoge mobile app's in-app browser.
|
|
396
|
+
* It asks for EIP-6963 providers and waits for one announcing {@link MYDOGE_APP_RDNS},
|
|
397
|
+
* resolving `false` after `timeoutMs` or when there is no `window` (SSR).
|
|
398
|
+
*/
|
|
399
|
+
export declare function isInMyDogeBrowser(timeoutMs?: number): Promise<boolean>;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* True when `error` is a wallet provider error, optionally with a given code.
|
|
403
|
+
* Use it for errors from `connect`, `switchChain`, signing, and provider requests.
|
|
404
|
+
*/
|
|
405
|
+
export declare function isWalletError(error: unknown, code?: WalletErrorCode): error is Error & {
|
|
406
|
+
code: number;
|
|
407
|
+
};
|
|
408
|
+
|
|
367
409
|
declare type LoginOptions = {
|
|
368
410
|
provider: "email";
|
|
369
411
|
email: string;
|
|
@@ -388,6 +430,13 @@ export declare enum ModalView {
|
|
|
388
430
|
WalletHome = "WALLET_HOME"
|
|
389
431
|
}
|
|
390
432
|
|
|
433
|
+
export declare interface PreferredConnectOptions {
|
|
434
|
+
/** Chain family to connect. Defaults to `defaultConnectChain`, then the first configured family the wallet has. */
|
|
435
|
+
chainType?: ChainType;
|
|
436
|
+
/** Chain to switch to after connecting, as in `connect()`. In a browser it applies when adding a chain family to a connected wallet; a wallet picked in the modal keeps the modal's own choice. */
|
|
437
|
+
chainId?: string;
|
|
438
|
+
}
|
|
439
|
+
|
|
391
440
|
declare interface ProviderConnectionInfo {
|
|
392
441
|
chainType: ChainTypeEnum;
|
|
393
442
|
connected: boolean;
|
|
@@ -506,6 +555,27 @@ export declare type UseWalletConnect = {
|
|
|
506
555
|
|
|
507
556
|
export declare const useWalletConnect: () => UseWalletConnect;
|
|
508
557
|
|
|
558
|
+
export declare type UseWalletHost = {
|
|
559
|
+
/** `"mydoge"` inside the MyDoge dApp browser, otherwise `"browser"`. */
|
|
560
|
+
host: WalletHost;
|
|
561
|
+
/** True inside MyDoge, where every wallet request is answered by the native app and the SDK shows no wallet UI. */
|
|
562
|
+
isNativeHost: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Connects the wallet that fits the host and resolves with the account.
|
|
565
|
+
* Inside MyDoge it asks the native wallet directly. In a browser it opens the
|
|
566
|
+
* connect modal and settles when a wallet connects or the modal closes.
|
|
567
|
+
* Resolves at once when a wallet is already connected.
|
|
568
|
+
*/
|
|
569
|
+
connect: (options?: PreferredConnectOptions) => Promise<ConnectData>;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Reports whether the dApp is running inside MyDoge and offers a connect call
|
|
574
|
+
* that works in both places. Inside MyDoge the SDK never renders its own
|
|
575
|
+
* wallet UI: `openModal()` and this `connect()` ask the native wallet instead.
|
|
576
|
+
*/
|
|
577
|
+
export declare const useWalletHost: () => UseWalletHost;
|
|
578
|
+
|
|
509
579
|
/**
|
|
510
580
|
* Embedded wallet connect component that renders the modal content with proper context
|
|
511
581
|
* Uses a hidden Modal wrapper to provide required Modal context for UI components
|
|
@@ -620,6 +690,24 @@ declare interface WalletConnectProviderProps {
|
|
|
620
690
|
config: WalletConnectKitConfig;
|
|
621
691
|
}
|
|
622
692
|
|
|
693
|
+
/**
|
|
694
|
+
* EIP-1193 provider error codes, plus 4902 for a chain the wallet does not
|
|
695
|
+
* know (the code `wallet_switchEthereumChain` uses by convention).
|
|
696
|
+
*/
|
|
697
|
+
export declare const WalletErrorCode: {
|
|
698
|
+
readonly UserRejected: 4001;
|
|
699
|
+
readonly Unauthorized: 4100;
|
|
700
|
+
readonly UnsupportedMethod: 4200;
|
|
701
|
+
readonly Disconnected: 4900;
|
|
702
|
+
readonly ChainDisconnected: 4901;
|
|
703
|
+
readonly UnsupportedChain: 4902;
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
export declare type WalletErrorCode = (typeof WalletErrorCode)[keyof typeof WalletErrorCode];
|
|
707
|
+
|
|
708
|
+
/** Where the SDK is running: an ordinary browser, or MyDoge's dApp browser. */
|
|
709
|
+
export declare type WalletHost = "browser" | "mydoge";
|
|
710
|
+
|
|
623
711
|
export { WalletInfo }
|
|
624
712
|
|
|
625
713
|
export { WalletProvider }
|