1个不稳定版本
0.1.4 | 2024年8月12日 |
---|
#938 in 神奇豆子
185 每月下载次数
用于 2 crates
4MB
109K SLoC
Tangle-Subxt
Rust接口,通过RPC与tangle节点交互
从Substrate节点下载元数据
使用subxt-cli
工具从节点下载目标运行时的元数据。
- 安装
cargo install [email protected] --force
- 要保存
tangle
的元数据:运行tangle
节点的发布版本,然后在另一个终端运行
subxt metadata -f bytes > ./metadata/tangle-mainnet-runtime.scale
- 从元数据生成subxt代码
subxt codegen --file metadata/tangle-testnet-runtime.scale \
--derive Clone \
--derive Eq \
--derive PartialEq \
--attributes-for-type tangle_primitives::services::field::Field='#[codec(dumb_trait_bound)]' \
--derive-for-type tangle_primitives::services::ServiceBlueprint=serde::Serialize,recursive\
--derive-for-type tangle_primitives::services::ServiceBlueprint=serde::Deserialize,recursive | rustfmt --edition=2021 --emit=stdout > src/tangle_testnet_runtime.rs
本地测试
您可以运行以下测试来触发本地开发中的Job pallet事件。
- 运行本地Tangle网络
./scripts/run-standalone-local.sh --clean
- 运行测试
cargo test test_job_submission_event
依赖项
~58MB
~1M SLoC