diff --git a/CHANGELOG.md b/CHANGELOG.md index a506677f8..e4114e3e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.21.0 + +## What's Changed + +### Enhancements + +- Enhancement: Removing more unused steps by @tzaffi in https://github.com/algorand/js-algorand-sdk/pull/637 +- Enhancement: Add deprecation tag to algod v1 client by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/642 +- enhancement: add unit test for ParticipationUpdates field by @shiqizng in https://github.com/algorand/js-algorand-sdk/pull/652 + +**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v1.20.0...v1.21.0 + # v1.20.0 ## What's Changed diff --git a/README.md b/README.md index 31e26cc80..69e6e9cec 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Include a minified browser bundle directly in your HTML like so: ```html @@ -32,7 +32,7 @@ or ```html diff --git a/package-lock.json b/package-lock.json index a44628a82..2d069eee4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "algosdk", - "version": "1.20.0", + "version": "1.21.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "algosdk", - "version": "1.20.0", + "version": "1.21.0", "license": "MIT", "dependencies": { "algo-msgpack-with-bigint": "^2.1.1", diff --git a/package.json b/package.json index 2803b38a3..0f4a53a46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "algosdk", - "version": "1.20.0", + "version": "1.21.0", "description": "The official JavaScript SDK for Algorand", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/src/client/algod.js b/src/client/algod.js index c1609454e..284870f4f 100644 --- a/src/client/algod.js +++ b/src/client/algod.js @@ -1,6 +1,7 @@ const { default: HTTPClient } = require('./client'); const { setSendTransactionHeaders } = require('./v2/algod/sendRawTransaction'); +/** @deprecated v1 algod APIs are deprecated, please use the v2 client */ function Algod( token = '', baseServer = 'http://r2.algorand.network', @@ -20,6 +21,7 @@ function Algod( * Takes an object and convert its note field to Buffer, if exist. * @param o * @returns {*} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ function noteb64ToNote(o) { if (!(o.noteb64 === undefined || o.noteb64 === null)) { @@ -33,6 +35,7 @@ function Algod( * status retrieves the StatusResponse from the running node * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.status = async (headerObj = {}) => { const res = await c.get('/v1/status', {}, headerObj); @@ -43,6 +46,7 @@ function Algod( * healthCheck returns an empty object iff the node is running * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.healthCheck = async (headerObj = {}) => { const res = await c.get('/health', {}, headerObj); @@ -58,6 +62,7 @@ function Algod( * @param roundNumber * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.statusAfterBlock = async (roundNumber, headerObj = {}) => { if (!Number.isInteger(roundNumber)) @@ -76,6 +81,7 @@ function Algod( * @param maxTxns - number * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.pendingTransactions = async (maxTxns, headerObj = {}) => { if (!Number.isInteger(maxTxns)) throw Error('maxTxns should be an integer'); @@ -101,6 +107,7 @@ function Algod( * versions retrieves the VersionResponse from the running node * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.versions = async (headerObj = {}) => { const res = await c.get('/versions', {}, headerObj); @@ -111,6 +118,7 @@ function Algod( * LedgerSupply gets the supply details for the specified node's Ledger * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.ledgerSupply = async (headerObj = {}) => { const res = await c.get('/v1/ledger/supply', {}, headerObj); @@ -125,6 +133,7 @@ function Algod( * @param maxTxns - number, optional * @param headers, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.transactionByAddress = async ( addr, @@ -161,6 +170,7 @@ function Algod( * @param maxTxns - number, optional * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.transactionByAddressAndDate = async ( addr, @@ -188,6 +198,7 @@ function Algod( * @param txid * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.transactionById = async (txid, headerObj = {}) => { const res = await c.get(`/v1/transaction/${txid}`, {}, headerObj); @@ -203,6 +214,7 @@ function Algod( * @param txid * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.transactionInformation = async (addr, txid, headerObj = {}) => { const res = await c.get( @@ -221,6 +233,7 @@ function Algod( * @param txid * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.pendingTransactionInformation = async (txid, headerObj = {}) => { const res = await c.get(`/v1/transactions/pending/${txid}`, {}, headerObj); @@ -235,6 +248,7 @@ function Algod( * @param addr - string * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.accountInformation = async (addr, headerObj = {}) => { const res = await c.get(`/v1/account/${addr}`, {}, headerObj); @@ -246,6 +260,7 @@ function Algod( * @param index - number * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.assetInformation = async (index, headerObj = {}) => { const res = await c.get(`/v1/asset/${index}`, {}, headerObj); @@ -256,6 +271,7 @@ function Algod( * suggestedFee gets the recommended transaction fee from the node * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.suggestedFee = async (headerObj = {}) => { const res = await c.get('/v1/transactions/fee', {}, headerObj); @@ -267,6 +283,7 @@ function Algod( * @param txn - Uin8Array * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.sendRawTransaction = async (txn, headerObj = {}) => { const txHeaders = setSendTransactionHeaders(headerObj); @@ -279,6 +296,7 @@ function Algod( * @param txn - Array of Uin8Array * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.sendRawTransactions = async (txns, headerObj = {}) => { const txHeaders = setSendTransactionHeaders(headerObj); @@ -297,6 +315,7 @@ function Algod( * getTransactionParams returns to common needed parameters for a new transaction * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.getTransactionParams = async (headerObj = {}) => { const res = await c.get('/v1/transactions/params', {}, headerObj); @@ -307,6 +326,7 @@ function Algod( * suggestParams returns to common needed parameters for a new transaction, in a format the transaction builder expects * @param headerObj, optional * @returns {Object} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.suggestParams = async (headerObj = {}) => { const result = await this.getTransactionParams(headerObj); @@ -325,6 +345,7 @@ function Algod( * @param roundNumber * @param headerObj, optional * @returns {Promise<*>} + * @deprecated v1 algod APIs are deprecated, please use the v2 client */ this.block = async (roundNumber, headerObj = {}) => { if (!Number.isInteger(roundNumber)) diff --git a/tests/cucumber/steps/steps.js b/tests/cucumber/steps/steps.js index 22f8ddcd0..cf1807a19 100644 --- a/tests/cucumber/steps/steps.js +++ b/tests/cucumber/steps/steps.js @@ -258,29 +258,6 @@ module.exports = function getSteps(options) { this.pk = algosdk.multisigAddress(this.msig); }); - When('I create the payment transaction', function () { - this.txn = { - from: this.pk, - to: this.to, - fee: this.fee, - firstRound: this.fv, - lastRound: this.lv, - genesisHash: this.gh, - }; - if (this.gen) { - this.txn.genesisID = this.gen; - } - if (this.close) { - this.txn.closeRemainderTo = this.close; - } - if (this.note) { - this.txn.note = this.note; - } - if (this.amt) { - this.txn.amount = this.amt; - } - }); - When('I sign the transaction with the private key', function () { const obj = algosdk.signTransaction(this.txn, this.sk); this.stx = obj.blob; @@ -980,60 +957,6 @@ module.exports = function getSteps(options) { return this.kcl.deleteKey(this.handle, this.wallet_pswd, this.pk); }); - Given( - 'key registration transaction parameters {int} {int} {int} {string} {string} {string} {int} {int} {int} {string} {string}', - function ( - fee, - fv, - lv, - gh, - votekey, - selkey, - votefst, - votelst, - votekd, - gen, - note - ) { - this.fee = parseInt(fee); - this.fv = parseInt(fv); - this.lv = parseInt(lv); - this.gh = gh; - if (gen !== 'none') { - this.gen = gen; - } - if (note !== 'none') { - this.note = makeUint8Array(Buffer.from(note, 'base64')); - } - this.votekey = votekey; - this.selkey = selkey; - this.votefst = votefst; - this.votelst = votelst; - this.votekd = votekd; - } - ); - - When('I create the key registration transaction', function () { - this.txn = { - fee: this.fee, - firstRound: this.fv, - lastRound: this.lv, - genesisHash: this.gh, - voteKey: this.votekey, - selectionKey: this.selkey, - voteFirst: this.votefst, - voteLast: this.votelst, - voteKeyDilution: this.votekd, - type: 'keyreg', - }; - if (this.gen) { - this.txn.genesisID = this.gen; - } - if (this.note) { - this.txn.note = this.note; - } - }); - Given( 'default V2 key registration transaction {string}', async function (type) { diff --git a/tests/cucumber/unit.tags b/tests/cucumber/unit.tags index 2d3f46b8e..3acf36fea 100644 --- a/tests/cucumber/unit.tags +++ b/tests/cucumber/unit.tags @@ -15,6 +15,7 @@ @unit.rekey @unit.responses @unit.responses.231 +@unit.responses.participationupdates @unit.responses.unlimited_assets @unit.sourcemap @unit.stateproof.paths