{"id":19563258,"url":"https://github.com/kodadot/stick","last_synced_at":"2025-06-13T06:07:29.838Z","repository":{"id":160493950,"uuid":"633397979","full_name":"kodadot/stick","owner":"kodadot","description":"GraphQL service for Uniques and Assets on Asset Hubs","archived":false,"fork":false,"pushed_at":"2025-05-29T20:16:32.000Z","size":1204,"stargazers_count":5,"open_issues_count":65,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-13T06:04:02.222Z","etag":null,"topics":["assethub","hacktoberfest","kodadot","kusama","nft","polkadot","polkadot-assethub","subsquid"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kodadot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-27T12:12:25.000Z","updated_at":"2025-05-29T20:01:32.000Z","dependencies_parsed_at":"2023-10-23T12:25:31.994Z","dependency_job_id":"cc4def09-a448-46fb-bc0c-5e42374a4489","html_url":"https://github.com/kodadot/stick","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/kodadot/stick","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodadot%2Fstick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodadot%2Fstick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodadot%2Fstick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodadot%2Fstick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodadot","download_url":"https://codeload.github.com/kodadot/stick/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodadot%2Fstick/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259592261,"owners_count":22881266,"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":["assethub","hacktoberfest","kodadot","kusama","nft","polkadot","polkadot-assethub","subsquid"],"created_at":"2024-11-11T05:17:06.520Z","updated_at":"2025-06-13T06:07:29.816Z","avatar_url":"https://github.com/kodadot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stick\n\n![](https://media.tenor.com/Eu0LNbU4hQMAAAAC/jeanne-darc-vanitas-no-carte.gif)\n\n[Squid](https://docs.subsquid.io) based data used to index, process, and query on top of AssetHub for [KodaDot](https://kodadot.xyz) NFT Marketplace.\n\n## Hosted Squids\n\n* Kusama AssetHub Processor (Statemine -\u003e KSM): [AHK GraphQL](https://kodadot.squids.live/stick:prod/api/graphql)\n* Polkadot AssetHub Processor (Statemint -\u003e DOT): [AHP GraphQL](https://kodadot.squids.live/speck:prod/api/graphql)\n* Paseo Testnet Processor: 🚧 Coming soon 🚧\n\n## Project structure\n\n* `src/generated` - model/server definitions created by `codegen`. Do not alter the contents of this directory manually.\n* `src/server-extension` - module with custom `type-graphql` based resolvers.\n* `src/types` - data type definitions for chain events and extrinsics created by `typegen`.\n* `src/mappings` - mapping module.\n* `lib` - compiled js files. The structure of this directory must reflect `src`.\n* `.env` - environment variables defined here or supplied by a shell.\n\n## Prerequisites\n\n* Node 18.x\n* Docker\n* npm\n* [just](https://github.com/casey/just)\n\n## Quickly running the sample\n\n```bash\n# 1. Install dependencies\nnpm ci\n\n# 2. Build project\njust build\n\n# 3. Start target Postgres database container\njust upd\n\n# 4. Update database with data objects\njust migrate\n\n# 5. Start the processor\njust process\n\n# 6. Open a separate terminal and launch the graphql server to query the processed data\njust serve\n\n# 7. Visit localhost:4350/graphql to see the result\n```\n\n## Dev flow\n\n### 1. Define database schema\n\nStart development by defining the schema of the target database via `schema.graphql`.\nSchema definition consists of regular graphql type declarations annotated with custom directives.\nA full description of `schema.graphql` dialect is available [here](https://docs.subsquid.io/schema-file).\n\n### 2. Generate TypeORM classes\n\nMapping developers use [TypeORM](https://typeorm.io) entities to interact with the target database during data processing. The squid framework generates All necessary entity classes from `schema.graphql`. This is done by running `just codegen` command.\n\n### 3. Generate database migration\n\nAll database changes are applied through migration files located at `db/migrations`.\n`squid-typeorm-migration` tool provides several commands to drive the process.\nIt is all [TypeORM](https://typeorm.io/#/migrations) under the hood.\n\n```bash\n# Connect to the database, analyze its state, and generate a migration to match the target schema.\n# Launch Docker instance of the database\njust upd\n\n# The target schema is derived from entity classes generated earlier.\n# Remember to compile your entity classes beforehand!\njust update-db\n\n# Apply database migrations from `db/migrations`\njust migrate\n\n# Revert the last performed migration\njust revert-db\n```\n\nAvailable `sqd` shortcuts:\n\n```bash\n# Build the project, remove any old migrations, then run `npx squid-typeorm-migration generate`\nsqd migration:generate\n\n# Run npx squid-typeorm-migration apply\nsqd migration:apply\n```\n\n### Testing\n\n\u003e Unit test early, unit test often\n\n\u003e [!NOTE]\n\u003e Any code imported from @kodadot [packages has unit test written in the separated repository](https://github.com/kodadot/packages)\n\nThis indexer contains unit tests for utility/parsing functions we wrote.\n\nTests are located in the `tests/` directory.\nTo run the tests, use:\n\n```bash\nnpm run test\n```\n\n\u003e [!WARNING]\n\u003e Currently, it is impossible to unit test the whole indexer workflow as a dry run. If you encounter some problem, please head over to the telegram group **HydraDevs**\n\n## Architecture\n\nThe architecture of this project is following:\n\n* `src/processable.ts` - definition of Events and Extrinsic to be processed by Squid\n* `src/processor.ts` - processor definition\n* `src/mappings/index` - the main function that is called by the processor to process events and extrinsic\n* `src/mappings/\u003cpallet\u003e` - mapping functions for each event and extrinsic\n* `src/mappings/\u003cpallet\u003e/types.ts` - types for each event and extrinsic\n* `src/mappings/\u003cpallet\u003e/getters/\u003cchain\u003e.ts` - transformation functions for each event and extrinsic\n* `src/mappings/utils` - utility functions used by mappings\n\n## Misc\n\n1. fast generate event handlers \n\n```bash\npbpaste | cut -d '=' -f 1 | tr -d ' '  | xargs -I_ echo \"processor.addEventHandler(Event._, dummy);\"\n```\n\n2. enable debug logs (in .env)\n\n```bash\nSQD_DEBUG=squid:log\n```\n\n3. generate metagetters from getters \n\n```bash\npbpaste | grep 'export'  | xargs -I_ echo \"_  return proc.  }\"\n```\n\n4. Enable different chain (currently only Kusama and Polkadot are supported)\n\n\u003e [!NOTE]\n\u003e By default the chain is set to `kusama`\n\n```bash\nCHAIN=polkadot # or kusama\n```\n\n5. enable offers \n\n`Offers` support is a hack on top of the `Atomic Swap` to enable `Offers` set in `.env` file\n\n```bash\nOFFER=\u003cID_OF_THE_COLLECTION\u003e\n```\n\n6. debugging the processor\n\nAs the processor can run for a longer period of time it is useful to turn off the \"features\" that you do not need,\nHandlers that need to be always enabled are `createCollection` and `createItem` as they are the base for the rest of the processor.\n\n\u003e [!NOTE]\n\u003e If you do not wish to index `uniques` pallet you can turn it off by setting `UNIQUES_ENABLED=false` in `.env` file\n\n### Note on Swaps\n\n1. Swaps can be overwritten at any time\n\nTherefore if you have a swap, and will create a new one, the old one will be overwritten. This is mentioned in `createSwap.ts` Line 31.\n\n2. Swaps are autocancelled by few conditions\n\n- if you `burn` the NFT\n- if you `transfer` the NFT\n\nin any other condition the swap will have to be cancelled manually.\n\n## Funding\n\nProject was funded as a common good by\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"200\" alt=\"version\" src=\"https://user-images.githubusercontent.com/55763425/211145923-f7ee2a57-3e63-4b7d-9674-2da9db46b2ee.png\" /\u003e\n\u003c/div\u003e\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodadot%2Fstick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodadot%2Fstick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodadot%2Fstick/lists"}