Docs
Upgrading from V1

Upgrading from V1

This guide will help you upgrade from Starknet React V1.

Updating dependencies

First, update all dependencies and double check that the installed version of @starknet-react/core is at least 2.0.0.

npm
pnpm
yarn

_10
npm install @starknet-react/chains@next @starknet-react/core@next starknet get-starknet-core

Update StarknetConfig

Update the existing StarknetConfig by adding the new chains and providers options. You also need to update the connectors passed to it.

  • chains: a list of chains supported by your dapp. The first chain in the list is the default chain, used when the user doesn't connect their wallet.
  • providers: an RPC provider. See the providers section for more information.
  • connectors: in v2, basic information about a wallet (like the id and name) must be provided. Starknet React provides helpers to initialize connectors for the most popular wallets.
components/starknet-provider.tsx

_23
import { goerli } from "@starknet-react/chains";
_23
import {
_23
StarknetConfig,
_23
publicProvider,
_23
argent,
_23
braavos,
_23
} from "@starknet-react/core";
_23
_23
export function StarknetProvider({ children }: { children: React.ReactNode }) {
_23
const chains = [goerli];
_23
const providers = [publicProvider()];
_23
const connectors = [argent(), braavos()];
_23
_23
return (
_23
<StarknetConfig
_23
chains={chains}
_23
providers={providers}
_23
connectors={connectors}
_23
>
_23
{children}
_23
</StarknetConfig>
_23
);
_23
}

Transaction manager

The transaction manager is now gone 💀 Fear not, it's easy to replace it using standard React tools 😇

This decision was not easy, but we noticed that the hook and context were cause of some issues and many teams decided to implement their own solution using their favourite state management library.

The easiest way to upgrade is by following the code in the transaction manager demo. Once you finish upgrading, you will have a transaction manager that's easier to customize and that persists the transaction list between page reloads.