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

feat: wallet namespace types #1448

Merged
merged 18 commits into from
Oct 18, 2024

Conversation

nadtech-hub
Copy link
Contributor

@nadtech-hub nadtech-hub commented Oct 10, 2024

Motivation

Should close #1420

Solution

Added response type of wallet_getCapabilities call.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Signed-off-by: nadtech-hub <taberlick@gmail.com>
Signed-off-by: nadtech-hub <taberlick@gmail.com>
Signed-off-by: nadtech-hub <taberlick@gmail.com>
Signed-off-by: nadtech-hub <taberlick@gmail.com>
Signed-off-by: nadtech-hub <taberlick@gmail.com>
@nadtech-hub
Copy link
Contributor Author

nadtech-hub commented Oct 11, 2024

May I deliver other wallet types in separate pull requests?

Signed-off-by: nadtech-hub <taberlick@gmail.com>
@nadtech-hub
Copy link
Contributor Author

nadtech-hub commented Oct 11, 2024

I didn't implement struct's getters / setters as long as their properties are made public

crates/rpc-types-wallet/src/wallet.rs Outdated Show resolved Hide resolved
crates/rpc-types-wallet/src/wallet.rs Outdated Show resolved Hide resolved
Comment on lines 67 to 76
/// Response type for RPC call.
///
/// See [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792#wallet_getcapabilities)
pub type GetCapabilitiesResult = HashMap<ChainId, HashMap<String, PermissionValue>>;

/// Response type of wallet_sendCalls
pub type SendCallsResult = String;

/// Request params of RPC call wallet_getCapabilities
pub type GetCapabilitiesParams = Vec<Address>;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

please remove these aliases, these are not very useful

Signed-off-by: nadtech-hub <taberlick@gmail.com>
@@ -0,0 +1,29 @@
[package]
name = "wallet-rpc-types"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name = "wallet-rpc-types"
name = "alloy-wallet-rpc-types"

pub calls: Vec<CallParams>,
/// Enabled permissions per chain
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
pub capabilities: Option<HashMap<String, PermissionValue>>
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just use serde value here and remove the permissionValue

Comment on lines 67 to 76
/// Response type for RPC call.
///
/// See [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792#wallet_getcapabilities)
pub type GetCapabilitiesResult = HashMap<ChainId, HashMap<String, PermissionValue>>;

/// Response type of wallet_sendCalls
pub type SendCallsResult = String;

/// Request params of RPC call wallet_getCapabilities
pub type GetCapabilitiesParams = Vec<Address>;
Copy link
Member

Choose a reason for hiding this comment

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

please remove these aliases, these are not very useful

@mattsse mattsse merged commit 4e27912 into alloy-rs:main Oct 18, 2024
26 checks passed
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.

[Feature] Add rpc types for wallet_ namespace
2 participants