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

Issue:
nft.getContractsForOwner does not support pageSize parameter
### [REQUIRED] Environment

- Browser version: any
- Alchemy SDK version: 2.4.3

### [REQUIRED] Describe the problem

Method `nft.getContractsForOwner` does not support the `pageSize` parameter, although the HTTP endpoint does.

#### How to reproduce:

1. Run this:
```
const alchemy = new Alchemy({
  apiKey: 'YOUR_API_KEY',
  network: Network.ETH_MAINNET
})

alchemy.nft.getContractsForOwner('SOME_CONTRACT_ADDRESS', {
  pageSize: 10 // This line not only gives a TypeScript error but also, when suppressed, doesn't pass the parameter to the underlying HTTP call
})
```

2. Go to browser console and find the relevant request.
3. No `pageSize` parameter is passed

#### Relevant code or sample repro:


Pull request:
Add pageSize parameter to getContractsForOwner()
Fixes #269.

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0aac2385..8d26b14d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
 
 ### Minor Changes
 - Added exports for Ethers.js types and interfaces used by the SDK.
+- Added the `pageSize` parameter to the `NftNamespace.getContractsForOwner()` method.
 
 ## 2.4.3
 
diff --git a/src/internal/nft-api.ts b/src/internal/nft-api.ts
index 9ade3764..466fd577 100644
--- a/src/internal/nft-api.ts
+++ b/src/internal/nft-api.ts
@@ -310,6 +310,7 @@ export async function getContractsForOwner(
     excludeFilters: options?.excludeFilters,
     includeFilters: options?.includeFilters,
     pageKey: options?.pageKey,
+    pageSize: options?.pageSize,
     orderBy: options?.orderBy
   });
 
@@ -931,6 +932,7 @@ interface GetOwnersForNftContractAlchemyParams {
 interface GetContractsForOwnerParams {
   owner: string;
   pageKey?: string;
+  pageSize?: number;
   includeFilters?: NftFilters[];
   excludeFilters?: NftFilters[];
   orderBy?: NftOrdering;
diff --git a/src/types/types.ts b/src/types/types.ts
index 38164583..1f2d41e3 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -977,6 +977,12 @@ export interface GetContractsForOwnerOptions {
   /** Key for pagination to use to fetch results from the next page if available. */
   pageKey?: string;
 
+  /**
+   * Configure the number of NFTs to return in each response. Maximum pages size
+   * is 100. Defaults to 100.
+   */
+  pageSize?: number;
+
   /**
    * Optional list of filters applied to the query. NFTs that match one or more
    * of these filters are included in the response. May not be used in


Test patch:
diff --git a/test/integration/nft.test.ts b/test/integration/nft.test.ts
index 93649387..a5ce9a96 100644
--- a/test/integration/nft.test.ts
+++ b/test/integration/nft.test.ts
@@ -200,11 +200,14 @@ describe('E2E integration tests', () => {
     verifyNftContractMetadata(response.contracts[0]);
   });
 
-  it('getContractsForOwner() with pageKey', async () => {
-    const firstPage = await alchemy.nft.getContractsForOwner(ownerEns);
+  it('getContractsForOwner() with pageKey and pageSize', async () => {
+    const firstPage = await alchemy.nft.getContractsForOwner(ownerEns, {
+      pageSize: 4
+    });
 
     expect(firstPage.pageKey).toBeDefined();
     expect(typeof firstPage.pageKey).toEqual('string');
+    expect(firstPage.contracts.length).toEqual(4);
 
     const response = await alchemy.nft.getContractsForOwner(ownerEns, {
       pageKey: firstPage?.pageKey
diff --git a/test/unit/nft-api.test.ts b/test/unit/nft-api.test.ts
index 71cc4d80..755df231 100644
--- a/test/unit/nft-api.test.ts
+++ b/test/unit/nft-api.test.ts
@@ -1207,7 +1207,8 @@ describe('NFT module', () => {
     it.each<[keyof GetContractsForOwnerOptions, any]>([
       ['excludeFilters', [NftFilters.AIRDROPS]],
       ['includeFilters', [NftFilters.SPAM]],
-      ['pageKey', 'a-page-key']
+      ['pageKey', 'a-page-key'],
+      ['pageSize', 50]
     ])('calls with the correct parameters', async (fieldName, value) => {
       await alchemy.nft.getContractsForOwner(owner, {
         [fieldName]: value