Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MujkicA committed Sep 10, 2024
1 parent 1ff56c4 commit 1fba3cc
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/src/custom-transactions/transaction-builders.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ As we have used coins that require a signature, we have to add the signer to the

> **Note** The signature is not created until the transaction is finalized with `build(&provider)`
We need to do one more thing before we stop thinking about transaction inputs. Executing the transaction also incurs a fee that is paid with the base asset. Our base asset inputs need to be large enough so that the total amount covers the transaction fee and any other operations we are doing. The `Account` trait lets us use `adjust_for_fee()` for adjusting the transaction inputs if needed to cover the fee. The second argument to `adjust_for_fee()` is the total amount of the base asset that we expect our transaction to spend regardless of fees. In our case, this is the **ask_amount** we are transferring to the predicate.
We need to do one more thing before we stop thinking about transaction inputs. Executing the transaction also incurs a fee that is paid with the base asset. Our base asset inputs need to be large enough so that the total amount covers the transaction fee and any other operations we are doing. The `ViewOnlyAccount` trait lets us use `adjust_for_fee()` for adjusting the transaction inputs if needed to cover the fee. The second argument to `adjust_for_fee()` is the total amount of the base asset that we expect our transaction to spend regardless of fees. In our case, this is the **ask_amount** we are transferring to the predicate.

```rust,ignore
{{#include ../../../examples/cookbook/src/lib.rs:custom_tx_adjust}}
Expand Down
4 changes: 1 addition & 3 deletions packages/fuels-accounts/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ pub trait ViewOnlyAccount: std::fmt::Debug + Send + Sync + Clone {
}

/// Returns a vector consisting of `Input::Coin`s and `Input::Message`s for the given
/// asset ID and amount. The `witness_index` is the position of the witness (signature)
/// in the transaction's list of witnesses. In the validation process, the node will
/// use the witness at this index to validate the coins returned by this method.
/// asset ID and amount.
async fn get_asset_inputs_for_amount(
&self,
asset_id: AssetId,
Expand Down
2 changes: 0 additions & 2 deletions packages/fuels-accounts/src/impersonated_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ impl ViewOnlyAccount for ImpersonatedAccount {
self.provider.as_ref().ok_or_else(try_provider_error)
}

/// Returns a vector consisting of `Input::Coin`s and `Input::Message`s for the given
/// asset ID and amount.
async fn get_asset_inputs_for_amount(
&self,
asset_id: AssetId,
Expand Down
8 changes: 0 additions & 8 deletions packages/fuels-accounts/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ impl ViewOnlyAccount for Wallet {
self.provider.as_ref().ok_or_else(try_provider_error)
}

/// Returns a vector consisting of `Input::Coin`s and `Input::Message`s for the given
/// asset ID and amount. The `witness_index` is the position of the witness (signature)
/// in the transaction's list of witnesses. In the validation process, the node will
/// use the witness at this index to validate the coins returned by this method.
async fn get_asset_inputs_for_amount(
&self,
asset_id: AssetId,
Expand Down Expand Up @@ -219,10 +215,6 @@ impl ViewOnlyAccount for WalletUnlocked {
self.provider.as_ref().ok_or_else(try_provider_error)
}

/// Returns a vector consisting of `Input::Coin`s and `Input::Message`s for the given
/// asset ID and amount. The `witness_index` is the position of the witness (signature)
/// in the transaction's list of witnesses. In the validation process, the node will
/// use the witness at this index to validate the coins returned by this method.
async fn get_asset_inputs_for_amount(
&self,
asset_id: AssetId,
Expand Down

0 comments on commit 1fba3cc

Please sign in to comment.