-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Bug ExternalBug Raised by CustomerBug Raised by Customer
Description
Link to minimal reproducible example
Calling a Transaction using a custom network for solana localnet fails
Steps to Reproduce
Add a custom network for Solana, I created one for localnet:
import { defineChain } from '@reown/appkit/networks';
// Define the custom network
export const solanaLocalnet = defineChain({
id: "C7PPtqrayTxjudYFNtv2hbWcU6SzEgvGjoZer4eAxv4V",
name: "Solana Localnet",
network: "solana-localnet",
nativeCurrency: {
name: "Solana",
symbol: "SOL",
decimals: 9
},
rpcUrls: {
default: {
http: [
"http://127.0.0.1:8899"
]
},
chainDefault: {
http: [
"http://127.0.0.1:8899"
]
}
},
blockExplorers: {
default: {
name: "Solscan",
url: "https://solscan.io?cluster=custom&customUrl=http://127.0.0.1:8899"
}
},
testnet: true,
chainNamespace: "solana",
caipNetworkId: "solana:C7PPtqrayTxjudYFNtv2hbWcU6SzEgvGjoZer4eAxv4V",
})
Then using backpack, switch to localnet and try performing a transaction
Summary
The I noticed the reown hardcoded the Solana chains, but Solana isnt the only SVM chain now, we now have SOON, Eclipse, Solayer and others, hardcoding Solana Chains will cause problems for custom networks.
This is what I found in reown solana lib during code inspection:
var solanaChains = {
"solana:mainnet": solana,
"solana:testnet": solanaTestnet,
"solana:devnet": solanaDevnet
};
getActiveChainName() {
const entry = Object.entries(solanaChains).find(([, chain]) => {
var _a;
return chain.id === ((_a = this.getActiveChain()) == null ? void 0 : _a.id);
});
if (!entry) {
throw new Error("Invalid chain id");
}
return entry[0];
}
This is using hard coded solanaChains object to validate the chains, which directly ignore custom chains.
List of related npm package versions
"@reown/appkit": "^1.8.14",
"@reown/appkit-adapter-solana": "^1.8.14",
"@reown/appkit-siwx": "^1.8.14",
Node.js Version
v24.8.0
Package Manager
npm 11.6.2
Metadata
Metadata
Assignees
Labels
Bug ExternalBug Raised by CustomerBug Raised by Customer