Skip to content

Commit

Permalink
Merge branch 'release/v2.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Algo-devops-service committed Jun 5, 2024
2 parents e947e33 + 3976e18 commit 8aaa432
Show file tree
Hide file tree
Showing 14 changed files with 1,494 additions and 192 deletions.
16 changes: 13 additions & 3 deletions .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/[email protected].3
browser-tools: circleci/[email protected].8
gh-pages: sugarshin/[email protected]

parameters:
Expand Down Expand Up @@ -77,6 +77,7 @@ jobs:
- checkout
- install_dependencies:
sudo: 'sudo'
browser: << parameters.browser >>
- run:
name: Install docker
command: |
Expand All @@ -89,7 +90,13 @@ jobs:
$(lsb_release -cs) stable" | $SUDO tee /etc/apt/sources.list.d/docker.list > /dev/null
$SUDO apt update
$SUDO apt -y install docker-ce docker-ce-cli containerd.io
- browser-tools/install-browser-tools
- when:
condition:
not:
equal: ['node', << parameters.browser >>]
steps:
browser-tools/install-browser-tools:
replace-existing-chrome: true
- run:
name: << parameters.browser >> test
command: |
Expand Down Expand Up @@ -120,6 +127,9 @@ commands:
sudo:
type: string
default: ''
browser:
type: string
default: ''
steps:
- run:
name: Install Dependencies
Expand All @@ -133,4 +143,4 @@ commands:
command: |
set -e
npm ci
npm install chromedriver@latest
if [ "<< parameters.browser >>" == "chrome" ]; then npm install chromedriver@latest; fi
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# v2.8.0

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

## What's Changed

### Bugfixes

- Fix: Update chromedriver deps, make install conditional in CI, and fix indexer sync error in cucumber tests by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/859
- fix: allow either boolean value for nonParticipation offline keyregs by @joe-p in https://github.com/algorand/js-algorand-sdk/pull/866

### Enhancements

- API: Regenerate algod and indexer models by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/845
- Spec: Regenerate code from specification file f633b019 by @gmalouf in https://github.com/algorand/js-algorand-sdk/pull/870

## New Contributors

- @gmalouf made their first contribution in https://github.com/algorand/js-algorand-sdk/pull/870

**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v2.7.0...v2.8.0

# v2.7.0

<!-- Release notes generated using configuration in .github/release.yml at release/v2.7.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.7.0/dist/browser/algosdk.min.js"
integrity="sha384-OP8U0zDUgTdYdeyxnrhicwju6SuPxm2tx4WaTYDeP5JiMS/OyifldTK5Y3vzPK9K"
src="https://unpkg.com/algosdk@v2.8.0/dist/browser/algosdk.min.js"
integrity="sha384-Yf0K01l2B3xzeVyU5y0g9/1cE753a/mHjarJ3l73s43RWU4t3ZCaW72qDKQXfr78"
crossorigin="anonymous"
></script>
```
Expand All @@ -30,8 +30,8 @@ or

```html
<script
src="https://cdn.jsdelivr.net/npm/algosdk@v2.7.0/dist/browser/algosdk.min.js"
integrity="sha384-OP8U0zDUgTdYdeyxnrhicwju6SuPxm2tx4WaTYDeP5JiMS/OyifldTK5Y3vzPK9K"
src="https://cdn.jsdelivr.net/npm/algosdk@v2.8.0/dist/browser/algosdk.min.js"
integrity="sha384-Yf0K01l2B3xzeVyU5y0g9/1cE753a/mHjarJ3l73s43RWU4t3ZCaW72qDKQXfr78"
crossorigin="anonymous"
></script>
```
Expand Down
8 changes: 5 additions & 3 deletions examples/asa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import {
getLocalAlgodClient,
getLocalAccounts,
getLocalIndexerClient,
indexerWaitForRound,
} from './utils';

async function main() {
const algodClient = getLocalAlgodClient();
const indexerClient = getLocalIndexerClient();
const accounts = await getLocalAccounts();
const creator = accounts[0];

Expand Down Expand Up @@ -49,11 +51,11 @@ async function main() {
console.log(`Asset Params: ${assetInfo.params}`);
// example: ASSET_INFO

await new Promise((f) => setTimeout(f, 45000)); // sleep to ensure indexer is caught up
// ensure indexer is caught up
await indexerWaitForRound(indexerClient, result['confirmed-round'], 30);

// example: INDEXER_LOOKUP_ASSET
const indexer = getLocalIndexerClient();
const indexerAssetInfo = await indexer.lookupAssetByID(assetIndex).do();
const indexerAssetInfo = await indexerClient.lookupAssetByID(assetIndex).do();
console.log('Indexer Asset Info:', indexerAssetInfo);
// example: INDEXER_LOOKUP_ASSET

Expand Down
10 changes: 8 additions & 2 deletions examples/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getLocalIndexerClient,
getLocalAccounts,
getLocalAlgodClient,
indexerWaitForRound,
} from './utils';
import algosdk from '../src';

Expand Down Expand Up @@ -73,9 +74,14 @@ async function main() {
});

await client.sendRawTransaction(txn.signTxn(sender.privateKey)).do();
await algosdk.waitForConfirmation(client, txn.txID().toString(), 3);
const result = await algosdk.waitForConfirmation(
client,
txn.txID().toString(),
3
);

await new Promise((f) => setTimeout(f, 1000)); // sleep to ensure indexer is caught up
// ensure indexer is caught up
await indexerWaitForRound(indexerClient, result['confirmed-round'], 30);

// example: INDEXER_PREFIX_SEARCH
const txnsWithNotePrefix = await indexerClient
Expand Down
1 change: 0 additions & 1 deletion examples/participation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ async function main() {
{
from: addr,
suggestedParams,
nonParticipation: true,
}
);
console.log(offlineKeyReg.get_obj_for_encoding());
Expand Down
35 changes: 35 additions & 0 deletions examples/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,41 @@ export function getLocalAlgodClient() {
return algodClient;
}

function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}

export async function indexerWaitForRound(
client: algosdk.Indexer,
round: number | bigint,
maxAttempts: number
) {
let indexerRound = 0;
let attempts = 0;

for (;;) {
// eslint-disable-next-line no-await-in-loop
const status = await client.makeHealthCheck().do();
indexerRound = status.round;

if (indexerRound >= round) {
// Success
break;
}

// eslint-disable-next-line no-await-in-loop
await sleep(1000); // Sleep 1 second and check again
attempts += 1;

if (attempts > maxAttempts) {
// Failsafe to prevent infinite loop
throw new Error(
`Timeout waiting for indexer to catch up to round ${round}. It is currently on ${indexerRound}`
);
}
}
}

export interface SandboxAccount {
addr: string;
privateKey: Uint8Array;
Expand Down
Loading

0 comments on commit 8aaa432

Please sign in to comment.