Releases: ChainSafe/web3.unity
Releases · ChainSafe/web3.unity
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