@dynamic-labs/multi-wallet 0.16.12-viem.1 → 0.16.13

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 (58) hide show
  1. package/CHANGELOG.md +13 -3
  2. package/package.json +4 -4
  3. package/src/errors.cjs +2 -1
  4. package/src/errors.d.ts +6 -2
  5. package/src/errors.js +2 -1
  6. package/src/multi-wallet.cjs +4 -3
  7. package/src/multi-wallet.js +4 -3
  8. package/src/rpcProviders.cjs +2 -6
  9. package/src/rpcProviders.js +2 -6
  10. package/src/types.d.ts +8 -16
  11. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs +54 -0
  12. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.d.ts +3 -0
  13. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js +50 -0
  14. package/src/utils/assignConfirmationScreenToProvider/index.d.ts +1 -0
  15. package/src/utils/isFunction/isFunction.cjs +8 -0
  16. package/src/utils/isFunction/isFunction.js +4 -0
  17. package/src/utils/message.cjs +2 -2
  18. package/src/utils/message.js +1 -1
  19. package/src/wallets/algorand/myalgo.d.ts +2 -1
  20. package/src/wallets/clients/coinbase/coinbase.cjs +2 -2
  21. package/src/wallets/clients/coinbase/coinbase.js +2 -2
  22. package/src/wallets/clients/walletConnect/walletConnect.cjs +5 -9
  23. package/src/wallets/clients/walletConnect/walletConnect.d.ts +2 -2
  24. package/src/wallets/clients/walletConnect/walletConnect.js +5 -9
  25. package/src/wallets/ethereum/BloctoEvm.cjs +140 -0
  26. package/src/wallets/ethereum/BloctoEvm.d.ts +2 -4
  27. package/src/wallets/ethereum/BloctoEvm.js +134 -0
  28. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +37 -5
  29. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +3 -0
  30. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +37 -5
  31. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +14 -35
  32. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +4 -4
  33. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +14 -35
  34. package/src/wallets/ethereum/coinbase.cjs +7 -18
  35. package/src/wallets/ethereum/coinbase.d.ts +2 -750
  36. package/src/wallets/ethereum/coinbase.js +7 -18
  37. package/src/wallets/ethereum/ethProvider.cjs +29 -13
  38. package/src/wallets/ethereum/ethProvider.d.ts +7 -7
  39. package/src/wallets/ethereum/ethProvider.js +29 -13
  40. package/src/wallets/ethereum/ethProviderHelper.cjs +34 -52
  41. package/src/wallets/ethereum/ethProviderHelper.d.ts +20 -20
  42. package/src/wallets/ethereum/ethProviderHelper.js +34 -52
  43. package/src/wallets/ethereum/fortmatic.cjs +7 -15
  44. package/src/wallets/ethereum/fortmatic.d.ts +3 -5
  45. package/src/wallets/ethereum/fortmatic.js +7 -15
  46. package/src/wallets/ethereum/meta-mask.cjs +2 -13
  47. package/src/wallets/ethereum/meta-mask.d.ts +3 -752
  48. package/src/wallets/ethereum/meta-mask.js +2 -13
  49. package/src/wallets/walletConnect/walletConnect.cjs +6 -8
  50. package/src/wallets/walletConnect/walletConnect.d.ts +4 -751
  51. package/src/wallets/walletConnect/walletConnect.js +6 -8
  52. package/src/wallets/walletConnect/walletConnectV2.cjs +7 -11
  53. package/src/wallets/walletConnect/walletConnectV2.d.ts +4 -751
  54. package/src/wallets/walletConnect/walletConnectV2.js +7 -11
  55. package/src/wallets/window.d.ts +1 -3
  56. package/src/getOrMapViemChain.cjs +0 -77
  57. package/src/getOrMapViemChain.d.ts +0 -11
  58. package/src/getOrMapViemChain.js +0 -51
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import Provider from '@walletconnect/universal-provider';
3
- import { createWalletClient, custom } from 'viem';
3
+ import { ethers } from 'ethers';
4
4
  import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
5
5
  import { normalizeWalletName } from '../../utils/normalizeWalletName/normalizeWalletName.js';
6
6
  import { EthProvider } from '../ethereum/ethProvider.js';
@@ -133,9 +133,7 @@ class WalletConnectV2 extends EthProvider {
133
133
  if (!provider) {
134
134
  throw new Error('No provider found');
135
135
  }
136
- return createWalletClient({
137
- transport: custom(provider),
138
- });
136
+ return new ethers.providers.Web3Provider(provider, 'any');
139
137
  }
140
138
  isInstalledOnBrowser() {
141
139
  return false;
@@ -213,10 +211,10 @@ class WalletConnectV2 extends EthProvider {
213
211
  // eslint-disable-next-line prefer-destructuring
214
212
  const address = this.session.namespaces.eip155.accounts[0].split(':')[2];
215
213
  const web3Provider = this.getWeb3Provider();
216
- return web3Provider.signMessage({
217
- account: address,
218
- message: utf8ToHex(messageToSign, true),
219
- });
214
+ return web3Provider.send('personal_sign', [
215
+ utf8ToHex(messageToSign, true),
216
+ address,
217
+ ]);
220
218
  });
