From 373ec7990f7e13b138ddf94bab6f7aa83420ddc0 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 7 Jan 2025 15:44:55 +0000 Subject: [PATCH] fix(jstz_proto): increment nonce --- crates/jstz_proto/src/api/smart_function.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/jstz_proto/src/api/smart_function.rs b/crates/jstz_proto/src/api/smart_function.rs index d3e87f7f6..ce0ce7883 100644 --- a/crates/jstz_proto/src/api/smart_function.rs +++ b/crates/jstz_proto/src/api/smart_function.rs @@ -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())