From 15b2dfb2d3b45ab427d0f66571300c13f08843b7 Mon Sep 17 00:00:00 2001 From: Chad Ostrowski <221614+chadoh@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:12:33 -0400 Subject: [PATCH] feat!: remove deprecated functionality And use `--locked` when installing pinned version of CLI (and update to latest, for good measure) --- .cargo/config.toml | 2 +- CHANGELOG.md | 25 +++++++++++++++++++ src/contract/assembled_transaction.ts | 2 +- src/contract/sent_transaction.ts | 5 +--- src/horizon/server_api.ts | 15 ----------- src/index.ts | 5 ---- test/unit/server/soroban/constructor_test.js | 2 +- .../server/soroban/get_contract_wasm_test.js | 2 +- 8 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 3aa25973a..4613d2ceb 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,7 +1,7 @@ # paths = ["/path/to/override"] # path dependency overrides [alias] # command aliases -install_stellar = "install --version 21.5.0 --root ./target stellar-cli --debug --force" +install_stellar = "install --locked --version 21.5.3 --root ./target stellar-cli --debug --force" # b = "build --target wasm32-unknown-unknown --release" # c = "check" # t = "test" diff --git a/CHANGELOG.md b/CHANGELOG.md index 64474521a..5a5359465 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,33 @@ A breaking change will get clearly marked in this log. ### Breaking Changes - `contract.AssembledTransaction#signAuthEntries` now takes an `address` instead of a `publicKey`. This brings the API more inline with its actual functionality: It can be used to sign all the auth entries for a particular _address_, whether that is the address of an account (public key) or a contract. ([#1044](https://github.com/stellar/js-stellar-sdk/pull/1044)). + - The Node.js code will now Babelify to Node 18 instead of Node 16, but we stopped supporting Node 16 long ago so this shouldn't be a breaking change. +- `SentTransaction.init` and `new SentTransaction` now take _one_ (1) argument instead of _two_ (2). The first argument had previously been deprecated and ignored. To update: + + ```diff + -SentTransaction(nonsense, realStuff) + +SentTransaction(realStuff) + -new SentTransaction(nonsense, realStuff) + +new SentTransaction(realStuff) + ``` + +- `SorobanRpc` import, previously deprecated, has been removed. You can import `rpc` instead: + + ```diff + -import { SorobanRpc } from '@stellar/stellar-sdk' + +import { rpc } from '@stellar/stellar-sdk' + ``` + + As an alternative, you can also import from the `rpc` entrypoint: + + ```ts + import { Server } from '@stellar/stellar-sdk/rpc' + ``` + +- Horizon Server API types: removed fields `transaction_count`, `base_fee`, and `base_reserve` (deprecated since [v10.0.1](https://github.com/stellar/js-stellar-sdk/releases/tag/v10.0.1)) + ### Added - You can now build the browser bundle without various dependencies: * Set `USE_AXIOS=false` to build without the `axios` dependency: this will build `stellar-sdk-no-axios.js` and `stellar-sdk-no-axios.min.js` in the `dist/` directory, or just run `yarn build:browser:no-axios` to generate these files. diff --git a/src/contract/assembled_transaction.ts b/src/contract/assembled_transaction.ts index 82ebc8d06..3acbc2795 100644 --- a/src/contract/assembled_transaction.ts +++ b/src/contract/assembled_transaction.ts @@ -676,7 +676,7 @@ export class AssembledTransaction { if(!this.signed){ throw new Error("The transaction has not yet been signed. Run `sign` first, or use `signAndSend` instead."); } - const sent = await SentTransaction.init(undefined, this); + const sent = await SentTransaction.init(this); return sent; } diff --git a/src/contract/sent_transaction.ts b/src/contract/sent_transaction.ts index f04d37ee5..bc7b2015f 100644 --- a/src/contract/sent_transaction.ts +++ b/src/contract/sent_transaction.ts @@ -57,7 +57,6 @@ export class SentTransaction { }; constructor( - _: any, // deprecated: used to take sentTransaction, need to wait for major release for breaking change public assembled: AssembledTransaction, ) { this.server = new Server(this.assembled.options.rpcUrl, { @@ -70,12 +69,10 @@ export class SentTransaction { * AssembledTransaction. This will also send the transaction to the network. */ static init = async ( - /** @deprecated variable is ignored. Now handled by AssembledTransaction. */ - _: any, // eslint-disable-line @typescript-eslint/no-unused-vars /** {@link AssembledTransaction} from which this SentTransaction was initialized */ assembled: AssembledTransaction, ): Promise> => { - const tx = new SentTransaction(undefined, assembled); + const tx = new SentTransaction(assembled); const sent = await tx.send(); return sent; }; diff --git a/src/horizon/server_api.ts b/src/horizon/server_api.ts index b567498e7..89afecc86 100644 --- a/src/horizon/server_api.ts +++ b/src/horizon/server_api.ts @@ -158,21 +158,6 @@ export namespace ServerApi { header_xdr: string; base_fee_in_stroops: number; base_reserve_in_stroops: number; - /** - * @deprecated This will be removed in the next major version: the property - * no longer exists on the Horizon API - */ - transaction_count: number; - /** - * @deprecated This will be removed in the next major version: the property - * no longer exists on the Horizon API - */ - base_fee: number; - /** - * @deprecated This will be removed in the next major version: the property - * no longer exists on the Horizon API - */ - base_reserve: string; effects: CallCollectionFunction; operations: CallCollectionFunction; diff --git a/src/index.ts b/src/index.ts index 813ce6fc1..af17f71f6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,11 +27,6 @@ export * as Horizon from './horizon'; */ export * as rpc from './rpc'; -/** - * @deprecated Use `rpc` instead - */ -export * as SorobanRpc from './rpc'; - /** * Tools for interacting with smart contracts, such as `Client`, `Spec`, and * `AssembledTransaction`. You can import these from the `/contract` diff --git a/test/unit/server/soroban/constructor_test.js b/test/unit/server/soroban/constructor_test.js index 82c4465e1..7999928d4 100644 --- a/test/unit/server/soroban/constructor_test.js +++ b/test/unit/server/soroban/constructor_test.js @@ -1,4 +1,4 @@ -const { Server, AxiosClient } = StellarSdk.SorobanRpc; +const { Server, AxiosClient } = StellarSdk.rpc; describe("Server.constructor", function () { beforeEach(function () { diff --git a/test/unit/server/soroban/get_contract_wasm_test.js b/test/unit/server/soroban/get_contract_wasm_test.js index 6e8957739..77473a1fa 100644 --- a/test/unit/server/soroban/get_contract_wasm_test.js +++ b/test/unit/server/soroban/get_contract_wasm_test.js @@ -1,5 +1,5 @@ const { Address, xdr, hash, Contract } = StellarSdk; -const { Server, AxiosClient } = StellarSdk.SorobanRpc; +const { Server, AxiosClient } = StellarSdk.rpc; describe("Server#getContractWasm", () => { beforeEach(function () {