Skip to content

Commit 351a73d

Browse files
authored
Merge pull request #100 from ChainSafe/web3_unity_pagination
Update EVM.cs pagination
2 parents 1f56059 + 1baf522 commit 351a73d

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

Web3Unity/Scripts/Library/EVM.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,27 +126,32 @@ public static async Task<string> CreateContractData(string _abi, string _method,
126126
return data.response;
127127
}
128128

129-
public static async Task<string> AllErc721(string _chain, string _network, string _account, string _contract = "")
129+
public static async Task<string> AllErc721(string _chain, string _network, string _account, string _contract = "", int _first = 500, int _skip = 0)
130130
{
131131
WWWForm form = new WWWForm();
132132
form.AddField("chain", _chain);
133133
form.AddField("network", _network);
134134
form.AddField("account", _account);
135135
form.AddField("contract", _contract);
136+
form.AddField("first", _first);
137+
form.AddField("skip", _skip);
138+
136139
string url = host + "/all721";
137140
UnityWebRequest webRequest = UnityWebRequest.Post(url, form);
138141
await webRequest.SendWebRequest();
139142
Response<string> data = JsonUtility.FromJson<Response<string>>(System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data));
140143
return data.response;
141144
}
142145

143-
public static async Task<string> AllErc1155(string _chain, string _network, string _account, string _contract = "")
146+
public static async Task<string> AllErc1155(string _chain, string _network, string _account, string _contract = "", int _first = 500, int _skip = 0)
144147
{
145148
WWWForm form = new WWWForm();
146149
form.AddField("chain", _chain);
147150
form.AddField("network", _network);
148151
form.AddField("account", _account);
149152
form.AddField("contract", _contract);
153+
form.AddField("first", _first);
154+
form.AddField("skip", _skip);
150155
string url = host + "/all1155";
151156
UnityWebRequest webRequest = UnityWebRequest.Post(url, form);
152157
await webRequest.SendWebRequest();

Web3Unity/Scripts/Prefabs/EVM/AllErc1155Example.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ async void Start()
1919
string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli
2020
string account = "0xebc0e6232fb9d494060acf580105108444f7c696";
2121
string contract = "";
22-
string response = await EVM.AllErc1155(chain, network, account, contract);
22+
int first = 500;
23+
int skip = 0;
24+
string response = await EVM.AllErc1155(chain, network, account, contract, first, skip);
2325
try
2426
{
2527
NFTs[] erc1155s = JsonConvert.DeserializeObject<NFTs[]>(response);

Web3Unity/Scripts/Prefabs/EVM/AllErc721Example.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ async void Start()
1919
string network = "rinkeby"; // mainnet ropsten kovan rinkeby goerli
2020
string account = "0xebc0e6232fb9d494060acf580105108444f7c696";
2121
string contract = "";
22-
string response = await EVM.AllErc721(chain, network, account, contract);
22+
int first = 500;
23+
int skip = 0;
24+
string response = await EVM.AllErc721(chain, network, account, contract, first, skip);
2325
try
2426
{
2527
NFTs[] erc721s = JsonConvert.DeserializeObject<NFTs[]>(response);

0 commit comments

Comments
 (0)