-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into style(frontend)/fix-token-balances
- Loading branch information
Showing
110 changed files
with
2,888 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+26.7 KB
(120%)
...y-page.spec.ts-snapshots/should-display-activity-page-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-395 Bytes
(100%)
...-snapshots/should-display-homepage-in-logged-in-state-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+213 Bytes
(100%)
...snapshots/should-display-homepage-in-logged-out-state-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+11.1 KB
(110%)
...spec.ts-snapshots/should-display-receive-tokens-modal-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-668 Bytes
(99%)
...pec.ts-snapshots/should-display-BTC-transactions-page-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+247 Bytes
(100%)
...pec.ts-snapshots/should-display-ETH-transactions-page-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-91 Bytes
(100%)
...pec.ts-snapshots/should-display-ICP-transactions-page-1-Google-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/frontend/src/btc/components/fee/UtxosFeeContext.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script lang="ts"> | ||
import { debounce, isNullish, nonNullish } from '@dfinity/utils'; | ||
import { getContext } from 'svelte'; | ||
import { selectUtxosFee as selectUtxosFeeApi } from '$btc/services/btc-send.services'; | ||
import { UTXOS_FEE_CONTEXT_KEY, type UtxosFeeContext } from '$btc/stores/utxos-fee.store'; | ||
import { authIdentity } from '$lib/derived/auth.derived'; | ||
import { nullishSignOut } from '$lib/services/auth.services'; | ||
import type { NetworkId } from '$lib/types/network'; | ||
import { mapNetworkIdToBitcoinNetwork } from '$lib/utils/network.utils'; | ||
export let amount: number | undefined = undefined; | ||
export let networkId: NetworkId | undefined = undefined; | ||
const { store } = getContext<UtxosFeeContext>(UTXOS_FEE_CONTEXT_KEY); | ||
const loadEstimatedFee = async () => { | ||
if (isNullish($authIdentity)) { | ||
await nullishSignOut(); | ||
return; | ||
} | ||
if (isNullish(networkId) || isNullish(amount) || amount === 0) { | ||
store.reset(); | ||
return; | ||
} | ||
const network = mapNetworkIdToBitcoinNetwork(networkId); | ||
const utxosFee = nonNullish(network) | ||
? await selectUtxosFeeApi({ | ||
amount, | ||
network, | ||
identity: $authIdentity | ||
}) | ||
: undefined; | ||
if (isNullish(utxosFee)) { | ||
store.reset(); | ||
return; | ||
} | ||
store.setUtxosFee({ | ||
utxosFee | ||
}); | ||
}; | ||
const debounceEstimateFee = debounce(loadEstimatedFee); | ||
$: amount, networkId, debounceEstimateFee(); | ||
</script> | ||
|
||
<slot /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { | ||
JsonTransactionsTextSchema, | ||
PostMessageDataResponseSchema, | ||
PostMessageWalletDataSchema | ||
} from '$lib/schema/post-message.schema'; | ||
|
||
const BtcPostMessageWalletDataSchema = PostMessageWalletDataSchema.extend({ | ||
newTransactions: JsonTransactionsTextSchema | ||
}); | ||
|
||
export const BtcPostMessageDataResponseWalletSchema = PostMessageDataResponseSchema.extend({ | ||
wallet: BtcPostMessageWalletDataSchema | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { UtxosFee } from '$btc/types/btc-send'; | ||
import type { Option } from '$lib/types/utils'; | ||
import { writable, type Readable } from 'svelte/store'; | ||
|
||
export type UtxosFeeStoreData = Option<{ | ||
utxosFee?: UtxosFee; | ||
}>; | ||
|
||
export interface UtxosFeeStore extends Readable<UtxosFeeStoreData> { | ||
setUtxosFee: (data: UtxosFeeStoreData) => void; | ||
reset: () => void; | ||
} | ||
|
||
export const initUtxosFeeStore = (): UtxosFeeStore => { | ||
const { subscribe, set } = writable<UtxosFeeStoreData>(undefined); | ||
|
||
return { | ||
subscribe, | ||
|
||
reset() { | ||
set(null); | ||
}, | ||
|
||
setUtxosFee(data: UtxosFeeStoreData) { | ||
set(data); | ||
} | ||
}; | ||
}; | ||
|
||
export interface UtxosFeeContext { | ||
store: UtxosFeeStore; | ||
} | ||
|
||
export const UTXOS_FEE_CONTEXT_KEY = Symbol('utxos-fee'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { BtcPostMessageDataResponseWalletSchema } from '$btc/schema/btc-post-message.schema'; | ||
import { z } from 'zod'; | ||
|
||
export type BtcPostMessageDataResponseWallet = z.infer< | ||
typeof BtcPostMessageDataResponseWalletSchema | ||
>; |
34 changes: 34 additions & 0 deletions
34
src/frontend/src/eth/components/loaders/LoaderMultipleEthTransactions.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script lang="ts"> | ||
import { erc20UserTokensNotInitialized } from '$eth/derived/erc20.derived'; | ||
import { enabledEthereumTokens } from '$eth/derived/tokens.derived'; | ||
import { loadTransactions } from '$eth/services/transactions.services'; | ||
import { enabledErc20Tokens } from '$lib/derived/tokens.derived'; | ||
import type { TokenId } from '$lib/types/token'; | ||
// TODO: make it more functional | ||
let tokensLoaded: TokenId[] = []; | ||
const load = async () => { | ||
if ($erc20UserTokensNotInitialized) { | ||
return; | ||
} | ||
await Promise.allSettled( | ||
[...$enabledEthereumTokens, ...$enabledErc20Tokens].map( | ||
async ({ network: { id: networkId }, id: tokenId }) => { | ||
if (tokensLoaded.includes(tokenId)) { | ||
return; | ||
} | ||
await loadTransactions({ tokenId, networkId }); | ||
tokensLoaded.push(tokenId); | ||
} | ||
) | ||
); | ||
}; | ||
$: $enabledEthereumTokens, $enabledErc20Tokens, $erc20UserTokensNotInitialized, load(); | ||
</script> | ||
|
||
<slot /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.