Use Starknet
Starknet is a non-EVM Layer 2 network.
You can interact with users' Starknet accounts in MetaMask by connecting to the
Starknet Snap.
You can use the get-starknet
library or the
wallet_invokeSnap
JSON-RPC method from
your dapp to connect to the Starknet Snap.
Both options support similar functionalities, but offer different ways of interacting with users'
Starknet accounts.
See Connect to Starknet to get started.
The following sections compare the two connection options.
get-starknet
We recommend using the get-starknet
library for most use cases due to its ease of configuration
and multi-wallet support.
Learn more about how get-starknet
interacts with MetaMask.
The get-starknet
library:
- Provides a high-level API that abstracts complex operations.
- Standardizes error handling.
- Supports connecting to multiple Starknet wallets, not limited to MetaMask.
- Manages wallet connections and Starknet interactions.
- Provides results in more readable code.
get-starknet
provides the same functionalities as wallet_invokeSnap
and integrates a Starknet
Window Object (SWO).
The SWO simplifies account management and signing, and enhances the experience of handling account
states and transactions.
A dapp uses the Account object in the SWO to manage operations.
wallet_invokeSnap
The wallet_invokeSnap
method:
- Requires precise method names and parameter structures.
- Handles both MetaMask-specific and Starknet-specific errors.
- Is designed for operating within the MetaMask framework.
- Manages lower-level Starknet interactions directly.
- Provides results in more detailed, lower-level code.
wallet_invokeSnap
manages direct interactions between the dapp and the Starknet Snap.
It facilitates network communication for account creation, transaction signing, fee estimation, and
other Starknet-related actions.
Supported functionalities
The following section lists the core functionalities and API methods that each connection option supports:
Resources
To get started, connect your dapp to Starknet in MetaMask.
The following external resources provide additional information for learning about and interacting with Starknet: