AleoSnap - MetaMask Snap for Aleo ecosystem
Table of Contents
Introduction
AleoSnap is a MetaMask Snap that enables MetaMask users to interact with Aleo blockchain.
This package provides the functionality to integrate the Aleo blockchain into MetaMask using the Snaps system.
Requirements
Ensure you are set up and ready to go with the AleoSnap Monorepo.
To use the AleoSnap package, you need to have the MetaMask browser extension installed and set up, and be familiar with developing Snaps.
Usage and Developing
To use and develop AleoSnap, you will need to interact with the MetaMask extension using the JSON-RPC API.
Run Local Development Environment
Notice:
Using snap that is running in local enviroment is only available with MetaMask Flask (https://metamask.io/flask),
regular MetaMask must not be installed simultaneously.
Run the Snap local development environment:
yarn serve
Initialize Snap
Open a browser with any website (e.g., http://example.com/), with the Developer Tools open.
Run this command in the console to initialize the Snap from local source:
window.ethereum.request({
method: "wallet_requestSnaps",
params: {
"local:http://localhost:8081": {},
},
});
or initialize from npm:
window.ethereum.request({
method: "wallet_requestSnaps",
params: {
"npm:@chainsafe/aleo-snap": {},
},
});
Invoke Snap Methods
Now you are ready to run any of the Snap commands:
window.ethereum.request({
method: "wallet_invokeSnap",
params: {
snapId: "local:http://localhost:8081",
request: {
method: "aleo_getAccountt",
params: {},
},
},
}).then(console.log);