starknet.js icon indicating copy to clipboard operation
starknet.js copied to clipboard

fix: RPC provider getEvents

Open rzmahmood opened this issue 3 years ago • 3 comments

The getEvents query on the Pathfinder RPC implementation has optional address and keys which is more valuable for many use cases. This does unfortunately differ from the RPC spec https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json BUT considering Pathfinder is the largest node implementation, we should support that. I will also be reaching out to Starkware to see if we can update the openrpc spec.

Also fromBlock and toBlock should be numbers and getEventResponse.islastpage should be a boolean

{
	"jsonrpc":"2.0",
	"method":"starknet_getEvents",
    "params": [
        {"fromBlock": 277645, "toBlock": 277700, "page_size": 1000, "page_number": 1}
    ],
	"id":1
}

rzmahmood avatar Jul 26 '22 01:07 rzmahmood

Deploy Preview for starknetjs canceled.

Name Link
Latest commit 01b34a4f621152dc157903300abb87d853efc466
Latest deploy log https://app.netlify.com/sites/starknetjs/deploys/62f1e2d5f6b1a30008d4bba7

netlify[bot] avatar Jul 26 '22 01:07 netlify[bot]

Thanks mate! Please make sure to follow this up with StarkWare to get the spec right

janek26 avatar Jul 27 '22 09:07 janek26

Have followed up with Starkware. They said they can do this and will discuss with nodes/sdks.

They will update the master branch on the repo soon.

rzmahmood avatar Aug 01 '22 06:08 rzmahmood

made draft until RPC spec update is ready and PR is ready to be reviewed.

tabaktoni avatar Aug 17 '22 11:08 tabaktoni

@rzmahmood Pathfinder RPC 0.2.0 eta is 2 weeks from now, so I think we can skip type changes and go straight to new continuation_token? https://github.com/starkware-libs/starknet-specs/blob/438df17c26609caa44eb2e8a34d368e25759fb08/api/starknet_api_openrpc.json#L665

tabaktoni avatar Sep 08 '22 16:09 tabaktoni

Makes sense @tabaktoni . Will close this PR

rzmahmood avatar Sep 14 '22 07:09 rzmahmood

Please note that according to the spec, all the properties in the filter are optional. This is simply the default defined behavior for a JSON schema.

lior-stark avatar Sep 22 '22 07:09 lior-stark