From f48c5a641c5e7f827d5495647616f23c3bd650f7 Mon Sep 17 00:00:00 2001 From: Nate Faber Date: Mon, 2 May 2022 14:48:47 -0400 Subject: [PATCH 01/10] Allow Uint8Arrays type public keys when signing (#549) The user gets the public key from `algosdk.decodeAddress(authAddress)` in the Uint8Array format, and the kmd client can already accept this how it is implemented. So it makes sense to allow this in the types for `signTransactionWithSpecificPublicKey` and `signMultisigTransaction` --- src/client/kmd.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/kmd.ts b/src/client/kmd.ts index b34a3dd97..3a1bd27c8 100644 --- a/src/client/kmd.ts +++ b/src/client/kmd.ts @@ -289,7 +289,7 @@ export default class Kmd extends ServiceClient { walletHandle: string, walletPassword: string, transaction: txn.TransactionLike, - publicKey: string + publicKey: Uint8Array | string ) { const tx = txn.instantiateTxnIfNeeded(transaction); @@ -384,7 +384,7 @@ export default class Kmd extends ServiceClient { walletHandle: string, pw: string, transaction: txn.TransactionLike, - pk: string, + pk: Uint8Array | string, partial: string ) { const tx = txn.instantiateTxnIfNeeded(transaction); From a1e5dc5050d589e53be264813065a12b7d848ef7 Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Wed, 11 May 2022 17:26:20 -0400 Subject: [PATCH 02/10] generate client api code --- src/client/v2/algod/models/types.ts | 51 ++++++++++++++++++++++++----- test-harness | 1 + 2 files changed, 43 insertions(+), 9 deletions(-) create mode 160000 test-harness diff --git a/src/client/v2/algod/models/types.ts b/src/client/v2/algod/models/types.ts index 8d64419ca..ca0e0da2e 100644 --- a/src/client/v2/algod/models/types.ts +++ b/src/client/v2/algod/models/types.ts @@ -1162,6 +1162,29 @@ export class CompileResponse extends BaseModel { } } +/** + * Teal disassembly Result + */ +export class DisassembleResponse extends BaseModel { + /** + * disassembled Teal code + */ + public result: string; + + /** + * Creates a new `DisassembleResponse` object. + * @param result - disassembled Teal code + */ + constructor(result: string) { + super(); + this.result = result; + + this.attribute_map = { + result: 'result', + }; + } +} + /** * Request data type for dryrun endpoint. Given the Transactions and simulated * ledger state upload, run TEAL scripts and return debugging information. @@ -1401,9 +1424,14 @@ export class DryrunTxnResult extends BaseModel { public appCallTrace?: DryrunState[]; /** - * Execution cost of app call transaction + * Budget consumed during execution of app call transaction. + */ + public budgetCredit?: number | bigint; + + /** + * Budget added during execution of app call transaction. */ - public cost?: number | bigint; + public budgetDebit?: number | bigint; /** * Application state delta. @@ -1428,7 +1456,8 @@ export class DryrunTxnResult extends BaseModel { * @param disassembly - Disassembled program line by line. * @param appCallMessages - * @param appCallTrace - - * @param cost - Execution cost of app call transaction + * @param budgetCredit - Budget consumed during execution of app call transaction. + * @param budgetDebit - Budget added during execution of app call transaction. * @param globalDelta - Application state delta. * @param localDeltas - * @param logicSigDisassembly - Disassembled lsig program line by line. @@ -1440,7 +1469,8 @@ export class DryrunTxnResult extends BaseModel { disassembly, appCallMessages, appCallTrace, - cost, + budgetCredit, + budgetDebit, globalDelta, localDeltas, logicSigDisassembly, @@ -1451,7 +1481,8 @@ export class DryrunTxnResult extends BaseModel { disassembly: string[]; appCallMessages?: string[]; appCallTrace?: DryrunState[]; - cost?: number | bigint; + budgetCredit?: number | bigint; + budgetDebit?: number | bigint; globalDelta?: EvalDeltaKeyValue[]; localDeltas?: AccountStateDelta[]; logicSigDisassembly?: string[]; @@ -1463,7 +1494,8 @@ export class DryrunTxnResult extends BaseModel { this.disassembly = disassembly; this.appCallMessages = appCallMessages; this.appCallTrace = appCallTrace; - this.cost = cost; + this.budgetCredit = budgetCredit; + this.budgetDebit = budgetDebit; this.globalDelta = globalDelta; this.localDeltas = localDeltas; this.logicSigDisassembly = logicSigDisassembly; @@ -1475,7 +1507,8 @@ export class DryrunTxnResult extends BaseModel { disassembly: 'disassembly', appCallMessages: 'app-call-messages', appCallTrace: 'app-call-trace', - cost: 'cost', + budgetCredit: 'budget-credit', + budgetDebit: 'budget-debit', globalDelta: 'global-delta', localDeltas: 'local-deltas', logicSigDisassembly: 'logic-sig-disassembly', @@ -2011,8 +2044,8 @@ export class ProofResponse extends BaseModel { /** * The type of hash function used to create the proof, must be one of: - * * sumhash * * sha512_256 + * * sha256 */ public hashtype?: string; @@ -2024,8 +2057,8 @@ export class ProofResponse extends BaseModel { * @param treedepth - Represents the depth of the tree that is being proven, i.e. the number of edges * from a leaf to the root. * @param hashtype - The type of hash function used to create the proof, must be one of: - * * sumhash * * sha512_256 + * * sha256 */ constructor({ idx, diff --git a/test-harness b/test-harness new file mode 160000 index 000000000..b22e799d4 --- /dev/null +++ b/test-harness @@ -0,0 +1 @@ +Subproject commit b22e799d46737af02dd3bcc9c8134bc49832699f From 646a3aab44aab207a9a1f57674339284e56a208d Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Mon, 16 May 2022 11:04:31 -0400 Subject: [PATCH 03/10] remove test-harness directory --- test-harness | 1 - 1 file changed, 1 deletion(-) delete mode 160000 test-harness diff --git a/test-harness b/test-harness deleted file mode 160000 index b22e799d4..000000000 --- a/test-harness +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b22e799d46737af02dd3bcc9c8134bc49832699f From 1b0837c3ed6fdcda8bbd2265792cfa38fd4abd70 Mon Sep 17 00:00:00 2001 From: Eric Warehime Date: Tue, 24 May 2022 12:17:58 -0700 Subject: [PATCH 04/10] Update generated files (#569) --- src/client/v2/algod/models/types.ts | 37 ++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/client/v2/algod/models/types.ts b/src/client/v2/algod/models/types.ts index 8d64419ca..685ed87e4 100644 --- a/src/client/v2/algod/models/types.ts +++ b/src/client/v2/algod/models/types.ts @@ -1145,19 +1145,50 @@ export class CompileResponse extends BaseModel { */ public result: string; + /** + * JSON of the source map + */ + public sourcemap?: Record; + /** * Creates a new `CompileResponse` object. * @param hash - base32 SHA512_256 of program bytes (Address style) * @param result - base64 encoded program bytes + * @param sourcemap - JSON of the source map */ - constructor(hash: string, result: string) { + constructor(hash: string, result: string, sourcemap?: Record) { super(); this.hash = hash; this.result = result; + this.sourcemap = sourcemap; this.attribute_map = { hash: 'hash', result: 'result', + sourcemap: 'sourcemap', + }; + } +} + +/** + * Teal disassembly Result + */ +export class DisassembleResponse extends BaseModel { + /** + * disassembled Teal code + */ + public result: string; + + /** + * Creates a new `DisassembleResponse` object. + * @param result - disassembled Teal code + */ + constructor(result: string) { + super(); + this.result = result; + + this.attribute_map = { + result: 'result', }; } } @@ -2011,8 +2042,8 @@ export class ProofResponse extends BaseModel { /** * The type of hash function used to create the proof, must be one of: - * * sumhash * * sha512_256 + * * sha256 */ public hashtype?: string; @@ -2024,8 +2055,8 @@ export class ProofResponse extends BaseModel { * @param treedepth - Represents the depth of the tree that is being proven, i.e. the number of edges * from a leaf to the root. * @param hashtype - The type of hash function used to create the proof, must be one of: - * * sumhash * * sha512_256 + * * sha256 */ constructor({ idx, From c06b6fdfd38a9c4d4ea5809d3e6f9bfb25ce6aff Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Wed, 25 May 2022 15:18:14 -0400 Subject: [PATCH 05/10] regenerate --- src/client/v2/algod/models/types.ts | 61 ++++++++++++----------------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/src/client/v2/algod/models/types.ts b/src/client/v2/algod/models/types.ts index 99782a4c3..d91d84cc0 100644 --- a/src/client/v2/algod/models/types.ts +++ b/src/client/v2/algod/models/types.ts @@ -1193,29 +1193,6 @@ export class DisassembleResponse extends BaseModel { } } -/** - * Teal disassembly Result - */ -export class DisassembleResponse extends BaseModel { - /** - * disassembled Teal code - */ - public result: string; - - /** - * Creates a new `DisassembleResponse` object. - * @param result - disassembled Teal code - */ - constructor(result: string) { - super(); - this.result = result; - - this.attribute_map = { - result: 'result', - }; - } -} - /** * Request data type for dryrun endpoint. Given the Transactions and simulated * ledger state upload, run TEAL scripts and return debugging information. @@ -1454,15 +1431,21 @@ export class DryrunTxnResult extends BaseModel { public appCallTrace?: DryrunState[]; + /** + * Budget added during execution of app call transaction. + */ + public budgetAdded?: number | bigint; + /** * Budget consumed during execution of app call transaction. */ - public budgetCredit?: number | bigint; + public budgetConsumed?: number | bigint; /** - * Budget added during execution of app call transaction. + * Net cost of app execution. Field is DEPRECATED and is subject for removal. + * Instead, use `budget-added` and `budget-consumed. */ - public budgetDebit?: number | bigint; + public cost?: number | bigint; /** * Application state delta. @@ -1487,8 +1470,10 @@ export class DryrunTxnResult extends BaseModel { * @param disassembly - Disassembled program line by line. * @param appCallMessages - * @param appCallTrace - - * @param budgetCredit - Budget consumed during execution of app call transaction. - * @param budgetDebit - Budget added during execution of app call transaction. + * @param budgetAdded - Budget added during execution of app call transaction. + * @param budgetConsumed - Budget consumed during execution of app call transaction. + * @param cost - Net cost of app execution. Field is DEPRECATED and is subject for removal. + * Instead, use `budget-added` and `budget-consumed. * @param globalDelta - Application state delta. * @param localDeltas - * @param logicSigDisassembly - Disassembled lsig program line by line. @@ -1500,8 +1485,9 @@ export class DryrunTxnResult extends BaseModel { disassembly, appCallMessages, appCallTrace, - budgetCredit, - budgetDebit, + budgetAdded, + budgetConsumed, + cost, globalDelta, localDeltas, logicSigDisassembly, @@ -1512,8 +1498,9 @@ export class DryrunTxnResult extends BaseModel { disassembly: string[]; appCallMessages?: string[]; appCallTrace?: DryrunState[]; - budgetCredit?: number | bigint; - budgetDebit?: number | bigint; + budgetAdded?: number | bigint; + budgetConsumed?: number | bigint; + cost?: number | bigint; globalDelta?: EvalDeltaKeyValue[]; localDeltas?: AccountStateDelta[]; logicSigDisassembly?: string[]; @@ -1525,8 +1512,9 @@ export class DryrunTxnResult extends BaseModel { this.disassembly = disassembly; this.appCallMessages = appCallMessages; this.appCallTrace = appCallTrace; - this.budgetCredit = budgetCredit; - this.budgetDebit = budgetDebit; + this.budgetAdded = budgetAdded; + this.budgetConsumed = budgetConsumed; + this.cost = cost; this.globalDelta = globalDelta; this.localDeltas = localDeltas; this.logicSigDisassembly = logicSigDisassembly; @@ -1538,8 +1526,9 @@ export class DryrunTxnResult extends BaseModel { disassembly: 'disassembly', appCallMessages: 'app-call-messages', appCallTrace: 'app-call-trace', - budgetCredit: 'budget-credit', - budgetDebit: 'budget-debit', + budgetAdded: 'budget-added', + budgetConsumed: 'budget-consumed', + cost: 'cost', globalDelta: 'global-delta', localDeltas: 'local-deltas', logicSigDisassembly: 'logic-sig-disassembly', From d5868f158ffd306ba2b0ef0185854d04911b11e7 Mon Sep 17 00:00:00 2001 From: Eric Warehime Date: Fri, 27 May 2022 14:01:38 -0700 Subject: [PATCH 06/10] Add codegen workflow (#570) --- .github/workflows/codegen.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/codegen.yml diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml new file mode 100644 index 000000000..01539bb70 --- /dev/null +++ b/.github/workflows/codegen.yml @@ -0,0 +1,19 @@ +name: "SDK Code Generation" +on: + schedule: + - cron: '20 23 * * *' +permissions: + contents: write + pull-requests: write +jobs: + generate_and_pr: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Generate and PR + uses: algorand/generator/.github/actions/sdk-codegen/ + with: + args: "-k JS" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d051cdf1e7d0930e3ca09468bb906c73aa6fb66b Mon Sep 17 00:00:00 2001 From: Eric Warehime Date: Tue, 31 May 2022 09:05:05 -0700 Subject: [PATCH 07/10] Update codegen.yml (#574) --- .github/workflows/codegen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 01539bb70..7b397ba54 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -12,7 +12,7 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - name: Generate and PR - uses: algorand/generator/.github/actions/sdk-codegen/ + uses: algorand/generator/.github/actions/sdk-codegen/@master with: args: "-k JS" env: From 30ffce3bbf1c2761c38f99b2ffa05113c7f5c9c1 Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 2 Jun 2022 15:03:04 -0400 Subject: [PATCH 08/10] Bump version and update CHANGELOG --- CHANGELOG.md | 21 +++++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10f42ca44..e678024e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +# v1.17.0 + +## What's Changed + +- Dryrun stack printer by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/514 +- Document all Indexer methods by @fionnachan in https://github.com/algorand/js-algorand-sdk/pull/524 +- fixing openssh upgrade error by @algojack in https://github.com/algorand/js-algorand-sdk/pull/559 +- pass a Uint8Array instead of a string for importing a key by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/557 +- adding foreign app addr to dryrun by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/561 +- Allow Uint8Arrays public keys for kmd signing by @vividn in https://github.com/algorand/js-algorand-sdk/pull/549 +- Update generated files by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/569 +- Build: Add SDK code generation workflow by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/570 +- Update codegen.yml by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/574 +- Generate updated client API code by @algoidurovic in https://github.com/algorand/js-algorand-sdk/pull/566 + +## New Contributors + +- @vividn made their first contribution in https://github.com/algorand/js-algorand-sdk/pull/549 +- @Eric-Warehime made their first contribution in https://github.com/algorand/js-algorand-sdk/pull/569 +- @algoidurovic made their first contribution in https://github.com/algorand/js-algorand-sdk/pull/566 + # v1.16.0 ## Added diff --git a/package-lock.json b/package-lock.json index 1fc3cb632..e64fb9a61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "algosdk", - "version": "1.16.0", + "version": "1.17.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "algosdk", - "version": "1.16.0", + "version": "1.17.0", "license": "MIT", "dependencies": { "algo-msgpack-with-bigint": "^2.1.1", diff --git a/package.json b/package.json index 571107834..47d32facd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "algosdk", - "version": "1.16.0", + "version": "1.17.0", "description": "The official JavaScript SDK for Algorand", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", From 442c923401a7f0b77392c04c77ff3611ece981b2 Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 2 Jun 2022 15:06:53 -0400 Subject: [PATCH 09/10] Update CDN hash --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a908a41db..72ec69f67 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ Include a minified browser bundle directly in your HTML like so: ```html ``` @@ -32,8 +32,8 @@ or ```html ``` From 01a41886a54d4544318f8a3cbcb14821464c1199 Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 2 Jun 2022 15:40:44 -0400 Subject: [PATCH 10/10] Update CHANGELOG --- CHANGELOG.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e678024e7..592631f73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,6 @@ ## What's Changed -- Dryrun stack printer by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/514 -- Document all Indexer methods by @fionnachan in https://github.com/algorand/js-algorand-sdk/pull/524 -- fixing openssh upgrade error by @algojack in https://github.com/algorand/js-algorand-sdk/pull/559 -- pass a Uint8Array instead of a string for importing a key by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/557 -- adding foreign app addr to dryrun by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/561 - Allow Uint8Arrays public keys for kmd signing by @vividn in https://github.com/algorand/js-algorand-sdk/pull/549 - Update generated files by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/569 - Build: Add SDK code generation workflow by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/570