diff --git a/Web3Unity/Scripts/Library/ERC721.cs b/Web3Unity/Scripts/Library/ERC721.cs index 9ec85c409..079f97f0d 100644 --- a/Web3Unity/Scripts/Library/ERC721.cs +++ b/Web3Unity/Scripts/Library/ERC721.cs @@ -35,7 +35,7 @@ public static async Task OwnerOf(string _chain, string _network, string return response; } - public static async Task> OwnerOfBatch(string _chain, string _network, string _contract, string[] _tokenIds, string _rpc="") + public static async Task> OwnerOfBatch(string _chain, string _network, string _contract, string[] _tokenIds, string _multicall = "", string _rpc="") { string method = "ownerOf"; // build array of args @@ -45,7 +45,7 @@ public static async Task> OwnerOfBatch(string _chain, string _netwo obj[i] = new string[1] { _tokenIds[i] }; }; string args = JsonConvert.SerializeObject(obj); - string response = await EVM.MultiCall(_chain, _network, _contract, abi, method, args, _rpc); + string response = await EVM.MultiCall(_chain, _network, _contract, abi, method, args, _multicall, _rpc); try { string[] responses = JsonConvert.DeserializeObject(response); diff --git a/Web3Unity/Scripts/Library/EVM.cs b/Web3Unity/Scripts/Library/EVM.cs index d463df946..9143f5c22 100755 --- a/Web3Unity/Scripts/Library/EVM.cs +++ b/Web3Unity/Scripts/Library/EVM.cs @@ -55,7 +55,7 @@ public static async Task Call(string _chain, string _network, string _co return data.response; } - public static async Task MultiCall(string _chain, string _network, string _contract, string _abi, string _method, string _args, string _rpc = "") + public static async Task MultiCall(string _chain, string _network, string _contract, string _abi, string _method, string _args, string _multicall = "", string _rpc = "") { WWWForm form = new WWWForm(); form.AddField("chain", _chain); @@ -64,6 +64,7 @@ public static async Task MultiCall(string _chain, string _network, strin form.AddField("abi", _abi); form.AddField("method", _method); form.AddField("args", _args); + form.AddField("multicall", _multicall); form.AddField("rpc", _rpc); string url = host + "/multicall"; UnityWebRequest webRequest = UnityWebRequest.Post(url, form); diff --git a/Web3Unity/Scripts/Prefabs/ERC721/ERC721OwnerOfBatchExample.cs b/Web3Unity/Scripts/Prefabs/ERC721/ERC721OwnerOfBatchExample.cs index abffac3f4..d6bac114d 100644 --- a/Web3Unity/Scripts/Prefabs/ERC721/ERC721OwnerOfBatchExample.cs +++ b/Web3Unity/Scripts/Prefabs/ERC721/ERC721OwnerOfBatchExample.cs @@ -10,8 +10,10 @@ async void Start() string network = "mainnet"; string contract = "0xA74E199990FF572A320508547Ab7f44EA51e6F28"; string[] tokenIds = {"700", "791"}; + string multicall = ""; // optional: multicall contract https://github.com/makerdao/multicall + string rpc = ""; // optional: custom rpc - List batchOwners = await ERC721.OwnerOfBatch(chain, network, contract, tokenIds); + List batchOwners = await ERC721.OwnerOfBatch(chain, network, contract, tokenIds, multicall, rpc); foreach (string owner in batchOwners) { print ("OwnerOfBatch: " + owner);