-
Notifications
You must be signed in to change notification settings - Fork 370
/
Copy pathtezos.ts
59 lines (54 loc) · 1.31 KB
/
tezos.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils";
import {
NamespaceMetadata,
ChainMetadata,
ChainRequestRender,
ChainsMap,
} from "../helpers";
export const TezosMetadata: NamespaceMetadata = {
mainnet: {
logo: "/assets/tezos.svg",
rgb: "44, 125, 247",
},
ghostnet: {
logo: "/assets/tezos.svg",
rgb: "44, 125, 247",
},
};
export const TezosChainData: ChainsMap = {
mainnet: {
name: "Tezos",
id: "tezos:mainnet",
rpc: ["https://rpc.tzbeta.net"],
indexer: "https://api.tzkt.io/v1",
slip44: 1729,
testnet: false,
},
ghostnet: {
name: "Tezos Ghostnet",
id: "tezos:ghostnet",
rpc: ["https://rpc.ghostnet.teztnets.com"],
indexer: "https://api.ghostnet.tzkt.io/v1",
slip44: 1729,
testnet: true,
},
};
export function getChainMetadata(chainId: string): ChainMetadata {
const reference = chainId.split(":")[1];
const metadata = TezosMetadata[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"),
},
];
}