Skip to content

Commit

Permalink
Merge branch 'develop' into l10n_develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeanribeiro authored Jul 5, 2024
2 parents d98f4f4 + b39eb35 commit f7ab288
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 23 deletions.
16 changes: 8 additions & 8 deletions firefly.diff
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@
delete mode 100644 packages/shared/lib/core/app/stores/time.store.ts
delete mode 100644 packages/shared/lib/core/app/utils/openUrlInBrowser.ts
delete mode 100644 packages/shared/lib/core/app/utils/shouldBeDarkMode.ts
delete mode 100644 packages/shared/lib/core/i18n/utils/formatCurrency.ts
delete mode 100644 packages/shared/lib/core/i18n/utils/parseCurrency.ts
delete mode 100644 packages/shared/lib/core/layer-2/abis/index.ts
delete mode 100644 packages/shared/lib/core/layer-2/actions/fetchSelectedAccountLayer2Balance.ts
Expand Down Expand Up @@ -1167,8 +1168,10 @@
delete mode 100644 packages/shared/lib/core/market/actions/getAndUpdateMarketPrices.ts
delete mode 100644 packages/shared/lib/core/market/actions/getMarketPrices.ts
delete mode 100644 packages/shared/lib/core/market/actions/index.ts
delete mode 100644 packages/shared/lib/core/market/constants/default-market-currency.constant.ts
delete mode 100644 packages/shared/lib/core/market/constants/market-api-base-url.constant.ts
delete mode 100644 packages/shared/lib/core/market/enums/index.ts
delete mode 100644 packages/shared/lib/core/market/enums/market-currency.enum.ts
delete mode 100644 packages/shared/lib/core/market/index.ts
delete mode 100644 packages/shared/lib/core/market/stores/index.ts
delete mode 100644 packages/shared/lib/core/market/utils/getMarketAmountFromAssetValue.ts
Expand Down Expand Up @@ -1840,12 +1843,11 @@
rename packages/shared/{ => src}/lib/core/i18n/types/locale-options.type.ts (100%)
rename packages/shared/{ => src}/lib/core/i18n/types/locale.type.ts (100%)
rename packages/shared/{ => src}/lib/core/i18n/utils/ensureZeroes.ts (100%)
rename packages/shared/{ => src}/lib/core/i18n/utils/formatCurrency.ts (52%)
rename packages/shared/{ => src}/lib/core/i18n/utils/formatNumber.ts (88%)
rename packages/shared/{ => src}/lib/core/i18n/utils/getCurrencyPosition.ts (88%)
rename packages/shared/{ => src}/lib/core/i18n/utils/getDecimalSeparator.ts (83%)
rename packages/shared/{ => src}/lib/core/i18n/utils/getDecimalSeparator.ts (67%)
rename packages/shared/{ => src}/lib/core/i18n/utils/getFormattedTimeStamp.ts (58%)
rename packages/shared/{ => src}/lib/core/i18n/utils/getGroupSeparator.ts (83%)
rename packages/shared/{ => src}/lib/core/i18n/utils/getGroupSeparator.ts (67%)
rename packages/shared/{ => src}/lib/core/i18n/utils/index.ts (100%)
rename packages/shared/{ => src}/lib/core/i18n/utils/replaceCurrencyDecimal.ts (100%)
rename packages/shared/{lib/core/layer-2/abis/isc-sandbox.abi.ts => src/lib/core/isc/abis/isc-magic-contract-sandbox.abi.ts} (89%)
Expand Down Expand Up @@ -1899,18 +1901,16 @@
rename packages/shared/{ => src}/lib/core/ledger/utils/isLedgerDeviceMatchingActiveProfile.ts (62%)
rename packages/shared/{ => src}/lib/core/ledger/utils/isLedgerError.ts (100%)
rename packages/shared/{ => src}/lib/core/market/actions/market-prices-polling.ts (100%)
rename packages/shared/{ => src}/lib/core/market/constants/default-market-currency.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/market/constants/index.ts (100%)
rename packages/shared/{ => src}/lib/core/market/constants/market-poll-interval.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/market/constants/market-simple-price-endpoint.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/market/enums/market-coin-id.enum.ts (54%)
rename packages/shared/{ => src}/lib/core/market/enums/market-currency.enum.ts (94%)
rename packages/shared/{lib/auxiliary/icon => src/lib/core/market}/index.ts (77%)
rename packages/shared/{ => src}/lib/core/market/interfaces/simple-prices-query-parameters.interface.ts (100%)
rename packages/shared/{ => src}/lib/core/market/stores/market-coin-prices.store.ts (100%)
rename packages/shared/{ => src}/lib/core/market/types/index.ts (100%)
rename packages/shared/{ => src}/lib/core/market/types/index.ts (66%)
rename packages/shared/{ => src}/lib/core/market/types/market-coin-prices.type.ts (53%)
rename packages/shared/{ => src}/lib/core/market/types/market-prices.type.ts (100%)
rename packages/shared/{ => src}/lib/core/market/types/market-prices.type.ts (53%)
rename packages/shared/{ => src}/lib/core/network/actions/addNodeToClientOptions.ts (76%)
rename packages/shared/{ => src}/lib/core/network/actions/editNodeInClientOptions.ts (82%)
rename packages/shared/{ => src}/lib/core/network/actions/index.ts (56%)
Expand Down Expand Up @@ -1944,7 +1944,7 @@
rename packages/shared/{ => src}/lib/core/nfts/constants/default-max-nft-downloading-time-in-seconds.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/nfts/constants/default-max-nft-size-in-megabytes.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/nfts/constants/default-nft-name.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/nfts/constants/index.ts (69%)
rename packages/shared/{ => src}/lib/core/nfts/constants/index.ts (77%)
rename packages/shared/{ => src}/lib/core/nfts/constants/nft-id-byte-length.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/nfts/constants/nft-media-file-name.constant.ts (100%)
rename packages/shared/{ => src}/lib/core/nfts/enums/download-error-type.enum.ts (78%)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { EvmTransactionAlert } from '.'
import { IToken } from '@core/token'
import { openUrlInBrowser } from '@core/app/utils'
import { Alert } from '@bloomwalletio/ui'
export let parsedTokenApproval: IParsedTokenApproval
export let networkId: EvmNetworkId
Expand Down Expand Up @@ -37,6 +38,7 @@
{#if tokenTransfer.token}
<TransactionAssetSection {tokenTransfer} />
{:else}
<Alert variant="warning" text={localize('popups.tokenApproval.warning')} />
<Table
collapsible
collapsibleTitle={localize('general.details')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
export let network: Network
export let account: IAccountState
$: tokens = $selectedAccountTokens?.[network.id]
$: nativeTokens = $selectedAccountTokens?.[network.id]?.nativeTokens?.filter((token) => !token.hidden) ?? []
$: nfts = $ownedNfts.filter((nft) => nft.networkId === network.id && !(nft.hidden || nft.isScam))
$: address = getAddressFromAccountForNetwork(account, network.id)
$: hasTokens = tokens?.nativeTokens?.length > 0
$: hasNfts = nfts?.length > 0
let clientWidth = 0
$: numberOfTokensToDisplay = Math.min(tokens?.nativeTokens?.length ?? 0, 3)
$: numberOfTokensToDisplay = Math.min(nativeTokens.length, 3)
$: numberOfNftsToDisplay = numberOfTokensToDisplay < 3 ? 3 : clientWidth >= 260 ? 3 : 2
let formattedBalance: string
Expand Down Expand Up @@ -133,8 +130,7 @@
</account-network-summary-balance>
<account-network-summary-assets bind:clientWidth class="flex flex-row justify-between items-center">
<div class="flex items-center">
{#if hasTokens}
{@const nativeTokens = tokens?.nativeTokens ?? []}
{#if nativeTokens.length > 0}
<AvatarGroup avatarSize="md" remainder={nativeTokens.length - numberOfTokensToDisplay}>
{#each nativeTokens.slice(0, numberOfTokensToDisplay) ?? [] as token}
<TokenAvatar hideNetworkBadge size="md" {token} />
Expand All @@ -143,7 +139,7 @@
{/if}
</div>
<div class="flex items-center">
{#if hasNfts}
{#if nfts?.length > 0}
<button
on:click={() => onNftGroupClick()}
disabled={!features?.collectibles?.enabled || !$activeProfile?.features?.collectibles}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { JsonRpcResponse } from '@walletconnect/jsonrpc-types'
import { getSdkError } from '@walletconnect/utils'
import { Web3WalletTypes } from '@walletconnect/web3wallet'
import {
cachedSessionRequest,
getConnectedDappBySessionTopic,
getWalletClient,
setConnectedDapps,
Expand All @@ -19,8 +20,21 @@ import { EvmTransactionData, getEvmTransactionFromHexString } from '@core/layer-
import { activeProfileId } from '@core/profile/stores'
import { get } from 'svelte/store'
import { Platform } from '@core/app/classes'
import { showNotification } from '@auxiliary/notification'
import { localize } from '@core/i18n'

export function onSessionRequest(event: Web3WalletTypes.SessionRequest): void {
Platform.focusWindow()

if (!get(activeProfileId)) {
cachedSessionRequest.set(event)
showNotification({
variant: 'info',
text: localize('dashboard.drawers.dapps.general.loginPrompt'),
})
return
}

// We need to call this here, because if the dapp requests too fast after approval, we won't have the dapp in the store yet
setConnectedDapps()
const { topic, params, id, verifyContext } = event
Expand Down Expand Up @@ -54,13 +68,6 @@ export function onSessionRequest(event: Web3WalletTypes.SessionRequest): void {
}
}

Platform.focusWindow()

if (!get(activeProfileId)) {
returnResponse({ error: getSdkError('SESSION_SETTLEMENT_FAILED') })
return
}

const dapp = getConnectedDappBySessionTopic(topic)
const verifiedState = verifyContext.verified.isScam
? DappVerification.Scam
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Web3WalletTypes } from '@walletconnect/web3wallet'
import { Writable, writable } from 'svelte/store'

export const cachedSessionRequest: Writable<Web3WalletTypes.SessionRequest | undefined> = writable(undefined)
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './cached-session-request.store'
export * from './connected-dapps.store'
export * from './persisted-dapps.store'
export * from './persisted-dapp-namespaces.store'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import { fetchAndPersistTransactionsForAccounts } from '@core/transactions/actio
import { updateCirculatingSupplyForActiveProfile } from './updateCirculatingSupplyForActiveProfile'
import { notificationsManager } from '@auxiliary/wallet-connect/notifications'
import { getEvmNetworks } from '@core/network'
import { cachedSessionRequest } from '@auxiliary/wallet-connect/stores'
import { onSessionRequest } from '@auxiliary/wallet-connect/handlers'

export async function login(loginOptions?: ILoginOptions): Promise<void> {
const loginRouter = get(routerManager)?.getRouterForAppContext(AppContext.Login)
Expand Down Expand Up @@ -115,6 +117,13 @@ export async function login(loginOptions?: ILoginOptions): Promise<void> {

if (getLastLoggedInProfileId() !== _activeProfile.id) {
void disconnectAllDapps()
cachedSessionRequest.set(undefined)
} else {
const _cachedSessionRequest = get(cachedSessionRequest)
if (_cachedSessionRequest) {
cachedSessionRequest.set(undefined)
onSessionRequest(_cachedSessionRequest)
}
}

setSelectedAccount(lastUsedAccountIndex ?? loadedAccounts?.[0]?.index)
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
}
},
"dapps": {
"general": {
"loginPrompt": "Dapp request received while logged out. Please log in to continue."
},
"dappsList": {
"title": "Connected dApps",
"connectDapp": "Connect dApp",
Expand Down Expand Up @@ -1108,6 +1111,7 @@
"tokenApproval": {
"title": "Approve {dappName} to access {assetName}",
"hint": "{address} is requesting approval to spend {assetName}",
"warning": "You don't own any of the approved tokens. Only approve tokens you trust.",
"action": "Approve",
"success": "Successfully approved"
},
Expand Down

0 comments on commit f7ab288

Please sign in to comment.