Skip to content

Commit

Permalink
Updated the sample in the readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kantagara committed Oct 9, 2024
1 parent 3e79913 commit 1fc487d
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@
## Documentation
You can access the full docs at [docs.gaming.chainsafe.io](https://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.
Our codebase is quite easy to use. To immediately start with reading from the blockchain, once you've installed our core package,you can simply drag and drop our Web3Unity prefab to the scene and do the following

```csharp
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);
await Web3Unity.Instance.Initialize(false);
var balance = await Web3Unity.Web3.Erc20.GetBalanceOf(contractAddress, accountAddress);
}
```

Expand Down

0 comments on commit 1fc487d

Please sign in to comment.