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

Refactor rent cost traits #1065

Merged
merged 116 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
e4ee434
Refactor rent cost traits
Aug 22, 2023
565f31e
Merge branch '2.0' into feat/rent-cost
Aug 23, 2023
6c3d6ae
Merge branch '2.0' into feat/rent-cost
Aug 23, 2023
c79412b
Merge branch '2.0' into feat/rent-cost
Aug 28, 2023
46b3974
remove pub'd field
Aug 28, 2023
871648b
Merge branch '2.0' into feat/rent-cost
Aug 28, 2023
2db3948
Fix sufficient storage deposit calculation
Aug 29, 2023
d5c013e
Merge branch '2.0' into feat/rent-cost
Aug 29, 2023
4a7f0c8
Merge branch '2.0' into feat/rent-cost
Aug 29, 2023
94d35db
Reduce sufficient SDR amount
Aug 30, 2023
27a52dd
Update comment
Aug 30, 2023
76e9f06
Hopefully last fix and better comments
Aug 30, 2023
db526dd
Add delegation and staking byte costs, clippy
Aug 30, 2023
60bf8d5
Merge branch '2.0' into feat/rent-cost
Aug 30, 2023
eec081f
block issuer key byte factor
Aug 31, 2023
db546f4
Merge branch '2.0' into feat/rent-cost
Sep 1, 2023
d92493e
clippy and fix claiming calc
Sep 1, 2023
4ccc610
Merge branch '2.0' into feat/rent-cost
Sep 1, 2023
66c93b6
Merge branch '2.0' into feat/rent-cost
Sep 5, 2023
d6301f1
Revert check
Sep 5, 2023
0745f90
cleanup, renames, and add test
Sep 5, 2023
591afd2
Remove static rent
Sep 5, 2023
5661fa0
more cleanup
Sep 5, 2023
069546b
Merge branch '2.0' into feat/rent-cost
Sep 6, 2023
f223610
Merge branch '2.0' into feat/rent-cost
Sep 6, 2023
d53e25f
Merge branch '2.0' into feat/rent-cost
Sep 7, 2023
d9485e1
Merge branch '2.0' into feat/rent-cost
Sep 7, 2023
3601754
Merge branch '2.0' into feat/rent-cost
Sep 8, 2023
b979d89
Merge branch '2.0' into feat/rent-cost
Sep 8, 2023
7efde19
Merge branch '2.0' into feat/rent-cost
Sep 11, 2023
16b3b82
Merge branch '2.0' into feat/rent-cost
Sep 11, 2023
fec3c1a
Merge branch '2.0' into feat/rent-cost
Sep 11, 2023
0861097
Merge branch '2.0' into feat/rent-cost
Sep 12, 2023
d606ab0
Merge branch 'feat/rent-cost' of https://github.com/iotaledger/iota-s…
Sep 12, 2023
ec59289
Merge branch '2.0' into feat/rent-cost
Sep 12, 2023
77db3fd
Merge branch '2.0' into feat/rent-cost
Sep 13, 2023
ab69ab7
Merge branch '2.0' into feat/rent-cost
Sep 14, 2023
db18131
Merge branch '2.0' into feat/rent-cost
Sep 14, 2023
f19bb38
Merge branch '2.0' into feat/rent-cost
Sep 15, 2023
359ffb0
Merge branch '2.0' into feat/rent-cost
Sep 15, 2023
63dc2e4
Merge branch '2.0' into feat/rent-cost
Sep 18, 2023
d06bb81
Merge branch '2.0' into feat/rent-cost
Sep 19, 2023
d9ab179
fix merge
Sep 19, 2023
178668d
Merge branch '2.0' into feat/rent-cost
Sep 19, 2023
8a0fea9
Merge branch '2.0' into feat/rent-cost
Sep 20, 2023
4e2e889
Merge branch '2.0' into feat/rent-cost
Sep 27, 2023
7274c3f
Merge branch '2.0' into feat/rent-cost
Sep 27, 2023
e1327c2
Merge branch '2.0' into feat/rent-cost
Sep 29, 2023
6d52f2d
Merge branch '2.0' into feat/rent-cost
Oct 2, 2023
95001b7
Merge branch '2.0' into feat/rent-cost
Oct 3, 2023
7f28105
Merge branch '2.0' into feat/rent-cost
Oct 4, 2023
da2d84d
Merge branch '2.0' into feat/rent-cost
Oct 5, 2023
c3f64c0
Merge branch '2.0' into feat/rent-cost
Oct 6, 2023
f9dcf8d
Merge branch '2.0' into feat/rent-cost
Oct 10, 2023
e96509b
Merge branch '2.0' into feat/rent-cost
Oct 10, 2023
193ff40
Merge branch '2.0' into feat/rent-cost
Oct 10, 2023
28a6ec0
Merge branch '2.0' into feat/rent-cost
Oct 11, 2023
ed8b288
Merge branch '2.0' into feat/rent-cost
Oct 11, 2023
22ca84b
Merge branch '2.0' into feat/rent-cost
Oct 13, 2023
0dad0b7
revert claiming calculations
Oct 13, 2023
ae25885
Merge branch '2.0' into feat/rent-cost
Oct 13, 2023
e95f9a3
Merge branch '2.0' into feat/rent-cost
Oct 16, 2023
088b2a0
Merge branch '2.0' into feat/rent-cost
Oct 17, 2023
03c41fc
refactor rent parameters
Oct 17, 2023
b3f7864
Rename min_deposit fn to better reflect usage
Oct 18, 2023
7ef858f
Merge branch '2.0' into feat/rent-cost
Oct 18, 2023
691e20f
rename rent
Oct 18, 2023
e5533fb
no_std
Oct 18, 2023
42d19ae
PR suggestions
Oct 18, 2023
95d0e76
Merge branch '2.0' into feat/rent-cost
Oct 18, 2023
95051d3
weird comment
Oct 18, 2023
6d6fbdc
Merge branch '2.0' into feat/rent-cost
Oct 18, 2023
8ff7195
Merge branch '2.0' into feat/rent-cost
Oct 19, 2023
9ab095a
refactor with overhead
Oct 19, 2023
4f6cd1c
review
Oct 19, 2023
3159d57
Merge branch '2.0' into feat/rent-cost
Oct 19, 2023
379766e
fix builder storage cost
Oct 19, 2023
0f9a154
Merge branch '2.0' into feat/rent-cost
Oct 20, 2023
2dcb64b
Merge branch '2.0' into feat/rent-cost
Oct 23, 2023
56ebdb7
comment out tests
Oct 23, 2023
dcec104
Merge branch '2.0' into feat/rent-cost
Oct 24, 2023
aa09046
Merge branch '2.0' into feat/rent-cost
Oct 25, 2023
badc436
Merge branch '2.0' into feat/rent-cost
Oct 25, 2023
841e4aa
Merge branch '2.0' into feat/rent-cost
Oct 31, 2023
9d01cb5
Merge branch '2.0' into feat/rent-cost
Nov 6, 2023
0bd4d6b
Merge branch '2.0' into feat/rent-cost
thibault-martinez Nov 7, 2023
bb5f807
Merge branch '2.0' into feat/rent-cost
thibault-martinez Nov 7, 2023
e78a090
impl StorageScore for MultiAddress {}
thibault-martinez Nov 7, 2023
c50a2b9
Merge branch '2.0' into feat/rent-cost
thibault-martinez Nov 7, 2023
4f49f87
Add missing serde(with = "crate::utils::serde::string"))
thibault-martinez Nov 7, 2023
a8e126b
Merge imports
thibault-martinez Nov 8, 2023
341aa9c
Rename nits
thibault-martinez Nov 8, 2023
f47a4b6
Merge some more imports
thibault-martinez Nov 8, 2023
14d6191
More renames
thibault-martinez Nov 8, 2023
a5c637f
Add TODO
thibault-martinez Nov 8, 2023
eaf85d9
rename output builder amount variant
Nov 8, 2023
f5e946f
Remove excess
Nov 8, 2023
dff70c8
Merge branch '2.0' into feat/rent-cost
thibault-martinez Nov 8, 2023
5e214c3
Some renames lost in the merge
thibault-martinez Nov 8, 2023
45e8e64
nit
thibault-martinez Nov 8, 2023
d46307a
suggestions
Nov 8, 2023
1388b73
Merge branch 'feat/rent-cost' of https://github.com/iotaledger/iota-s…
Nov 8, 2023
81e49d7
cleanup imports
Nov 8, 2023
c844407
fix implicit storage score
Nov 8, 2023
cabaaf9
update terminology and separate trait
Nov 13, 2023
1f8d25a
Merge branch '2.0' into feat/rent-cost
Nov 13, 2023
9ea3f81
nit
Nov 13, 2023
4e8b054
suggestions
Nov 13, 2023
248945c
I did change that
Nov 13, 2023
b29a709
blame the sickness
Nov 13, 2023
c9f95e6
cleanup
Nov 13, 2023
1cac8a6
Merge branch '2.0' into feat/rent-cost
Nov 13, 2023
a6da4ce
Nits
thibault-martinez Nov 14, 2023
7e5a5de
Return is a BasicOutputBuilder
thibault-martinez Nov 14, 2023
893ffe4
fmt
thibault-martinez Nov 14, 2023
5454a3a
Merge branch '2.0' into feat/rent-cost
Nov 14, 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
14 changes: 7 additions & 7 deletions bindings/core/src/method/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub enum ClientMethod {
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
BuildAccountOutput {
// If not provided, minimum storage deposit will be used
// If not provided, minimum amount will be used
#[serde(default, with = "option_string")]
amount: Option<u64>,
// TODO: Determine if `default` is wanted here
Expand All @@ -55,7 +55,7 @@ pub enum ClientMethod {
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
BuildBasicOutput {
// If not provided, minimum storage deposit will be used
// If not provided, minimum amount will be used
#[serde(default, with = "option_string")]
amount: Option<u64>,
// TODO: Determine if `default` is wanted here
Expand All @@ -70,7 +70,7 @@ pub enum ClientMethod {
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
BuildFoundryOutput {
// If not provided, minimum storage deposit will be used
// If not provided, minimum amount will be used
#[serde(default, with = "option_string")]
amount: Option<u64>,
native_tokens: Option<Vec<NativeToken>>,
Expand All @@ -85,7 +85,7 @@ pub enum ClientMethod {
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
BuildNftOutput {
// If not provided, minimum storage deposit will be used
// If not provided, minimum amount will be used
#[serde(default, with = "option_string")]
amount: Option<u64>,
// TODO: Determine if `default` is wanted here
Expand Down Expand Up @@ -351,10 +351,10 @@ pub enum ClientMethod {
/// Human readable part
bech32_hrp: Option<Hrp>,
},
/// Calculate the minimum required storage deposit for an output.
/// Calculate the minimum required amount for an output.
/// Expected response:
/// [`MinimumRequiredStorageDeposit`](crate::Response::MinimumRequiredStorageDeposit)
MinimumRequiredStorageDeposit { output: OutputDto },
/// [`MinimumRequiredOutputAmount`](crate::Response::MinimumRequiredOutputAmount)
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
ComputeMinimumOutputAmount { output: OutputDto },
/// Requests funds for a given address from the faucet, for example `https://faucet.testnet.shimmer.network/api/enqueue` or `http://localhost:8091/api/enqueue`.
RequestFundsFromFaucet {
/// Faucet URL
Expand Down
10 changes: 7 additions & 3 deletions bindings/core/src/method/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use derivative::Derivative;
use iota_sdk::types::block::{
address::{Bech32Address, Hrp},
output::{dto::OutputDto, AccountId, NftId, OutputId, RentStructure},
output::{dto::OutputDto, AccountId, NftId, OutputId, StorageScoreParameters},
payload::signed_transaction::{
dto::{SignedTransactionPayloadDto, TransactionDto},
TransactionId,
Expand Down Expand Up @@ -128,8 +128,12 @@ pub enum UtilsMethod {
/// The transaction.
transaction: TransactionDto,
},
/// Computes the required storage deposit of an output.
ComputeStorageDeposit { output: OutputDto, rent: RentStructure },
/// Computes the minimum required amount of an output.
#[serde(rename_all = "camelCase")]
ComputeMinimumOutputAmount {
output: OutputDto,
storage_score_parameters: StorageScoreParameters,
},
/// Checks if the given mnemonic is valid.
/// Expected response: [`Ok`](crate::Response::Ok)
VerifyMnemonic {
Expand Down
19 changes: 9 additions & 10 deletions bindings/core/src/method_handler/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use iota_sdk::{
api::core::OutputWithMetadataResponse,
block::{
output::{
dto::OutputDto, AccountOutput, BasicOutput, FoundryOutput, NftOutput, Output, OutputBuilderAmount, Rent,
dto::OutputDto, AccountOutput, BasicOutput, FoundryOutput, MinimumOutputAmount, NftOutput, Output,
OutputBuilderAmount,
},
payload::Payload,
SignedBlock, SignedBlockDto, UnsignedBlockDto,
Expand Down Expand Up @@ -69,7 +70,7 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
if let Some(amount) = amount {
OutputBuilderAmount::Amount(amount)
} else {
OutputBuilderAmount::MinimumStorageDeposit(client.get_rent_structure().await?)
OutputBuilderAmount::MinimumAmount(client.get_storage_score_parameters().await?)
},
mana,
native_tokens,
Expand All @@ -94,7 +95,7 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
if let Some(amount) = amount {
OutputBuilderAmount::Amount(amount)
} else {
OutputBuilderAmount::MinimumStorageDeposit(client.get_rent_structure().await?)
OutputBuilderAmount::MinimumAmount(client.get_storage_score_parameters().await?)
},
mana,
native_tokens,
Expand All @@ -118,7 +119,7 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
if let Some(amount) = amount {
OutputBuilderAmount::Amount(amount)
} else {
OutputBuilderAmount::MinimumStorageDeposit(client.get_rent_structure().await?)
OutputBuilderAmount::MinimumAmount(client.get_storage_score_parameters().await?)
},
native_tokens,
serial_number,
Expand All @@ -144,7 +145,7 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
if let Some(amount) = amount {
OutputBuilderAmount::Amount(amount)
} else {
OutputBuilderAmount::MinimumStorageDeposit(client.get_rent_structure().await?)
OutputBuilderAmount::MinimumAmount(client.get_storage_score_parameters().await?)
},
mana,
native_tokens,
Expand Down Expand Up @@ -294,13 +295,11 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
ClientMethod::HexPublicKeyToBech32Address { hex, bech32_hrp } => {
Response::Bech32Address(client.hex_public_key_to_bech32_address(&hex, bech32_hrp).await?)
}
ClientMethod::MinimumRequiredStorageDeposit { output } => {
ClientMethod::ComputeMinimumOutputAmount { output } => {
let output = Output::try_from_dto_with_params(output, client.get_token_supply().await?)?;
let rent_structure = client.get_rent_structure().await?;
let storage_score_params = client.get_storage_score_parameters().await?;

let minimum_storage_deposit = output.rent_cost(rent_structure);

Response::MinimumRequiredStorageDeposit(minimum_storage_deposit.to_string())
Response::OutputAmount(output.minimum_amount(storage_score_params))
}
ClientMethod::RequestFundsFromFaucet { url, address } => {
Response::Faucet(request_funds_from_faucet(&url, &address).await?)
Expand Down
9 changes: 6 additions & 3 deletions bindings/core/src/method_handler/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use iota_sdk::{
block::{
address::{AccountAddress, Address, ToBech32Ext},
input::UtxoInput,
output::{AccountId, FoundryId, NftId, Output, OutputId, Rent, TokenId},
output::{AccountId, FoundryId, MinimumOutputAmount, NftId, Output, OutputId, TokenId},
payload::{signed_transaction::Transaction, SignedTransactionPayload},
SignedBlock,
},
Expand Down Expand Up @@ -72,9 +72,12 @@ pub(crate) fn call_utils_method_internal(method: UtilsMethod) -> Result<Response
UtilsMethod::TransactionSigningHash { transaction } => {
Response::Hash(Transaction::try_from_dto(transaction)?.signing_hash().to_string())
}
UtilsMethod::ComputeStorageDeposit { output, rent } => {
UtilsMethod::ComputeMinimumOutputAmount {
output,
storage_score_parameters: storage_params,
} => {
let out = Output::try_from_dto(output)?;
Response::MinimumRequiredStorageDeposit(out.rent_cost(rent).to_string())
Response::OutputAmount(out.minimum_amount(storage_params))
}
UtilsMethod::VerifyMnemonic { mnemonic } => {
let mnemonic = Mnemonic::from(mnemonic);
Expand Down
7 changes: 4 additions & 3 deletions bindings/core/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use iota_sdk::{
BlockId, SignedBlockDto, UnsignedBlockDto,
},
},
utils::serde::string,
wallet::{
types::{Balance, OutputDataDto, TransactionWithMetadataDto},
PreparedCreateNativeTokenTransactionDto,
Expand Down Expand Up @@ -256,9 +257,9 @@ pub enum Response {
/// - [`GetAddress`](crate::method::WalletMethod::GetAddress)
Address(Bech32Address),
/// Response for:
/// - [`MinimumRequiredStorageDeposit`](crate::method::ClientMethod::MinimumRequiredStorageDeposit)
/// - [`ComputeStorageDeposit`](crate::method::UtilsMethod::ComputeStorageDeposit)
MinimumRequiredStorageDeposit(String),
/// - [`ClientMethod::ComputeMinimumOutputAmount`](crate::method::ClientMethod::ComputeMinimumOutputAmount)
/// - [`UtilsMethod::ComputeMinimumOutputAmount`](crate::method::UtilsMethod::ComputeMinimumOutputAmount)
OutputAmount(#[serde(with = "string")] u64),
/// Response for:
/// - [`ClaimableOutputs`](crate::method::WalletMethod::ClaimableOutputs)
OutputIds(Vec<OutputId>),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const SEND_MICRO_AMOUNT = BigInt(1);
const RECV_ADDRESS =
'rms1qpszqzadsym6wpppd6z037dvlejmjuke7s24hm95s9fg9vpua7vluaw60xu';

// In this example we will send an amount below the minimum storage deposit.
// In this example we will send an amount below the minimum output amount.
//
// Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by
// running the `how_tos/accounts_and_addresses/create-account` example!
Expand Down
8 changes: 4 additions & 4 deletions bindings/nodejs/lib/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,14 +692,14 @@ export class Client {
}

/**
* Calculate the minimum required storage deposit for an output.
* Calculate the minimum required amount for an output.
*
* @param output The output to calculate the minimum deposit amount for.
* @param output The output to calculate the minimum amount for.
* @returns The minimum required amount.
*/
async minimumRequiredStorageDeposit(output: Output): Promise<number> {
async computeMinimumOutputAmount(output: Output): Promise<number> {
const response = await this.methodHandler.callMethod({
name: 'minimumRequiredStorageDeposit',
name: 'computeMinimumOutputAmount',
data: {
output,
},
Expand Down
4 changes: 2 additions & 2 deletions bindings/nodejs/lib/types/client/bridge/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ export interface __ClearListenersMethod__ {
};
}

export type __MinimumRequiredStorageDepositMethod__ = {
name: 'minimumRequiredStorageDeposit';
export type __ComputeMinimumOutputAmountMethod__ = {
name: 'computeMinimumOutputAmount';
data: {
output: Output;
};
Expand Down
4 changes: 2 additions & 2 deletions bindings/nodejs/lib/types/client/bridge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import type {
__BuildNftOutputMethod__,
__ClearListenersMethod__,
__SignatureUnlockMethod__,
__MinimumRequiredStorageDepositMethod__,
__MinimumRequiredOutputAmountMethod__,
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
__RequestFundsFromFaucetMethod__,
__CallPluginRouteMethod__,
} from './client';
Expand Down Expand Up @@ -102,6 +102,6 @@ export type __ClientMethods__ =
| __BuildFoundryOutputMethod__
| __BuildNftOutputMethod__
| __ClearListenersMethod__
| __MinimumRequiredStorageDepositMethod__
| __MinimumRequiredOutputAmountMethod__
| __RequestFundsFromFaucetMethod__
| __CallPluginRouteMethod__;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
*/
export interface BasicOutputBuilderParams {
/**
* If not provided, minimum storage deposit will be used
* If not provided, minimum amount will be used
*/
amount?: u64 | NumericString;
/**
Expand Down
6 changes: 3 additions & 3 deletions bindings/nodejs/lib/types/wallet/output-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface StorageDeposit {
returnStrategy?: ReturnStrategy;
/**
* Determines whether the storage deposit will automatically add excess small funds when necessary.
* For example, given an account has 20 tokens and wants to send 15 tokens, and the minimum storage deposit
* For example, given an account has 20 tokens and wants to send 15 tokens, and the minimum amount
* is 10 tokens, it wouldn't be possible to create an output with the 5 token remainder. If this flag is enabled,
* the 5 tokens will be added to the output automatically.
*/
Expand All @@ -67,8 +67,8 @@ export interface StorageDeposit {

/** Return strategy for the storage deposit. */
export enum ReturnStrategy {
/** A storage deposit return unlock condition will be added with the required minimum storage deposit. */
/** A storage deposit return unlock condition will be added with the additional amount needed to satisfy storage costs. */
Return = 'Return',
/** The recipient address will get the additional amount to reach the minimum storage deposit gifted. */
/** The recipient address will receive the additional amount needed to satisfy storage costs. */
Gift = 'Gift',
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

load_dotenv()

# In this example we will send an amount below the minimum storage deposit
# In this example we will send an amount below the minimum amount

wallet = Wallet(os.environ['WALLET_DB_PATH'])

Expand Down
6 changes: 3 additions & 3 deletions bindings/python/iota_sdk/client/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def hex_public_key_to_bech32_address(
'bech32Hrp': bech32_hrp
})

def minimum_required_storage_deposit(self, output: Output) -> int:
"""Minimum required storage deposit.
def computer_minimum_output_amount(self, output: Output) -> int:
"""Minimum required output amount.
"""
return int(self._call_method(
'minimumRequiredStorageDeposit', {
'computeMinimumOutputAmount', {
kwek20 marked this conversation as resolved.
Show resolved Hide resolved
'output': output.to_dict()
}
))
Expand Down
4 changes: 2 additions & 2 deletions cli/src/wallet_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,11 @@ pub async fn send_native_token_command(
let address = address.convert()?;
let transaction = if gift_storage_deposit.unwrap_or(false) {
// Send native tokens together with the required storage deposit
let rent_structure = wallet.client().get_rent_structure().await?;
let storage_params = wallet.client().get_storage_score_parameters().await?;

wallet.client().bech32_hrp_matches(address.hrp()).await?;

let outputs = [BasicOutputBuilder::new_with_minimum_storage_deposit(rent_structure)
let outputs = [BasicOutputBuilder::new_with_minimum_amount(storage_params)
.add_unlock_condition(AddressUnlockCondition::new(address))
.with_native_tokens([NativeToken::new(
TokenId::from_str(&token_id)?,
Expand Down
4 changes: 2 additions & 2 deletions sdk/examples/client/output/build_account_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ async fn main() -> Result<()> {
.finish()
.await?;

let rent_structure = client.get_rent_structure().await?;
let storage_score_params = client.get_storage_score_parameters().await?;

let address = std::env::args()
.nth(1)
.unwrap_or("rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy".to_string());
let address = Address::try_from_bech32(address)?;

// Account id needs to be null the first time
let account_output = AccountOutputBuilder::new_with_minimum_storage_deposit(rent_structure, AccountId::null())
let account_output = AccountOutputBuilder::new_with_minimum_amount(storage_score_params, AccountId::null())
.add_feature(SenderFeature::new(address.clone()))
.add_feature(MetadataFeature::new(metadata)?)
.add_immutable_feature(IssuerFeature::new(address.clone()))
Expand Down
4 changes: 2 additions & 2 deletions sdk/examples/client/output/build_nft_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn main() -> Result<()> {
.finish()
.await?;

let rent_structure = client.get_rent_structure().await?;
let storage_score_params = client.get_storage_score_parameters().await?;

let address = std::env::args()
.nth(1)
Expand All @@ -55,7 +55,7 @@ async fn main() -> Result<()> {
.to_string();

// NftId needs to be null the first time
let nft_output = NftOutputBuilder::new_with_minimum_storage_deposit(rent_structure, NftId::null())
let nft_output = NftOutputBuilder::new_with_minimum_amount(storage_score_params, NftId::null())
.add_unlock_condition(AddressUnlockCondition::new(address.clone()))
.add_feature(SenderFeature::new(address.clone()))
.add_feature(MetadataFeature::new(MUTABLE_METADATA)?)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

//! In this example we will send an amount below the minimum storage deposit.
//! In this example we will send an amount below the minimum amount.
//!
//! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by
//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example!
Expand Down
4 changes: 2 additions & 2 deletions sdk/examples/how_tos/outputs/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ async fn main() -> Result<()> {
// Create a client instance.
let client = Client::builder().with_node(&node_url)?.finish().await?;

let rent_structure = client.get_rent_structure().await?;
let storage_score_params = client.get_storage_score_parameters().await?;

let address = Address::try_from_bech32("rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy")?;

let nft_output_builder = NftOutputBuilder::new_with_minimum_storage_deposit(rent_structure, NftId::null())
let nft_output_builder = NftOutputBuilder::new_with_minimum_amount(storage_score_params, NftId::null())
.add_unlock_condition(AddressUnlockCondition::new(address.clone()));

let outputs = [
Expand Down
7 changes: 3 additions & 4 deletions sdk/examples/how_tos/outputs/unlock_conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let token_supply = client.get_token_supply().await?;
let rent_structure = client.get_rent_structure().await?;
let storage_score_params = client.get_storage_score_parameters().await?;

let address = Address::try_from_bech32("rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy")?;
let account_address = Address::try_from_bech32("rms1pr59qm43mjtvhcajfmupqf23x29llam88yecn6pyul80rx099krmv2fnnux")?;

let token_scheme = TokenScheme::Simple(SimpleTokenScheme::new(50, 0, 100)?);

let basic_output_builder = BasicOutputBuilder::new_with_minimum_storage_deposit(rent_structure)
let basic_output_builder = BasicOutputBuilder::new_with_minimum_amount(storage_score_params)
.add_unlock_condition(AddressUnlockCondition::new(address.clone()));
let foundry_output_builder =
FoundryOutputBuilder::new_with_minimum_storage_deposit(rent_structure, 1, token_scheme);
let foundry_output_builder = FoundryOutputBuilder::new_with_minimum_amount(storage_score_params, 1, token_scheme);

let outputs = [
//// most simple output
Expand Down
Loading
Loading