Skip to content

Commit

Permalink
fix: removes imports of caip-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Gancho Radkov committed Jan 3, 2024
1 parent 844c782 commit 936f10a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
26 changes: 7 additions & 19 deletions examples/dapp/src/components/Blockchain.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -14,6 +13,7 @@ import {
ChainMetadata,
ChainNamespaces,
AccountBalances,
NamespaceMetadata,
} from "../helpers";
import { fonts } from "../styles";

Expand Down Expand Up @@ -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;
Expand All @@ -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<PropsWithChildren<BlockchainProps>> = (
props: PropsWithChildren<BlockchainProps>
props: PropsWithChildren<BlockchainProps>,
) => {
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;

Expand Down Expand Up @@ -162,10 +153,7 @@ const Blockchain: FC<PropsWithChildren<BlockchainProps>> = (
<SFullWidthContainer>
<h6>Balances</h6>
<Column center>
<Asset
key={balances[address].symbol}
asset={balances[address]}
/>
<Asset key={balances[address].symbol} asset={balances[address]} />
</Column>
</SFullWidthContainer>
) : null}
Expand Down
4 changes: 1 addition & 3 deletions examples/dapp/src/helpers/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ChainsMap } from "caip-api";

export interface AssetData {
account: string;
symbol: string;
Expand Down Expand Up @@ -145,7 +143,7 @@ export interface NamespaceMetadata {
[reference: string]: ChainMetadata;
}
export interface ChainNamespaces {
[namespace: string]: ChainsMap;
[namespace: string]: NamespaceMetadata;
}

export interface AccountAction {
Expand Down

0 comments on commit 936f10a

Please sign in to comment.