Skip to content

Commit dcabb95

Browse files
Merge branch 'release/v2.11.0' into v2.x-master
2 parents 62645cf + a7893be commit dcabb95

File tree

12 files changed

+374
-41
lines changed

12 files changed

+374
-41
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
orbs:
44
node: circleci/[email protected]
55
slack: circleci/[email protected]
6-
browser-tools: circleci/browser-tools@1.4.8
6+
browser-tools: circleci/browser-tools@1.5.1
77
gh-pages: sugarshin/[email protected]
88

99
parameters:

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# v2.11.0
2+
3+
<!-- Release notes generated using configuration in .github/release.yml at release/v2.11.0 -->
4+
5+
## What's Changed
6+
7+
### Bugfixes
8+
9+
- cucumber: fix miissing skip in browsers by @algorandskiy in https://github.com/algorand/js-algorand-sdk/pull/919
10+
11+
### Enhancements
12+
13+
- api: port regenerated incentives and heartbeat models by @algorandskiy in https://github.com/algorand/js-algorand-sdk/pull/917
14+
- Incentives: Support heartbeat transaction (v2.9) by @algorandskiy in https://github.com/algorand/js-algorand-sdk/pull/918
15+
- BlockHeaders: Support for /v2/blockheaders against Indexer API (v2.x line) by @gmalouf in https://github.com/algorand/js-algorand-sdk/pull/928
16+
- API: Support for header-only flag on /v2/block algod endpoint (v2.x backport) by @gmalouf in https://github.com/algorand/js-algorand-sdk/pull/941
17+
18+
**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v3.1.0...v2.11.0
19+
120
# v2.10.0
221

322
<!-- Release notes generated using configuration in .github/release.yml at release/v2.10.0 -->

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Include a minified browser bundle directly in your HTML like so:
2020

2121
```html
2222
<script
23-
src="https://unpkg.com/algosdk@v2.10.0/dist/browser/algosdk.min.js"
24-
integrity="sha384-/nsSdRUItyaWG9aAQkugPs/yAyEaWwKsmRNCUk/TE7sN/iv3H+Iz1ZN4eNVFLV7E"
23+
src="https://unpkg.com/algosdk@v2.11.0/dist/browser/algosdk.min.js"
24+
integrity="sha384-uev6K0btFsNVnRflssjwJjjGiXAPl/gga0gr5hD7F4w+BXwNfdVrhkQfjcIXgVVp"
2525
crossorigin="anonymous"
2626
></script>
2727
```
@@ -30,8 +30,8 @@ or
3030

