Sample dApp using MetaMask
Last updated
Was this helpful?
Last updated
Was this helpful?
The VSL MetaMask Snap lets developers create and manage VSL accounts, sign transactions, and interact with VSL assets all directly from MetaMask-compatible dApps.
This guide gives an overview of what the Snap can do, introduces the companion dApp, and shows you how to begin using the integration. If you're ready to try it locally, you’ll find the setup steps in our Snap Companion dApp repository.
The VSL Snap is a custom MetaMask extension that communicates with a locally running VSL node. It exposes JSON-RPC methods to allow dApps to:
Manage accounts via a keyring interface
Sign messages and transactions
Mint and query VSL assets
Transfer VSL tokens
The Snap speaks via wallet_invokeSnap and keyring_* methods and forwards all calls to a VSL core node, which must be running locally (by default at http://localhost:44444
).
To make it easier to try out the Snap, we’ve built a simple frontend that lets you call its features directly.
Head over to the companion dApp repository for full setup instructions.
Once it’s running, you can connect MetaMask Flask and interact with the Snap through a simple UI. You can see the UI below:
Once you have the Snap installed and the companion dApp running, you can start using it to manage your VSL accounts and assets.
One of the first things you can do is add an account. To do this, follow the steps below:
Click on the Add Account button in the Snap Companion dApp.
Click on Create on the next screen to create a new VSL account.
Enter a name for your account and click Add Account.
Your new account will now appear in the list of accounts managed by Snap.
If you click on the info icon next to the account, you can see details like the account id, address, etc.
To see the private key of the account, click on the download icon next to the account name. This will reveal the private key, which you can copy to your clipboard.
To delete an account, click the trash icon next to the account name. This will remove the account from the Snap.
You can also import an existing VSL account into Snap. To do this, you need a private key. You can generate a random one here.
Once you have the private key, follow these steps:
Insert the private key into the input field in the Snap Companion dApp.
Click on Import Account and on the popup that appears, click Add account.
Add the account, and right after, you will see the account and next to it, the account information.
More Features
Once you have an account set up, you can use the Snap to:
Create an asset by filling in the required fields in the Snap Companion dApp and clicking the Add Asset button.
Verify an asset by pasting the asset ID into the input field and clicking the Get Asset button.
Retrieve the balance of an asset by filling in the required fields in the Snap Companion dApp and clicking the Get Balance button.
You can also transfer assets by filling in the required fields in the Snap Companion dApp and clicking the Pay button.