From 7638165bd5ce75145dcb374939cc0e5487110434 Mon Sep 17 00:00:00 2001 From: Vojtech Simetka Date: Wed, 20 Sep 2023 16:51:50 +0200 Subject: [PATCH] refactor: remove duplicate TokenAmount type definition --- src/lib/adapters/balance.ts | 3 ++- src/lib/adapters/index.ts | 3 +-- src/lib/adapters/waku/index.ts | 2 +- src/lib/objects/adapter.ts | 3 +-- src/lib/objects/ui.svelte | 3 ++- src/lib/stores/balances.ts | 10 +--------- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/lib/adapters/balance.ts b/src/lib/adapters/balance.ts index 626d86c8..0fc63ef0 100644 --- a/src/lib/adapters/balance.ts +++ b/src/lib/adapters/balance.ts @@ -1,7 +1,8 @@ -import { balanceStore, type TokenAmount } from '$lib/stores/balances' +import { balanceStore } from '$lib/stores/balances' import { defaultBlockchainNetwork, getBalance, getProvider } from '$lib/adapters/transaction' import { Contract } from 'ethers' import abi from '$lib/abis/erc20.json' +import type { TokenAmount } from '$lib/objects/schemas' export async function fetchBalances(address: string): Promise { balanceStore.update((state) => ({ diff --git a/src/lib/adapters/index.ts b/src/lib/adapters/index.ts index fe6ee516..64e69568 100644 --- a/src/lib/adapters/index.ts +++ b/src/lib/adapters/index.ts @@ -1,7 +1,6 @@ -import type { TokenAmount } from '$lib/stores/balances' import WakuAdapter from '$lib/adapters/waku' import type { BaseWallet } from 'ethers' -import type { User } from '$lib/objects/schemas' +import type { TokenAmount, User } from '$lib/objects/schemas' import type { JSONSerializable } from '$lib/objects' export interface Adapter { diff --git a/src/lib/adapters/waku/index.ts b/src/lib/adapters/waku/index.ts index 06030fe0..e07e2b4d 100644 --- a/src/lib/adapters/waku/index.ts +++ b/src/lib/adapters/waku/index.ts @@ -16,7 +16,6 @@ import type { BaseWallet, Wallet } from 'ethers' import { get } from 'svelte/store' import { objectStore, objectKey } from '$lib/stores/objects' import { lookup } from '$lib/objects/lookup' -import type { TokenAmount } from '$lib/stores/balances' import { defaultBlockchainNetwork, sendTransaction, @@ -35,6 +34,7 @@ import { makeWakustore } from './wakustore' import type { StorageChat, StorageChatEntry, StorageObjectEntry, StorageProfile } from './types' import { walletStore } from '$lib/stores/wallet' import { SafeWaku } from './safe-waku' +import type { TokenAmount } from '$lib/objects/schemas' const MAX_MESSAGES = 100 diff --git a/src/lib/objects/adapter.ts b/src/lib/objects/adapter.ts index 26a2c112..e6db74d8 100644 --- a/src/lib/objects/adapter.ts +++ b/src/lib/objects/adapter.ts @@ -1,7 +1,6 @@ import type { Adapter } from '$lib/adapters' import { Contract, type BaseWallet, type TransactionReceipt, Interface } from 'ethers' import type { WakuObjectAdapter } from '.' -import type { TokenAmount } from '$lib/stores/balances' import { defaultBlockchainNetwork, getProvider, @@ -10,7 +9,7 @@ import { getTransactionTimestamp, waitForTransaction, } from '$lib/adapters/transaction' -import type { Transaction, TransactionState } from './schemas' +import type { TokenAmount, Transaction, TransactionState } from './schemas' import { checkBalance } from '$lib/adapters/balance' import abi from '$lib/abis/erc20.json' diff --git a/src/lib/objects/ui.svelte b/src/lib/objects/ui.svelte index 53e11f80..ae82ddd0 100644 --- a/src/lib/objects/ui.svelte +++ b/src/lib/objects/ui.svelte @@ -1,7 +1,7 @@