Skip to content

Commit

Permalink
Merge branch 'release/v2.11.0' into v2.x-master
Browse files Browse the repository at this point in the history
  • Loading branch information
Algo-devops-service committed Feb 13, 2025
2 parents 62645cf + a7893be commit dcabb95
Show file tree
Hide file tree
Showing 12 changed files with 374 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
orbs:
node: circleci/[email protected]
slack: circleci/[email protected]
browser-tools: circleci/browser-tools@1.4.8
browser-tools: circleci/browser-tools@1.5.1
gh-pages: sugarshin/[email protected]

parameters:
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# v2.11.0

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

## What's Changed

### Bugfixes

- cucumber: fix miissing skip in browsers by @algorandskiy in https://github.com/algorand/js-algorand-sdk/pull/919

### Enhancements

- api: port regenerated incentives and heartbeat models by @algorandskiy in https://github.com/algorand/js-algorand-sdk/pull/917
- Incentives: Support heartbeat transaction (v2.9) by @algorandskiy in https://github.com/algorand/js-algorand-sdk/pull/918
- BlockHeaders: Support for /v2/blockheaders against Indexer API (v2.x line) by @gmalouf in https://github.com/algorand/js-algorand-sdk/pull/928
- 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

**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v3.1.0...v2.11.0

# v2.10.0

<!-- Release notes generated using configuration in .github/release.yml at release/v2.10.0 -->
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Include a minified browser bundle directly in your HTML like so:

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

```html
<script
src="https://cdn.jsdelivr.net/npm/algosdk@v2.10.0/dist/browser/algosdk.min.js"
integrity="sha384-/nsSdRUItyaWG9aAQkugPs/yAyEaWwKsmRNCUk/TE7sN/iv3H+Iz1ZN4eNVFLV7E"
src="https://cdn.jsdelivr.net/npm/algosdk@v2.11.0/dist/browser/algosdk.min.js"
integrity="sha384-uev6K0btFsNVnRflssjwJjjGiXAPl/gga0gr5hD7F4w+BXwNfdVrhkQfjcIXgVVp"
crossorigin="anonymous"
></script>
```
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algosdk",
"version": "2.10.0",
"version": "2.11.0",
"description": "The official JavaScript SDK for Algorand",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
22 changes: 22 additions & 0 deletions src/client/v2/algod/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ export default class Block extends JSONRequest {
return `/v2/blocks/${this.round}`;
}

/**
* If true, only the block header (exclusive of payset or certificate) may be included in response.
*
* #### Example
* ```typescript
*
* const roundNumber = 41000000;
*
* const blockResponse = await algodClient
* .block(roundNumber)
* .headerOnly(true)
* .do();
* ```
*
* @param headerOnly - the flag indicating whether exclusively return header in response
* @category query
*/
headerOnly(headerOnly: boolean) {
this.query['header-only'] = headerOnly;
return this;
}