3131
```html
3232
<script
33-
src="https://cdn.jsdelivr.net/npm/algosdk@v2.10.0/dist/browser/algosdk.min.js"
34-
integrity="sha384-/nsSdRUItyaWG9aAQkugPs/yAyEaWwKsmRNCUk/TE7sN/iv3H+Iz1ZN4eNVFLV7E"
33+
src="https://cdn.jsdelivr.net/npm/algosdk@v2.11.0/dist/browser/algosdk.min.js"
34+
integrity="sha384-uev6K0btFsNVnRflssjwJjjGiXAPl/gga0gr5hD7F4w+BXwNfdVrhkQfjcIXgVVp"
3535
crossorigin="anonymous"
3636
></script>
3737
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "algosdk",
3-
"version": "2.10.0",
3+
"version": "2.11.0",
44
"description": "The official JavaScript SDK for Algorand",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

src/client/v2/algod/block.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@ export default class Block extends JSONRequest {
2020
return `/v2/blocks/${this.round}`;
2121
}
2222

23+
/**
24+
* If true, only the block header (exclusive of payset or certificate) may be included in response.
25+
*
26+
* #### Example
27+
* ```typescript
28+
*
29+
* const roundNumber = 41000000;
30+
*
31+
* const blockResponse = await algodClient
32+
* .block(roundNumber)
33+
* .headerOnly(true)
34+
* .do();
35+
* ```
36+
*
37+
* @param headerOnly - the flag indicating whether exclusively return header in response
38+
* @category query
39+
*/
40+
headerOnly(headerOnly: boolean) {
41+
this.query['header-only'] = headerOnly;
42+
return this;
43+
}
44+
2345
// eslint-disable-next-line class-methods-use-this
2446
prepare(body: Uint8Array) {
2547
if (body && body.byteLength > 0) {

src/client/v2/algod/models/types.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,38 +2098,6 @@ export class BlockHashResponse extends BaseModel {
20982098
}
20992099
}
21002100

2101-
/**
2102-
* Block header.
2103-
*/
2104-
export class BlockHeaderResponse extends BaseModel {
2105-
/**
2106-
* Block header data.
2107-
*/
2108-
public blockheader?: BlockHeader;
2109-
2110-
/**
2111-
* Creates a new `BlockHeaderResponse` object.
2112-
* @param blockheader - Block header data.
2113-
*/
2114-
constructor({ blockheader }: { blockheader?: BlockHeader }) {
2115-
super();
2116-
this.blockheader = blockheader;
2117-
2118-
this.attribute_map = {
2119-
blockheader: 'blockHeader',
2120-
};
2121-
}
2122-
2123-
// eslint-disable-next-line camelcase
2124-
static from_obj_for_encoding(data: Record<string, any>): BlockHeaderResponse {
2125-
/* eslint-disable dot-notation */
2126-
return new BlockHeaderResponse({
2127-
blockheader: data['blockHeader'],
2128-
});
2129-
/* eslint-enable dot-notation */
2130-
}
2131-
}
2132-
21332101
/**
21342102
* All logs emitted in the given round. Each app call, whether top-level or inner,
21352103
* that contains logs results in a separate AppCallLogs object. Therefore there may

src/client/v2/indexer/indexer.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import LookupApplications from './lookupApplications';
1515
import LookupApplicationLogs from './lookupApplicationLogs';
1616
import LookupApplicationBoxByIDandName from './lookupApplicationBoxByIDandName';
1717
import SearchAccounts from './searchAccounts';
18+
import SearchForBlockHeaders from './searchForBlockHeaders';
1819
import SearchForTransactions from './searchForTransactions';
1920
import SearchForAssets from './searchForAssets';
2021
import SearchForApplications from './searchForApplications';
@@ -345,6 +346,21 @@ export default class IndexerClient extends ServiceClient {
345346
return new SearchForTransactions(this.c, this.intDecoding);
346347
}
347348

349+
/**
350+
* Returns information about indexed block headers.
351+
*
352+
* #### Example
353+
* ```typescript
354+
* const txns = await indexerClient.searchForBlockHeaders().do();
355+
* ```
356+
*
357+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
358+
* @category GET
359+
*/
360+
searchForBlockHeaders() {
361+
return new SearchForBlockHeaders(this.c, this.intDecoding);
362+
}
363+
348364
/**
349365
* Returns information about indexed assets.
350366
*
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
import JSONRequest from '../jsonrequest';
2+
3+
/**
4+
* Returns information about indexed block headers.
5+
*
6+
* #### Example
7+
* ```typescript
8+
* const bhs = await indexerClient.searchForBlockHeaders().do();
9+
* ```
10+
*
11+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
12+
* @category GET
13+
*/
14+
export default class SearchForBlockHeaders extends JSONRequest {
15+
/**
16+
* @returns `/v2/block-headers`
17+
*/
18+
// eslint-disable-next-line class-methods-use-this
19+
path() {
20+
return '/v2/block-headers';
21+
}
22+
23+
/**
24+
* Accounts marked as absent in the block header's participation updates.
25+
*
26+
* #### Example
27+
* ```typescript
28+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
29+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
30+
* const bhs = await indexerClient
31+
* .searchForBlockHeaders()
32+
* .absent([address1,address2])
33+
* .do();
34+
* ```
35+
*
36+
* @param absent - a comma separated list of addresses
37+
* @category query
38+
*/
39+
absent(absent: string[]) {
40+
this.query.absent = absent;
41+
return this;
42+
}
43+
44+
/**
45+
* Include results after the given time.
46+
*
47+
* #### Example
48+
* ```typescript
49+
* const afterTime = "2022-10-21T00:00:11.55Z";
50+
* const bhs = await indexerClient
51+
* .searchForBlockHeaders()
52+
* .afterTime(afterTime)
53+
* .do();
54+
* ```
55+
*
56+
* @param after - rfc3339 string
57+
* @category query
58+
*/
59+
afterTime(after: string) {
60+
this.query['after-time'] = after;
61+
return this;
62+
}
63+
64+
/**
65+
* Include results before the given time.
66+
*
67+
* #### Example
68+
* ```typescript
69+
* const beforeTime = "2022-02-02T20:20:22.02Z";
70+
* const bhs = await indexerClient
71+
* .searchForBlockHeaders()
72+
* .beforeTime(beforeTime)
73+
* .do();
74+
* ```
75+
*
76+
* @param before - rfc3339 string
77+
* @category query
78+
*/
79+
beforeTime(before: string) {
80+
this.query['before-time'] = before;
81+
return this;
82+
}
83+
84+
/**
85+
* Accounts marked as expired in the block header's participation updates.
86+
*
87+
* #### Example
88+
* ```typescript
89+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
90+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
91+
* const bhs = await indexerClient
92+
* .searchForBlockHeaders()
93+
* .expired([address1,address2])
94+
* .do();
95+
* ```
96+
*
97+
* @param expired - - a comma separated list of addresses
98+
* @category query
99+
*/
100+
expired(expired: string[]) {
101+
this.query.expired = expired;
102+
return this;
103+
}
104+
105+
/**
106+
* Maximum number of results to return.
107+
*
108+
* #### Example
109+
* ```typescript
110+
* const maxResults = 25;
111+
* const bhs = await indexerClient
112+
* .searchForBlockHeaders()
113+
* .limit(maxResults)
114+
* .do();
115+
* ```
116+
*
117+
* @param limit
118+
* @category query
119+
*/
120+
limit(limit: number) {
121+
this.query.limit = limit;
122+
return this;
123+
}
124+
125+
/**
126+
* Include results at or before the specified max-round.
127+
*
128+
* #### Example
129+
* ```typescript
130+
* const maxRound = 18309917;
131+
* const bhs = await indexerClient
132+
* .searchForBlockHeaders()
133+
* .maxRound(maxRound)
134+
* .do();
135+
* ```
136+
*
137+
* @param round
138+
* @category query
139+
*/
140+
maxRound(round: number) {
141+
this.query['max-round'] = round;
142+
return this;
143+
}
144+
145+
/**
146+
* Include results at or after the specified min-round.
147+
*
148+
* #### Example
149+
* ```typescript
150+
* const minRound = 18309917;
151+
* const bhs = await indexerClient
152+
* .searchForBlockHeaders()
153+
* .minRound(minRound)
154+
* .do();
155+
* ```
156+
*
157+
* @param round
158+
* @category query
159+
*/
160+
minRound(round: number) {
161+
this.query['min-round'] = round;
162+
return this;
163+
}
164+
165+
/**
166+
* The next page of results.
167+
*
168+
* #### Example
169+
* ```typescript
170+
* const maxResults = 25;
171+
*
172+
* const bh1 = await indexerClient
173+
* .searchForBlockHeaders()
174+
* .limit(maxResults)
175+
* .do();
176+
*
177+
* const bh2 = await indexerClient
178+
* .searchForBlockHeaders()
179+
* .limit(maxResults)
180+
* .nextToken(bh1["next-token"])
181+
* .do();
182+
* ```
183+
*
184+
* @param nextToken - provided by the previous results
185+
* @category query
186+
*/
187+
nextToken(nextToken: string) {
188+
this.query.next = nextToken;
189+
return this;
190+
}
191+
192+
/**
193+
* Accounts marked as proposer in the block header's participation updates.
194+
*
195+
* #### Example
196+
* ```typescript
197+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
198+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
199+
* const bhs = await indexerClient
200+
* .searchForBlockHeaders()
201+
* .proposers([address1,address2])
202+
* .do();
203+
* ```
204+
*
205+
* @param proposers - a comma separated list of addresses
206+
* @category query
207+
*/
208+
proposers(proposers: string[]) {
209+
this.query.proposers = proposers;
210+
return this;
211+
}
212+
}

0 commit comments

Comments
 (0)