Skip to content

Commit 61c6634

Browse files
evavirsedacpl121begonaalvarezd
authored
feat: update deposit address to selected created explicit account (#7907)
* feat: add account to routes * feat: add to analytics featureflag * fix: update naming * feat: update wallet state to accomodate accounts * feat: update events to accomodate accounts WIP * feat: improve validate wallet api event * feat: improve imports * fix merge * feat: remove duplicate implicitAccountCreationRouter * perf: update todo comment for getDepositAddress function * feat: update dashboard to route to dashboard or implicit flow based on wallet status * feat: update event to walletEvent * feat: update subscribeToWalletApiEventsForActiveProfile with new WalletEvent * fix: move onDestroy to the last view of implicit account creation * perf: hasAccount reactive * perf: rename accountsOutput and implicitAccountsOutput * fix: undo unsubscribeFromWalletApiEvents place * perf: add implicit account logic to handleNewOutputEventInternal * feat: imporve isImplicitAccountOutput logic * feat: uopdate depositAddress to selected explicit acocunt * fix: get depositAddres * fix function and remove arguments * fix: update comment * fix: update depositAddress * fix: remove comment and constant * fix: remove duplicated code * fix: bring back arg --------- Co-authored-by: cpl121 <[email protected]> Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
1 parent 903d563 commit 61c6634

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/shared/lib/core/wallet/actions/events-handlers/handleNewOutputEvent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
AddressType,
99
AddressUnlockCondition,
1010
} from '@iota/sdk/out/types'
11-
1211
import { addNftsToDownloadQueue, addOrUpdateNftInAllAccountNfts, buildNftFromNftOutput } from '@core/nfts'
1312
import { checkAndRemoveProfilePicture } from '@core/profile/actions'
1413
import {
@@ -26,6 +25,7 @@ import {
2625
addActivitiesToWalletActivitiesInAllWalletActivities,
2726
WalletApiEventHandler,
2827
updateSelectedWallet,
28+
getDepositAddress,
2929
} from '@core/wallet'
3030
import { get } from 'svelte/store'
3131
import { activeWallets, updateActiveWallet } from '@core/profile'
@@ -103,8 +103,10 @@ export async function handleNewOutputEventInternal(walletId: string, payload: Ne
103103

104104
if (isAccountOutput) {
105105
const accounts = await wallet.accounts()
106+
const depositAddress = await getDepositAddress(wallet)
106107
updateSelectedWallet({
107108
accountOutputs: accounts,
109+
depositAddress,
108110
})
109111
}
110112
}
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { IWallet } from '@core/profile/interfaces'
1+
import { AccountOutput } from '@iota/sdk'
2+
import { IWallet } from '../../profile/interfaces'
23

3-
// TODO(2.0): the implementation is incorrect, the deposit address should be the address of the selected block issuer account output , not the ed25519 address
4-
export function getDepositAddress(wallet: IWallet): Promise<string> {
5-
return wallet.address()
4+
// TODO(2.0): Update the implementation to handle multiple accounts and use the selected account's address.
5+
export async function getDepositAddress(wallet: IWallet): Promise<string> {
6+
const accounts = await wallet?.accounts()
7+
if (accounts?.length) {
8+
return (accounts[0]?.output as AccountOutput).accountId ?? ''
9+
} else {
10+
return ''
11+
}
612
}

0 commit comments

Comments
 (0)