@dynamic-labs/wallet-connector-core 3.0.0-alpha.52 → 3.0.0-alpha.53

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/_virtual/_tslib.cjs +0 -8
  3. package/_virtual/_tslib.js +1 -8
  4. package/package.json +6 -6
  5. package/src/index.cjs +3 -3
  6. package/src/index.d.ts +2 -2
  7. package/src/index.js +2 -2
  8. package/src/lib/IAccountAbstractionWalletConnector.d.ts +5 -0
  9. package/src/lib/IBitcoinWalletConnector.d.ts +1 -0
  10. package/src/lib/IHardwareWalletConnector.d.ts +2 -1
  11. package/src/lib/WalletConnector.cjs +39 -10
  12. package/src/lib/WalletConnector.d.ts +12 -6
  13. package/src/lib/WalletConnector.js +39 -10
  14. package/src/lib/WalletConnectorExtension.d.ts +2 -2
  15. package/src/lib/index.d.ts +0 -1
  16. package/src/lib/wallets/Wallet/Wallet.cjs +9 -61
  17. package/src/lib/wallets/Wallet/Wallet.d.ts +9 -37
  18. package/src/lib/wallets/Wallet/Wallet.js +10 -62
  19. package/src/utils/getChainInfo/getChainInfo.cjs +4 -0
  20. package/src/utils/getChainInfo/getChainInfo.js +4 -0
  21. package/src/utils/getWalletConnectorByKey.d.ts +2 -2
  22. package/src/utils/index.d.ts +1 -2
  23. package/src/utils/isAccountAbstractionConnector/index.d.ts +1 -1
  24. package/src/utils/isConnectorMethodSupported/index.d.ts +1 -0
  25. package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.cjs +14 -0
  26. package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.d.ts +3 -0
  27. package/src/utils/isConnectorMethodSupported/isConnectorMethodSupported.js +10 -0
  28. package/src/utils/isHardwareWalletConnector/isHardwareWalletConnector.d.ts +1 -1
  29. package/src/utils/isSessionKeyCompatible/index.d.ts +2 -0
  30. package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/index.d.ts +1 -0
  31. package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.cjs +10 -0
  32. package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.d.ts +2 -0
  33. package/src/utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.js +6 -0
  34. package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/isSessionKeyCompatibleWalletConnector.d.ts +2 -1
  35. package/src/lib/SmartWalletConnector.d.ts +0 -4
  36. package/src/utils/isSmartWalletConnector/index.d.ts +0 -1
  37. package/src/utils/isSmartWalletConnector/isSmartWalletConnector.cjs +0 -8
  38. package/src/utils/isSmartWalletConnector/isSmartWalletConnector.d.ts +0 -2
  39. package/src/utils/isSmartWalletConnector/isSmartWalletConnector.js +0 -4
  40. /package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/index.d.ts +0 -0
  41. /package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/isSessionKeyCompatibleWalletConnector.cjs +0 -0
  42. /package/src/utils/{isSessionKeyCompatibleWalletConnector → isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector}/isSessionKeyCompatibleWalletConnector.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,43 @@
1
1
 
