@@ -17,15 +17,17 @@ Get the first 10 token balances of account _testacc_.
17
17
``` javascript
18
18
const resp = await rpc .get_table_rows ({
19
19
json: true , // Get the response as json
20
- code: ' eosio.token' , // Contract that we target
21
- scope: ' testacc' // Account that owns the data
22
- table: ' accounts' // Table name
23
- limit: 10 , // maximum number of rows that we want to get
20
+ code: ' eosio.token' , // Contract that we target
21
+ scope: ' testacc' // Account that owns the data
22
+ table: ' accounts' // Table name
23
+ limit: 10 , // Maximum number of rows that we want to get
24
+ reverse = false , // Optional: Get reversed data
25
+ show_payer = false , // Optional: Show ram payer
24
26
});
25
27
26
28
console .log (resp .rows );
27
29
```
28
- Output:
30
+ Output:
29
31
30
32
``` json
31
33
{
@@ -42,15 +44,17 @@ Output:
42
44
``` javascript
43
45
const resp = await rpc .get_table_rows ({
44
46
json: true , // Get the response as json
45
- code: ' contract' , // Contract that we target
46
- scope: ' contract' // Account that owns the data
47
- table: ' profiles' // Table name
48
- lower_bound: ' testacc' // Table primary key value
47
+ code: ' contract' , // Contract that we target
48
+ scope: ' contract' // Account that owns the data
49
+ table: ' profiles' // Table name
50
+ lower_bound: ' testacc' // Table primary key value
49
51
limit: 1 , // Here we limit to 1 to get only the
52
+ reverse = false , // Optional: Get reversed data
53
+ show_payer = false , // Optional: Show ram payer
50
54
});
51
55
console .log (resp .rows );
52
56
```
53
- Output:
57
+ Output:
54
58
55
59
``` json
56
60
{
@@ -64,21 +68,23 @@ Output:
64
68
}
65
69
```
66
70
67
- ### Get one row by secondary index
71
+ ### Get one row by secondary index
68
72
69
73
``` javascript
70
74
const resp = await rpc .get_table_rows ({
71
75
json: true , // Get the response as json
72
- code: ' contract' , // Contract that we target
73
- scope: ' contract' // Account that owns the data
74
- table: ' profiles' // Table name
75
- table_key: ' age' // Table secondaray key name
76
- lower_bound: 21 // Table secondary key value
77
- limit: 1 , // Here we limit to 1 to get only the
76
+ code: ' contract' , // Contract that we target
77
+ scope: ' contract' // Account that owns the data
78
+ table: ' profiles' // Table name
79
+ table_key: ' age' // Table secondaray key name
80
+ lower_bound: 21 // Table secondary key value
81
+ limit: 1 , // Here we limit to 1 to get only row
82
+ reverse = false , // Optional: Get reversed data
83
+ show_payer = false , // Optional: Show ram payer
78
84
});
79
85
console .log (resp .rows );
80
86
```
81
- Output:
87
+ Output:
82
88
83
89
``` json
84
90
{
@@ -97,7 +103,7 @@ Output:
97
103
``` javascript
98
104
console .log (await rpc .get_currency_balance (' eosio.token' , ' testacc' , ' HAK' ));
99
105
```
100
- Output:
106
+ Output:
101
107
102
108
``` json
103
109
[ " 1000000000.0000 HAK" ]
@@ -108,7 +114,7 @@ Output:
108
114
``` javascript
109
115
console .log (await rpc .get_account (' testacc' ));
110
116
```
111
- Output:
117
+ Output:
112
118
113
119
``` json
114
120
{ "account_name" : " testacc" ,
@@ -123,7 +129,7 @@ Output:
123
129
"net_limit" : { "used" : -1 , "available" : -1 , "max" : -1 },
124
130
"cpu_limit" : { "used" : -1 , "available" : -1 , "max" : -1 },
125
131
"ram_usage" : 2724 ,
126
- "permissions" :
132
+ "permissions" :
127
133
[ { "perm_name" : " active" , "parent" : " owner" , "required_auth" : [] },
128
134
{ "perm_name" : " owner" , "parent" : " " , "required_auth" : [] } ],
129
135
"total_resources" : null ,
@@ -137,7 +143,7 @@ Output:
137
143
``` javascript
138
144
console .log (await rpc .get_block (1 ));
139
145
```
140
- Output:
146
+ Output:
141
147
142
148
``` json
143
149
{ "timestamp" : " 2018-06-01T12:00:00.000" ,
0 commit comments