@metamask/connect-evm 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0]
11
+
12
+ ### Added
13
+
14
+ - Initial release ([#58](https://github.com/MetaMask/connect-monorepo/pull/58))
15
+
16
+ [Unreleased]: https://github.com/MetaMask/metamask-connect-monorepo/compare/@metamask/connect-evm@0.1.0...HEAD
17
+ [0.1.0]: https://github.com/MetaMask/metamask-connect-monorepo/releases/tag/@metamask/connect-evm@0.1.0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 MetaMask
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # `@metamask/connect-evm`
2
+
3
+ > EIP-1193 compatible interface for connecting to MetaMask and interacting with Ethereum Virtual Machine (EVM) networks.
4
+
5
+ `@metamask/connect-evm` provides a modern replacement for MetaMask SDK V1, offering enhanced functionality and cross-platform compatibility. It wraps the Multichain SDK to provide a simplified, EIP-1193 compliant API for dapp developers.
6
+
7
+ ## Features
8
+
9
+ - **EIP-1193 Provider Interface** - Seamless integration with existing dapp code using the standard Ethereum provider interface
10
+ - **Cross-Platform Support** - Works with browser extensions and mobile applications
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ yarn add @metamask/connect-evm
16
+ ```
17
+
18
+ or
19
+
20
+ ```bash
21
+ npm install @metamask/connect-evm
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```typescript
27
+ import { createMetamaskConnectEVM } from '@metamask/connect-evm';
28
+
29
+ // Create an SDK instance
30
+ const sdk = await createMetamaskConnectEVM({
31
+ dapp: {
32
+ name: 'My DApp',
33
+ url: 'https://mydapp.com',
34
+ },
35
+ });
36
+
37
+ // Connect to MetaMask
38
+ await sdk.connect({ chainId: 1 }); // Connect to Ethereum Mainnet
39
+
40
+ // Get the EIP-1193 provider
41
+ const provider = await sdk.getProvider();
42
+
43
+ // Request accounts
44
+ const accounts = await provider.request({
45
+ method: 'eth_accounts',
46
+ });
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### Basic Connection
52
+
53
+ ```typescript
54
+ import { createMetamaskConnectEVM } from '@metamask/connect-evm';
55
+
56
+ const sdk = await createMetamaskConnectEVM({
57
+ dapp: {
58
+ name: 'My DApp',
59
+ url: 'https://mydapp.com',
60
+ },
61
+ });
62
+
63
+ // Connect with default chain (mainnet)
64
+ const { accounts, chainId } = await sdk.connect();
65
+
66
+ // Connect to a specific chain
67
+ await sdk.connect({ chainId: 137 }); // Polygon
68
+
69
+ // Connect to a specific chain and account
70
+ await sdk.connect({ chainId: 1, account: '0x...' });
71
+ ```
72
+
73
+ ### Using the Provider Directly
74
+
75
+ ```typescript
76
+ const provider = await sdk.getProvider();
77
+
78
+ // Send transaction
79
+ const txHash = await provider.request({
80
+ method: 'eth_sendTransaction',
81
+ params: [
82
+ {
83
+ from: accounts[0],
84
+ to: '0x...',
85
+ value: '0x...',
86
+ },
87
+ ],
88
+ });
89
+
90
+ // Call contract method
91
+ const result = await provider.request({
92
+ method: 'eth_call',
93
+ params: [
94
+ {
95
+ to: '0x...',
96
+ data: '0x...',
97
+ },
98
+ ],
99
+ });
100
+ ```
101
+
102
+ ## Examples
103
+
104
+ Check out the [playground examples](../../playground/legacy-evm-react-vite-playground) for a complete React implementation.
105
+
106
+ ## TypeScript
107
+
108
+ This package is written in TypeScript and includes full type definitions. No additional `@types` package is required.
109
+
110
+ ## Development
111
+
112
+ This package is part of the MetaMask Connect monorepo. From the repo root:
113
+
114
+ ```bash
115
+ # Run linting
116
+ yarn workspace @metamask/connect-evm run lint
117
+
118
+ # Run type checking
119
+ yarn workspace @metamask/connect-evm run check
120
+
121
+ # Format code
122
+ yarn workspace @metamask/connect-evm run format:fix
123
+
124
+ # Run tests
125
+ yarn workspace @metamask/connect-evm run test
126
+ ```
127
+
128
+ ## Contributing
129
+
130
+ This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/metamask-connect-monorepo#readme).
131
+
132
+ ## License
133
+
134
+ MIT