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

Single account wallet #1279

Merged
merged 116 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
48a698d
start impl
Alex6323 Sep 21, 2023
cfb6589
walk the line 1
Alex6323 Sep 21, 2023
cc2bb0c
walk the line 2
Alex6323 Sep 21, 2023
ec94415
walk the line 3
Alex6323 Sep 22, 2023
7032453
update examples
Alex6323 Sep 25, 2023
03a5844
update tests
Alex6323 Sep 25, 2023
91c83e8
more
Alex6323 Sep 25, 2023
adc2965
update cli
Alex6323 Sep 25, 2023
75c6f11
update wallet builder
Alex6323 Sep 26, 2023
6d7d282
remove redundant event wrapper
Alex6323 Sep 27, 2023
088281f
fix remaining todos 1
Alex6323 Sep 27, 2023
199a6fe
fix remaining todos 2
Alex6323 Sep 27, 2023
e1aa5e9
fix remaining todos 3
Alex6323 Sep 27, 2023
402e4a9
fix remaining todos 4
Alex6323 Sep 27, 2023
250500d
Merge branch '2.0' into refactor/wallet-account
Alex6323 Sep 27, 2023
62029f5
clean up cli
Alex6323 Sep 27, 2023
c799a38
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 2, 2023
751ad14
fix test 1
Alex6323 Sep 27, 2023
9abd625
fix test 2
Alex6323 Sep 27, 2023
ae8a04c
optional wallet alias
Alex6323 Oct 4, 2023
ed7731b
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 4, 2023
12e796a
get rid of some warnings; nits
Alex6323 Oct 4, 2023
28db840
nits
Alex6323 Oct 4, 2023
1426c40
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 4, 2023
a295337
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 11, 2023
93f96ed
fix some todos
Alex6323 Oct 11, 2023
e6cae42
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 11, 2023
7ce754d
remove account backgroudn syncing stuff
Alex6323 Oct 11, 2023
5b3dcc2
merge fix 1
Alex6323 Oct 12, 2023
11ee307
merge fix 2
Alex6323 Oct 12, 2023
c0856cf
remove account parent module
Alex6323 Oct 12, 2023
a36edf1
update core bindings
Alex6323 Oct 12, 2023
8d04532
rename
Alex6323 Oct 12, 2023
7fe9601
PR suggestions 1
Alex6323 Oct 12, 2023
6ec326e
PR suggestions 2
Alex6323 Oct 12, 2023
a5dbcba
fix common features sets [wallet, stronghold]
Alex6323 Oct 12, 2023
54101e1
remove account related tests and examples
Alex6323 Oct 12, 2023
b294636
rename stuff
Alex6323 Oct 16, 2023
160829d
remove oopsies
Alex6323 Oct 16, 2023
f0a3dde
use bip path
Alex6323 Oct 16, 2023
cf8f994
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 16, 2023
edd32e1
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 18, 2023
3aedbc4
rename operation to command
Alex6323 Oct 17, 2023
4178b15
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 18, 2023
8ca8e39
doc fixes
Alex6323 Oct 18, 2023
2e4e3d9
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 24, 2023
63635b7
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 24, 2023
e39542e
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 24, 2023
30a6dfb
nits
Alex6323 Oct 24, 2023
f1b8d31
nits 2
Alex6323 Oct 24, 2023
e35f9bf
nits 3
Alex6323 Oct 24, 2023
e862d2d
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 25, 2023
2d12273
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 26, 2023
1fbbbca
kill Alice ... sooory
Alex6323 Oct 26, 2023
529e1d8
re-enable tests 1
Alex6323 Oct 26, 2023
c7aad63
optional bip path
Alex6323 Oct 26, 2023
5c4cdab
remove verifiy_accounts test
Alex6323 Oct 26, 2023
f63463d
re-enable wallet error serialization test
Alex6323 Oct 26, 2023
53b8bd0
cli: optional bip path
Alex6323 Oct 26, 2023
724b0bb
remove
Alex6323 Oct 26, 2023
5ad2136
more remove
Alex6323 Oct 26, 2023
753e60e
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 26, 2023
efe7e7c
rm dupl imports
Alex6323 Oct 26, 2023
7f625c6
Merge branch '2.0' into refactor/wallet-account
thibault-martinez Oct 27, 2023
76af2a6
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 30, 2023
ac8255e
remove remaining account mentioning in prints
Alex6323 Oct 30, 2023
cd78a60
revert fn rename
Alex6323 Oct 30, 2023
df7a04d
update todo
Alex6323 Oct 30, 2023
a6328b1
update todo 2
Alex6323 Oct 30, 2023
389570a
remove more wallet/account alias mentioning
Alex6323 Oct 30, 2023
e8bba3e
remove more account mentioning
Alex6323 Oct 30, 2023
2aab93c
more renames
Alex6323 Oct 31, 2023
f71d140
custom error serializations
Alex6323 Oct 31, 2023
3680b9d
weird that's still there
Alex6323 Oct 31, 2023
496ae58
more renames
Alex6323 Oct 31, 2023
e927b45
remove more
Alex6323 Oct 31, 2023
b72c04b
Rename alias to account sync options
Alex6323 Oct 31, 2023
1bfa266
default alias
Alex6323 Oct 31, 2023
73eecbc
more
Alex6323 Oct 31, 2023
4a1f95e
and more
Alex6323 Oct 31, 2023
5a5f262
also some that thibault overlooked. how come?
Alex6323 Oct 31, 2023
35de853
more renames ^2
Alex6323 Oct 31, 2023
84a39bc
Rename to wallet-sync-options
Alex6323 Oct 31, 2023
44568d1
Rename secret manager key
Alex6323 Oct 31, 2023
cd4d1c2
Merge branch '2.0' into refactor/wallet-account
Alex6323 Oct 31, 2023
2802b19
nits
Alex6323 Oct 31, 2023
ecd3dbe
nits 2
Alex6323 Oct 31, 2023
6dc16fc
remove whooopsie
Alex6323 Oct 31, 2023
51153f3
optional alias
Alex6323 Oct 31, 2023
f503dec
error tests
Alex6323 Nov 1, 2023
d5060ae
harmony
Alex6323 Nov 1, 2023
0fdcb9e
Merge branch '2.0' into refactor/wallet-account
Alex6323 Nov 1, 2023
8096151
nursery
Alex6323 Nov 1, 2023
f860f06
deny restore with outputs
Alex6323 Nov 1, 2023
abbe274
Rename file
thibault-martinez Nov 1, 2023
a5fe126
Remove inner
thibault-martinez Nov 1, 2023
ae20ba2
More changes
thibault-martinez Nov 1, 2023
9446b12
Merge branch '2.0' into refactor/wallet-account
thibault-martinez Nov 1, 2023
d4cba3f
Comment failing tests
thibault-martinez Nov 1, 2023
73ecd7e
Nit
thibault-martinez Nov 1, 2023
c2d32cf
More nits
thibault-martinez Nov 1, 2023
b958150
Update sdk/src/wallet/core/operations/background_syncing.rs
thibault-martinez Nov 1, 2023
70a3b38
Merge branch '2.0' into refactor/wallet-account
thibault-martinez Nov 1, 2023
619e8b1
Fix a test
thibault-martinez Nov 1, 2023
c691b2c
Bring back assert
thibault-martinez Nov 1, 2023
80addf9
Fix response type
thibault-martinez Nov 1, 2023
c0ea729
Fix another response type
thibault-martinez Nov 1, 2023
c481880
Remove useless added inner() calls
thibault-martinez Nov 1, 2023
9607353
Bring back faucet address
thibault-martinez Nov 1, 2023
c2da899
Fix comment
thibault-martinez Nov 1, 2023
85a116e
Not need to use format
thibault-martinez Nov 1, 2023
860f4ff
TODO
thibault-martinez Nov 1, 2023
3a0752a
update_after_sync
thibault-martinez Nov 1, 2023
9565d7a
Fix log
thibault-martinez Nov 1, 2023
a21a32d
TODO
thibault-martinez Nov 1, 2023
c42b8d8
Improve comment?
thibault-martinez Nov 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
316 changes: 9 additions & 307 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[workspace]
resolver = "2"
members = [
"bindings/core",
"bindings/nodejs",
"bindings/python",
"bindings/wasm",
# TODO: uncomment and fix step by step
#"bindings/core",
#"bindings/nodejs",
#"bindings/python",
#"bindings/wasm",
"cli",
"sdk",
]
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use packable::error::UnexpectedEOF;
use serde::{ser::SerializeMap, Serialize, Serializer};

