You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parameterize NftController.addNft by networkClientId (#1698)
Fixes: MetaMask/MetaMask-planning#1022
# Changelog
## @metamask/assets-controllers
- **BREAKING:** `NFTController` now expects `getNetworkClientById` in
constructor options
- **BREAKING:** `NftController. addNft()` function signature has
changed:
- Previously
```
address: string,
tokenId: string,
nftMetadata?: NftMetadata,
accountParams?: {
userAddress: string;
chainId: Hex;
},
source = Source.Custom,
```
now:
```
tokenAddress: string,
tokenId: string,
{
nftMetadata?: NftMetadata;
chainId?: Hex; // extracts from AccountParams
userAddress?: string // extracted from AccountParams
source?: Source;
networkClientId?: NetworkClientId; // new
},
```
- CHANGED: `NftController.addNftVerifyOwnership`: now accepts optional
`networkClientId` which is used to fetch NFT metadata and determine by
which chainId the added NFT should be stored in state.
- CHANGED: `NftController.isNftOwner`: now accepts optional
`networkClientId` which is used to instantiate the provider for the
correct chain and call the NFT contract to verify ownership.
- CHANGED: `NftController. addNft()` will use the chainId value derived
from `networkClientId` if provided
- CHANGED: `NftController. watchNft()` options now accepts optional
`networkClientId` which is used to fetch NFT metadata and determine by
which chainId the added NFT should be stored in state.
0 commit comments