I create a transaction - SmartContract, Invoke and load the ABI.
Then it shows me the 2 arguments. bet_id and result, but when I want to set the result to False, it doesn’t want to create the transaction because it assumes it must be True. In my opinion this is a bug.
Hi @CryptoJaeger
Please clear your cache and reload the screen.
I saw in your screenshot that it’s not the new version.
In the new version, the checkbox is not required.
Hello mate, this feature is on pipe of the Kleverscan team, I circle back to u when done. BTW we’ve updated the IDE extension, have you checked it already? You will be able to upgrade your contract by IDE extension meanwhile
So I don’t see any update in the Klever IDE extension in VS-Code. The problem is still the same. I also think that you should not enter the owner address for the upgrade, but rather the contract address. Anyway, I have tried both. Here is the result. A spinning circle.
Select Build-Contract with success, but the output says, can not build contract.
(1/1)
In \\?\C:\Users\Marco\Documents\KLV-Workplace\chain\chain\meta
Calling `cargo run build`
Compiling chain v0.0.0 (C:\Users\Marco\Documents\KLV-Workplace\chain\chain)
Compiling chain-meta v0.0.0 (C:\Users\Marco\Documents\KLV-Workplace\chain\chain\meta)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 15.50s
Running `\\?\C:\Users\Marco\Documents\KLV-Workplace\chain\chain\target\debug\chain-meta.exe build`
Warning: wasm-opt not installed
Warning: wasm-objdump not installed
Building chain.wasm in \\?\C:\Users\Marco\Documents\KLV-Workplace\chain\chain\wasm ...
RUSTFLAGS="-C link-arg=-s -C link-arg=-zstack-size=131072" cargo build --target=wasm32-unknown-unknown --release
Compiling chain-wasm v0.0.0 (C:\Users\Marco\Documents\KLV-Workplace\chain\chain\wasm)
Finished `release` profile [optimized] target(s) in 4.13s
Copying ../wasm/target/wasm32-unknown-unknown/release/chain_wasm.wasm to ../output/chain.wasm ...
Packing ../output/chain.kleversc.json ...
Contract size: 47779 bytes.
So far I have always deployed directly via testnet.kleverscan.org and the contract has been running for quite a while, but in the menu it would be practical to do an upgrade and throws this error:
Output:
ERROR [2025-03-06T06:06:54.203Z]: Could not build Smart Contract
Error: Could not build Smart Contract
at Object.<anonymous> (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:96961)
at Generator.next (<anonymous>)
at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:86358
at new Promise (<anonymous>)
at n (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:86103)
at t.manageContract (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:92132)
at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:77498
at Generator.next (<anonymous>)
at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:75761
at new Promise (<anonymous>)
at n (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:75506)
at S (c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:77441)
at c:\Users\Marco\.vscode\extensions\klever-org.vscode-kvm-ide-1.0.10\dist\extension.js:2:79211
at mw.h (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:32741)
at mw.$executeContributedCommand (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:33579)
at Uy.S (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:114979)
at Uy.Q (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:114759)
at Uy.M (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:113848)
at Uy.L (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:112953)
at Ah.value (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:111750)
at D.B (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2373)
at D.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2591)
at Xn.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:9458)
at Ah.value (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:13296)
at D.B (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2373)
at D.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2591)
at Xn.fire (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:9458)
at MessagePortMain.<anonymous> (file:///c:/Users/Marco/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:11588)
at MessagePortMain.emit (node:events:518:28)
at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2949)
To use our IDE extension on Windows, you must run it inside WSL Ubuntu. It looks like you’re running it directly on Windows, which currently lacks the necessary dependencies to communicate with the node.
Solution:
To unlock all the features of your IDE, use WSL2 Ubuntu in windows or run it on a Ubuntu/macOS machine.
Your logs show commit: 1.7.7, while the latest Testnet version is 1.7.11.
This time, you’ll need to perform some manual operations, but based on our last interactions, we made the new version of the extension able to automatically handle future updates.
Update Instructions
With these changes, we recommend starting with a clean setup. Follow these steps:
Delete the SDK Folder:
Navigate to your SDK location (default: ~/klever-sdk, unless configured otherwise).
Delete this folder.
Uninstall the Previous Extension:
Remove the old version of the KleverChain IDE extension from VSCode.
Restart VSCode.
Delete Old Workspace Files:
Remove any kleverchain.workspace.json files from previous projects.
Install v1.0.10:
Add the latest version of the KleverChain IDE extension.
One More Important Step!
When starting a new project, run the following commands to ensure the correct Rustup version:
rustup override set nightly-2024-06-12
rustup target add wasm32-unknown-unknown
Also, remember to update the wallet address in your extension settings when generating a new wallet. This ensures the faucet functions properly.
Let me know if you need any help during the update!
I’d also like to provide an update on Windows support.
I’m working on making it available to everyone, and WSL2 currently seems to be the most promising solution. However, as I’m still testing and experimenting, I haven’t created a tutorial yet for setting it up on Windows.
Once it’s ready, I’ll create a forum topic with detailed instructions.
I just wanted to give you a quick follow-up because you seem to be an active Windows developer, just like I am. So believe me when I say that I’m one of the most interested in having a stable and secure environment for Windows.
I will do that on my Linux machine, but I won’t use it there. Constantly moving the code back and forth. My work machine is on Windows, so it would be really cool if at least testnet.kleverscan.org supported an upgrade.
I have done all the steps like this. I even deployed the contract on the Windows computer beforehand to see that it works.
Then I did the upgrade in the fresh Linux VS code and it says “OwnerAddress” which I think is wrong. Since I have made around 149 deploys with my OwnerAddress.
It should say “ContractAddress”, right?
In any case. It doesn’t work for me.
Here with OwnerAddress:
Error: Command failed: KLEVER_NODE=https://node.testnet.klever.finance /home/marco/klever-sdk/koperator --key-file=/home/marco/Klever-Work/extension.pem sc upgrade klv1v9mcl3m25tymxzs2tu3zztp7y5ceg3yy9z2glj5wykywanf564fsd5djjt --upgradeable --readable --payable --payableBySC --wasm="/home/marco/kleverwork/kex/output/kex.wasm" --await --sign
commit: v1.7.11-0-g4e957dbc-dirty, error: error creating transaction: validation error: invalid argument: upgrade is allowed only for owner - (upgrade is allowed only for owner)
try adding a `--help` flag
Yes, you are absolutely right—it should indeed say “contractAddress”. I’m updating it right now.
About Your New Error
The good news is that this error should be easy to fix!
When a contract performs an upgrade, it calls its own upgrade function, allowing the code to handle migration, storage updates, and other necessary operations (if necessary).
So when you see the error “invalid function” during a contract update, it means we tried to call the upgrade function, but it wasn’t found in your contract.
Solution: Implement an Upgrade Function
To fix this, simply add an upgrade function to your contract.
Example 1: Declaring an empty upgrade function
#[upgrade]
fn upgrade(&self) {}
Example 2: Upgrade function with an argument
#[upgrade]
fn upgrade(&self, example_argument: BigUint) {
// your code
}