chore(config): adds solana network data and metadata
This commit is contained in:
parent
a54db6ceb2
commit
86ef897b4c
BIN
dapps/react-dapp-v2/public/solana_logo.png
Normal file
BIN
dapps/react-dapp-v2/public/solana_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@ -3,6 +3,7 @@ import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils";
|
|||||||
import * as eip155 from "./eip155";
|
import * as eip155 from "./eip155";
|
||||||
import * as cosmos from "./cosmos";
|
import * as cosmos from "./cosmos";
|
||||||
import * as polkadot from "./polkadot";
|
import * as polkadot from "./polkadot";
|
||||||
|
import * as solana from "./solana";
|
||||||
|
|
||||||
import { ChainMetadata, ChainRequestRender } from "../helpers";
|
import { ChainMetadata, ChainRequestRender } from "../helpers";
|
||||||
|
|
||||||
@ -15,6 +16,8 @@ export function getChainMetadata(chainId: string): ChainMetadata {
|
|||||||
return cosmos.getChainMetadata(chainId);
|
return cosmos.getChainMetadata(chainId);
|
||||||
case "polkadot":
|
case "polkadot":
|
||||||
return polkadot.getChainMetadata(chainId);
|
return polkadot.getChainMetadata(chainId);
|
||||||
|
case "solana":
|
||||||
|
return solana.getChainMetadata(chainId);
|
||||||
default:
|
default:
|
||||||
throw new Error(`No metadata handler for namespace ${namespace}`);
|
throw new Error(`No metadata handler for namespace ${namespace}`);
|
||||||
}
|
}
|
||||||
|
23
dapps/react-dapp-v2/src/chains/solana.ts
Normal file
23
dapps/react-dapp-v2/src/chains/solana.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { NamespaceMetadata, ChainMetadata } from "../helpers";
|
||||||
|
|
||||||
|
export const SolanaMetadata: NamespaceMetadata = {
|
||||||
|
// Solana Mainnet
|
||||||
|
"4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ": {
|
||||||
|
logo: "/solana_logo.png",
|
||||||
|
rgb: "0, 0, 0",
|
||||||
|
},
|
||||||
|
// Solana Devnet
|
||||||
|
"8E9rvCKLFQia2Y35HXjjpWzj8weVo44K": {
|
||||||
|
logo: "/solana_logo.png",
|
||||||
|
rgb: "0, 0, 0",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getChainMetadata(chainId: string): ChainMetadata {
|
||||||
|
const reference = chainId.split(":")[1];
|
||||||
|
const metadata = SolanaMetadata[reference];
|
||||||
|
if (typeof metadata === "undefined") {
|
||||||
|
throw new Error(`No chain metadata found for chainId: ${chainId}`);
|
||||||
|
}
|
||||||
|
return metadata;
|
||||||
|
}
|
@ -118,8 +118,11 @@ const Blockchain: FC<PropsWithChildren<BlockchainProps>> = (
|
|||||||
) => {
|
) => {
|
||||||
const { chainData, fetching, chainId, address, onClick, active, balances, actions } = props;
|
const { chainData, fetching, chainId, address, onClick, active, balances, actions } = props;
|
||||||
if (!Object.keys(chainData).length) return null;
|
if (!Object.keys(chainData).length) return null;
|
||||||
|
|
||||||
const chain = getBlockchainDisplayData(chainId, chainData);
|
const chain = getBlockchainDisplayData(chainId, chainData);
|
||||||
|
|
||||||
if (typeof chain === "undefined") return null;
|
if (typeof chain === "undefined") return null;
|
||||||
|
|
||||||
const name = chain.meta.name || chain.data.name;
|
const name = chain.meta.name || chain.data.name;
|
||||||
const account = typeof address !== "undefined" ? `${chainId}:${address}` : undefined;
|
const account = typeof address !== "undefined" ? `${chainId}:${address}` : undefined;
|
||||||
const assets =
|
const assets =
|
||||||
|
@ -7,6 +7,7 @@ export const DEFAULT_MAIN_CHAINS = [
|
|||||||
"eip155:42161",
|
"eip155:42161",
|
||||||
"eip155:42220",
|
"eip155:42220",
|
||||||
"cosmos:cosmoshub-4",
|
"cosmos:cosmoshub-4",
|
||||||
|
"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",
|
||||||
];
|
];
|
||||||
|
|
||||||
export const DEFAULT_TEST_CHAINS = [
|
export const DEFAULT_TEST_CHAINS = [
|
||||||
@ -16,6 +17,7 @@ export const DEFAULT_TEST_CHAINS = [
|
|||||||
"eip155:80001",
|
"eip155:80001",
|
||||||
"eip155:421611",
|
"eip155:421611",
|
||||||
"eip155:44787",
|
"eip155:44787",
|
||||||
|
"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K",
|
||||||
];
|
];
|
||||||
|
|
||||||
export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS];
|
export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS];
|
||||||
@ -34,6 +36,11 @@ export const DEFAULT_EIP155_METHODS = [
|
|||||||
|
|
||||||
export const DEFAULT_COSMOS_METHODS = ["cosmos_signDirect", "cosmos_signAmino"];
|
export const DEFAULT_COSMOS_METHODS = ["cosmos_signDirect", "cosmos_signAmino"];
|
||||||
|
|
||||||
|
export enum DEFAULT_SOLANA_METHODS {
|
||||||
|
SOL_SIGN_TRANSACTION = "solana_signTransaction",
|
||||||
|
SOL_SIGN_MESSAGE = "solana_signMessage",
|
||||||
|
}
|
||||||
|
|
||||||
export const DEFAULT_LOGGER = "debug";
|
export const DEFAULT_LOGGER = "debug";
|
||||||
|
|
||||||
export const DEFAULT_APP_METADATA = {
|
export const DEFAULT_APP_METADATA = {
|
||||||
|
Loading…
Reference in New Issue
Block a user