{"id":19423185,"url":"https://github.com/make-software/ces-js-parser","last_synced_at":"2025-10-30T15:27:43.461Z","repository":{"id":92011006,"uuid":"602558709","full_name":"make-software/ces-js-parser","owner":"make-software","description":"The js library for parsing Casper Event Standard events","archived":false,"fork":false,"pushed_at":"2025-09-05T10:56:42.000Z","size":557,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-12T16:30:18.164Z","etag":null,"topics":["blockchain","casper-network","smart-contracts"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/make-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-16T13:21:01.000Z","updated_at":"2025-09-05T10:56:39.000Z","dependencies_parsed_at":"2025-04-24T16:30:51.885Z","dependency_job_id":"07d14385-5ded-4bbc-95ce-6c23450215ff","html_url":"https://github.com/make-software/ces-js-parser","commit_stats":{"total_commits":27,"total_committers":6,"mean_commits":4.5,"dds":0.5555555555555556,"last_synced_commit":"28b89aa8a3414ab35a872a1babf2b82496e4fb98"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/make-software/ces-js-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-software%2Fces-js-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-software%2Fces-js-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-software%2Fces-js-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-software%2Fces-js-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/make-software","download_url":"https://codeload.github.com/make-software/ces-js-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-software%2Fces-js-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281829283,"owners_count":26568859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","casper-network","smart-contracts"],"created_at":"2024-11-10T13:37:08.871Z","updated_at":"2025-10-30T15:27:43.456Z","avatar_url":"https://github.com/make-software.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CES JS Parser\n\n`@make-software/ces-js-parser` parses contract-level events that follow the [Casper Event Standard](https://github.com/make-software/casper-event-standard).\n\nThe library is built on top of the [casper-js-sdk](https://github.com/casper-ecosystem/casper-js-sdk) and operates on types defined by the SDK.\n\n## Prerequisites\n\n- **Node.js Version**: \u003e12.22.10\n- **OS**: Linux, MacOS\n\n## Install\n\n`npm install --save @make-software/ces-js-parser`\n\n## Usage\n\nHere is an example of parsing CES events using `ces-js-parser` from a real Integration net transaction loaded with `casper-js-sdk`:\n\n```typescript\nimport { HttpHandler, RpcClient } from 'casper-js-sdk';\nimport { Parser } from '@make-software/ces-js-parser';\n\n(async() =\u003e {\n  const rpcHandler = new HttpHandler('http://${process.env.NODE_ADDRESS}:7777/rpc');\n\n  const rpcClient = new RpcClient(rpcHandler);\n\n  const parser = await Parser.create(rpcClient, [\n    '333f0e776995a27ad8502e29b141b875951f92fe6b61329a59f1f875ef48e16a'\n  ]);\n\n  const transaction = await rpcClient.getTransactionByTransactionHash(\n    '1592814db95151bb9366112dea6e10fe5d8043ba2b1efd28545a0b6e53839a70'\n  );\n\n  const events = parser.parseExecutionResult(\n    transaction.executionInfo!.executionResult,\n  );\n\n  events.forEach(console.log);\n})()\n```\n\n## API\n\nCES JS Parser provides several public types and functions:\n\n- [CES JS Parser](#ces-js-parser)\n  - [Prerequisites](#prerequisites)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [API](#api)\n    - [`Parser`](#parser)\n      - [`create`](#create)\n      - [`parseExecutionResults`](#parseexecutionresults)\n      - [`fetchContractSchemasBytes`](#fetchcontractschemasbytes)\n    - [`parseSchemasFromBytes`](#parseschemasfrombytes)\n    - [`parseEventNameAndData`](#parseeventnameanddata)\n    - [`Event`](#event)\n    - [`ParseResult`](#parseresult)\n    - [`Schema`](#schema)\n    - [`Schemas`](#schemas)\n  - [Tests](#tests)\n  - [License](#license)\n  - [Contributing](#contributing)\n\n### `Parser`\n\nParser that accepts a list of observed contracts and provides possibility to parse CES events out of deploy execution results\n\n#### `create`\n\n`create` is a async factory function that accepts `CasperServiceByJsonRPC` and `contractHashes` array and created a `Parser` instance:\n\n| Argument | Type | Description |\n| --- | --- | --- |\n| `rpcClient` | `CasperServiceByJsonRPC` | Instance of the `CasperServiceByJsonRPC` client |\n| `contractHashes` | `string[]` | List of the observed contract hashes |\n\n**Example**\n\n```typescript\nimport { HttpHandler, RpcClient } from 'casper-js-sdk';\nimport { Parser } from '@make-software/ces-js-parser';\n\nconst rpcHandler = new HttpHandler('http://${process.env.NODE_ADDRESS}:7777/rpc');\n\nconst rpcClient = new RpcClient(rpcHandler);\n\nconst parser = await Parser.create(rpcClient, [\n  '214a0e730e14501d1e3e03504d3a2f940ef32830b13fa47f9d85a40f73b78161'\n]);\n```\n\n#### `parseExecutionResults`\n\n`parseExecutionResults` method that accepts deploy execution results and returns `ParseResult[]`:\n\n| Argument           | Type               | Description              |\n| ------------------ | ------------------ | ------------------------ |\n| `executionResults` | `ExecutionResults` | Deploy execution results |\n\n#### `fetchContractSchemasBytes`\n\n`fetchContractSchemasBytes` method that accepts contract hash and return bytes representation of stored schema:\n\n| Argument | Type | Description |\n| --- | --- | --- |\n| `contractHash` | `string` | Contract hash schema want to be fetched |\n| `stateRootHash` | `string` | State root hash of the data (takes latest if not provided) |\n\n### `parseSchemasFromBytes`\n\n`parseSchemasFromBytes` function that accepts raw CES schema bytes stored under the contract `__events_schema` URef and returns `Schemas`:\n\n| Argument   | Type         | Description                |\n| ---------- | ------------ | -------------------------- |\n| `rawBytes` | `Uint8Array` | Raw contract schemas bytes |\n\n### `parseEventNameAndData`\n\nFunction that accepts raw event bytes and contract event schemas and returns `Event`, that contains `name` and `data`:\n\n| Argument   | Type      | Description                  |\n| ---------- | --------- | ---------------------------- |\n| `rawEvent` | `string`  | Raw event bytes in hex       |\n| `schemas`  | `Schemas` | The list of contract schemas |\n\n**Example**\n\n```typescript\nimport { decodeBase16 } from 'casper-js-sdk';\nimport {\n  parseSchemasFromBytes,\n  parseEventNameAndData\n} from '@make-software/ces-js-parser';\n\nconst schemas = parseSchemasFromBytes(rawBytes);\nconst rawEvent = decodeBase16('some real example here');\n\nconst event = parseEventNameAndData(rawEvent, schemas);\n```\n\n### `Event`\n\nType that represents an event:\n\n| Property | Type                     | Description                                         |\n| --- |--------------------------|-----------------------------------------------------|\n| `contractHash` | `Uint8Array`             | Event ContractHash                                  |\n| `contractPackageHash` | `Uint8Array`             | Event ContractHash                                  |\n| `name` | `string`                 | Event name                                          |\n| `eventId` | `number`                 | Event identifier                                    |\n| `transformIdx` | `number`                 | Transaction transform index of the event |\n| `data` | `Record\u003cstring,CLValue\u003e` | Event Data                                          |\n\n### `ParseResult`\n\nValue-object that represents a parse result. Contains error representing weather parsing was successful or not.\n\n| Property | Type              | Description        |\n| -------- | ----------------- | ------------------ |\n| `error`  | `string`          | Parse result error |\n| `event`  | [`Event`](#Event) | ces Event          |\n\n### `Schema`\n\nSchema is slice of `PropertyDefinition` - value-object that represents an schema item.\n\n| Property   | Type     | Description                 |\n| ---------- | -------- | --------------------------- |\n| `Property` | `string` | Name of the schema property |\n| `Value`    | `CLType` | casper CLType               |\n\n### `Schemas`\n\nSchemas represent a map of event name and its Schema.\n\n## Tests\n\nTo run unit tests for the library, make sure you are in the root of the library:\n\n`npm run test`\n\n## License\n\nThis project is licensed under the terms of the [Apache-2.0 license](https://github.com/make-software/ces-js-parser/blob/master/LICENSE).\n\n## Contributing\n\nWe welcome contributions from anyone interested in improving this project. Before getting started, please take a moment to read our [contributing guidelines](https://github.com/make-software/ces-js-parser/blob/master/CONTRIBUTING.md) to learn more about how to contribute to this project, including how to report bugs, suggest enhancements, and submit pull requests.\n\nWe look forward to collaborating with you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmake-software%2Fces-js-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmake-software%2Fces-js-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmake-software%2Fces-js-parser/lists"}