Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(methods): add generic documentation on all rpc methods #8

Merged
merged 1 commit into from
Sep 14, 2021

Conversation

miraclx
Copy link
Contributor

@miraclx miraclx commented Sep 14, 2021

Add generic documentation on all methods in near_jsonrpc_client::methods... primarily for clarity. Showing which exported type does what. Disambiguating between Rpc*Request / Rpc*Response & Rpc*Error types.

Example generated documentation

Module near_jsonrpc_client::methods::broadcast_tx_async

Example

use near_jsonrpc_client::{errors, methods, JsonRpcClient, JsonRpcMethodCallResult};

use methods::broadcast_tx_async::{
    RpcBroadcastTxAsyncRequest,
    CryptoHash,
    RpcBroadcastTxAsyncError,
};

let mainnet_client = JsonRpcClient::new().connect("https://rpc.mainnet.near.org");

let request = RpcBroadcastTxAsyncRequest {...}; // <-- create a valid request here

let result: errors::JsonRpcMethodCallResult<
    CryptoHash,
    RpcBroadcastTxAsyncError,
> = mainnet_client.call(&request);
  • RPC Method Constructor: RpcBroadcastTxAsyncRequest
  • RPC Method Response Type: CryptoHash
  • RPC Method Error Type: RpcBroadcastTxAsyncError

Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macro magic gets out of hands 😄

@miraclx miraclx merged commit 3bd1446 into master Sep 14, 2021
@miraclx miraclx deleted the generic-method-doc branch September 14, 2021 17:04
@frol frol mentioned this pull request Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants