wallet-connect-web-examples/dapps/react-dapp-v2/src/chains/index.ts
AndreasGassmann 9bf2b02602
Add Tezos Support (#127)
* feat(): add tezos

* feat(dapp): add tezos support

* feat(): remove unused project

* feat(): update logo

* feat(): add tezos sign modal

* feat(): remove unimplemented method

* feat(tezos): add send and sign support

* feat(tezos): add rpc

* Update wallets/react-wallet-v2/src/views/SessionProposalModal.tsx

Co-authored-by: Ben Kremer <contact@bkrem.dev>

* feat(): share all accounts

---------

Co-authored-by: Ben Kremer <ben@walletconnect.com>
Co-authored-by: Ben Kremer <contact@bkrem.dev>
2023-03-31 10:35:53 +02:00

58 lines
1.7 KiB
TypeScript

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 * as near from "./near";
import * as elrond from "./elrond";
import * as tron from "./tron";
import * as tezos from "./tezos";
import { ChainMetadata, ChainRequestRender } from "../helpers";
export function getChainMetadata(chainId: string): ChainMetadata {
const namespace = chainId.split(":")[0];
switch (namespace) {
case "eip155":
return eip155.getChainMetadata(chainId);
case "cosmos":
return cosmos.getChainMetadata(chainId);
case "polkadot":
return polkadot.getChainMetadata(chainId);
case "solana":
return solana.getChainMetadata(chainId);
case "near":
return near.getChainMetadata(chainId);
case "elrond":
return elrond.getChainMetadata(chainId);
case "tron":
return tron.getChainMetadata(chainId);
case "tezos":
return tezos.getChainMetadata(chainId);
default:
throw new Error(`No metadata handler for namespace ${namespace}`);
}
}
export function getChainRequestRender(
request: JsonRpcRequest,
chainId: string
): ChainRequestRender[] {
const namespace = chainId.split(":")[0];
switch (namespace) {
case "eip155":
return eip155.getChainRequestRender(request);
case "cosmos":
return cosmos.getChainRequestRender(request);
case "polkadot":
return polkadot.getChainRequestRender(request);
case "near":
return near.getChainRequestRender(request);
case "tezos":
return tezos.getChainRequestRender(request);
default:
throw new Error(`No render handler for namespace ${namespace}`);
}
}