// eslint-disable-next-line class-methods-use-this
prepare(body: Uint8Array) {
if (body && body.byteLength > 0) {
Expand Down
32 changes: 0 additions & 32 deletions src/client/v2/algod/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2098,38 +2098,6 @@ export class BlockHashResponse extends BaseModel {
}
}

/**
* Block header.
*/
export class BlockHeaderResponse extends BaseModel {
/**
* Block header data.
*/
public blockheader?: BlockHeader;

/**
* Creates a new `BlockHeaderResponse` object.
* @param blockheader - Block header data.
*/
constructor({ blockheader }: { blockheader?: BlockHeader }) {
super();
this.blockheader = blockheader;

this.attribute_map = {
blockheader: 'blockHeader',
};
}

// eslint-disable-next-line camelcase
static from_obj_for_encoding(data: Record<string, any>): BlockHeaderResponse {
/* eslint-disable dot-notation */
return new BlockHeaderResponse({
blockheader: data['blockHeader'],
});
/* eslint-enable dot-notation */
}
}

/**
* All logs emitted in the given round. Each app call, whether top-level or inner,
* that contains logs results in a separate AppCallLogs object. Therefore there may
Expand Down
16 changes: 16 additions & 0 deletions src/client/v2/indexer/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import LookupApplications from './lookupApplications';
import LookupApplicationLogs from './lookupApplicationLogs';
import LookupApplicationBoxByIDandName from './lookupApplicationBoxByIDandName';
import SearchAccounts from './searchAccounts';
import SearchForBlockHeaders from './searchForBlockHeaders';
import SearchForTransactions from './searchForTransactions';
import SearchForAssets from './searchForAssets';
import SearchForApplications from './searchForApplications';
Expand Down Expand Up @@ -345,6 +346,21 @@ export default class IndexerClient extends ServiceClient {
return new SearchForTransactions(this.c, this.intDecoding);
}

/**
* Returns information about indexed block headers.
*
* #### Example
* ```typescript
* const txns = await indexerClient.searchForBlockHeaders().do();
* ```
*
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
* @category GET
*/
searchForBlockHeaders() {
return new SearchForBlockHeaders(this.c, this.intDecoding);
}

/**
* Returns information about indexed assets.
*
Expand Down
212 changes: 212 additions & 0 deletions src/client/v2/indexer/searchForBlockHeaders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
import JSONRequest from '../jsonrequest';

/**
* Returns information about indexed block headers.
*
* #### Example
* ```typescript
* const bhs = await indexerClient.searchForBlockHeaders().do();
* ```
*
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
* @category GET
*/
export default class SearchForBlockHeaders extends JSONRequest {
/**
* @returns `/v2/block-headers`
*/
// eslint-disable-next-line class-methods-use-this
path() {
return '/v2/block-headers';
}

/**
* Accounts marked as absent in the block header's participation updates.
*
* #### Example
* ```typescript
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .absent([address1,address2])
* .do();
* ```
*
* @param absent - a comma separated list of addresses
* @category query
*/
absent(absent: string[]) {
this.query.absent = absent;
return this;
}

/**
* Include results after the given time.
*
* #### Example
* ```typescript
* const afterTime = "2022-10-21T00:00:11.55Z";
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .afterTime(afterTime)
* .do();
* ```
*
* @param after - rfc3339 string
* @category query
*/
afterTime(after: string) {
this.query['after-time'] = after;
return this;
}

/**
* Include results before the given time.
*
* #### Example
* ```typescript
* const beforeTime = "2022-02-02T20:20:22.02Z";
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .beforeTime(beforeTime)
* .do();
* ```
*
* @param before - rfc3339 string
* @category query
*/
beforeTime(before: string) {
this.query['before-time'] = before;
return this;
}

/**
* Accounts marked as expired in the block header's participation updates.
*
* #### Example
* ```typescript
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .expired([address1,address2])
* .do();
* ```
*
* @param expired - - a comma separated list of addresses
* @category query
*/
expired(expired: string[]) {
this.query.expired = expired;
return this;
}

/**
* Maximum number of results to return.
*
* #### Example
* ```typescript
* const maxResults = 25;
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .limit(maxResults)
* .do();
* ```
*
* @param limit
* @category query
*/
limit(limit: number) {
this.query.limit = limit;
return this;
}

/**
* Include results at or before the specified max-round.
*
* #### Example
* ```typescript
* const maxRound = 18309917;
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .maxRound(maxRound)
* .do();
* ```
*
* @param round
* @category query
*/
maxRound(round: number) {
this.query['max-round'] = round;
return this;
}

/**
* Include results at or after the specified min-round.
*
* #### Example
* ```typescript
* const minRound = 18309917;
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .minRound(minRound)
* .do();
* ```
*
* @param round
* @category query
*/
minRound(round: number) {
this.query['min-round'] = round;
return this;
}

/**
* The next page of results.
*
* #### Example
* ```typescript
* const maxResults = 25;
*
* const bh1 = await indexerClient
* .searchForBlockHeaders()
* .limit(maxResults)
* .do();
*
* const bh2 = await indexerClient
* .searchForBlockHeaders()
* .limit(maxResults)
* .nextToken(bh1["next-token"])
* .do();
* ```
*
* @param nextToken - provided by the previous results
* @category query
*/
nextToken(nextToken: string) {
this.query.next = nextToken;
return this;
}

/**
* Accounts marked as proposer in the block header's participation updates.
*
* #### Example
* ```typescript
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
* const bhs = await indexerClient
* .searchForBlockHeaders()
* .proposers([address1,address2])
* .do();
* ```
*
* @param proposers - a comma separated list of addresses
* @category query
*/
proposers(proposers: string[]) {
this.query.proposers = proposers;
return this;
}
}
Loading

0 comments on commit dcabb95

Please sign in to comment.