Skip to content

Commit

Permalink
Merge branch 'release/v1.20.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
egieseke committed Sep 6, 2022
2 parents ea72af2 + 4e61fa0 commit be3fdd3
Show file tree
Hide file tree
Showing 32 changed files with 901 additions and 1,218 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ temp
# Environment information
examples/.env

test-harness/
tests/cucumber/features/
tests/cucumber/browser/build
tests/browser/bundle.*
Expand Down
14 changes: 14 additions & 0 deletions .test-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Configs for testing repo download:
SDK_TESTING_URL="https://github.com/algorand/algorand-sdk-testing"
SDK_TESTING_BRANCH="master"
SDK_TESTING_HARNESS="test-harness"

VERBOSE_HARNESS=0

# WARNING: If set to 1, new features will be LOST when downloading the test harness.
# REGARDLESS: modified features are ALWAYS overwritten.
REMOVE_LOCAL_FEATURES=0

# WARNING: Be careful when turning on the next variable.
# In that case you'll need to provide all variables expected by `algorand-sdk-testing`'s `.env`
OVERWRITE_TESTING_ENVIRONMENT=0
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# v1.20.0

## What's Changed

### Bugfixes

- Bug-Fix: Pass verbosity to the harness and sandbox by @tzaffi in https://github.com/algorand/js-algorand-sdk/pull/630

### Enhancements

- Enhancement: Use sandbox for SDK Testing and remove Indexer v1 steps by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/623
- Tidy: Ignore algorand-sdk-testing test-harness dir by @michaeldiamant in https://github.com/algorand/js-algorand-sdk/pull/634
- Enhancement: Deprecating use of langspec by @ahangsu in https://github.com/algorand/js-algorand-sdk/pull/632
- enhancement: Initial stateproofs support by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/629

**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v1.19.1...v1.20.0

# v1.20.0-beta.1

## What's Changed

### Bugfixes

- Bug-Fix: Pass verbosity to the harness and sandbox by @tzaffi in https://github.com/algorand/js-algorand-sdk/pull/630

### Enhancements

- Enhancement: Use sandbox for SDK Testing and remove Indexer v1 steps by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/623
- Tidy: Ignore algorand-sdk-testing test-harness dir by @michaeldiamant in https://github.com/algorand/js-algorand-sdk/pull/634
- Enhancement: Deprecating use of langspec by @ahangsu in https://github.com/algorand/js-algorand-sdk/pull/632
- enhancement: Initial stateproofs support by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/629

## New Contributors

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

**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v1.19.1...v1.20.0-beta.1

# v1.19.1

### Enhancements
Expand Down
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
UNIT_TAGS := "$(subst :, or ,$(shell awk '{print $2}' tests/cucumber/unit.tags | paste -s -d: -))"
INTEGRATIONS_TAGS := "$(subst :, or ,$(shell awk '{print $2}' tests/cucumber/integration.tags | paste -s -d: -))"

unit:
node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.abijson.byname or @unit.atomic_transaction_composer or @unit.responses.unlimited_assets or @unit.indexer.ledger_refactoring or @unit.algod.ledger_refactoring or @unit.dryrun.trace.application or @unit.sourcemap" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js
node_modules/.bin/cucumber-js --tags $(UNIT_TAGS) tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js

integration:
node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @indexer or @rekey_v1 or @send.keyregtxn or @dryrun or @compile or @applications or @indexer.applications or @applications.verified or @indexer.231 or @abi or @c2c or @compile.sourcemap" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js
node_modules/.bin/cucumber-js --tags $(INTEGRATIONS_TAGS) tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js

# The following assumes that all cucumber steps are defined in `./tests/cucumber/steps/steps.js` and begin past line 135 of that file.
# Please note any deviations of the above before presuming correctness.
display-all-js-steps:
tail -n +135 tests/cucumber/steps/steps.js | grep -v '^ *//' | awk "/(Given|Then|When)/,/',/" | grep -E "\'.+\'" | sed "s/^[^']*'\([^']*\)'.*/\1/g"

harness:
./test-harness.sh

docker-build:
docker build -t js-sdk-testing -f tests/cucumber/docker/Dockerfile $(CURDIR) --build-arg TEST_BROWSER --build-arg CI=true

docker-run:
docker ps -a
docker run -it --network host js-sdk-testing:latest

docker-test:
./tests/cucumber/docker/run_docker.sh
docker-test: harness docker-build docker-run

format:
npm run format
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Include a minified browser bundle directly in your HTML like so:

```html
<script
src="https://unpkg.com/algosdk@v1.19.1/dist/browser/algosdk.min.js"
integrity="sha384-vpY7inPLTrCOYSwaOYlQbFwoSY/t3lFMVjAh/iXN+86fNAQ39DeQjlX87aczChqD"
src="https://unpkg.com/algosdk@v1.20.0/dist/browser/algosdk.min.js"
integrity="sha384-MBUb3pc2VI86j87sLfTwm1kEs2PUDCOFXnXdgspn0lWSJOxr1gu4mZL6L7VE1ITH"
crossorigin="anonymous"
></script>
```
Expand All @@ -32,8 +32,8 @@ or

