{"id":29353015,"url":"https://github.com/polymeshassociation/sub-script","last_synced_at":"2026-02-27T03:31:41.689Z","repository":{"id":41135444,"uuid":"428228718","full_name":"PolymeshAssociation/sub-script","owner":"PolymeshAssociation","description":"Scripting interface for substrate nodes.","archived":false,"fork":false,"pushed_at":"2025-04-23T11:52:25.000Z","size":804,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-25T14:42:51.186Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/PolymeshAssociation.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-15T11:03:28.000Z","updated_at":"2025-04-23T11:52:29.000Z","dependencies_parsed_at":"2024-01-04T16:47:01.392Z","dependency_job_id":"098356ec-e06e-404c-95cb-1c523d8b2466","html_url":"https://github.com/PolymeshAssociation/sub-script","commit_stats":{"total_commits":191,"total_committers":1,"mean_commits":191.0,"dds":0.0,"last_synced_commit":"9f5f12cb9bafc8b9d4193418cc430407a1646bc3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PolymeshAssociation/sub-script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymeshAssociation%2Fsub-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymeshAssociation%2Fsub-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymeshAssociation%2Fsub-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymeshAssociation%2Fsub-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolymeshAssociation","download_url":"https://codeload.github.com/PolymeshAssociation/sub-script/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymeshAssociation%2Fsub-script/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269677392,"owners_count":24457847,"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-08-10T02:00:08.965Z","response_time":71,"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":[],"created_at":"2025-07-09T01:43:01.133Z","updated_at":"2026-02-27T03:31:41.661Z","avatar_url":"https://github.com/PolymeshAssociation.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sub-script\n\nA simple scripting interface for [Substrate](https://substrate.dev) nodes.\nIt uses [Rhai](https://rhai.rs) for the scripting engine.\n\n## Features\n\n- Auto generate key pairs for named users by accessing `USER.\u003cUserName\u003e`.\n- Loads chain metadata for all modules, extrinsics, events, storages and types (for v14+ Metadata chains).\n- Easy to sign and submit extrinsic calls.\n- Spawning sub-task (threads) for load testing.\n\n## Goals\n\n- Flexible - Load chain metadata from node and all custom types from `schema.json` file.  No recompile needed.\n- Mocking - Easy to share scripts for mocking large number of users, assets, etc.. on a local node for testing UIs.\n- Debuging - Provides a low-level interface to the node.  Easy to change schema types for testing encoding issues.\n\n## Non-Goals\n\n- This doesn't replace SDKs for other languages.  The available libraries will be very limited.\n- Please don't use on Mainnet.\n\n## Todo\n\n- Subscribe to storage updates.\n- Add REPL support for quickly making extrinsic calls.\n\n## Examples\n\n```rhai\n// Use Alice for mocking cdd.\nlet alice = USER.Alice;\n\n// Generate a test user.  Key generated from \"//Test123\" seed.\nlet user = USER.Test123;\n\n// Mock Cdd for user and make sure they have some POLYX.\nlet res = alice.submit(TestUtils.mock_cdd_register_did(user));\nif res.is_success {\n\t// New account send them some POLYX.\n\talice.submit(Balances.transfer(user, 5.0));\n}\n\n// Generate another test user.  Key generated from \"//Key1\" seed.\nlet key = USER.Key1; // Don't mock cdd for this user.\n\n// Add JoinIdentity authorization for `key` to join `user`.\nlet res = user.submit(Identity.add_authorization(#{\n\tAccount: key\n}, #{\n\tJoinIdentity: #{\n\t\tasset: #{ These: [\"ACME\"] },\n\t\textrinsic: #{ Whole: () },\n\t\tportfolio: #{ Whole: () },\n\t}\n}, ()));\nif res.is_success {\n\t// call successful.\n} else {\n\t// call failed.\n\tprint(`failed: ${res.result}`);\n}\n\n// Process all events emitted by the call.\nfor event in res.events {\n\tprint(`EventName: ${event.name}`);\n\tprint(`  Args: ${event.args}`);\n}\n// Process events matching prefix 'Identity.Auth'.\nfor event in res.events(\"Identity.Auth\") {\n\tprint(`EventName: ${event.name}`);\n\tprint(`  Args: ${event.args}`);\n}\n```\n\nSee other examples scripts in `./scripts/` folder.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolymeshassociation%2Fsub-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolymeshassociation%2Fsub-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolymeshassociation%2Fsub-script/lists"}