@@ -17,19 +17,19 @@ Make a one-time query to get historical data:
1717``` typescript
1818import { query } from " @indexsupply/indexsupply.js" ;
1919
20- const { blockNumber, result } = await query ({
20+ const { cursor, rows } = await query ({
2121 apiKey: " face" ,
2222 chainId: 8453 ,
2323 query: ' select "from", "to", value from transfer limit 1' ,
24- eventSignatures : [' Transfer(address indexed from, address indexed to, uint256 value)' ],
24+ signatures : [' Transfer(address indexed from, address indexed to, uint256 value)' ],
2525 formatRow : ([from , to , value ]) => ({
2626 from: from as Address ,
2727 to: to as Address ,
2828 value: BigInt (value ),
2929 }),
3030})
3131
32- console .log (` Block ${blockNumber }: ` , result )
32+ console .log (` Block ${cursor }: ` , rows )
3333```
3434
3535### Live Query
@@ -44,16 +44,16 @@ const q = queryLive({
4444 chainId: 8453 ,
4545 startBlock : async () => 1234567n ,
4646 query: ' select "from", "to", value from transfer limit 1' ,
47- eventSignatures : [' Transfer(address indexed from, address indexed to, uint256 value)' ],
47+ signatures : [' Transfer(address indexed from, address indexed to, uint256 value)' ],
4848 formatRow : ([from , to , value ]) => ({
4949 from: from as Address ,
5050 to: to as Address ,
5151 value: BigInt (value ),
5252 }),
5353})
5454
55- for await (const { blockNumber, result } of q ) {
56- console .log (` New data at block ${blockNumber }: ` , result )
55+ for await (const { cursor, rows } of q ) {
56+ console .log (` New data at block ${cursor }: ` , rows )
5757}
5858```
5959
@@ -71,7 +71,7 @@ const liveQuery = queryLive({
7171 },
7272 ...
7373});
74- for await (const { blockNumber , result } of liveQuery ) {
74+ for await (const { cursor , rows } of liveQuery ) {
7575 await pg .query (" insert into my_table(block_num, ...) values (blockNumber, ...)" );
7676}
7777```
@@ -90,12 +90,12 @@ See [this page](https://indexsupply.github.io/indexsupply.js/examples/index.html
9090 </head >
9191 <script type =" module" >
9292 import { query } from " https://static.indexsupply.net/indexsupply.js" ;
93- const { blockNumber , result } = await query ({
93+ const { cursor , rows } = await query ({
9494 chainId: 8453n ,
95- eventSignatures : [],
95+ signatures : [],
9696 query: " select block_num from logs limit 1" ,
9797 });
98- document .querySelector (" body pre" ).textContent = JSON .stringify ({ blockNumber, result });
98+ document .querySelector (" body pre" ).textContent = JSON .stringify ({ cursor, rows });
9999 </script >
100100 <body >
101101 <pre ></pre >
0 commit comments