```html
<script
src="https://cdn.jsdelivr.net/npm/algosdk@v1.19.1/dist/browser/algosdk.min.js"
integrity="sha384-vpY7inPLTrCOYSwaOYlQbFwoSY/t3lFMVjAh/iXN+86fNAQ39DeQjlX87aczChqD"
src="https://cdn.jsdelivr.net/npm/algosdk@v1.20.0/dist/browser/algosdk.min.js"
integrity="sha384-MBUb3pc2VI86j87sLfTwm1kEs2PUDCOFXnXdgspn0lWSJOxr1gu4mZL6L7VE1ITH"
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": "1.19.1",
"version": "1.20.0",
"description": "The official JavaScript SDK for Algorand",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
44 changes: 39 additions & 5 deletions src/client/v2/algod/algod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ import AccountApplicationInformation from './accountApplicationInformation';
import Block from './block';
import Compile from './compile';
import Dryrun from './dryrun';
import Genesis from './genesis';
import GetAssetByID from './getAssetByID';
import GetApplicationByID from './getApplicationByID';
import HealthCheck from './healthCheck';
import PendingTransactionInformation from './pendingTransactionInformation';
import PendingTransactions from './pendingTransactions';
import PendingTransactionsByAddress from './pendingTransactionsByAddress';
import GetTransactionProof from './getTransactionProof';
import SendRawTransaction from './sendRawTransaction';
import Status from './status';
import StatusAfterBlock from './statusAfterBlock';
import SuggestedParams from './suggestedParams';
import Supply from './supply';
import Versions from './versions';
import Genesis from './genesis';
import Proof from './proof';
import { BaseHTTPClient } from '../../baseHTTPClient';
import {
AlgodTokenHeader,
CustomTokenHeader,
} from '../../urlTokenBaseHTTPClient';
import LightBlockHeaderProof from './lightBlockHeaderProof';
import StateProof from './stateproof';

/**
* Algod client connects an application to the Algorand blockchain. The algod client requires a valid algod REST endpoint IP address and algod token from an Algorand node that is connected to the network you plan to interact with.
Expand Down Expand Up @@ -451,15 +453,47 @@ export default class AlgodClient extends ServiceClient {
* ```typescript
* const round = 18038133;
* const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
* const proof = await algodClient.getProof(round, txId).do();
* const proof = await algodClient.getTransactionProof(round, txId).do();
* ```
*
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksroundtransactionstxidproof)
* @param round - The round in which the transaction appears.
* @param txID - The transaction ID for which to generate a proof.
* @category GET
*/
getProof(round: number, txID: string) {
return new Proof(this.c, this.intDecoding, round, txID);
getTransactionProof(round: number, txID: string) {
return new GetTransactionProof(this.c, this.intDecoding, round, txID);
}

/**
* Gets a proof for a given light block header inside a state proof commitment.
*
* #### Example
* ```typescript
* const round = 11111111;
* const lightBlockHeaderProof = await algodClient.getLightBlockHeaderProof(round).do();
* ```
*
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2#get-v2blocksroundlightheaderproof)
* @param round
*/
getLightBlockHeaderProof(round: number) {
return new LightBlockHeaderProof(this.c, this.intDecoding, round);
}

/**
* Gets a state proof that covers a given round.
*
* #### Example
* ```typescript
* const round = 11111111;
* const stateProof = await algodClient.getStateProof(round).do();
* ```
*
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2#get-v2stateproofsround)
* @param round
*/
getStateProof(round: number) {
return new StateProof(this.c, this.intDecoding, round);
}
}
43 changes: 43 additions & 0 deletions src/client/v2/algod/getTransactionProof.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import JSONRequest from '../jsonrequest';
import HTTPClient from '../../client';
import IntDecoding from '../../../types/intDecoding';

export default class GetTransactionProof extends JSONRequest {
constructor(
c: HTTPClient,
intDecoding: IntDecoding,
private round: number,
private txID: string
) {
super(c, intDecoding);

this.round = round;
this.txID = txID;
}

path() {
return `/v2/blocks/${this.round}/transactions/${this.txID}/proof`;
}

/**
* Exclude assets and application data from results
* The type of hash function used to create the proof, must be one of: "sha512_256", "sha256"
*
* #### Example
* ```typescript
* const hashType = "sha256";
* const round = 123456;
* const txId = "abc123;
* const txProof = await algodClient.getTransactionProof(round, txId)
* .hashType(hashType)
* .do();
* ```
*
* @param hashType
* @category query
*/
hashType(hashType: string) {
this.query.hashtype = hashType;
return this;
}
}
15 changes: 15 additions & 0 deletions src/client/v2/algod/lightBlockHeaderProof.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import JSONRequest from '../jsonrequest';
import HTTPClient from '../../client';
import IntDecoding from '../../../types/intDecoding';

export default class LightBlockHeaderProof extends JSONRequest {
constructor(c: HTTPClient, intDecoding: IntDecoding, private round: number) {
super(c, intDecoding);

this.round = round;
}

path() {
return `/v2/blocks/${this.round}/lightheader/proof`;
}
}
Loading

0 comments on commit be3fdd3

Please sign in to comment.