pub use super::{method::AccountMethod, response::Response};
pub use super::{method::WalletMethod, response::Response};

/// Result type of the bindings core crate.
pub type Result<T> = std::result::Result<T, Error>;
Expand Down
19 changes: 11 additions & 8 deletions bindings/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub use self::method_handler::listen_mqtt;
pub use self::method_handler::CallMethod;
pub use self::{
error::{Error, Result},
method::{AccountMethod, ClientMethod, SecretManagerMethod, UtilsMethod, WalletMethod},
method::{WalletMethod, ClientMethod, SecretManagerMethod, UtilsMethod, WalletMethod},
method_handler::{call_client_method, call_secret_manager_method, call_utils_method, call_wallet_method},
response::Response,
};
Expand All @@ -43,7 +43,8 @@ pub fn init_logger(config: String) -> std::result::Result<(), fern_logger::Error
pub struct WalletOptions {
pub storage_path: Option<String>,
pub client_options: Option<ClientOptions>,
pub coin_type: Option<u32>,
// TODO: replace
// pub coin_type: Option<u32>,
#[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))]
pub secret_manager: Option<SecretManagerDto>,
}
Expand All @@ -59,10 +60,11 @@ impl WalletOptions {
self
}

pub fn with_coin_type(mut self, coin_type: impl Into<Option<u32>>) -> Self {
self.coin_type = coin_type.into();
self
}
// TODO: replace
// pub fn with_coin_type(mut self, coin_type: impl Into<Option<u32>>) -> Self {
// self.coin_type = coin_type.into();
// self
// }

