@@ -44,9 +44,12 @@ import BN from 'bn.js';
44
44
import { v4 as random } from 'uuid' ;
45
45
46
46
import type {
47
- AssetsContractControllerGetERC1155StandardAction ,
48
- AssetsContractControllerGetERC20StandardAction ,
49
- AssetsContractControllerGetERC721StandardAction ,
47
+ AssetsContractControllerGetERC1155BalanceOfAction ,
48
+ AssetsContractControllerGetERC1155TokenURIAction ,
49
+ AssetsContractControllerGetERC721AssetNameAction ,
50
+ AssetsContractControllerGetERC721AssetSymbolAction ,
51
+ AssetsContractControllerGetERC721OwnerOfAction ,
52
+ AssetsContractControllerGetERC721TokenURIAction ,
50
53
} from './AssetsContractController' ;
51
54
import { compareNftMetadata , getFormattedIpfsUrl } from './assetsUtil' ;
52
55
import { Source } from './constants' ;
@@ -227,9 +230,12 @@ export type AllowedActions =
227
230
| AccountsControllerGetAccountAction
228
231
| AccountsControllerGetSelectedAccountAction
229
232
| NetworkControllerGetNetworkClientByIdAction
230
- | AssetsContractControllerGetERC20StandardAction
231
- | AssetsContractControllerGetERC721StandardAction
232
- | AssetsContractControllerGetERC1155StandardAction ;
233
+ | AssetsContractControllerGetERC721AssetNameAction
234
+ | AssetsContractControllerGetERC721AssetSymbolAction
235
+ | AssetsContractControllerGetERC721TokenURIAction
236
+ | AssetsContractControllerGetERC721OwnerOfAction
237
+ | AssetsContractControllerGetERC1155BalanceOfAction
238
+ | AssetsContractControllerGetERC1155TokenURIAction ;
233
239
234
240
export type AllowedEvents =
235
241
| PreferencesControllerStateChangeEvent
@@ -657,19 +663,25 @@ export class NftController extends BaseController<
657
663
) : Promise < [ string , string ] > {
658
664
// try ERC721 uri
659
665
try {
660
- const uri = await this . messagingSystem
661
- . call ( 'AssetsContractController:getERC721Standard' , networkClientId )
662
- . getTokenURI ( contractAddress , tokenId ) ;
666
+ const uri = await this . messagingSystem . call (
667
+ 'AssetsContractController:getERC721TokenURI' ,
668
+ contractAddress ,
669
+ tokenId ,
670
+ networkClientId ,
671
+ ) ;
663
672
return [ uri , ERC721 ] ;
664
673
} catch {
665
674
// Ignore error
666
675
}
667
676
668
677
// try ERC1155 uri
669
678
try {
670
- const tokenURI = await this . messagingSystem
671
- . call ( 'AssetsContractController:getERC1155Standard' , networkClientId )
672
- . getTokenURI ( contractAddress , tokenId ) ;
679
+ const tokenURI = await this . messagingSystem . call (
680
+ 'AssetsContractController:getERC1155TokenURI' ,
681
+ contractAddress ,
682
+ tokenId ,
683
+ networkClientId ,
684
+ ) ;
673
685
674
686
/**
675
687
* According to EIP1155 the URI value allows for ID substitution
@@ -750,12 +762,16 @@ export class NftController extends BaseController<
750
762
Pick < ApiNftContract , 'collection' >
751
763
> {
752
764
const [ name , symbol ] = await Promise . all ( [
753
- this . messagingSystem
754
- . call ( 'AssetsContractController:getERC721Standard' , networkClientId )
755
- . getAssetName ( contractAddress ) ,
756
- this . messagingSystem
757
- . call ( 'AssetsContractController:getERC721Standard' , networkClientId )
758
- . getAssetSymbol ( contractAddress ) ,
765
+ this . messagingSystem . call (
766
+ 'AssetsContractController:getERC721AssetName' ,
767
+ contractAddress ,
768
+ networkClientId ,
769
+ ) ,
770
+ this . messagingSystem . call (
771
+ 'AssetsContractController:getERC721AssetSymbol' ,
772
+ contractAddress ,
773
+ networkClientId ,
774
+ ) ,
759
775
] ) ;
760
776
761
777
return {
@@ -1329,9 +1345,12 @@ export class NftController extends BaseController<
1329
1345
) : Promise < boolean > {
1330
1346
// Checks the ownership for ERC-721.
1331
1347
try {
1332
- const owner = await this . messagingSystem
1333
- . call ( 'AssetsContractController:getERC721Standard' , networkClientId )
1334
- . getOwnerOf ( nftAddress , tokenId ) ;
1348
+ const owner = await this . messagingSystem . call (
1349
+ 'AssetsContractController:getERC721OwnerOf' ,
1350
+ nftAddress ,
1351
+ tokenId ,
1352
+ networkClientId ,
1353
+ ) ;
1335
1354
return ownerAddress . toLowerCase ( ) === owner . toLowerCase ( ) ;
1336
1355
// eslint-disable-next-line no-empty
1337
1356
} catch {
@@ -1340,9 +1359,13 @@ export class NftController extends BaseController<
1340
1359
1341
1360
// Checks the ownership for ERC-1155.
1342
1361
try {
1343
- const balance = await this . messagingSystem
1344
- . call ( 'AssetsContractController:getERC1155Standard' , networkClientId )
1345
- . getBalanceOf ( ownerAddress , nftAddress , tokenId ) ;
1362
+ const balance = await this . messagingSystem . call (
1363
+ 'AssetsContractController:getERC1155BalanceOf' ,
1364
+ ownerAddress ,
1365
+ nftAddress ,
1366
+ tokenId ,
1367
+ networkClientId ,
1368
+ ) ;
1346
1369
return ! balance . isZero ( ) ;
1347
1370
// eslint-disable-next-line no-empty
1348
1371
} catch {
0 commit comments