| Crates.io | rusnap-macros |
| lib.rs | rusnap-macros |
| version | 0.1.2 |
| created_at | 2023-10-11 08:17:44.098146+00 |
| updated_at | 2023-10-13 15:50:17.908309+00 |
| description | Macros for RuSnap |
| homepage | |
| repository | https://github.com/tiannian/rusnap |
| max_upload_size | |
| id | 999936 |
| size | 6,263 |
Build Metamask Snap use Rust.
https://github.com/tiannian/rusnap-example
Install cargo-rusnap.
cargo install rusnap
Please install these dependencies.
cargo rusnap new <pkg-name>
# Build dev mode in default
cargo rusnap build
# Build release mode
cargo rusnap build --release
cargo rusnap start
Then you can load snap in metamask.
Execute these js statement in broswer devtool:
window.ethereum.request({
method: "wallet_requestSnaps",
params: { "local:http://localhost:8080": {} },
});
Or use Metamask Snap Debug Tool.
Execute these js statement in broswer devtool:
window.ethereum.request({
method: "wallet_invokeSnap",
params: {
snapId: "local:http://localhost:8080",
request: {
method: "hello",
},
},
});
TODO
Basic function of Snap:
Use OsRng in rand_core or other random crate based on getrandom.
Please add getrandom with js feature.
getrandom = { version = "0.2.10", features = ["js"] }
Use rusnap-ethers and ethers.