Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit 724c066

Browse files
bors[bot]Devashish Dixit
andauthored
Merge #673
673: Problem: (CRO-599) No way to get public key for creating new MultiSig address r=tomtau a=devashishdxt Solution: Exposed `wallet_newPublicKey` method in `client-rpc` Co-authored-by: Devashish Dixit <devashish@crypto.com>
2 parents 8af48ce + fc7761c commit 724c066

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

client-rpc/src/rpc/wallet_rpc.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use chain_core::tx::data::output::TxOut;
1212
use chain_core::tx::TxObfuscated;
1313
use chain_core::tx::{TxAux, TxEnclaveAux};
1414
use client_common::{PublicKey, Result as CommonResult};
15-
use client_core::types::TransactionChange;
1615
use client_core::types::WalletKind;
16+
use client_core::types::{AddressType, TransactionChange};
1717
use client_core::{Mnemonic, MultiSigWalletClient, WalletClient};
1818

1919
use crate::server::{rpc_error_from_string, to_rpc_error, WalletRequest};
@@ -29,6 +29,9 @@ pub trait WalletRpc: Send + Sync {
2929
#[rpc(name = "wallet_restore")]
3030
fn restore(&self, request: WalletRequest, mnemonics: Mnemonic) -> Result<String>;
3131

32+
#[rpc(name = "wallet_newMultiSigAddressPublicKey")]
33+
fn new_multi_sig_address_public_key(&self, request: WalletRequest) -> Result<String>;
34+
3235
#[rpc(name = "wallet_createStakingAddress")]
3336
fn create_staking_address(&self, request: WalletRequest) -> Result<String>;
3437

@@ -129,6 +132,17 @@ where
129132
Ok(request.name)
130133
}
131134

135+
fn new_multi_sig_address_public_key(&self, request: WalletRequest) -> Result<String> {
136+
self.client
137+
.new_public_key(
138+
&request.name,
139+
&request.passphrase,
140+
Some(AddressType::Transfer),
141+
)
142+
.map(|public_key| public_key.to_string())
143+
.map_err(to_rpc_error)
144+
}
145+
132146
fn create_staking_address(&self, request: WalletRequest) -> Result<String> {
133147
self.client
134148
.new_staking_address(&request.name, &request.passphrase)

0 commit comments

Comments
 (0)