@dynamic-labs-sdk/wallet-connect 1.17.1 → 1.19.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/dist/{SessionClosedUnexpectedlyError-hEoXu8Ul.esm.js → SessionClosedUnexpectedlyError-BlM2BV_T.esm.js} +2 -2
- package/dist/{SessionClosedUnexpectedlyError-hEoXu8Ul.esm.js.map → SessionClosedUnexpectedlyError-BlM2BV_T.esm.js.map} +1 -1
- package/dist/{SessionClosedUnexpectedlyError-bhOw-Gya.cjs → SessionClosedUnexpectedlyError-C2E2eW0s.cjs} +2 -2
- package/dist/{SessionClosedUnexpectedlyError-bhOw-Gya.cjs.map → SessionClosedUnexpectedlyError-C2E2eW0s.cjs.map} +1 -1
- package/dist/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.d.ts +10 -0
- package/dist/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.esm.js +1 -1
- package/dist/getPreferredWalletDeepLink/getPreferredWalletDeepLink.d.ts +9 -0
- package/dist/getPreferredWalletDeepLink/getPreferredWalletDeepLink.d.ts.map +1 -1
- package/dist/index.cjs +36 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +36 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/isWalletConnectWalletProvider/isWalletConnectWalletProvider.d.ts +16 -1
- package/dist/isWalletConnectWalletProvider/isWalletConnectWalletProvider.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import { BaseError } from "@dynamic-labs-sdk/client";
|
|
|
2
2
|
|
|
3
3
|
//#region package.json
|
|
4
4
|
var name = "@dynamic-labs-sdk/wallet-connect";
|
|
5
|
-
var version = "1.
|
|
5
|
+
var version = "1.19.0";
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/errors/SessionClosedUnexpectedlyError.ts
|
|
@@ -20,4 +20,4 @@ var SessionClosedUnexpectedlyError = class extends BaseError {
|
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
22
|
export { name as n, version as r, SessionClosedUnexpectedlyError as t };
|
|
23
|
-
//# sourceMappingURL=SessionClosedUnexpectedlyError-
|
|
23
|
+
//# sourceMappingURL=SessionClosedUnexpectedlyError-BlM2BV_T.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionClosedUnexpectedlyError-
|
|
1
|
+
{"version":3,"file":"SessionClosedUnexpectedlyError-BlM2BV_T.esm.js","names":[],"sources":["../package.json","../src/errors/SessionClosedUnexpectedlyError.ts"],"sourcesContent":["","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype SessionClosedUnexpectedlyErrorParams = {\n /**\n * The topic of the session that closed unexpectedly.\n */\n sessionTopic: string;\n\n /**\n * The display name of the wallet that was associated with the session that closed unexpectedly.\n */\n walletDisplayName: string | null | undefined;\n};\n\nexport class SessionClosedUnexpectedlyError extends BaseError {\n constructor({\n sessionTopic,\n walletDisplayName,\n }: SessionClosedUnexpectedlyErrorParams) {\n super({\n cause: null,\n code: 'session_closed_unexpectedly_error',\n docsUrl: null,\n name: 'SessionClosedUnexpectedlyError',\n shortMessage: walletDisplayName\n ? `WalletConnect session ${sessionTopic} closed unexpectedly. Associated wallet was ${walletDisplayName}`\n : `WalletConnect session ${sessionTopic} closed unexpectedly`,\n });\n }\n}\n"],"mappings":";;;;;;;;ACcA,IAAa,iCAAb,cAAoD,UAAU;CAC5D,YAAY,EACV,cACA,qBACuC;AACvC,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,oBACV,yBAAyB,aAAa,8CAA8C,sBACpF,yBAAyB,aAAa;GAC3C,CAAC"}
|
|
@@ -3,7 +3,7 @@ let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
|
|
3
3
|
|
|
4
4
|
//#region package.json
|
|
5
5
|
var name = "@dynamic-labs-sdk/wallet-connect";
|
|
6
|
-
var version = "1.
|
|
6
|
+
var version = "1.19.0";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/errors/SessionClosedUnexpectedlyError.ts
|
|
@@ -38,4 +38,4 @@ Object.defineProperty(exports, 'version', {
|
|
|
38
38
|
return version;
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
//# sourceMappingURL=SessionClosedUnexpectedlyError-
|
|
41
|
+
//# sourceMappingURL=SessionClosedUnexpectedlyError-C2E2eW0s.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionClosedUnexpectedlyError-
|
|
1
|
+
{"version":3,"file":"SessionClosedUnexpectedlyError-C2E2eW0s.cjs","names":["BaseError"],"sources":["../package.json","../src/errors/SessionClosedUnexpectedlyError.ts"],"sourcesContent":["","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype SessionClosedUnexpectedlyErrorParams = {\n /**\n * The topic of the session that closed unexpectedly.\n */\n sessionTopic: string;\n\n /**\n * The display name of the wallet that was associated with the session that closed unexpectedly.\n */\n walletDisplayName: string | null | undefined;\n};\n\nexport class SessionClosedUnexpectedlyError extends BaseError {\n constructor({\n sessionTopic,\n walletDisplayName,\n }: SessionClosedUnexpectedlyErrorParams) {\n super({\n cause: null,\n code: 'session_closed_unexpectedly_error',\n docsUrl: null,\n name: 'SessionClosedUnexpectedlyError',\n shortMessage: walletDisplayName\n ? `WalletConnect session ${sessionTopic} closed unexpectedly. Associated wallet was ${walletDisplayName}`\n : `WalletConnect session ${sessionTopic} closed unexpectedly`,\n });\n }\n}\n"],"mappings":";;;;;;;;;ACcA,IAAa,iCAAb,cAAoDA,mCAAU;CAC5D,YAAY,EACV,cACA,qBACuC;AACvC,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,oBACV,yBAAyB,aAAa,8CAA8C,sBACpF,yBAAyB,aAAa;GAC3C,CAAC"}
|
|
@@ -9,9 +9,19 @@ type AppendWalletConnectUriToDeepLinkParams = {
|
|
|
9
9
|
* was renamed to be generic across all URI-deeplink connection options
|
|
10
10
|
* (WalletConnect, MetaMask SDK URI, …).
|
|
11
11
|
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const deepLink = appendWalletConnectUriToDeepLink({
|
|
15
|
+
* deepLinkUrl: 'https://metamask.app.link/wc',
|
|
16
|
+
* walletConnectUri: 'wc:abc123@2?relay-protocol=irn&symKey=xyz',
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
12
20
|
* @param params.deepLinkUrl - The base deeplink URL.
|
|
13
21
|
* @param params.walletConnectUri - The WalletConnect pairing URI to append.
|
|
14
22
|
* @returns The deeplink URL with the WalletConnect URI appended as a query parameter.
|
|
23
|
+
* @see getPreferredWalletDeepLink
|
|
24
|
+
* @see isWalletConnectWalletProvider
|
|
15
25
|
* @notInstrumented
|
|
16
26
|
*/
|
|
17
27
|
export declare const appendWalletConnectUriToDeepLink: ({ deepLinkUrl, walletConnectUri, }: AppendWalletConnectUriToDeepLinkParams) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appendWalletConnectUriToDeepLink.d.ts","sourceRoot":"","sources":["../../src/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.ts"],"names":[],"mappings":"AAEA,KAAK,sCAAsC,GAAG;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"appendWalletConnectUriToDeepLink.d.ts","sourceRoot":"","sources":["../../src/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.ts"],"names":[],"mappings":"AAEA,KAAK,sCAAsC,GAAG;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,gCAAgC,uCAG1C,sCAAsC,KAAG,MAIxC,CAAC"}
|
package/dist/core.cjs
CHANGED
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_SessionClosedUnexpectedlyError = require('./SessionClosedUnexpectedlyError-
|
|
28
|
+
const require_SessionClosedUnexpectedlyError = require('./SessionClosedUnexpectedlyError-C2E2eW0s.cjs');
|
|
29
29
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
30
30
|
let _walletconnect_utils = require("@walletconnect/utils");
|
|
31
31
|
let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
package/dist/core.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as name, r as version, t as SessionClosedUnexpectedlyError } from "./SessionClosedUnexpectedlyError-
|
|
1
|
+
import { n as name, r as version, t as SessionClosedUnexpectedlyError } from "./SessionClosedUnexpectedlyError-BlM2BV_T.esm.js";
|
|
2
2
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
3
|
import { formatMessage } from "@walletconnect/utils";
|
|
4
4
|
import { verifyWalletAccount } from "@dynamic-labs-sdk/client";
|
|
@@ -15,8 +15,17 @@ type GetPreferredWalletDeepLinkParams = {
|
|
|
15
15
|
* variant is missing. Returns `undefined` only when both variants are
|
|
16
16
|
* absent.
|
|
17
17
|
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const deepLink = getPreferredWalletDeepLink({
|
|
21
|
+
* deeplinks: wallet.deeplinks,
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
18
25
|
* @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).
|
|
19
26
|
* @returns The preferred deep link URL, or `undefined` if neither variant is available.
|
|
27
|
+
* @see appendConnectionUriToDeeplink
|
|
28
|
+
* @see isWalletConnectWalletProvider
|
|
20
29
|
* @notInstrumented
|
|
21
30
|
*/
|
|
22
31
|
export declare const getPreferredWalletDeepLink: ({ deeplinks, }: GetPreferredWalletDeepLinkParams) => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPreferredWalletDeepLink.d.ts","sourceRoot":"","sources":["../../src/getPreferredWalletDeepLink/getPreferredWalletDeepLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAG9E,KAAK,gCAAgC,GAAG;IACtC,SAAS,EAAE,6BAA6B,CAAC;CAC1C,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"getPreferredWalletDeepLink.d.ts","sourceRoot":"","sources":["../../src/getPreferredWalletDeepLink/getPreferredWalletDeepLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAG9E,KAAK,gCAAgC,GAAG;IACtC,SAAS,EAAE,6BAA6B,CAAC;CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,0BAA0B,mBAEpC,gCAAgC,KAAG,MAAM,GAAG,SAQ9C,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_SessionClosedUnexpectedlyError = require('./SessionClosedUnexpectedlyError-
|
|
1
|
+
const require_SessionClosedUnexpectedlyError = require('./SessionClosedUnexpectedlyError-C2E2eW0s.cjs');
|
|
2
2
|
const require_core = require('./core.cjs');
|
|
3
3
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
4
4
|
let _walletconnect_utils = require("@walletconnect/utils");
|
|
@@ -13,9 +13,19 @@ let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
|
13
13
|
* was renamed to be generic across all URI-deeplink connection options
|
|
14
14
|
* (WalletConnect, MetaMask SDK URI, …).
|
|
15
15
|
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const deepLink = appendWalletConnectUriToDeepLink({
|
|
19
|
+
* deepLinkUrl: 'https://metamask.app.link/wc',
|
|
20
|
+
* walletConnectUri: 'wc:abc123@2?relay-protocol=irn&symKey=xyz',
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
16
24
|
* @param params.deepLinkUrl - The base deeplink URL.
|
|
17
25
|
* @param params.walletConnectUri - The WalletConnect pairing URI to append.
|
|
18
26
|
* @returns The deeplink URL with the WalletConnect URI appended as a query parameter.
|
|
27
|
+
* @see getPreferredWalletDeepLink
|
|
28
|
+
* @see isWalletConnectWalletProvider
|
|
19
29
|
* @notInstrumented
|
|
20
30
|
*/
|
|
21
31
|
const appendWalletConnectUriToDeepLink = ({ deepLinkUrl, walletConnectUri }) => (0, _dynamic_labs_sdk_client.appendConnectionUriToDeeplink)({
|
|
@@ -38,8 +48,17 @@ const appendWalletConnectUriToDeepLink = ({ deepLinkUrl, walletConnectUri }) =>
|
|
|
38
48
|
* variant is missing. Returns `undefined` only when both variants are
|
|
39
49
|
* absent.
|
|
40
50
|
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const deepLink = getPreferredWalletDeepLink({
|
|
54
|
+
* deeplinks: wallet.deeplinks,
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
41
58
|
* @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).
|
|
42
59
|
* @returns The preferred deep link URL, or `undefined` if neither variant is available.
|
|
60
|
+
* @see appendConnectionUriToDeeplink
|
|
61
|
+
* @see isWalletConnectWalletProvider
|
|
43
62
|
* @notInstrumented
|
|
44
63
|
*/
|
|
45
64
|
const getPreferredWalletDeepLink = ({ deeplinks }) => {
|
|
@@ -50,7 +69,22 @@ const getPreferredWalletDeepLink = ({ deeplinks }) => {
|
|
|
50
69
|
|
|
51
70
|
//#endregion
|
|
52
71
|
//#region src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts
|
|
53
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Type guard function to check if a wallet provider is a WalletConnect wallet provider.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* if (isWalletConnectWalletProvider(provider)) {
|
|
78
|
+
* const session = provider.getSession();
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @param walletProvider - The wallet provider to check.
|
|
83
|
+
* @returns True if the wallet provider is a WalletConnect wallet provider, false otherwise.
|
|
84
|
+
* @see getPreferredWalletDeepLink
|
|
85
|
+
* @see appendConnectionUriToDeeplink
|
|
86
|
+
* @notInstrumented
|
|
87
|
+
*/
|
|
54
88
|
const isWalletConnectWalletProvider = (walletProvider) => {
|
|
55
89
|
return walletProvider.walletProviderType === _dynamic_labs_sdk_api_core.WalletProviderEnum.WalletConnect;
|
|
56
90
|
};
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["WalletProviderEnum","name","version"],"sources":["../src/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.ts","../src/getPreferredWalletDeepLink/getPreferredWalletDeepLink.ts","../src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts","../src/exports/index.ts"],"sourcesContent":["import { appendConnectionUriToDeeplink } from '@dynamic-labs-sdk/client';\n\ntype AppendWalletConnectUriToDeepLinkParams = {\n deepLinkUrl: string;\n walletConnectUri: string;\n};\n\n/**\n * Appends a WalletConnect URI to a deeplink URL.\n *\n * @deprecated Use {@link appendConnectionUriToDeeplink} instead. This helper\n * was renamed to be generic across all URI-deeplink connection options\n * (WalletConnect, MetaMask SDK URI, …).\n *\n * @param params.deepLinkUrl - The base deeplink URL.\n * @param params.walletConnectUri - The WalletConnect pairing URI to append.\n * @returns The deeplink URL with the WalletConnect URI appended as a query parameter.\n * @notInstrumented\n */\nexport const appendWalletConnectUriToDeepLink = ({\n deepLinkUrl,\n walletConnectUri,\n}: AppendWalletConnectUriToDeepLinkParams): string =>\n appendConnectionUriToDeeplink({\n connectionUri: walletConnectUri,\n deeplinkUrl: deepLinkUrl,\n });\n","import type { WalletConnectCatalogDeepLinks } from '@dynamic-labs-sdk/client';\nimport { isMobile } from '@dynamic-labs-sdk/client';\n\ntype GetPreferredWalletDeepLinkParams = {\n deeplinks: WalletConnectCatalogDeepLinks;\n};\n\n/**\n * Picks the most appropriate deep link variant for the current platform.\n *\n * Mobile (Android, iOS, tablets) prefers `native` because the OS treats\n * custom URL schemes as first-class app links and gives the wallet a faster\n * round-trip back to the dApp. Desktop prefers `universal` because browsers\n * cannot resolve mobile-only custom schemes and need an `https://` link\n * that opens the wallet's web flow.\n *\n * In either case, the alternative is used as a fallback when the preferred\n * variant is missing. Returns `undefined` only when both variants are\n * absent.\n *\n * @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).\n * @returns The preferred deep link URL, or `undefined` if neither variant is available.\n * @notInstrumented\n */\nexport const getPreferredWalletDeepLink = ({\n deeplinks,\n}: GetPreferredWalletDeepLinkParams): string | undefined => {\n const { native, universal } = deeplinks;\n\n if (isMobile()) {\n return native ?? universal;\n }\n\n return universal ?? native;\n};\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { WalletConnectWalletProvider } from '../walletConnectWalletProvider.types';\n\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["WalletProviderEnum","name","version"],"sources":["../src/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.ts","../src/getPreferredWalletDeepLink/getPreferredWalletDeepLink.ts","../src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts","../src/exports/index.ts"],"sourcesContent":["import { appendConnectionUriToDeeplink } from '@dynamic-labs-sdk/client';\n\ntype AppendWalletConnectUriToDeepLinkParams = {\n deepLinkUrl: string;\n walletConnectUri: string;\n};\n\n/**\n * Appends a WalletConnect URI to a deeplink URL.\n *\n * @deprecated Use {@link appendConnectionUriToDeeplink} instead. This helper\n * was renamed to be generic across all URI-deeplink connection options\n * (WalletConnect, MetaMask SDK URI, …).\n *\n * @example\n * ```ts\n * const deepLink = appendWalletConnectUriToDeepLink({\n * deepLinkUrl: 'https://metamask.app.link/wc',\n * walletConnectUri: 'wc:abc123@2?relay-protocol=irn&symKey=xyz',\n * });\n * ```\n *\n * @param params.deepLinkUrl - The base deeplink URL.\n * @param params.walletConnectUri - The WalletConnect pairing URI to append.\n * @returns The deeplink URL with the WalletConnect URI appended as a query parameter.\n * @see getPreferredWalletDeepLink\n * @see isWalletConnectWalletProvider\n * @notInstrumented\n */\nexport const appendWalletConnectUriToDeepLink = ({\n deepLinkUrl,\n walletConnectUri,\n}: AppendWalletConnectUriToDeepLinkParams): string =>\n appendConnectionUriToDeeplink({\n connectionUri: walletConnectUri,\n deeplinkUrl: deepLinkUrl,\n });\n","import type { WalletConnectCatalogDeepLinks } from '@dynamic-labs-sdk/client';\nimport { isMobile } from '@dynamic-labs-sdk/client';\n\ntype GetPreferredWalletDeepLinkParams = {\n deeplinks: WalletConnectCatalogDeepLinks;\n};\n\n/**\n * Picks the most appropriate deep link variant for the current platform.\n *\n * Mobile (Android, iOS, tablets) prefers `native` because the OS treats\n * custom URL schemes as first-class app links and gives the wallet a faster\n * round-trip back to the dApp. Desktop prefers `universal` because browsers\n * cannot resolve mobile-only custom schemes and need an `https://` link\n * that opens the wallet's web flow.\n *\n * In either case, the alternative is used as a fallback when the preferred\n * variant is missing. Returns `undefined` only when both variants are\n * absent.\n *\n * @example\n * ```ts\n * const deepLink = getPreferredWalletDeepLink({\n * deeplinks: wallet.deeplinks,\n * });\n * ```\n *\n * @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).\n * @returns The preferred deep link URL, or `undefined` if neither variant is available.\n * @see appendConnectionUriToDeeplink\n * @see isWalletConnectWalletProvider\n * @notInstrumented\n */\nexport const getPreferredWalletDeepLink = ({\n deeplinks,\n}: GetPreferredWalletDeepLinkParams): string | undefined => {\n const { native, universal } = deeplinks;\n\n if (isMobile()) {\n return native ?? universal;\n }\n\n return universal ?? native;\n};\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { WalletConnectWalletProvider } from '../walletConnectWalletProvider.types';\n\n/**\n * Type guard function to check if a wallet provider is a WalletConnect wallet provider.\n *\n * @example\n * ```ts\n * if (isWalletConnectWalletProvider(provider)) {\n * const session = provider.getSession();\n * }\n * ```\n *\n * @param walletProvider - The wallet provider to check.\n * @returns True if the wallet provider is a WalletConnect wallet provider, false otherwise.\n * @see getPreferredWalletDeepLink\n * @see appendConnectionUriToDeeplink\n * @notInstrumented\n */\nexport const isWalletConnectWalletProvider = (\n walletProvider: WalletProvider\n): walletProvider is WalletConnectWalletProvider => {\n return walletProvider.walletProviderType === WalletProviderEnum.WalletConnect;\n};\n","/* eslint-disable import/no-unassigned-import */\nimport { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport { name, version } from '../../package.json';\n\nassertPackageVersion(name, version);\n\nimport '../events';\n\nexport { SDK_ERRORS as WC_ERRORS } from '@walletconnect/utils';\n\nexport { appendWalletConnectUriToDeepLink } from '../appendWalletConnectUriToDeepLink';\nexport { SessionClosedUnexpectedlyError } from '../errors/SessionClosedUnexpectedlyError';\nexport { getPreferredWalletDeepLink } from '../getPreferredWalletDeepLink';\nexport { isWalletConnectWalletProvider } from '../isWalletConnectWalletProvider';\nexport type {\n WalletConnectConnectionResult,\n WalletConnectWalletProvider,\n} from '../walletConnectWalletProvider.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,oCAAoC,EAC/C,aACA,mFAE8B;CAC5B,eAAe;CACf,aAAa;CACd,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHJ,MAAa,8BAA8B,EACzC,gBAC0D;CAC1D,MAAM,EAAE,QAAQ,cAAc;AAE9B,6CAAc,CACZ,QAAO,UAAU;AAGnB,QAAO,aAAa;;;;;;;;;;;;;;;;;;;;;ACrBtB,MAAa,iCACX,mBACkD;AAClD,QAAO,eAAe,uBAAuBA,8CAAmB;;;;;mECnB7CC,6CAAMC,+CAAQ"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as name, r as version, t as SessionClosedUnexpectedlyError } from "./SessionClosedUnexpectedlyError-
|
|
1
|
+
import { n as name, r as version, t as SessionClosedUnexpectedlyError } from "./SessionClosedUnexpectedlyError-BlM2BV_T.esm.js";
|
|
2
2
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
3
|
import { SDK_ERRORS as WC_ERRORS } from "@walletconnect/utils";
|
|
4
4
|
import { appendConnectionUriToDeeplink, isMobile } from "@dynamic-labs-sdk/client";
|
|
@@ -12,9 +12,19 @@ import { WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
|
12
12
|
* was renamed to be generic across all URI-deeplink connection options
|
|
13
13
|
* (WalletConnect, MetaMask SDK URI, …).
|
|
14
14
|
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const deepLink = appendWalletConnectUriToDeepLink({
|
|
18
|
+
* deepLinkUrl: 'https://metamask.app.link/wc',
|
|
19
|
+
* walletConnectUri: 'wc:abc123@2?relay-protocol=irn&symKey=xyz',
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
15
23
|
* @param params.deepLinkUrl - The base deeplink URL.
|
|
16
24
|
* @param params.walletConnectUri - The WalletConnect pairing URI to append.
|
|
17
25
|
* @returns The deeplink URL with the WalletConnect URI appended as a query parameter.
|
|
26
|
+
* @see getPreferredWalletDeepLink
|
|
27
|
+
* @see isWalletConnectWalletProvider
|
|
18
28
|
* @notInstrumented
|
|
19
29
|
*/
|
|
20
30
|
const appendWalletConnectUriToDeepLink = ({ deepLinkUrl, walletConnectUri }) => appendConnectionUriToDeeplink({
|
|
@@ -37,8 +47,17 @@ const appendWalletConnectUriToDeepLink = ({ deepLinkUrl, walletConnectUri }) =>
|
|
|
37
47
|
* variant is missing. Returns `undefined` only when both variants are
|
|
38
48
|
* absent.
|
|
39
49
|
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const deepLink = getPreferredWalletDeepLink({
|
|
53
|
+
* deeplinks: wallet.deeplinks,
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
40
57
|
* @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).
|
|
41
58
|
* @returns The preferred deep link URL, or `undefined` if neither variant is available.
|
|
59
|
+
* @see appendConnectionUriToDeeplink
|
|
60
|
+
* @see isWalletConnectWalletProvider
|
|
42
61
|
* @notInstrumented
|
|
43
62
|
*/
|
|
44
63
|
const getPreferredWalletDeepLink = ({ deeplinks }) => {
|
|
@@ -49,7 +68,22 @@ const getPreferredWalletDeepLink = ({ deeplinks }) => {
|
|
|
49
68
|
|
|
50
69
|
//#endregion
|
|
51
70
|
//#region src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts
|
|
52
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Type guard function to check if a wallet provider is a WalletConnect wallet provider.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* if (isWalletConnectWalletProvider(provider)) {
|
|
77
|
+
* const session = provider.getSession();
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param walletProvider - The wallet provider to check.
|
|
82
|
+
* @returns True if the wallet provider is a WalletConnect wallet provider, false otherwise.
|
|
83
|
+
* @see getPreferredWalletDeepLink
|
|
84
|
+
* @see appendConnectionUriToDeeplink
|
|
85
|
+
* @notInstrumented
|
|
86
|
+
*/
|
|
53
87
|
const isWalletConnectWalletProvider = (walletProvider) => {
|
|
54
88
|
return walletProvider.walletProviderType === WalletProviderEnum.WalletConnect;
|
|
55
89
|
};
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","names":[],"sources":["../src/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.ts","../src/getPreferredWalletDeepLink/getPreferredWalletDeepLink.ts","../src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts","../src/exports/index.ts"],"sourcesContent":["import { appendConnectionUriToDeeplink } from '@dynamic-labs-sdk/client';\n\ntype AppendWalletConnectUriToDeepLinkParams = {\n deepLinkUrl: string;\n walletConnectUri: string;\n};\n\n/**\n * Appends a WalletConnect URI to a deeplink URL.\n *\n * @deprecated Use {@link appendConnectionUriToDeeplink} instead. This helper\n * was renamed to be generic across all URI-deeplink connection options\n * (WalletConnect, MetaMask SDK URI, …).\n *\n * @param params.deepLinkUrl - The base deeplink URL.\n * @param params.walletConnectUri - The WalletConnect pairing URI to append.\n * @returns The deeplink URL with the WalletConnect URI appended as a query parameter.\n * @notInstrumented\n */\nexport const appendWalletConnectUriToDeepLink = ({\n deepLinkUrl,\n walletConnectUri,\n}: AppendWalletConnectUriToDeepLinkParams): string =>\n appendConnectionUriToDeeplink({\n connectionUri: walletConnectUri,\n deeplinkUrl: deepLinkUrl,\n });\n","import type { WalletConnectCatalogDeepLinks } from '@dynamic-labs-sdk/client';\nimport { isMobile } from '@dynamic-labs-sdk/client';\n\ntype GetPreferredWalletDeepLinkParams = {\n deeplinks: WalletConnectCatalogDeepLinks;\n};\n\n/**\n * Picks the most appropriate deep link variant for the current platform.\n *\n * Mobile (Android, iOS, tablets) prefers `native` because the OS treats\n * custom URL schemes as first-class app links and gives the wallet a faster\n * round-trip back to the dApp. Desktop prefers `universal` because browsers\n * cannot resolve mobile-only custom schemes and need an `https://` link\n * that opens the wallet's web flow.\n *\n * In either case, the alternative is used as a fallback when the preferred\n * variant is missing. Returns `undefined` only when both variants are\n * absent.\n *\n * @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).\n * @returns The preferred deep link URL, or `undefined` if neither variant is available.\n * @notInstrumented\n */\nexport const getPreferredWalletDeepLink = ({\n deeplinks,\n}: GetPreferredWalletDeepLinkParams): string | undefined => {\n const { native, universal } = deeplinks;\n\n if (isMobile()) {\n return native ?? universal;\n }\n\n return universal ?? native;\n};\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { WalletConnectWalletProvider } from '../walletConnectWalletProvider.types';\n\n
|
|
1
|
+
{"version":3,"file":"index.esm.js","names":[],"sources":["../src/appendWalletConnectUriToDeepLink/appendWalletConnectUriToDeepLink.ts","../src/getPreferredWalletDeepLink/getPreferredWalletDeepLink.ts","../src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts","../src/exports/index.ts"],"sourcesContent":["import { appendConnectionUriToDeeplink } from '@dynamic-labs-sdk/client';\n\ntype AppendWalletConnectUriToDeepLinkParams = {\n deepLinkUrl: string;\n walletConnectUri: string;\n};\n\n/**\n * Appends a WalletConnect URI to a deeplink URL.\n *\n * @deprecated Use {@link appendConnectionUriToDeeplink} instead. This helper\n * was renamed to be generic across all URI-deeplink connection options\n * (WalletConnect, MetaMask SDK URI, …).\n *\n * @example\n * ```ts\n * const deepLink = appendWalletConnectUriToDeepLink({\n * deepLinkUrl: 'https://metamask.app.link/wc',\n * walletConnectUri: 'wc:abc123@2?relay-protocol=irn&symKey=xyz',\n * });\n * ```\n *\n * @param params.deepLinkUrl - The base deeplink URL.\n * @param params.walletConnectUri - The WalletConnect pairing URI to append.\n * @returns The deeplink URL with the WalletConnect URI appended as a query parameter.\n * @see getPreferredWalletDeepLink\n * @see isWalletConnectWalletProvider\n * @notInstrumented\n */\nexport const appendWalletConnectUriToDeepLink = ({\n deepLinkUrl,\n walletConnectUri,\n}: AppendWalletConnectUriToDeepLinkParams): string =>\n appendConnectionUriToDeeplink({\n connectionUri: walletConnectUri,\n deeplinkUrl: deepLinkUrl,\n });\n","import type { WalletConnectCatalogDeepLinks } from '@dynamic-labs-sdk/client';\nimport { isMobile } from '@dynamic-labs-sdk/client';\n\ntype GetPreferredWalletDeepLinkParams = {\n deeplinks: WalletConnectCatalogDeepLinks;\n};\n\n/**\n * Picks the most appropriate deep link variant for the current platform.\n *\n * Mobile (Android, iOS, tablets) prefers `native` because the OS treats\n * custom URL schemes as first-class app links and gives the wallet a faster\n * round-trip back to the dApp. Desktop prefers `universal` because browsers\n * cannot resolve mobile-only custom schemes and need an `https://` link\n * that opens the wallet's web flow.\n *\n * In either case, the alternative is used as a fallback when the preferred\n * variant is missing. Returns `undefined` only when both variants are\n * absent.\n *\n * @example\n * ```ts\n * const deepLink = getPreferredWalletDeepLink({\n * deeplinks: wallet.deeplinks,\n * });\n * ```\n *\n * @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).\n * @returns The preferred deep link URL, or `undefined` if neither variant is available.\n * @see appendConnectionUriToDeeplink\n * @see isWalletConnectWalletProvider\n * @notInstrumented\n */\nexport const getPreferredWalletDeepLink = ({\n deeplinks,\n}: GetPreferredWalletDeepLinkParams): string | undefined => {\n const { native, universal } = deeplinks;\n\n if (isMobile()) {\n return native ?? universal;\n }\n\n return universal ?? native;\n};\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { WalletConnectWalletProvider } from '../walletConnectWalletProvider.types';\n\n/**\n * Type guard function to check if a wallet provider is a WalletConnect wallet provider.\n *\n * @example\n * ```ts\n * if (isWalletConnectWalletProvider(provider)) {\n * const session = provider.getSession();\n * }\n * ```\n *\n * @param walletProvider - The wallet provider to check.\n * @returns True if the wallet provider is a WalletConnect wallet provider, false otherwise.\n * @see getPreferredWalletDeepLink\n * @see appendConnectionUriToDeeplink\n * @notInstrumented\n */\nexport const isWalletConnectWalletProvider = (\n walletProvider: WalletProvider\n): walletProvider is WalletConnectWalletProvider => {\n return walletProvider.walletProviderType === WalletProviderEnum.WalletConnect;\n};\n","/* eslint-disable import/no-unassigned-import */\nimport { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport { name, version } from '../../package.json';\n\nassertPackageVersion(name, version);\n\nimport '../events';\n\nexport { SDK_ERRORS as WC_ERRORS } from '@walletconnect/utils';\n\nexport { appendWalletConnectUriToDeepLink } from '../appendWalletConnectUriToDeepLink';\nexport { SessionClosedUnexpectedlyError } from '../errors/SessionClosedUnexpectedlyError';\nexport { getPreferredWalletDeepLink } from '../getPreferredWalletDeepLink';\nexport { isWalletConnectWalletProvider } from '../isWalletConnectWalletProvider';\nexport type {\n WalletConnectConnectionResult,\n WalletConnectWalletProvider,\n} from '../walletConnectWalletProvider.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,oCAAoC,EAC/C,aACA,uBAEA,8BAA8B;CAC5B,eAAe;CACf,aAAa;CACd,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHJ,MAAa,8BAA8B,EACzC,gBAC0D;CAC1D,MAAM,EAAE,QAAQ,cAAc;AAE9B,KAAI,UAAU,CACZ,QAAO,UAAU;AAGnB,QAAO,aAAa;;;;;;;;;;;;;;;;;;;;;ACrBtB,MAAa,iCACX,mBACkD;AAClD,QAAO,eAAe,uBAAuB,mBAAmB;;;;;ACnBlE,qBAAqB,MAAM,QAAQ"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { WalletProvider } from '@dynamic-labs-sdk/client/core';
|
|
2
2
|
import type { WalletConnectWalletProvider } from '../walletConnectWalletProvider.types';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Type guard function to check if a wallet provider is a WalletConnect wallet provider.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* if (isWalletConnectWalletProvider(provider)) {
|
|
9
|
+
* const session = provider.getSession();
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param walletProvider - The wallet provider to check.
|
|
14
|
+
* @returns True if the wallet provider is a WalletConnect wallet provider, false otherwise.
|
|
15
|
+
* @see getPreferredWalletDeepLink
|
|
16
|
+
* @see appendConnectionUriToDeeplink
|
|
17
|
+
* @notInstrumented
|
|
18
|
+
*/
|
|
4
19
|
export declare const isWalletConnectWalletProvider: (walletProvider: WalletProvider) => walletProvider is WalletConnectWalletProvider;
|
|
5
20
|
//# sourceMappingURL=isWalletConnectWalletProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isWalletConnectWalletProvider.d.ts","sourceRoot":"","sources":["../../src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGpE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAExF
|
|
1
|
+
{"version":3,"file":"isWalletConnectWalletProvider.d.ts","sourceRoot":"","sources":["../../src/isWalletConnectWalletProvider/isWalletConnectWalletProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGpE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAExF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,6BAA6B,mBACxB,cAAc,KAC7B,cAAc,IAAI,2BAEpB,CAAC"}
|