@dynamic-labs/multi-wallet 0.17.0-RC.5 → 0.17.0-RC.7
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 +39 -0
- package/package.json +7 -4
- package/src/index.cjs +0 -5
- package/src/index.d.ts +0 -2
- package/src/index.js +0 -1
- package/src/multi-wallet.cjs +45 -76
- package/src/multi-wallet.js +45 -76
- package/src/types.d.ts +9 -28
- package/src/utils/findProvider/findProvider.cjs +7 -0
- package/src/utils/findProvider/findProvider.d.ts +2 -0
- package/src/utils/findProvider/findProvider.js +3 -0
- package/src/utils/findProvider/index.d.ts +1 -0
- package/src/utils/message.d.ts +2 -2
- package/src/utils/walletConnect.cjs +21 -20
- package/src/utils/walletConnect.d.ts +4 -3
- package/src/utils/walletConnect.js +21 -20
- package/src/wallets/clients/coinbase/types.d.ts +2 -2
- package/src/wallets/clients/walletConnect/walletConnect.cjs +8 -13
- package/src/wallets/clients/walletConnect/walletConnect.js +8 -13
- package/src/wallets/cosmos/KeplrWalletConnect.cjs +7 -6
- package/src/wallets/cosmos/KeplrWalletConnect.d.ts +3 -3
- package/src/wallets/cosmos/KeplrWalletConnect.js +7 -6
- package/src/wallets/cosmos/KeplrWalletConnector.cjs +9 -2
- package/src/wallets/cosmos/KeplrWalletConnector.d.ts +5 -3
- package/src/wallets/cosmos/KeplrWalletConnector.js +9 -2
- package/src/wallets/cosmos/getKeplrConnector.d.ts +2 -2
- package/src/wallets/ethereum/BloctoEvm.cjs +7 -7
- package/src/wallets/ethereum/BloctoEvm.d.ts +2 -5
- package/src/wallets/ethereum/BloctoEvm.js +7 -7
- package/src/wallets/ethereum/EthWalletConnector.cjs +27 -11
- package/src/wallets/ethereum/EthWalletConnector.d.ts +7 -4
- package/src/wallets/ethereum/EthWalletConnector.js +27 -11
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +5 -4
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +3 -3
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +5 -4
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs +1 -0
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js +1 -0
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +4 -2
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +4 -3
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +4 -2
- package/src/wallets/ethereum/coinbase.cjs +3 -2
- package/src/wallets/ethereum/coinbase.d.ts +6 -7
- package/src/wallets/ethereum/coinbase.js +4 -3
- package/src/wallets/ethereum/evm-network.cjs +2 -2
- package/src/wallets/ethereum/evm-network.d.ts +1 -17
- package/src/wallets/ethereum/evm-network.js +2 -2
- package/src/wallets/ethereum/fortmatic.cjs +3 -2
- package/src/wallets/ethereum/fortmatic.d.ts +5 -6
- package/src/wallets/ethereum/fortmatic.js +4 -3
- package/src/wallets/ethereum/meta-mask.d.ts +1 -1
- package/src/wallets/getMobileOrInjectedWallet.cjs +5 -9
- package/src/wallets/getMobileOrInjectedWallet.d.ts +5 -4
- package/src/wallets/getMobileOrInjectedWallet.js +5 -9
- package/src/wallets/getWalletConnectConnector.cjs +7 -10
- package/src/wallets/getWalletConnectConnector.d.ts +2 -5
- package/src/wallets/getWalletConnectConnector.js +7 -10
- package/src/wallets/solana/solWalletConnector.cjs +22 -4
- package/src/wallets/solana/solWalletConnector.d.ts +8 -5
- package/src/wallets/solana/solWalletConnector.js +22 -4
- package/src/wallets/walletConnect/walletConnect.cjs +3 -2
- package/src/wallets/walletConnect/walletConnect.d.ts +6 -6
- package/src/wallets/walletConnect/walletConnect.js +4 -3
- package/src/wallets/walletConnect/walletConnectV2.cjs +1 -1
- package/src/wallets/walletConnect/walletConnectV2.d.ts +7 -7
- package/src/wallets/walletConnect/walletConnectV2.js +1 -1
- package/src/wallets/walletConnect/zerion.d.ts +2 -4
- package/src/rpcProviders.cjs +0 -76
- package/src/rpcProviders.d.ts +0 -5
- package/src/rpcProviders.js +0 -69
package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
6
7
|
|
|
7
8
|
// these are based off of Magic's EthNetworkName type
|
|
8
9
|
const chainNameToChainIdMap = {
|
|
@@ -17,16 +18,16 @@ const chainNameToChainIdMap = {
|
|
|
17
18
|
sepolia: 11155111,
|
|
18
19
|
};
|
|
19
20
|
class MagicClientNetworkHandler {
|
|
20
|
-
constructor({ createClient, evmNetworks, config, }) {
|
|
21
|
-
var _a, _b;
|
|
21
|
+
constructor({ createClient, evmNetworks, config, defaultChainId, }) {
|
|
22
|
+
var _a, _b, _c;
|
|
22
23
|
this._clients = {};
|
|
23
24
|
this.evmNetworks = [];
|
|
24
25
|
this._config = config;
|
|
25
|
-
this.evmNetworks = evmNetworks;
|
|
26
|
+
this.evmNetworks = utils.parseEvmNetworks(evmNetworks);
|
|
26
27
|
this._networkId =
|
|
27
28
|
typeof (config === null || config === void 0 ? void 0 : config.network) === 'string'
|
|
28
29
|
? chainNameToChainIdMap[config.network]
|
|
29
|
-
: (_b = (_a = config === null || config === void 0 ? void 0 : config.network) === null || _a === void 0 ? void 0 : _a.chainId) !== null && _b !== void 0 ? _b : 1;
|
|
30
|
+
: (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.network) === null || _a === void 0 ? void 0 : _a.chainId) !== null && _b !== void 0 ? _b : defaultChainId) !== null && _c !== void 0 ? _c : 1;
|
|
30
31
|
this._createClient = createClient;
|
|
31
32
|
}
|
|
32
33
|
setListeners(listeners) {
|
package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { MagicSDKAdditionalConfiguration, MagicSDKExtensionsOption } from 'magic-sdk';
|
|
2
2
|
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { EvmNetwork } from '@dynamic-labs/types';
|
|
3
4
|
import { MagicConnectorProps } from '../MagicWalletConnector';
|
|
4
|
-
import { EvmNetwork } from '../../evm-network';
|
|
5
5
|
export type MagicLinkConfig = Pick<MagicSDKAdditionalConfiguration<string, MagicSDKExtensionsOption<string>>, 'network' | 'testMode' | 'locale'> & {
|
|
6
6
|
redirectURI?: string;
|
|
7
7
|
};
|
|
8
8
|
type ConfigForNetwork = MagicSDKAdditionalConfiguration<string, MagicSDKExtensionsOption<string>> | undefined;
|
|
9
|
-
export type MagicClientNetworkHandlerProps<TClient> = Pick<MagicConnectorProps, 'config' | 'evmNetworks'> & {
|
|
9
|
+
export type MagicClientNetworkHandlerProps<TClient> = Pick<MagicConnectorProps, 'config' | 'evmNetworks' | 'defaultChainId'> & {
|
|
10
10
|
createClient: (config: ConfigForNetwork) => TClient;
|
|
11
11
|
};
|
|
12
12
|
export declare class MagicClientNetworkHandler<TClient = unknown> {
|
|
@@ -18,7 +18,7 @@ export declare class MagicClientNetworkHandler<TClient = unknown> {
|
|
|
18
18
|
protected _listeners: WalletEventListeners | undefined;
|
|
19
19
|
evmNetworks: EvmNetwork[];
|
|
20
20
|
protected _createClient: MagicClientNetworkHandlerProps<TClient>['createClient'];
|
|
21
|
-
constructor({ createClient, evmNetworks, config, }: MagicClientNetworkHandlerProps<TClient>);
|
|
21
|
+
constructor({ createClient, evmNetworks, config, defaultChainId, }: MagicClientNetworkHandlerProps<TClient>);
|
|
22
22
|
setListeners(listeners: WalletEventListeners | undefined): void;
|
|
23
23
|
onChainChanged(networkChainId: number): void;
|
|
24
24
|
selectNetwork(networkChainId: number): Promise<void>;
|
package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
+
import { parseEvmNetworks } from '@dynamic-labs/utils';
|
|
2
3
|
|
|
3
4
|
// these are based off of Magic's EthNetworkName type
|
|
4
5
|
const chainNameToChainIdMap = {
|
|
@@ -13,16 +14,16 @@ const chainNameToChainIdMap = {
|
|
|
13
14
|
sepolia: 11155111,
|
|
14
15
|
};
|
|
15
16
|
class MagicClientNetworkHandler {
|
|
16
|
-
constructor({ createClient, evmNetworks, config, }) {
|
|
17
|
-
var _a, _b;
|
|
17
|
+
constructor({ createClient, evmNetworks, config, defaultChainId, }) {
|
|
18
|
+
var _a, _b, _c;
|
|
18
19
|
this._clients = {};
|
|
19
20
|
this.evmNetworks = [];
|
|
20
21
|
this._config = config;
|
|
21
|
-
this.evmNetworks = evmNetworks;
|
|
22
|
+
this.evmNetworks = parseEvmNetworks(evmNetworks);
|
|
22
23
|
this._networkId =
|
|
23
24
|
typeof (config === null || config === void 0 ? void 0 : config.network) === 'string'
|
|
24
25
|
? chainNameToChainIdMap[config.network]
|
|
25
|
-
: (_b = (_a = config === null || config === void 0 ? void 0 : config.network) === null || _a === void 0 ? void 0 : _a.chainId) !== null && _b !== void 0 ? _b : 1;
|
|
26
|
+
: (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.network) === null || _a === void 0 ? void 0 : _a.chainId) !== null && _b !== void 0 ? _b : defaultChainId) !== null && _c !== void 0 ? _c : 1;
|
|
26
27
|
this._createClient = createClient;
|
|
27
28
|
}
|
|
28
29
|
setListeners(listeners) {
|
|
@@ -16,6 +16,7 @@ class MagicSocialWalletConnector extends MagicWalletConnector.MagicWalletConnect
|
|
|
16
16
|
this._magicClient = new MagicClientNetworkHandler.MagicClientNetworkHandler({
|
|
17
17
|
config: opts.config,
|
|
18
18
|
createClient: (config) => new magicSdk.Magic(opts.apiKey, Object.assign(Object.assign({}, config), { extensions: [new oauth.OAuthExtension()] })),
|
|
19
|
+
defaultChainId: opts.defaultChainId,
|
|
19
20
|
evmNetworks: opts.evmNetworks,
|
|
20
21
|
});
|
|
21
22
|
}
|
package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js
CHANGED
|
@@ -12,6 +12,7 @@ class MagicSocialWalletConnector extends MagicWalletConnector {
|
|
|
12
12
|
this._magicClient = new MagicClientNetworkHandler({
|
|
13
13
|
config: opts.config,
|
|
14
14
|
createClient: (config) => new Magic(opts.apiKey, Object.assign(Object.assign({}, config), { extensions: [new OAuthExtension()] })),
|
|
15
|
+
defaultChainId: opts.defaultChainId,
|
|
15
16
|
evmNetworks: opts.evmNetworks,
|
|
16
17
|
});
|
|
17
18
|
}
|
|
@@ -6,6 +6,7 @@ var tslib = require('tslib');
|
|
|
6
6
|
var magicSdk = require('magic-sdk');
|
|
7
7
|
var ethers = require('ethers');
|
|
8
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
10
|
var errors = require('../../../../errors.cjs');
|
|
10
11
|
var logger = require('../../../../utils/logger.cjs');
|
|
11
12
|
var assignConfirmationScreenToProvider = require('../../../../utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs');
|
|
@@ -17,7 +18,7 @@ class MagicWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
17
18
|
get key() {
|
|
18
19
|
return 'magiclink';
|
|
19
20
|
}
|
|
20
|
-
constructor({ apiKey, walletUiUtils, evmNetworks, config, }) {
|
|
21
|
+
constructor({ apiKey, walletUiUtils, evmNetworks, config, defaultChainId, }) {
|
|
21
22
|
super();
|
|
22
23
|
this.canConnectViaCustodialService = true;
|
|
23
24
|
this.connectedChain = 'EVM';
|
|
@@ -26,9 +27,10 @@ class MagicWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
26
27
|
this._magicClient = new MagicClientNetworkHandler.MagicClientNetworkHandler({
|
|
27
28
|
config,
|
|
28
29
|
createClient: (config) => new magicSdk.Magic(apiKey, config),
|
|
30
|
+
defaultChainId,
|
|
29
31
|
evmNetworks,
|
|
30
32
|
});
|
|
31
|
-
this.evmNetworks = evmNetworks;
|
|
33
|
+
this.evmNetworks = utils.parseEvmNetworks(evmNetworks);
|
|
32
34
|
this._walletUiUtils = walletUiUtils;
|
|
33
35
|
}
|
|
34
36
|
getDeepLink() {
|
|
@@ -2,14 +2,15 @@ import { LoginWithMagicLinkEvents, Magic, MagicUserMetadata, PromiEvent } from '
|
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { OAuthExtension, OAuthProvider } from '@magic-ext/oauth';
|
|
4
4
|
import { Chain, WalletConnectorBase, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { EvmNetwork, GenericNetwork } from '@dynamic-labs/types';
|
|
5
6
|
import { WalletUiUtils } from '../../../../types';
|
|
6
7
|
import { CancellablePromise } from '../../../../utils/CancellablePromise';
|
|
7
8
|
import { MagicLinkConfig, MagicClientNetworkHandler } from '../MagicClientNetworkHandler';
|
|
8
|
-
import { EvmNetwork } from './../../evm-network';
|
|
9
9
|
export type MagicConnectorProps = {
|
|
10
10
|
apiKey: string;
|
|
11
11
|
config?: MagicLinkConfig;
|
|
12
|
-
|
|
12
|
+
defaultChainId?: number;
|
|
13
|
+
evmNetworks: GenericNetwork[];
|
|
13
14
|
walletUiUtils: WalletUiUtils;
|
|
14
15
|
};
|
|
15
16
|
export type MagicPromiEvent = PromiEvent<string | null, LoginWithMagicLinkEvents & {
|
|
@@ -28,7 +29,7 @@ export declare abstract class MagicWalletConnector extends WalletConnectorBase {
|
|
|
28
29
|
_listeners: WalletEventListeners | undefined;
|
|
29
30
|
_currentAuthCancellablePromise: CancellablePromise<MagicPromiEvent | undefined> | undefined;
|
|
30
31
|
protected _magicClient: MagicClientNetworkHandler<Magic | Magic<OAuthExtension[]>>;
|
|
31
|
-
constructor({ apiKey, walletUiUtils, evmNetworks, config, }: MagicConnectorProps);
|
|
32
|
+
constructor({ apiKey, walletUiUtils, evmNetworks, config, defaultChainId, }: MagicConnectorProps);
|
|
32
33
|
abstract loginWithMagic(provider?: OAuthProvider): Promise<MagicPromiEvent | undefined>;
|
|
33
34
|
getDeepLink(): string | undefined;
|
|
34
35
|
connect(provider?: OAuthProvider): Promise<void>;
|
|
@@ -2,6 +2,7 @@ import { __awaiter } from 'tslib';
|
|
|
2
2
|
import { Magic } from 'magic-sdk';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { parseEvmNetworks } from '@dynamic-labs/utils';
|
|
5
6
|
import { DynamicError } from '../../../../errors.js';
|
|
6
7
|
import { logger } from '../../../../utils/logger.js';
|
|
7
8
|
import { assignConfirmationScreenToProvider } from '../../../../utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js';
|
|
@@ -13,7 +14,7 @@ class MagicWalletConnector extends WalletConnectorBase {
|
|
|
13
14
|
get key() {
|
|
14
15
|
return 'magiclink';
|
|
15
16
|
}
|
|
16
|
-
constructor({ apiKey, walletUiUtils, evmNetworks, config, }) {
|
|
17
|
+
constructor({ apiKey, walletUiUtils, evmNetworks, config, defaultChainId, }) {
|
|
17
18
|
super();
|
|
18
19
|
this.canConnectViaCustodialService = true;
|
|
19
20
|
this.connectedChain = 'EVM';
|
|
@@ -22,9 +23,10 @@ class MagicWalletConnector extends WalletConnectorBase {
|
|
|
22
23
|
this._magicClient = new MagicClientNetworkHandler({
|
|
23
24
|
config,
|
|
24
25
|
createClient: (config) => new Magic(apiKey, config),
|
|
26
|
+
defaultChainId,
|
|
25
27
|
evmNetworks,
|
|
26
28
|
});
|
|
27
|
-
this.evmNetworks = evmNetworks;
|
|
29
|
+
this.evmNetworks = parseEvmNetworks(evmNetworks);
|
|
28
30
|
this._walletUiUtils = walletUiUtils;
|
|
29
31
|
}
|
|
30
32
|
getDeepLink() {
|
|
@@ -7,8 +7,9 @@ var ethProviderHelper = require('./ethProviderHelper.cjs');
|
|
|
7
7
|
var EthWalletConnector = require('./EthWalletConnector.cjs');
|
|
8
8
|
|
|
9
9
|
class Coinbase extends EthWalletConnector.EthWalletConnector {
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
10
|
+
constructor(_a) {
|
|
11
|
+
var { appName, appLogoUrl, evmNetworks } = _a, props = tslib.__rest(_a, ["appName", "appLogoUrl", "evmNetworks"]);
|
|
12
|
+
super(Object.assign({ evmNetworks }, props));
|
|
12
13
|
this.name = 'Coinbase';
|
|
13
14
|
this.supportedChains = ['EVM', 'ETH'];
|
|
14
15
|
this.connectedChain = 'EVM';
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import { Chain, FetchPublicAddressOpts, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { EthProviderHelper } from './ethProviderHelper';
|
|
4
|
-
import { EthWalletConnector } from './EthWalletConnector';
|
|
5
|
-
|
|
4
|
+
import { EthWalletConnector, EthWalletConnectorOpts } from './EthWalletConnector';
|
|
5
|
+
type CoinbaseOpts = EthWalletConnectorOpts & {
|
|
6
|
+
appLogoUrl?: string;
|
|
7
|
+
appName?: string;
|
|
8
|
+
};
|
|
6
9
|
declare class Coinbase extends EthWalletConnector {
|
|
7
10
|
name: string;
|
|
8
11
|
supportedChains: Chain[];
|
|
@@ -10,11 +13,7 @@ declare class Coinbase extends EthWalletConnector {
|
|
|
10
13
|
canConnectViaQrCode: boolean;
|
|
11
14
|
ethProviderHelper: EthProviderHelper;
|
|
12
15
|
private coinbaseProviderOpts;
|
|
13
|
-
constructor({ appName, appLogoUrl, evmNetworks, }:
|
|
14
|
-
appLogoUrl?: string;
|
|
15
|
-
appName?: string;
|
|
16
|
-
evmNetworks: EvmNetwork[];
|
|
17
|
-
});
|
|
16
|
+
constructor({ appName, appLogoUrl, evmNetworks, ...props }: CoinbaseOpts);
|
|
18
17
|
setupEventListeners(listeners: WalletEventListeners): () => void;
|
|
19
18
|
teardownEventListeners(): void;
|
|
20
19
|
getWeb3Provider(): ethers.providers.Web3Provider | undefined;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
1
|
+
import { __rest, __awaiter } from 'tslib';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { getCoinbaseProvider, fetchPublicAddress, signMessage, killCoinbaseSession } from '../clients/coinbase/coinbase.js';
|
|
4
4
|
import { EthProviderHelper } from './ethProviderHelper.js';
|
|
5
5
|
import { EthWalletConnector } from './EthWalletConnector.js';
|
|
6
6
|
|
|
7
7
|
class Coinbase extends EthWalletConnector {
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
8
|
+
constructor(_a) {
|
|
9
|
+
var { appName, appLogoUrl, evmNetworks } = _a, props = __rest(_a, ["appName", "appLogoUrl", "evmNetworks"]);
|
|
10
|
+
super(Object.assign({ evmNetworks }, props));
|
|
10
11
|
this.name = 'Coinbase';
|
|
11
12
|
this.supportedChains = ['EVM', 'ETH'];
|
|
12
13
|
this.connectedChain = 'EVM';
|
|
@@ -7,13 +7,13 @@ const findEvmNetwork = ({ chainId, name, networks, }) => {
|
|
|
7
7
|
return undefined;
|
|
8
8
|
}
|
|
9
9
|
if (chainId && name) {
|
|
10
|
-
return networks.find((network) => network.chainId === chainId && network.
|
|
10
|
+
return networks.find((network) => network.chainId === chainId && network.name === name);
|
|
11
11
|
}
|
|
12
12
|
else if (chainId) {
|
|
13
13
|
return networks.find((network) => network.chainId === chainId);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
return networks.find((network) => network.
|
|
16
|
+
return networks.find((network) => network.name === name);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
blockExplorerUrls?: string[];
|
|
3
|
-
chainId: number;
|
|
4
|
-
chainName: string;
|
|
5
|
-
iconUrls?: string[];
|
|
6
|
-
lcdUrl?: string;
|
|
7
|
-
nativeCurrency: {
|
|
8
|
-
decimals: number;
|
|
9
|
-
denom?: string;
|
|
10
|
-
name: string;
|
|
11
|
-
symbol: string;
|
|
12
|
-
};
|
|
13
|
-
networkId: number;
|
|
14
|
-
privateCustomerRpcUrls?: string[];
|
|
15
|
-
rpcUrls: string[];
|
|
16
|
-
vanityName?: string;
|
|
17
|
-
};
|
|
1
|
+
import { EvmNetwork } from '@dynamic-labs/types';
|
|
18
2
|
export declare const findEvmNetwork: ({ chainId, name, networks, }: {
|
|
19
3
|
chainId?: number | undefined;
|
|
20
4
|
name?: string | undefined;
|
|
@@ -3,13 +3,13 @@ const findEvmNetwork = ({ chainId, name, networks, }) => {
|
|
|
3
3
|
return undefined;
|
|
4
4
|
}
|
|
5
5
|
if (chainId && name) {
|
|
6
|
-
return networks.find((network) => network.chainId === chainId && network.
|
|
6
|
+
return networks.find((network) => network.chainId === chainId && network.name === name);
|
|
7
7
|
}
|
|
8
8
|
else if (chainId) {
|
|
9
9
|
return networks.find((network) => network.chainId === chainId);
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
|
-
return networks.find((network) => network.
|
|
12
|
+
return networks.find((network) => network.name === name);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -13,8 +13,9 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
var FortmaticClient__default = /*#__PURE__*/_interopDefaultLegacy(FortmaticClient);
|
|
14
14
|
|
|
15
15
|
class Fortmatic extends EthWalletConnector.EthWalletConnector {
|
|
16
|
-
constructor(
|
|
17
|
-
|
|
16
|
+
constructor(_a) {
|
|
17
|
+
var { apiKey } = _a, props = tslib.__rest(_a, ["apiKey"]);
|
|
18
|
+
super(props);
|
|
18
19
|
this.name = 'Fortmatic';
|
|
19
20
|
this.supportedChains = ['ETH', 'EVM'];
|
|
20
21
|
this.connectedChain = 'EVM';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import { Chain } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { EthProviderHelper } from './ethProviderHelper';
|
|
4
|
-
import { EthWalletConnector } from './EthWalletConnector';
|
|
5
|
-
|
|
4
|
+
import { EthWalletConnector, EthWalletConnectorOpts } from './EthWalletConnector';
|
|
5
|
+
type FortmaticOpts = EthWalletConnectorOpts & {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
};
|
|
6
8
|
declare class Fortmatic extends EthWalletConnector {
|
|
7
9
|
name: string;
|
|
8
10
|
supportedChains: Chain[];
|
|
@@ -11,10 +13,7 @@ declare class Fortmatic extends EthWalletConnector {
|
|
|
11
13
|
ethProviderHelper: EthProviderHelper;
|
|
12
14
|
publicAddress: string | undefined;
|
|
13
15
|
private apiKey;
|
|
14
|
-
constructor({
|
|
15
|
-
apiKey: string;
|
|
16
|
-
evmNetworks: EvmNetwork[];
|
|
17
|
-
});
|
|
16
|
+
constructor({ apiKey, ...props }: FortmaticOpts);
|
|
18
17
|
getFortmaticProvider(): import("fortmatic/dist/cjs/src/core/fm-provider").FmProvider;
|
|
19
18
|
getWeb3Provider(): ethers.providers.Web3Provider;
|
|
20
19
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
1
|
+
import { __rest, __awaiter } from 'tslib';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import FortmaticClient from 'fortmatic';
|
|
4
4
|
import { DynamicError } from '../../errors.js';
|
|
@@ -7,8 +7,9 @@ import { EthProviderHelper } from './ethProviderHelper.js';
|
|
|
7
7
|
import { EthWalletConnector } from './EthWalletConnector.js';
|
|
8
8
|
|
|
9
9
|
class Fortmatic extends EthWalletConnector {
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
10
|
+
constructor(_a) {
|
|
11
|
+
var { apiKey } = _a, props = __rest(_a, ["apiKey"]);
|
|
12
|
+
super(props);
|
|
12
13
|
this.name = 'Fortmatic';
|
|
13
14
|
this.supportedChains = ['ETH', 'EVM'];
|
|
14
15
|
this.connectedChain = 'EVM';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import { Chain, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { EvmNetwork } from '@dynamic-labs/types';
|
|
3
4
|
import { EthProviderHelper } from './ethProviderHelper';
|
|
4
5
|
import { EthWalletConnector } from './EthWalletConnector';
|
|
5
|
-
import { EvmNetwork } from './evm-network';
|
|
6
6
|
declare class MetaMask extends EthWalletConnector {
|
|
7
7
|
name: string;
|
|
8
8
|
supportedChains: Chain[];
|
|
@@ -2,24 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var tslib = require('tslib');
|
|
5
6
|
var walletConnect = require('./walletConnect/walletConnect.cjs');
|
|
6
7
|
var walletConnectV2 = require('./walletConnect/walletConnectV2.cjs');
|
|
7
8
|
|
|
8
|
-
const getMobileOrInjectedWallet = (
|
|
9
|
+
const getMobileOrInjectedWallet = (_a) => {
|
|
10
|
+
var { injectedWallet, isWalletConnectV2 = false } = _a, props = tslib.__rest(_a, ["injectedWallet", "isWalletConnectV2"]);
|
|
9
11
|
if (injectedWallet.isInstalledOnBrowser()) {
|
|
10
12
|
return injectedWallet;
|
|
11
13
|
}
|
|
12
14
|
else if (isWalletConnectV2) {
|
|
13
|
-
return new walletConnectV2(
|
|
14
|
-
evmNetworks,
|
|
15
|
-
walletName: walletConnectName,
|
|
16
|
-
});
|
|
15
|
+
return new walletConnectV2(props);
|
|
17
16
|
}
|
|
18
17
|
else {
|
|
19
|
-
return new walletConnect(
|
|
20
|
-
evmNetworks,
|
|
21
|
-
walletName: walletConnectName,
|
|
22
|
-
});
|
|
18
|
+
return new walletConnect(props);
|
|
23
19
|
}
|
|
24
20
|
};
|
|
25
21
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
import {
|
|
3
|
-
export declare const getMobileOrInjectedWallet: ({
|
|
4
|
-
|
|
2
|
+
import { WalletConnectorV2Opts } from './walletConnect/walletConnectV2';
|
|
3
|
+
export declare const getMobileOrInjectedWallet: ({ injectedWallet, isWalletConnectV2, ...props }: import("./ethereum/EthWalletConnector").EthWalletConnectorOpts & {
|
|
4
|
+
projectId?: string | undefined;
|
|
5
|
+
walletName: string;
|
|
6
|
+
} & {
|
|
5
7
|
injectedWallet: WalletConnector;
|
|
6
8
|
isWalletConnectV2?: boolean | undefined;
|
|
7
|
-
walletConnectName: string;
|
|
8
9
|
}) => WalletConnector;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
1
2
|
import WalletConnect from './walletConnect/walletConnect.js';
|
|
2
3
|
import WalletConnectV2 from './walletConnect/walletConnectV2.js';
|
|
3
4
|
|
|
4
|
-
const getMobileOrInjectedWallet = (
|
|
5
|
+
const getMobileOrInjectedWallet = (_a) => {
|
|
6
|
+
var { injectedWallet, isWalletConnectV2 = false } = _a, props = __rest(_a, ["injectedWallet", "isWalletConnectV2"]);
|
|
5
7
|
if (injectedWallet.isInstalledOnBrowser()) {
|
|
6
8
|
return injectedWallet;
|
|
7
9
|
}
|
|
8
10
|
else if (isWalletConnectV2) {
|
|
9
|
-
return new WalletConnectV2(
|
|
10
|
-
evmNetworks,
|
|
11
|
-
walletName: walletConnectName,
|
|
12
|
-
});
|
|
11
|
+
return new WalletConnectV2(props);
|
|
13
12
|
}
|
|
14
13
|
else {
|
|
15
|
-
return new WalletConnect(
|
|
16
|
-
evmNetworks,
|
|
17
|
-
walletName: walletConnectName,
|
|
18
|
-
});
|
|
14
|
+
return new WalletConnect(props);
|
|
19
15
|
}
|
|
20
16
|
};
|
|
21
17
|
|
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var tslib = require('tslib');
|
|
5
6
|
var walletConnect = require('./walletConnect/walletConnect.cjs');
|
|
6
7
|
var walletConnectV2 = require('./walletConnect/walletConnectV2.cjs');
|
|
7
8
|
|
|
8
|
-
const getWalletConnectConnector = (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
walletName: 'WalletConnect'
|
|
13
|
-
|
|
14
|
-
: new walletConnect({
|
|
15
|
-
evmNetworks,
|
|
16
|
-
walletName: 'WalletConnect',
|
|
17
|
-
});
|
|
9
|
+
const getWalletConnectConnector = (_a) => {
|
|
10
|
+
var { isWalletConnectV2Enabled } = _a, props = tslib.__rest(_a, ["isWalletConnectV2Enabled"]);
|
|
11
|
+
return isWalletConnectV2Enabled
|
|
12
|
+
? new walletConnectV2(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }))
|
|
13
|
+
: new walletConnect(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
14
|
+
};
|
|
18
15
|
|
|
19
16
|
exports.getWalletConnectConnector = getWalletConnectConnector;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { EvmNetwork } from './ethereum/evm-network';
|
|
2
1
|
import WalletConnect from './walletConnect';
|
|
3
|
-
import WalletConnectV2 from './walletConnect/walletConnectV2';
|
|
4
|
-
export declare const getWalletConnectConnector: ({
|
|
5
|
-
evmNetworks: EvmNetwork[];
|
|
2
|
+
import WalletConnectV2, { WalletConnectorV2Opts } from './walletConnect/walletConnectV2';
|
|
3
|
+
export declare const getWalletConnectConnector: ({ isWalletConnectV2Enabled, ...props }: Omit<WalletConnectorV2Opts, "walletName"> & {
|
|
6
4
|
isWalletConnectV2Enabled: boolean;
|
|
7
|
-
projectId?: string | undefined;
|
|
8
5
|
}) => WalletConnectV2 | WalletConnect;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
1
2
|
import WalletConnect from './walletConnect/walletConnect.js';
|
|
2
3
|
import WalletConnectV2 from './walletConnect/walletConnectV2.js';
|
|
3
4
|
|
|
4
|
-
const getWalletConnectConnector = (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
walletName: 'WalletConnect'
|
|
9
|
-
|
|
10
|
-
: new WalletConnect({
|
|
11
|
-
evmNetworks,
|
|
12
|
-
walletName: 'WalletConnect',
|
|
13
|
-
});
|
|
5
|
+
const getWalletConnectConnector = (_a) => {
|
|
6
|
+
var { isWalletConnectV2Enabled } = _a, props = __rest(_a, ["isWalletConnectV2Enabled"]);
|
|
7
|
+
return isWalletConnectV2Enabled
|
|
8
|
+
? new WalletConnectV2(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }))
|
|
9
|
+
: new WalletConnect(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
10
|
+
};
|
|
14
11
|
|
|
15
12
|
export { getWalletConnectConnector };
|
|
@@ -5,15 +5,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var web3_js = require('@solana/web3.js');
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
|
-
var rpcProviders = require('
|
|
8
|
+
var rpcProviders = require('@dynamic-labs/rpc-providers');
|
|
9
9
|
var errors = require('../../errors.cjs');
|
|
10
10
|
|
|
11
11
|
class SolWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
12
|
-
constructor({ solNetworks }) {
|
|
12
|
+
constructor({ solNetworks, chainRpcProviders }) {
|
|
13
|
+
var _a;
|
|
13
14
|
super();
|
|
14
15
|
this.supportedChains = ['SOL'];
|
|
15
16
|
this.connectedChain = 'SOL';
|
|
16
17
|
this.solNetworks = solNetworks;
|
|
18
|
+
this.chainRpcProviders = chainRpcProviders;
|
|
19
|
+
(_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerChainProviders(rpcProviders.ProviderChain.SOLANA, (config) => {
|
|
20
|
+
const rpcProviders = {};
|
|
21
|
+
if (config === null || config === void 0 ? void 0 : config.solana) {
|
|
22
|
+
rpcProviders.solana = config.solana.map((network) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
|
|
25
|
+
const provider = new web3_js.Connection(rpcUrl);
|
|
26
|
+
return {
|
|
27
|
+
chainId: network.chainId.toString(),
|
|
28
|
+
chainName: network.name,
|
|
29
|
+
provider,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return rpcProviders.solana;
|
|
34
|
+
});
|
|
17
35
|
}
|
|
18
36
|
getWeb3Provider() {
|
|
19
37
|
var _a;
|
|
@@ -25,7 +43,7 @@ class SolWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
25
43
|
return new web3_js.Connection(rpcUrl, 'confirmed');
|
|
26
44
|
}
|
|
27
45
|
getRpcProvider() {
|
|
28
|
-
var _a;
|
|
46
|
+
var _a, _b;
|
|
29
47
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
30
48
|
if (this.solNetworks.length === 0)
|
|
31
49
|
return;
|
|
@@ -35,7 +53,7 @@ class SolWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
35
53
|
solana: this.solNetworks,
|
|
36
54
|
starknet: undefined,
|
|
37
55
|
};
|
|
38
|
-
return (_a =
|
|
56
|
+
return (_b = (_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.getSolanaRpcProviderByChainId(configurations, '101')) === null || _b === void 0 ? void 0 : _b.provider;
|
|
39
57
|
});
|
|
40
58
|
}
|
|
41
59
|
getBalance() {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Connection } from '@solana/web3.js';
|
|
2
|
-
import type { NetworkConfiguration } from '@dynamic-labs/sdk-api';
|
|
3
2
|
import { Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { GenericNetwork } from '@dynamic-labs/types';
|
|
4
|
+
import { ChainRpcProviders } from '@dynamic-labs/rpc-providers';
|
|
4
5
|
import { ISolana } from '../window';
|
|
6
|
+
export type SolWalletConnectorOpts = {
|
|
7
|
+
chainRpcProviders: typeof ChainRpcProviders;
|
|
8
|
+
solNetworks: GenericNetwork[];
|
|
9
|
+
};
|
|
5
10
|
export declare abstract class SolWalletConnector extends WalletConnectorBase {
|
|
6
|
-
solNetworks:
|
|
11
|
+
solNetworks: GenericNetwork[];
|
|
7
12
|
supportedChains: Chain[];
|
|
8
13
|
connectedChain: Chain;
|
|
9
|
-
constructor({ solNetworks }:
|
|
10
|
-
solNetworks: NetworkConfiguration[];
|
|
11
|
-
});
|
|
14
|
+
constructor({ solNetworks, chainRpcProviders }: SolWalletConnectorOpts);
|
|
12
15
|
getWeb3Provider(): Connection;
|
|
13
16
|
getRpcProvider(): Promise<Connection | undefined>;
|
|
14
17
|
abstract getSigner(): Promise<ISolana | undefined>;
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import {
|
|
4
|
+
import { ProviderChain } from '@dynamic-labs/rpc-providers';
|
|
5
5
|
import { DynamicError } from '../../errors.js';
|
|
6
6
|
|
|
7
7
|
class SolWalletConnector extends WalletConnectorBase {
|
|
8
|
-
constructor({ solNetworks }) {
|
|
8
|
+
constructor({ solNetworks, chainRpcProviders }) {
|
|
9
|
+
var _a;
|
|
9
10
|
super();
|
|
10
11
|
this.supportedChains = ['SOL'];
|
|
11
12
|
this.connectedChain = 'SOL';
|
|
12
13
|
this.solNetworks = solNetworks;
|
|
14
|
+
this.chainRpcProviders = chainRpcProviders;
|
|
15
|
+
(_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerChainProviders(ProviderChain.SOLANA, (config) => {
|
|
16
|
+
const rpcProviders = {};
|
|
17
|
+
if (config === null || config === void 0 ? void 0 : config.solana) {
|
|
18
|
+
rpcProviders.solana = config.solana.map((network) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
|
|
21
|
+
const provider = new Connection(rpcUrl);
|
|
22
|
+
return {
|
|
23
|
+
chainId: network.chainId.toString(),
|
|
24
|
+
chainName: network.name,
|
|
25
|
+
provider,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return rpcProviders.solana;
|
|
30
|
+
});
|
|
13
31
|
}
|
|
14
32
|
getWeb3Provider() {
|
|
15
33
|
var _a;
|
|
@@ -21,7 +39,7 @@ class SolWalletConnector extends WalletConnectorBase {
|
|
|
21
39
|
return new Connection(rpcUrl, 'confirmed');
|
|
22
40
|
}
|
|
23
41
|
getRpcProvider() {
|
|
24
|
-
var _a;
|
|
42
|
+
var _a, _b;
|
|
25
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
44
|
if (this.solNetworks.length === 0)
|
|
27
45
|
return;
|
|
@@ -31,7 +49,7 @@ class SolWalletConnector extends WalletConnectorBase {
|
|
|
31
49
|
solana: this.solNetworks,
|
|
32
50
|
starknet: undefined,
|
|
33
51
|
};
|
|
34
|
-
return (_a =
|
|
52
|
+
return (_b = (_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.getSolanaRpcProviderByChainId(configurations, '101')) === null || _b === void 0 ? void 0 : _b.provider;
|
|
35
53
|
});
|
|
36
54
|
}
|
|
37
55
|
getBalance() {
|