chore(config): adds solana network data and metadata

This commit is contained in:
Ben Kremer 2022-03-16 16:26:00 +01:00
parent a54db6ceb2
commit 86ef897b4c
5 changed files with 36 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -3,6 +3,7 @@ import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils";
import * as eip155 from "./eip155";
import * as cosmos from "./cosmos";
import * as polkadot from "./polkadot";
import * as solana from "./solana";
import { ChainMetadata, ChainRequestRender } from "../helpers";
@ -15,6 +16,8 @@ export function getChainMetadata(chainId: string): ChainMetadata {
return cosmos.getChainMetadata(chainId);
case "polkadot":
return polkadot.getChainMetadata(chainId);
case "solana":
return solana.getChainMetadata(chainId);
default:
throw new Error(`No metadata handler for namespace ${namespace}`);
}

View 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;
}

View File

@ -118,8 +118,11 @@ const Blockchain: FC<PropsWithChildren<BlockchainProps>> = (
) => {
const { chainData, fetching, chainId, address, onClick, active, balances, actions } = props;
if (!Object.keys(chainData).length) return null;
const chain = getBlockchainDisplayData(chainId, chainData);
if (typeof chain === "undefined") return null;
const name = chain.meta.name || chain.data.name;
const account = typeof address !== "undefined" ? `${chainId}:${address}` : undefined;
const assets =

View File

@ -7,6 +7,7 @@ export const DEFAULT_MAIN_CHAINS = [
"eip155:42161",
"eip155:42220",
"cosmos:cosmoshub-4",
"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",
];
export const DEFAULT_TEST_CHAINS = [
@ -16,6 +17,7 @@ export const DEFAULT_TEST_CHAINS = [
"eip155:80001",
"eip155:421611",
"eip155:44787",
"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K",
];
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 enum DEFAULT_SOLANA_METHODS {
SOL_SIGN_TRANSACTION = "solana_signTransaction",
SOL_SIGN_MESSAGE = "solana_signMessage",
}
export const DEFAULT_LOGGER = "debug";
export const DEFAULT_APP_METADATA = {