Skip to content

Commit

Permalink
feat!: remove deprecated functionality
Browse files Browse the repository at this point in the history
And use `--locked` when installing pinned version of CLI (and update to
latest, for good measure)
  • Loading branch information
chadoh committed Oct 23, 2024
1 parent b13c291 commit 15b2dfb
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/contract/assembled_transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ export class AssembledTransaction<T> {
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;
}

Expand Down
5 changes: 1 addition & 4 deletions src/contract/sent_transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export class SentTransaction<T> {
};

constructor(
_: any, // deprecated: used to take sentTransaction, need to wait for major release for breaking change
public assembled: AssembledTransaction<T>,
) {
this.server = new Server(this.assembled.options.rpcUrl, {
Expand All @@ -70,12 +69,10 @@ export class SentTransaction<T> {
* AssembledTransaction. This will also send the transaction to the network.
*/
static init = async <U>(
/** @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<U>,
): Promise<SentTransaction<U>> => {
const tx = new SentTransaction(undefined, assembled);
const tx = new SentTransaction(assembled);
const sent = await tx.send();
return sent;
};
Expand Down
15 changes: 0 additions & 15 deletions src/horizon/server_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<EffectRecord>;
operations: CallCollectionFunction<OperationRecord>;
Expand Down
5 changes: 0 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion test/unit/server/soroban/constructor_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Server, AxiosClient } = StellarSdk.SorobanRpc;
const { Server, AxiosClient } = StellarSdk.rpc;

describe("Server.constructor", function () {
beforeEach(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/server/soroban/get_contract_wasm_test.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down

0 comments on commit 15b2dfb

Please sign in to comment.