v13.0.0: Protocol 22
This is a direct re-tag of rc.2 with the only change being an upgrade to the stellar-base library to incorporate a patch release. Nonetheless, the entire changelog from the prior major version here is replicated for a comprehensive view on what's broken, added, and fixed.
Breaking Changes
- We stopped supporting Node 18 explicitly a while ago, but now the Babelification of the codebase will transform to Node 18 instead of 16.
TypeScript Bindings: the contract module.
contract.AssembledTransaction#signAuthEntriesnow takes anaddressinstead of apublicKey. 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).- The
ClientOptions.signTransactiontype has been updated to reflect the latest SEP-43 protocol, which matches the latest major version of Freighter and other wallets. It now acceptsaddress,submit, andsubmitUrloptions, and it returns a promise containing thesignedTxXdrand thesignerAddress. It now also returns anErrortype if an error occurs during signing.basicNodeSignerhas been updated to reflect this new type.
ClientOptions.signAuthEntrytype has been updated to reflect the SEP-43 protocol, which returns a promise containing thesignerAddressin addition to thesignAuthEntrythat was returned previously. It also can return anErrortype.SentTransaction.initandnew SentTransactionnow take one (1) argument instead of two (2). The first argument had previously been deprecated and ignored. To update:
-SentTransaction(nonsense, realStuff)
+SentTransaction(realStuff)
-new SentTransaction(nonsense, realStuff)
+new SentTransaction(realStuff)Server APIs: the rpc and Horizon modules.
- Deprecated RPC APIs have been removed (#1084):
simulateTransaction'scostfield is removedrpc.Server.getEvents'spagingTokenfield is deprecated, usecursorinstead
- Deprecated Horizon APIs have been removed (deprecated since v10.0.1, ):
- removed fields
transaction_count,base_fee, andbase_reserve - removed fields
num_accountsandamountfrom assets
- removed fields
- The
SorobanRpcimport, previously deprecated, has been removed. You can importrpcinstead:
-import { SorobanRpc } from '@stellar/stellar-sdk'
+import { rpc } from '@stellar/stellar-sdk'
// alternatively, you can also import from the `rpc` entrypoint:
import { Server } from '@stellar/stellar-sdk/rpc'Added
TypeScript Bindings: the contract module.
contract.Clientnow has a staticdeploymethod that can be used to deploy a contract instance from an existing uploaded/"installed" Wasm hash. The first arguments to this method are the arguments for the contract's__constructormethod in accordance with CAP-42 (#1086). For example, using theincrementtest contract as modified in https://github.com/stellar/soroban-test-examples/pull/2/files#diff-8734809100be3803c3ce38064730b4578074d7c2dc5fb7c05ca802b2248b18afR10-R45:
const tx = await contract.Client.deploy(
{ counter: 42 },
{
networkPassphrase,
rpcUrl,
wasmHash: uploadedWasmHash,
publicKey: someKeypair.publicKey(),
...basicNodeSigner(someKeypair, networkPassphrase),
},
);
const { result: client } = await tx.signAndSend();
const t = await client.get();
expect(t.result, 42);contract.AssembledTransaction#signAuthEntriesnow allows you to overrideauthorizeEntry. This can be used to streamline novel workflows using cross-contract auth. (#1044).
Server modules: the rpc, Horizon, and stellartoml modules.
Horizon.ServerApinow has anEffectTypeexported so that you can compare and infer effect types directly (#1099).Horizon.ServerApi.Tradetype now has atype_ifield for type inference (#1099).- All effects now expose their type as an exact string (#947).
stellartoml.Resolver.resolvenow has aallowedRedirectsoption to configure the number of allowed redirects to follow when resolving a stellar toml file.rpc.Server.getEventsnow returns acursorfield that matchespagingTokenandidrpc.Server.getTransactionsnow returns atxHashfieldrpc.Serverhas two new methods:
export interface BalanceResponse {
latestLedger: number;
/** present only on success, otherwise request malformed or no balance */
balanceEntry?: {
/** a 64-bit integer */
amount: string;
authorized: boolean;
clawback: boolean;
lastModifiedLedgerSeq?: number;
liveUntilLedgerSeq?: number;
};
}New bundles without dependencies
- You can now build the browser bundle without various dependencies:
- Set
USE_AXIOS=falseto build without theaxiosdependency: this will buildstellar-sdk-no-axios.jsandstellar-sdk-no-axios.min.jsin thedist/directory, or just runyarn build:browser:no-axiosto generate these files. - You can import Node packages without the
axiosdependency via@stellar/stellar-sdk/no-axios. For Node environments that don't support modern imports, use@stellar/stellar-sdk/lib/no-axios/index. - Set
USE_EVENTSOURCE=falseto build without theeventsourcedependency: this will buildstellar-sdk-no-eventsource.jsandstellar-sdk-no-eventsource.min.jsin thedist/directory, or just runyarn build:browser:no-eventsourceto generate these files. - You can import Node packages without the
eventsourcedependency via@stellar/stellar-sdk/no-eventsource. For Node.js environments that don't support modern imports, use@stellar/stellar-sdk/lib/no-eventsource/index. - To use a minimal build without both Axios and EventSource, use
stellar-sdk-minimal.jsfor the browser build and import from@stellar/stellar-sdk/minimalfor the Node package.
- Set
Fixed
contract.AssembledTransaction#nonInvokerSigningBynow correctly returns contract addresses, in instances of cross-contract auth, rather than throwing an error.signwill ignore these contract addresses, since auth happens via cross-contract call (#1044).buildInvocationTreenow correctly handles V2 contract creation and displays constructor args (js-stellar-base#785).