@broxus/evm-connect 1.10.1 → 1.10.3
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.
|
@@ -40,10 +40,10 @@ const React = __importStar(require("react"));
|
|
|
40
40
|
const EvmConnectDialog_1 = require("../../components/EvmConnectDialog");
|
|
41
41
|
const context_1 = require("../../context");
|
|
42
42
|
const utils_1 = require("../../utils");
|
|
43
|
-
exports.EvmConnectButton = (0, mobx_react_lite_1.observer)(({ children,
|
|
43
|
+
exports.EvmConnectButton = (0, mobx_react_lite_1.observer)(({ children, disabled, network, popupClassName, popupType, type = 'primary', onClose, onConnect, onOpen, ...props }) => {
|
|
44
44
|
const walletService = (0, context_1.useEvmWalletService)();
|
|
45
45
|
const walletProviders = React.useContext(context_1.EvmWalletProvidersContext);
|
|
46
|
-
const { standalone = walletService.providers?.length === 1 } = props;
|
|
46
|
+
const { standalone = walletService.providers?.length === 1, ...restProps } = props;
|
|
47
47
|
const [isModalShown, setModalVisibility] = React.useState(false);
|
|
48
48
|
const connect = React.useCallback(async () => {
|
|
49
49
|
setModalVisibility(false);
|
|
@@ -61,7 +61,9 @@ exports.EvmConnectButton = (0, mobx_react_lite_1.observer)(({ children, classNam
|
|
|
61
61
|
onOpen?.();
|
|
62
62
|
}, [onOpen]);
|
|
63
63
|
return (React.createElement(React.Fragment, null,
|
|
64
|
-
React.createElement(react_uikit_1.Button, { "aria-disabled": walletService.isInitializing || walletService.isConnecting, disabled: disabled === undefined
|
|
64
|
+
React.createElement(react_uikit_1.Button, { "aria-disabled": walletService.isInitializing || walletService.isConnecting, disabled: disabled === undefined
|
|
65
|
+
? walletService.isInitializing || walletService.isConnecting
|
|
66
|
+
: disabled, type: type, ...restProps, onClick: standalone ? connect : open }, children),
|
|
65
67
|
!standalone && (React.createElement(context_1.EvmWalletProvidersProvider, { agreementsNote: walletProviders?.agreementsNote, network: network, onConnect: close },
|
|
66
68
|
React.createElement(EvmConnectDialog_1.EvmConnectDialog, { className: popupClassName, open: isModalShown, type: popupType, onClose: close })))));
|
|
67
69
|
});
|
|
@@ -18,6 +18,6 @@ export type EvmConnectButtonProps = React.PropsWithChildren<{
|
|
|
18
18
|
onConnect?: (walletService?: EvmWalletService) => Promise<void> | void;
|
|
19
19
|
onOpen?: VoidFunction;
|
|
20
20
|
}>;
|
|
21
|
-
export declare const EvmConnectButton: (({ children,
|
|
21
|
+
export declare const EvmConnectButton: (({ children, disabled, network, popupClassName, popupType, type, onClose, onConnect, onOpen, ...props }: EvmConnectButtonProps) => React.JSX.Element) & {
|
|
22
22
|
displayName: string;
|
|
23
23
|
};
|
|
@@ -4,10 +4,10 @@ import * as React from 'react';
|
|
|
4
4
|
import { EvmConnectDialog } from '../../components/EvmConnectDialog';
|
|
5
5
|
import { EvmWalletProvidersContext, EvmWalletProvidersProvider, useEvmWalletService } from '../../context';
|
|
6
6
|
import { convertNetworkToChainParams } from '../../utils';
|
|
7
|
-
export const EvmConnectButton = observer(({ children,
|
|
7
|
+
export const EvmConnectButton = observer(({ children, disabled, network, popupClassName, popupType, type = 'primary', onClose, onConnect, onOpen, ...props }) => {
|
|
8
8
|
const walletService = useEvmWalletService();
|
|
9
9
|
const walletProviders = React.useContext(EvmWalletProvidersContext);
|
|
10
|
-
const { standalone = walletService.providers?.length === 1 } = props;
|
|
10
|
+
const { standalone = walletService.providers?.length === 1, ...restProps } = props;
|
|
11
11
|
const [isModalShown, setModalVisibility] = React.useState(false);
|
|
12
12
|
const connect = React.useCallback(async () => {
|
|
13
13
|
setModalVisibility(false);
|
|
@@ -25,7 +25,9 @@ export const EvmConnectButton = observer(({ children, className, disabled, netwo
|
|
|
25
25
|
onOpen?.();
|
|
26
26
|
}, [onOpen]);
|
|
27
27
|
return (React.createElement(React.Fragment, null,
|
|
28
|
-
React.createElement(Button, { "aria-disabled": walletService.isInitializing || walletService.isConnecting, disabled: disabled === undefined
|
|
28
|
+
React.createElement(Button, { "aria-disabled": walletService.isInitializing || walletService.isConnecting, disabled: disabled === undefined
|
|
29
|
+
? walletService.isInitializing || walletService.isConnecting
|
|
30
|
+
: disabled, type: type, ...restProps, onClick: standalone ? connect : open }, children),
|
|
29
31
|
!standalone && (React.createElement(EvmWalletProvidersProvider, { agreementsNote: walletProviders?.agreementsNote, network: network, onConnect: close },
|
|
30
32
|
React.createElement(EvmConnectDialog, { className: popupClassName, open: isModalShown, type: popupType, onClose: close })))));
|
|
31
33
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@broxus/evm-connect",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "Ethereum wallets connector.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"prepare": "npx yarn cleanup && npx yarn build"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@broxus/js-core": "^0.
|
|
78
|
+
"@broxus/js-core": "^0.24.0",
|
|
79
79
|
"@broxus/js-utils": "^1.3.12",
|
|
80
|
-
"@broxus/react-components": "^0.20.
|
|
81
|
-
"@broxus/react-uikit": "^0.
|
|
80
|
+
"@broxus/react-components": "^0.20.3",
|
|
81
|
+
"@broxus/react-uikit": "^0.17.0",
|
|
82
82
|
"@metamask/detect-provider": "^2.0.0",
|
|
83
83
|
"@walletconnect/ethereum-provider": "^2.17.2",
|
|
84
84
|
"classnames": "^2.5.1"
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"web3-types": "^1.x",
|
|
96
96
|
"web3-utils": "^4.x"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "31bf04383be62ca53895b5c3e7f0240634dfc01a"
|
|
99
99
|
}
|