Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterize NftController.addNft by networkClientId #1698

Merged
merged 17 commits into from
Sep 29, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Sep 21, 2023

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/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.

@adonesky1 adonesky1 force-pushed the nftcontroller-multichain branch 5 times, most recently from 9189fba to a9977b8 Compare September 25, 2023 20:57
@adonesky1 adonesky1 marked this pull request as ready for review September 25, 2023 21:32
@adonesky1 adonesky1 requested a review from a team as a code owner September 25, 2023 21:32
@adonesky1 adonesky1 merged commit c9b2cc7 into main Sep 29, 2023
107 checks passed
@adonesky1 adonesky1 deleted the nftcontroller-multichain branch September 29, 2023 15:21
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
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.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants