Skip to content

Commit

Permalink
deploy: f996863
Browse files Browse the repository at this point in the history
  • Loading branch information
MujkicA committed Sep 27, 2023
1 parent 30fcf30 commit 27ac4e4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
6 changes: 1 addition & 5 deletions master/calling-contracts/tx-params.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,8 @@ <h1 id="transaction-parameters"><a class="header" href="#transaction-parameters"
</code></pre>
<!-- This section should explain how to use the defauly tx params -->
<!-- tx_params_default:example:start -->
<p>You can also use <code>TxParameters::default()</code> to use the default values:</p>
<p>You can also use <code>TxParameters::default()</code> to use the default values. If <code>gas_price</code> or <code>gas_limit</code> is set to <code>None</code>, the SDK will use the network's default value:</p>
<!-- tx_params_default:example:end -->
<pre><code class="language-rust ignore">pub const DEFAULT_GAS_PRICE: u64 = 0;
pub const DEFAULT_GAS_LIMIT: u64 = 10_000_000;
pub const DEFAULT_MATURITY: u32 = 0;
</code></pre>
<p>This way:</p>
<pre><code class="language-rust ignore"> let response = contract_methods
.initialize_counter(42)
Expand Down
2 changes: 1 addition & 1 deletion master/connecting/external-node.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ <h1 id="connecting-to-the-testnet-or-an-external-node"><a class="header" href="#
<p>In the code example, we connected a new provider to the Testnet node and created a new wallet from a private key.</p>
<blockquote>
<p><strong>Note:</strong> New wallets on the Testnet will not have any assets! They can be obtained by providing the wallet address to the faucet at</p>
<p><a href="https://faucet-beta-3.fuel.network">faucet-beta-3.fuel.network</a></p>
<p><a href="https://faucet-beta-4.fuel.network">faucet-beta-4.fuel.network</a></p>
<p>Once the assets have been transferred to the wallet, you can reuse it in other tests by providing the private key!</p>
<p>In addition to the faucet, there is a block explorer for the Tesnet at</p>
<p><a href="https://fuellabs.github.io/block-explorer-v2">block-explorer</a></p>
Expand Down
9 changes: 7 additions & 2 deletions master/cookbook/transfer-all-assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,13 @@ <h1 id="transfer-all-assets"><a class="header" href="#transfer-all-assets">Trans
}
</code></pre>
<p>All that is left is to build the transaction via <code>ScriptTransactionBuilder</code>, have <code>wallet_1</code> sign it, and we can send it. We confirm this by checking the number of balances present in the receiving wallet and their amount:</p>
<pre><code class="language-rust ignore"> let mut tb =
ScriptTransactionBuilder::prepare_transfer(inputs, outputs, TxParameters::default());
<pre><code class="language-rust ignore"> let network_info = provider.network_info().await?;
let mut tb = ScriptTransactionBuilder::prepare_transfer(
inputs,
outputs,
TxParameters::default(),
network_info,
);
wallet_1.sign_transaction(&amp;mut tb);
let tx = tb.build()?;

Expand Down
26 changes: 17 additions & 9 deletions master/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ <h2 id="more-in-depth-fuel-and-sway-knowledge"><a class="header" href="#more-in-
<p>In the code example, we connected a new provider to the Testnet node and created a new wallet from a private key.</p>
<blockquote>
<p><strong>Note:</strong> New wallets on the Testnet will not have any assets! They can be obtained by providing the wallet address to the faucet at</p>
<p><a href="https://faucet-beta-3.fuel.network">faucet-beta-3.fuel.network</a></p>
<p><a href="https://faucet-beta-4.fuel.network">faucet-beta-4.fuel.network</a></p>
<p>Once the assets have been transferred to the wallet, you can reuse it in other tests by providing the private key!</p>
<p>In addition to the faucet, there is a block explorer for the Tesnet at</p>
<p><a href="https://fuellabs.github.io/block-explorer-v2">block-explorer</a></p>
Expand Down Expand Up @@ -923,6 +923,12 @@ <h2 id="signing-a-transaction"><a class="header" href="#signing-a-transaction">S
)?;
let wallet = WalletUnlocked::new_from_private_key(secret, None);

let network_info = NetworkInfo {
consensus_parameters: Default::default(),
max_gas_per_tx: 0,
min_gas_price: 0,
gas_costs: Default::default(),
};
// Set up a transaction
let mut tb = {
let input_coin = Input::ResourceSigned {
Expand All @@ -945,6 +951,7 @@ <h2 id="signing-a-transaction"><a class="header" href="#signing-a-transaction">S
vec![input_coin],
vec![output_coin],
Default::default(),
network_info,
)
};

