I am trying to call api.events.staking.Withdrawn.is in polkadot.js/api.
Docs: https://polkadot.js.org/docs/substrate/events#withdrawnaccountid32-u128
Code sandbox: https://codesandbox.io/s/hardcore-architecture-vrhyqm?file=/index.js
It is not working and causing isssue.
const provider = new WsProvider("wss://kusama-rpc.polkadot.io");
const api = await ApiPromise.create({ provider });
const validator = "CaKh7HmPMXxv22GnLgjEZxWHBUu7y7Twf2k8mP3mxpLYTH4";
const response = await api.events.staking.Withdrawn.is(validator, "50");
Error
2022-05-19 17:41:35 API/INIT: RPC methods not decorated: mmr_generateBatchProof
(node:2206) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
at Object.is (/sandbox/node_modules/@polkadot/types/cjs/metadata/decorate/events/index.js:44:60)
at Server.<anonymous> (/sandbox/index.js:10:57)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2206) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2206) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.