public async Task GetTableRowsTest() { var tableRowsParams = new GetTableRowsParams { Scope = "test", Code = "test", Table = "posts" //Json = true, //LowerBound = "0", //UpperBound = "-1", //Limit = 10 }; var resp = await Api.GetTableRows(tableRowsParams, CancellationToken); TestPropetries(resp); }
public async Task GetTableRowsTest(string code, string scope, string table) { var args = new GetTableRowsParams { Code = code, Scope = scope, Table = table, Json = true, //LowerBound = "0", //UpperBound = "-1", //Limit = 10 }; var resp = await Api.GetTableRowsAsync(args, CancellationToken).ConfigureAwait(false); TestPropetries(resp); }
private async void btnGetAccounts_Click(object sender, EventArgs e) { btnGetAccounts.Enabled = false; var args = new GetTableRowsParams { Code = "eosio", Scope = "eosio", Table = "voters", Json = true, //LowerBound = "0", //UpperBound = "-1", Limit = 1000 }; int skip = 0; do { var resp = await Api.GetTableRows(args, CancellationToken.None); if (resp.IsError) { throw resp.Exception; } var accs = resp.Result.Rows.Skip(skip).Select(r => ((JObject)r).Value <string>("owner")).ToArray(); if (accs.Any()) { File.AppendAllLines(TestNetAccountsFileName, accs); } if (!resp.Result.More) { break; } args.LowerBound = accs.Last(); skip = 1; } while (true); btnGetAccounts.Enabled = true; }
public async Task GetTableRowsTest() { var tableRowsParams = new GetTableRowsParams() { Scope = "hackathon", Code = "hackathon", Table = "accounts", Json = true, LowerBound = "0", UpperBound = "-1", Limit = 10, }; var resp = await Api.GetTableRows(tableRowsParams, CancellationToken.None); Console.WriteLine(resp.Error); Assert.IsTrue(resp.IsSuccess); Console.WriteLine(JsonConvert.SerializeObject(resp.Result)); var obj = await Api.CustomPostRequest <JObject>("v1/chain/get_table_rows", tableRowsParams, CancellationToken.None); TestPropetries(resp.Result.GetType(), obj.Result); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine(JsonConvert.SerializeObject(obj)); }
/// <summary> /// Fetch smart contract data from an account. /// /// curl http://127.0.0.1:8888/v1/chain/get_table_rows -X POST -d '{"scope":"inita", "code":"currency", "table":"account", "json": true}' /// curl http://127.0.0.1:8888/v1/chain/get_table_rows -X POST -d '{"scope":"inita", "code":"currency", "table":"account", "json": true, "lower_bound":0, "upper_bound":-1, "limit":10}' /// </summary> /// <param name="tableRowsParams"></param> /// <param name="token">Throws a <see cref="T:System.OperationCanceledException" /> if this token has had cancellation requested.</param> /// <returns></returns> public async Task <OperationResult <GetTableRowsResult> > GetTableRows(GetTableRowsParams tableRowsParams, CancellationToken token) { var endpoint = "v1/chain/get_table_rows"; return(await CustomPostRequest <GetTableRowsResult>(endpoint, tableRowsParams, token)); }
/// <summary> /// Fetch smart contract data from an account. /// /// curl http://127.0.0.1:8888/v1/chain/get_table_rows -X POST -d '{"scope":"inita", "code":"currency", "table":"account", "json": true}' /// curl http://127.0.0.1:8888/v1/chain/get_table_rows -X POST -d '{"scope":"inita", "code":"currency", "table":"account", "json": true, "lower_bound":0, "upper_bound":-1, "limit":10}' /// </summary> /// <param name="args"></param> /// <param name="token">Throws a <see cref="T:System.OperationCanceledException" /> if this token has had cancellation requested.</param> /// <returns></returns> public async Task <OperationResult <GetTableRowsResult> > GetTableRowsAsync(GetTableRowsParams args, CancellationToken token) { var endpoint = $"{ChainUrl}/v1/chain/get_table_rows"; return(await CustomPutRequestAsync <GetTableRowsResult>(endpoint, args, token).ConfigureAwait(false)); }