@broxus/evm-connect 1.13.6 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +453 -0
- package/dist/index.d.ts +453 -0
- package/dist/index.js +4954 -0
- package/dist/index.mjs +4954 -0
- package/dist/inheritance.min.css +3 -0
- package/dist/react.d.mts +116 -0
- package/dist/react.d.ts +116 -0
- package/dist/react.js +4860 -0
- package/dist/react.mjs +4860 -0
- package/dist/sdk.d.mts +346 -0
- package/dist/sdk.d.ts +346 -0
- package/dist/sdk.js +4860 -0
- package/dist/sdk.mjs +4860 -0
- package/dist/standalone.min.css +1 -0
- package/dist/uikit.min.css +1 -1
- package/lib/cjs/_react.js +25 -0
- package/lib/cjs/_sdk.js +22 -0
- package/lib/cjs/components/{EvmConnectButton/index.js → EvmConnectButton.js} +4 -4
- package/lib/cjs/components/{EvmConnectDialog/index.js → EvmConnectDialog.js} +13 -7
- package/lib/cjs/components/EvmConnectionRequest.js +80 -0
- package/lib/cjs/components/{EvmConnector/index.js → EvmConnector.js} +4 -5
- package/lib/cjs/components/{EvmProvidersDispatcher/ProviderButton/index.js → EvmProviderButton.js} +8 -9
- package/lib/cjs/components/{EvmProvidersDispatcher/index.js → EvmProvidersDispatcher.js} +24 -16
- package/lib/cjs/components/EvmProvidersList.js +49 -0
- package/lib/cjs/context/EvmWalletProvidersContext.js +4 -5
- package/lib/cjs/context/EvmWalletServiceContext.js +4 -4
- package/lib/cjs/hooks/index.js +1 -0
- package/lib/cjs/hooks/useContext.js +44 -0
- package/lib/cjs/hooks/useRecentConnectionMeta.js +7 -35
- package/lib/cjs/intl/index.js +1 -1
- package/lib/cjs/services/EvmWalletService.js +1 -1
- package/lib/cjs/styles/inheritance.css +71 -0
- package/lib/cjs/styles/inheritance.js +4 -0
- package/lib/cjs/styles/standalone.css +68 -0
- package/lib/cjs/styles/standalone.js +4 -0
- package/lib/cjs/styles/style.css +538 -0
- package/lib/cjs/styles/uikit.js +3 -0
- package/lib/cjs/utils/index.js +2 -1
- package/lib/cjs/utils/recent-connection-meta.js +37 -0
- package/lib/cjs/utils/{convert-network-to-chain-params.js → to-chain-params.js} +2 -2
- package/lib/esm/_react.d.ts +9 -0
- package/lib/esm/_react.js +9 -0
- package/lib/esm/_sdk.d.ts +6 -0
- package/lib/esm/_sdk.js +6 -0
- package/lib/esm/components/{EvmConnectButton/index.d.ts → EvmConnectButton.d.ts} +3 -3
- package/lib/esm/components/{EvmConnectButton/index.js → EvmConnectButton.js} +4 -4
- package/lib/esm/components/{EvmConnectDialog/index.d.ts → EvmConnectDialog.d.ts} +0 -1
- package/lib/esm/components/{EvmConnectDialog/index.js → EvmConnectDialog.js} +13 -7
- package/lib/esm/components/EvmConnectionRequest.d.ts +4 -0
- package/lib/esm/components/EvmConnectionRequest.js +41 -0
- package/lib/esm/components/{EvmConnector/index.d.ts → EvmConnector.d.ts} +1 -2
- package/lib/esm/components/{EvmConnector/index.js → EvmConnector.js} +4 -5
- package/lib/esm/components/EvmProviderButton.d.ts +10 -0
- package/lib/esm/components/{EvmProvidersDispatcher/ProviderButton/index.js → EvmProviderButton.js} +7 -8
- package/lib/esm/components/{EvmProvidersDispatcher/index.d.ts → EvmProvidersDispatcher.d.ts} +0 -1
- package/lib/esm/components/EvmProvidersDispatcher.js +40 -0
- package/lib/esm/components/EvmProvidersList.d.ts +4 -0
- package/lib/esm/components/EvmProvidersList.js +13 -0
- package/lib/esm/connectors/EIP6963Connector.d.ts +1 -2
- package/lib/esm/connectors/MetaMask.d.ts +1 -1
- package/lib/esm/context/EvmWalletProvidersContext.js +3 -4
- package/lib/esm/context/EvmWalletServiceContext.js +2 -2
- package/lib/esm/core/EthereumConnector.d.ts +1 -1
- package/lib/esm/hooks/index.d.ts +1 -0
- package/lib/esm/hooks/index.js +1 -0
- package/lib/esm/hooks/useContext.d.ts +2 -0
- package/lib/esm/hooks/useContext.js +8 -0
- package/lib/esm/hooks/useEIP6963Connections.d.ts +1 -1
- package/lib/esm/hooks/useOrderedConnections.d.ts +1 -2
- package/lib/esm/hooks/useRecentConnectionMeta.d.ts +1 -9
- package/lib/esm/hooks/useRecentConnectionMeta.js +5 -31
- package/lib/esm/intl/index.d.ts +115 -0
- package/lib/esm/intl/index.js +1 -1
- package/lib/esm/services/EvmWalletService.js +2 -2
- package/lib/esm/styles/inheritance.css +71 -0
- package/lib/esm/styles/inheritance.d.ts +2 -0
- package/lib/esm/styles/inheritance.js +2 -0
- package/lib/esm/styles/standalone.css +68 -0
- package/lib/esm/styles/standalone.d.ts +2 -0
- package/lib/esm/styles/standalone.js +2 -0
- package/lib/esm/styles/style.css +538 -0
- package/lib/esm/styles/uikit.js +1 -0
- package/lib/esm/types.d.ts +7 -1
- package/lib/esm/utils/index.d.ts +2 -1
- package/lib/esm/utils/index.js +2 -1
- package/lib/esm/utils/recent-connection-meta.d.ts +4 -0
- package/lib/esm/utils/recent-connection-meta.js +32 -0
- package/lib/esm/utils/to-chain-params.d.ts +2 -0
- package/lib/esm/utils/{convert-network-to-chain-params.js → to-chain-params.js} +1 -1
- package/package.json +52 -29
- package/dist/index.cjs.js +0 -2
- package/dist/index.esm.js +0 -2
- package/dist/style.min.css +0 -1
- package/lib/cjs/components/EvmConnectDialog/index.css +0 -142
- package/lib/cjs/components/EvmConnector/index.css +0 -46
- package/lib/cjs/components/EvmProvidersDispatcher/ConnectionRequest/index.css +0 -44
- package/lib/cjs/components/EvmProvidersDispatcher/ConnectionRequest/index.js +0 -75
- package/lib/cjs/components/EvmProvidersDispatcher/ProviderButton/index.css +0 -54
- package/lib/cjs/components/EvmProvidersDispatcher/index.css +0 -13
- package/lib/esm/components/EvmConnectDialog/index.css +0 -142
- package/lib/esm/components/EvmConnector/index.css +0 -46
- package/lib/esm/components/EvmProvidersDispatcher/ConnectionRequest/index.css +0 -44
- package/lib/esm/components/EvmProvidersDispatcher/ConnectionRequest/index.d.ts +0 -5
- package/lib/esm/components/EvmProvidersDispatcher/ConnectionRequest/index.js +0 -36
- package/lib/esm/components/EvmProvidersDispatcher/ProviderButton/index.css +0 -54
- package/lib/esm/components/EvmProvidersDispatcher/ProviderButton/index.d.ts +0 -11
- package/lib/esm/components/EvmProvidersDispatcher/index.css +0 -13
- package/lib/esm/components/EvmProvidersDispatcher/index.js +0 -32
- package/lib/esm/utils/convert-network-to-chain-params.d.ts +0 -2
- /package/lib/esm/{uikit.d.ts → styles/uikit.d.ts} +0 -0
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type NetworkConfigBase } from '@broxus/js-core';
|
|
2
|
-
import { type EIP1193Provider, type MetaMaskProvider, type Web3APISpec, type Web3BaseProvider, type Web3EthExecutionAPI } from 'web3
|
|
2
|
+
import { type EIP1193Provider, type MetaMaskProvider, type Web3APISpec, type Web3BaseProvider, type Web3EthExecutionAPI } from 'web3';
|
|
3
3
|
import { type EthereumConnector } from './core';
|
|
4
4
|
type EvmBasedNetwork = 'evm';
|
|
5
5
|
export interface EvmNetworkConfig extends NetworkConfigBase<string> {
|
|
@@ -35,6 +35,12 @@ export interface AddEthereumChainParams {
|
|
|
35
35
|
};
|
|
36
36
|
rpcUrls: string[];
|
|
37
37
|
}
|
|
38
|
+
export interface RecentConnectionMeta {
|
|
39
|
+
chainId?: string;
|
|
40
|
+
disconnected?: boolean;
|
|
41
|
+
providerId: string;
|
|
42
|
+
type?: EthereumConnectionType;
|
|
43
|
+
}
|
|
38
44
|
export type EvmProviderAvailablePlatforms = 'ios' | 'android' | 'chromeExtension' | 'firefoxExtension';
|
|
39
45
|
export type EvmProviderPlatformLinks = Partial<Record<EvmProviderAvailablePlatforms, string>>;
|
|
40
46
|
export interface EvmWalletProviderConfig {
|
package/lib/esm/utils/index.d.ts
CHANGED
package/lib/esm/utils/index.js
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RecentConnectionMeta } from '../types';
|
|
2
|
+
export declare function isRecentConnectionMeta(value: any): value is RecentConnectionMeta;
|
|
3
|
+
export declare function storeRecentConnectionMeta(meta: RecentConnectionMeta | undefined, storageKey?: string): void;
|
|
4
|
+
export declare function getRecentConnectionMeta(storageKey?: string): RecentConnectionMeta | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { debug, storage } from '@broxus/js-utils';
|
|
2
|
+
import { EVM_RECENT_CONNECTION } from '../constants';
|
|
3
|
+
import { EthereumConnectionType } from '../types';
|
|
4
|
+
export function isRecentConnectionMeta(value) {
|
|
5
|
+
const meta = { providerId: value.providerId, type: value.type };
|
|
6
|
+
return Boolean(meta.type && EthereumConnectionType[meta.type] && !!meta.providerId);
|
|
7
|
+
}
|
|
8
|
+
export function storeRecentConnectionMeta(meta, storageKey = EVM_RECENT_CONNECTION) {
|
|
9
|
+
if (!meta) {
|
|
10
|
+
storage.remove(storageKey);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
debug('Store EVM recent connection', meta);
|
|
14
|
+
storage.set(storageKey, JSON.stringify(meta));
|
|
15
|
+
}
|
|
16
|
+
export function getRecentConnectionMeta(storageKey = EVM_RECENT_CONNECTION) {
|
|
17
|
+
const value = storage.get(storageKey);
|
|
18
|
+
if (!value) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const json = JSON.parse(value);
|
|
23
|
+
if (isRecentConnectionMeta(json)) {
|
|
24
|
+
return json;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
debug(e);
|
|
29
|
+
}
|
|
30
|
+
storeRecentConnectionMeta(undefined, storageKey);
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@broxus/evm-connect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Ethereum wallets connector.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -21,16 +21,31 @@
|
|
|
21
21
|
},
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"node": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.js",
|
|
27
|
+
"import": "./dist/index.mjs"
|
|
27
28
|
},
|
|
28
29
|
"./lib": {
|
|
29
|
-
"
|
|
30
|
+
"types": "./lib/esm/index.d.ts",
|
|
31
|
+
"node": "./lib/cjs/index.js",
|
|
30
32
|
"require": "./lib/cjs/index.js",
|
|
31
|
-
"
|
|
33
|
+
"import": "./lib/esm/index.js"
|
|
32
34
|
},
|
|
33
|
-
"./
|
|
35
|
+
"./sdk": {
|
|
36
|
+
"types": "./dist/sdk.d.ts",
|
|
37
|
+
"node": "./dist/sdk.js",
|
|
38
|
+
"require": "./dist/sdk.js",
|
|
39
|
+
"import": "./dist/sdk.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./react": {
|
|
42
|
+
"types": "./dist/react.d.ts",
|
|
43
|
+
"node": "./dist/react.js",
|
|
44
|
+
"require": "./dist/react.js",
|
|
45
|
+
"import": "./dist/react.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./inheritance.min.css": "./dist/inheritance.min.css",
|
|
48
|
+
"./standalone.min.css": "./dist/standalone.min.css",
|
|
34
49
|
"./uikit.min.css": "./dist/uikit.min.css",
|
|
35
50
|
"./package.json": "./package.json"
|
|
36
51
|
},
|
|
@@ -40,13 +55,19 @@
|
|
|
40
55
|
"LICENSE",
|
|
41
56
|
"README.md"
|
|
42
57
|
],
|
|
43
|
-
"main": "./dist/index.
|
|
44
|
-
"module": "./dist/index.
|
|
45
|
-
"types": "./
|
|
58
|
+
"main": "./dist/index.js",
|
|
59
|
+
"module": "./dist/index.mjs",
|
|
60
|
+
"types": "./dist/index.d.ts",
|
|
46
61
|
"typesVersions": {
|
|
47
62
|
"*": {
|
|
48
63
|
"lib": [
|
|
49
64
|
"./lib/esm/index.d.ts"
|
|
65
|
+
],
|
|
66
|
+
"react": [
|
|
67
|
+
"./dist/react.d.ts"
|
|
68
|
+
],
|
|
69
|
+
"sdk": [
|
|
70
|
+
"./dist/sdk.d.ts"
|
|
50
71
|
]
|
|
51
72
|
}
|
|
52
73
|
},
|
|
@@ -59,11 +80,11 @@
|
|
|
59
80
|
"npm": ">=8"
|
|
60
81
|
},
|
|
61
82
|
"scripts": {
|
|
62
|
-
"build": "npx yarn build:
|
|
83
|
+
"build": "npx yarn build:dist && npx yarn build:lib",
|
|
84
|
+
"build:dist": "npx tsup && npx rollup -c --bundleConfigAsCjs",
|
|
63
85
|
"build:lib": "(npx yarn build:cjs & npx yarn build:esm) && npx yarn styles:copy",
|
|
64
86
|
"build:cjs": "tsc -p tsconfig.cjs.json && tsc-alias -p tsconfig.cjs.json",
|
|
65
87
|
"build:esm": "tsc -p tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
|
|
66
|
-
"build:dist": "npx rollup -c --bundleConfigAsCjs",
|
|
67
88
|
"styles:copy": "npx yarn styles:cjs:copy & npx yarn styles:esm:copy",
|
|
68
89
|
"styles:cjs:copy": "npx copyfiles \"src/**/*.css\" -u 1 lib/cjs",
|
|
69
90
|
"styles:esm:copy": "npx copyfiles \"src/**/*.css\" -u 1 lib/esm",
|
|
@@ -73,28 +94,30 @@
|
|
|
73
94
|
"lint": "npx eslint src --ext .ts,.tsx",
|
|
74
95
|
"lint:fix": "npx eslint src --ext .ts,.tsx --fix",
|
|
75
96
|
"cleanup": "npx rimraf dist && npx rimraf lib",
|
|
76
|
-
"prepare": "npx yarn cleanup && npx yarn build"
|
|
97
|
+
"prepare": "npx yarn cleanup && cross-env NODE_ENV=production npx yarn build"
|
|
77
98
|
},
|
|
78
99
|
"dependencies": {
|
|
79
|
-
"@broxus/js-core": "^0.
|
|
80
|
-
"@broxus/js-utils": "^1.4.
|
|
81
|
-
"@broxus/react-components": "^0.
|
|
82
|
-
"@broxus/react-uikit": "^0.
|
|
100
|
+
"@broxus/js-core": "^0.34.0",
|
|
101
|
+
"@broxus/js-utils": "^1.4.2",
|
|
102
|
+
"@broxus/react-components": "^0.24.0",
|
|
103
|
+
"@broxus/react-uikit": "^0.20.0",
|
|
104
|
+
"classnames": "^2.5.1"
|
|
105
|
+
},
|
|
106
|
+
"optionalDependencies": {
|
|
83
107
|
"@metamask/detect-provider": "^2.0.0",
|
|
84
108
|
"@walletconnect/ethereum-provider": "^2.20.2",
|
|
85
|
-
"
|
|
109
|
+
"mobx": "^6.9.0",
|
|
110
|
+
"mobx-react-lite": "^4.1.0",
|
|
111
|
+
"react-intl": "^7.1.0",
|
|
112
|
+
"web3": "^4.0.0"
|
|
86
113
|
},
|
|
87
114
|
"peerDependencies": {
|
|
88
|
-
"mobx": "^6.
|
|
89
|
-
"mobx-react-lite": "^3.4.
|
|
90
|
-
"react": "^16.8.0 || ^17.
|
|
91
|
-
"react-
|
|
92
|
-
"
|
|
93
|
-
"web3
|
|
94
|
-
"web3-eth": "^4.x",
|
|
95
|
-
"web3-eth-contract": "^4.x",
|
|
96
|
-
"web3-types": "^1.x",
|
|
97
|
-
"web3-utils": "^4.x"
|
|
115
|
+
"mobx": "^6.9.0",
|
|
116
|
+
"mobx-react-lite": "^3.4.0 || ^4.0.0",
|
|
117
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
118
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
119
|
+
"react-intl": "^6.0.0 || ^7.0.0",
|
|
120
|
+
"web3": "^4.0.0"
|
|
98
121
|
},
|
|
99
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "dd4f4796db2f624810e4a6c38bb5f0f082b0014d"
|
|
100
123
|
}
|