MCPcopy Index your code
hub / github.com/Consensys/starknet-snap

github.com/Consensys/starknet-snap @starknet-snap-v4.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release starknet-snap-v4.2.0 ↗ · + Follow
1,391 symbols 3,755 edges 498 files 109 documented · 8% updated 57d agoget-starknet-v1.6.0 · 2026-02-03★ 873 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<img src="https://github.com/Consensys/starknet-snap/raw/starknet-snap-v4.2.0/github/starknet-snap-install.gif" alt="Starknet Snap Install">

Starknet Snap · npm version

The Starknet Snap allows users to deploy Starknet accounts, make transactions on Starknet, and interact with Starknet dapps. A blog post describing the effort is available here:

Blog Post

Table of Contents

Getting Started

Install the Snap

As a user, you can start by installing the snap here:

Starknet Snap

Connect to the dApp

You can also connect to the dApp:

Starknet Dapp

This is a sample dApp that uses the Starknet Snap. The dApp code can be found here. Developers can experiment with integrating this snap using this example.

Important Note

As the Starknet ecosystem is multi-wallet, the best approach for dApp developers in terms of interoperability is to build using the official get-starknet library. This way, developers can seamlessly make their dapp compatible with this snap and gain access to the MetaMask user base.

Development

Prerequisites

  • MetaMask Flask
  • ⚠️ You cannot have other versions of MetaMask installed.
  • Node.js 18. We strongly recommend you install via NVM to avoid incompatibility issues between different node projects.
    • Once installed, you should also install Yarn with npm i -g yarn to make working with this repository easier.

Installing

nvm use
yarn setup

Running

Quickstart

⚠️ When the snap updates, you will need to reconnect from the dapp to see changes.

# This will start the starknet-snap, the associated dapp and the get-starknet compatibility layer
yarn start

This will launch the following:

  • Wallet UI dapp: http://localhost:3000/
  • Snap server: http://localhost:8081/
  • Get-starknet federation module: http://localhost:8082/

Everything will run together in the same terminal in watch mode. If you want more control, see the next section

Snap

# Running Snap via watch mode
yarn workspace @consensys/starknet-snap watch

Alternatively, you can build and serve the snap manually. This can sometimes be more stable than watch mode but requires a manual rebuild and serve anytime there is a change on the snap.

# Building and serving snap manually
yarn workspace @consensys/starknet-snap build
yarn workspace @consensys/starknet-snap serve

UI

You can run the UI alone by running

# Running Wallet UI
yarn workspace wallet-ui start

This will launch the following:

  • Wallet UI dapp: http://localhost:3000/

Dapp Integration Guide

This guide is for a dApp that would be compatible only with MetaMask. To create a dApp compatible with all wallets in the Starknet ecosystem, prefer the get-starknet library. A sample dApp can be found here. If you still want to directly interact with the snap follow the tutorial below:

How to Install

From the dApp, issue the following RPC request to install the Snap. Make sure it is using the latest version.

provider.request({
  method: 'wallet_requestSnaps',
  params: {
    ["npm:@consensys/starknet-snap"]: { version: "2.2.0" }, // Snap's version
  },
});

Interact with Starknet Snap's API

From the dApp, issue the following RPC request to interact with the Snap.

provider.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: "npm:@consensys/starknet-snap",
    request: {
      method: 'starkNet_getStoredUserAccounts', // Snap method
      params: {
        chainId: "1", // Snap method's parameter
      },
    },
  },
});

Starknet Snap's API

The corresponding request payload and response for the latest Starknet Snap's API are documented in the openrpc spec.

Tutorial & Troubleshooting

If after update your funds are stuck on an old Cairo0 address, follow this tutorial to resolve stuck funds using the old StarkNet Snap.

Licenses

This project is dual-licensed under Apache 2.0 and MIT terms:

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

Copyright (c) 2024 ConsenSys Software Inc.

Extension points exported contracts — how you extend this code

MetaMaskProvider (Interface)
(no doc) [6 implementers]
packages/wallet-ui/src/hooks/useHasMetamask.ts
Wallet (Interface)
(no doc) [5 implementers]
packages/starknet-snap/test/wallet.mock.test.ts
ITestingAccount (Interface)
(no doc)
e2e/conf/shapes.ts
Erc20Token (Interface)
(no doc)
packages/wallet-ui/src/types/index.ts
IAccountsConf (Interface)
(no doc)
e2e/conf/shapes.ts
Erc20TokenBalance (Interface)
(no doc)
packages/wallet-ui/src/types/index.ts
TokenBalance (Interface)
(no doc)
packages/wallet-ui/src/types/index.ts
IListProps (Interface)
(no doc)
packages/wallet-ui/src/components/ui/molecule/List/List.view.tsx

Core symbols most depended-on inside this repo

translate
called by 132
packages/wallet-ui/src/services/useMultiLanguage.ts
execute
called by 92
packages/starknet-snap/src/rpcs/watch-asset.ts
translate
called by 68
packages/starknet-snap/src/utils/locale.ts
log
called by 66
packages/starknet-snap/src/utils/__mocks__/logger.ts
toJson
called by 52
packages/starknet-snap/src/utils/serializer.ts
error
called by 48
packages/starknet-snap/src/utils/__mocks__/logger.ts
request
called by 47
packages/starknet-snap/test/wallet.mock.test.ts
useMultiLanguage
called by 26
packages/wallet-ui/src/services/useMultiLanguage.ts

Shape

Function 720
Method 323
Class 239
Interface 77
Enum 32

Languages

TypeScript100%

Modules by API surface

packages/starknet-snap/src/utils/starknetUtils.ts53 symbols
packages/starknet-snap/src/utils/snapUtils.ts42 symbols
packages/starknet-snap/src/utils/exceptions.ts42 symbols
packages/wallet-ui/src/services/useStarkNetSnap.ts39 symbols
packages/starknet-snap/src/state/transaction-state-manager.ts30 symbols
e2e/utils/DappPage.ts30 symbols
packages/starknet-snap/src/utils/transaction/filter.ts25 symbols
packages/get-starknet/src/snap.ts25 symbols
packages/wallet-ui/src/utils/utils.ts24 symbols
packages/starknet-snap/src/state/account-state-manager.ts22 symbols
packages/starknet-snap/src/rpcs/__tests__/helper.ts20 symbols
packages/get-starknet/src/wallet.ts19 symbols

For agents

$ claude mcp add starknet-snap \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page