Crates.io | rusnap-ethers |
lib.rs | rusnap-ethers |
version | 0.1.4 |
source | src |
created_at | 2023-10-13 09:02:19.11692 |
updated_at | 2023-10-17 15:03:52.338439 |
description | Ethers compact layer for RuSnap |
homepage | |
repository | https://github.com/tiannian/rusnap |
max_upload_size | |
id | 1002119 |
size | 8,009 |
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
.
Note:
rusnap-ethers
don't re-export intorusnap
crate, please add this crate independently.