diff --git a/examples/dapp/package.json b/examples/dapp/package.json index bd89d63..c7d80a1 100644 --- a/examples/dapp/package.json +++ b/examples/dapp/package.json @@ -36,7 +36,6 @@ "@walletconnect/utils": "2.11.0", "axios": "^0.21.1", "blockies-ts": "^1.0.0", - "caip-api": "^2.0.0-beta.1", "cosmos-wallet": "^1.1.0", "eth-sig-util": "^2.5.3", "ethereumjs-util": "^7.0.6", diff --git a/examples/dapp/src/components/Blockchain.tsx b/examples/dapp/src/components/Blockchain.tsx index 50acb99..e150697 100644 --- a/examples/dapp/src/components/Blockchain.tsx +++ b/examples/dapp/src/components/Blockchain.tsx @@ -1,6 +1,5 @@ import React, { PropsWithChildren, FC } from "react"; import styled from "styled-components"; -import { ChainData } from "caip-api"; import Asset from "./Asset"; import Button from "./Button"; @@ -14,6 +13,7 @@ import { ChainMetadata, ChainNamespaces, AccountBalances, + NamespaceMetadata, } from "../helpers"; import { fonts } from "../styles"; @@ -93,13 +93,13 @@ interface BlockchainProps { } interface BlockchainDisplayData { - data: ChainData; + data: ChainMetadata; meta: ChainMetadata; } function getBlockchainDisplayData( chainId: string, - chainData: ChainNamespaces + chainData: ChainNamespaces, ): BlockchainDisplayData | undefined { const [namespace, reference] = chainId.split(":"); let meta: ChainMetadata; @@ -108,24 +108,15 @@ function getBlockchainDisplayData( } catch (e) { return undefined; } - const data: ChainData = chainData[namespace][reference]; + const data = chainData[namespace][reference]; if (typeof data === "undefined") return undefined; return { data, meta }; } const Blockchain: FC> = ( - props: PropsWithChildren + props: PropsWithChildren, ) => { - const { - chainData, - fetching, - chainId, - address, - onClick, - balances, - active, - actions, - } = props; + const { chainData, fetching, chainId, address, onClick, balances, active, actions } = props; if (!Object.keys(chainData).length) return null; @@ -162,10 +153,7 @@ const Blockchain: FC> = (
Balances
- +
) : null} diff --git a/examples/dapp/src/contexts/ClientContext.tsx b/examples/dapp/src/contexts/ClientContext.tsx index eb67b88..1e02303 100644 --- a/examples/dapp/src/contexts/ClientContext.tsx +++ b/examples/dapp/src/contexts/ClientContext.tsx @@ -8,7 +8,6 @@ import { useState, } from "react"; -import { apiGetChainNamespace, ChainsMap } from "caip-api"; import { PairingTypes, SessionTypes } from "@walletconnect/types"; import { EthereumProvider } from "@walletconnect/ethereum-provider"; import type IEthereumProvider from "@walletconnect/ethereum-provider"; @@ -79,20 +78,10 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac const loadChainData = async () => { const namespaces = getAllChainNamespaces(); - const chainData: ChainNamespaces = {}; - await Promise.all( - namespaces.map(async (namespace) => { - let chains: ChainsMap | undefined; - try { - chains = await apiGetChainNamespace(namespace); - } catch (e) { - // ignore error - } - if (typeof chains !== "undefined") { - chainData[namespace] = chains; - } - }), - ); + const namespace = namespaces[0]; + const chainData = { + [namespace]: EIP155Metadata, + }; setChainData(chainData); }; diff --git a/examples/dapp/src/helpers/types.ts b/examples/dapp/src/helpers/types.ts index 71fc62b..f87d1d3 100644 --- a/examples/dapp/src/helpers/types.ts +++ b/examples/dapp/src/helpers/types.ts @@ -1,5 +1,3 @@ -import { ChainsMap } from "caip-api"; - export interface AssetData { account: string; symbol: string; @@ -145,7 +143,7 @@ export interface NamespaceMetadata { [reference: string]: ChainMetadata; } export interface ChainNamespaces { - [namespace: string]: ChainsMap; + [namespace: string]: NamespaceMetadata; } export interface AccountAction { diff --git a/examples/dapp/yarn.lock b/examples/dapp/yarn.lock index d560fb4..2761824 100644 --- a/examples/dapp/yarn.lock +++ b/examples/dapp/yarn.lock @@ -1885,13 +1885,6 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@json-rpc-tools/types@^2.0.0-beta.0": - version "2.0.0-beta.12" - resolved "https://registry.yarnpkg.com/@json-rpc-tools/types/-/types-2.0.0-beta.12.tgz#358f77c48a844a3f55169c2db3b35c6af1cf4e8b" - integrity sha512-UM8w0RnD4DjYql/HlThe051ivW2Q8ulWarr7ux5Aas1UsOmcGQEg4slQo46p+BXgh1Nth7SHWS2tVnW/UUnCwQ== - dependencies: - keyvaluestorage-interface "^1.0.0" - "@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz#64df34e2f12e68e78ac57e571d25ec07fa460ca9" @@ -4584,20 +4577,6 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -caip-api@^2.0.0-beta.1: - version "2.0.0-beta.1" - resolved "https://registry.yarnpkg.com/caip-api/-/caip-api-2.0.0-beta.1.tgz#23877b880396f855fc2cd7892d02c597f2d62ba7" - integrity sha512-pwVXYfAIV3V0QhsKfvamIvsnn7lSmrotukmbXndOE2EsA0dos5W8MLadlpG2U+VSDghCVWI6cY9oJbBuXWj2gg== - dependencies: - "@json-rpc-tools/types" "^2.0.0-beta.0" - axios "^0.21.1" - caip "^0.9.2" - -caip@^0.9.2: - version "0.9.2" - resolved "https://registry.yarnpkg.com/caip/-/caip-0.9.2.tgz#6aec668e459dc3a1830530f7bb8d06f0044a5391" - integrity sha512-o4aIUSR9lkn7B9lIw8Xgkj+hDh+S1PtsBphoSqP2Dt95gRWPniaqEpnPwiUEhaPQr84JzWIEm4Cck3lMZtIkTA== - call-bind@^1.0.0, call-bind@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"