-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into refactor/market-currency
- Loading branch information
Showing
17 changed files
with
297 additions
and
184 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
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
17 changes: 14 additions & 3 deletions
17
packages/desktop/views/dashboard/collectibles/components/CollectiblesTabs.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 |
---|---|---|
@@ -1,13 +1,24 @@ | ||
<script lang="ts"> | ||
import { Tabs } from '@bloomwalletio/ui' | ||
import { COLLECTIBLES_TABS } from '@core/nfts' | ||
import { selectedCollectiblesTab } from '@core/nfts/stores' | ||
import { KeyValue } from '@ui' | ||
import features from '@features/features' | ||
import { localize } from '@core/i18n' | ||
const selectedIndex = COLLECTIBLES_TABS.findIndex((tab) => tab.key === $selectedCollectiblesTab?.key) | ||
const COLLECTIBLES_TABS: KeyValue<string>[] = [ | ||
{ key: 'collectibles', value: localize('views.collectibles.gallery.title') }, | ||
...(features.collectibles?.collections.enabled | ||
? [{ key: 'collections', value: localize('views.collectibles.collectionsGallery.title') }] | ||
: []), | ||
] | ||
</script> | ||
|
||
{#if COLLECTIBLES_TABS.length > 1} | ||
<div class="w-64"> | ||
<Tabs {selectedIndex} bind:selectedTab={$selectedCollectiblesTab} tabs={COLLECTIBLES_TABS} /> | ||
<Tabs | ||
bind:selectedIndex={$selectedCollectiblesTab} | ||
selectedTab={COLLECTIBLES_TABS[$selectedCollectiblesTab]} | ||
tabs={COLLECTIBLES_TABS} | ||
/> | ||
</div> | ||
{/if} |
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
46 changes: 46 additions & 0 deletions
46
packages/shared/src/lib/auxiliary/wallet-connect/actions/addAccountToAllDappSessions.ts
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,46 @@ | ||
import { IAccountState, getAddressFromAccountForNetwork } from '@core/account' | ||
import { get } from 'svelte/store' | ||
import { ISupportedNamespace } from '../types' | ||
import { getWalletClient, walletClient } from '../stores' | ||
import { EvmNetworkId } from '@core/network/types' | ||
import { buildCaip10Address } from '../utils' | ||
import { connectedDapps } from '../stores' | ||
|
||
export async function addAccountToAllDappSessions(account: IAccountState): Promise<void> { | ||
const dapps = get(connectedDapps) | ||
for (const dapp of dapps) { | ||
if (dapp.sessionTopic && dapp.namespaces) { | ||
await addAccountForDappSession(dapp.sessionTopic, dapp.namespaces, account) | ||
} | ||
} | ||
} | ||
|
||
export async function addAccountForDappSession( | ||
sessionTopic: string, | ||
namespaces: Record<string, ISupportedNamespace>, | ||
account: IAccountState | ||
): Promise<void> { | ||
const walletConnectClient = get(walletClient) | ||
if (!walletConnectClient) { | ||
return | ||
} | ||
|
||
const protocols = Object.keys(namespaces ?? {}) | ||
for (const protocol of protocols) { | ||
if (!namespaces[protocol]) { | ||
continue | ||
} | ||
|
||
const chainsForSession = (namespaces[protocol].chains ?? []) as EvmNetworkId[] | ||
const addressOfAccountForEachChain = chainsForSession | ||
.map((chainId) => { | ||
const address = getAddressFromAccountForNetwork(account, chainId) | ||
return address ? buildCaip10Address(address, chainId) : undefined | ||
}) | ||
.filter(Boolean) as string[] | ||
|
||
namespaces[protocol].accounts = [...addressOfAccountForEachChain, ...namespaces[protocol].accounts] | ||
} | ||
|
||
await getWalletClient()?.updateSession({ topic: sessionTopic, namespaces }) | ||
} |
1 change: 1 addition & 0 deletions
1
packages/shared/src/lib/auxiliary/wallet-connect/actions/index.ts
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
7 changes: 0 additions & 7 deletions
7
packages/shared/src/lib/core/nfts/constants/collectibles-tabs.constant.ts
This file was deleted.
Oops, something went wrong.
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
4 changes: 1 addition & 3 deletions
4
packages/shared/src/lib/core/nfts/stores/selected-collectibles-tabs.store.ts
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import { KeyValue } from '@ui' | ||
import { Writable, writable } from 'svelte/store' | ||
import { COLLECTIBLES_TABS } from '../constants' | ||
|
||
export const selectedCollectiblesTab: Writable<KeyValue<string>> = writable(COLLECTIBLES_TABS[0]) | ||
export const selectedCollectiblesTab: Writable<number> = writable(0) |
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.