Repository: 0xs34n/starknet.js
Pull request #693 (2023-07-19 14:59:26)

fix: optional keys and address in eventfilters
## Motivation and Resolution
Solve issue #692 

### RPC version (if applicable)

In EVENT_FILTER, keys and address should be optional.

## Usage related changes

Keys and Address filters are not mandatory.

## Development related changes

## Checklist:

- [x] Performed a self-review of the code
- [x] Rebased to the last commit of the target branch (or merged it into my branch)
- [x] Linked the issues which this PR resolves
- [x] Documented the changes in code (API docs will be generated automatically)
- [x] Updated the tests
- [x] All tests are passing



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b17c7d62..27ea46c9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,18 @@
+# [5.17.0](https://github.com/0xs34n/starknet.js/compare/v5.16.0...v5.17.0) (2023-07-18)
+
+### Bug Fixes
+
+- add FailedTransactionResponse ([994925e](https://github.com/0xs34n/starknet.js/commit/994925e87a4fde3cfcffd9103793d44bc96fc96c))
+- remedy type declaration roll-up issues ([48625f4](https://github.com/0xs34n/starknet.js/commit/48625f4a9eaf4e3c294ad840dae78ebab4ab9a12))
+- transaction_failure_reason ([77329b7](https://github.com/0xs34n/starknet.js/commit/77329b7ddfc63d708685f0dcbffbe1b9094f7824))
+
+### Features
+
+- add Enum in contract ([515e233](https://github.com/0xs34n/starknet.js/commit/515e233a0b29e125936192da540b83af8591b507)), closes [#670](https://github.com/0xs34n/starknet.js/issues/670) [#665](https://github.com/0xs34n/starknet.js/issues/665) [#664](https://github.com/0xs34n/starknet.js/issues/664) [#1](https://github.com/0xs34n/starknet.js/issues/1)
+- calldata result in populate ([d44dc56](https://github.com/0xs34n/starknet.js/commit/d44dc56c0b6db68fcd664b8f02d7a4b72bcdfd28)), closes [#675](https://github.com/0xs34n/starknet.js/issues/675) [#1](https://github.com/0xs34n/starknet.js/issues/1)
+- contractFactory Cairo1 & changed constructor signature, 0.12 test fixes ([9b44c54](https://github.com/0xs34n/starknet.js/commit/9b44c54857896019c2545c945695e525392e8dbd))
+- rename Failed to Rejected for transaction type ([65b1ef4](https://github.com/0xs34n/starknet.js/commit/65b1ef432e2eda9f37574771d60b409a3f7ab049))
+
 # [5.16.0](https://github.com/0xs34n/starknet.js/compare/v5.15.1...v5.16.0) (2023-07-03)
 
 ### Features
diff --git a/package-lock.json b/package-lock.json
index 62d8ec7d..256e5616 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "starknet",
-  "version": "5.16.0",
+  "version": "5.17.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "starknet",
-      "version": "5.16.0",
+      "version": "5.17.0",
       "license": "MIT",
       "dependencies": {
         "@noble/curves": "~1.0.0",
diff --git a/package.json b/package.json
index 74c26dd4..35c5c28e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "starknet",
-  "version": "5.16.0",
+  "version": "5.17.0",
   "description": "JavaScript library for Starknet",
   "main": "dist/index.js",
   "module": "dist/index.mjs",
diff --git a/src/types/api/openrpc.ts b/src/types/api/openrpc.ts
index 7d9a8e54..783813fb 100644
--- a/src/types/api/openrpc.ts
+++ b/src/types/api/openrpc.ts
@@ -307,10 +307,10 @@ type PENDING_STATE_UPDATE = {
 };
 type STORAGE_KEY = string;
 type EVENT_FILTER = {
-  from_block: BLOCK_ID;
-  to_block: BLOCK_ID;
-  address: ADDRESS;
-  keys: Array<Array<FELT>>;
+  from_block?: BLOCK_ID;
+  to_block?: BLOCK_ID;
+  address?: ADDRESS;
+  keys?: Array<Array<FELT>>;
 };
 type EVENTS_CHUNK = {
   events: Array<EMITTED_EVENT>;


Test patch:
diff --git a/__tests__/rpcProvider.test.ts b/__tests__/rpcProvider.test.ts
index 3a4f509e..3c302d3b 100644
--- a/__tests__/rpcProvider.test.ts
+++ b/__tests__/rpcProvider.test.ts
@@ -151,8 +151,13 @@ describeIfRpc('RPCProvider', () => {
           chunk_size: 2,
         });
 
+        const result1 = await rpcProvider.getEvents({
+          chunk_size: 2, // all optional paramaters removed
+        });
+
         expect(result).toHaveProperty('continuation_token');
         expect(result).toHaveProperty('events');
+        expect(result1).toHaveProperty('events');
         expect(Array.isArray(result?.events)).toBe(true);
         expect(result?.events?.length).toBe(2);
         expect(result.events[0]).toMatchSchemaRef('StarknetEmittedEvent');