Skip to content

Commit

Permalink
fix(jstz_proto): increment nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
ryutamago committed Jan 7, 2025
1 parent 3502133 commit 373ec79
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/jstz_proto/src/api/smart_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ impl SmartFunction {

// 2. Deploy the smart function
let address =
Script::deploy(hrt, tx, &self.address, function_code, initial_balance)?; // The mutable borrow of `tx` in `Script::deploy` is released here
Script::deploy(hrt, tx, &self.address, function_code, initial_balance)?;

// 3. Transfer the balance to the associated account
// 3. Increment nonce of current account
let nonce = Account::nonce(hrt, tx, &self.address)?;
nonce.increment();

// 4. Transfer the balance to the associated account
Account::transfer(hrt, tx, &self.address, &address, initial_balance)?;

Ok(address.to_string())
Expand Down

0 comments on commit 373ec79

Please sign in to comment.