Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Merge develop to feature/box-storage #640

Merged
merged 15 commits into from
Sep 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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="feature/box-storage"
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.19.1

### Enhancements

- API: Support attaching signatures to standard and multisig transactions by @jdtzmn in https://github.com/algorand/js-algorand-sdk/pull/595
- AVM: Consolidate TEAL and AVM versions by @michaeldiamant in https://github.com/algorand/js-algorand-sdk/pull/609
- Testing: Use Dev mode network for cucumber tests by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/614

# v1.19.0

## What's Changed
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.applications.boxes 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 @applications.boxes 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/[email protected].0/dist/browser/algosdk.min.js"
integrity="sha384-5cebCuqDx6A5Y1HeScIKIcSdqsub2M3wwkqTZyu45M8zN/+do8cgxcHDJjkaVTNb"
src="https://unpkg.com/[email protected].1/dist/browser/algosdk.min.js"
integrity="sha384-vpY7inPLTrCOYSwaOYlQbFwoSY/t3lFMVjAh/iXN+86fNAQ39DeQjlX87aczChqD"
crossorigin="anonymous"
></script>
```
Expand All @@ -32,8 +32,8 @@ or

```html
<script
src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/browser/algosdk.min.js"
integrity="sha384-5cebCuqDx6A5Y1HeScIKIcSdqsub2M3wwkqTZyu45M8zN/+do8cgxcHDJjkaVTNb"
src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/browser/algosdk.min.js"
integrity="sha384-vpY7inPLTrCOYSwaOYlQbFwoSY/t3lFMVjAh/iXN+86fNAQ39DeQjlX87aczChqD"
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.0",
"version": "1.19.1",
"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,6 +6,7 @@ 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 GetApplicationBoxByName from './getApplicationBoxByName';
Expand All @@ -14,19 +15,20 @@ 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 @@ -488,15 +490,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