Skip to content

Commit bf1ee0d

Browse files
authored
Fix starknet react defaultChainId (#58)
1 parent d4d4776 commit bf1ee0d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/pages/controller/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type Chain = {
1717
export type ControllerOptions = {
1818
// Chain configuration
1919
chains?: Chain[]; // Custom RPC endpoints for slot katana instances
20-
chainId?: string; // hex encoded
20+
defaultChainId?: string; // Default chain to use (hex encoded). If using Starknet React, this gets overridden by the same param in StarknetConfig
2121

2222
// Session options
2323
policies?: SessionPolicies; // Session policies for pre-approved transactions

src/pages/controller/examples/react.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ const policies: SessionPolicies = {
7979
// Initialize the connector
8080
const connector = new ControllerConnector({
8181
policies,
82-
rpc: 'https://api.cartridge.gg/x/starknet/sepolia',
82+
// With the defaults, you can omit chains if you want to use:
83+
// - chains: [
84+
// { rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia" },
85+
// { rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet" },
86+
// ]
8387
})
8488

8589
// Configure RPC provider
@@ -99,6 +103,7 @@ export function StarknetProvider({ children }: { children: React.ReactNode }) {
99103
return (
100104
<StarknetConfig
101105
autoConnect
106+
defaultChainId={mainnet.id}
102107
chains={[mainnet, sepolia]}
103108
provider={provider}
104109
connectors={[connector]}

src/pages/controller/getting-started.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const provider = jsonRpcProvider({
128128
export function StarknetProvider({ children }: { children: React.ReactNode }) {
129129
return (
130130
<StarknetConfig
131+
defaultChainId={sepolia.id}
131132
chains={[mainnet, sepolia]}
132133
provider={provider}
133134
connectors={[connector]}

0 commit comments

Comments
 (0)