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

[tracking] RPC refactoring wishlist #4032

Open
5 of 14 tasks
aatifsyed opened this issue Mar 6, 2024 · 1 comment
Open
5 of 14 tasks

[tracking] RPC refactoring wishlist #4032

aatifsyed opened this issue Mar 6, 2024 · 1 comment
Labels
Priority: 4 - Low Limited impact and can be implemented at any time Type: Enhancement

Comments

@aatifsyed
Copy link
Contributor

aatifsyed commented Mar 6, 2024

The motivating use-case is #4038.
While we're in the area we can do a lot of cleanup.

@aatifsyed
Copy link
Contributor Author

aatifsyed commented Apr 8, 2024

Code snippets file for VSCode:

// This should live somewhere like `${workspaceDir}/.vscode/rpc.code-snippets`
{
	"rpc method": {
		"prefix": "impl RpcMethod",
		"body": [
			"pub enum ${1:MethodName} {}",
			"impl RpcMethod<${2:ARITY}> for $1 {",
			"const NAME: &'static str = \"Filecoin.$1\";",
			"const PARAM_NAMES: [&'static str; $2] = [$3];",
			"const API_VERSION: ApiVersion = ApiVersion::${7:V0};",
			"",
			"type Params = ($4);",
			"type Ok = $6;",
			"",
			"async fn handle(ctx: Ctx<impl Blockstore $8>, ($5): Self::Params) -> Result<Self::Ok, ServerError> {",
			"$0",
			"}", // fn handle
			"}", // impl RpcMethod
		]
	},
	"imports": {
		"prefix": "use",
		"body": [
			"use crate::rpc::{reflect::SelfDescribingRpcModule, ApiVersion, Ctx, RPCState, RpcMethod, RpcMethodExt as _, ServerError};",
			"use schemars::JsonSchema;"
		]
	},
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 4 - Low Limited impact and can be implemented at any time Type: Enhancement
Projects
Status: No status
Status: In Progress
Development

No branches or pull requests

2 participants