@@ -51,6 +51,7 @@ import { ERC1155Standard } from './Standards/NftStandards/ERC1155/ERC1155Standar
5151import {
5252 fetchTokenMetadata ,
5353 TOKEN_METADATA_NO_SUPPORT_ERROR ,
54+ TokenRwaData ,
5455} from './token-service' ;
5556import type {
5657 TokenListStateChange ,
@@ -288,6 +289,9 @@ export class TokensController extends BaseController<
288289 if ( cachedToken && cachedToken . name && ! token . name ) {
289290 token . name = cachedToken . name ; // Update the token name
290291 }
292+ if ( cachedToken ?. rwaData ) {
293+ token . rwaData = cachedToken . rwaData ; // Update the token RWA data
294+ }
291295 }
292296 }
293297 }
@@ -426,6 +430,7 @@ export class TokensController extends BaseController<
426430 image,
427431 interactingAddress,
428432 networkClientId,
433+ rwaData,
429434 } : {
430435 address : string ;
431436 symbol : string ;
@@ -434,6 +439,7 @@ export class TokensController extends BaseController<
434439 image ?: string ;
435440 interactingAddress ?: string ;
436441 networkClientId : NetworkClientId ;
442+ rwaData ?: TokenRwaData ;
437443 } ) : Promise < Token [ ] > {
438444 const releaseLock = await this . #mutex. acquire ( ) ;
439445 const { allTokens, allIgnoredTokens, allDetectedTokens } = this . state ;
@@ -473,7 +479,7 @@ export class TokensController extends BaseController<
473479 isERC721,
474480 aggregators : formatAggregatorNames ( tokenMetadata ?. aggregators ?? [ ] ) ,
475481 name,
476- ...( tokenMetadata ?. rwaData && { rwaData : tokenMetadata . rwaData } ) ,
482+ ...( rwaData !== undefined && { rwaData } ) ,
477483 } ;
478484 const previousIndex = newTokens . findIndex (
479485 ( token ) => token . address . toLowerCase ( ) === address . toLowerCase ( ) ,
@@ -986,7 +992,7 @@ export class TokensController extends BaseController<
986992
987993 await this . #requestApproval( suggestedAssetMeta ) ;
988994
989- const { address, symbol, decimals, name, image } = asset ;
995+ const { address, symbol, decimals, name, image, rwaData } = asset ;
990996 await this . addToken ( {
991997 address,
992998 symbol,
@@ -995,6 +1001,7 @@ export class TokensController extends BaseController<
9951001 image,
9961002 interactingAddress : suggestedAssetMeta . interactingAddress ,
9971003 networkClientId,
1004+ rwaData,
9981005 } ) ;
9991006 }
10001007
0 commit comments