Repository: alchemyplatform/alchemy-sdk-js (ts)

Issue:
missing `title` field in `ContractForOwner`
### [REQUIRED] Environment

- Alchemy SDK version: 2.6.0

### [REQUIRED] Describe the problem

There is the field `title` in json of response. But there is no `title` field inside of `ContractForOwner` in SDK.

![image](https://user-images.githubusercontent.com/9107889/223433183-db3d7326-25e1-473a-a45c-5e1dc3e48a0c.png)



Pull request:
Add title field to ContractForOwner
Fixes #278.

This PR adds the `title` field to the `ContractForOwner` interface returned by `NftNamespace.getContractsForOwner`. The field represents the title of the NFT owned by the owner

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afa4ffbc..bff0f305 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
 
 ### Minor Changes
 
+- Added the `title` field to `ContractForOwner` to represent the title of the token held by the owner.
 - Fixed a bug where the `media` field in `ContractForOwner` was a `Media` object rather than a `Media[]` array.
 
 ## 2.6.0
diff --git a/src/internal/raw-interfaces.ts b/src/internal/raw-interfaces.ts
index 2b153ec6..901cd546 100644
--- a/src/internal/raw-interfaces.ts
+++ b/src/internal/raw-interfaces.ts
@@ -312,6 +312,7 @@ export interface RawContractForOwner
   address: string;
   totalBalance: number;
   numDistinctTokensOwned: number;
+  title: string;
   isSpam: boolean;
   tokenId: string;
   media: Media[];
diff --git a/src/types/types.ts b/src/types/types.ts
index dd9d7a70..d96b1e27 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -1029,6 +1029,9 @@ export interface ContractForOwner extends NftContract {
    */
   totalBalance: number;
 
+  /** The title of the token held by the owner. */
+  title: string;
+
   /**
    * Number of distinct token IDs held by the owner. For non-fungible tokens
    * this will be equal to the totalBalance, but it may be lower if the user
diff --git a/src/util/util.ts b/src/util/util.ts
index 92cfc5af..f64c9762 100644
--- a/src/util/util.ts
+++ b/src/util/util.ts
@@ -187,6 +187,7 @@ export function getContractsForOwnerFromRaw(
         tokenId: contract.tokenId,
         totalBalance: contract.totalBalance,
         name: contract.name,
+        title: contract.title,
         openSea: parseOpenSeaMetadata(contract?.opensea),
         symbol: contract?.symbol,
         tokenType: parseNftTokenType(contract?.tokenType),


Test patch:
diff --git a/test/test-util.ts b/test/test-util.ts
index 7ac01cfd..a92f707a 100644
--- a/test/test-util.ts
+++ b/test/test-util.ts
@@ -242,7 +242,8 @@ export function createRawContractForOwner(
   totalSupply?: string,
   opensea?: RawOpenSeaCollectionMetadata,
   contractDeployer?: string,
-  deployedBlockNumber?: number
+  deployedBlockNumber?: number,
+  title = 'NFT Title'
 ): RawContractForOwner {
   return {
     address,
@@ -252,6 +253,7 @@ export function createRawContractForOwner(
     totalBalance: 1,
     numDistinctTokensOwned: 1,
     name,
+    title,
     totalSupply,
     opensea,
     symbol,
diff --git a/test/unit/nft-api.test.ts b/test/unit/nft-api.test.ts
index 755df231..c1196c56 100644
--- a/test/unit/nft-api.test.ts
+++ b/test/unit/nft-api.test.ts
@@ -1155,6 +1155,7 @@ describe('NFT module', () => {
     const contractAddress = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d';
     const tokenId = '27';
     const name = 'NFT Contract Name';
+    const title = 'NFT Title';
     const symbol = 'XNO';
     const totalContractCount = 3;
     const totalSupply = '1492';
@@ -1195,7 +1196,8 @@ describe('NFT module', () => {
           totalSupply,
           rawOpenSeaContractMetadata,
           contractDeployer,
-          deployedBlockNumber
+          deployedBlockNumber,
+          title
         )
       ]
     };
@@ -1239,6 +1241,7 @@ describe('NFT module', () => {
       expect(result.contracts[2].address).toEqual(contractAddress);
       expect(result.contracts[2].tokenId).toEqual(tokenId);
       expect(result.contracts[2].name).toEqual(name);
+      expect(result.contracts[2].title).toEqual(title);
       expect(result.contracts[2].tokenType).toEqual(NftTokenType.ERC1155);
       expect(result.contracts[2].symbol).toEqual(symbol);
       expect(result.contracts[2].openSea).toEqual(expectedOpenseaMetadata);