wallet-connect-web-examples/advanced/dapps/react-dapp-v2-cosmos-provider/src/chains/cosmos.ts
Ben Kremer d205e01fd8
refactor(apis): replace to-be-deprecated ethereum-api.xyz and blockchain-api.xyz calls (#349)
* refactor(dapp-v2): `ethereum-api.xyz` to `rpc.walletconnect.com`

* refactor(with-ethers): `ethereum-api.xyz` -> `rpc.walletconnect.com`

* refactor(with-web3js): `ethereum-api.xyz` -> `rpc.walletconnect.com`

* refactor(cosmos-provider): `ethereum-api.xyz` -> `rpc.walletconnect.com`

* refactor(apis): replace remaining `blockchain-api.xyz` calls with assets

* chore: add leftover assets for test chains
2023-12-18 15:46:51 +01:00

30 lines
840 B
TypeScript

import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils";
import { NamespaceMetadata, ChainMetadata, ChainRequestRender } from "../helpers";
export const CosmosMetadata: NamespaceMetadata = {
"cosmoshub-4": {
logo: "/assets/" + "cosmos:cosmoshub-4.png",
rgb: "27, 31, 53",
},
};
export function getChainMetadata(chainId: string): ChainMetadata {
const reference = chainId.split(":")[1];
const metadata = CosmosMetadata[reference];
if (typeof metadata === "undefined") {
throw new Error(`No chain metadata found for chainId: ${chainId}`);
}
return metadata;
}
export function getChainRequestRender(request: JsonRpcRequest): ChainRequestRender[] {
return [
{ label: "Method", value: request.method },
{
label: "params",
value: JSON.stringify(request.params, null, "\t"),
},
];
}