Skip to content

Commit 7759197

Browse files
Merge branch 'release/v3.0.0'
2 parents 4b0eabc + 6973ff5 commit 7759197

File tree

187 files changed

+30331
-22738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+30331
-22738
lines changed

.eslintrc.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ module.exports = {
1616
},
1717
plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
1818
rules: {
19-
'no-restricted-globals': [
20-
'error',
21-
{
22-
// This is to ensure that we use the 'buffer' package in the browser. In Node it doesn't
23-
// make a difference.
24-
name: 'Buffer',
25-
message:
26-
"Explictly import Buffer with `import { Buffer } from 'buffer'`",
27-
},
28-
],
2919
'no-constant-condition': ['error', { checkLoops: false }],
3020
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
3121
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
@@ -68,4 +58,13 @@ module.exports = {
6858
'tests/cucumber/browser/build/',
6959
'tests/browser/bundle.*',
7060
],
61+
settings: {
62+
'import/resolver': {
63+
typescript: {
64+
extensionAlias: {
65+
'.js': ['.ts', '.d.ts', '.js'],
66+
},
67+
},
68+
},
69+
},
7170
};

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/client/v2/algod/models/types.ts linguist-generated=true
2+
src/client/v2/indexer/models/types.ts linguist-generated=true

.github/workflows/create-release-pr.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,15 @@ jobs:
8181
id: build-changelog
8282
env:
8383
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
84+
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
8485
run: |
8586
CHANGELOG=$(curl -L \
8687
-X POST \
8788
-H "Accept: application/vnd.github+json" \
8889
-H "Authorization: Bearer ${{ github.token }}"\
8990
-H "X-GitHub-Api-Version: 2022-11-28" \
9091
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
91-
-d '{"tag_name":"${{ env.RELEASE_VERSION }}","target_commitish":"${{ env.RELEASE_BRANCH }}","previous_tag_name":"${{ env.PREVIOUS_VERSION }}","configuration_file_path":".github/release.yml"}' \
92+
-d '{"tag_name":"${{ env.RELEASE_TAG }}","target_commitish":"${{ env.RELEASE_BRANCH }}","previous_tag_name":"${{ env.PREVIOUS_VERSION }}","configuration_file_path":".github/release.yml"}' \
9293
| jq -r '.body')
9394
9495
# The EOF steps are used to save multiline string in github:
@@ -115,7 +116,7 @@ jobs:
115116
env:
116117
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
117118
run: |
118-
rm -rf dist node_modules
119+
rm -rf node_modules
119120
npm ci
120121
npm run build
121122
NEW_HASH=$(cat dist/browser/algosdk.min.js | openssl dgst -sha384 -binary | openssl base64 -A)

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
dist/*
2+
!dist/esm
3+
dist/esm/*
4+
!dist/esm/package.json
5+
16
.DS_Store
27

38
.idea/
@@ -6,6 +11,7 @@
611
.vscode/*
712
!.vscode/settings.json
813
!.vscode/extensions.json
14+
!.vscode/launch.json
915

1016
# npm
1117
node_modules/
@@ -23,7 +29,6 @@ tests/cucumber/browser/build
2329
tests/browser/bundle.*
2430

2531
# Builds
26-
dist/
2732
docs/
2833
built/
2934

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"singleQuote": true
2+
"singleQuote": true,
3+
"trailingComma": "es5"
34
}

.vscode/launch.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Debug unit tests",
9+
"type": "node",
10+
"request": "launch",
11+
"program": "${workspaceRoot}/tests/mocha.js",
12+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/tsx",
13+
"console": "integratedTerminal",
14+
"internalConsoleOptions": "neverOpen",
15+
"env": {
16+
"NODE_ENV": "testing",
17+
"MOCHA_TIMEOUT": "0"
18+
},
19+
"skipFiles": [
20+
// Node.js internal core modules
21+
"<node_internals>/**",
22+
// Ignore all dependencies (optional)
23+
"${workspaceFolder}/node_modules/**"
24+
]
25+
}
26+
]
27+
}

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
# v3.0.0
2+
3+
<!-- Release notes generated using configuration in .github/release.yml at 3.0.0 **WITH MANUAL EDITING AFTERWARD** -->
4+
5+
## What's Changed
6+
7+
> ⚠️ **WARNING:** This release is a new major version with breaking changes from the v2.X.X series. For help migrating from v2 releases, see the file `v2_TO_v3_MIGRATION_GUIDE.md`.
8+
9+
### v2 End of Life
10+
11+
With the release of v3 of this SDK, v2 is now in maintenance mode. No new features will be added to v2, and only security fixes or critical errors will be addressed. At the end of March 2025, no further updates will be made to the v2 package.
12+
13+
### Breaking Changes
14+
15+
- Convert algod responses to typed by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/776
16+
- Align transaction fields to transaction reference spec by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/804
17+
- TEAL Source Map: Improve SourceMap and support columns by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/834
18+
- Remove `IntDecoding` as a REST option & support native bigint types in models by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/852
19+
- Refactor `Transaction` class by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/854
20+
- Improve object encoding and decoding by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/862
21+
- Correctly model blocks by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/875
22+
- Fix stateproof txn representation by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/876
23+
- Typed indexer responses by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/857
24+
- Support special case raw binary strings by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/878
25+
- REST API TEAL bytes fix by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/881
26+
- Fix remaining REST untyped responses by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/882
27+
28+
### Enhancements
29+
30+
- Remove buffer usage in favor or Uint8Array and Dataview by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/800
31+
- Remove `Buffer` Usage by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/801
32+
- Add address bytes length check in encodeAddress by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/809
33+
- Native esm bundle by @PhearZero in https://github.com/algorand/js-algorand-sdk/pull/836
34+
- Add ability to pass through fetch options by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/883
35+
- REST API: Allow bigints for client args by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/893
36+
37+
### Bugfixes
38+
39+
- Fix: Don't delete `dist` folder when creating release PR by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/890
40+
- Release PR Generation: Use prerelease tag in changelog generation by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/892
41+
42+
### Other
43+
44+
- Type and formatting changes by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/853
45+
- 3.0.0: Sync changes to develop by @jasonpaulos in https://github.com/algorand/js-algorand-sdk/pull/884
46+
47+
**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v2.9.0...v3.0.0
48+
149
# v2.9.0
250

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

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ UNIT_TAGS := "$(subst :, or ,$(shell awk '{print $2}' tests/cucumber/unit.tags
22
INTEGRATIONS_TAGS := "$(subst :, or ,$(shell awk '{print $2}' tests/cucumber/integration.tags | paste -s -d: -))"
33

44
unit:
5-
node_modules/.bin/cucumber-js --tags $(UNIT_TAGS) tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js
6-
5+
node_modules/.bin/cucumber-js --tags $(UNIT_TAGS) tests/cucumber/features --require-module tsx/cjs --require tests/cucumber/steps/index.js
6+
77
integration:
8-
node_modules/.bin/cucumber-js --tags $(INTEGRATIONS_TAGS) tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js
8+
node_modules/.bin/cucumber-js --tags $(INTEGRATIONS_TAGS) tests/cucumber/features --require-module tsx/cjs --require tests/cucumber/steps/index.js
99

1010
# The following assumes that all cucumber steps are defined in `./tests/cucumber/steps/steps.js` and begin past line 135 of that file.
1111
# Please note any deviations of the above before presuming correctness.

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
AlgoSDK is the official JavaScript library for communicating with the Algorand network. It's designed for modern browsers and Node.js.
66

7+
## New Major Version 3
8+
9+
Existing codebases using v2 of this library will be incompatible with v3. The v3 release introduces breaking changes to the API, and a migration guide is available [here](v2_TO_v3_MIGRATION_GUIDE.md).
10+
711
## Installation
812

913
### [Node.js](https://nodejs.org/en/download/)
@@ -20,8 +24,8 @@ Include a minified browser bundle directly in your HTML like so:
2024

2125
```html
2226
<script
23-
src="https://unpkg.com/algosdk@v2.9.0/dist/browser/algosdk.min.js"
24-
integrity="sha384-R84o0hH3cBFIzv9uqyKcDNfDi/6jgn1MrS1/tOMDWxeh8hWfOLuRoMy0LekUm2KL"
27+
src="https://unpkg.com/algosdk@v3.0.0/dist/browser/algosdk.min.js"
28+
integrity="sha384-EdTN548g1VApyPivwjhxg5HpPLY6nzw58f8nbvmc89M8fO8eBor+KHzf17y1SWl3"
2529
crossorigin="anonymous"
2630
></script>
2731
```
@@ -30,8 +34,8 @@ or
3034

3135
```html
3236
<script
33-
src="https://cdn.jsdelivr.net/npm/algosdk@v2.9.0/dist/browser/algosdk.min.js"
34-
integrity="sha384-R84o0hH3cBFIzv9uqyKcDNfDi/6jgn1MrS1/tOMDWxeh8hWfOLuRoMy0LekUm2KL"
37+
src="https://cdn.jsdelivr.net/npm/algosdk@v3.0.0/dist/browser/algosdk.min.js"
38+
integrity="sha384-EdTN548g1VApyPivwjhxg5HpPLY6nzw58f8nbvmc89M8fO8eBor+KHzf17y1SWl3"
3539
crossorigin="anonymous"
3640
></script>
3741
```

dist/esm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"type": "module"}

examples/accounts.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function main() {
1919
const mnemonic =
2020
'creek phrase island true then hope employ veteran rapid hurdle above liberty tissue connect alcohol timber idle ten frog bulb embody crunch taxi abstract month';
2121
const recoveredAccount = algosdk.mnemonicToSecretKey(mnemonic);
22-
console.log('Recovered mnemonic account: ', recoveredAccount.addr);
22+
console.log('Recovered mnemonic account: ', recoveredAccount.addr.toString());
2323
// example: ACCOUNT_RECOVER_MNEMONIC
2424

2525
const funder = accounts[0];
@@ -31,30 +31,30 @@ async function main() {
3131
signerAccounts.push(algosdk.generateAccount());
3232

3333
// multiSigParams is used when creating the address and when signing transactions
34-
const multiSigParams = {
34+
const multiSigParams: algosdk.MultisigMetadata = {
3535
version: 1,
3636
threshold: 2,
3737
addrs: signerAccounts.map((a) => a.addr),
3838
};
3939
const multisigAddr = algosdk.multisigAddress(multiSigParams);
4040

41-
console.log('Created MultiSig Address: ', multisigAddr);
41+
console.log('Created MultiSig Address: ', multisigAddr.toString());
4242
// example: MULTISIG_CREATE
4343

4444
const fundMsigTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
45-
from: funder.addr,
46-
to: multisigAddr,
45+
sender: funder.addr,
46+
receiver: multisigAddr,
4747
amount: 1_000_000,
4848
suggestedParams,
4949
});
5050

5151
await client.sendRawTransaction(fundMsigTxn.signTxn(funder.privateKey)).do();
52-
await algosdk.waitForConfirmation(client, fundMsigTxn.txID().toString(), 3);
52+
await algosdk.waitForConfirmation(client, fundMsigTxn.txID(), 3);
5353

5454
// example: MULTISIG_SIGN
5555
const msigTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
56-
from: multisigAddr,
57-
to: funder.addr,
56+
sender: multisigAddr,
57+
receiver: funder.addr,
5858
amount: 100,
5959
suggestedParams,
6060
});
@@ -74,46 +74,50 @@ async function main() {
7474
).blob;
7575

7676
await client.sendRawTransaction(msigWithSecondSig).do();
77-
await algosdk.waitForConfirmation(client, msigTxn.txID().toString(), 3);
77+
await algosdk.waitForConfirmation(client, msigTxn.txID(), 3);
7878
// example: MULTISIG_SIGN
7979

8080
// example: ACCOUNT_GENERATE
8181
const generatedAccount = algosdk.generateAccount();
8282
const passphrase = algosdk.secretKeyToMnemonic(generatedAccount.sk);
83-
console.log(`My address: ${generatedAccount.addr}`);
83+
console.log(`My address: ${generatedAccount.addr.toString()}`);
8484
console.log(`My passphrase: ${passphrase}`);
8585
// example: ACCOUNT_GENERATE
8686

8787
// example: ACCOUNT_REKEY
8888
// rekey the original account to the new signer via a payment transaction
8989
// Note any transaction type can be used to rekey an account
9090
const rekeyTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
91-
from: acct1.addr,
92-
to: acct1.addr,
91+
sender: acct1.addr,
92+
receiver: acct1.addr,
9393
amount: 0,
9494
suggestedParams,
9595
rekeyTo: acct2.addr, // set the rekeyTo field to the new signer
9696
});
9797

9898
await client.sendRawTransaction(rekeyTxn.signTxn(acct1.privateKey)).do();
99-
await algosdk.waitForConfirmation(client, rekeyTxn.txID().toString(), 3);
99+
await algosdk.waitForConfirmation(client, rekeyTxn.txID(), 3);
100100

101101
const acctInfo = await client.accountInformation(acct1.addr).do();
102102

103-
console.log(`Account Info: ${acctInfo} Auth Addr: ${acctInfo['auth-addr']}`);
103+
console.log(
104+
`Account Info: ${algosdk.stringifyJSON(acctInfo)} Auth Addr: ${
105+
acctInfo['auth-addr']
106+
}`
107+
);
104108
// example: ACCOUNT_REKEY
105109

106110
// the transaction is from originalAccount, but signed with newSigner private key
107111

108112
const rekeyBack = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
109-
from: acct1.addr,
110-
to: acct1.addr,
113+
sender: acct1.addr,
114+
receiver: acct1.addr,
111115
amount: 0,
112116
suggestedParams,
113117
rekeyTo: acct1.addr,
114118
});
115119
await client.sendRawTransaction(rekeyBack.signTxn(acct2.privateKey)).do();
116-
await algosdk.waitForConfirmation(client, rekeyBack.txID().toString(), 3);
120+
await algosdk.waitForConfirmation(client, rekeyBack.txID(), 3);
117121
}
118122

119123
main();

0 commit comments

Comments
 (0)