RpcClient::send<T> now supports client-defined RPC methods via RpcRequest::Custom
This commit is contained in:
@@ -2575,6 +2575,7 @@ mod tests {
|
||||
let signature = rpc_client.send_transaction(&tx);
|
||||
assert!(signature.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_recent_blockhash() {
|
||||
let rpc_client = RpcClient::new_mock("succeeds".to_string());
|
||||
@@ -2589,6 +2590,20 @@ mod tests {
|
||||
assert!(rpc_client.get_recent_blockhash().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_custom_request() {
|
||||
let rpc_client = RpcClient::new_mock("succeeds".to_string());
|
||||
|
||||
let slot = rpc_client.get_slot().unwrap();
|
||||
assert_eq!(slot, 0);
|
||||
|
||||
let custom_slot = rpc_client
|
||||
.send::<Slot>(RpcRequest::Custom { method: "getSlot" }, Value::Null)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(slot, custom_slot);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_signature_status() {
|
||||
let signature = Signature::default();
|
||||
|
Reference in New Issue
Block a user