Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

YGrpc 客户端

一个对 Yellowstone gRPC 协议简单封装的 Rust 客户端,方便使用。

使用

源码依赖 根据自己的项目配置调整Cargo.toml中的依赖 较新的yellow stone grpc可能需要修改部分源码

使用方法

let client =
YGrpcClient::new("https://solana-yellowstone-grpc.publicnode.com:443",None).await;let level = SubLevel::Processed;// Test transaction subscription cancellationlet tx_id = "tx_cancel_test".to_string();let accounts = vec!["675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8".to_string()];// System programletmut transaction_rx = client
.simple_sub_transactions(tx_id.clone(), accounts,false,None, level).await.unwrap();let tx_client = client.clone();let tx_id_clone = tx_id.clone();
tokio::spawn(asyncmove{letmut cnt = 0;whileletSome(tx) = transaction_rx.recv().await{let tx = tx.transaction.unwrap();
cnt += 1;
log::info!("cancel test - cnt: {}, tx: {:?}",
cnt,
bs58::encode(tx.signature).into_string());if cnt >= 3{
log::info!("Requesting cancellation of transaction subscription");
tx_client.cancel_subscribe(&tx_id_clone).await;break;}}
log::info!("tx cancel test loop exit");});

许可证

本项目采用 MIT 许可证。

YGrpcClient

About

yellow stone grpc simple wrapper client

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages