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

3.0.0: Sync changes to develop #884

Merged
merged 45 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3150ea1
Remove buffer usage in favor or Uint8Array and Dataview (#800)
algochoi Jul 18, 2023
ecf77e4
CICD: Update Chromedriver version and CI orb (#802)
algochoi Jul 20, 2023
b09d616
Remove `Buffer` Usage (#801)
algochoi Jul 27, 2023
81ab6eb
Add address bytes length check in encodeAddress (#809)
algochoi Aug 9, 2023
c079c61
Align transaction fields to transaction reference spec (#804)
algochoi Aug 11, 2023
df77157
Merge branch 'develop' into 3.0.0
algochoi Aug 16, 2023
2fb824c
Merge branch 'develop' into 3.0.0
algochoi Aug 22, 2023
a077ce1
Change Buffer usage to base64ToBytes
algochoi Aug 22, 2023
6d17cd3
3.0.0: Convert algod responses to typed (#776)
Eric-Warehime Aug 31, 2023
9447440
Merge branch 'develop' into 3.0.0
jasonpaulos Oct 6, 2023
f8618b6
Fix type error is examples dir
jasonpaulos Oct 6, 2023
fb81c1d
More examples fixes
jasonpaulos Oct 6, 2023
a4f44c6
Merge pull request #835 from algorand/3.0.0-merge-develop
jasonpaulos Oct 6, 2023
2db897d
Improve SourceMap and support columns
jasonpaulos Oct 5, 2023
327f33c
Report source file index and name index
jasonpaulos Oct 12, 2023
a1e40e4
Update cucumber tests
jasonpaulos Nov 15, 2023
7d4b4b0
Rename to ProgramSourceMap
jasonpaulos Nov 15, 2023
7451256
Firefox fix
jasonpaulos Nov 15, 2023
a0700c6
Update unit tests
jasonpaulos Nov 15, 2023
ccf6c68
Update .test-env
jasonpaulos Nov 20, 2023
d527840
Merge pull request #834 from jasonpaulos/teal-source-map-improvements
jasonpaulos Nov 20, 2023
f03c939
Regenerate simulate exec trace model (#844)
jasonpaulos Dec 18, 2023
5a33cb0
Merge branch 'develop' into 3.0.0
jasonpaulos Dec 18, 2023
1947079
chore: native esm bundle (#836)
PhearZero Jan 5, 2024
2a25f7a
3.0.0: Type and formatting changes (#853)
jasonpaulos Feb 5, 2024
4184324
3.0.0: Refactor `Transaction` class (#854)
jasonpaulos Feb 13, 2024
96c2295
3.0.0: Remove `IntDecoding` as a REST option & support native bigint …
jasonpaulos Feb 16, 2024
175f99a
Merge branch 'develop' into 3.0.0
jasonpaulos Feb 29, 2024
3b4d6b2
Fix examples merge error
jasonpaulos Feb 29, 2024
3fd4fa0
minor fix
jasonpaulos Feb 29, 2024
f9013e2
3.0.0: Improve object encoding and decoding (#862)
jasonpaulos Jun 5, 2024
67212db
Merge branch 'develop' into 3.0.0
jasonpaulos Jun 5, 2024
b9fb388
3.0.0: Correctly model blocks (#875)
jasonpaulos Jun 27, 2024
0bb78fa
Fix stateproof txn representation (#876)
jasonpaulos Jun 27, 2024
9ec8b7f
Add to migration guide for #876 (#877)
jasonpaulos Jul 16, 2024
11c8dd7
Typed indexer responses (#857)
jasonpaulos Jul 16, 2024
d9e608f
Merge branch 'develop' into 3.0.0
jasonpaulos Jul 29, 2024
bd49458
3.0.0: Support special case raw binary strings (#878)
jasonpaulos Aug 5, 2024
ad0e4af
Merge branch 'develop' into 3.0.0
jasonpaulos Aug 7, 2024
c3a56c3
REST API TEAL bytes fix (#881)
jasonpaulos Aug 8, 2024
ceccfe4
3.0.0: Fix remaining REST untyped responses (#882)
jasonpaulos Aug 15, 2024
785a441
3.0.0: Add ability to pass through fetch options (#883)
jasonpaulos Aug 16, 2024
d070f30
Merge branch 'develop' into 3.0.0
jasonpaulos Aug 19, 2024
43ae4b8
Merge branch 'develop' into 3.0.0
jasonpaulos Aug 20, 2024
4cc71a7
Add migration guide to readme
jasonpaulos Aug 20, 2024
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
19 changes: 9 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ module.exports = {
},
plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
rules: {
'no-restricted-globals': [
'error',
{
// This is to ensure that we use the 'buffer' package in the browser. In Node it doesn't
// make a difference.
name: 'Buffer',
message:
"Explictly import Buffer with `import { Buffer } from 'buffer'`",
},
],
'no-constant-condition': ['error', { checkLoops: false }],
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
Expand Down Expand Up @@ -68,4 +58,13 @@ module.exports = {
'tests/cucumber/browser/build/',
'tests/browser/bundle.*',
],
settings: {
'import/resolver': {
typescript: {
extensionAlias: {
'.js': ['.ts', '.d.ts', '.js'],
},
},
},
},
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/client/v2/algod/models/types.ts linguist-generated=true
src/client/v2/indexer/models/types.ts linguist-generated=true
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
dist/*
!dist/esm
dist/esm/*
!dist/esm/package.json

.DS_Store

.idea/
Expand All @@ -6,6 +11,7 @@
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
!.vscode/launch.json

# npm
node_modules/
Expand All @@ -23,7 +29,6 @@ tests/cucumber/browser/build
tests/browser/bundle.*

# Builds
dist/
docs/
built/

Expand Down
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"singleQuote": true
"singleQuote": true,
"trailingComma": "es5"
}
27 changes: 27 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug unit tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/tests/mocha.js",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/tsx",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"NODE_ENV": "testing",
"MOCHA_TIMEOUT": "0"
},
"skipFiles": [
// Node.js internal core modules
"<node_internals>/**",
// Ignore all dependencies (optional)
"${workspaceFolder}/node_modules/**"
]
}
]
}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ UNIT_TAGS := "$(subst :, or ,$(shell awk '{print $2}' tests/cucumber/unit.tags
INTEGRATIONS_TAGS := "$(subst :, or ,$(shell awk '{print $2}' tests/cucumber/integration.tags | paste -s -d: -))"

unit:
node_modules/.bin/cucumber-js --tags $(UNIT_TAGS) 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 tsx/cjs --require tests/cucumber/steps/index.js

integration:
node_modules/.bin/cucumber-js --tags $(INTEGRATIONS_TAGS) 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 tsx/cjs --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.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

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

## New Major Version 3

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).

## Installation

### [Node.js](https://nodejs.org/en/download/)
Expand Down
1 change: 1 addition & 0 deletions dist/esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "module"}
38 changes: 21 additions & 17 deletions examples/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function main() {
const mnemonic =
'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';
const recoveredAccount = algosdk.mnemonicToSecretKey(mnemonic);
console.log('Recovered mnemonic account: ', recoveredAccount.addr);
console.log('Recovered mnemonic account: ', recoveredAccount.addr.toString());
// example: ACCOUNT_RECOVER_MNEMONIC

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

// multiSigParams is used when creating the address and when signing transactions
const multiSigParams = {
const multiSigParams: algosdk.MultisigMetadata = {
version: 1,
threshold: 2,
addrs: signerAccounts.map((a) => a.addr),
};
const multisigAddr = algosdk.multisigAddress(multiSigParams);

console.log('Created MultiSig Address: ', multisigAddr);
console.log('Created MultiSig Address: ', multisigAddr.toString());
// example: MULTISIG_CREATE

const fundMsigTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: funder.addr,
to: multisigAddr,
sender: funder.addr,
receiver: multisigAddr,
amount: 1_000_000,
suggestedParams,
});

await client.sendRawTransaction(fundMsigTxn.signTxn(funder.privateKey)).do();
await algosdk.waitForConfirmation(client, fundMsigTxn.txID().toString(), 3);
await algosdk.waitForConfirmation(client, fundMsigTxn.txID(), 3);

// example: MULTISIG_SIGN
const msigTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: multisigAddr,
to: funder.addr,
sender: multisigAddr,
receiver: funder.addr,
amount: 100,
suggestedParams,
});
Expand All @@ -74,46 +74,50 @@ async function main() {
).blob;

await client.sendRawTransaction(msigWithSecondSig).do();
await algosdk.waitForConfirmation(client, msigTxn.txID().toString(), 3);
await algosdk.waitForConfirmation(client, msigTxn.txID(), 3);
// example: MULTISIG_SIGN

// example: ACCOUNT_GENERATE
const generatedAccount = algosdk.generateAccount();
const passphrase = algosdk.secretKeyToMnemonic(generatedAccount.sk);
console.log(`My address: ${generatedAccount.addr}`);
console.log(`My address: ${generatedAccount.addr.toString()}`);
console.log(`My passphrase: ${passphrase}`);
// example: ACCOUNT_GENERATE

// example: ACCOUNT_REKEY
// rekey the original account to the new signer via a payment transaction
// Note any transaction type can be used to rekey an account
const rekeyTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: acct1.addr,
to: acct1.addr,
sender: acct1.addr,
receiver: acct1.addr,
amount: 0,
suggestedParams,
rekeyTo: acct2.addr, // set the rekeyTo field to the new signer
});

await client.sendRawTransaction(rekeyTxn.signTxn(acct1.privateKey)).do();
await algosdk.waitForConfirmation(client, rekeyTxn.txID().toString(), 3);
await algosdk.waitForConfirmation(client, rekeyTxn.txID(), 3);

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

console.log(`Account Info: ${acctInfo} Auth Addr: ${acctInfo['auth-addr']}`);
console.log(
`Account Info: ${algosdk.stringifyJSON(acctInfo)} Auth Addr: ${
acctInfo['auth-addr']
}`
);
// example: ACCOUNT_REKEY

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

const rekeyBack = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: acct1.addr,
to: acct1.addr,
sender: acct1.addr,
receiver: acct1.addr,
amount: 0,
suggestedParams,
rekeyTo: acct1.addr,
});
await client.sendRawTransaction(rekeyBack.signTxn(acct2.privateKey)).do();
await algosdk.waitForConfirmation(client, rekeyBack.txID().toString(), 3);
await algosdk.waitForConfirmation(client, rekeyBack.txID(), 3);
}

main();
Loading
Loading