Releases: ChainSafe/web3.unity
Releases 路 ChainSafe/web3.unity
v1.2.0
- Version 1.2.0 now supports Mobile and Desktop builds via Web3Wallet
- Mobile and Desktop Prefabs provided for SendTransaction - SignMessage - Transfer20 - Transfer721 - Transfer1155
- There is a known bug in Android with environment not being checked correctly in some use cases and will be updated in the next release.
1.1.0
Release notes
- Removed modal and now defaults to browser extension wallet i.e MetaMask
- Variable name changed from networkId to web3ChainId
- If you want to add a modal as in previous releases follow instructions in the WebGLTemplates folder file named readme.md for a guide on how to implement this.
We have also added a game-web3gl playground
v1.0.15
Removed JSON.Net dependency as this comes with newer versions of Unity3D. If you are using an older version of Unity and experiencing the error The type or namespace name 'Newtonsoft'
when importing the SDK. You will need to install it manually from the Unity Asset Store with the link provided.
https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347
v1.0.14
v1.0.13
Script and Prefab to get all of a user's NFTs (ERC721s and ERC1155s)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Newtonsoft.Json;
public class AllErc721Example : MonoBehaviour
{
private class NFTs
{
public string contract { get; set; }
public string tokenId { get; set; }
public string uri { get; set; }
public string balance { get; set; }
}
async void Start()
{
string chain = "ethereum";
string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli
string account = "0xebc0e6232fb9d494060acf580105108444f7c696";
string contract = "";
string response = await EVM.AllErc721(chain, network, account, contract);
try
{
NFTs[] erc721s = JsonConvert.DeserializeObject<NFTs[]>(response);
print(erc721s[0].contract);
print(erc721s[0].tokenId);
print(erc721s[0].uri);
print(erc721s[0].balance);
}
catch
{
print("Error: " + response);
}
}
}
v1.0.12
v1.0.11
SDK now supports gas limit and gas price.
// account to send to
string to = "0x428066dd8A212104Bc9240dCe3cdeA3D3A0f7979";
// amount in wei to send
string value = "12300000000000000";
// gas limit OPTIONAL
string gasLimit = "";
// gas price OPTIONAL
string gasPrice = "";
// connects to user's browser wallet (metamask) to send a transaction
try {
string response = await Web3GL.SendTransaction(to, value, gasLimit, gasPrice);
Debug.Log(response);
} catch (Exception e) {
Debug.LogException(e, this);
}
v1.0.10
Dynamic multicall for any EVM chain/network
example here
async void Start()
{
string chain = "anyChain";
string network = "anyNetwork";
string contract = "0xA74E199990FF572A320508547Ab7f44EA51e6F28";
string[] tokenIds = {"700", "791"};
string multicall = "0xMulticallContractAddress"; // optional: multicall contract https://github.com/makerdao/multicall
string rpc = "https://anyrpc.com"; // optional: custom rpc
List<string> batchOwners = await ERC721.OwnerOfBatch(chain, network, contract, tokenIds, multicall, rpc);
foreach (string owner in batchOwners)
{
print ("OwnerOfBatch: " + owner);
}
}
v1.0.9
Web3.unity.v1.0.9.mov
To get user's current network
https://chainsafe.github.io/game-docs/#get-users-network