{"id":15292336,"url":"https://github.com/ic-alloy/ic-alloy-toolkit","last_synced_at":"2025-04-13T11:11:48.454Z","repository":{"id":257586321,"uuid":"856257227","full_name":"ic-alloy/ic-alloy-toolkit","owner":"ic-alloy","description":"Example code for using Alloy with the Internet Computer.","archived":false,"fork":false,"pushed_at":"2024-11-28T10:50:18.000Z","size":388,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T05:02:37.486Z","etag":null,"topics":["alloy","ethereum","internet-computer","rust"],"latest_commit_sha":null,"homepage":"https://u4yi6-xiaaa-aaaap-aib2q-cai.icp0.io","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/ic-alloy.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-12T09:07:32.000Z","updated_at":"2025-01-23T05:03:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e1cda74-5d8d-47fe-97ce-c76805fd8b08","html_url":"https://github.com/ic-alloy/ic-alloy-toolkit","commit_stats":null,"previous_names":["kristoferlund/ic-alloy-demo","kristoferlund/ic-alloy-toolkit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ic-alloy","download_url":"https://codeload.github.com/ic-alloy/ic-alloy-toolkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703199,"owners_count":21148118,"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":["alloy","ethereum","internet-computer","rust"],"created_at":"2024-09-30T16:17:25.176Z","updated_at":"2025-04-13T11:11:48.448Z","avatar_url":"https://github.com/ic-alloy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Alloy + ICP Toolkit\n\n[Alloy](https://alloy.rs/) is the next generation of Ethereum support libraries,\nwritten in Rust and designed for scalability and performance. Alloy is a rewrite\nof of [ethers-rs](https://github.com/gakonst/ethers-rs) from the ground up.\nAlloy includes built in support for transports like HTTP, WebSockets and IPC.\n\n**Alloy now also works with the Internet Computer (ICP)!**\n\nThe Alloy libraries have been forked to add support for ICP as a transport\nlayer. This makes it possible to use the full feature set of Alloy from ICP\ncanisters.\n\nThis repository contains a collection of examples of how to use Alloy in an IC\ncontext.\n\n- The backend canister interacting with the EVM through Alloy is written in\n  Rust.\n- The frontend canster uses Vite/React.\n- The ic-alloy fork: \u003chttps://github.com/kristoferlund/ic-alloy\u003e\n- Live demo: \u003chttps://u4yi6-xiaaa-aaaap-aib2q-cai.icp0.io\u003e\n\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url] [![MIT License][license-shield]](LICENSE)\n\n\u003e [!TIP]\n\u003e\n\u003e Live demo: \u003chttps://u4yi6-xiaaa-aaaap-aib2q-cai.icp0.io\u003e\n\n![screenshot](media/screenshot.png)\n\n## Example, get the balance of an address\n\n```Rust\n#[ic_cdk::update]\nasync fn get_balance(address: String) -\u003e Result\u003cString, String\u003e {\n    let address = address.parse::\u003cAddress\u003e().map_err(|e| e.to_string())?;\n    let rpc_service = RpcService::EthSepolia(EthSepoliaService::Alchemy);\n    let config = IcpConfig::new(rpc_service);\n    let provider = ProviderBuilder::new().on_icp(config);\n    let result = provider.get_balance(address).await;\n\n    match result {\n        Ok(balance) =\u003e Ok(balance.to_string()),\n        Err(e) =\u003e Err(e.to_string()),\n    }\n}\n```\n\n[get_balance.rs](src/backend/src/service/get_balance.rs)\n\n## Example, sign a message\n\n```Rust\n#[ic_cdk::update]\nasync fn sign_message(message: String) -\u003e Result\u003cString, String\u003e {\n    let ecdsa_key_name = \"key_1\".to_string();\n    IcpSigner::new(vec![], \u0026ecdsa_key_name, None)).await.unwrap();\n    let signature = signer.sign_message(message.as_bytes()).await.unwrap();\n    Ok(format!(\"{:?}\", signature))\n}\n```\n\n[sign_message.rs](src/backend/src/service/sign_message.rs)\n\n## Setup\n\nThere are two main ways to set up and run the project:\n\n### 1. Using a VS Code Dev Container\n\nThe dev containers extension lets you use a Docker container as a full-featured\ndevelopment environment. This repository includes a dev container configuration\nthat you can use to open the project with all the necessary tools and\ndependencies pre-installed.\n\nPre-requisites:\n\n- [Docker](https://www.docker.com/products/docker-desktop)\n- [Visual Studio Code](https://code.visualstudio.com/)\n- [Dev Containers Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)\n\nOnce Docker, Visual Studio Code and the Dev Containers Extension are installed,\nyou can open the project in a container by clicking the button below:\n\n[![Open locally in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers\u0026message=Open\u0026color=blue\u0026logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/ic-alloy/ic-alloy-toolkit)\n\n### 2. Setup manually\n\nPre-requisites:\n\n- [Local Internet Computer dev environment](https://internetcomputer.org/docs/current/developer-docs/backend/rust/dev-env)\n- [pnpm](https://pnpm.io/installation)\n\nOnce you have the prerequisites installed, you can clone this repository and run\nthe project.\n\n## Running the project\n\n### 1. Start the Internet Computer\n\n```bash\ndfx start --background\n```\n\n### 2. Install dependencies\n\n```bash\npnpm install\n```\n\n### 3. Deploy the canisters\n\n```bash\ndfx deploy\n```\n\n## Develop\n\nDuring development, you can run the frontend with hot reloading using Vite.\n\n```bash\npnpm run dev\n```\n\n## Collaborators\n\n\u003c!-- readme: collaborators,contributors -start --\u003e\n\u003ctable\u003e\n\t\u003ctbody\u003e\n\t\t\u003ctr\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/kristoferlund\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/9698363?v=4\" width=\"100;\" alt=\"kristoferlund\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eKristofer\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/domwoe\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/1970182?v=4\" width=\"100;\" alt=\"domwoe\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eDominic Wörner\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\u003ctbody\u003e\n\u003c/table\u003e\n\u003c!-- readme: collaborators,contributors -end --\u003e\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for more\ndetails.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request if you\nhave any suggestions or improvements.\n\n[contributors-shield]:\n  https://img.shields.io/github/contributors/ic-alloy/ic-alloy-toolkit.svg?style=for-the-badge\n[contributors-url]:\n  https://github.com/ic-alloy/ic-alloy-toolkit/graphs/contributors\n[forks-shield]:\n  https://img.shields.io/github/forks/ic-alloy/ic-alloy-toolkit.svg?style=for-the-badge\n[forks-url]: https://github.com/ic-alloy/ic-alloy-toolkit/network/members\n[stars-shield]:\n  https://img.shields.io/github/stars/ic-alloy/ic-alloy-toolkit?style=for-the-badge\n[stars-url]: https://github.com/ic-alloy/ic-alloy-toolkit/stargazers\n[issues-shield]:\n  https://img.shields.io/github/issues/ic-alloy/ic-alloy-toolkit.svg?style=for-the-badge\n[issues-url]: https://github.com/ic-alloy/ic-alloy-toolkit/issues\n[license-shield]:\n  https://img.shields.io/github/license/ic-alloy/ic-alloy-toolkit.svg?style=for-the-badge\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fic-alloy%2Fic-alloy-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fic-alloy%2Fic-alloy-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fic-alloy%2Fic-alloy-toolkit/lists"}