2
+ ## [3.0.0-alpha.53](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.52...v3.0.0-alpha.53) (2024-08-29)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * simplify solana wallet signer types (#6748)
8
+ * deprecate getEoaConnector (#6571)
9
+ * limit methods and props returned by wallet.connector (#6540)
10
+ * move generic solana code to solana-core package (#6701)
11
+ * revamp ether v6 interface (#6548)
12
+ * add ethereum wallet specific methods and intercept to sync when needed (#6662)
13
+ * add solana wallet specific methods and intercept to sync when needed (#6608)
14
+ * don't force primary wallet to be connected (#6128)
15
+
16
+ ### Features
17
+
18
+ * add bitcoin wallet specific methods and intercept to sync when needed ([#6663](https://github.com/dynamic-labs/DynamicAuth/issues/6663)) ([ed699b1](https://github.com/dynamic-labs/DynamicAuth/commit/ed699b1f8c264755779ec4840d105f89ade5500e))
19
+ * add ethereum wallet specific methods and intercept to sync when needed ([#6662](https://github.com/dynamic-labs/DynamicAuth/issues/6662)) ([372360e](https://github.com/dynamic-labs/DynamicAuth/commit/372360ed7ca395f88811fc62c94b2b494eb59971))
20
+ * add solana wallet specific methods and intercept to sync when needed ([#6608](https://github.com/dynamic-labs/DynamicAuth/issues/6608)) ([565f610](https://github.com/dynamic-labs/DynamicAuth/commit/565f6100340296c267e9706fd263e9bd3f7d3732))
21
+ * add useSmartWallets hook to manage aa wallets ([#6564](https://github.com/dynamic-labs/DynamicAuth/issues/6564)) ([a243d36](https://github.com/dynamic-labs/DynamicAuth/commit/a243d361ce7c368d0f1afda55f9c1fabefd75ba8))
22
+ * don't force primary wallet to be connected ([#6128](https://github.com/dynamic-labs/DynamicAuth/issues/6128)) ([018a6f6](https://github.com/dynamic-labs/DynamicAuth/commit/018a6f66f8725914ab97ea3e2e1c80626266e503))
23
+ * new prop to enable prompt for linking when account change is detected ([#6713](https://github.com/dynamic-labs/DynamicAuth/issues/6713)) ([b5a6321](https://github.com/dynamic-labs/DynamicAuth/commit/b5a63212ae33fae24401f141d5ca2356b446dcff))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * always sync wagmi client with primary wallet ([#6577](https://github.com/dynamic-labs/DynamicAuth/issues/6577)) ([be22fde](https://github.com/dynamic-labs/DynamicAuth/commit/be22fdea3bb61db79b06ba56cb32da6cd8141b66))
29
+ * cosmos wallet intercepts ([#6720](https://github.com/dynamic-labs/DynamicAuth/issues/6720)) ([cfc9df4](https://github.com/dynamic-labs/DynamicAuth/commit/cfc9df48a8032f7348fec14f77b9e378d2e26a22))
30
+ * magiceden wallet events not working correctly on page refresh ([#6735](https://github.com/dynamic-labs/DynamicAuth/issues/6735)) ([6ed5964](https://github.com/dynamic-labs/DynamicAuth/commit/6ed5964134a2cafd392c19f18eb71e6ca2ce238d))
31
+ * use proxy to intercept solana signer methods ([#6743](https://github.com/dynamic-labs/DynamicAuth/issues/6743)) ([ecbe5ea](https://github.com/dynamic-labs/DynamicAuth/commit/ecbe5ea772592d2c693d8222d85b7642acd151a8))
32
+ * wallet.chain references ([525c1ca](https://github.com/dynamic-labs/DynamicAuth/commit/525c1ca9a8fe6402c06eabe6aebc30e310411d9b))
33
+
34
+
35
+ * deprecate getEoaConnector ([#6571](https://github.com/dynamic-labs/DynamicAuth/issues/6571)) ([0226ee5](https://github.com/dynamic-labs/DynamicAuth/commit/0226ee5a13f2418607076ee6f2ec0a579b06dd5d))
36
+ * limit methods and props returned by wallet.connector ([#6540](https://github.com/dynamic-labs/DynamicAuth/issues/6540)) ([9c86e35](https://github.com/dynamic-labs/DynamicAuth/commit/9c86e35c72cd40313bfd19254dd6171ee8f62213))
37
+ * move generic solana code to solana-core package ([#6701](https://github.com/dynamic-labs/DynamicAuth/issues/6701)) ([30815f5](https://github.com/dynamic-labs/DynamicAuth/commit/30815f5d46feeefb2413c1b7d30b43d5370ee032))
38
+ * revamp ether v6 interface ([#6548](https://github.com/dynamic-labs/DynamicAuth/issues/6548)) ([f3b2fb8](https://github.com/dynamic-labs/DynamicAuth/commit/f3b2fb8da7de21f9c58e67fa7f5580166195092a))
39
+ * simplify solana wallet signer types ([#6748](https://github.com/dynamic-labs/DynamicAuth/issues/6748)) ([01d1a42](https://github.com/dynamic-labs/DynamicAuth/commit/01d1a42bc916ab329580b741ba60d706bf6c5491))
40
+
2
41
  ## [3.0.0-alpha.52](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.51...v3.0.0-alpha.52) (2024-08-28)
3
42
 
4
43
 
@@ -46,13 +46,6 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
46
46
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
47
47
  }
48
48
 
49
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
50
- if (kind === "m") throw new TypeError("Private method is not writable");
51
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
52
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
53
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
54
- }
55
-
56
49
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
57
50
  var e = new Error(message);
58
51
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -60,5 +53,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
60
53
 
61
54
  exports.__awaiter = __awaiter;
62
55
  exports.__classPrivateFieldGet = __classPrivateFieldGet;
63
- exports.__classPrivateFieldSet = __classPrivateFieldSet;
64
56
  exports.__rest = __rest;
@@ -42,16 +42,9 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
42
42
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
43
43
  }
44
44
 
45
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
46
- if (kind === "m") throw new TypeError("Private method is not writable");
47
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
48
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
49
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
50
- }
51
-
52
45
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
53
46
  var e = new Error(message);
54
47
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
55
48
  };
56
49
 
57
- export { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet, __rest };
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-alpha.52",
3
+ "version": "3.0.0-alpha.53",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -29,11 +29,11 @@
29
29
  "@dynamic-labs/sdk-api-core": "0.0.519"
30
30
  },
31
31
  "peerDependencies": {
32
- "@dynamic-labs/logger": "3.0.0-alpha.52",
33
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.52",
34
- "@dynamic-labs/types": "3.0.0-alpha.52",
35
- "@dynamic-labs/utils": "3.0.0-alpha.52",
36
- "@dynamic-labs/wallet-book": "3.0.0-alpha.52",
32
+ "@dynamic-labs/logger": "3.0.0-alpha.53",
33
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.53",
34
+ "@dynamic-labs/types": "3.0.0-alpha.53",
35
+ "@dynamic-labs/utils": "3.0.0-alpha.53",
36
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.53",
37
37
  "eventemitter3": "5.0.1"
38
38
  }
39
39
  }
package/src/index.cjs CHANGED
@@ -21,7 +21,6 @@ var isEmbeddedConnector = require('./utils/isEmbeddedConnector/isEmbeddedConnect
21
21
  var isMagicConnector = require('./utils/isMagicConnector/isMagicConnector.cjs');
22
22
  var isBloctoConnector = require('./utils/isBloctoConnector/isBloctoConnector.cjs');
23
23
  var isPasskeyWalletConnector = require('./utils/isPasskeyWalletConnector/isPasskeyWalletConnector.cjs');
24
- var isSmartWalletConnector = require('./utils/isSmartWalletConnector/isSmartWalletConnector.cjs');
25
24
  var isAccountAbstractionConnector = require('./utils/isAccountAbstractionConnector/isAccountAbstractionConnector.cjs');
26
25
  var isBitcoinConnector = require('./utils/isBitcoinConnector/isBitcoinConnector.cjs');
27
26
  var isHardwareWalletConnector = require('./utils/isHardwareWalletConnector/isHardwareWalletConnector.cjs');
@@ -32,7 +31,8 @@ var getRpcUrlForChain = require('./utils/getRpcUrlForChain/getRpcUrlForChain.cjs
32
31
  var isCoinbaseMpcWalletConnector = require('./utils/isCoinbaseMpcWalletConnector/isCoinbaseMpcWalletConnector.cjs');
33
32
  var isWalletConnectConnector = require('./utils/isWalletConnectConnector/isWalletConnectConnector.cjs');
34
33
  var isSendBalanceWalletConnector = require('./utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.cjs');
35
- var isSessionKeyCompatibleWalletConnector = require('./utils/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.cjs');
34
+ var isSessionKeyCompatibleWallet = require('./utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.cjs');
35
+ var isSessionKeyCompatibleWalletConnector = require('./utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.cjs');
36
36
  var getMobileExperience = require('./utils/getMobileExperience/getMobileExperience.cjs');
37
37
 
38
38
 
@@ -61,7 +61,6 @@ exports.isEmbeddedConnector = isEmbeddedConnector.isEmbeddedConnector;
61
61
  exports.isMagicConnector = isMagicConnector.isMagicConnector;
62
62
  exports.isBloctoConnector = isBloctoConnector.isBloctoConnector;
63
63
  exports.isPasskeyWalletConnector = isPasskeyWalletConnector.isPasskeyWalletConnector;
64
- exports.isSmartWalletConnector = isSmartWalletConnector.isSmartWalletConnector;
65
64
  exports.isAccountAbstractionConnector = isAccountAbstractionConnector.isAccountAbstractionConnector;
66
65
  exports.isBitcoinConnector = isBitcoinConnector.isBitcoinConnector;
67
66
  exports.isHardwareWalletConnector = isHardwareWalletConnector.isHardwareWalletConnector;
@@ -72,5 +71,6 @@ exports.getRpcUrlForChain = getRpcUrlForChain.getRpcUrlForChain;
72
71
  exports.isCoinbaseMpcWalletConnector = isCoinbaseMpcWalletConnector.isCoinbaseMpcWalletConnector;
73
72
  exports.isWalletConnectConnector = isWalletConnectConnector.isWalletConnectConnector;
74
73
  exports.isSendBalanceWalletConnector = isSendBalanceWalletConnector.isSendBalanceWalletConnector;
74
+ exports.isSessionKeyCompatibleWallet = isSessionKeyCompatibleWallet.isSessionKeyCompatibleWallet;
75
75
  exports.isSessionKeyCompatibleWalletConnector = isSessionKeyCompatibleWalletConnector.isSessionKeyCompatibleWalletConnector;
76
76
  exports.getMobileExperience = getMobileExperience.getMobileExperience;
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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 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 SmartWalletConnector, type SocialProvider, type WalletConnector, type WalletConnectorConstructor, type WalletConnectorCore, type WalletConnectorEventTypes, type WalletConnectorsMethod, type WebAuthnAttestation, } from './lib';
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 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';
2
2
  export type { WalletConnectorExtension } from './lib/WalletConnectorExtension';
3
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, isEmailOTPWalletConnector, isEmailWalletConnector, isEmbeddedConnector, isHardwareWalletConnector, isHex, isMagicConnector, isPasskeyWalletConnector, isPhantomRedirectConnector, isSameAddress, isSendBalanceWalletConnector, isSessionKeyCompatibleWalletConnector, isSmartWalletConnector, isSocialWalletConnector, isWalletConnectConnector, logger, performPlatformSpecificConnectionMethod, shouldLowercaseAddress, utf8ToHex, type DeepLinkVariant, type ProviderCondition, type ChainDisplayOverrides, } from './utils';
4
+ export { ProviderLookup, addHexPrefix, bufferToHex, eventListenerHandlers, getChainInfo, getChainInfoWithOverrides, setChainInfoOverrides, getDeepLink, getMobileExperience, getRpcUrlForChain, getWalletConnectorByKey, isAccountAbstractionConnector, isBitcoinConnector, isBloctoConnector, isCoinbaseMpcWalletConnector, 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
@@ -17,7 +17,6 @@ export { isEmbeddedConnector } from './utils/isEmbeddedConnector/isEmbeddedConne
17
17
  export { isMagicConnector } from './utils/isMagicConnector/isMagicConnector.js';
18
18
  export { isBloctoConnector } from './utils/isBloctoConnector/isBloctoConnector.js';
19
19
  export { isPasskeyWalletConnector } from './utils/isPasskeyWalletConnector/isPasskeyWalletConnector.js';
20
- export { isSmartWalletConnector } from './utils/isSmartWalletConnector/isSmartWalletConnector.js';
21
20
  export { isAccountAbstractionConnector } from './utils/isAccountAbstractionConnector/isAccountAbstractionConnector.js';
22
21
  export { isBitcoinConnector } from './utils/isBitcoinConnector/isBitcoinConnector.js';
23
22
  export { isHardwareWalletConnector } from './utils/isHardwareWalletConnector/isHardwareWalletConnector.js';
@@ -28,5 +27,6 @@ export { getRpcUrlForChain } from './utils/getRpcUrlForChain/getRpcUrlForChain.j
28
27
  export { isCoinbaseMpcWalletConnector } from './utils/isCoinbaseMpcWalletConnector/isCoinbaseMpcWalletConnector.js';
29
28
  export { isWalletConnectConnector } from './utils/isWalletConnectConnector/isWalletConnectConnector.js';
30
29
  export { isSendBalanceWalletConnector } from './utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.js';
31
- export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
30
+ export { isSessionKeyCompatibleWallet } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.js';
31
+ export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
32
32
  export { getMobileExperience } from './utils/getMobileExperience/getMobileExperience.js';
@@ -8,6 +8,11 @@ export interface IAccountAbstractionWalletConnector extends WalletConnectorBase
8
8
  disableGasSponsorshipOnce(): void;
9
9
  getAccountAbstractionProvider<T>(props?: GetAccountAbstractionProviderProps): T;
10
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
+ */
11
16
  getEOAConnector(): WalletConnector | undefined;
12
17
  }
13
18
  export {};
@@ -24,5 +24,6 @@ export interface IBitcoinWalletConnector extends WalletConnectorBase {
24
24
  isHardwareWalletEnabled: boolean;
25
25
  isLedgerAddress(address: string): boolean;
26
26
  clearConnectedAccounts(): Promise<void>;
27
+ signMessageWithAddress(messageToSign: string, address: string): Promise<string | undefined>;
27
28
  }
28
29
  export {};
@@ -1,4 +1,5 @@
1
- export interface IHardwareWalletConnector {
1
+ import { WalletConnectorBase } from '../';
2
+ export interface IHardwareWalletConnector extends WalletConnectorBase {
2
3
  canConnectWithHardwareWallet(): boolean;
3
4
  isHardwareWalletEnabled: boolean;
4
5
  }
@@ -10,6 +10,7 @@ var utils = require('@dynamic-labs/utils');
10
10
  var logger = require('../utils/logger.cjs');
11
11
  var isSameAddress = require('../utils/isSameAddress/isSameAddress.cjs');
12
12
  var getMobileExperience = require('../utils/getMobileExperience/getMobileExperience.cjs');
13
+ var isConnectorMethodSupported = require('../utils/isConnectorMethodSupported/isConnectorMethodSupported.cjs');
13
14
  var WalletBookSingleton = require('./WalletBookSingleton.cjs');
14
15
 
15
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -47,6 +48,10 @@ const socialProviders = [
47
48
  'microsoft',
48
49
  ];
49
50
  class WalletConnectorBase extends EventEmitter__default["default"] {
51
+ createWallet(props) {
52
+ const wallet = new this.ChainWallet(props);
53
+ return wallet;
54
+ }
50
55
  /**
51
56
  * We store the constructor props so that we can use them later on
52
57
  * in getMobileOrInstalledWallet which may fall back to a different class
@@ -235,9 +240,11 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
235
240
  /**
236
241
  * Get the address silently
237
242
  *
243
+ * @param forceFetch - if true it will fetch the address again even if
244
+ * wallet has getConnectedAccounts limitation in wallet-book
238
245
  * @default Promise<[]>
239
246
  */
240
- getConnectedAccounts() {
247
+ getConnectedAccounts(forceFetch) {
241
248
  return Promise.resolve([]);
242
249
  }
243
250
  /**
@@ -310,8 +317,11 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
310
317
  *
311
318
  * @default Promise<undefined>
312
319
  */
313
- proveOwnership(messageToSign) {
314
- return this.signMessage(messageToSign);
320
+ proveOwnership(address, messageToSign) {
321
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
322
+ yield this.validateActiveWallet(address);
323
+ return this.signMessage(messageToSign);
324
+ });
315
325
  }
316
326
  /**
317
327
  * Set up event listeners for the wallet
@@ -363,26 +373,45 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
363
373
  validateActiveWallet(expectedAddress) {
364
374
  return _tslib.__awaiter(this, void 0, void 0, function* () {
365
375
  var _a, _b;
366
- const [activeAddress] = yield this.getConnectedAccounts();
367
- const isWalletActive = isSameAddress.isSameAddress(activeAddress, expectedAddress, this.connectedChain);
368
- logger.logger.debug(`validateActiveWallet - wallet ${isWalletActive ? 'is' : 'is not'} active`, {
369
- activeAddress,
370
- expectedAddress,
376
+ logger.logger.debug('validateActiveWallet - validating wallet', expectedAddress);
377
+ const canFetchConnectedAccounts = isConnectorMethodSupported.isConnectorMethodSupported(this, 'getConnectedAccounts', 'browserExtension');
378
+ logger.logger.debug('validateActiveWallet - getting connected accounts', {
379
+ canFetchConnectedAccounts,
371
380
  });
381
+ const [activeAddress] = canFetchConnectedAccounts
382
+ ? yield this.getConnectedAccounts(true)
383
+ : [];
384
+ const isWalletActive = activeAddress &&
385
+ isSameAddress.isSameAddress(activeAddress, expectedAddress, this.connectedChain);
372
386
  const walletUiUtils = this.constructorProps
373
387
  .walletUiUtils;
374
388
  if (isWalletActive) {
389
+ logger.logger.debug('validateActiveWallet - wallet is active');
375
390
  return;
376
391
  }
392
+ logger.logger.debug('validateActiveWallet - trying to reconnect wallet...');
393
+ // not possible to auto-reconnect walletconnect
394
+ const reconnectedAddress = !this.isWalletConnect && (yield this.getAddress());
395
+ if (reconnectedAddress &&
396
+ isSameAddress.isSameAddress(reconnectedAddress, expectedAddress, this.connectedChain)) {
397
+ logger.logger.debug('validateActiveWallet - wallet reconnected successfuly');
398
+ return;
399
+ }
400
+ logger.logger.debug('validateActiveWallet - wallet is not active', {
401
+ activeAddress,
402
+ expectedAddress,
403
+ reconnectedAddress,
404
+ });
405
+ const currentActiveAddress = activeAddress || reconnectedAddress || '';
377
406
  if (!walletUiUtils) {
378
407
  throw new utils.WalletAddressMismatchError(`Wallet ${expectedAddress !== null && expectedAddress !== void 0 ? expectedAddress : ''} is not currently active in ${(_a = this.name) !== null && _a !== void 0 ? _a : this.key}.`, {
379
- activeAddress,
408
+ activeAddress: currentActiveAddress,
380
409
  expectedAddress,
381
410
  walletName: (_b = this.name) !== null && _b !== void 0 ? _b : this.key,
382
411
  });
383
412
  }
384
413
  return walletUiUtils.syncWallet({
385
- activeAddress,
414
+ activeAddress: currentActiveAddress,
386
415
  expectedAddress,
387
416
  walletConnector: this,
388
417
  });
@@ -6,6 +6,7 @@ import { MobileExperience } from '@dynamic-labs/types';
6
6
  import { WalletBookSingleton } from './WalletBookSingleton';
7
7
  import { WalletConnectorExtension } from './WalletConnectorExtension';
8
8
  import { WalletConnectorCore } from './types';
9
+ import { WalletConstructor, WalletProps } from './wallets';
9
10
  export declare const Chains: readonly ["ETH", "FLOW", "SOL", "EVM", "ALGO", "STARK", "ATOM", "COSMOS", "BTC"];
10
11
  export type Chain = typeof Chains[number];
11
12
  export declare const socialProviders: readonly ["google", "facebook", "apple", "github", "bitbucket", "gitlab", "linkedin", "twitter", "discord", "twitch", "microsoft"];
@@ -33,9 +34,10 @@ declare module './types' {
33
34
  }
34
35
  }
35
36
  }
36
- export type WalletConnector = WalletConnectorCore.WalletConnector;
37
+ export type InternalWalletConnector = WalletConnectorCore.WalletConnector;
38
+ export type WalletConnector = Pick<InternalWalletConnector, 'canConnectViaCustodialService' | 'canConnectViaQrCode' | 'canConnectViaSocial' | 'chainRpcProviders' | 'connect' | 'connectedChain' | 'createWallet' | 'constructorProps' | 'endSession' | 'getAddress' | 'getAdditionalAddresses' | 'getConnectedAccounts' | 'getNetwork' | 'initEventListener' | 'isAvailable' | 'isEmbeddedWallet' | 'isInitialized' | 'isInstalledOnBrowser' | 'isTestnet' | 'isWalletConnect' | 'key' | 'name' | 'parseAddress' | 'proveOwnership' | 'providerResources' | 'supportedChains' | 'supportsNetworkSwitching' | 'switchNetwork' | 'switchNetworkOnlyFromWallet' | 'teardownEventListeners'> & EventEmitter<WalletConnectorEventTypes>;
37
39
  export interface WalletConnectorConstructor {
38
- new (props?: any): WalletConnector;
40
+ new (props?: any): InternalWalletConnector;
39
41
  }
40
42
  export type WalletConnectorsMethod = (props?: any) => WalletConnectorConstructor[];
41
43
  export type WalletConnectorEventTypes = {
@@ -47,8 +49,10 @@ export type WalletConnectorEventTypes = {
47
49
  }) => void;
48
50
  disconnect: () => void;
49
51
  };
50
- export declare abstract class WalletConnectorBase extends EventEmitter<WalletConnectorEventTypes> {
52
+ export declare abstract class WalletConnectorBase<C extends WalletConstructor<any> = WalletConstructor<any>> extends EventEmitter<WalletConnectorEventTypes> {
51
53
  #private;
54
+ abstract ChainWallet: C;
55
+ createWallet(props: WalletProps<InternalWalletConnector>): import("./wallets").Wallet<any>;
52
56
  chainRpcProviders: IChainRpcProviders | undefined;
53
57
  constructorProps: any;
54
58
  _walletBookInstance: WalletBookSingleton;
@@ -159,9 +163,11 @@ export declare abstract class WalletConnectorBase extends EventEmitter<WalletCon
159
163
  /**
160
164
  * Get the address silently
161
165
  *
166
+ * @param forceFetch - if true it will fetch the address again even if
167
+ * wallet has getConnectedAccounts limitation in wallet-book
162
168
  * @default Promise<[]>
163
169
  */
164
- getConnectedAccounts(): Promise<string[]>;
170
+ getConnectedAccounts(forceFetch?: boolean): Promise<string[]>;
165
171
  /**
166
172
  * Gets the deep link of the wallet
167
173
  *
@@ -256,13 +262,13 @@ export declare abstract class WalletConnectorBase extends EventEmitter<WalletCon
256
262
  * @returns WalletConnector
257
263
  * @default this
258
264
  */
259
- getMobileOrInstalledWallet(): WalletConnector;
265
+ getMobileOrInstalledWallet(): InternalWalletConnector;
260
266
  /**
261
267
  * In most cases this is an alias for `signMessage`
262
268
  *
263
269
  * @default Promise<undefined>
264
270
  */
265
- proveOwnership(messageToSign: string): Promise<string | undefined>;
271
+ proveOwnership(address: string, messageToSign: string): Promise<string | undefined>;
266
272
  /**
267
273
  * Additional resources to add to the message to be signed
268
274
  *
@@ -6,6 +6,7 @@ import { WalletAddressMismatchError } from '@dynamic-labs/utils';
6
6
  import { logger } from '../utils/logger.js';
7
7
  import { isSameAddress } from '../utils/isSameAddress/isSameAddress.js';
8
8
  import { getMobileExperience } from '../utils/getMobileExperience/getMobileExperience.js';
9
+ import { isConnectorMethodSupported } from '../utils/isConnectorMethodSupported/isConnectorMethodSupported.js';
9
10
  import { WalletBookSingleton } from './WalletBookSingleton.js';
10
11
 
11
12
  /* eslint-disable @typescript-eslint/triple-slash-reference */
@@ -39,6 +40,10 @@ const socialProviders = [
39
40
  'microsoft',
40
41
  ];
41
42
  class WalletConnectorBase extends EventEmitter {
43
+ createWallet(props) {
44
+ const wallet = new this.ChainWallet(props);
45
+ return wallet;
46
+ }
42
47
  /**
43
48
  * We store the constructor props so that we can use them later on
44
49
  * in getMobileOrInstalledWallet which may fall back to a different class
@@ -227,9 +232,11 @@ class WalletConnectorBase extends EventEmitter {
227
232
  /**
228
233
  * Get the address silently
229
234
  *
235
+ * @param forceFetch - if true it will fetch the address again even if
236
+ * wallet has getConnectedAccounts limitation in wallet-book
230
237
  * @default Promise<[]>
231
238
  */
232
- getConnectedAccounts() {
239
+ getConnectedAccounts(forceFetch) {
233
240
  return Promise.resolve([]);
234
241
  }
235
242
  /**
@@ -302,8 +309,11 @@ class WalletConnectorBase extends EventEmitter {
302
309
  *
303
310
  * @default Promise<undefined>
304
311
  */
305
- proveOwnership(messageToSign) {
306
- return this.signMessage(messageToSign);
312
+ proveOwnership(address, messageToSign) {
313
+ return __awaiter(this, void 0, void 0, function* () {
314
+ yield this.validateActiveWallet(address);
315
+ return this.signMessage(messageToSign);
316
+ });
307
317
  }
308
318
  /**
309
319
  * Set up event listeners for the wallet
@@ -355,26 +365,45 @@ class WalletConnectorBase extends EventEmitter {
355
365
  validateActiveWallet(expectedAddress) {
356
366
  return __awaiter(this, void 0, void 0, function* () {
357
367
  var _a, _b;
358
- const [activeAddress] = yield this.getConnectedAccounts();
359
- const isWalletActive = isSameAddress(activeAddress, expectedAddress, this.connectedChain);
360
- logger.debug(`validateActiveWallet - wallet ${isWalletActive ? 'is' : 'is not'} active`, {
361
- activeAddress,
362
- expectedAddress,
368
+ logger.debug('validateActiveWallet - validating wallet', expectedAddress);
369
+ const canFetchConnectedAccounts = isConnectorMethodSupported(this, 'getConnectedAccounts', 'browserExtension');
370
+ logger.debug('validateActiveWallet - getting connected accounts', {
371
+ canFetchConnectedAccounts,
363
372
  });
373
+ const [activeAddress] = canFetchConnectedAccounts
374
+ ? yield this.getConnectedAccounts(true)
375
+ : [];
376
+ const isWalletActive = activeAddress &&
377
+ isSameAddress(activeAddress, expectedAddress, this.connectedChain);
364
378
  const walletUiUtils = this.constructorProps
365
379
  .walletUiUtils;
366
380
  if (isWalletActive) {
381
+ logger.debug('validateActiveWallet - wallet is active');
367
382
  return;
368
383
  }
384
+ logger.debug('validateActiveWallet - trying to reconnect wallet...');
385
+ // not possible to auto-reconnect walletconnect
386
+ const reconnectedAddress = !this.isWalletConnect && (yield this.getAddress());
387
+ if (reconnectedAddress &&
388
+ isSameAddress(reconnectedAddress, expectedAddress, this.connectedChain)) {
389
+ logger.debug('validateActiveWallet - wallet reconnected successfuly');
390
+ return;
391
+ }
392
+ logger.debug('validateActiveWallet - wallet is not active', {
393
+ activeAddress,
394
+ expectedAddress,
395
+ reconnectedAddress,
396
+ });
397
+ const currentActiveAddress = activeAddress || reconnectedAddress || '';
369
398
  if (!walletUiUtils) {
370
399
  throw new WalletAddressMismatchError(`Wallet ${expectedAddress !== null && expectedAddress !== void 0 ? expectedAddress : ''} is not currently active in ${(_a = this.name) !== null && _a !== void 0 ? _a : this.key}.`, {
371
- activeAddress,
400
+ activeAddress: currentActiveAddress,
372
401
  expectedAddress,
373
402
  walletName: (_b = this.name) !== null && _b !== void 0 ? _b : this.key,
374
403
  });
375
404
  }
376
405
  return walletUiUtils.syncWallet({
377
- activeAddress,
406
+ activeAddress: currentActiveAddress,
378
407
  expectedAddress,
379
408
  walletConnector: this,
380
409
  });
@@ -1,5 +1,5 @@
1
- import { WalletConnector } from '.';
1
+ import { InternalWalletConnector } from '.';
2
2
  export interface WalletConnectorExtension {
3
- extend(connector: WalletConnector): void;
3
+ extend(connector: InternalWalletConnector): void;
4
4
  name: string;
5
5
  }
@@ -4,7 +4,6 @@ export * from './WalletConnector';
4
4
  export * from './types';
5
5
  export * from './IPasskeyWalletConnector';
6
6
  export * from './ITurnkeyWalletConnectorStamper';
7
- export * from './SmartWalletConnector';
8
7
  export * from './IAccountAbstractionWalletConnector';
9
8
  export * from './IBitcoinWalletConnector';
10
9
  export * from './IHardwareWalletConnector';
@@ -10,19 +10,17 @@ var normalizeAddress = require('../../../utils/isSameAddress/utils/normalizeAddr
10
10
  require('@dynamic-labs/utils');
11
11
  require('@dynamic-labs/wallet-book');
12
12
 
13
- var _Wallet_connector;
14
13
  class Wallet extends types.BaseWallet {
15
14
  constructor(_a) {
16
15
  var { connector } = _a, props = _tslib.__rest(_a, ["connector"]);
17
16
  super(props);
18
- _Wallet_connector.set(this, void 0);
19
- _tslib.__classPrivateFieldSet(this, _Wallet_connector, connector, "f");
17
+ this._connector = connector;
20
18
  }
21
19
  /**
22
20
  * Gets the wallet connector.
23
21
  */
24
22
  get connector() {
25
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f");
23
+ return this._connector;
26
24
  }
27
25
  /**
28
26
  * Retrieves the balance of the wallet.
@@ -31,7 +29,7 @@ class Wallet extends types.BaseWallet {
31
29
  */
32
30
  getBalance() {
33
31
  return _tslib.__awaiter(this, void 0, void 0, function* () {
34
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").getBalance(this.address);
32
+ return this._connector.getBalance(this.address);
35
33
  });
36
34
  }
37
35
  /**
@@ -41,57 +39,9 @@ class Wallet extends types.BaseWallet {
41
39
  */
42
40
  getNameService() {
43
41
  return _tslib.__awaiter(this, void 0, void 0, function* () {
44
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").getNameService(this.address);
42
+ return this._connector.getNameService(this.address);
45
43
  });
46
44
  }
47
- /**
48
- * Retrieves the network that the wallet is connected to.
49
- * @returns A promise that resolves to the network value as a string or number,
50
- * or undefined if the network cannot be retrieved.
51
- */
52
- getNetwork() {
53
- return _tslib.__awaiter(this, void 0, void 0, function* () {
54
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").getNetwork();
55
- });
56
- }
57
- /**
58
- * Retrieves the rpc provider for the wallet.
59
- * @returns A promise that resolves to the provider,
60
- * or undefined if the provider cannot be retrieved.
61
- */
62
- getPublicClient() {
63
- return _tslib.__awaiter(this, void 0, void 0, function* () {
64
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").getPublicClient();
65
- });
66
- }
67
- /**
68
- * Retrieves the signer for the wallet.
69
- * @returns A promise that resolves to the signer,
70
- * or undefined if the signer cannot be retrieved.
71
- */
72
- getSigner() {
73
- return _tslib.__awaiter(this, void 0, void 0, function* () {
74
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").getSigner();
75
- });
76
- }
77
- /**
78
- * Retrieves the wallet client.
79
- * @param chainId - (optional) Chain id to be used by the wallet client.
80
- * @returns A promise that resolves to the wallet client,
81
- * or undefined if the wallet client cannot be retrieved.
82
- */
83
- getWalletClient(chainId) {
84
- return _tslib.__awaiter(this, void 0, void 0, function* () {
85
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").getWalletClient(chainId);
86
- });
87
- }
88
- /**
89
- * If the wallet is availble to use. A wallet is available if its provider is available.
90
- * @returns True if the wallet is available, false otherwise.
91
- */
92
- isAvailable() {
93
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").isAvailable;
94
- }
95
45
  /**
96
46
  * If the wallet is connected.
97
47
  * @returns A promise that resolves to true the wallet is connected or false if it's not connected.
@@ -99,7 +49,7 @@ class Wallet extends types.BaseWallet {
99
49
  isConnected() {
100
50
  return _tslib.__awaiter(this, void 0, void 0, function* () {
101
51
  try {
102
- const connectedAccounts = yield _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").getConnectedAccounts();
52
+ const connectedAccounts = yield this._connector.getConnectedAccounts();
103
53
  return connectedAccounts
104
54
  .map((address) => normalizeAddress.normalizeAddress(address, this.chain))
105
55
  .includes(normalizeAddress.normalizeAddress(this.address, this.chain));
@@ -118,8 +68,7 @@ class Wallet extends types.BaseWallet {
118
68
  */
119
69
  proveOwnership(messageToSign) {
120
70
  return _tslib.__awaiter(this, void 0, void 0, function* () {
121
- yield this.sync();
122
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").proveOwnership(messageToSign);
71
+ return this._connector.proveOwnership(this.address, messageToSign);
123
72
  });
124
73
  }
125
74
  /**
@@ -131,7 +80,7 @@ class Wallet extends types.BaseWallet {
131
80
  signMessage(messageToSign) {
132
81
  return _tslib.__awaiter(this, void 0, void 0, function* () {
133
82
  yield this.sync();
134
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").signMessage(messageToSign);
83
+ return this._connector.signMessage(messageToSign);
135
84
  });
136
85
  }
137
86
  /**
@@ -141,7 +90,7 @@ class Wallet extends types.BaseWallet {
141
90
  */
142
91
  switchNetwork(networkChainId) {
143
92
  return _tslib.__awaiter(this, void 0, void 0, function* () {
144
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").switchNetwork({
93
+ return this._connector.switchNetwork({
145
94
  networkChainId,
146
95
  });
147
96
  });
@@ -152,10 +101,9 @@ class Wallet extends types.BaseWallet {
152
101
  */
153
102
  sync() {
154
103
  return _tslib.__awaiter(this, void 0, void 0, function* () {
155
- return _tslib.__classPrivateFieldGet(this, _Wallet_connector, "f").validateActiveWallet(this.address);
104
+ return this._connector.validateActiveWallet(this.address);
156
105
  });
157
106
  }
158
107
  }
159
- _Wallet_connector = new WeakMap();
160
108
 
161
109
  exports.Wallet = Wallet;
@@ -1,12 +1,12 @@
1
1
  import type { BaseWalletProps } from '@dynamic-labs/types';
2
2
  import { BaseWallet } from '@dynamic-labs/types';
3
- import { NameServiceData, WalletConnector } from '../../';
4
- type WalletProps = BaseWalletProps & {
5
- connector: WalletConnector;
3
+ import { WalletConnector, NameServiceData, InternalWalletConnector } from '../../';
4
+ export type WalletProps<T extends InternalWalletConnector = InternalWalletConnector> = BaseWalletProps & {
5
+ connector: T;
6
6
  };
7
- export declare class Wallet extends BaseWallet {
8
- #private;
9
- constructor({ connector, ...props }: WalletProps);
7
+ export declare class Wallet<T extends InternalWalletConnector = InternalWalletConnector> extends BaseWallet {
8
+ protected _connector: T;
9
+ constructor({ connector, ...props }: WalletProps<T>);
10
10
  /**
11
11
  * Gets the wallet connector.
12
12
  */
@@ -23,36 +23,6 @@ export declare class Wallet extends BaseWallet {
23
23
  * or undefined if the data cannot be retrieved.
24
24
  */
25
25
  getNameService(): Promise<NameServiceData | undefined>;
26
- /**
27
- * Retrieves the network that the wallet is connected to.
28
- * @returns A promise that resolves to the network value as a string or number,
29
- * or undefined if the network cannot be retrieved.
30
- */
31
- getNetwork(): Promise<string | number | undefined>;
32
- /**
33
- * Retrieves the rpc provider for the wallet.
34
- * @returns A promise that resolves to the provider,
35
- * or undefined if the provider cannot be retrieved.
36
- */
37
- getPublicClient<T>(): Promise<T>;
38
- /**
39
- * Retrieves the signer for the wallet.
40
- * @returns A promise that resolves to the signer,
41
- * or undefined if the signer cannot be retrieved.
42
- */
43
- getSigner<T>(): Promise<T>;
44
- /**
45
- * Retrieves the wallet client.
46
- * @param chainId - (optional) Chain id to be used by the wallet client.
47
- * @returns A promise that resolves to the wallet client,
48
- * or undefined if the wallet client cannot be retrieved.
49
- */
50
- getWalletClient<T>(chainId?: string): Promise<T>;
51
- /**
52
- * If the wallet is availble to use. A wallet is available if its provider is available.
53
- * @returns True if the wallet is available, false otherwise.
54
- */
55
- isAvailable(): boolean;
56
26
  /**
57
27
  * If the wallet is connected.
58
28
  * @returns A promise that resolves to true the wallet is connected or false if it's not connected.
@@ -84,4 +54,6 @@ export declare class Wallet extends BaseWallet {
84
54
  */
85
55
  sync(): Promise<void>;
86
56
  }
87
- export {};
57
+ export interface WalletConstructor<T extends InternalWalletConnector> {
58
+ new (props: WalletProps<T>): Wallet<T>;
59
+ }
@@ -1,24 +1,22 @@
1
1
  'use client'
2
- import { __rest, __classPrivateFieldSet, __classPrivateFieldGet, __awaiter } from '../../../../_virtual/_tslib.js';
2
+ import { __rest, __awaiter } from '../../../../_virtual/_tslib.js';
3
3
  import { BaseWallet } from '@dynamic-labs/types';
4
4
  import { logger } from '../../../utils/logger.js';
5
5
  import { normalizeAddress } from '../../../utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js';
6
6
  import '@dynamic-labs/utils';
7
7
  import '@dynamic-labs/wallet-book';
8
8
 
9
- var _Wallet_connector;
10
9
  class Wallet extends BaseWallet {
11
10
  constructor(_a) {
12
11
  var { connector } = _a, props = __rest(_a, ["connector"]);
13
12
  super(props);
14
- _Wallet_connector.set(this, void 0);
15
- __classPrivateFieldSet(this, _Wallet_connector, connector, "f");
13
+ this._connector = connector;
16
14
  }
17
15
  /**
18
16
  * Gets the wallet connector.
19
17
  */
20
18
  get connector() {
21
- return __classPrivateFieldGet(this, _Wallet_connector, "f");
19
+ return this._connector;
22
20
  }
23
21
  /**
24
22
  * Retrieves the balance of the wallet.
@@ -27,7 +25,7 @@ class Wallet extends BaseWallet {
27
25
  */
28
26
  getBalance() {
29
27
  return __awaiter(this, void 0, void 0, function* () {
30
- return __classPrivateFieldGet(this, _Wallet_connector, "f").getBalance(this.address);
28
+ return this._connector.getBalance(this.address);
31
29
  });
32
30
  }
33
31
  /**
@@ -37,57 +35,9 @@ class Wallet extends BaseWallet {
37
35
  */
38
36
  getNameService() {
39
37
  return __awaiter(this, void 0, void 0, function* () {
40
- return __classPrivateFieldGet(this, _Wallet_connector, "f").getNameService(this.address);
38
+ return this._connector.getNameService(this.address);
41
39
  });
42
40
  }
43
- /**
44
- * Retrieves the network that the wallet is connected to.
45
- * @returns A promise that resolves to the network value as a string or number,
46
- * or undefined if the network cannot be retrieved.
47
- */
48
- getNetwork() {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- return __classPrivateFieldGet(this, _Wallet_connector, "f").getNetwork();
51
- });
52
- }
53
- /**
54
- * Retrieves the rpc provider for the wallet.
55
- * @returns A promise that resolves to the provider,
56
- * or undefined if the provider cannot be retrieved.
57
- */
58
- getPublicClient() {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- return __classPrivateFieldGet(this, _Wallet_connector, "f").getPublicClient();
61
- });
62
- }
63
- /**
64
- * Retrieves the signer for the wallet.
65
- * @returns A promise that resolves to the signer,
66
- * or undefined if the signer cannot be retrieved.
67
- */
68
- getSigner() {
69
- return __awaiter(this, void 0, void 0, function* () {
70
- return __classPrivateFieldGet(this, _Wallet_connector, "f").getSigner();
71
- });
72
- }
73
- /**
74
- * Retrieves the wallet client.
75
- * @param chainId - (optional) Chain id to be used by the wallet client.
76
- * @returns A promise that resolves to the wallet client,
77
- * or undefined if the wallet client cannot be retrieved.
78
- */
79
- getWalletClient(chainId) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- return __classPrivateFieldGet(this, _Wallet_connector, "f").getWalletClient(chainId);
82
- });
83
- }
84
- /**
85
- * If the wallet is availble to use. A wallet is available if its provider is available.
86
- * @returns True if the wallet is available, false otherwise.
87
- */
88
- isAvailable() {
89
- return __classPrivateFieldGet(this, _Wallet_connector, "f").isAvailable;
90
- }
91
41
  /**
92
42
  * If the wallet is connected.
93
43
  * @returns A promise that resolves to true the wallet is connected or false if it's not connected.
@@ -95,7 +45,7 @@ class Wallet extends BaseWallet {
95
45
  isConnected() {
96
46
  return __awaiter(this, void 0, void 0, function* () {
97
47
  try {
98
- const connectedAccounts = yield __classPrivateFieldGet(this, _Wallet_connector, "f").getConnectedAccounts();
48
+ const connectedAccounts = yield this._connector.getConnectedAccounts();
99
49
  return connectedAccounts
100
50
  .map((address) => normalizeAddress(address, this.chain))
101
51
  .includes(normalizeAddress(this.address, this.chain));
@@ -114,8 +64,7 @@ class Wallet extends BaseWallet {
114
64
  */
115
65
  proveOwnership(messageToSign) {
116
66
  return __awaiter(this, void 0, void 0, function* () {
117
- yield this.sync();
118
- return __classPrivateFieldGet(this, _Wallet_connector, "f").proveOwnership(messageToSign);
67
+ return this._connector.proveOwnership(this.address, messageToSign);
119
68
  });
120
69
  }
121
70
  /**
@@ -127,7 +76,7 @@ class Wallet extends BaseWallet {
127
76
  signMessage(messageToSign) {
128
77
  return __awaiter(this, void 0, void 0, function* () {
129
78
  yield this.sync();
130
- return __classPrivateFieldGet(this, _Wallet_connector, "f").signMessage(messageToSign);
79
+ return this._connector.signMessage(messageToSign);
131
80
  });
132
81
  }
133
82
  /**
@@ -137,7 +86,7 @@ class Wallet extends BaseWallet {
137
86
  */
138
87
  switchNetwork(networkChainId) {
139
88
  return __awaiter(this, void 0, void 0, function* () {
140
- return __classPrivateFieldGet(this, _Wallet_connector, "f").switchNetwork({
89
+ return this._connector.switchNetwork({
141
90
  networkChainId,
142
91
  });
143
92
  });
@@ -148,10 +97,9 @@ class Wallet extends BaseWallet {
148
97
  */
149
98
  sync() {
150
99
  return __awaiter(this, void 0, void 0, function* () {
151
- return __classPrivateFieldGet(this, _Wallet_connector, "f").validateActiveWallet(this.address);
100
+ return this._connector.validateActiveWallet(this.address);
152
101
  });
153
102
  }
154
103
  }
155
- _Wallet_connector = new WeakMap();
156
104
 
157
105
  export { Wallet };
@@ -54,8 +54,12 @@ const chainsInfo = [
54
54
  },
55
55
  ];
56
56
  const chainOverrides = {
57
+ algo: 'algorand',
58
+ bip122: 'bitcoin',
59
+ btc: 'bitcoin',
57
60
  eip155: 'evm',
58
61
  eth: 'evm',
62
+ sol: 'solana',
59
63
  stark: 'starknet',
60
64
  };
61
65
  let chainInfoOverrides;
@@ -50,8 +50,12 @@ const chainsInfo = [
50
50
  },
51
51
  ];
52
52
  const chainOverrides = {
53
+ algo: 'algorand',
54
+ bip122: 'bitcoin',
55
+ btc: 'bitcoin',
53
56
  eip155: 'evm',
54
57
  eth: 'evm',
58
+ sol: 'solana',
55
59
  stark: 'starknet',
56
60
  };
57
61
  let chainInfoOverrides;
@@ -1,2 +1,2 @@
1
- import { WalletConnector } from '../lib';
2
- export declare const getWalletConnectorByKey: (wallets: WalletConnector[], key: string) => WalletConnector | null;
1
+ import { InternalWalletConnector } from '../lib';
2
+ export declare const getWalletConnectorByKey: (wallets: InternalWalletConnector[], key: string) => InternalWalletConnector | null;
@@ -13,7 +13,6 @@ export * from './isEmbeddedConnector';
13
13
  export * from './isMagicConnector';
14
14
  export * from './isBloctoConnector';
15
15
  export * from './isPasskeyWalletConnector';
16
- export * from './isSmartWalletConnector';
17
16
  export * from './isAccountAbstractionConnector';
18
17
  export * from './isBitcoinConnector';
19
18
  export * from './isHardwareWalletConnector';
@@ -24,5 +23,5 @@ export * from './getRpcUrlForChain';
24
23
  export * from './isCoinbaseMpcWalletConnector';
25
24
  export * from './isWalletConnectConnector';
26
25
  export * from './isSendBalanceWalletConnector';
27
- export * from './isSessionKeyCompatibleWalletConnector';
26
+ export * from './isSessionKeyCompatible';
28
27
  export * from './getMobileExperience';
@@ -1 +1 @@
1
- export { isAccountAbstractionConnector } from './isAccountAbstractionConnector';
1
+ export * from './isAccountAbstractionConnector';
@@ -0,0 +1 @@
1
+ export { isConnectorMethodSupported } from './isConnectorMethodSupported';
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var walletBook = require('@dynamic-labs/wallet-book');
7
+
8
+ const isConnectorMethodSupported = (connector, method, platform) => {
9
+ const walletBookWallet = connector.constructorProps.walletData ||
10
+ walletBook.getWalletBookWallet(connector.walletBook, connector.key);
11
+ return walletBook.isWalletMethodSupported(walletBookWallet, method, platform);
12
+ };
13
+
14
+ exports.isConnectorMethodSupported = isConnectorMethodSupported;
@@ -0,0 +1,3 @@
1
+ import { WalletSchema } from '@dynamic-labs/wallet-book';
2
+ import { InternalWalletConnector } from '../../lib';
3
+ export declare const isConnectorMethodSupported: (connector: InternalWalletConnector, method: string, platform: keyof NonNullable<WalletSchema['walletLimitations']>) => boolean;
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ import { getWalletBookWallet, isWalletMethodSupported } from '@dynamic-labs/wallet-book';
3
+
4
+ const isConnectorMethodSupported = (connector, method, platform) => {
5
+ const walletBookWallet = connector.constructorProps.walletData ||
6
+ getWalletBookWallet(connector.walletBook, connector.key);
7
+ return isWalletMethodSupported(walletBookWallet, method, platform);
8
+ };
9
+
10
+ export { isConnectorMethodSupported };
@@ -1,2 +1,2 @@
1
1
  import { IHardwareWalletConnector, WalletConnector } from '../../lib';
2
- export declare const isHardwareWalletConnector: (connector: WalletConnector | IHardwareWalletConnector) => connector is IHardwareWalletConnector & import("../../lib").WalletConnectorCore.WalletConnector;
2
+ export declare const isHardwareWalletConnector: (connector: WalletConnector | IHardwareWalletConnector) => connector is IHardwareWalletConnector;
@@ -0,0 +1,2 @@
1
+ export * from './isSessionKeyCompatibleWallet';
2
+ export * from './isSessionKeyCompatibleWalletConnector';
@@ -0,0 +1 @@
1
+ export * from './isSessionKeyCompatibleWallet';
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var isSessionKeyCompatibleWalletConnector = require('../isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.cjs');
7
+
8
+ const isSessionKeyCompatibleWallet = (wallet) => isSessionKeyCompatibleWalletConnector.isSessionKeyCompatibleWalletConnector(wallet.connector);
9
+
10
+ exports.isSessionKeyCompatibleWallet = isSessionKeyCompatibleWallet;
@@ -0,0 +1,2 @@
1
+ import { Wallet } from '../../../lib/wallets/Wallet';
2
+ export declare const isSessionKeyCompatibleWallet: (wallet: Wallet) => boolean;
@@ -0,0 +1,6 @@
1
+ 'use client'
2
+ import { isSessionKeyCompatibleWalletConnector } from '../isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
3
+
4
+ const isSessionKeyCompatibleWallet = (wallet) => isSessionKeyCompatibleWalletConnector(wallet.connector);
5
+
6
+ export { isSessionKeyCompatibleWallet };
@@ -1,2 +1,3 @@
1
- import { ISessionKeyCompatibleWalletConnector, WalletConnector } from '../../lib';
1
+ import { ISessionKeyCompatibleWalletConnector } from '../../../lib/ISessionKeyCompatibleWalletConnector';
2
+ import { WalletConnector } from '../../../lib/WalletConnector';
2
3
  export declare const isSessionKeyCompatibleWalletConnector: (walletConnector: WalletConnector | ISessionKeyCompatibleWalletConnector | undefined | null) => walletConnector is ISessionKeyCompatibleWalletConnector;
@@ -1,4 +0,0 @@
1
- import { WalletConnectorBase } from './WalletConnector';
2
- export interface SmartWalletConnector extends WalletConnectorBase {
3
- setEoaConnector(connector: WalletConnectorBase): Promise<void>;
4
- }
@@ -1 +0,0 @@
1
- export * from './isSmartWalletConnector';
@@ -1,8 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- const isSmartWalletConnector = (walletConnector) => Boolean(walletConnector.setEoaConnector);
7
-
8
- exports.isSmartWalletConnector = isSmartWalletConnector;
@@ -1,2 +0,0 @@
1
- import { SmartWalletConnector, WalletConnector } from '../../lib';
2
- export declare const isSmartWalletConnector: (walletConnector: WalletConnector) => walletConnector is SmartWalletConnector;
@@ -1,4 +0,0 @@
1
- 'use client'
2
- const isSmartWalletConnector = (walletConnector) => Boolean(walletConnector.setEoaConnector);
3
-
4
- export { isSmartWalletConnector };