@stellar/stellar-sdk 13.0.0-rc.2 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,12 +6,107 @@ A breaking change will get clearly marked in this log.
6
6
 
7
7
  ## Unreleased
8
8
 
9
- ## [v13.0.0-rc.2](https://github.com/stellar/js-stellar-sdk/compare/v12.3.0...v13.0.0-rc.2)
9
+
10
+ ## [v13.0.0](https://github.com/stellar/js-stellar-sdk/compare/v12.3.0...v13.0.0)
11
+ 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.
12
+
13
+ ### Breaking Changes
14
+ - We stopped supporting Node 18 explicitly a while ago, but now the Babelification of the codebase will transform to Node 18 instead of 16.
15
+
16
+ #### TypeScript Bindings: the `contract` module.
17
+ - `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)).
18
+ - The `ClientOptions.signTransaction` type has been updated to reflect the latest [SEP-43](https://stellar.org/protocol/sep-43#wallet-interface-format) protocol, which matches the latest major version of Freighter and other wallets. It now accepts `address`, `submit`, and `submitUrl` options, and it returns a promise containing the `signedTxXdr` and the `signerAddress`. It now also returns an `Error` type if an error occurs during signing.
19
+ * `basicNodeSigner` has been updated to reflect this new type.
20
+ - `ClientOptions.signAuthEntry` type has been updated to reflect the [SEP-43](https://stellar.org/protocol/sep-43#wallet-interface-format) protocol, which returns a promise containing the `signerAddress` in addition to the `signAuthEntry` that was returned previously. It also can return an `Error` type.
21
+ - `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:
22
+ ```diff
23
+ -SentTransaction(nonsense, realStuff)
24
+ +SentTransaction(realStuff)
25
+ -new SentTransaction(nonsense, realStuff)
26
+ +new SentTransaction(realStuff)
27
+ ```
28
+
29
+ #### Server APIs: the `rpc` and `Horizon` modules.
30
+ - Deprecated RPC APIs have been removed ([#1084](https://github.com/stellar/js-stellar-sdk/pull/1084)):
31
+ * `simulateTransaction`'s `cost` field is removed
32
+ * `rpc.Server.getEvents`'s `pagingToken` field is deprecated, use `cursor` instead
33
+ - Deprecated Horizon APIs have been removed (deprecated since [v10.0.1](https://github.com/stellar/js-stellar-sdk/releases/tag/v10.0.1), []()):
34
+ * removed fields `transaction_count`, `base_fee`, and `base_reserve`
35
+ * removed fields `num_accounts` and `amount` from assets
36
+ - The `SorobanRpc` import, previously deprecated, has been removed. You can import `rpc` instead:
37
+ ```diff
38
+ -import { SorobanRpc } from '@stellar/stellar-sdk'
39
+ +import { rpc } from '@stellar/stellar-sdk'
40
+ // alternatively, you can also import from the `rpc` entrypoint:
41
+ import { Server } from '@stellar/stellar-sdk/rpc'
42
+ ```
43
+
44
+ ### Added
45
+
46
+ #### TypeScript Bindings: the `contract` module.
47
+ * `contract.Client` now has a static `deploy` method 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 `__constructor` method in accordance with [CAP-42](https://stellar.org/protocol/cap-42) ([#1086](https://github.com/stellar/js-stellar-sdk/pull/1086/)). For example, using the `increment` test contract as modified in https://github.com/stellar/soroban-test-examples/pull/2/files#diff-8734809100be3803c3ce38064730b4578074d7c2dc5fb7c05ca802b2248b18afR10-R45:
48
+ ```typescript
49
+ const tx = await contract.Client.deploy(
50
+ { counter: 42 },
51
+ {
52
+ networkPassphrase,
53
+ rpcUrl,
54
+ wasmHash: uploadedWasmHash,
55
+ publicKey: someKeypair.publicKey(),
56
+ ...basicNodeSigner(someKeypair, networkPassphrase),
57
+ },
58
+ );
59
+ const { result: client } = await tx.signAndSend();
60
+ const t = await client.get();
61
+ expect(t.result, 42);
62
+ ```
63
+ * `contract.AssembledTransaction#signAuthEntries` now allows you to override `authorizeEntry`. This can be used to streamline novel workflows using cross-contract auth. ([#1044](https://github.com/stellar/js-stellar-sdk/pull/1044)).
64
+
65
+ #### Server modules: the `rpc`, `Horizon`, and `stellartoml` modules.
66
+ * `Horizon.ServerApi` now has an `EffectType` exported so that you can compare and infer effect types directly ([#1099](https://github.com/stellar/js-stellar-sdk/pull/1099)).
67
+ * `Horizon.ServerApi.Trade` type now has a `type_i` field for type inference ([#1099](https://github.com/stellar/js-stellar-sdk/pull/1099)).
68
+ * All effects now expose their type as an exact string ([#947](https://github.com/stellar/js-stellar-sdk/pull/947)).
69
+ * `stellartoml.Resolver.resolve` now has a `allowedRedirects` option to configure the number of allowed redirects to follow when resolving a stellar toml file.
70
+ * `rpc.Server.getEvents` now returns a `cursor` field that matches `pagingToken` and `id`
71
+ * `rpc.Server.getTransactions` now returns a `txHash` field
72
+ * `rpc.Server` has two new methods:
73
+ - `pollTransaction` to retry transaction retrieval ([#1092]https://github.com/stellar/js-stellar-sdk/pull/1092), and
74
+ - `getSACBalance` to fetch the balance of a built-in Stellar Asset Contract token held by a contract ([#1046](https://github.com/stellar/js-stellar-sdk/pull/1046)), returning this schema:
75
+ ```typescript
76
+ export interface BalanceResponse {
77
+ latestLedger: number;
78
+ /** present only on success, otherwise request malformed or no balance */
79
+ balanceEntry?: {
80
+ /** a 64-bit integer */
81
+ amount: string;
82
+ authorized: boolean;
83
+ clawback: boolean;
84
+
85
+ lastModifiedLedgerSeq?: number;
86
+ liveUntilLedgerSeq?: number;
87
+ };
88
+ }
89
+ ```
90
+
91
+ #### New bundles without dependencies
92
+ - You can now build the browser bundle without various dependencies:
93
+ * 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.
94
+ * You can import Node packages without the `axios` dependency via `@stellar/stellar-sdk/no-axios`. For Node environments that don't support modern imports, use `@stellar/stellar-sdk/lib/no-axios/index`.
95
+ * Set `USE_EVENTSOURCE=false` to build without the `eventsource` dependency: this will build `stellar-sdk-no-eventsource.js` and `stellar-sdk-no-eventsource.min.js` in the `dist/` directory, or just run `yarn build:browser:no-eventsource` to generate these files.
96
+ * You can import Node packages without the `eventsource` dependency via `@stellar/stellar-sdk/no-eventsource`. For Node.js environments that don't support modern imports, use `@stellar/stellar-sdk/lib/no-eventsource/index`.
97
+ * To use a minimal build without both Axios and EventSource, use `stellar-sdk-minimal.js` for the browser build and import from `@stellar/stellar-sdk/minimal` for the Node package.
98
+
99
+ ### Fixed
100
+ - `contract.AssembledTransaction#nonInvokerSigningBy` now correctly returns contract addresses, in instances of cross-contract auth, rather than throwing an error. `sign` will ignore these contract addresses, since auth happens via cross-contract call ([#1044](https://github.com/stellar/js-stellar-sdk/pull/1044)).
101
+ - `buildInvocationTree` now correctly handles V2 contract creation and displays constructor args ([js-stellar-base#785](https://github.com/stellar/js-stellar-base/pull/785)).
102
+
103
+
104
+ ## [v13.0.0-rc.2](https://github.com/stellar/js-stellar-sdk/compare/v13.0.0-rc.1...v13.0.0-rc.2)
10
105
 
11
106
  ### Breaking Changes
12
107
  - The `ClientOptions.signTransaction` type has been updated to reflect the latest [SEP-43](https://stellar.org/protocol/sep-43#wallet-interface-format) protocol, which matches the latest major version of Freighter and other wallets. It now accepts `address`, `submit`, and `submitUrl` options, and it returns a promise containing the `signedTxXdr` and the `signerAddress`. It now also returns an `Error` type if an error occurs during signing.
13
108
  * `basicNodeSigner` has been updated to reflect the new type.
14
- - `ClientOptions.signAuthEntry` type has also been updated to reflect the [SEP-43](https://stellar.org/protocol/sep-43#wallet-interface-format) protocol, which also returns a promise containing the `signerAddress` in addition to the `signAuthEntry` that was returned previously. It also can return an `Error` type.
109
+ - `ClientOptions.signAuthEntry` type has also been updated to reflect the [SEP-43](https://stellar.org/protocol/sep-43#wallet-interface-format) protocol, which also returns a promise containing the `signerAddress` in addition to the `signAuthEntry` that was returned previously. It also can return an `Error` type.
15
110
 
16
111
  ### Added
17
112
  * `contract.Client` now has a static `deploy` method 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 `__constructor` method in accordance with CAP-42 ([#1086](https://github.com/stellar/js-stellar-sdk/pull/1086/)).
@@ -38,7 +133,7 @@ For example, using the `increment` test contract as modified in https://github.c
38
133
  * `stellartoml-Resolver.resolve` now has a `allowedRedirects` option to configure the number of allowed redirects to follow when resolving a stellar toml file.
39
134
 
40
135
 
41
- ## [v13.0.0-rc.1](https://github.com/stellar/js-stellar-sdk/compare/v12.3.0...v13.0.0-rc.1)
136
+ ## [v13.0.0-rc.1](https://github.com/stellar/js-stellar-sdk/compare/v13.0.0-beta.1...v13.0.0-rc.1)
42
137
 
43
138
  ### Breaking Changes
44
139
  - Deprecated RPC APIs have been removed ([#1084](https://github.com/stellar/js-stellar-sdk/pull/1084)):
@@ -11063,6 +11063,12 @@ exports.walkInvocationTree = walkInvocationTree;
11063
11063
  var _asset = __webpack_require__(1764);
11064
11064
  var _address = __webpack_require__(1180);
11065
11065
  var _scval = __webpack_require__(7177);
11066
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11067
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11068
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11069
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11070
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
11071
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11066
11072
  /**
11067
11073
  * @typedef CreateInvocation
11068
11074
  *
@@ -11076,6 +11082,9 @@ var _scval = __webpack_require__(7177);
11076
11082
  * @prop {string} wasm.address contract address of this deployment
11077
11083
  * @prop {string} wasm.salt hex salt that the user consumed when creating
11078
11084
  * this contract (encoded in the resulting address)
11085
+ * @prop {any[]} [wasm.constructorArgs] a list of natively-represented values
11086
+ * (see {@link scValToNative}) that are passed to the constructor when
11087
+ * creating this contract
11079
11088
  */
11080
11089
 
11081
11090
  /**
@@ -11084,8 +11093,8 @@ var _scval = __webpack_require__(7177);
11084
11093
  * @prop {string} source the strkey of the contract (C...) being invoked
11085
11094
  * @prop {string} function the name of the function being invoked
11086
11095
  * @prop {any[]} args the natively-represented parameters to the function
11087
- * invocation (see {@link scValToNative}) for rules on how they're
11088
- * represented a JS types
11096
+ * invocation (see {@link scValToNative} for rules on how they're
11097
+ * represented a JS types)
11089
11098
  */
11090
11099
 
11091
11100
  /**
@@ -11146,7 +11155,7 @@ function buildInvocationTree(root) {
11146
11155
  /** @type {InvocationTree} */
11147
11156
  var output = {};
11148
11157
 
11149
- /** @type {xdr.CreateContractArgs | xdr.InvokeContractArgs} */
11158
+ /** @type {xdr.CreateContractArgs|xdr.CreateContractArgsV2|xdr.InvokeContractArgs} */
11150
11159
  var inner = fn.value();
11151
11160
  switch (fn["switch"]().value) {
11152
11161
  // sorobanAuthorizedFunctionTypeContractFn
@@ -11162,8 +11171,11 @@ function buildInvocationTree(root) {
11162
11171
  break;
11163
11172
 
11164
11173
  // sorobanAuthorizedFunctionTypeCreateContractHostFn
11165
- case 1:
11174
+ // sorobanAuthorizedFunctionTypeCreateContractV2HostFn
11175
+ case 1: // fallthrough: just no ctor args in V1
11176
+ case 2:
11166
11177
  {
11178
+ var createV2 = fn["switch"]().value === 2;
11167
11179
  output.type = 'create';
11168
11180
  output.args = {};
11169
11181
 
@@ -11187,11 +11199,15 @@ function buildInvocationTree(root) {
11187
11199
  /** @type {xdr.ContractIdPreimageFromAddress} */
11188
11200
  var details = preimage.fromAddress();
11189
11201
  output.args.type = 'wasm';
11190
- output.args.wasm = {
11202
+ output.args.wasm = _objectSpread({
11191
11203
  salt: details.salt().toString('hex'),
11192
11204
  hash: exec.wasmHash().toString('hex'),
11193
11205
  address: _address.Address.fromScAddress(details.address()).toString()
11194
- };
11206
+ }, createV2 && {
11207
+ constructorArgs: inner.constructorArgs().map(function (arg) {
11208
+ return (0, _scval.scValToNative)(arg);
11209
+ })
11210
+ });
11195
11211
  break;
11196
11212
  }
11197
11213
 
@@ -27714,7 +27730,7 @@ var http_client = __webpack_require__(6371);
27714
27730
  function horizon_axios_client_typeof(o) { "@babel/helpers - typeof"; return horizon_axios_client_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, horizon_axios_client_typeof(o); }
27715
27731
 
27716
27732
 
27717
- var version = "13.0.0-rc.2";
27733
+ var version = "13.0.0";
27718
27734
  var SERVER_TIME_MAP = {};
27719
27735
  var AxiosClient = (0,http_client/* create */.vt)({
27720
27736
  headers: {
@@ -29922,7 +29938,7 @@ var lib = __webpack_require__(356);
29922
29938
  var http_client = __webpack_require__(6371);
29923
29939
  ;// ./src/rpc/axios.ts
29924
29940
 
29925
- var version = "13.0.0-rc.2";
29941
+ var version = "13.0.0";
29926
29942
  var AxiosClient = (0,http_client/* create */.vt)({
29927
29943
  headers: {
29928
29944
  'X-Client-Name': 'js-soroban-client',