@dynamic-labs/wallet-connector-core 0.18.11 → 0.18.12
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/CHANGELOG.md +13 -0
- package/package.json +5 -5
- package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.cjs +7 -2
- package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.d.ts +2 -1
- package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.js +7 -2
- package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.cjs +14 -8
- package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.d.ts +3 -1
- package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.js +14 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.18.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.11...v0.18.12) (2023-08-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add deepLinkPreference prop ([#3174](https://github.com/dynamic-labs/DynamicAuth/issues/3174)) ([#3176](https://github.com/dynamic-labs/DynamicAuth/issues/3176)) ([8a6e389](https://github.com/dynamic-labs/DynamicAuth/commit/8a6e389e84bd74e80dc9df37ba6df5d46e6ba831))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* end connector session when unlinking from bridge ([#3120](https://github.com/dynamic-labs/DynamicAuth/issues/3120)) ([#3178](https://github.com/dynamic-labs/DynamicAuth/issues/3178)) ([0a69e21](https://github.com/dynamic-labs/DynamicAuth/commit/0a69e218dc9a9a0709bb74b901ed0ca08c7f463c))
|
|
13
|
+
* **bridge:** update address when switching networks ([#3171](https://github.com/dynamic-labs/DynamicAuth/issues/3171)) ([#3180](https://github.com/dynamic-labs/DynamicAuth/issues/3180)) ([8ab5ce4](https://github.com/dynamic-labs/DynamicAuth/commit/8ab5ce4add675ae326c052fc1510d54d56d0d665))
|
|
14
|
+
|
|
2
15
|
### [0.18.11](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.10...v0.18.11) (2023-08-29)
|
|
3
16
|
|
|
4
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wallet-connector-core",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@dynamic-labs/logger": "0.18.
|
|
31
|
-
"@dynamic-labs/rpc-providers": "0.18.
|
|
32
|
-
"@dynamic-labs/utils": "0.18.
|
|
33
|
-
"@dynamic-labs/wallet-book": "0.18.
|
|
30
|
+
"@dynamic-labs/logger": "0.18.12",
|
|
31
|
+
"@dynamic-labs/rpc-providers": "0.18.12",
|
|
32
|
+
"@dynamic-labs/utils": "0.18.12",
|
|
33
|
+
"@dynamic-labs/wallet-book": "0.18.12",
|
|
34
34
|
"eventemitter3": "5.0.1"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -5,9 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var utils = require('@dynamic-labs/utils');
|
|
6
6
|
var walletConnectDeepLinks = require('./walletConnectDeepLinks.cjs');
|
|
7
7
|
|
|
8
|
-
const performPlatformSpecificConnectionMethod = (uri, metadata, opts) => {
|
|
8
|
+
const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference) => {
|
|
9
9
|
var _a, _b, _c;
|
|
10
|
-
const deepLink = walletConnectDeepLinks.getDeepLink({
|
|
10
|
+
const deepLink = walletConnectDeepLinks.getDeepLink({
|
|
11
|
+
metadata,
|
|
12
|
+
mode: 'connection',
|
|
13
|
+
preference,
|
|
14
|
+
uri,
|
|
15
|
+
});
|
|
11
16
|
if (utils.isMobile()) {
|
|
12
17
|
window.location.href = deepLink;
|
|
13
18
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
2
2
|
import type { FetchPublicAddressOpts } from '../../lib';
|
|
3
|
-
|
|
3
|
+
import { DeepLinkVariant } from './walletConnectDeepLinks';
|
|
4
|
+
export declare const performPlatformSpecificConnectionMethod: (uri: string, metadata: WalletSchema, opts: Pick<FetchPublicAddressOpts, 'onDesktopUri' | 'onDisplayUri'>, preference: DeepLinkVariant) => void;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { isMobile } from '@dynamic-labs/utils';
|
|
2
2
|
import { getDeepLink } from './walletConnectDeepLinks.js';
|
|
3
3
|
|
|
4
|
-
const performPlatformSpecificConnectionMethod = (uri, metadata, opts) => {
|
|
4
|
+
const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference) => {
|
|
5
5
|
var _a, _b, _c;
|
|
6
|
-
const deepLink = getDeepLink({
|
|
6
|
+
const deepLink = getDeepLink({
|
|
7
|
+
metadata,
|
|
8
|
+
mode: 'connection',
|
|
9
|
+
preference,
|
|
10
|
+
uri,
|
|
11
|
+
});
|
|
7
12
|
if (isMobile()) {
|
|
8
13
|
window.location.href = deepLink;
|
|
9
14
|
}
|
|
@@ -4,32 +4,38 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var utils = require('@dynamic-labs/utils');
|
|
6
6
|
|
|
7
|
-
const getConnectionDeepLink = (uri, metadata) => {
|
|
7
|
+
const getConnectionDeepLink = (uri, metadata, preference) => {
|
|
8
8
|
// on android, the connection deeplink is simply the uri
|
|
9
9
|
// see: https://docs.walletconnect.com/mobile-linking#for-android
|
|
10
10
|
if (utils.isAndroid()) {
|
|
11
11
|
return uri;
|
|
12
12
|
}
|
|
13
|
-
const deepLink = getRegularDeepLink(uri, metadata);
|
|
13
|
+
const deepLink = getRegularDeepLink(uri, metadata, preference);
|
|
14
14
|
return `${deepLink}?uri=${encodeURIComponent(uri)}`;
|
|
15
15
|
};
|
|
16
|
-
const getRegularDeepLink = (uri, metadata) => {
|
|
17
|
-
var _a, _b;
|
|
16
|
+
const getRegularDeepLink = (uri, metadata, preference) => {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
18
|
if (utils.isAndroid()) {
|
|
19
19
|
// on android, the deeplink is simply the uri, without the query params
|
|
20
20
|
// see: https://docs.walletconnect.com/mobile-linking#for-android
|
|
21
21
|
return uri.split('?')[0];
|
|
22
22
|
}
|
|
23
23
|
const index = utils.isMobile() ? 'mobile' : 'desktop';
|
|
24
|
-
|
|
24
|
+
let origin;
|
|
25
|
+
if (preference === 'native') {
|
|
26
|
+
origin = ((_a = metadata[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata[index]) === null || _b === void 0 ? void 0 : _b.universal);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
origin = ((_c = metadata[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = metadata[index]) === null || _d === void 0 ? void 0 : _d.native);
|
|
30
|
+
}
|
|
25
31
|
return origin || '';
|
|
26
32
|
};
|
|
27
|
-
const getDeepLink = ({ mode, uri = '', metadata, }) => {
|
|
33
|
+
const getDeepLink = ({ mode, uri = '', metadata, preference, }) => {
|
|
28
34
|
switch (mode) {
|
|
29
35
|
case 'connection':
|
|
30
|
-
return getConnectionDeepLink(uri, metadata);
|
|
36
|
+
return getConnectionDeepLink(uri, metadata, preference);
|
|
31
37
|
case 'regular':
|
|
32
|
-
return getRegularDeepLink(uri, metadata);
|
|
38
|
+
return getRegularDeepLink(uri, metadata, preference);
|
|
33
39
|
}
|
|
34
40
|
};
|
|
35
41
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
2
|
+
export type DeepLinkVariant = 'native' | 'universal';
|
|
2
3
|
type GetDeepLinkArgs = {
|
|
3
4
|
metadata: WalletSchema;
|
|
4
5
|
mode: 'connection' | 'regular';
|
|
5
6
|
uri?: string;
|
|
7
|
+
preference: DeepLinkVariant;
|
|
6
8
|
};
|
|
7
|
-
export declare const getDeepLink: ({ mode, uri, metadata, }: GetDeepLinkArgs) => string;
|
|
9
|
+
export declare const getDeepLink: ({ mode, uri, metadata, preference, }: GetDeepLinkArgs) => string;
|
|
8
10
|
export {};
|
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import { isAndroid, isMobile } from '@dynamic-labs/utils';
|
|
2
2
|
|
|
3
|
-
const getConnectionDeepLink = (uri, metadata) => {
|
|
3
|
+
const getConnectionDeepLink = (uri, metadata, preference) => {
|
|
4
4
|
// on android, the connection deeplink is simply the uri
|
|
5
5
|
// see: https://docs.walletconnect.com/mobile-linking#for-android
|
|
6
6
|
if (isAndroid()) {
|
|
7
7
|
return uri;
|
|
8
8
|
}
|
|
9
|
-
const deepLink = getRegularDeepLink(uri, metadata);
|
|
9
|
+
const deepLink = getRegularDeepLink(uri, metadata, preference);
|
|
10
10
|
return `${deepLink}?uri=${encodeURIComponent(uri)}`;
|
|
11
11
|
};
|
|
12
|
-
const getRegularDeepLink = (uri, metadata) => {
|
|
13
|
-
var _a, _b;
|
|
12
|
+
const getRegularDeepLink = (uri, metadata, preference) => {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
14
|
if (isAndroid()) {
|
|
15
15
|
// on android, the deeplink is simply the uri, without the query params
|
|
16
16
|
// see: https://docs.walletconnect.com/mobile-linking#for-android
|
|
17
17
|
return uri.split('?')[0];
|
|
18
18
|
}
|
|
19
19
|
const index = isMobile() ? 'mobile' : 'desktop';
|
|
20
|
-
|
|
20
|
+
let origin;
|
|
21
|
+
if (preference === 'native') {
|
|
22
|
+
origin = ((_a = metadata[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata[index]) === null || _b === void 0 ? void 0 : _b.universal);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
origin = ((_c = metadata[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = metadata[index]) === null || _d === void 0 ? void 0 : _d.native);
|
|
26
|
+
}
|
|
21
27
|
return origin || '';
|
|
22
28
|
};
|
|
23
|
-
const getDeepLink = ({ mode, uri = '', metadata, }) => {
|
|
29
|
+
const getDeepLink = ({ mode, uri = '', metadata, preference, }) => {
|
|
24
30
|
switch (mode) {
|
|
25
31
|
case 'connection':
|
|
26
|
-
return getConnectionDeepLink(uri, metadata);
|
|
32
|
+
return getConnectionDeepLink(uri, metadata, preference);
|
|
27
33
|
case 'regular':
|
|
28
|
-
return getRegularDeepLink(uri, metadata);
|
|
34
|
+
return getRegularDeepLink(uri, metadata, preference);
|
|
29
35
|
}
|
|
30
36
|
};
|
|
31
37
|
|