Skip to content

Commit

Permalink
Merge pull request #238 from algorand/release/1.8.0
Browse files Browse the repository at this point in the history
v1.8.0
  • Loading branch information
jasonpaulos authored Nov 5, 2020
2 parents 6f3d3a7 + 0fbb991 commit c2fafd0
Show file tree
Hide file tree
Showing 50 changed files with 7,196 additions and 4,498 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ node_modules/
# Testing files
*.feature
temp

tests/cucumber/features/
tests/cucumber/browser/build
tests/browser/bundle.js
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ script:
- set -e
- npm test
- make docker-test

jobs:
include:
- stage: Testing
name: Node test
- name: Chrome test
env: TEST_BROWSER=chrome
addons:
chrome: stable
- name: Firefox test
env: TEST_BROWSER=firefox
addons:
firefox: latest
26 changes: 23 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# 1.8.0
## Added
- Add `encodeAddress` and `decodeAddress` to convert between the binary and text form of Algorand
addresses ([#216](https://github.com/algorand/js-algorand-sdk/pull/216)).
- Add `encodeUnsignedTransaction`, `decodeUnsignedTransaction`, `decodeSignedTransaction` to convert
between binary transactions and transaction objects ([#218](https://github.com/algorand/js-algorand-sdk/pull/218)).
- Add optional `rekeyTo` parameter to transaction builder functions ([#221](https://github.com/algorand/js-algorand-sdk/pull/221)).
- Support testing on Chrome and Firefox in addition to Node ([#228](https://github.com/algorand/js-algorand-sdk/pull/228) and [#235](https://github.com/algorand/js-algorand-sdk/pull/235)).
## Fixed
- Update [keccak](https://www.npmjs.com/package/keccak) to 3.0.1, which fixes a build error that
would occur every time the package was installed ([#151](https://github.com/algorand/js-algorand-sdk/pull/151)).
- Allow `assignGroupID` to accept raw transaction objects and instances of the `Transaction` class
([#236](https://github.com/algorand/js-algorand-sdk/pull/236)).
- Allow `signTransaction` to accept instances of the `Transaction` class ([#233](https://github.com/algorand/js-algorand-sdk/pull/233)).
- Improve type checking and documentation ([#233](https://github.com/algorand/js-algorand-sdk/pull/233) and [#231](https://github.com/algorand/js-algorand-sdk/pull/231)).
## Changed
- Switch to using [algo-msgpack-with-bigint](https://www.npmjs.com/package/algo-msgpack-with-bigint),
which is a fork of [@msgpack/msgpack](https://www.npmjs.com/package/@msgpack/msgpack) with support
for encoding and decoding BigInts ([#229](https://github.com/algorand/js-algorand-sdk/pull/229)).
- Update dependencies ([#237](https://github.com/algorand/js-algorand-sdk/pull/237)).
# 1.7.2
## Fixed
- Fixed msgpack endpoints returning undefined in browsers (#210 and #215).
- Removed use of class properties (#213).
- Fixed msgpack endpoints returning undefined in browsers ([#210](https://github.com/algorand/js-algorand-sdk/pull/210) and [#215](https://github.com/algorand/js-algorand-sdk/pull/215)).
- Removed use of class properties ([#213](https://github.com/algorand/js-algorand-sdk/pull/213)).
## Changed
- Remove unneeded dependency js-yaml and changed mock-http-server to a dev dependency (#214 and #212).
- Remove unneeded dependency js-yaml and changed mock-http-server to a dev dependency ([#214](https://github.com/algorand/js-algorand-sdk/pull/214) and [#212](https://github.com/algorand/js-algorand-sdk/pull/212)).
# 1.7.1
## Fixed
- Fixed set Accept on GET calls
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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" tests/cucumber/features --require tests/cucumber/steps/*
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" tests/cucumber/features --require tests/cucumber/steps/index.js
integration:
node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @template or @indexer or @rekey or @dryrun or @compile or @applications or @indexer.applications or @applications.verified" tests/cucumber/features --require tests/cucumber/steps/*
node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @template or @indexer or @rekey or @dryrun or @compile or @applications or @indexer.applications or @applications.verified" tests/cucumber/features --require tests/cucumber/steps/index.js

docker-test:
./tests/cucumber/docker/run_docker.sh
65 changes: 62 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# js-algorand-sdk
[![Build Status](https://travis-ci.com/algorand/js-algorand-sdk.svg?token=25XP72ADqbCQJ3TJVC9S&branch=master)](https://travis-ci.com/algorand/js-algorand-sdk) [![npm version](https://badge.fury.io/js/algosdk.svg)](https://badge.fury.io/js/algosdk)
[![Build Status](https://travis-ci.com/algorand/js-algorand-sdk.svg?branch=master)](https://travis-ci.com/algorand/js-algorand-sdk) [![npm version](https://badge.fury.io/js/algosdk.svg)](https://badge.fury.io/js/algosdk)

AlgoSDK is a javascript library for communicating with the Algorand network for modern browsers and node.js.

Expand All @@ -19,7 +19,44 @@ Include this line in your HTML.
## SDK Development
Run tests with `make docker-test`
### Building
To build a new version of the library for browsers, run:
```bash
npm build
```
### Testing
We have two test suites: mocha tests in this repo, and the Algorand SDK test suite from https://github.com/algorand/algorand-sdk-testing.
#### Node
To run the mocha tests in Node, run:
```bash
npm test
```
To run the SDK test suite in Node, run:
```bash
make docker-test
```
#### Browsers
The test suites can also run in browsers. To do so, set the environment variable `TEST_BROWSER` to
one of our supported browsers. Currently we support testing in `chrome` and `firefox`. When
`TEST_BROWSER` is set, the mocha and SDK test suites will run in that browser.
For example, to run mocha tests in Chrome:
```bash
TEST_BROWSER=chrome npm test
```
And to run SDK tests in Firefox:
```bash
TEST_BROWSER=firefox make docker-test
```
## Quick Start
```javascript
Expand Down Expand Up @@ -57,7 +94,7 @@ Example result
"gorilla fortune learn marble essay uphold defense hover index effort ice atom figure will improve mom indoor mansion people elder hill material donkey abandon gown"
```
#### Mnemonic to secret sey
#### Mnemonic to secret key
```javascript
var secret_key = algosdk.mnemonicToSecretKey(mnemonic);
```
Expand All @@ -75,6 +112,28 @@ Example result
true
```
#### Encode/decode addresses
These two functions let you convert addresses between their string and binary representations.
```javascript
var decoded = algosdk.decodeAddress("IB3NJALXLDX5JLYCD4TMTMLVCKDRZNS4JONHMIWD6XM7DSKYR7MWHI6I7U");
var encoded = algosdk.encodeAddress(decoded.publicKey);
console.log('Decoded:', decoded);
console.log('Encoded:', encoded);
```
Result
```text
Decoded: {
publicKey: Uint8Array(32) [
64, 118, 212, 129, 119, 88, 239, 212,
175, 2, 31, 38, 201, 177, 117, 18,
135, 28, 182, 92, 75, 154, 118, 34,
195, 245, 217, 241, 201, 88, 143, 217
],
checksum: Uint8Array(4) [ 99, 163, 200, 253 ]
}
Encoded: IB3NJALXLDX5JLYCD4TMTMLVCKDRZNS4JONHMIWD6XM7DSKYR7MWHI6I7U
```
#### Sign a transaction
In order to create and sign a transaction, create first an object with the relevant properties.
There is no need to specify the `from` address, it is computed directly from the secretKey.
Expand Down
2 changes: 1 addition & 1 deletion dist/algosdk.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit c2fafd0

Please sign in to comment.