pub fn with_secret_manager(mut self, secret_manager: impl Into<Option<SecretManagerDto>>) -> Self {
self.secret_manager = secret_manager.into();
Expand All @@ -72,8 +74,9 @@ impl WalletOptions {
pub async fn build(self) -> iota_sdk::wallet::Result<Wallet> {
log::debug!("wallet options: {self:?}");
let mut builder = Wallet::builder()
.with_client_options(self.client_options)
.with_coin_type(self.coin_type);
.with_client_options(self.client_options);
// TODO: replace
// .with_coin_type(self.coin_type);

#[cfg(feature = "storage")]
if let Some(storage_path) = &self.storage_path {
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/src/method/account.rs
Alex6323 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(tag = "name", content = "data", rename_all = "camelCase")]
#[non_exhaustive]
pub enum AccountMethod {
pub enum WalletMethod {
/// List addresses.
/// Expected response: [`Addresses`](crate::Response::Addresses)
Addresses,
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/src/method/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ mod utils;
mod wallet;

pub use self::{
account::AccountMethod, client::ClientMethod, secret_manager::SecretManagerMethod, utils::UtilsMethod,
account::WalletMethod, client::ClientMethod, secret_manager::SecretManagerMethod, utils::UtilsMethod,
wallet::WalletMethod,
};
39 changes: 25 additions & 14 deletions bindings/core/src/method/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use iota_sdk::{
};
use serde::{Deserialize, Serialize};

use crate::method::account::AccountMethod;
use crate::method::account::WalletMethod;
#[cfg(feature = "stronghold")]
use crate::OmittedDebug;

Expand All @@ -34,32 +34,43 @@ pub enum WalletMethod {
/// Creates an account.
/// Expected response: [`Account`](crate::Response::Account)
#[serde(rename_all = "camelCase")]
CreateAccount {
Create {
/// The wallet index.
index: Option<u32>
/// The account alias.
alias: Option<String>,
/// The bech32 HRP.
bech32_hrp: Option<Hrp>,
/// BIP44 addresses.
addresses: Option<Vec<Bip44Address>>,
},
/// Read account.
/// Expected response: [`Account`](crate::Response::Account)
#[serde(rename_all = "camelCase")]
GetAccount { account_id: AccountIdentifier },
/// Return the account indexes.
/// Expected response: [`AccountIndexes`](crate::Response::AccountIndexes)
GetAccountIndexes,
/// Read accounts.
/// Expected response: [`Accounts`](crate::Response::Accounts)
GetAccounts,

// TODO: remove
// /// Read account.
// /// Expected response: [`Account`](crate::Response::Account)
// #[serde(rename_all = "camelCase")]
// GetAccount { account_id: AccountIdentifier },

// TODO: change to `GetAccountIndex`
// /// Return the account indexes.
// /// Expected response: [`AccountIndexes`](crate::Response::AccountIndexes)
// GetAccountIndexes,


// TODO: remove
// /// Read accounts.
// /// Expected response: [`Accounts`](crate::Response::Accounts)
// GetAccounts,


/// Consume an account method.
/// Returns [`Response`](crate::Response)
#[serde(rename_all = "camelCase")]
CallAccountMethod {
CallMethod {
/// The account identifier.
account_id: AccountIdentifier,
/// The account method to call.
method: AccountMethod,
method: WalletMethod,
},
/// Backup storage. Password must be the current one, when Stronghold is used as SecretManager.
/// Expected response: [`Ok`](crate::Response::Ok)
Expand Down
Loading