221
219
  }
222
220
  proveOwnership(messageToSign) {
@@ -267,9 +265,7 @@ class WalletConnectV2 extends EthProvider {
267
265
  if (!this.session) {
268
266
  return [];
269
267
  }
270
- return [
271
- this.session.namespaces.eip155.accounts[0].split(':')[2],
272
- ];
268
+ return [this.session.namespaces.eip155.accounts[0].split(':')[2]];
273
269
  });
274
270
  }
275
271
  }
@@ -56,12 +56,10 @@ export interface IEthereum {
56
56
  isPhantom: boolean;
57
57
  isTrustWallet: boolean;
58
58
  isZerion: boolean;
59
- on: (event: string, listener: (...args: Array<any>) => unknown) => void;
60
59
  providers: object[];
61
- removeListener: (event: string, listener: (...args: Array<any>) => unknown) => void;
62
60
  request: <T extends string>(params: {
63
61
  method: T;
64
- } | object) => Promise<T extends 'eth_requestAccounts' ? [`0x${string}`] : object>;
62
+ } | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
65
63
  }
66
64
  export interface ISolana {
67
65
  connect: () => Promise<void | object>;
@@ -1,77 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var chains = require('viem/chains');
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var chains__namespace = /*#__PURE__*/_interopNamespace(chains);
26
-
27
- // eslint-disable-next-line import/no-namespace
28
- /**
29
- * Gets the chain object for the given chain id.
30
- * @param chainId - Chain id of the target EVM chain.
31
- * @returns Viem's chain object.
32
- */
33
- const getChain = (chainId) => {
34
- for (const chain of Object.values(chains__namespace)) {
35
- if ('id' in chain) {
36
- if (chain.id === chainId) {
37
- return chain;
38
- }
39
- }
40
- }
41
- throw new Error(`Chain with id ${chainId} not found`);
42
- };
43
- const mapChain = (network) => {
44
- var _a;
45
- return ({
46
- blockExplorers: ((_a = network.blockExplorerUrls) === null || _a === void 0 ? void 0 : _a[0])
47
- ? {
48
- default: {
49
- name: network.blockExplorerUrls[0],
50
- url: network.blockExplorerUrls[0],
51
- },
52
- }
53
- : undefined,
54
- id: network.chainId,
55
- name: network.vanityName || network.chainName,
56
- nativeCurrency: network.nativeCurrency,
57
- network: network.chainName,
58
- rpcUrls: {
59
- default: { http: network.rpcUrls },
60
- public: { http: network.rpcUrls },
61
- },
62
- });
63
- };
64
- const getOrMapViemChain = (network) => {
65
- let chain;
66
- try {
67
- chain = getChain(network.chainId);
68
- }
69
- catch (_a) {
70
- chain = mapChain(network);
71
- }
72
- return chain;
73
- };
74
-
75
- exports.getChain = getChain;
76
- exports.getOrMapViemChain = getOrMapViemChain;
77
- exports.mapChain = mapChain;
@@ -1,11 +0,0 @@
1
- import { Chain } from 'viem';
2
- import * as chains from 'viem/chains';
3
- import { EvmNetwork } from './wallets/ethereum/evm-network';
4
- /**
5
- * Gets the chain object for the given chain id.
6
- * @param chainId - Chain id of the target EVM chain.
7
- * @returns Viem's chain object.
8
- */
9
- export declare const getChain: (chainId: number) => chains.Chain;
10
- export declare const mapChain: (network: EvmNetwork) => Chain;
11
- export declare const getOrMapViemChain: (network: EvmNetwork) => Chain;
@@ -1,51 +0,0 @@
1
- import * as chains from 'viem/chains';
2
-
3
- // eslint-disable-next-line import/no-namespace
4
- /**
5
- * Gets the chain object for the given chain id.
6
- * @param chainId - Chain id of the target EVM chain.
7
- * @returns Viem's chain object.
8
- */
9
- const getChain = (chainId) => {
10
- for (const chain of Object.values(chains)) {
11
- if ('id' in chain) {
12
- if (chain.id === chainId) {
13
- return chain;
14
- }
15
- }
16
- }
17
- throw new Error(`Chain with id ${chainId} not found`);
18
- };
19
- const mapChain = (network) => {
20
- var _a;
21
- return ({
22
- blockExplorers: ((_a = network.blockExplorerUrls) === null || _a === void 0 ? void 0 : _a[0])
23
- ? {
24
- default: {
25
- name: network.blockExplorerUrls[0],
26
- url: network.blockExplorerUrls[0],
27
- },
28
- }
29
- : undefined,
30
- id: network.chainId,
31
- name: network.vanityName || network.chainName,
32
- nativeCurrency: network.nativeCurrency,
33
- network: network.chainName,
34
- rpcUrls: {
35
- default: { http: network.rpcUrls },
36
- public: { http: network.rpcUrls },
37
- },
38
- });
39
- };
40
- const getOrMapViemChain = (network) => {
41
- let chain;
42
- try {
43
- chain = getChain(network.chainId);
44
- }
45
- catch (_a) {
46
- chain = mapChain(network);
47
- }
48
- return chain;
49
- };
50
-
51
- export { getChain, getOrMapViemChain, mapChain };