@@ -64,6 +64,14 @@ import AssetList from './AssetList';
64
64
import { Search } from './asset-picker-modal-search' ;
65
65
import { AssetPickerModalNetwork } from './asset-picker-modal-network' ;
66
66
67
+ type TokenListGenerator = Generator <
68
+ | AssetWithDisplayData < NativeAsset >
69
+ | ( ( Token | TokenListToken ) & {
70
+ balance ?: string ;
71
+ string ?: string ;
72
+ } )
73
+ > ;
74
+
67
75
type AssetPickerModalProps = {
68
76
header : JSX . Element | string | null ;
69
77
isOpen : boolean ;
@@ -77,6 +85,7 @@ type AssetPickerModalProps = {
77
85
*/
78
86
sendingAsset ?: { image : string ; symbol : string } | undefined ;
79
87
onNetworkPickerClick ?: ( ) => void ;
88
+ tokenListGenerator ?: ( ) => TokenListGenerator ;
80
89
} & Pick <
81
90
React . ComponentProps < typeof AssetPickerModalTabs > ,
82
91
'visibleTabs' | 'defaultActiveTabKey'
@@ -94,6 +103,7 @@ export function AssetPickerModal({
94
103
sendingAsset,
95
104
network,
96
105
onNetworkPickerClick,
106
+ tokenListGenerator,
97
107
...tabProps
98
108
} : AssetPickerModalProps ) {
99
109
const t = useI18nContext ( ) ;
@@ -164,6 +174,10 @@ export function AssetPickerModal({
164
174
} , [ tokensWithBalances , tokens ] ) ;
165
175
166
176
const tokenGenerator = useCallback ( ( ) => {
177
+ if ( tokenListGenerator ) {
178
+ return tokenListGenerator ( ) ;
179
+ }
180
+
167
181
const nativeToken : AssetWithDisplayData < NativeAsset > = {
168
182
address : null ,
169
183
symbol : nativeCurrency ,
@@ -174,13 +188,7 @@ export function AssetPickerModal({
174
188
type : AssetType . native ,
175
189
} ;
176
190
177
- return ( function * ( ) : Generator <
178
- | AssetWithDisplayData < NativeAsset >
179
- | ( ( Token | TokenListToken ) & {
180
- balance ?: string ;
181
- string ?: string ;
182
- } )
183
- > {
191
+ return ( function * ( ) : TokenListGenerator {
184
192
yield nativeToken ;
185
193
186
194
const blockedTokens = [ ] ;
@@ -215,6 +223,7 @@ export function AssetPickerModal({
215
223
nativeCurrencyImage ,
216
224
balanceValue ,
217
225
memoizedUsersTokens ,
226
+ tokenListGenerator ,
218
227
topTokens ,
219
228
tokenList ,
220
229
getIsDisabled ,
0 commit comments