Skip to content

Latest commit

History

History
51 lines (37 loc) 路 3.08 KB

README.md

File metadata and controls

51 lines (37 loc) 路 3.08 KB

ChainSafeGaming

Discord Twitter

Documentation

You can access the full docs at docs.gaming.chainsafe.io.

Our codebase is quite easy to use. This is an example of accessing player balance and calling a write method of a custom Smart Contract within Unity.

async void Awake()
{
    // Build Web3 client
    var web3 = await BuildWeb3();
    
    // Get ERC-20 balance for current user
    var balance = await web3.Erc20.GetBalanceOf(erc20ContractAddress);
    
    // Interact with custom Contract
    var customContract = web3.ContractBuilder.Build(contractAbi, contractAddress);
    var friendHp = await customContract.SendSingle<int, BigInteger>("healPlayer", nftItemId);
}

Additional prefab scripts can be found here docs.gaming.chainsafe.io/current/sample-scripts.

Support

  • Need help with web3.unity or found a bug? Be sure to read the documentation above, then review existing issues or create a new one here. This is the best way to get help from the ChainSafe Gaming team.
  • Need help from the community, including questions not related to web3.unity? Ask in #community-code-support on Discord.

Contributing

  • Have an idea for a new feature that would improve web3.unity? Create a feature request here.
  • Have a code contribution you'd like to make directly? Make a pull request to this repo!
  • Join our community! Say hi on Discord in #web3unity-gaming-general and share your project built with web3.unity in #gaming-showcase.

Building the code

  • Clone the repository and run the setup script.
  • You can now open src/UnitySampleProject in Unity and start hacking!
  • Whenever you make changes to the code in the libraries, run the src/ChainSafe.Gaming.Unity/publish-to-unity-package script from within the folder it is in. This will build and publish the libraries to the UPM package's folder, thus making any new code accessible inside Unity.

ChainSafe Security Policy

Reporting a Security Bug

We take all security issues seriously, if you believe you have found a security issue within a ChainSafe project please notify us immediately. If an issue is confirmed, we will take all necessary precautions to ensure a statement and patch release is made in a timely manner.

Please email us a description of the flaw and any related information (e.g. reproduction steps, version) to security at chainsafe dot io.