Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizAsFight committed Oct 6, 2023
1 parent 7721f01 commit 5286d32
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/app/src/systems/Assets/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './network';
export * from './network';
30 changes: 17 additions & 13 deletions packages/app/src/systems/Assets/utils/network.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import type { Ethereum, Fuel } from "@fuels/assets";
import type { Ethereum, Fuel } from '@fuels/assets';

import type { Asset } from "../services";
import type { Asset } from '../services';

type Network = Ethereum | Fuel; // Assuming Ethereum and Fuel are your types
type Network = Ethereum | Fuel; // Assuming Ethereum and Fuel are your types
export type NetworkTypes = Ethereum['type'] | Fuel['type'];
type NetworkTypeToNetwork<T> =
T extends 'ethereum' ? Ethereum :
T extends 'fuel' ? Fuel :
Network;
type NetworkTypeToNetwork<T> = T extends 'ethereum'
? Ethereum
: T extends 'fuel'
? Fuel
: Network;

export type GetAssetNetworkParams<T extends NetworkTypes | undefined> = {
asset: Asset;
chainId: number;
networkType?: T;
};

export const getAssetNetwork = <T extends NetworkTypes | undefined>({ asset, chainId, networkType }: GetAssetNetworkParams<T>): NetworkTypeToNetwork<T> => {
if (!asset.networks) {
debugger;
}
const network = asset.networks.find(network => network.chainId === chainId && network.type === networkType) as NetworkTypeToNetwork<T>;
export const getAssetNetwork = <T extends NetworkTypes | undefined>({
asset,
chainId,
networkType,
}: GetAssetNetworkParams<T>): NetworkTypeToNetwork<T> => {
const network = asset.networks.find(
(network) => network.chainId === chainId && network.type === networkType
) as NetworkTypeToNetwork<T>;

return network;
}
};
1 change: 0 additions & 1 deletion packages/app/src/systems/Store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { OverlayMachine } from '~/systems/Overlay';

import type { AssetsMachine } from '../Assets/machines/assetsMachine';


export enum Services {
overlay = 'overlay',
bridge = 'bridge',
Expand Down

0 comments on commit 5286d32

Please sign in to comment.