Add EXPERIMENTAL_changes functionality
See original GitHub issueIs your feature request related to a problem? Please describe.
Many partners and members from the community want to use events. We currently send them here:
https://docs.near.org/docs/api/rpc-experimental#example-of-data-changes
While you can send such a response directly the RPC, near-api-js does not allow such a command to happen (as far as I’m aware) because we don’t have the interface.
It seems you cannot use .sendJsonRpc until we map the parameters to the RPC request.
Until we do this, folks will have to use a JavaScript fetch or axios call.
Describe the solution you’d like
I believe we need to have an interface for EXPERIMENTAL_changes in:
/src/providers/provider.ts
that matches the RPC request struct (https://github.com/nearprotocol/nearcore/blob/master/core/primitives/src/rpc.rs)
pub struct RpcStateChangesRequest {
#[serde(flatten)]
pub block_id_or_finality: BlockIdOrFinality,
#[serde(flatten)]
pub state_changes_request: StateChangesRequestView,
}
}
Describe alternatives you’ve considered
Using fetch will work, but then they aren’t using this library.
Lastly, we should revisit if this is truly “experimental” anymore.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)

Top Related StackOverflow Question
just pass plain JS object with necessary fields, taking into account serde annotations like https://serde.rs/attr-flatten.html
so in this case smth like:
Fixed in #534