diff --git a/lez/wallet/src/cli/account.rs b/lez/wallet/src/cli/account.rs index c3e4ef21..1d2854d4 100644 --- a/lez/wallet/src/cli/account.rs +++ b/lez/wallet/src/cli/account.rs @@ -111,8 +111,9 @@ pub enum NewSubcommand { #[arg(long, requires = "pda")] /// Program ID as hex string. program_id: Option, - #[arg(long, requires = "pda")] - /// Identifier that diversifies this PDA within the (`program_id`, seed, npk) family. + #[arg(long)] + /// Identifier selecting the shared account. + /// Co-owners must supply the same value to derive the same account. /// Defaults to a random value if not specified. identifier: Option, }, @@ -237,6 +238,10 @@ impl NewSubcommand { identifier.unwrap_or_else(rand::random), ) .await? + } else if let Some(id) = identifier { + wallet_core + .create_shared_regular_account_with_identifier(group.clone(), id) + .await? } else { wallet_core .create_shared_regular_account(group.clone()) diff --git a/lez/wallet/src/lib.rs b/lez/wallet/src/lib.rs index f2d135f5..3dfef27f 100644 --- a/lez/wallet/src/lib.rs +++ b/lez/wallet/src/lib.rs @@ -439,14 +439,21 @@ impl WalletCore { }) } - /// Create a shared regular private account from a group's GMS. Returns the `AccountId` and - /// derived keys. The derivation seed is computed deterministically from a random identifier. + /// Create a shared regular private account from a group's GMS with a random identifier. pub async fn create_shared_regular_account( &mut self, group_name: Label, ) -> Result { - let identifier: lee_core::Identifier = rand::random(); + self.create_shared_regular_account_with_identifier(group_name, rand::random()) + .await + } + /// Create a shared regular private account from a group's GMS under the given `identifier`. + pub async fn create_shared_regular_account_with_identifier( + &mut self, + group_name: Label, + identifier: lee_core::Identifier, + ) -> Result { let holder = self .storage .key_chain()