nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: algolia/algoliasearch-client-go
Pull request #636 (2020-11-23 11:22:25)

feat: add filters rule condition
| Q                 | A
| ----------------- | ----------
| Bug fix?          | no
| New feature?      | yes
| BC breaks?        | no     
| Need Doc update   | yes


## Describe your change

Add `filters` field as a query rule condition


Patch:
diff --git a/algolia/search/rule_condition.go b/algolia/search/rule_condition.go
index 791829a1..9cbe41d4 100644
--- a/algolia/search/rule_condition.go
+++ b/algolia/search/rule_condition.go
@@ -7,6 +7,7 @@ type RuleCondition struct {
 	Pattern      string
 	Context      string
 	Alternatives *Alternatives
+	Filters      string
 }
 
 func (c RuleCondition) MarshalJSON() ([]byte, error) {
@@ -21,6 +22,9 @@ func (c RuleCondition) MarshalJSON() ([]byte, error) {
 	if c.Alternatives != nil {
 		m["alternatives"] = *c.Alternatives
 	}
+	if c.Filters != "" {
+		m["filters"] = c.Filters
+	}
 	return json.Marshal(m)
 }
 


Test patch:
diff --git a/algolia/search/rule_condition_test.go b/algolia/search/rule_condition_test.go
index e05becd8..3fadd023 100644
--- a/algolia/search/rule_condition_test.go
+++ b/algolia/search/rule_condition_test.go
@@ -22,6 +22,7 @@ func TestRuleCondition_MarshalJSON(t *testing.T) {
 				Pattern:      "",
 				Context:      "",
 				Alternatives: nil,
+				Filters:      "",
 			},
 			`{}`,
 		},
@@ -31,6 +32,7 @@ func TestRuleCondition_MarshalJSON(t *testing.T) {
 				Pattern:      "",
 				Context:      "",
 				Alternatives: nil,
+				Filters:      "",
 			},
 			`{"anchoring": "is", "pattern": ""}`,
 		},
@@ -40,6 +42,7 @@ func TestRuleCondition_MarshalJSON(t *testing.T) {
 				Pattern:      "Pattern",
 				Context:      "",
 				Alternatives: nil,
+				Filters:      "",
 			},
 			`{"anchoring": "", "pattern": "Pattern"}`,
 		},
@@ -49,6 +52,7 @@ func TestRuleCondition_MarshalJSON(t *testing.T) {
 				Pattern:      "Pattern",
 				Context:      "Context",
 				Alternatives: AlternativesEnabled(),
+				Filters:      "",
 			},
 			`{"anchoring": "is", "pattern": "Pattern", "context": "Context", "alternatives": true}`,
 		},
@@ -58,9 +62,30 @@ func TestRuleCondition_MarshalJSON(t *testing.T) {
 				Pattern:      "Pattern",
 				Context:      "Context",
 				Alternatives: AlternativesDisabled(),
+				Filters:      "",
 			},
 			`{"anchoring": "is", "pattern": "Pattern", "context": "Context", "alternatives": false}`,
 		},