Expand All @@ -964,7 +971,7 @@ <h2 id="signing-a-transaction"><a class="header" href="#signing-a-transaction">S
assert_eq!(signature, tx_signature);

// Check if the signature is what we expect it to be
assert_eq!(signature, Signature::from_str(&quot;d7027be16db0aada625ac8cd438f9b6187bd74465495ba39511c1ad72b7bb10af4ef582c94cc33433f7a1eb4f2ad21c471473947f5f645e90924ba273e2cee7f&quot;)?);
assert_eq!(signature, Signature::from_str(&quot;51198e39c541cd3197785fd8add8cdbec3dc5aba7f8fbb23eb09455dd1003a8b78d94f247df8e1577805ea7eebd6d58336393942fd98484609e9e7d6d7a55f28&quot;)?);

// Recover the address that signed the transaction
let recovered_address = signature.recover(&amp;message)?;
Expand Down Expand Up @@ -1701,12 +1708,8 @@ <h2 id="deploying-a-contract-binary"><a class="header" href="#deploying-a-contra
</code></pre>
<!-- This section should explain how to use the defauly tx params -->
<!-- tx_params_default:example:start -->
<p>You can also use <code>TxParameters::default()</code> to use the default values:</p>
<p>You can also use <code>TxParameters::default()</code> to use the default values. If <code>gas_price</code> or <code>gas_limit</code> is set to <code>None</code>, the SDK will use the network's default value:</p>
<!-- tx_params_default:example:end -->
<pre><code class="language-rust ignore">pub const DEFAULT_GAS_PRICE: u64 = 0;
pub const DEFAULT_GAS_LIMIT: u64 = 10_000_000;
pub const DEFAULT_MATURITY: u32 = 0;
</code></pre>
<p>This way:</p>
<pre><code class="language-rust ignore"> let response = contract_methods
.initialize_counter(42)
Expand Down Expand Up @@ -3476,8 +3479,13 @@ <h2 id="loadscript"><a class="header" href="#loadscript">LoadScript</a></h2>
}
</code></pre>
<p>All that is left is to build the transaction via <code>ScriptTransactionBuilder</code>, have <code>wallet_1</code> sign it, and we can send it. We confirm this by checking the number of balances present in the receiving wallet and their amount:</p>
<pre><code class="language-rust ignore"> let mut tb =
ScriptTransactionBuilder::prepare_transfer(inputs, outputs, TxParameters::default());
<pre><code class="language-rust ignore"> let network_info = provider.network_info().await?;
let mut tb = ScriptTransactionBuilder::prepare_transfer(
inputs,
outputs,
TxParameters::default(),
network_info,
);
wallet_1.sign_transaction(&amp;mut tb);
let tx = tb.build()?;

Expand Down
2 changes: 1 addition & 1 deletion master/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion master/searchindex.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion master/wallets/signing.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ <h2 id="signing-a-transaction"><a class="header" href="#signing-a-transaction">S
)?;
let wallet = WalletUnlocked::new_from_private_key(secret, None);

let network_info = NetworkInfo {
consensus_parameters: Default::default(),
max_gas_per_tx: 0,
min_gas_price: 0,
gas_costs: Default::default(),
};
// Set up a transaction
let mut tb = {
let input_coin = Input::ResourceSigned {
Expand All @@ -200,6 +206,7 @@ <h2 id="signing-a-transaction"><a class="header" href="#signing-a-transaction">S
vec![input_coin],
vec![output_coin],
Default::default(),
network_info,
)
};

Expand All @@ -219,7 +226,7 @@ <h2 id="signing-a-transaction"><a class="header" href="#signing-a-transaction">S
assert_eq!(signature, tx_signature);

// Check if the signature is what we expect it to be
assert_eq!(signature, Signature::from_str(&quot;d7027be16db0aada625ac8cd438f9b6187bd74465495ba39511c1ad72b7bb10af4ef582c94cc33433f7a1eb4f2ad21c471473947f5f645e90924ba273e2cee7f&quot;)?);
assert_eq!(signature, Signature::from_str(&quot;51198e39c541cd3197785fd8add8cdbec3dc5aba7f8fbb23eb09455dd1003a8b78d94f247df8e1577805ea7eebd6d58336393942fd98484609e9e7d6d7a55f28&quot;)?);

// Recover the address that signed the transaction
let recovered_address = signature.recover(&amp;message)?;
Expand Down

0 comments on commit 27ac4e4

Please sign in to comment.