Skip to content

Commit

Permalink
Merge branch 'develop' into refactor/rename-native-token-methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Jun 26, 2023
2 parents 1751f34 + 6525c4f commit f310f1c
Show file tree
Hide file tree
Showing 26 changed files with 229 additions and 149 deletions.
4 changes: 2 additions & 2 deletions bindings/core/src/method_handler/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use iota_sdk::{
block::{
input::dto::UtxoInputDto,
output::{
dto::{OutputBuilderAmountDto, OutputDto},
dto::{OutputBuilderAmountDto, OutputDto, OutputMetadataDto},
AliasOutput, BasicOutput, FoundryOutput, NftOutput, Output, RentStructure,
},
payload::{
Expand Down Expand Up @@ -312,7 +312,7 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
.map(OutputWithMetadataResponse::from)?,
),
ClientMethod::GetOutputMetadata { output_id } => {
Response::OutputMetadata(client.get_output_metadata(&output_id).await?)
Response::OutputMetadata(OutputMetadataDto::from(&client.get_output_metadata(&output_id).await?))
}
ClientMethod::GetMilestoneById { milestone_id } => Response::Milestone(MilestonePayloadDto::from(
&client.get_milestone_by_id(&milestone_id).await?,
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/iota_sdk/client/_node_core_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

class NodeCoreAPI():

def get_node_health(self, url: str):
def get_health(self, url: str):
""" Get node health.
"""
return self._call_method('getNodeHealth', {
return self._call_method('getHealth', {
'url': url
})

Expand Down
2 changes: 1 addition & 1 deletion cli/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub async fn account_prompt_internal(account: Account, history: &mut AccountHist
_ => {
// Prepend `Account: ` so the parsing will be correct
let command = format!("Account: {}", command.trim());
let account_cli = match AccountCli::try_parse_from(command.split(' ')) {
let account_cli = match AccountCli::try_parse_from(command.split_whitespace()) {
Ok(account_cli) => account_cli,
Err(err) => {
println!("{err}");
Expand Down
5 changes: 2 additions & 3 deletions cli/src/command/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ pub enum AccountCommand {
/// Synchronize the account.
Sync,
/// Show the details of the transaction.
#[clap(alias = "tx")]
#[clap(visible_alias = "tx")]
Transaction {
/// Transaction ID to be displayed e.g. 0x84fe6b1796bddc022c9bc40206f0a692f4536b02aa8c13140264e2e01a3b7e4b.
transaction_id: String,
},
/// List the account transactions.
#[clap(alias = "txs")]
#[clap(visible_alias = "txs")]
Transactions {
/// List account transactions with all details.
#[arg(long, default_value_t = false)]
Expand Down Expand Up @@ -576,7 +576,6 @@ pub async fn mint_nft_command(
.with_tag(tag)
.with_sender(sender)
.with_issuer(issuer);

let transaction = account.mint_nfts([nft_options], None).await?;

println_log_info!(
Expand Down
27 changes: 15 additions & 12 deletions cli/src/command/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use log::LevelFilter;
use crate::{
error::Error,
helper::{check_file_exists, enter_or_generate_mnemonic, generate_mnemonic, get_password, import_mnemonic},
println_log_info,
println_log_error, println_log_info,
};

const DEFAULT_LOG_LEVEL: &str = "debug";
Expand Down Expand Up @@ -123,6 +123,8 @@ pub async fn change_password_command(storage_path: &Path, snapshot_path: &Path)
let new_password = get_password("Stronghold new password", true)?;
wallet.change_stronghold_password(password, new_password).await?;

println_log_info!("The password has been changed");

Ok(wallet)
}

Expand Down Expand Up @@ -165,15 +167,12 @@ pub async fn init_command(
}

pub async fn migrate_stronghold_snapshot_v2_to_v3_command(path: Option<String>) -> Result<(), Error> {
let snapshot_path = path.as_deref().unwrap_or(DEFAULT_STRONGHOLD_SNAPSHOT_PATH);
check_file_exists(snapshot_path.as_ref()).await?;

let password = get_password("Stronghold password", false)?;
StrongholdAdapter::migrate_snapshot_v2_to_v3(
path.as_deref().unwrap_or(DEFAULT_STRONGHOLD_SNAPSHOT_PATH),
password,
"wallet.rs",
100,
None,
None,
)?;
StrongholdAdapter::migrate_snapshot_v2_to_v3(snapshot_path, password, "wallet.rs", 100, None, None)?;

println_log_info!("Stronghold snapshot successfully migrated from v2 to v3.");

Ok(())
Expand Down Expand Up @@ -270,13 +269,17 @@ pub async fn unlock_wallet(
None
};

let wallet = Wallet::builder()
let maybe_wallet = Wallet::builder()
.with_secret_manager(secret_manager)
.with_storage_path(storage_path.to_str().expect("invalid unicode"))
.finish()
.await?;
.await;

Ok(wallet)
if let Err(iota_sdk::wallet::Error::MissingParameter(_)) = maybe_wallet {
println_log_error!("Please make sure the wallet is initialized.");
}

Ok(maybe_wallet?)
}

pub async fn add_account(wallet: &Wallet, alias: Option<String>) -> Result<String, Error> {
Expand Down
1 change: 1 addition & 0 deletions cli/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn get_password(prompt: &str, confirmation: bool) -> Result<Password, Error>
password.with_prompt(prompt);

if confirmation {
password.with_prompt("Provide a new Stronghold password");
password.with_confirmation("Confirm password", "Password mismatch");
}

Expand Down
34 changes: 21 additions & 13 deletions documentation/cli/docs/03-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Prints the account balance.

#### Parameters

| Name | Optional | Default | Example |
| ----------- | --------- | ------- | --------------------------------------------------------------- |
| `addresses` || N/A | rms1qztwng6cty8cfm42nzvq099ev7udhrnk0rw8jt8vttf9kpqnxhpsx869vr3 |
| Name | Optional | Default | Example |
| ----------- | --------- | -------------------------------------- | --------------------------------------------------------------- |
| `addresses` || All addresses belonging to the account | rms1qztwng6cty8cfm42nzvq099ev7udhrnk0rw8jt8vttf9kpqnxhpsx869vr3 |

#### Examples

Expand Down Expand Up @@ -82,9 +82,9 @@ Tries to claim outputs with storage deposit return, expiration or timelock unloc

#### Parameters

| Name | Optional | Default | Example |
| ----------- | --------- | ------- | ---------------------------------------------------------------------- |
| `output_id` || N/A | 0xd5dff9ee869dfa7796d5132b220cb5c00146c36abba27d3562e2d726decb50850000 |
| Name | Optional | Default | Example |
| ----------- | --------- | --------------------- | ---------------------------------------------------------------------- |
| `output_id` || All claimable outputs | 0xd5dff9ee869dfa7796d5132b220cb5c00146c36abba27d3562e2d726decb50850000 |

#### Examples

Expand Down Expand Up @@ -230,7 +230,7 @@ Requests funds from a faucet.
| Name | Optional | Default | Example |
| --------- | --------- | -----------------------------------------------------| ------------------------------------------------------------------|
| `address` || The latest address of the account | rms1qztwng6cty8cfm42nzvq099ev7udhrnk0rw8jt8vttf9kpqnxhpsx869vr3 |
| `url` || <https://faucet.testnet.shimmer.network/api/enqueue> | <http://localhost:8091/api/enqueue> |
| `url` || https://faucet.testnet.shimmer.network/api/enqueue | http://localhost:8091/api/enqueue |

#### Examples

Expand Down Expand Up @@ -429,9 +429,9 @@ Calculates the participation overview of the account.

#### Parameters

| Name | Optional | Default | Example |
| ----------- | --------- | ------- | ------------------------------------------------------------------ |
| `event_ids` || N/A | 0x8d6ffcd8d6c9f049b5732adb8900bb6f6a28e282b15a2297405a28181eebd515 |
| Name | Optional | Default | Example |
| ----------- | --------- | ------------------------------------------- | ------------------------------------------------------------------ |
| `event_ids` || All participation event ids for the account | 0x8d6ffcd8d6c9f049b5732adb8900bb6f6a28e282b15a2297405a28181eebd515 |

#### Example

Expand Down Expand Up @@ -561,16 +561,24 @@ Lists all account transactions.

#### Parameters

| Name | Optional | Default | Example |
| -------------------| --------- | ------- | ------------------------------------------------------------------------------- |
| `show_details` || false | true |
| Name | Optional | Default | Example |
| -------------------| --------- | ------- | -------- |
| `show_details` || false | true |

#### Example

List all transactions.

```sh
> Account "main": transactions
```

List all transactions with details.

```sh
> Account "main": transactions --show-details
```

### `unspent-outputs`

Displays all unspent outputs that are stored in the account.
Expand Down
12 changes: 6 additions & 6 deletions documentation/cli/docs/04-step-by-step.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It is advised to do them all at least once in the given order to understand the

Initialize the wallet with a given node and a randomly generated mnemonic.
```sh title=Input
./wallet init --node <NODE_API_URL>
./wallet init --node-url <NODE_API_URL>
```
```sh title=Output
> INFO Mnemonic stored successfully
Expand Down Expand Up @@ -69,7 +69,7 @@ Enter the "main" account and send some amount to the "savings" address.
```
```sh title=Output
> INFO Transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand All @@ -96,7 +96,7 @@ Enter the "main" account and mint native tokens with foundry metadata.

```sh title=Output
> INFO Native token minting transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand Down Expand Up @@ -128,7 +128,7 @@ Send native tokens from the "main" account to the new "savings" address.
```
```sh title=Output
> INFO Native token transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand All @@ -144,7 +144,7 @@ Enter the "main" account and mint an NFT.
```
```sh title=Output
> INFO NFT minting transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand Down Expand Up @@ -177,7 +177,7 @@ Send the NFT to the new "savings" address.
```
```sh title=Output
> INFO Nft transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand Down
2 changes: 1 addition & 1 deletion documentation/sdk/docs/about-the-iota-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Your application communicates directly with the IOTA SDK in Rust or through one
your requests into REST API calls and sends them to a node through the Internet. The node, in turn, interacts with the
rest of an IOTA network, which could be
the [main operational network (mainnet)](https://wiki.iota.org/shimmer/develop/explanations/what-is-shimmer/networks/#shimmer-mainnet)
or a [network for testing purposes (testnet)](https://wiki.iota.org/shimmer/develop/explanations/what-is-shimmer/networks/#public-testnet). !["An overview of IOTA layers."](/img/iota_layers_overview.svg "An overview of IOTA layers.")
or a [network for testing purposes (testnet)](https://wiki.iota.org/shimmer/develop/explanations/what-is-shimmer/networks/#public-testnet). !["An overview of the IOTA SDK layers."](/img/layered_overview.svg "An overview of the IOTA SDK layers.")

## Secure Secret Management

Expand Down
Loading

0 comments on commit f310f1c

Please sign in to comment.