@dynamic-labs/wallet-connector-core 4.0.0-alpha.5 → 4.0.0-alpha.51
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 +468 -0
- package/package.cjs +8 -0
- package/package.js +4 -0
- package/package.json +9 -16
- package/src/{lib/wallets/Wallet → Wallet}/Wallet.cjs +6 -6
- package/src/{lib/wallets/Wallet → Wallet}/Wallet.d.ts +6 -2
- package/src/{lib/wallets/Wallet → Wallet}/Wallet.js +6 -6
- package/src/{lib → WalletBookSingleton}/WalletBookSingleton.cjs +3 -0
- package/src/{lib → WalletBookSingleton}/WalletBookSingleton.d.ts +1 -0
- package/src/{lib → WalletBookSingleton}/WalletBookSingleton.js +3 -0
- package/src/WalletBookSingleton/index.d.ts +1 -0
- package/src/{lib/WalletConnector.cjs → WalletConnectorBase/WalletConnectorBase.cjs} +21 -38
- package/src/{lib/WalletConnector.d.ts → WalletConnectorBase/WalletConnectorBase.d.ts} +16 -45
- package/src/{lib/WalletConnector.js → WalletConnectorBase/WalletConnectorBase.js} +22 -37
- package/src/WalletConnectorBase/index.d.ts +2 -0
- package/src/WalletConnectorBase/types.cjs +33 -0
- package/src/WalletConnectorBase/types.d.ts +54 -0
- package/src/WalletConnectorBase/types.js +28 -0
- package/src/events/index.d.ts +1 -0
- package/src/events/walletConnectorEvents.cjs +14 -0
- package/src/events/walletConnectorEvents.d.ts +34 -0
- package/src/events/walletConnectorEvents.js +6 -0
- package/src/index.cjs +25 -7
- package/src/index.d.ts +7 -4
- package/src/index.js +14 -2
- package/src/{lib → interfaces}/IAccountAbstractionWalletConnector.d.ts +11 -2
- package/src/{lib → interfaces}/IBitcoinWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/ICoinbaseMPCWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/IEmailWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/IHardwareWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/IPasskeyWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/IPhantomRedirectConnector.d.ts +1 -1
- package/src/{lib → interfaces}/ISMSWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/ISendBalanceWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/ISessionKeyCompatibleWalletConnector.d.ts +1 -1
- package/src/{lib → interfaces}/ITurnkeyWalletConnector.d.ts +1 -1
- package/src/interfaces/ITurnkeyWalletConnectorStamper.d.ts +35 -0
- package/src/{lib → interfaces}/IWalletConnectConnector.d.ts +1 -1
- package/src/{lib → interfaces}/index.d.ts +7 -10
- package/src/types.d.ts +88 -0
- package/src/utils/convertWalletToBaseWallet/convertWalletToBaseWallet.cjs +24 -0
- package/src/utils/convertWalletToBaseWallet/convertWalletToBaseWallet.d.ts +4 -0
- package/src/utils/convertWalletToBaseWallet/convertWalletToBaseWallet.js +19 -0
- package/src/utils/convertWalletToBaseWallet/index.d.ts +1 -0
- package/src/utils/eventListenerHandlers.d.ts +1 -1
- package/src/utils/getChainInfo/getChainInfo.cjs +4 -4
- package/src/utils/getChainInfo/getChainInfo.d.ts +2 -2
- package/src/utils/getChainInfo/getChainInfo.js +4 -4
- package/src/utils/getWalletConnectorByKey.d.ts +1 -1
- package/src/utils/getWalletLinks/getWalletLinks.cjs +32 -0
- package/src/utils/getWalletLinks/getWalletLinks.d.ts +2 -0
- package/src/utils/getWalletLinks/getWalletLinks.js +28 -0
- package/src/utils/getWalletLinks/index.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.cjs +36 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.d.ts +6 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.js +32 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/index.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/getDownloadLinks.cjs +36 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/getDownloadLinks.d.ts +3 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/getDownloadLinks.js +32 -0
- package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/index.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/getIconUrl.cjs +15 -0
- package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/getIconUrl.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/getIconUrl.js +11 -0
- package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/index.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/getValidHexColor.cjs +15 -0
- package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/getValidHexColor.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/getValidHexColor.js +11 -0
- package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/index.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.cjs +19 -0
- package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.d.ts +3 -0
- package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.js +15 -0
- package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/index.d.ts +1 -0
- package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.cjs +54 -0
- package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.d.ts +10 -0
- package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.js +50 -0
- package/src/utils/getWalletMetadataFromWalletBook/index.d.ts +1 -0
- package/src/utils/index.d.ts +5 -0
- package/src/utils/isAccountAbstractionConnector/isAccountAbstractionConnector.d.ts +1 -1
- package/src/utils/isBitcoinConnector/isBitcoinConnector.d.ts +1 -1
- package/src/utils/isBloctoConnector/isBloctoConnector.d.ts +1 -1
- package/src/utils/isCoinbaseMpcWalletConnector/isCoinbaseMpcWalletConnector.d.ts +1 -1
- package/src/utils/isConnectorEventSupported/index.d.ts +1 -0
- package/src/utils/isConnectorEventSupported/isConnectorEventSupported.cjs +11 -0
- package/src/utils/isConnectorEventSupported/isConnectorEventSupported.d.ts +3 -0
- package/src/utils/isConnectorEventSupported/isConnectorEventSupported.js +7 -0
- package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.cjs +2 -5
- package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.d.ts +3 -3
- package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.js +2 -5
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.d.ts +1 -1
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.d.ts +1 -1
- package/src/utils/isEmbeddedConnector/isEmbeddedConnector.d.ts +1 -1
- package/src/utils/isHardwareWalletConnector/isHardwareWalletConnector.d.ts +1 -1
- package/src/utils/isMagicConnector/isMagicConnector.d.ts +1 -1
- package/src/utils/isPasskeyWalletConnector/isPasskeyWalletConnector.d.ts +1 -1
- package/src/utils/isPhantomRedirectConnector/isPhantomRedirectConnector.d.ts +1 -1
- package/src/utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.cjs +2 -1
- package/src/utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.d.ts +2 -2
- package/src/utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.js +2 -1
- package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.d.ts +1 -1
- package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.d.ts +2 -2
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.d.ts +1 -1
- package/src/utils/isTurnkeyWalletConnector/isTurnkeyWalletConnector.d.ts +1 -1
- package/src/utils/isWalletConnectConnector/isWalletConnectConnector.d.ts +1 -1
- package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.cjs +3 -3
- package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.d.ts +3 -3
- package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.js +3 -3
- package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.cjs +11 -8
- package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.d.ts +3 -3
- package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.js +11 -8
- package/src/lib/ITurnkeyWalletConnectorStamper.d.ts +0 -18
- package/src/lib/WalletConnectorExtension.d.ts +0 -7
- package/src/lib/types.d.ts +0 -8
- package/src/lib/wallets/index.d.ts +0 -1
- /package/src/{lib/wallets/Wallet → Wallet}/index.d.ts +0 -0
- /package/src/{lib → interfaces}/IEmailOTPWalletConnector.d.ts +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const getValidHexColor = (color) => {
|
|
7
|
+
if (!color) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
// Check if string starts with # and is followed by either 3 or 6 valid hex characters
|
|
11
|
+
const hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
12
|
+
return hexColorRegex.test(color) ? color : undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.getValidHexColor = getValidHexColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getValidHexColor: (color?: string) => `#${string}` | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const getValidHexColor = (color) => {
|
|
3
|
+
if (!color) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
// Check if string starts with # and is followed by either 3 or 6 valid hex characters
|
|
7
|
+
const hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
8
|
+
return hexColorRegex.test(color) ? color : undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { getValidHexColor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getValidHexColor';
|
package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const getWalletLimitations = (walletLimitations) => {
|
|
7
|
+
if (!(walletLimitations === null || walletLimitations === void 0 ? void 0 : walletLimitations.browserExtension)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const { unsupportedEvents, unsupportedMethods } = walletLimitations.browserExtension;
|
|
11
|
+
return {
|
|
12
|
+
desktop: {
|
|
13
|
+
unsupportedEvents: unsupportedEvents,
|
|
14
|
+
unsupportedMethods: unsupportedMethods,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.getWalletLimitations = getWalletLimitations;
|
package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const getWalletLimitations = (walletLimitations) => {
|
|
3
|
+
if (!(walletLimitations === null || walletLimitations === void 0 ? void 0 : walletLimitations.browserExtension)) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const { unsupportedEvents, unsupportedMethods } = walletLimitations.browserExtension;
|
|
7
|
+
return {
|
|
8
|
+
desktop: {
|
|
9
|
+
unsupportedEvents: unsupportedEvents,
|
|
10
|
+
unsupportedMethods: unsupportedMethods,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { getWalletLimitations };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getWalletLimitations';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
+
var logger = require('../logger.cjs');
|
|
8
|
+
require('@dynamic-labs/utils');
|
|
9
|
+
require('../../../_virtual/_tslib.cjs');
|
|
10
|
+
var getIconUrl = require('./getIconUrl/getIconUrl.cjs');
|
|
11
|
+
var getValidHexColor = require('./getValidHexColor/getValidHexColor.cjs');
|
|
12
|
+
var getDeepLinks = require('./getDeepLinks/getDeepLinks.cjs');
|
|
13
|
+
var getDownloadLinks = require('./getDownloadLinks/getDownloadLinks.cjs');
|
|
14
|
+
var getWalletLimitations = require('./getWalletLimitations/getWalletLimitations.cjs');
|
|
15
|
+
|
|
16
|
+
const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBook: walletBook$1, walletFallback, }) => {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
18
|
+
if (!walletBook.isWalletBookPopulated(walletBook$1) && !walletFallback) {
|
|
19
|
+
logger.logger.warn('Wallet book is required');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const wallet = walletBookWallet !== null && walletBookWallet !== void 0 ? walletBookWallet : walletBook.getWalletBookWallet(walletBook$1, walletKey, walletFallback);
|
|
24
|
+
// if no walletBookWallet is provided and no wallet is found in the wallet book, throw an error
|
|
25
|
+
if (!wallet) {
|
|
26
|
+
logger.logger.warn('Wallet not found in wallet book');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
brandColor: getValidHexColor.getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
|
|
31
|
+
deepLinks: getDeepLinks.getDeepLinks({
|
|
32
|
+
desktop: wallet === null || wallet === void 0 ? void 0 : wallet.desktop,
|
|
33
|
+
mobile: wallet === null || wallet === void 0 ? void 0 : wallet.mobile,
|
|
34
|
+
}),
|
|
35
|
+
downloadLinks: getDownloadLinks.getDownloadLinks(wallet),
|
|
36
|
+
groupKey: (_b = wallet === null || wallet === void 0 ? void 0 : wallet.chainGroup) !== null && _b !== void 0 ? _b : wallet === null || wallet === void 0 ? void 0 : wallet.walletGroup,
|
|
37
|
+
icon: (_d = getIconUrl.getIconUrl((_c = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _c === void 0 ? void 0 : _c.spriteId)) !== null && _d !== void 0 ? _d : '',
|
|
38
|
+
id: walletKey,
|
|
39
|
+
inAppBrowserUrl: (_f = (_e = wallet.mobile) === null || _e === void 0 ? void 0 : _e.inAppBrowser) !== null && _f !== void 0 ? _f : undefined,
|
|
40
|
+
name: wallet.name,
|
|
41
|
+
rdns: (_g = wallet.eip6963Config) === null || _g === void 0 ? void 0 : _g.rdns,
|
|
42
|
+
supportedHardwareWallets: wallet.hardwareWallets,
|
|
43
|
+
walletLimitations: getWalletLimitations.getWalletLimitations(wallet.walletLimitations),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
logger.logger.warn('Error getting wallet metadata from wallet book', {
|
|
48
|
+
error: e,
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.getWalletMetadataFromWalletBook = getWalletMetadataFromWalletBook;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WalletBookSchema, WalletSchema } from '@dynamic-labs/wallet-book';
|
|
2
|
+
import { WalletMetadata } from '../../types';
|
|
3
|
+
type GetWalletMetadataFromWalletBookOpts = {
|
|
4
|
+
walletKey: string;
|
|
5
|
+
walletBookWallet?: WalletSchema;
|
|
6
|
+
walletBook?: WalletBookSchema;
|
|
7
|
+
walletFallback?: WalletSchema;
|
|
8
|
+
};
|
|
9
|
+
export declare const getWalletMetadataFromWalletBook: ({ walletKey, walletBookWallet, walletBook, walletFallback, }: GetWalletMetadataFromWalletBookOpts) => WalletMetadata | undefined;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { isWalletBookPopulated, getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import { logger } from '../logger.js';
|
|
4
|
+
import '@dynamic-labs/utils';
|
|
5
|
+
import '../../../_virtual/_tslib.js';
|
|
6
|
+
import { getIconUrl } from './getIconUrl/getIconUrl.js';
|
|
7
|
+
import { getValidHexColor } from './getValidHexColor/getValidHexColor.js';
|
|
8
|
+
import { getDeepLinks } from './getDeepLinks/getDeepLinks.js';
|
|
9
|
+
import { getDownloadLinks } from './getDownloadLinks/getDownloadLinks.js';
|
|
10
|
+
import { getWalletLimitations } from './getWalletLimitations/getWalletLimitations.js';
|
|
11
|
+
|
|
12
|
+
const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBook, walletFallback, }) => {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
14
|
+
if (!isWalletBookPopulated(walletBook) && !walletFallback) {
|
|
15
|
+
logger.warn('Wallet book is required');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const wallet = walletBookWallet !== null && walletBookWallet !== void 0 ? walletBookWallet : getWalletBookWallet(walletBook, walletKey, walletFallback);
|
|
20
|
+
// if no walletBookWallet is provided and no wallet is found in the wallet book, throw an error
|
|
21
|
+
if (!wallet) {
|
|
22
|
+
logger.warn('Wallet not found in wallet book');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
brandColor: getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
|
|
27
|
+
deepLinks: getDeepLinks({
|
|
28
|
+
desktop: wallet === null || wallet === void 0 ? void 0 : wallet.desktop,
|
|
29
|
+
mobile: wallet === null || wallet === void 0 ? void 0 : wallet.mobile,
|
|
30
|
+
}),
|
|
31
|
+
downloadLinks: getDownloadLinks(wallet),
|
|
32
|
+
groupKey: (_b = wallet === null || wallet === void 0 ? void 0 : wallet.chainGroup) !== null && _b !== void 0 ? _b : wallet === null || wallet === void 0 ? void 0 : wallet.walletGroup,
|
|
33
|
+
icon: (_d = getIconUrl((_c = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _c === void 0 ? void 0 : _c.spriteId)) !== null && _d !== void 0 ? _d : '',
|
|
34
|
+
id: walletKey,
|
|
35
|
+
inAppBrowserUrl: (_f = (_e = wallet.mobile) === null || _e === void 0 ? void 0 : _e.inAppBrowser) !== null && _f !== void 0 ? _f : undefined,
|
|
36
|
+
name: wallet.name,
|
|
37
|
+
rdns: (_g = wallet.eip6963Config) === null || _g === void 0 ? void 0 : _g.rdns,
|
|
38
|
+
supportedHardwareWallets: wallet.hardwareWallets,
|
|
39
|
+
walletLimitations: getWalletLimitations(wallet.walletLimitations),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
logger.warn('Error getting wallet metadata from wallet book', {
|
|
44
|
+
error: e,
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { getWalletMetadataFromWalletBook };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getWalletMetadataFromWalletBook';
|
package/src/utils/index.d.ts
CHANGED
|
@@ -26,3 +26,8 @@ export * from './isWalletConnectConnector';
|
|
|
26
26
|
export * from './isSendBalanceWalletConnector';
|
|
27
27
|
export * from './isSessionKeyCompatible';
|
|
28
28
|
export * from './getMobileExperience';
|
|
29
|
+
export * from './getWalletMetadataFromWalletBook';
|
|
30
|
+
export * from './isConnectorMethodSupported';
|
|
31
|
+
export * from './isConnectorEventSupported';
|
|
32
|
+
export * from './getWalletLinks';
|
|
33
|
+
export * from './convertWalletToBaseWallet';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IAccountAbstractionWalletConnector } from '
|
|
1
|
+
import { IAccountAbstractionWalletConnector } from '../..';
|
|
2
2
|
export declare const isAccountAbstractionConnector: (walletConnector: IAccountAbstractionWalletConnector | unknown) => walletConnector is IAccountAbstractionWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IBitcoinWalletConnector, WalletConnector } from '
|
|
1
|
+
import { IBitcoinWalletConnector, WalletConnector } from '../..';
|
|
2
2
|
export declare const isBitcoinConnector: (connector: WalletConnector | IBitcoinWalletConnector) => connector is IBitcoinWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector } from '
|
|
1
|
+
import { WalletConnector } from '../..';
|
|
2
2
|
export declare const isBloctoConnector: (connector: WalletConnector) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICoinbaseMPCWalletConnector, WalletConnector } from '
|
|
1
|
+
import { ICoinbaseMPCWalletConnector, WalletConnector } from '../..';
|
|
2
2
|
export declare const isCoinbaseMpcWalletConnector: (connector?: WalletConnector | ICoinbaseMPCWalletConnector) => connector is ICoinbaseMPCWalletConnector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isConnectorEventSupported } from './isConnectorEventSupported';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const isConnectorEventSupported = (connector, event, platform) => {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedEvents) === null || _c === void 0 ? void 0 : _c.includes(event));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.isConnectorEventSupported = isConnectorEventSupported;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { WalletLimitations, WalletEvent } from '../../types';
|
|
2
|
+
import { InternalWalletConnector } from '../../WalletConnectorBase';
|
|
3
|
+
export declare const isConnectorEventSupported: (connector: InternalWalletConnector, event: WalletEvent, platform: keyof NonNullable<WalletLimitations>) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const isConnectorEventSupported = (connector, event, platform) => {
|
|
3
|
+
var _a, _b, _c;
|
|
4
|
+
return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedEvents) === null || _c === void 0 ? void 0 : _c.includes(event));
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { isConnectorEventSupported };
|
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
-
|
|
8
6
|
const isConnectorMethodSupported = (connector, method, platform) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return walletBook.isWalletMethodSupported(walletBookWallet, method, platform);
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedMethods) === null || _c === void 0 ? void 0 : _c.includes(method));
|
|
12
9
|
};
|
|
13
10
|
|
|
14
11
|
exports.isConnectorMethodSupported = isConnectorMethodSupported;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const isConnectorMethodSupported: (connector: InternalWalletConnector, method:
|
|
1
|
+
import { InternalWalletConnector } from '../..';
|
|
2
|
+
import { WalletLimitations, WalletMethod } from '../../types';
|
|
3
|
+
export declare const isConnectorMethodSupported: (connector: InternalWalletConnector, method: WalletMethod, platform: keyof NonNullable<WalletLimitations>) => boolean;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { getWalletBookWallet, isWalletMethodSupported } from '@dynamic-labs/wallet-book';
|
|
3
|
-
|
|
4
2
|
const isConnectorMethodSupported = (connector, method, platform) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return isWalletMethodSupported(walletBookWallet, method, platform);
|
|
3
|
+
var _a, _b, _c;
|
|
4
|
+
return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedMethods) === null || _c === void 0 ? void 0 : _c.includes(method));
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
export { isConnectorMethodSupported };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IEmailOTPWalletConnector, WalletConnector } from '
|
|
1
|
+
import { IEmailOTPWalletConnector, WalletConnector } from '../..';
|
|
2
2
|
export declare const isEmailOTPWalletConnector: (walletConnector: WalletConnector | IEmailOTPWalletConnector) => walletConnector is IEmailOTPWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector, IEmailWalletConnector } from '
|
|
1
|
+
import { WalletConnector, IEmailWalletConnector } from '../..';
|
|
2
2
|
export declare const isEmailWalletConnector: (walletConnector: WalletConnector | IEmailWalletConnector) => walletConnector is IEmailWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector } from '
|
|
1
|
+
import { WalletConnector } from '../..';
|
|
2
2
|
export declare const isEmbeddedConnector: (connector: WalletConnector) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IHardwareWalletConnector, WalletConnector } from '
|
|
1
|
+
import { IHardwareWalletConnector, WalletConnector } from '../..';
|
|
2
2
|
export declare const isHardwareWalletConnector: (connector: WalletConnector | IHardwareWalletConnector) => connector is IHardwareWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector } from '
|
|
1
|
+
import { WalletConnector } from '../..';
|
|
2
2
|
export declare const isMagicConnector: (connector: WalletConnector) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector, IPasskeyWalletConnector } from '
|
|
1
|
+
import { WalletConnector, IPasskeyWalletConnector } from '../..';
|
|
2
2
|
export declare const isPasskeyWalletConnector: (walletConnector: WalletConnector | IPasskeyWalletConnector) => walletConnector is IPasskeyWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPhantomRedirectConnectorWithEvents } from '
|
|
1
|
+
import { IPhantomRedirectConnectorWithEvents } from '../..';
|
|
2
2
|
export declare const isPhantomRedirectConnector: (connector: unknown) => connector is IPhantomRedirectConnectorWithEvents;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
const isSendBalanceWalletConnector = (walletConnector) => 'createUiTransaction' in walletConnector &&
|
|
7
|
-
typeof walletConnector.createUiTransaction === 'function'
|
|
7
|
+
typeof walletConnector.createUiTransaction === 'function' &&
|
|
8
|
+
walletConnector.isAvailable;
|
|
8
9
|
|
|
9
10
|
exports.isSendBalanceWalletConnector = isSendBalanceWalletConnector;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { WalletConnector } from '
|
|
2
|
-
import { ISendBalanceWalletConnector } from '../../
|
|
1
|
+
import { WalletConnector } from '../..';
|
|
2
|
+
import { ISendBalanceWalletConnector } from '../../interfaces/ISendBalanceWalletConnector';
|
|
3
3
|
export declare const isSendBalanceWalletConnector: (walletConnector: WalletConnector | ISendBalanceWalletConnector) => walletConnector is ISendBalanceWalletConnector;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
const isSendBalanceWalletConnector = (walletConnector) => 'createUiTransaction' in walletConnector &&
|
|
3
|
-
typeof walletConnector.createUiTransaction === 'function'
|
|
3
|
+
typeof walletConnector.createUiTransaction === 'function' &&
|
|
4
|
+
walletConnector.isAvailable;
|
|
4
5
|
|
|
5
6
|
export { isSendBalanceWalletConnector };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Wallet } from '../../../
|
|
1
|
+
import { Wallet } from '../../../Wallet';
|
|
2
2
|
export declare const isSessionKeyCompatibleWallet: (wallet: Wallet) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ISessionKeyCompatibleWalletConnector } from '../../../
|
|
2
|
-
import { WalletConnector } from '../../../
|
|
1
|
+
import { ISessionKeyCompatibleWalletConnector } from '../../../interfaces/ISessionKeyCompatibleWalletConnector';
|
|
2
|
+
import { WalletConnector } from '../../../WalletConnectorBase';
|
|
3
3
|
export declare const isSessionKeyCompatibleWalletConnector: (walletConnector: WalletConnector | ISessionKeyCompatibleWalletConnector | undefined | null) => walletConnector is ISessionKeyCompatibleWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector } from '
|
|
1
|
+
import { WalletConnector } from '../..';
|
|
2
2
|
export declare const isSocialWalletConnector: (walletConnector: WalletConnector) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnector, ITurnkeyWalletConnector } from '
|
|
1
|
+
import { WalletConnector, ITurnkeyWalletConnector } from '../..';
|
|
2
2
|
export declare const isTurnkeyWalletConnector: (walletConnector: WalletConnector) => walletConnector is ITurnkeyWalletConnector;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IWalletConnectConnector, WalletConnector } from '
|
|
1
|
+
import { IWalletConnectConnector, WalletConnector } from '../..';
|
|
2
2
|
export declare const isWalletConnectConnector: (connector?: WalletConnector) => connector is IWalletConnectConnector;
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var utils = require('@dynamic-labs/utils');
|
|
7
7
|
var walletConnectDeepLinks = require('./walletConnectDeepLinks.cjs');
|
|
8
8
|
|
|
9
|
-
const performPlatformSpecificConnectionMethod = (uri,
|
|
9
|
+
const performPlatformSpecificConnectionMethod = (uri, deepLinks, opts, preference) => {
|
|
10
10
|
var _a, _b, _c;
|
|
11
11
|
const deepLink = walletConnectDeepLinks.getDeepLink({
|
|
12
|
-
|
|
12
|
+
deepLinks,
|
|
13
13
|
mode: 'connection',
|
|
14
14
|
preference,
|
|
15
15
|
uri,
|
|
@@ -18,7 +18,7 @@ const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference
|
|
|
18
18
|
window.location.href = deepLink;
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
if ((_a =
|
|
21
|
+
if ((_a = deepLinks === null || deepLinks === void 0 ? void 0 : deepLinks.desktop) === null || _a === void 0 ? void 0 : _a.native) {
|
|
22
22
|
(_b = opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, deepLink);
|
|
23
23
|
}
|
|
24
24
|
(_c = opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, uri);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { GetAddressOpts } from '../../WalletConnectorBase/types';
|
|
2
|
+
import type { WalletDeepLinks } from '../../types';
|
|
3
3
|
import { DeepLinkVariant } from './walletConnectDeepLinks';
|
|
4
|
-
export declare const performPlatformSpecificConnectionMethod: (uri: string,
|
|
4
|
+
export declare const performPlatformSpecificConnectionMethod: (uri: string, deepLinks: WalletDeepLinks | undefined, opts: Pick<GetAddressOpts, 'onDesktopUri' | 'onDisplayUri'>, preference: DeepLinkVariant) => void;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { isMobile } from '@dynamic-labs/utils';
|
|
3
3
|
import { getDeepLink } from './walletConnectDeepLinks.js';
|
|
4
4
|
|
|
5
|
-
const performPlatformSpecificConnectionMethod = (uri,
|
|
5
|
+
const performPlatformSpecificConnectionMethod = (uri, deepLinks, opts, preference) => {
|
|
6
6
|
var _a, _b, _c;
|
|
7
7
|
const deepLink = getDeepLink({
|
|
8
|
-
|
|
8
|
+
deepLinks,
|
|
9
9
|
mode: 'connection',
|
|
10
10
|
preference,
|
|
11
11
|
uri,
|
|
@@ -14,7 +14,7 @@ const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference
|
|
|
14
14
|
window.location.href = deepLink;
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
if ((_a =
|
|
17
|
+
if ((_a = deepLinks === null || deepLinks === void 0 ? void 0 : deepLinks.desktop) === null || _a === void 0 ? void 0 : _a.native) {
|
|
18
18
|
(_b = opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, deepLink);
|
|
19
19
|
}
|
|
20
20
|
(_c = opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, uri);
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var utils = require('@dynamic-labs/utils');
|
|
7
7
|
|
|
8
|
-
const getConnectionDeepLink = (uri,
|
|
8
|
+
const getConnectionDeepLink = (uri, deepLinks, preference) => {
|
|
9
9
|
// on android, the connection deeplink is simply the uri
|
|
10
10
|
// see: https://docs.walletconnect.com/mobile-linking#for-android
|
|
11
11
|
if (utils.isAndroid()) {
|
|
12
12
|
return uri;
|
|
13
13
|
}
|
|
14
|
-
const deepLink = getRegularDeepLink(uri,
|
|
14
|
+
const deepLink = getRegularDeepLink(uri, deepLinks, preference);
|
|
15
15
|
if (!deepLink) {
|
|
16
16
|
return `${deepLink}?uri=${encodeURIComponent(uri)}`;
|
|
17
17
|
}
|
|
@@ -21,7 +21,7 @@ const getConnectionDeepLink = (uri, metadata, preference) => {
|
|
|
21
21
|
deepLinkUrl.search = deepLinkParams.toString();
|
|
22
22
|
return deepLinkUrl.toString();
|
|
23
23
|
};
|
|
24
|
-
const getRegularDeepLink = (uri,
|
|
24
|
+
const getRegularDeepLink = (uri, deepLinks, preference) => {
|
|
25
25
|
var _a, _b, _c, _d;
|
|
26
26
|
if (utils.isAndroid()) {
|
|
27
27
|
// on android, the deeplink is simply the uri, without the query params
|
|
@@ -31,19 +31,22 @@ const getRegularDeepLink = (uri, metadata, preference) => {
|
|
|
31
31
|
const index = utils.isMobile() ? 'mobile' : 'desktop';
|
|
32
32
|
let origin;
|
|
33
33
|
if (preference === 'native') {
|
|
34
|
-
origin = ((_a =
|
|
34
|
+
origin = ((_a = deepLinks[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = deepLinks[index]) === null || _b === void 0 ? void 0 : _b.universal);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
origin = ((_c =
|
|
37
|
+
origin = ((_c = deepLinks[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = deepLinks[index]) === null || _d === void 0 ? void 0 : _d.native);
|
|
38
38
|
}
|
|
39
39
|
return origin || '';
|
|
40
40
|
};
|
|
41
|
-
const getDeepLink = ({ mode, uri = '',
|
|
41
|
+
const getDeepLink = ({ mode, uri = '', deepLinks, preference, }) => {
|
|
42
|
+
if (!deepLinks) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
42
45
|
switch (mode) {
|
|
43
46
|
case 'connection':
|
|
44
|
-
return getConnectionDeepLink(uri,
|
|
47
|
+
return getConnectionDeepLink(uri, deepLinks, preference);
|
|
45
48
|
case 'regular':
|
|
46
|
-
return getRegularDeepLink(uri,
|
|
49
|
+
return getRegularDeepLink(uri, deepLinks, preference);
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
52
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WalletDeepLinks } from '../../types';
|
|
2
2
|
export type DeepLinkVariant = 'native' | 'universal';
|
|
3
3
|
type GetDeepLinkArgs = {
|
|
4
|
-
|
|
4
|
+
deepLinks: WalletDeepLinks | undefined;
|
|
5
5
|
mode: 'connection' | 'regular';
|
|
6
6
|
uri?: string;
|
|
7
7
|
preference: DeepLinkVariant;
|
|
8
8
|
};
|
|
9
|
-
export declare const getDeepLink: ({ mode, uri,
|
|
9
|
+
export declare const getDeepLink: ({ mode, uri, deepLinks, preference, }: GetDeepLinkArgs) => string;
|
|
10
10
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { isAndroid, isMobile } from '@dynamic-labs/utils';
|
|
3
3
|
|
|
4
|
-
const getConnectionDeepLink = (uri,
|
|
4
|
+
const getConnectionDeepLink = (uri, deepLinks, preference) => {
|
|
5
5
|
// on android, the connection deeplink is simply the uri
|
|
6
6
|
// see: https://docs.walletconnect.com/mobile-linking#for-android
|
|
7
7
|
if (isAndroid()) {
|
|
8
8
|
return uri;
|
|
9
9
|
}
|
|
10
|
-
const deepLink = getRegularDeepLink(uri,
|
|
10
|
+
const deepLink = getRegularDeepLink(uri, deepLinks, preference);
|
|
11
11
|
if (!deepLink) {
|
|
12
12
|
return `${deepLink}?uri=${encodeURIComponent(uri)}`;
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ const getConnectionDeepLink = (uri, metadata, preference) => {
|
|
|
17
17
|
deepLinkUrl.search = deepLinkParams.toString();
|
|
18
18
|
return deepLinkUrl.toString();
|
|
19
19
|
};
|
|
20
|
-
const getRegularDeepLink = (uri,
|
|
20
|
+
const getRegularDeepLink = (uri, deepLinks, preference) => {
|
|
21
21
|
var _a, _b, _c, _d;
|
|
22
22
|
if (isAndroid()) {
|
|
23
23
|
// on android, the deeplink is simply the uri, without the query params
|
|
@@ -27,19 +27,22 @@ const getRegularDeepLink = (uri, metadata, preference) => {
|
|
|
27
27
|
const index = isMobile() ? 'mobile' : 'desktop';
|
|
28
28
|
let origin;
|
|
29
29
|
if (preference === 'native') {
|
|
30
|
-
origin = ((_a =
|
|
30
|
+
origin = ((_a = deepLinks[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = deepLinks[index]) === null || _b === void 0 ? void 0 : _b.universal);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
origin = ((_c =
|
|
33
|
+
origin = ((_c = deepLinks[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = deepLinks[index]) === null || _d === void 0 ? void 0 : _d.native);
|
|
34
34
|
}
|
|
35
35
|
return origin || '';
|
|
36
36
|
};
|
|
37
|
-
const getDeepLink = ({ mode, uri = '',
|
|
37
|
+
const getDeepLink = ({ mode, uri = '', deepLinks, preference, }) => {
|
|
38
|
+
if (!deepLinks) {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
38
41
|
switch (mode) {
|
|
39
42
|
case 'connection':
|
|
40
|
-
return getConnectionDeepLink(uri,
|
|
43
|
+
return getConnectionDeepLink(uri, deepLinks, preference);
|
|
41
44
|
case 'regular':
|
|
42
|
-
return getRegularDeepLink(uri,
|
|
45
|
+
return getRegularDeepLink(uri, deepLinks, preference);
|
|
43
46
|
}
|
|
44
47
|
};
|
|
45
48
|
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { WalletConnectorBase } from './WalletConnector';
|
|
2
|
-
export interface ITurnkeyWalletConnectorStamper extends WalletConnectorBase {
|
|
3
|
-
stampCreateWalletAccountRequest: ({ request, }: {
|
|
4
|
-
request: {
|
|
5
|
-
type: string;
|
|
6
|
-
timestampMs: string;
|
|
7
|
-
organizationId: string;
|
|
8
|
-
parameters: any;
|
|
9
|
-
};
|
|
10
|
-
}) => Promise<{
|
|
11
|
-
body: string;
|
|
12
|
-
url: string;
|
|
13
|
-
stamp: {
|
|
14
|
-
stampHeaderName: string;
|
|
15
|
-
stampHeaderValue: string;
|
|
16
|
-
};
|
|
17
|
-
}>;
|
|
18
|
-
}
|
package/src/lib/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Wallet';
|
|
File without changes
|
|
File without changes
|