{"id":22861968,"url":"https://github.com/tetcoin/tetcore-api-sidecar","last_synced_at":"2025-03-31T08:44:24.715Z","repository":{"id":105894654,"uuid":"334334070","full_name":"tetcoin/tetcore-api-sidecar","owner":"tetcoin","description":"REST service that makes it easy to interact with blockchain nodes built using Tetcore FABRIC framework.","archived":false,"fork":false,"pushed_at":"2021-02-11T04:59:04.000Z","size":4517,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T13:18:50.027Z","etag":null,"topics":["chains","fee","payout-calculations","sidecar","tetcore-js"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tetcoin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-30T05:16:07.000Z","updated_at":"2021-03-09T23:16:39.000Z","dependencies_parsed_at":"2023-07-14T11:11:32.525Z","dependency_job_id":null,"html_url":"https://github.com/tetcoin/tetcore-api-sidecar","commit_stats":null,"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetcoin%2Ftetcore-api-sidecar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetcoin%2Ftetcore-api-sidecar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetcoin%2Ftetcore-api-sidecar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetcoin%2Ftetcore-api-sidecar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetcoin","download_url":"https://codeload.github.com/tetcoin/tetcore-api-sidecar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246443522,"owners_count":20778247,"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","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":["chains","fee","payout-calculations","sidecar","tetcore-js"],"created_at":"2024-12-13T10:11:57.194Z","updated_at":"2025-03-31T08:44:24.695Z","avatar_url":"https://github.com/tetcoin.png","language":"TypeScript","readme":"\n\u003cbr /\u003e\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e@tetcore/api-sidecar\u003c/h1\u003e\n  \u003ch4 align=\"center\"\u003e REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.\u003c/h4\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@substrate/api-sidecar\"\u003e\n      \u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/v/@substrate/api-sidecar\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/paritytech/substrate-api-sidecar/actions\"\u003e\n      \u003cimg alt=\"Github Actions\" src=\"https://github.com/paritytech/substrate-api-sidecar/workflows/pr/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/paritytech/substrate-api-sidecar/blob/master/LICENSE\"\u003e\n      \u003cimg alt=\"GPL-3.0-or-later\" src=\"https://img.shields.io/npm/l/@substrate/api-sidecar\" /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## Note\n\nv1.0.0 was released on 2020-10-23. This major release introduced several renamed endpoints as breaking changes. It is important that users complete the transition to the new endpoints ASAP so they are ready for any subsequent emergency updates. Please visit the [MIGRATION_GUIDE](/MIGRATION_GUIDE.md) to\nlearn more.\n\n## Prerequisites\n\nThis service requires Node version 12 or higher.\n\n## Table of contents\n\n- [NPM package installation and usage](#npm-package-installation-and-usage)\n- [Source code installation and usage](#source-code-installation-and-usage)\n- [Configuration](#configuration)\n- [Debugging fee and payout calculations](#debugging-fee-and-payout-calculations)\n- [Available endpoints](https://paritytech.github.io/substrate-api-sidecar/dist/)\n- [Chain integration guide](/CHAIN_INTEGRATION.md)\n- [Docker](#docker)\n- [Note for maintainers](#note-for-maintainers)\n\n## NPM package installation and usage\n\n### Global installation\n\nInstall the service globally:\n\n```bash\nnpm install -g @substrate/api-sidecar\n# OR\nyarn global add @substrate/api-sidecar\n```\n\nRun the service from any directory on your machine:\n\n```bash\nsubstrate-api-sidecar\n```\n\n### Local installation\n\nInstall the service locally:\n\n```bash\nnpm install @substrate/api-sidecar\n# OR\nyarn add @substrate/api-sidecar\n```\n\nRun the service from within the local directory:\n\n```bash\nnode_modules/.bin/substrate-api-sidecar\n```\n\n### Finishing up\n\n[Jump to the configuration section](#configuration) for more details on connecting to a node.\n\n[Click here for full endpoint docs.](https://paritytech.github.io/substrate-api-sidecar/dist/)\n\n## Source code installation and usage\n\n### Quick install\n\nSimply run `yarn`.\n\n### Rust development installation\n\nIf you are looking to hack on the `calc` Rust crate make sure your machine has an [up-to-date version of `rustup`](https://www.rust-lang.org/tools/install)\ninstalled to manage Rust dependencies.\n\nInstall `wasm-pack` if your machine does not already have it:\n\n```bash\ncargo install wasm-pack\n```\n\nUse yarn to do the remaining setup:\n\n```bash\nyarn\n```\n\n### Running\n\n```bash\n# For live reload in development\nyarn dev\n\n# To build and run\nyarn build\nyarn start\n```\n\n[Jump to the configuration section](#configuration) for more details on connecting to a node.\n\n## Configuration\n\nTo use a specific env profile (here for instance a profile called 'env.sample'):\n\n```bash\nNODE_ENV=sample yarn start\n```\n\nFor more information on our configuration manager visit its readme [here](https://gitlab.com/chevdor/confmgr/-/raw/master/README.adoc). See `Specs.ts` to view the env configuration spec.\n\n### Express server\n\n-   `SAS_EXPRESS_BIND_HOST`: address on which the server will be listening, defaults to `127.0.0.1`.\n-   `SAS_EXPRESS_PORT`: port on which the server will be listening, defaults to `8080`.\n-   `SAS_EXPRESS_LOG_MODE`: enable console logging of \"all\" HTTP requests, only \"errors\", or nothing by\n    setting it to anything else. LOG_MODE defaults to only \"errors\".\n\n### Substrate node\n\n-   `SAS_SUBSTRATE_WS_URL`: WebSocket URL to which the RPC proxy will attempt to connect to, defaults to\n    `ws://127.0.0.1:9944`.\n\n#### Custom substrate types\n\nSome chains require custom type definitions in order for Sidecar to know how to decode the data\nretrieved from the node. Sidecar pulls types for chains from [@polkadot/apps-config](https://github.com/polkadot-js/apps/tree/master/packages/apps-config), but in some cases\nthe types for the chain you are trying to connect to may be out of date or may simply not exist in\n@polkadot/apps-config.\n\nSidecar affords environment variables which allow the user to specify an absolute path to a JSON file\nthat contains type definitions in the corresponding formats. Consult polkadot-js/api for more info on\nthe type formats (see `RegisteredTypes`).\n\n**N.B** Types set from environment variables will override the corresponding types pulled from\n@polkadot/apps-config.\n\n-   `SAS_SUBSTRATE_TYPES_BUNDLE`: a bundle of types with versioning info, type aliases, derives, and\n    rpc definitions. Format: `OverrideBundleType` (see [`typesBundle`](https://github.com/polkadot-js/api/blob/21039dec1fcad36061a96bf5526248c5fab38780/packages/types/src/types/registry.ts#L72)).\n-   `SAS_SUBSTRATE_TYPES_CHAIN`: type definitions keyed by `chainName`. Format: `Record\u003cstring, RegistryTypes\u003e` (see [`typesChain`](https://github.com/polkadot-js/api/blob/21039dec1fcad36061a96bf5526248c5fab38780/packages/types/src/types/registry.ts#L76)).\n-   `SAS_SUBSTRATE_TYPES_SPEC`: type definitions keyed by `specName`. Format: `Record\u003cstring, RegistryTypes\u003e` (see [`typesSpec`](https://github.com/polkadot-js/api/blob/21039dec1fcad36061a96bf5526248c5fab38780/packages/types/src/types/registry.ts#L80)).\n-   `SAS_SUBSTRATE_TYPES`: type definitions and overrides, not keyed. Format: `RegistryTypes` (see [`types`](https://github.com/polkadot-js/api/blob/21039dec1fcad36061a96bf5526248c5fab38780/packages/types/src/types/registry.ts#L64)).\n\nYou can read more about [defining types for polkadot-js here.](https://polkadot.js.org/api/start/types.extend.html)\n\n##### Connecting a modified node template\n\nPolkadot-js can recognize the standard node template and inject the correct types, but if you have\nmodified the name of your chain in the node template you will need to add the types manually in a\nJSON `types` file like so:\n\n```json\n// my-chains-types.json\n{\n  \"Address\": \"AccountId\",\n  \"LookupSource\": \"AccountId\"\n}\n```\n\nand then set the enviroment variable to point to your definitions:\n\n```bash\nexport SAS_SUBSTRATE_TYPES=/path/to/my-chains-types.json\n```\n\n### Logging\n\n-   `SAS_LOG_LEVEL`: the lowest priority log level to surface, defaults to `info`. Tip: set to `http`\n    to see all HTTP requests.\n-   `SAS_LOG_JSON`: wether or not to have logs formatted as JSON, defaults to `false`.\n    Useful when using `stdout` to programmatically process Sidecar log data.\n-   `SAS_LOG_FILTER_RPC`: wether or not to filter polkadot-js API-WS RPC logging, defaults to `false`.\n-   `SAS_LOG_STRIP_ANSI`: wether or not to strip ANSI characters from logs, defaults\n    to `false`. Useful when logging RPC calls with JSON written to transports.\n\n#### Log levels\n\nLog levels in order of decreasing importance are: `error`, `warn`, `info`, `http`, `verbose`, `debug`, `silly`.\n\n| http status code range | log level |\n|------------------------|-----------|\n| `code` \u003c 400           | `http`    |\n| 400 \u003c= `code` \u003c 500    | `warn`    |\n| 500 \u003c `code`           | `error`   |\n\n#### RPC logging\n\nIf looking to track raw RPC requests/responses, one can use `yarn start:log-rpc` to turn on polkadot-js's \nlogging. It is recommended to also set `SAS_LOG_STRIP_ANSI=true` to increase the readability of the logging stream.\n\n**N.B.** If running `yarn start:log-rpc`, the NODE_ENV will be set to `test`. In order still run your `.env`\nfile you can `symlink` it with `.env.test`. For example you could run\n`ln -s .env.myEnv .env.test \u0026\u0026 yarn start:log-rpc` to use `.env.myEnv` to set ENV variables. (see linux\ncommands `ln` and `unlink` for more info.)\n\n## Debugging fee and payout calculations\n\nIt is possible to get more information about the fee and payout calculation process logged to\nthe console. Because this fee calculation happens in the statically compiled web assembly part\na re-compile with the proper environment variable set is necessary:\n\n```bash\nCALC_DEBUG=1 sh calc/build.sh\n```\n\n## Available endpoints\n\n[Click here for full endpoint docs.](https://paritytech.github.io/substrate-api-sidecar/dist/)\n\n## Chain integration guide\n\n[Click here for chain integration guide.](/CHAIN_INTEGRATION.md)\n\n## Docker\n\n### Pull the latest release\n\n```bash\ndocker pull docker.io/parity/substrate-api-sidecar:latest\n```\n\nThe specific image tag matches the release version.\n\n### Or build from source\n\n```bash\nyarn build:docker\n```\n\n### Run\n\n```bash\n# For default use run:\ndocker run --rm -it -p 8080:8080 substrate-api-sidecar\n\n# Or if you want to use environment variables set in `.env.docker`, run:\ndocker run --rm -it --env-file .env.docker -p 8080:8080 substrate-api-sidecar\n```\n\nthen you can test with:\n\n```bash\ncurl -s http://0.0.0.0:8080/blocks/head | jq\n```\n\n**N.B.** The docker flow presented here is just a sample to help get started. Modifications may be necessary for secure usage.\n\n## Contribute\n\nNeed help or want to contribute ideas or code? Head over to our [CONTRIBUTING](CONTRIBUTING.md) doc for more information.\n\n## Note for maintainers\n\nAll the commits in this repo follow the [Conventional Commits spec](https://www.conventionalcommits.org/en/v1.0.0/#summary). When merging a PR, make sure 1/ to\nuse squash merge and 2/ that the title of the PR follows the Conventional Commits spec.\n\nThe history of commits will be used to generate the `CHANGELOG`. To do so, run `yarn deploy` on the master\nbranch. This command will look at all the commits since the latest tag, bump the package version according\nto semver rules, and generate a new `CHANGELOG`.\n\nIf you don't want to follow semver or need to do a dry run, consult the [`standard-version` CLI usage](https://github.com/conventional-changelog/standard-version#cli-usag)\ndocs. Flags for `standard-version` can be passed to `yarn deploy`.\n\n`yarn deploy`, which only does local operations and doesn't push anything, will output more or\nless the following lines:\n\n``` bash\n$ yarn deploy\nyarn run v1.21.1\n$ yarn build \u0026\u0026 standard-version -r minor\n$ rimraf lib/ \u0026\u0026 tsc\n✔ bumping version in package.json from 0.18.1 to 0.18.2\n✔ outputting changes to CHANGELOG.md\n✔ committing package.json and CHANGELOG.md\n✔ tagging release v0.18.2\nℹ Run `git push --follow-tags origin master \u0026\u0026 npm publish` to publish\n```\n\nTo publish the new package, just follow the instructions: `git push --follow-tags origin master \u0026\u0026 npm publish.`\nYou must have access to the @substrate organization on npm to publish.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetcoin%2Ftetcore-api-sidecar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetcoin%2Ftetcore-api-sidecar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetcoin%2Ftetcore-api-sidecar/lists"}