11import { type BN } from '@polkadot/util' ;
2- import { useUnit } from 'effector-react' ;
32import { type TFunction } from 'i18next' ;
43import { memo , useMemo } from 'react' ;
54
65import {
6+ type Address ,
77 type Asset ,
88 type AssetByChains ,
99 type Chain ,
1010 type ChainId ,
1111 type FlexibleMultisigAccount ,
1212 type MultisigAccount ,
13+ type Wallet ,
1314} from '@/shared/core' ;
1415import { createTransformer , useTransformer } from '@/shared/di' ;
1516import { useI18n } from '@/shared/i18n' ;
1617import { formatSectionAndMethod , toAddress , toShortAddress } from '@/shared/lib/utils' ;
1718import { Accordion , FootnoteText , HelpText } from '@/shared/ui' ;
1819import { IconButton } from '@/shared/ui/Buttons' ;
1920import { AssetBalance , AssetIcon , WalletAccountIcon } from '@/shared/ui-entities' ;
20- import { Copy , Tooltip } from '@/shared/ui-kit' ;
21+ import { AsyncItem , Copy , Tooltip } from '@/shared/ui-kit' ;
2122import { type MultisigOperation , useWalletName } from '@/domains/network' ;
2223import { ChainTitle , XcmChains } from '@/entities/chain' ;
23- import { networkModel } from '@/entities/network' ;
2424import { OperationTitleStatus } from '@/entities/operations' ;
2525import { AssetFiatBalance } from '@/entities/price' ;
2626import {
@@ -29,7 +29,7 @@ import {
2929 getTransactionAmount ,
3030 useTransactionAsset ,
3131} from '@/entities/transaction' ;
32- import { accountUtils , walletModel } from '@/entities/wallet' ;
32+ import { accountUtils } from '@/entities/wallet' ;
3333import { type TabFilter } from '../model/context' ;
3434import { deepLinkModel } from '../model/deep-link' ;
3535
@@ -42,6 +42,8 @@ type Props = {
4242 multisigAccount : MultisigAccount | FlexibleMultisigAccount ;
4343 isDefaultOpen ?: boolean ;
4444 tab : TabFilter ;
45+ chains : Record < ChainId , Chain > ;
46+ wallets : Wallet [ ] ;
4547} ;
4648
4749export type OperationTitle = {
@@ -65,16 +67,27 @@ export const operationTitleTransformer = createTransformer<
6567 OperationTitle
6668> ( ) ;
6769
68- export const Operation = memo ( ( { operation, multisigAccount, isDefaultOpen = false , tab } : Props ) => {
70+ const OperationWalletInfo = ( { wallet, accountAddress } : { wallet : Wallet ; accountAddress : Address } ) => {
71+ const walletName = useWalletName ( wallet ) ;
72+
73+ return (
74+ < div className = "flex w-[240px] items-center gap-x-2" >
75+ < WalletAccountIcon address = { accountAddress } type = { wallet . type } size = { 32 } iconSize = { 14 } />
76+ < div className = "flex min-w-0 flex-col items-start gap-y-0.5" >
77+ < FootnoteText className = "truncate text-text-primary" > { walletName } </ FootnoteText >
78+ < HelpText className = "text-text-tertiary" > { toShortAddress ( accountAddress , 6 ) } </ HelpText >
79+ </ div >
80+ </ div >
81+ ) ;
82+ } ;
83+
84+ export const Operation = memo ( ( { operation, multisigAccount, isDefaultOpen = false , tab, chains, wallets } : Props ) => {
6985 const { t } = useI18n ( ) ;
70- const chains = useUnit ( networkModel . $chains ) ;
71- const wallets = useUnit ( walletModel . $wallets ) ;
7286
7387 const wallet = useMemo (
7488 ( ) => wallets . find ( w => w . id === multisigAccount . walletId ) ,
7589 [ wallets , multisigAccount . walletId ] ,
7690 ) ;
77- const walletName = useWalletName ( wallet ) ;
7891
7992 const isFlexibleMultisigAccount = accountUtils . isFlexibleMultisigAccount ( multisigAccount ) ;
8093 const coreTx = isFlexibleMultisigAccount ? findCoreTransaction ( operation . transaction ) : operation . transaction ;
@@ -134,32 +147,32 @@ export const Operation = memo(({ operation, multisigAccount, isDefaultOpen = fal
134147 < AssetIcon asset = { titleData . amount . asset } size = { 32 } />
135148 < div className = "flex flex-col items-start gap-y-0.5" >
136149 < AssetBalance value = { titleData . amount . value } asset = { titleData . amount . asset } />
137- < AssetFiatBalance
138- asset = { titleData . amount . asset }
139- amount = { titleData . amount . value }
140- className = "text-help-text text-text-tertiary"
141- />
150+ < AsyncItem strategy = "async" fallback = { < div className = "h-[18px]" /> } >
151+ < AssetFiatBalance
152+ asset = { titleData . amount . asset }
153+ amount = { titleData . amount . value }
154+ className = "text-help-text text-text-tertiary"
155+ />
156+ </ AsyncItem >
142157 </ div >
143158 </ div >
144159 ) }
145160 </ div >
146161
147162 < div className = "flex min-w-0 flex-1 items-center justify-between" >
148- { wallet && accountAddress ? (
149- < div className = "flex w-[240px] items-center gap-x-2" >
150- < WalletAccountIcon address = { accountAddress } type = { wallet . type } size = { 32 } iconSize = { 14 } />
151- < div className = "flex min-w-0 flex-col items-start gap-y-0.5" >
152- < FootnoteText className = "truncate text-text-primary" > { walletName } </ FootnoteText >
153- < HelpText className = "text-text-tertiary" > { toShortAddress ( accountAddress , 6 ) } </ HelpText >
154- </ div >
155- </ div >
156- ) : (
157- < div className = "w-[240px]" />
158- ) }
163+ < AsyncItem strategy = "async" fallback = { < div className = "w-[240px]" /> } >
164+ { wallet && accountAddress ? (
165+ < OperationWalletInfo wallet = { wallet } accountAddress = { accountAddress } />
166+ ) : (
167+ < div className = "w-[240px]" />
168+ ) }
169+ </ AsyncItem >
159170
160171 < OperationTitleStatus operation = { operation } account = { multisigAccount } />
161172
162- < OperationActions operation = { operation } account = { multisigAccount } />
173+ < AsyncItem strategy = "async" fallback = { < div /> } >
174+ < OperationActions operation = { operation } account = { multisigAccount } />
175+ </ AsyncItem >
163176 </ div >
164177
165178 < Tooltip >
0 commit comments