Releases: stellar/js-stellar-sdk
v12.0.0-rc.3
v12.0.0-rc.3: Protocol 21 Release Candidate 3
This update supports Protocol 21. It is an additive change to the protocol so there are no true backwards incompatibilities, but your software may break if you encounter new unexpected fields from this Protocol (#949).
Breaking Changes
ContractClientfunctionality previously added in v11.3.0 was exported in a non-standard way. You can now import it as any otherstellar-sdkmodule (#962):
-import { ContractClient } from '@stellar/stellar-sdk/lib/contract_client'
+import { contract } from '@stellar/stellar-sdk'
+const { Client } = contractNote that this top-level contract export is a container for ContractClient and related functionality. The ContractClient class is now available at contract.Client, as shown. Further note that there is a capitalized Contract export as well, which comes from stellar-base. You can remember which is which because capital-C Contract is a class, whereas lowercase-c contract is a container/module with a bunch of classes, functions, and types.
Additionally, this is available from the /contract entrypoint, if your version of Node and TypeScript support the exports declaration. Finally, some of its exports have been renamed:
import {
AssembledTransaction,
SentTransaction,
- ContractClient,
- ContractClientOptions,
-} from '@stellar/stellar-sdk/lib/contract_client'
+ Client,
+ ClientOptions,
+} from '@stellar/stellar-sdk/contract'- The
ContractSpecclass is now nested under thecontractmodule, and has been renamed toSpec(#962). Alternatively, you can import this from thecontractentrypoint, if your version of Node and TypeScript support theexportsdeclaration:
-import { ContractSpec } from '@stellar/stellar-sdk'
+import { contract } from '@stellar/stellar-sdk'
+const { Spec } = contract
// OR
+import { Spec } from '@stellar/stellar-sdk/contract'- Previously,
AssembledTransaction.signAndSend()would return aSentTransactioneven if the transaction never finalized. That is, if it successfully sent the transaction to the network, but the transaction was stillstatus: 'PENDING', then it wouldconsole.erroran error message, but return the indeterminate transaction anyhow. It now throws aSentTransaction.Errors.TransactionStillPendingerror with that error message instead (#962).
Deprecated
SorobanRpcmodule is now also exported asrpc(#962). You can import it with either name for now, butSorobanRpcwill be removed in a future release:
-import { SorobanRpc } from '@stellar/stellar-sdk'
+import { rpc } from '@stellar/stellar-sdk'You can also now import it at the /rpc entrypoint, if your version of Node and TypeScript support the exports declaration.
-import { SorobanRpc } from '@stellar/stellar-sdk'
-const { Api } = SorobanRpc
+import { Api } from '@stellar/stellar-sdk/rpc'Added
- New methods on
contract.Client(#960):from(opts: ContractClientOptions)instantiatescontract.Clientby fetching thecontractId's WASM from the network to fill out the client'sContractSpec.fromWasmandfromWasmHashmethods to instantiate acontract.Clientwhen you already have the WASM bytes or hash alongside thecontract.ClientOptions.
- New methods on
rpc.Server(#960):getContractWasmByContractIdandgetContractWasmByHashto retrieve a contract's WASM bytecode via itscontractIdorwasmHash, respectively.
Fixed
- The breaking changes above (strictly speaking, they are not breaking changes because importing from the inner guts of the SDK is not supported) enable the
contractmodule to be used in non-Node environments.
Full Changelog: v11.3.0...v12.0.0-rc.3
v12.0.0-rc.2
v12.0.0-rc.2: Protocol 21 Release Candidate 2
This update supports Protocol 21. It is an additive change to the protocol so there are no true backwards incompatibilities, but your software may break if you encounter new unexpected fields from this Protocol (#949).
Please refer to RC1 for additional changes since the last major version.
Breaking Changes
- The default timeout for transaction calls is now set to 300 seconds (5 minutes) from the previous default of 10 seconds. 10 seconds is often not enough time to review transactions before signing, especially in Freighter or using a hardware wallet like a Ledger, which would cause a
txTooLateerror response from the server. Five minutes is also the value used by the CLI, so this brings the two into alignment (#956).
Fixed
- Dependencies have been properly updated to pull in Protocol 21 XDR, where RC1 was not pulling properly for existing installs (#959).
New Contributors
- @BlaineHeffron made their first contribution in #951
Full Changelog: v11.3.0...v12.0.0-rc.2
v12.0.0-rc.1
v12.0.0-rc.1: Protocol 21 Release Candidate
Breaking Changes
- This update supports Protocol 21. It is an additive change to the protocol so there are no true backwards incompatibilities, but your software may break if you encounter new unexpected fields from this Protocol (#949).
Fixed
- Each item in the
GetEventsResponse.eventslist will now have atxHashitem corresponding to the transaction hash that triggered a particular event (#939). ContractClientnow properly handles methods that take no arguments by makingMethodOptionsthe only parameter, bringing it inline with the types generated by Soroban CLI'ssoroban contract bindings typescript(#940).ContractClientnow allowspublicKeyto be undefined (#941).SentTransactionwill only passallowHttpif (and only if) its correspondingAssembledTransaction#optionsconfig allowed it (#952).
New Contributors
- @silence48 made their first contribution in #934
Full Changelog: v11.3.0...v12.0.0-rc.1
v11.3.0
Added
- Introduces an entire suite of helpers to assist with interacting with smart contracts (#929):
ContractClient: generate a class from the contract specification where each Rust contract method gets a matching method in this class. Each method returns anAssembledTransactionthat can be used to modify, simulate, decode results, and possibly sign, & submit the transaction.AssembledTransaction: used to wrap a transaction-under-construction and provide high-level interfaces to the most common workflows, while still providing access to low-level transaction manipulation.SentTransaction: transaction sent to the Soroban network, in two steps - initial submission and waiting for it to finalize to get the result (retried with exponential backoff)
Fixed
- Upgrade underlying dependencies, including
@stellar/js-xdrwhich should broaden compatibility to pre-ES2016 environments (#932, #930). SorobanRpc.Serverwill no longer use array-based passing to invoke JSON-RPC methods (#924).
Full Changelog: v11.2.2...v11.3.0
v11.2.2
v11.2.1
v11.2.0
Added
- Support for the new, optional
diagnosticEventsXdrfield on theSorobanRpc.Server.sendTransactionmethod. The raw field will be present when using the_sendTransactionmethod, while the normal method will have an already-parseddiagnosticEvents: xdr.DiagnosticEvent[]field, instead (#905). - A new exported interface
SorobanRpc.Api.EventResponseso that developers can type-check individual events (#904).
Updated
v11.1.0
Added
SorobanRpc.Server.simulateTransactionnow supports an optionaladdlResourcesparameter to allow users to specify additional resources that they want to include in a simulation (#896).ContractSpecnow has ajsonSchema()method to generate a JSON Schema for a particular contract specification (#889).
Fixed
- All dependencies have been updated to their latest versions, including
stellar-baseto v10.0.1 which included a small patch (#897).
New Contributors
- @willemneal made their first contribution in #889
Full Changelog: v11.0.1...v11.1.0
v11.0.1
v11.0.0
This is the stable Protocol 20 release.
v11.0.0: Protocol 20, Soroban!
Breaking Changes
- The package has been renamed: it is now
@stellar/stellar-sdk. - The new minimum version is Node 18.
- The
soroban-clientlibrary (stellar/js-soroban-client) has been merged into this package, causing significant breaking changes in the module structure (#860):- The namespaces have changed to move each server-dependent component into its own module. Shared components (e.g.
TransactionBuilder) are still in the top level, Horizon-specific interactions are in theHorizonnamespace (i.e.Serveris nowHorizon.Server), and new Soroban RPC interactions are in theSorobanRpcnamespace. - There is a detailed migration guide available to outline both the literal (i.e. necessary code changes) and philosophical (i.e. how to find certain functionality) changes needed to adapt to this merge.
- The namespaces have changed to move each server-dependent component into its own module. Shared components (e.g.
- The
SorobanRpc.Server.prepareTransactionandSorobanRpc.assembleTransactionmethods no longer need an optionalnetworkPassphraseparameter, because it is implicitly part of the transaction already (#870). - Certain effects have been renamed to align better with the "tense" that other structures have (#844):
DepositLiquidityEffect->LiquidityPoolDepositedWithdrawLiquidityEffect->LiquidityPoolWithdrewLiquidityPoolTradeEffect->LiquidityPoolTradeLiquidityPoolCreatedEffect->LiquidityPoolCreatedLiquidityPoolRevokedEffect->LiquidityPoolRevokedLiquidityPoolRemovedEffect->LiquidityPoolRemoved
Added
- New effects have been added to support Protocol 20 (Soroban) (#842):
ContractCreditedoccurs when a Stellar asset moves into its corresponding Stellar Asset Contract instanceContractDebitedoccurs when a Stellar asset moves out of its corresponding Stellar Asset Contract instance
- Asset stat records (
ServerApi.AssetRecord) contain two new fields to support the Protocol 20 (Soroban) release (#841):num_contracts- the integer quantity of contracts that hold this assetcontracts_amount- the total units of that asset held by contracts
- New operation responses (#845):
invokeHostFunction: seeHorizon.InvokeHostFunctionOperationResponsebumpFootprintExpiration: seeHorizon.BumpFootprintExpirationOperationResponserestoreFootprint: seeHorizon.RestoreFootprintOperationResponse- You can refer to the actual definitions for details, but the gist of the schemas is below:
interface InvokeHostFunctionOperationResponse {
function: string;
parameters: {
value: string;
type: string;
}[];
address: string;
salt: string;
asset_balance_changes: {
type: string;
from: string;
to: string;
amount: string;
}[];
}
interface BumpFootprintExpirationOperationResponse {
ledgersToExpire: string;
}
interface RestoreFootprintOperationResponse {};Updated
- Build system has been overhauled to support Webpack 5 (#814).
stellar-basehas been updated to its corresponding overhaul (#818).- Bundle size has decreased by dropping unnecessary dependencies (
lodash: #822,es6-promise: #823, polyfills: #825,detect-node: #831). - Dependencies have been updated to their latest versions (#825, #827).
- The
stellar-baselibrary has been upgraded to support the latest Protocol 20 XDR schema and all Soroban functionality (#861).
Fixed
- Missing fields have been added to certain API responses (#801 and #797).
- Some effect definitions that were missing have been added (#842):
ClaimableBalanceClawedBackis now definedtype EffectRecordnow has all of the effect types
- The
PaymentCallBuilderwas incorrectly indicating that it would return a collection ofPaymentrecords, while in reality it can return a handful of "payment-like" records (#885).
New Contributors
- @jhuntbach-bc made their first contribution in #801
- @kknownymouss made their first contribution in #797
- @criadoperez made their first contribution in #853
- @IgorShadurin made their first contribution in #879
Full Changelog: v10.4.1...v11.0.0