+		{
+			RuleCondition{
+				Anchoring:    "",
+				Pattern:      "",
+				Context:      "",
+				Alternatives: nil,
+				Filters:      "type:house AND (amenity:fireplace OR amenity:place)",
+			},
+			`{"filters": "type:house AND (amenity:fireplace OR amenity:place)"}`,
+		},
+		{
+			RuleCondition{
+				Anchoring:    Is,
+				Pattern:      "",
+				Context:      "Context",
+				Alternatives: nil,
+				Filters:      "type:house AND (amenity:fireplace OR amenity:place)",
+			},
+			`{"anchoring": "is", "pattern": "", "context": "Context", "filters": "type:house AND (amenity:fireplace OR amenity:place)"}`,
+		},
 	} {
 		// Encode the RuleCondition to JSON
 		data, err := json.Marshal(c.condition)
Repository: algolia/algoliasearch-client-go
Pull request #649 (2021-02-23 14:23:55)

feat(Transport): improve error message on unmarshalTo errors
| Q                 | A
| ----------------- | ----------
| Bug fix?          | no
| New feature?      | no
| BC breaks?        | no     
| Need Doc update   | no


## Describe your change

Improve error message on unmarshalTo errors

## What problem is this fixing?

When the client is unable to deserialize a response, there's currently no way to know the original message and what it contains. This PR will improve it.



Patch:
diff --git a/algolia/transport/transport.go b/algolia/transport/transport.go
index 73855f15..b3ec24b1 100644
--- a/algolia/transport/transport.go
+++ b/algolia/transport/transport.go
@@ -7,6 +7,7 @@ import (
 	"errors"
 	"fmt"
 	"io"
+	"io/ioutil"
 	"net"
 	"net/http"
 	"runtime"
@@ -302,10 +303,14 @@ func buildRequest(
 }
 
 func unmarshalTo(r io.ReadCloser, v interface{}) error {
-	err := json.NewDecoder(r).Decode(&v)
+	body, err := ioutil.ReadAll(r)
 	errClose := r.Close()
 	if err != nil {
-		return fmt.Errorf("cannot deserialize response's body: %v", err)
+		return fmt.Errorf("cannot read body: %v", err)
+	}
+	err = json.Unmarshal(body, &v)
+	if err != nil {
+		return fmt.Errorf("cannot deserialize response's body: %v: %s", err, string(body))
 	}
 	if errClose != nil {
 		return fmt.Errorf("cannot close response's body: %v", errClose)


Test patch:
diff --git a/algolia/transport/transport_test.go b/algolia/transport/transport_test.go
index 073a8ea9..62004b64 100644
--- a/algolia/transport/transport_test.go
+++ b/algolia/transport/transport_test.go
@@ -1,6 +1,9 @@
 package transport
 
 import (
+	"bytes"
+	"fmt"
+	"io/ioutil"
 	"net/http"
 	"testing"
 	"time"
@@ -79,3 +82,22 @@ func TestShouldExposeIntermediateNetworkErrors(t *testing.T) {
 	require.True(t, ok)
 	require.Len(t, noMoreHostToTryErr.IntermediateNetworkErrors(), 1)
 }
+
+func TestUnmarshallTo(t *testing.T) {
+	type fakeStruct struct {
+		Attr string `json:"attr"`
+	}
+	for _, v := range []struct {
+		bodyRaw       string
+		expectedError error
+		expectedBody  fakeStruct
+	}{
+		{"<html>Non json answer</html>", fmt.Errorf("cannot deserialize response's body: invalid character '<' looking for beginning of value: <html>Non json answer</html>"), fakeStruct{}},
+		{`{"attr":"value"}`, nil, fakeStruct{"value"}},
+	} {
+		bodyDeserialized := fakeStruct{}
+		err := unmarshalTo(ioutil.NopCloser(bytes.NewReader([]byte(v.bodyRaw))), &bodyDeserialized)
+		require.Equal(t, v.expectedError, err)
+		require.Equal(t, v.expectedBody, bodyDeserialized)
+	}
+}
Repository: algolia/algoliasearch-client-go
Pull request #689 (2022-02-01 10:20:46)

fix: Suppress rule condition pattern marshalling in case of empty anchoring
| Q                 | A
| ----------------- | ----------
| Bug fix?          | yes
| New feature?      | no
| BC breaks?        | no     
| Related Issue     | Fix #...  <!-- will close issue automatically, if any -->
| Need Doc update   | no


## Describe your change

The engine doesn't accept Query Rule condition pattern in case of missing `anchoring` parameter. 
This PR suppress `pattern` parameter marshalling if the anchoring parameter is empty. 



Patch:
diff --git a/algolia/search/rule_condition.go b/algolia/search/rule_condition.go
index 9cbe41d4..74cc399d 100644
--- a/algolia/search/rule_condition.go
+++ b/algolia/search/rule_condition.go
@@ -12,7 +12,7 @@ type RuleCondition struct {
 
 func (c RuleCondition) MarshalJSON() ([]byte, error) {
 	m := make(map[string]interface{})
-	if c.Anchoring != "" || c.Pattern != "" {
+	if c.Anchoring != "" {
 		m["anchoring"] = c.Anchoring
 		m["pattern"] = c.Pattern
 	}


Test patch:
diff --git a/algolia/search/rule_condition_test.go b/algolia/search/rule_condition_test.go
index 3fadd023..eed73091 100644
--- a/algolia/search/rule_condition_test.go
+++ b/algolia/search/rule_condition_test.go
@@ -44,7 +44,7 @@ func TestRuleCondition_MarshalJSON(t *testing.T) {
 				Alternatives: nil,
 				Filters:      "",
 			},
-			`{"anchoring": "", "pattern": "Pattern"}`,
+			`{}`,
 		},
 		{
 			RuleCondition{
@@ -106,7 +106,11 @@ func TestRuleCondition_MarshalJSON(t *testing.T) {
 
 		// Compare the two RuleConditions
 		require.Equal(t, c.condition.Anchoring, condition.Anchoring)
-		require.Equal(t, c.condition.Pattern, condition.Pattern)
+		if c.condition.Anchoring == "" {
+			require.Equal(t, condition.Pattern, "")
+		} else {
+			require.Equal(t, c.condition.Pattern, condition.Pattern)
+		}
 		require.Equal(t, c.condition.Context, condition.Context)
 		if c.condition.Alternatives == nil {
 			require.Nil(t, condition.Alternatives)
Repository: algolia/algoliasearch-client-go
Pull request #716 (2023-02-08 09:37:16)

fix(search) handle automaticFacetFilters unmarshal from string
| Q                 | A
| ----------------- | ----------
| Bug fix?          | yes
| New feature?      | no    <!-- please update the /CHANGELOG.md file -->
| BC breaks?        | no     
| Need Doc update   | no


## Describe your change

Implement the `UnmarshalJSON` on `AutomaticFacetFilter` to handle the case when `automaticFacetFilters` or `automaticOptionalFacetFilters` are just a `string`.



Patch:
diff --git a/algolia/search/rule_consequence_params.go b/algolia/search/rule_consequence_params.go
index b1e147ea..ae6964bf 100644
--- a/algolia/search/rule_consequence_params.go
+++ b/algolia/search/rule_consequence_params.go
@@ -80,6 +80,46 @@ type AutomaticFacetFilter struct {
 	Score       int    `json:"score"`       // Defaults to 1
 }
 
+// AutomaticFacetFilter can be unmarshalled from a string or an object.
+func (a *AutomaticFacetFilter) UnmarshalJSON(data []byte) error {
+	if len(data) == 0 {
+		return nil
+	}
+
+	if string(data) == jsonNull {
+		return nil
+	}
+
+	switch data[0] {
+	case '"':
+		var facet string
+		if err := json.Unmarshal(data, &facet); err != nil {
+			return err
+		}
+		*a = AutomaticFacetFilter{
+			Facet: facet,
+		}
+		return nil
+	case '{':
+		var alias struct {
+			Facet       string `json:"facet"`
+			Disjunctive bool   `json:"disjunctive"`
+			Score       int    `json:"score"`
+		}
+		if err := json.Unmarshal(data, &alias); err != nil {
+			return err
+		}
+		*a = AutomaticFacetFilter{
+			Facet:       alias.Facet,
+			Disjunctive: alias.Disjunctive,
+			Score:       alias.Score,
+		}
+		return nil
+	default:
+		return fmt.Errorf("cannot unmarshal automatic facet filter")
+	}
+}
+
 type QueryEdit struct {
 	Type   QueryEditType `json:"type"`
 	Delete string        `json:"delete"`


Test patch:
diff --git a/algolia/search/rule_consequence_params_test.go b/algolia/search/rule_consequence_params_test.go
new file mode 100644
index 00000000..8c78b15a
--- /dev/null
+++ b/algolia/search/rule_consequence_params_test.go
@@ -0,0 +1,42 @@
+package search
+
+import (
+	"encoding/json"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+)
+
+func Test_AutomaticFacetFilter_UnmarshalJSON(t *testing.T) {
+	for _, c := range []struct {
+		input    string
+		expected AutomaticFacetFilter
+		err      string
+	}{
+		{
+			input:    `{"facet": "facet", "score": 42}`,
+			expected: AutomaticFacetFilter{Facet: "facet", Score: 42},
+		},
+		{
+			input:    `{"facet": "facet", "score": 42, "disjunctive": true}`,
+			expected: AutomaticFacetFilter{Facet: "facet", Score: 42, Disjunctive: true},
+		},
+		{
+			input:    `"facet"`,
+			expected: AutomaticFacetFilter{Facet: "facet"},
+		},
+		{
+			input: `[]`,
+			err:   `cannot unmarshal automatic facet filter`,
+		},
+	} {
+		var actual AutomaticFacetFilter
+		err := json.Unmarshal([]byte(c.input), &actual)
+		if c.err != "" {
+			require.EqualError(t, err, c.err)
+			continue
+		}
+		require.NoError(t, err)
+		require.Equal(t, c.expected, actual)
+	}
+}
Repository: algolia/algoliasearch-client-go
Pull request #721 (2023-03-30 12:21:48)

fix: unmarshal the legacy format before trying the new one
| Q                 | A
| ----------------- | ----------
| Bug fix?          | yes
| New feature?      | no
| BC breaks?        | no     
| Need Doc update   | no


## Describe your change

Try first the legacy format parsing before new format and continue only if no edits are retrieved

## What problem is this fixing?

Fix the unmarshalling of rules consequence using the legacy format to edit the query words. The permissive parsing of the new format was taking precedence leading to rules without edits.



Patch:
diff --git a/algolia/search/rule_consequence_params.go b/algolia/search/rule_consequence_params.go
index ae6964bf..a614c4c9 100644
--- a/algolia/search/rule_consequence_params.go
+++ b/algolia/search/rule_consequence_params.go
@@ -49,7 +49,6 @@ func (q *RuleQuery) UnmarshalJSON(data []byte) error {
 	var objectQuery RuleQueryObjectQuery
 	if err := json.Unmarshal(data, &objectQuery); err == nil {
 		q.objectQuery = &objectQuery
-		return nil
 	}
 
 	// Kept for backward-compatibility only
@@ -57,11 +56,12 @@ func (q *RuleQuery) UnmarshalJSON(data []byte) error {
 		Remove []string `json:"remove"`
 	}
 	if err := json.Unmarshal(data, &incrementalEdit); err == nil {
-		var edits []QueryEdit
+		if q.objectQuery == nil {
+			q.objectQuery = &RuleQueryObjectQuery{}
+		}
 		for _, word := range incrementalEdit.Remove {
-			edits = append(edits, RemoveEdit(word))
+			q.objectQuery.Edits = append(q.objectQuery.Edits, RemoveEdit(word))
 		}
-		q.objectQuery = &RuleQueryObjectQuery{Edits: edits}
 		return nil
 	}
 


Test patch:
diff --git a/algolia/search/rule_consequence_params_test.go b/algolia/search/rule_consequence_params_test.go
index 8c78b15a..1d3d1fb6 100644
--- a/algolia/search/rule_consequence_params_test.go
+++ b/algolia/search/rule_consequence_params_test.go
@@ -40,3 +40,28 @@ func Test_AutomaticFacetFilter_UnmarshalJSON(t *testing.T) {
 		require.Equal(t, c.expected, actual)
 	}
 }
+
+func Test_LegacyParsingOfQueryEdits(t *testing.T) {
+	for _, c := range []struct {
+		input    string
+		expected RuleQuery
+	}{
+		{
+			input:    `{"remove":["myWord"]}`,
+			expected: RuleQuery{objectQuery: &RuleQueryObjectQuery{Edits: []QueryEdit{RemoveEdit("myWord")}}},
+		},
+		{
+			input:    `{"edits":[{"type":"remove","delete":"myWord"}]}`,
+			expected: RuleQuery{objectQuery: &RuleQueryObjectQuery{Edits: []QueryEdit{RemoveEdit("myWord")}}},
+		},
+		{
+			input:    `{"edits":[{"type":"remove","delete":"myWord1"}],"remove":["myWord2"]}`,
+			expected: RuleQuery{objectQuery: &RuleQueryObjectQuery{Edits: []QueryEdit{RemoveEdit("myWord1"), RemoveEdit("myWord2")}}},
+		},
+	} {
+		var actual RuleQuery
+		err := json.Unmarshal([]byte(c.input), &actual)
+		require.NoError(t, err)
+		require.Equal(t, c.expected, actual)
+	}
+}
Repository: algolia/algoliasearch-client-go
Pull request #722 (2023-03-30 12:35:06)

feat: add support of tags parsing in rules
| Q                 | A
| ----------------- | ----------
| Bug fix?          | no
| New feature?      | yes
| BC breaks?        | no     
| Need Doc update   | no


## Describe your change

Add the support of `tags` in the rules parsing



Patch:
diff --git a/algolia/search/rule.go b/algolia/search/rule.go
index dea78b9e..6f8afc82 100644
--- a/algolia/search/rule.go
+++ b/algolia/search/rule.go
@@ -19,6 +19,7 @@ type Rule struct {
 	Enabled     *opt.EnabledOption `json:"enabled,omitempty"`
 	ObjectID    string             `json:"objectID,omitempty"`
 	Validity    []TimeRange        `json:"validity,omitempty"`
+	Tags        []string           `json:"tags,omitempty"`
 }
 
 // TimeRange is a pair of begin/end time.Time used to represent a rule validity


Test patch:
diff --git a/algolia/search/rule_test.go b/algolia/search/rule_test.go
index bc7cbda1..7267f35e 100644
--- a/algolia/search/rule_test.go
+++ b/algolia/search/rule_test.go
@@ -52,6 +52,12 @@ func TestRule_MarshalJSON(t *testing.T) {
 			},
 			`{"condition":{"anchoring":"is","pattern":"Pattern","context":"Context","alternatives":true},"consequence":{}}`,
 		},
+		{
+			Rule{
+				Tags: []string{"visual-editor"},
+			},
+			`{"consequence":{},"tags":["visual-editor"]}`,
+		},
 	} {
 		// Encode the Rule to JSON
 		data, err := json.Marshal(&c.rule)
Repository: alchemyplatform/alchemy-sdk-js
Pull request #280 (2023-03-07 20:25:23)

Fix media field in ContractForOwner
The `media` field in `ContractForOwner` was incorrectly typed as a `Media` object. The REST API returns a `Media[]` object. This PR updates the TS typing to the correct return type.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb3c7e35..afa4ffbc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@
 
 ### Minor Changes
 
+- Fixed a bug where the `media` field in `ContractForOwner` was a `Media` object rather than a `Media[]` array.
+
 ## 2.6.0
 
 ### Major Changes
diff --git a/src/internal/raw-interfaces.ts b/src/internal/raw-interfaces.ts
index 9c879e15..2b153ec6 100644
--- a/src/internal/raw-interfaces.ts
+++ b/src/internal/raw-interfaces.ts
@@ -314,6 +314,6 @@ export interface RawContractForOwner
   numDistinctTokensOwned: number;
   isSpam: boolean;
   tokenId: string;
-  media: Media;
+  media: Media[];
   opensea?: RawOpenSeaCollectionMetadata;
 }
diff --git a/src/types/types.ts b/src/types/types.ts
index a87b08a7..dd9d7a70 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -1042,7 +1042,7 @@ export interface ContractForOwner extends NftContract {
   tokenId: string;
 
   /** Alternative NFT metadata for this contract to be parsed manually. */
-  media: Media;
+  media: Media[];
 }
 
 /**


Test patch:
diff --git a/test/test-util.ts b/test/test-util.ts
index 5a326af6..7ac01cfd 100644
--- a/test/test-util.ts
+++ b/test/test-util.ts
@@ -234,7 +234,7 @@ export function createRawNftSale(
 export function createRawContractForOwner(
   address: string,
   tokenId: string,
-  media: Media,
+  media: Media[],
   isSpam?: boolean,
   name?: string,
   tokenType?: NftTokenType,
@@ -265,14 +265,16 @@ export function createNftMediaData(
   bytes?: number,
   format?: string,
   thumbnail?: string
-): Media {
-  return {
-    raw: 'http://api.nikeape.xyz/ipfs/nickbanc/1.jpg',
-    gateway: 'http://api.nikeape.xyz/ipfs/nickbanc/1.jpg',
-    bytes,
-    format,
-    thumbnail
-  };
+): Media[] {
+  return [
+    {
+      raw: 'http://api.nikeape.xyz/ipfs/nickbanc/1.jpg',
+      gateway: 'http://api.nikeape.xyz/ipfs/nickbanc/1.jpg',
+      bytes,
+      format,
+      thumbnail
+    }
+  ];
 }
 
 export function verifyNftContractMetadata(
Repository: alchemyplatform/alchemy-sdk-js
Pull request #306 (2023-04-13 17:46:37)

polygon zk evm

thebrianchen: to make the failing tests pass, you'll have the add the enum here as well: https://github.com/alchemyplatform/alchemy-sdk-js/blob/682abd28246ad3173ec5f5585ecfd842e776a8f9/src/types/types.ts#L76

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54052ecf..452de4c5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
 
 ### Major Changes
 
+Added PolygonZkEvm Mainnet and Testnet limited support to the sdk
+
 ### Minor Changes
 
 ## 2.7.0
diff --git a/README.md b/README.md
index 118e4195..56ac64f4 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,7 @@ The SDK currently supports the following chains:
 - **Optimism**: Mainnet, Goerli, Kovan
 - **Arbitrum**: Mainnet, Goerli, Rinkeby
 - **Astar**: Mainnet
+- **PolygonZKEVM**: Mainnet, Testnet
 
 You can find per-method documentation of the Alchemy SDK endpoints at the [Alchemy Docs linked in the sidebar](https://docs.alchemy.com/reference/alchemy-sdk-quickstart).
 
diff --git a/src/types/types.ts b/src/types/types.ts
index 083a4cd0..388b8285 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -93,7 +93,9 @@ export enum Network {
   ARB_GOERLI = 'arb-goerli',
   MATIC_MAINNET = 'polygon-mainnet',
   MATIC_MUMBAI = 'polygon-mumbai',
-  ASTAR_MAINNET = 'astar-mainnet'
+  ASTAR_MAINNET = 'astar-mainnet',
+  POLYGONZKEVM_MAINNET = 'polygonzkevm-mainnet',
+  POLYGONZKEVM_TESTNET = 'polygonzkevm-testnet'
 }
 
 /** Token Types for the `getTokenBalances()` endpoint. */
diff --git a/src/util/const.ts b/src/util/const.ts
index 5310ef74..1d93dee2 100644
--- a/src/util/const.ts
+++ b/src/util/const.ts
@@ -54,7 +54,9 @@ export const EthersNetwork = {
   [Network.ARB_GOERLI]: 'arbitrum-goerli',
   [Network.MATIC_MAINNET]: 'matic',
   [Network.MATIC_MUMBAI]: 'maticmum',
-  [Network.ASTAR_MAINNET]: 'astar-mainnet'
+  [Network.ASTAR_MAINNET]: 'astar-mainnet',
+  [Network.POLYGONZKEVM_MAINNET]: 'polygonzkevm-mainnet',
+  [Network.POLYGONZKEVM_TESTNET]: 'polygonzkevm-testnet'
 };
 
 /**
@@ -74,6 +76,14 @@ export const CustomNetworks: { [key: string]: NetworkFromEthers } = {
   sepolia: {
     chainId: 11155111,
     name: 'sepolia'
+  },
+  'polygonzkevm-mainnet': {
+    chainId: 1101,
+    name: 'polygonzkevm-mainnet'
+  },
+  'polygonzkevm-testnet': {
+    chainId: 1442,
+    name: 'polygonzkevm-testnet'
   }
 };
 


Test patch:
diff --git a/test/integration/alchemy.test.ts b/test/integration/alchemy.test.ts
index 9465771b..14c3fd7f 100644
--- a/test/integration/alchemy.test.ts
+++ b/test/integration/alchemy.test.ts
@@ -47,9 +47,15 @@ describe('E2E integration tests', () => {
         });
       }
 
+      const excludedNetworks = [
+        Network.ASTAR_MAINNET,
+        Network.POLYGONZKEVM_MAINNET,
+        Network.POLYGONZKEVM_TESTNET
+      ];
+
       for (const network of supportedNetworks) {
         // TODO: Enable after Astar websockets work.
-        if (network === Network.ASTAR_MAINNET) {
+        if (excludedNetworks.includes(network)) {
           continue;
         }
Repository: alchemyplatform/alchemy-sdk-js
Pull request #334 (2023-05-31 19:13:22)

Add decimals and deprecate decimal in getNftSales


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee680f0f..748ed097 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
 
 ### Major Changes
 
+- Fixed a bug with in `NftNamespace.getNftSales()` in which there was a typo in `decimal` field of the `NftSaleFeeData` object. The field is now correctly named `decimals`, and `decimal` is marked deprecated to avoid a breaking change.
+
 ### Minor Changes
 
 - Added redundancy to `CoreNamespace.getTokensForOwner()` to handle failures when fetching token metadata.
diff --git a/src/types/types.ts b/src/types/types.ts
index 79a98376..196b5324 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -1313,8 +1313,16 @@ export interface NftSaleFeeData {
   /** The symbol of the token used for the payment. */
   symbol: string;
 
-  /** The number of decimals of the token used for the payment. */
+  /**
+   * The number of decimals of the token used for the payment.
+   * @deprecated Please use `decimals` instead. This field contains a typo
+   * and will always be undefined. It's been marked as deprecated to avoid
+   * breaking changes.
+   */
   decimal: number;
+
+  /** The number of decimals of the token used for the payment. */
+  decimals: number;
 }
 
 /**


Test patch:
diff --git a/test/test-util.ts b/test/test-util.ts
index a92f707a..f77f7eb2 100644
--- a/test/test-util.ts
+++ b/test/test-util.ts
@@ -209,6 +209,7 @@ export function createRawNftSale(
   const feeData: NftSaleFeeData = {
     amount: '100',
     decimal: 18,
+    decimals: 18,
     symbol: 'ETH'
   };