Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample Updates #690

Merged
merged 7 commits into from
Oct 31, 2023
Merged

Sample Updates #690

merged 7 commits into from
Oct 31, 2023

Conversation

sneakzttv
Copy link
Contributor

Added contract call and private key sign/send to the UnsortedSample.cs file for ECDSA later.
Removed some magic strings and changed them to input parameters in UnsortedSample.cs.
Updated tests.

Added contract call and private key sign/send to the UnsortedSample.cs file.
Removed some magic strings and changed them to input parameters in UnsortedSample.cs.
Updated tests.
@@ -8,6 +8,10 @@ public class ContractSendBehaviour : SampleBehaviour
public string method = "addTotal";
public string abi = "[ { \"inputs\": [ { \"internalType\": \"uint8\", \"name\": \"_myArg\", \"type\": \"uint8\" } ], \"name\": \"addTotal\", \"outputs\": [], \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"inputs\": [], \"name\": \"myTotal\", \"outputs\": [ { \"internalType\": \"uint256\", \"name\": \"\", \"type\": \"uint256\" } ], \"stateMutability\": \"view\", \"type\": \"function\" } ]";
public string contractAddress = "0x7286Cf0F6E80014ea75Dbc25F545A3be90F4904F";
public object[] args =
{
1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does that number 1 actually represent?

Copy link
Contributor Author

@sneakzttv sneakzttv Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The amount to increase the state variable by like so:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

contract AddTotal {
    uint256 public myTotal = 0;

    function addTotal(uint8 _myArg) public {
        myTotal = myTotal + _myArg;
    }
}

Copy link
Contributor Author

@sneakzttv sneakzttv Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably refactor the object so it's initialized from a public integer so it's not sitting there as a magic number too. BRB.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@kalambet kalambet added this to the 2.5.1 Release milestone Oct 30, 2023
Copy link
Contributor

@kantagara kantagara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

sneakzttv and others added 2 commits October 31, 2023 16:17
Updated test case to use a constant instead of a magic number
Copy link
Contributor

@juans-chainsafe juans-chainsafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following build error:

/Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity.web3auth/Runtime/Web3AuthWalletExtensions.cs(50,100): error CS1026: ) expected

@RyRy79261
Copy link
Contributor

@juans-chainsafe Theres a fix in @sneakzttv latest goerli PR that is approved that should resolve that issue

@sneakzttv
Copy link
Contributor Author

should work now @juans-chainsafe

Copy link
Contributor

@juans-chainsafe juans-chainsafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Samples working correctly!

@sneakzttv sneakzttv merged commit 4a9ad03 into main Oct 31, 2023
8 checks passed
@sneakzttv sneakzttv deleted the sneakz/sample-updates branch October 31, 2023 13:49
robGG1997 pushed a commit that referenced this pull request Nov 3, 2023
* Sample Updates

Added contract call and private key sign/send to the UnsortedSample.cs file.
Removed some magic strings and changed them to input parameters in UnsortedSample.cs.
Updated tests.

* Auto-duplicate Package Samples

* Update ContractSendBehaviour.cs

* Auto-duplicate Package Samples

* Test case

Updated test case to use a constant instead of a magic number

---------

Co-authored-by: sneakzttv <sneakzttv@users.noreply.github.com>
rob1997 pushed a commit that referenced this pull request Jan 16, 2025
* Sample Updates

Added contract call and private key sign/send to the UnsortedSample.cs file.
Removed some magic strings and changed them to input parameters in UnsortedSample.cs.
Updated tests.

* Auto-duplicate Package Samples

* Update ContractSendBehaviour.cs

* Auto-duplicate Package Samples

* Test case

Updated test case to use a constant instead of a magic number

---------

Co-authored-by: sneakzttv <sneakzttv@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants