-
Notifications
You must be signed in to change notification settings - Fork 113
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: add sov-modules-wallet-blueprint
#1179
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[package] | ||
name = "sov-modules-wallet-blueprint" | ||
description = "Defines the interface of the Sovereign SDK wallet" | ||
authors = { workspace = true } | ||
edition = { workspace = true } | ||
homepage = { workspace = true } | ||
license = { workspace = true } | ||
repository = { workspace = true } | ||
|
||
version = { workspace = true } | ||
readme = "README.md" | ||
resolver = "2" | ||
|
||
[dependencies] | ||
anyhow = { workspace = true, optional = true } | ||
async-trait = { workspace = true, optional = true } | ||
borsh = { workspace = true, optional = true } | ||
serde = { workspace = true, optional = true } | ||
serde_json = { workspace = true, optional = true } | ||
sov-cli = { path = "../sov-cli", optional = true } | ||
sov-mock-da = { path = "../../adapters/mock-da", version = "0.3", optional = true } | ||
sov-modules-api = { path = "../sov-modules-api", version = "0.3" } | ||
sov-modules-rollup-blueprint = { path = "../sov-modules-rollup-blueprint", optional = true } | ||
sov-rollup-interface = { path = "../../rollup-interface", version = "0.3" } | ||
|
||
[features] | ||
default = ["cli", "default-impl"] | ||
cli = [ | ||
"anyhow", | ||
"async-trait", | ||
"borsh", | ||
"native", | ||
"serde", | ||
"serde_json", | ||
"sov-cli", | ||
"sov-modules-rollup-blueprint", | ||
] | ||
default-impl = ["sov-mock-da"] | ||
native = [ | ||
"sov-mock-da?/native", | ||
"sov-modules-api/native", | ||
"sov-rollup-interface/native", | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use sov_modules_api::Context; | ||
use sov_rollup_interface::da::DaSpec; | ||
|
||
#[cfg(feature = "cli")] | ||
pub mod cli; | ||
|
||
/// Blueprint definition for a module wallet. | ||
/// | ||
/// The associated types of this trait are expected to be implemented concretely as binary | ||
/// endpoints depends on resolved generics in order to compile properly. | ||
/// | ||
/// The `DefaultWalletBlueprint` contains concrete types for the default implementations on | ||
/// `sov-modules-api`. It lives behind a feature flag 'default-impl'. | ||
pub trait WalletBlueprint { | ||
/// Context used to define the asymetric cryptography for keys generation and signing. | ||
type Context: Context; | ||
/// DA specification used to declare runtime call message of the module, that is signed by the | ||
/// wallet. | ||
type DaSpec: DaSpec; | ||
} | ||
|
||
#[cfg(feature = "default-impl")] | ||
pub struct DefaultWalletBlueprint; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't need this. If we move the code to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The goal of this struct is to make a If we implement |
||
|
||
#[cfg(feature = "default-impl")] | ||
impl WalletBlueprint for DefaultWalletBlueprint { | ||
type Context = sov_modules_api::default_context::ZkDefaultContext; | ||
type DaSpec = sov_mock_da::MockDaSpec; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a new crate? Can we just put the
snap-wallet
insov-modules-rollup-blueprint
so everything is in one place?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would bring more feature complexity to
sov-modules-rollup-blueprint
as I need to differentiate when we generate for the CLI (so we use things likeclap
as dependency), and for the WASM (that is as minimal as possible to keep the binary size small)If we put it under
sov-modules-rollup-blueprint
, we will have to shield anything non-wallet behind feature flags