This is a simple Node.js application that demonstrates how to interact with the MetaMask wallet using the MetaMask SDK and gather user input using the enquirer
library.
Before you can run this demo, you need to ensure that you have the following installed:
- Node.js: You can download it from https://nodejs.org/.
-
Clone this repository to your local machine:
git clone <repository_url>
-
Navigate to the project directory:
cd sdk-nodejs-demo
-
Install the project dependencies:
yarn install
-
Start the application:
yarn start
The application will prompt you to select an action from a list of options using the
enquirer
library. -
After selecting an action, the application will dynamically determine the appropriate Ethereum method and execute it using the MetaMask SDK.
-
The results of the Ethereum method calls will be displayed in the console.
-
MetaMask SDK Options: You can configure MetaMask SDK options in the
options
object in theindex.ts
file. This includes specifying the dapp metadata, logging settings, and customizing modal text. -
Ethereum Methods: To add more Ethereum methods or customize the behavior of existing ones, you can modify the
start
function in theindex.ts
file. For example, you can add a new condition to handle a specific action.
getAccounts
: Retrieve the user's Ethereum accounts.getChainId
: Get the current Ethereum chain ID.signMessage
: Send an Ethereum transaction (customize parameters as needed).getBalance
: Get the balance of an Ethereum address (customize parameters as needed).- Other actions: You can extend the list of available actions as needed.
This project is licensed under the MIT License - see the LICENSE file for details.
- MetaMask SDK: https://github.com/MetaMask/metamask-sdk
- enquirer: https://github.com/enquirer/enquirer
- Dax the Dev
- Email: haydenaylor911@gmail.com