{"id":15060032,"url":"https://github.com/nzengi/spawn-wasm-erc721","last_synced_at":"2026-01-05T00:50:25.862Z","repository":{"id":255569089,"uuid":"853128905","full_name":"nzengi/spawn-wasm-erc721","owner":"nzengi","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-11T07:46:09.000Z","size":101840,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T20:52:36.868Z","etag":null,"topics":["assembly","erc721","ethereum","rust","rust-library","wasm"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/nzengi.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}},"created_at":"2024-09-06T03:40:38.000Z","updated_at":"2024-09-11T07:46:12.000Z","dependencies_parsed_at":"2024-09-06T04:23:52.463Z","dependency_job_id":null,"html_url":"https://github.com/nzengi/spawn-wasm-erc721","commit_stats":null,"previous_names":["nzengi/spawn-wasm-erc721"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzengi%2Fspawn-wasm-erc721","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzengi%2Fspawn-wasm-erc721/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzengi%2Fspawn-wasm-erc721/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzengi%2Fspawn-wasm-erc721/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nzengi","download_url":"https://codeload.github.com/nzengi/spawn-wasm-erc721/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239167039,"owners_count":19593139,"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":["assembly","erc721","ethereum","rust","rust-library","wasm"],"created_at":"2024-09-24T22:51:28.708Z","updated_at":"2025-10-31T09:31:00.070Z","avatar_url":"https://github.com/nzengi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spawn-wasm-erc721\n\n`spawn-wasm-erc721` is a Rust library designed to handle ownership and user roles for smart contracts in a WebAssembly (WASM) environment. This library provides essential functionality for role management, including assigning roles to users, checking role-based access, and transferring ownership.\n\n## Features\n\n- **Ownership Management**: Enables ownership transfer and ensures that only the owner can perform sensitive actions like role assignments.\n- **Role-based Access Control**: Allows access to contract methods based on assigned roles.\n- **WASM Compatibility**: Designed to work seamlessly in WebAssembly, allowing for easy integration into JavaScript-based environments.\n- **Event Logging**: Logs important events like ownership transfers and role assignments to the browser console for easier debugging.\n\n## Installation\n\nTo use the library, first add the following dependencies to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nwasm-bindgen = \"0.2\"\nweb-sys = { version = \"0.3\", features = [\"console\"] }\n```\n\nAlso, ensure the following settings are added to your Cargo.toml for WebAssembly compilation:\n\n```toml\n[lib]\ncrate-type = [\"cdylib\"]\n\n[profile.release]\nlto = true\n\n[package.metadata.wasm-pack.profile.release]\nwasm-opt = [\"-Oz\"]\n```\n## Usage\nInitialize RoleManager\nTo initialize the RoleManager struct with an owner:\n\n```rust\nuse spawn_wasm_erc721::RoleManager;\n\nlet owner = \"owner1\".to_string();\nlet mut role_manager = RoleManager::new(owner);\n```\n\n## Assign a Role\nAssign a role to a user, ensuring the caller is the owner:\n\n```rust\nrole_manager.assign_role(\"owner1\".to_string(), \"admin\".to_string(), \"user1\".to_string());\n```\n\n## Check Role-Based Access\nCheck if a user has access based on a specific role:\n\n```rust\nlet has_access = role_manager.role_based_access(\"user1\".to_string(), \"admin\".to_string());\n```\n\n## Transfer Ownership\nOwnership can only be transferred by the current owner:\n\n```rust\nrole_manager.transfer_ownership(\"owner1\".to_string(), \"new_owner\".to_string());\n```\n\n## List Role Users\nTo list all users with a specific role:\n\n```rust\nlet users = role_manager.list_role_users(\"admin\".to_string());\n```\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzengi%2Fspawn-wasm-erc721","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnzengi%2Fspawn-wasm-erc721","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzengi%2Fspawn-wasm-erc721/lists"}