@dynamic-labs/wallet-connector-core 3.0.0-alpha.9 → 3.0.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/CHANGELOG.md +620 -0
- package/_virtual/_tslib.cjs +13 -0
- package/_virtual/_tslib.js +13 -1
- package/package.json +7 -7
- package/src/index.cjs +11 -3
- package/src/index.d.ts +3 -3
- package/src/index.js +6 -3
- package/src/lib/IAccountAbstractionWalletConnector.d.ts +11 -2
- package/src/lib/IBitcoinWalletConnector.d.ts +1 -0
- package/src/lib/IHardwareWalletConnector.d.ts +2 -1
- package/src/lib/ISendBalanceWalletConnector.d.ts +2 -1
- package/src/lib/ISessionKeyCompatibleWalletConnector.d.ts +6 -2
- package/src/lib/ITurnkeyWalletConnector.d.ts +49 -0
- package/src/lib/ITurnkeyWalletConnectorStamper.d.ts +18 -0
- package/src/lib/WalletConnector.cjs +124 -21
- package/src/lib/WalletConnector.d.ts +47 -30
- package/src/lib/WalletConnector.js +124 -21
- package/src/lib/WalletConnectorExtension.d.ts +2 -2
- package/src/lib/index.d.ts +3 -1
- package/src/lib/wallets/Wallet/Wallet.cjs +119 -0
- package/src/lib/wallets/Wallet/Wallet.d.ts +65 -0
- package/src/lib/wallets/Wallet/Wallet.js +115 -0
- package/src/lib/wallets/Wallet/index.d.ts +1 -0
- package/src/lib/wallets/index.d.ts +1 -0
- package/src/utils/getChainInfo/getChainInfo.cjs +25 -0
- package/src/utils/getChainInfo/getChainInfo.d.ts +6 -0
- package/src/utils/getChainInfo/getChainInfo.js +24 -1
- package/src/utils/getChainInfo/index.d.ts +1 -1
- package/src/utils/getMobileExperience/getMobileExperience.cjs +24 -0
- package/src/utils/getMobileExperience/getMobileExperience.d.ts +7 -0
- package/src/utils/getMobileExperience/getMobileExperience.js +20 -0
- package/src/utils/getMobileExperience/index.d.ts +1 -0
- package/src/utils/getWalletConnectorByKey.d.ts +2 -2
- package/src/utils/index.d.ts +3 -2
- package/src/utils/isAccountAbstractionConnector/index.d.ts +1 -1
- package/src/utils/isConnectorMethodSupported/index.d.ts +1 -0
- package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.cjs +14 -0
- package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.d.ts +3 -0
- package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.js +10 -0
- package/src/utils/isHardwareWalletConnector/isHardwareWalletConnector.d.ts +1 -1
- package/src/utils/isSessionKeyCompatible/index.d.ts +2 -0
- package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/index.d.ts +1 -0
- package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.cjs +10 -0
- package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.d.ts +2 -0
- package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.js +6 -0
- package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/isSessionKeyCompatibleWalletConnector.d.ts +2 -1
- package/src/utils/isTurnkeyWalletConnector/index.d.ts +1 -0
- package/src/utils/isTurnkeyWalletConnector/isTurnkeyWalletConnector.cjs +17 -0
- package/src/utils/isTurnkeyWalletConnector/isTurnkeyWalletConnector.d.ts +2 -0
- package/src/utils/isTurnkeyWalletConnector/isTurnkeyWalletConnector.js +13 -0
- package/src/lib/SmartWalletConnector.d.ts +0 -4
- package/src/utils/isSmartWalletConnector/index.d.ts +0 -1
- package/src/utils/isSmartWalletConnector/isSmartWalletConnector.cjs +0 -8
- package/src/utils/isSmartWalletConnector/isSmartWalletConnector.d.ts +0 -2
- package/src/utils/isSmartWalletConnector/isSmartWalletConnector.js +0 -4
- /package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/index.d.ts +0 -0
- /package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/isSessionKeyCompatibleWalletConnector.cjs +0 -0
- /package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/isSessionKeyCompatibleWalletConnector.js +0 -0
package/_virtual/_tslib.cjs
CHANGED
|
@@ -18,6 +18,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
18
18
|
PERFORMANCE OF THIS SOFTWARE.
|
|
19
19
|
***************************************************************************** */
|
|
20
20
|
|
|
21
|
+
function __rest(s, e) {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
+
t[p] = s[p];
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
+
t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
|
|
21
33
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
22
34
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
35
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,3 +53,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
41
53
|
|
|
42
54
|
exports.__awaiter = __awaiter;
|
|
43
55
|
exports.__classPrivateFieldGet = __classPrivateFieldGet;
|
|
56
|
+
exports.__rest = __rest;
|
package/_virtual/_tslib.js
CHANGED
|
@@ -14,6 +14,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
16
|
|
|
17
|
+
function __rest(s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
+
t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
18
30
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
31
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,4 +47,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
35
47
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
36
48
|
};
|
|
37
49
|
|
|
38
|
-
export { __awaiter, __classPrivateFieldGet };
|
|
50
|
+
export { __awaiter, __classPrivateFieldGet, __rest };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wallet-connector-core",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
29
|
+
"@dynamic-labs/sdk-api-core": "0.0.529"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@dynamic-labs/logger": "3.0.0
|
|
33
|
-
"@dynamic-labs/rpc-providers": "3.0.0
|
|
34
|
-
"@dynamic-labs/types": "3.0.0
|
|
35
|
-
"@dynamic-labs/utils": "3.0.0
|
|
36
|
-
"@dynamic-labs/wallet-book": "3.0.0
|
|
32
|
+
"@dynamic-labs/logger": "3.0.0",
|
|
33
|
+
"@dynamic-labs/rpc-providers": "3.0.0",
|
|
34
|
+
"@dynamic-labs/types": "3.0.0",
|
|
35
|
+
"@dynamic-labs/utils": "3.0.0",
|
|
36
|
+
"@dynamic-labs/wallet-book": "3.0.0",
|
|
37
37
|
"eventemitter3": "5.0.1"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/index.cjs
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var WalletConnector = require('./lib/WalletConnector.cjs');
|
|
7
|
+
var Wallet = require('./lib/wallets/Wallet/Wallet.cjs');
|
|
7
8
|
var logger = require('./utils/logger.cjs');
|
|
8
9
|
var ProviderLookup = require('./utils/ProviderLookup/ProviderLookup.cjs');
|
|
9
10
|
var getChainInfo = require('./utils/getChainInfo/getChainInfo.cjs');
|
|
10
11
|
var isEmailOTPWalletConnector = require('./utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.cjs');
|
|
11
12
|
var isEmailWalletConnector = require('./utils/isEmailWalletConnector/isEmailWalletConnector.cjs');
|
|
13
|
+
var isTurnkeyWalletConnector = require('./utils/isTurnkeyWalletConnector/isTurnkeyWalletConnector.cjs');
|
|
12
14
|
var isSameAddress = require('./utils/isSameAddress/isSameAddress.cjs');
|
|
13
15
|
var isSocialWalletConnector = require('./utils/isSocialWalletConnector/isSocialWalletConnector.cjs');
|
|
14
16
|
var encoding = require('./utils/encoding.cjs');
|
|
@@ -20,7 +22,6 @@ var isEmbeddedConnector = require('./utils/isEmbeddedConnector/isEmbeddedConnect
|
|
|
20
22
|
var isMagicConnector = require('./utils/isMagicConnector/isMagicConnector.cjs');
|
|
21
23
|
var isBloctoConnector = require('./utils/isBloctoConnector/isBloctoConnector.cjs');
|
|
22
24
|
var isPasskeyWalletConnector = require('./utils/isPasskeyWalletConnector/isPasskeyWalletConnector.cjs');
|
|
23
|
-
var isSmartWalletConnector = require('./utils/isSmartWalletConnector/isSmartWalletConnector.cjs');
|
|
24
25
|
var isAccountAbstractionConnector = require('./utils/isAccountAbstractionConnector/isAccountAbstractionConnector.cjs');
|
|
25
26
|
var isBitcoinConnector = require('./utils/isBitcoinConnector/isBitcoinConnector.cjs');
|
|
26
27
|
var isHardwareWalletConnector = require('./utils/isHardwareWalletConnector/isHardwareWalletConnector.cjs');
|
|
@@ -31,18 +32,24 @@ var getRpcUrlForChain = require('./utils/getRpcUrlForChain/getRpcUrlForChain.cjs
|
|
|
31
32
|
var isCoinbaseMpcWalletConnector = require('./utils/isCoinbaseMpcWalletConnector/isCoinbaseMpcWalletConnector.cjs');
|
|
32
33
|
var isWalletConnectConnector = require('./utils/isWalletConnectConnector/isWalletConnectConnector.cjs');
|
|
33
34
|
var isSendBalanceWalletConnector = require('./utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.cjs');
|
|
34
|
-
var
|
|
35
|
+
var isSessionKeyCompatibleWallet = require('./utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.cjs');
|
|
36
|
+
var isSessionKeyCompatibleWalletConnector = require('./utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.cjs');
|
|
37
|
+
var getMobileExperience = require('./utils/getMobileExperience/getMobileExperience.cjs');
|
|
35
38
|
|
|
36
39
|
|
|
37
40
|
|
|
38
41
|
exports.Chains = WalletConnector.Chains;
|
|
39
42
|
exports.WalletConnectorBase = WalletConnector.WalletConnectorBase;
|
|
40
43
|
exports.socialProviders = WalletConnector.socialProviders;
|
|
44
|
+
exports.Wallet = Wallet.Wallet;
|
|
41
45
|
exports.logger = logger.logger;
|
|
42
46
|
exports.ProviderLookup = ProviderLookup.ProviderLookup;
|
|
43
47
|
exports.getChainInfo = getChainInfo.getChainInfo;
|
|
48
|
+
exports.getChainInfoWithOverrides = getChainInfo.getChainInfoWithOverrides;
|
|
49
|
+
exports.setChainInfoOverrides = getChainInfo.setChainInfoOverrides;
|
|
44
50
|
exports.isEmailOTPWalletConnector = isEmailOTPWalletConnector.isEmailOTPWalletConnector;
|
|
45
51
|
exports.isEmailWalletConnector = isEmailWalletConnector.isEmailWalletConnector;
|
|
52
|
+
exports.isTurnkeyWalletConnector = isTurnkeyWalletConnector.isTurnkeyWalletConnector;
|
|
46
53
|
exports.isSameAddress = isSameAddress.isSameAddress;
|
|
47
54
|
exports.isSocialWalletConnector = isSocialWalletConnector.isSocialWalletConnector;
|
|
48
55
|
exports.addHexPrefix = encoding.addHexPrefix;
|
|
@@ -56,7 +63,6 @@ exports.isEmbeddedConnector = isEmbeddedConnector.isEmbeddedConnector;
|
|
|
56
63
|
exports.isMagicConnector = isMagicConnector.isMagicConnector;
|
|
57
64
|
exports.isBloctoConnector = isBloctoConnector.isBloctoConnector;
|
|
58
65
|
exports.isPasskeyWalletConnector = isPasskeyWalletConnector.isPasskeyWalletConnector;
|
|
59
|
-
exports.isSmartWalletConnector = isSmartWalletConnector.isSmartWalletConnector;
|
|
60
66
|
exports.isAccountAbstractionConnector = isAccountAbstractionConnector.isAccountAbstractionConnector;
|
|
61
67
|
exports.isBitcoinConnector = isBitcoinConnector.isBitcoinConnector;
|
|
62
68
|
exports.isHardwareWalletConnector = isHardwareWalletConnector.isHardwareWalletConnector;
|
|
@@ -67,4 +73,6 @@ exports.getRpcUrlForChain = getRpcUrlForChain.getRpcUrlForChain;
|
|
|
67
73
|
exports.isCoinbaseMpcWalletConnector = isCoinbaseMpcWalletConnector.isCoinbaseMpcWalletConnector;
|
|
68
74
|
exports.isWalletConnectConnector = isWalletConnectConnector.isWalletConnectConnector;
|
|
69
75
|
exports.isSendBalanceWalletConnector = isSendBalanceWalletConnector.isSendBalanceWalletConnector;
|
|
76
|
+
exports.isSessionKeyCompatibleWallet = isSessionKeyCompatibleWallet.isSessionKeyCompatibleWallet;
|
|
70
77
|
exports.isSessionKeyCompatibleWalletConnector = isSessionKeyCompatibleWalletConnector.isSessionKeyCompatibleWalletConnector;
|
|
78
|
+
exports.getMobileExperience = getMobileExperience.getMobileExperience;
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './types';
|
|
3
|
-
export * from './utils';
|
|
1
|
+
export { Chains, Wallet, WalletConnectorBase, socialProviders, type Attestation, type AuthenticatorRecoveryHandler, type AuthenticatorType, type BitcoinSignPsbtRequest, type BitcoinSignPsbtRequestSignature, type BitcoinSignPsbtResponse, type Chain, type ChainInfo, type ExportHandler, type ExtendedPrivateKey, type GetAddressOpts, type IAccountAbstractionWalletConnector, type IBitcoinWalletConnector, type ICoinbaseMPCWalletConnector, type IEmailOTPWalletConnector, type IEmailWalletConnector, type IHardwareWalletConnector, type ITurnkeyWalletConnector, type InternalWalletConnector, type IPasskeyWalletConnector, type IPhantomRedirectConnector, type IPhantomRedirectConnectorWithEvents, type ISMSWalletConnector, type ISendBalanceWalletConnector, type ISessionKeyCompatibleWalletConnector, type ITurnkeyWalletConnectorStamper, type IWalletConnectConnector, type NameServiceData, type PayloadParams, type RawPrivateKey, type RecoveryEmailParams, type RecoveryWebAuthnAttestation, type SignAllTransactionsListener, type SignAndSendTransactionListener, type SignMessageListener, type SignTransactionListener, type SocialProvider, type WalletConnector, type WalletConnectorConstructor, type WalletConnectorCore, type WalletConnectorEventTypes, type WalletConnectorsMethod, type WalletConstructor, type WalletProps, type WebAuthnAttestation, } from './lib';
|
|
4
2
|
export type { WalletConnectorExtension } from './lib/WalletConnectorExtension';
|
|
3
|
+
export type { AccountChangeEventHandler, ChainChangeEventHandler, DisconnectEventHandler, } from './types';
|
|
4
|
+
export { ProviderLookup, addHexPrefix, bufferToHex, eventListenerHandlers, getChainInfo, getChainInfoWithOverrides, setChainInfoOverrides, getDeepLink, getMobileExperience, getRpcUrlForChain, getWalletConnectorByKey, isAccountAbstractionConnector, isBitcoinConnector, isBloctoConnector, isCoinbaseMpcWalletConnector, isTurnkeyWalletConnector, isEmailOTPWalletConnector, isEmailWalletConnector, isEmbeddedConnector, isHardwareWalletConnector, isHex, isMagicConnector, isPasskeyWalletConnector, isPhantomRedirectConnector, isSameAddress, isSendBalanceWalletConnector, isSessionKeyCompatibleWallet, isSessionKeyCompatibleWalletConnector, isSocialWalletConnector, isWalletConnectConnector, logger, performPlatformSpecificConnectionMethod, shouldLowercaseAddress, utf8ToHex, type DeepLinkVariant, type ProviderCondition, type ChainDisplayOverrides, } from './utils';
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
export { Chains, WalletConnectorBase, socialProviders } from './lib/WalletConnector.js';
|
|
3
|
+
export { Wallet } from './lib/wallets/Wallet/Wallet.js';
|
|
3
4
|
export { logger } from './utils/logger.js';
|
|
4
5
|
export { ProviderLookup } from './utils/ProviderLookup/ProviderLookup.js';
|
|
5
|
-
export { getChainInfo } from './utils/getChainInfo/getChainInfo.js';
|
|
6
|
+
export { getChainInfo, getChainInfoWithOverrides, setChainInfoOverrides } from './utils/getChainInfo/getChainInfo.js';
|
|
6
7
|
export { isEmailOTPWalletConnector } from './utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js';
|
|
7
8
|
export { isEmailWalletConnector } from './utils/isEmailWalletConnector/isEmailWalletConnector.js';
|
|
9
|
+
export { isTurnkeyWalletConnector } from './utils/isTurnkeyWalletConnector/isTurnkeyWalletConnector.js';
|
|
8
10
|
export { isSameAddress } from './utils/isSameAddress/isSameAddress.js';
|
|
9
11
|
export { isSocialWalletConnector } from './utils/isSocialWalletConnector/isSocialWalletConnector.js';
|
|
10
12
|
export { addHexPrefix, bufferToHex, utf8ToHex } from './utils/encoding.js';
|
|
@@ -16,7 +18,6 @@ export { isEmbeddedConnector } from './utils/isEmbeddedConnector/isEmbeddedConne
|
|
|
16
18
|
export { isMagicConnector } from './utils/isMagicConnector/isMagicConnector.js';
|
|
17
19
|
export { isBloctoConnector } from './utils/isBloctoConnector/isBloctoConnector.js';
|
|
18
20
|
export { isPasskeyWalletConnector } from './utils/isPasskeyWalletConnector/isPasskeyWalletConnector.js';
|
|
19
|
-
export { isSmartWalletConnector } from './utils/isSmartWalletConnector/isSmartWalletConnector.js';
|
|
20
21
|
export { isAccountAbstractionConnector } from './utils/isAccountAbstractionConnector/isAccountAbstractionConnector.js';
|
|
21
22
|
export { isBitcoinConnector } from './utils/isBitcoinConnector/isBitcoinConnector.js';
|
|
22
23
|
export { isHardwareWalletConnector } from './utils/isHardwareWalletConnector/isHardwareWalletConnector.js';
|
|
@@ -27,4 +28,6 @@ export { getRpcUrlForChain } from './utils/getRpcUrlForChain/getRpcUrlForChain.j
|
|
|
27
28
|
export { isCoinbaseMpcWalletConnector } from './utils/isCoinbaseMpcWalletConnector/isCoinbaseMpcWalletConnector.js';
|
|
28
29
|
export { isWalletConnectConnector } from './utils/isWalletConnectConnector/isWalletConnectConnector.js';
|
|
29
30
|
export { isSendBalanceWalletConnector } from './utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.js';
|
|
30
|
-
export {
|
|
31
|
+
export { isSessionKeyCompatibleWallet } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.js';
|
|
32
|
+
export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
|
|
33
|
+
export { getMobileExperience } from './utils/getMobileExperience/getMobileExperience.js';
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { IUITransaction } from '@dynamic-labs/types';
|
|
2
2
|
import { WalletConnector, WalletConnectorBase } from './WalletConnector';
|
|
3
|
+
type GetAccountAbstractionProviderProps = {
|
|
4
|
+
withSponsorship?: boolean;
|
|
5
|
+
};
|
|
3
6
|
export interface IAccountAbstractionWalletConnector extends WalletConnectorBase {
|
|
4
7
|
canSponsorTransactionGas(transaction: IUITransaction): Promise<boolean>;
|
|
5
8
|
disableGasSponsorshipOnce(): void;
|
|
6
|
-
getAccountAbstractionProvider<T>(): T;
|
|
7
|
-
getAccountAbstractionProvider(): unknown;
|
|
9
|
+
getAccountAbstractionProvider<T>(props?: GetAccountAbstractionProviderProps): T;
|
|
10
|
+
getAccountAbstractionProvider(props?: GetAccountAbstractionProviderProps): unknown;
|
|
11
|
+
setEoaConnector(connector: WalletConnectorBase): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated You should get the EOA connector by passing the SCW wallet to getEOAConnector,
|
|
14
|
+
* from the useSmartWallet hook
|
|
15
|
+
*/
|
|
8
16
|
getEOAConnector(): WalletConnector | undefined;
|
|
9
17
|
}
|
|
18
|
+
export {};
|
|
@@ -20,6 +20,7 @@ export interface IBitcoinWalletConnector extends WalletConnectorBase {
|
|
|
20
20
|
sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
21
21
|
sendRawTransaction(transactionHex: string): Promise<string | undefined>;
|
|
22
22
|
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
23
|
+
signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
|
|
23
24
|
isHardwareWalletEnabled: boolean;
|
|
24
25
|
isLedgerAddress(address: string): boolean;
|
|
25
26
|
clearConnectedAccounts(): Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IUITransaction } from '@dynamic-labs/types';
|
|
1
|
+
import { TransactionReceipt, IUITransaction } from '@dynamic-labs/types';
|
|
2
2
|
import { WalletConnectorBase } from './WalletConnector';
|
|
3
3
|
export interface ISendBalanceWalletConnector extends WalletConnectorBase {
|
|
4
4
|
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
5
|
+
confirmTransactionStatus?(txHash: string): Promise<TransactionReceipt>;
|
|
5
6
|
}
|
|
@@ -7,9 +7,13 @@ export interface ISessionKeyCompatibleWalletConnector extends WalletConnectorBas
|
|
|
7
7
|
isSessionKeyCompatible(): boolean;
|
|
8
8
|
isSessionActive(): Promise<boolean>;
|
|
9
9
|
sessionKeys?: SessionKeys;
|
|
10
|
-
setSessionKeyFetcher(fetcher: (
|
|
10
|
+
setSessionKeyFetcher(fetcher: ({ ignoreRestore, }: {
|
|
11
|
+
ignoreRestore?: boolean;
|
|
12
|
+
}) => Promise<SessionKeys>): void;
|
|
11
13
|
setSessionKeyRemoveFunction(fetcher: () => void): void;
|
|
12
|
-
createOrRestoreSession(
|
|
14
|
+
createOrRestoreSession({ ignoreRestore, }?: {
|
|
15
|
+
ignoreRestore?: boolean;
|
|
16
|
+
}): Promise<string | undefined>;
|
|
13
17
|
removeSessionKeys: (() => Promise<void>) | undefined;
|
|
14
18
|
}
|
|
15
19
|
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { JwtVerifiedCredential, TurnkeyWalletProperties } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
import { WalletConnectorBase } from './WalletConnector';
|
|
3
|
+
type JwtVerifiedCredentialWithSmartWalletRef = JwtVerifiedCredential & {
|
|
4
|
+
smartWalletRefId?: string;
|
|
5
|
+
smartWalletRefAddress?: string;
|
|
6
|
+
};
|
|
7
|
+
type SessionKeys = {
|
|
8
|
+
publicKey: string;
|
|
9
|
+
privateKey: string;
|
|
10
|
+
};
|
|
11
|
+
export interface ITurnkeyWalletConnector extends WalletConnectorBase {
|
|
12
|
+
createOrRestoreSessionFetcherFunction?: ({ ignoreRestore, }: {
|
|
13
|
+
ignoreRestore?: boolean;
|
|
14
|
+
}) => Promise<SessionKeys>;
|
|
15
|
+
removeSessionKeysFunction?: () => Promise<void>;
|
|
16
|
+
getWebAuthnAttestation(): Promise<{
|
|
17
|
+
attestation: {
|
|
18
|
+
attestationObject: ArrayBuffer;
|
|
19
|
+
clientDataJson: ArrayBuffer;
|
|
20
|
+
credentialId: ArrayBuffer;
|
|
21
|
+
transports: string[];
|
|
22
|
+
};
|
|
23
|
+
challenge: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}>;
|
|
26
|
+
getAuthenticatorHandler(): unknown;
|
|
27
|
+
getExportHandler(): unknown;
|
|
28
|
+
email: string | null | undefined;
|
|
29
|
+
setEmail(email: string | null | undefined): void;
|
|
30
|
+
clearEmail(): void;
|
|
31
|
+
phone: string | null | undefined;
|
|
32
|
+
setPhone(phone: string | null | undefined): void;
|
|
33
|
+
passkeyIdentifier: string | null | undefined;
|
|
34
|
+
setPasskeyIdentifier(passkeyIdentifier: string | null | undefined): void;
|
|
35
|
+
turnkeyAddress: string | undefined;
|
|
36
|
+
walletProperties: TurnkeyWalletProperties | undefined;
|
|
37
|
+
verifiedCredential: JwtVerifiedCredentialWithSmartWalletRef | undefined;
|
|
38
|
+
verifiedCredentials: JwtVerifiedCredentialWithSmartWalletRef[] | undefined;
|
|
39
|
+
setSessionKeyFetcher(func: () => Promise<SessionKeys>): void;
|
|
40
|
+
setSessionKeyRemoveFunction(func: () => Promise<void>): void;
|
|
41
|
+
removeSessionKeys(): Promise<void>;
|
|
42
|
+
createOrRestoreSession({ ignoreRestore, }: {
|
|
43
|
+
ignoreRestore?: boolean;
|
|
44
|
+
}): Promise<string | undefined>;
|
|
45
|
+
isSessionKeyCompatible(): boolean;
|
|
46
|
+
isSessionActive(): Promise<boolean>;
|
|
47
|
+
sessionKeys: SessionKeys | undefined;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -6,6 +6,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var EventEmitter = require('eventemitter3');
|
|
8
8
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
9
|
+
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var logger = require('../utils/logger.cjs');
|
|
11
|
+
var isSameAddress = require('../utils/isSameAddress/isSameAddress.cjs');
|
|
12
|
+
var getMobileExperience = require('../utils/getMobileExperience/getMobileExperience.cjs');
|
|
13
|
+
var isConnectorMethodSupported = require('../utils/isConnectorMethodSupported/isConnectorMethodSupported.cjs');
|
|
9
14
|
var WalletBookSingleton = require('./WalletBookSingleton.cjs');
|
|
10
15
|
|
|
11
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -43,6 +48,10 @@ const socialProviders = [
|
|
|
43
48
|
'microsoft',
|
|
44
49
|
];
|
|
45
50
|
class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
51
|
+
createWallet(props) {
|
|
52
|
+
const wallet = new this.ChainWallet(props);
|
|
53
|
+
return wallet;
|
|
54
|
+
}
|
|
46
55
|
/**
|
|
47
56
|
* We store the constructor props so that we can use them later on
|
|
48
57
|
* in getMobileOrInstalledWallet which may fall back to a different class
|
|
@@ -52,6 +61,7 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
52
61
|
constructor(props) {
|
|
53
62
|
super();
|
|
54
63
|
this.chainRpcProviders = undefined;
|
|
64
|
+
this.isGlobalTransaction = false;
|
|
55
65
|
_WalletConnectorBase_registeredExtensions.set(this, []);
|
|
56
66
|
this.didSetup = false;
|
|
57
67
|
/**
|
|
@@ -76,22 +86,6 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
76
86
|
* @default false
|
|
77
87
|
*/
|
|
78
88
|
this.canConnectViaSocial = false;
|
|
79
|
-
/**
|
|
80
|
-
* @deprecated getWeb3Provider has been renamed to getWalletClient
|
|
81
|
-
* If you would like to still get the ethers web3Provider,
|
|
82
|
-
* see our docs for enabling ethers: https://docs.dynamic.xyz/ethers
|
|
83
|
-
*
|
|
84
|
-
* Get the wallet provider
|
|
85
|
-
*/
|
|
86
|
-
this.getWeb3Provider = this.getWalletClient;
|
|
87
|
-
/**
|
|
88
|
-
* @deprecated getRpcProvider has been renamed to getPublicClient
|
|
89
|
-
* If you would like to still get the ethers rpcProvider,
|
|
90
|
-
* see our docs for enabling ethers: https://docs.dynamic.xyz/ethers
|
|
91
|
-
*
|
|
92
|
-
* Get the rpc provider
|
|
93
|
-
*/
|
|
94
|
-
this.getRpcProvider = this.getPublicClient;
|
|
95
89
|
/**
|
|
96
90
|
* Flag if connector/provider is available
|
|
97
91
|
*
|
|
@@ -140,6 +134,11 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
140
134
|
if (_tslib.__classPrivateFieldGet(this, _WalletConnectorBase_registeredExtensions, "f").includes(extension.name)) {
|
|
141
135
|
throw new Error(`You can only register a single extension of: ${extension.name}`);
|
|
142
136
|
}
|
|
137
|
+
if (extension.name === 'global-wallet-extension') {
|
|
138
|
+
// only allow global wallet extension for evm embedded wallets
|
|
139
|
+
if (!this.isEmbeddedWallet || !this.supportedChains.includes('EVM'))
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
143
142
|
_tslib.__classPrivateFieldGet(this, _WalletConnectorBase_registeredExtensions, "f").push(extension.name);
|
|
144
143
|
extension.extend(this);
|
|
145
144
|
}
|
|
@@ -165,6 +164,20 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
165
164
|
return false;
|
|
166
165
|
}
|
|
167
166
|
}
|
|
167
|
+
get mobileExperience() {
|
|
168
|
+
return getMobileExperience.getMobileExperience({
|
|
169
|
+
mobileExperienceProp: this.constructorProps.mobileExperience,
|
|
170
|
+
walletBook: this.walletBook,
|
|
171
|
+
walletKey: this.key,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Prompt the user to choose accounts to connect (see behavior in MM)
|
|
176
|
+
* @default Promise<[]>
|
|
177
|
+
*/
|
|
178
|
+
chooseAccountsToConnect() {
|
|
179
|
+
return Promise.resolve([]);
|
|
180
|
+
}
|
|
168
181
|
connect() {
|
|
169
182
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
170
183
|
yield this.getAddress();
|
|
@@ -228,7 +241,7 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
228
241
|
*
|
|
229
242
|
* @default Promise<undefined>
|
|
230
243
|
*/
|
|
231
|
-
getBalance() {
|
|
244
|
+
getBalance(address) {
|
|
232
245
|
return Promise.resolve(undefined);
|
|
233
246
|
}
|
|
234
247
|
/**
|
|
@@ -255,7 +268,7 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
255
268
|
*
|
|
256
269
|
* @default Promise<undefined>
|
|
257
270
|
*/
|
|
258
|
-
getNameService() {
|
|
271
|
+
getNameService(address) {
|
|
259
272
|
return Promise.resolve(undefined);
|
|
260
273
|
}
|
|
261
274
|
getPublicClient() {
|
|
@@ -309,8 +322,11 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
309
322
|
*
|
|
310
323
|
* @default Promise<undefined>
|
|
311
324
|
*/
|
|
312
|
-
proveOwnership(messageToSign) {
|
|
313
|
-
return
|
|
325
|
+
proveOwnership(address, messageToSign) {
|
|
326
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
yield this.validateActiveWallet(address);
|
|
328
|
+
return this.signMessage(messageToSign);
|
|
329
|
+
});
|
|
314
330
|
}
|
|
315
331
|
/**
|
|
316
332
|
* Set up event listeners for the wallet
|
|
@@ -325,7 +341,7 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
325
341
|
*
|
|
326
342
|
* @default Promise<undefined>
|
|
327
343
|
*/
|
|
328
|
-
signMessage(messageToSign) {
|
|
344
|
+
signMessage(messageToSign, withAddress) {
|
|
329
345
|
return Promise.resolve(undefined);
|
|
330
346
|
}
|
|
331
347
|
/**
|
|
@@ -352,6 +368,93 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
352
368
|
setVerifiedCredentials(verifiedCredentials) {
|
|
353
369
|
return;
|
|
354
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* Whether the wallet allow for getting the address in the
|
|
373
|
+
* current chain.
|
|
374
|
+
* This is used for multi chain wallets.
|
|
375
|
+
* @default true
|
|
376
|
+
*/
|
|
377
|
+
canGetChainAddress() {
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Prompts the user to make expected wallet active
|
|
382
|
+
*
|
|
383
|
+
* @throws {WalletAddressMismatchError} If the active address does not match the expected address.
|
|
384
|
+
* @returns {Promise<void>} A promise that resolves when the active address matches the expected address,
|
|
385
|
+
* otherwise rejects with an error.
|
|
386
|
+
*/
|
|
387
|
+
handleWalletNotActive(_a) {
|
|
388
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ activeAddress, expectedAddress, reconnectedAddress, }) {
|
|
389
|
+
logger.logger.debug('validateActiveWallet - wallet is not active', {
|
|
390
|
+
activeAddress,
|
|
391
|
+
expectedAddress,
|
|
392
|
+
reconnectedAddress,
|
|
393
|
+
});
|
|
394
|
+
const currentActiveAddress = activeAddress || reconnectedAddress || '';
|
|
395
|
+
const walletUiUtils = this.constructorProps
|
|
396
|
+
.walletUiUtils;
|
|
397
|
+
if (!walletUiUtils) {
|
|
398
|
+
throw new utils.WalletAddressMismatchError(`Wallet ${expectedAddress !== null && expectedAddress !== void 0 ? expectedAddress : ''} is not currently active in ${this.name || this.key}.`, {
|
|
399
|
+
activeAddress: currentActiveAddress,
|
|
400
|
+
expectedAddress,
|
|
401
|
+
walletName: this.name || this.key,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
return walletUiUtils.syncWallet({
|
|
405
|
+
activeAddress: currentActiveAddress,
|
|
406
|
+
expectedAddress,
|
|
407
|
+
walletConnector: this,
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Validates if the address is connected and active in the wallet app
|
|
413
|
+
*
|
|
414
|
+
* @throws {WalletAddressMismatchError} If the active address does not match the expected address.
|
|
415
|
+
* @returns {Promise<void>} A promise that resolves if the active address matches the expected address,
|
|
416
|
+
* otherwise rejects with an error.
|
|
417
|
+
*/
|
|
418
|
+
validateActiveWallet(expectedAddress) {
|
|
419
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
420
|
+
logger.logger.debug('validateActiveWallet - validating wallet', expectedAddress);
|
|
421
|
+
const canFetchConnectedAccounts = isConnectorMethodSupported.isConnectorMethodSupported(this, 'getConnectedAccounts', 'browserExtension');
|
|
422
|
+
logger.logger.debug('validateActiveWallet - getting connected accounts', {
|
|
423
|
+
canFetchConnectedAccounts,
|
|
424
|
+
});
|
|
425
|
+
const [activeAddress] = canFetchConnectedAccounts
|
|
426
|
+
? yield this.getConnectedAccounts()
|
|
427
|
+
: [];
|
|
428
|
+
const isWalletActive = activeAddress &&
|
|
429
|
+
isSameAddress.isSameAddress(activeAddress, expectedAddress, this.connectedChain);
|
|
430
|
+
if (isWalletActive) {
|
|
431
|
+
logger.logger.debug('validateActiveWallet - wallet is active');
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
logger.logger.debug('validateActiveWallet - trying to reconnect wallet...');
|
|
435
|
+
const getReconnectedAddress = () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
436
|
+
if (this.isWalletConnect || !this.canGetChainAddress()) {
|
|
437
|
+
return undefined;
|
|
438
|
+
}
|
|
439
|
+
return this.getAddress().catch((err) => {
|
|
440
|
+
logger.logger.debug('validateActiveWallet - error getting address', err);
|
|
441
|
+
return undefined;
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
// not possible to auto-reconnect walletconnect
|
|
445
|
+
const reconnectedAddress = yield getReconnectedAddress();
|
|
446
|
+
if (reconnectedAddress &&
|
|
447
|
+
isSameAddress.isSameAddress(reconnectedAddress, expectedAddress, this.connectedChain)) {
|
|
448
|
+
logger.logger.debug('validateActiveWallet - wallet reconnected successfuly');
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
return this.handleWalletNotActive({
|
|
452
|
+
activeAddress,
|
|
453
|
+
expectedAddress,
|
|
454
|
+
reconnectedAddress,
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
}
|
|
355
458
|
}
|
|
356
459
|
_WalletConnectorBase_registeredExtensions = new WeakMap();
|
|
357
460
|
|