@stellar/stellar-sdk 13.0.0-rc.2 → 13.1.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +112 -7
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk-minimal.js +448 -77
  4. package/dist/stellar-sdk-minimal.min.js +1 -1
  5. package/dist/stellar-sdk-no-axios.js +1044 -234
  6. package/dist/stellar-sdk-no-axios.min.js +1 -1
  7. package/dist/stellar-sdk-no-eventsource.js +171 -148
  8. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  9. package/dist/stellar-sdk.js +767 -305
  10. package/dist/stellar-sdk.min.js +1 -1
  11. package/lib/friendbot/index.d.ts +1 -0
  12. package/lib/horizon/call_builder.d.ts +1 -1
  13. package/lib/horizon/horizon_api.d.ts +13 -0
  14. package/lib/horizon/horizon_axios_client.js +1 -1
  15. package/lib/horizon/server.d.ts +5 -0
  16. package/lib/horizon/server.js +80 -59
  17. package/lib/minimal/friendbot/index.d.ts +1 -0
  18. package/lib/minimal/horizon/call_builder.d.ts +1 -1
  19. package/lib/minimal/horizon/horizon_api.d.ts +13 -0
  20. package/lib/minimal/horizon/horizon_axios_client.js +1 -1
  21. package/lib/minimal/horizon/server.d.ts +5 -0
  22. package/lib/minimal/horizon/server.js +80 -59
  23. package/lib/minimal/rpc/api.d.ts +2 -1
  24. package/lib/minimal/rpc/axios.js +1 -1
  25. package/lib/minimal/rpc/parsers.js +1 -0
  26. package/lib/minimal/rpc/server.js +27 -8
  27. package/lib/no-axios/friendbot/index.d.ts +1 -0
  28. package/lib/no-axios/horizon/call_builder.d.ts +1 -1
  29. package/lib/no-axios/horizon/horizon_api.d.ts +13 -0
  30. package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
  31. package/lib/no-axios/horizon/server.d.ts +5 -0
  32. package/lib/no-axios/horizon/server.js +80 -59
  33. package/lib/no-axios/rpc/api.d.ts +2 -1
  34. package/lib/no-axios/rpc/axios.js +1 -1
  35. package/lib/no-axios/rpc/parsers.js +1 -0
  36. package/lib/no-axios/rpc/server.js +27 -8
  37. package/lib/no-eventsource/friendbot/index.d.ts +1 -0
  38. package/lib/no-eventsource/horizon/call_builder.d.ts +1 -1
  39. package/lib/no-eventsource/horizon/horizon_api.d.ts +13 -0
  40. package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
  41. package/lib/no-eventsource/horizon/server.d.ts +5 -0
  42. package/lib/no-eventsource/horizon/server.js +80 -59
  43. package/lib/no-eventsource/rpc/api.d.ts +2 -1
  44. package/lib/no-eventsource/rpc/axios.js +1 -1
  45. package/lib/no-eventsource/rpc/parsers.js +1 -0
  46. package/lib/no-eventsource/rpc/server.js +27 -8
  47. package/lib/rpc/api.d.ts +2 -1
  48. package/lib/rpc/axios.js +1 -1
  49. package/lib/rpc/parsers.js +1 -0
  50. package/lib/rpc/server.js +27 -8
  51. package/package.json +11 -11
package/CHANGELOG.md CHANGED
@@ -6,12 +6,117 @@ 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.1.0](https://github.com/stellar/js-stellar-sdk/compare/v13.0.0...v13.1.0)
11
+
12
+ ### Added
13
+ * Added `Horizon.Server.root` to obtain information from the Horizon root endpoint ([#1122](https://github.com/stellar/js-stellar-sdk/pull/1122/)).
14
+
15
+ ### Fixed
16
+ * When using a friendbot that points to a Horizon instance that has ledger metadata disabled, you can no longer extract the account sequence from the response. Instead, we hit RPC directly ([#1107](https://github.com/stellar/js-stellar-sdk/pull/1107/)).
17
+ * `rpc.Server.getEvents()` now correctly returns the `cursor` field at the top-level response ([#1124](https://github.com/stellar/js-stellar-sdk/pull/1124)).
18
+
19
+
20
+ ## [v13.0.0](https://github.com/stellar/js-stellar-sdk/compare/v12.3.0...v13.0.0)
21
+ 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.
22
+
23
+ ### Breaking Changes
24
+ - We stopped supporting Node 18 explicitly a while ago, but now the Babelification of the codebase will transform to Node 18 instead of 16.
25
+
26
+ #### TypeScript Bindings: the `contract` module.
27
+ - `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)).
28
+ - 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.
29
+ * `basicNodeSigner` has been updated to reflect this new type.
30
+ - `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.
31
+ - `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:
32
+ ```diff
33
+ -SentTransaction(nonsense, realStuff)
34
+ +SentTransaction(realStuff)
35
+ -new SentTransaction(nonsense, realStuff)
36
+ +new SentTransaction(realStuff)
37
+ ```
38
+
39
+ #### Server APIs: the `rpc` and `Horizon` modules.
40
+ - Deprecated RPC APIs have been removed ([#1084](https://github.com/stellar/js-stellar-sdk/pull/1084)):
41
+ * `simulateTransaction`'s `cost` field is removed
42
+ * `rpc.Server.getEvents`'s `pagingToken` field is deprecated, use `cursor` instead
43
+ - Deprecated Horizon APIs have been removed (deprecated since [v10.0.1](https://github.com/stellar/js-stellar-sdk/releases/tag/v10.0.1), []()):
44
+ * removed fields `transaction_count`, `base_fee`, and `base_reserve`
45
+ * removed fields `num_accounts` and `amount` from assets
46
+ - The `SorobanRpc` import, previously deprecated, has been removed. You can import `rpc` instead:
47
+ ```diff
48
+ -import { SorobanRpc } from '@stellar/stellar-sdk'
49
+ +import { rpc } from '@stellar/stellar-sdk'
50
+ // alternatively, you can also import from the `rpc` entrypoint:
51
+ import { Server } from '@stellar/stellar-sdk/rpc'
52
+ ```
53
+
54
+ ### Added
55
+
56
+ #### TypeScript Bindings: the `contract` module.
57
+ * `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:
58
+ ```typescript
59
+ const tx = await contract.Client.deploy(
60
+ { counter: 42 },
61
+ {
62
+ networkPassphrase,
63
+ rpcUrl,
64
+ wasmHash: uploadedWasmHash,
65
+ publicKey: someKeypair.publicKey(),
66
+ ...basicNodeSigner(someKeypair, networkPassphrase),
67
+ },
68
+ );
69
+ const { result: client } = await tx.signAndSend();
70
+ const t = await client.get();
71
+ expect(t.result, 42);
72
+ ```
73
+ * `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)).
74
+
75
+ #### Server modules: the `rpc`, `Horizon`, and `stellartoml` modules.
76
+ * `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)).
77
+ * `Horizon.ServerApi.Trade` type now has a `type_i` field for type inference ([#1099](https://github.com/stellar/js-stellar-sdk/pull/1099)).
78
+ * All effects now expose their type as an exact string ([#947](https://github.com/stellar/js-stellar-sdk/pull/947)).
79
+ * `stellartoml.Resolver.resolve` now has a `allowedRedirects` option to configure the number of allowed redirects to follow when resolving a stellar toml file.
80
+ * `rpc.Server.getEvents` now returns a `cursor` field that matches `pagingToken` and `id`
81
+ * `rpc.Server.getTransactions` now returns a `txHash` field
82
+ * `rpc.Server` has two new methods:
83
+ - `pollTransaction` to retry transaction retrieval ([#1092]https://github.com/stellar/js-stellar-sdk/pull/1092), and
84
+ - `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:
85
+ ```typescript
86
+ export interface BalanceResponse {
87
+ latestLedger: number;
88
+ /** present only on success, otherwise request malformed or no balance */
89
+ balanceEntry?: {
90
+ /** a 64-bit integer */
91
+ amount: string;
92
+ authorized: boolean;
93
+ clawback: boolean;
94
+
95
+ lastModifiedLedgerSeq?: number;
96
+ liveUntilLedgerSeq?: number;
97
+ };
98
+ }
99
+ ```
100
+
101
+ #### New bundles without dependencies
102
+ - You can now build the browser bundle without various dependencies:
103
+ * 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.
104
+ * 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`.
105
+ * 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.
106
+ * 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`.
107
+ * 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.
108
+
109
+ ### Fixed
110
+ - `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)).
111
+ - `buildInvocationTree` now correctly handles V2 contract creation and displays constructor args ([js-stellar-base#785](https://github.com/stellar/js-stellar-base/pull/785)).
112
+
113
+
114
+ ## [v13.0.0-rc.2](https://github.com/stellar/js-stellar-sdk/compare/v13.0.0-rc.1...v13.0.0-rc.2)
10
115
 
11
116
  ### Breaking Changes
12
117
  - 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
118
  * `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.
119
+ - `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
120
 
16
121
  ### Added
17
122
  * `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 +143,7 @@ For example, using the `increment` test contract as modified in https://github.c
38
143
  * `stellartoml-Resolver.resolve` now has a `allowedRedirects` option to configure the number of allowed redirects to follow when resolving a stellar toml file.
39
144
 
40
145
 
41
- ## [v13.0.0-rc.1](https://github.com/stellar/js-stellar-sdk/compare/v12.3.0...v13.0.0-rc.1)
146
+ ## [v13.0.0-rc.1](https://github.com/stellar/js-stellar-sdk/compare/v13.0.0-beta.1...v13.0.0-rc.1)
42
147
 
43
148
  ### Breaking Changes
44
149
  - Deprecated RPC APIs have been removed ([#1084](https://github.com/stellar/js-stellar-sdk/pull/1084)):
@@ -203,7 +308,7 @@ interface FeeDistribution {
203
308
 
204
309
  ### Added
205
310
  - `rpc.server.simulateTransaction` now supports an optional `stateChanges?: LedgerEntryChange[]` field ([#963](https://github.com/stellar/js-stellar-sdk/pull/963)):
206
- * If `Before` is omitted, it constitutes a creation, if `After` is omitted, it constitutes a deletions, note that `Before` and `After` cannot be be omitted at the same time. Each item follows this schema:
311
+ * If `Before` is omitted, it constitutes a creation, if `After` is omitted, it constitutes a deletions, note that `Before` and `After` cannot be omitted at the same time. Each item follows this schema:
207
312
 
208
313
  ```typescript
209
314
  interface LedgerEntryChange {
@@ -253,7 +358,7 @@ import {
253
358
  +import { Spec } from '@stellar/stellar-sdk/contract'
254
359
  ```
255
360
 
256
- - Previously, `AssembledTransaction.signAndSend()` would return a `SentTransaction` even if the transaction never finalized. That is, if it successfully sent the transaction to the network, but the transaction was still `status: 'PENDING'`, then it would `console.error` an error message, but return the indeterminate transaction anyhow. **It now throws** a `SentTransaction.Errors.TransactionStillPending` error with that error message instead ([#962](https://github.com/stellar/js-stellar-sdk/pull/962)).
361
+ - Previously, `AssembledTransaction.signAndSend()` would return a `SentTransaction` even if the transaction was never finalized. That is, if it successfully sent the transaction to the network, but the transaction was still `status: 'PENDING'`, then it would `console.error` an error message, but return the indeterminate transaction anyhow. **It now throws** a `SentTransaction.Errors.TransactionStillPending` error with that error message instead ([#962](https://github.com/stellar/js-stellar-sdk/pull/962)).
257
362
 
258
363
  ### Deprecated
259
364
 
@@ -637,7 +742,7 @@ Refer to the release notes for the betas (e.g. [v9.0.0-beta.0](https://github.co
637
742
 
638
743
  ### Updates
639
744
 
640
- - Updates the following SEP-10 utility functions to be compilant with the protocols ([#709](https://github.com/stellar/js-stellar-sdk/pull/709/), [stellar-protocol/#1036](https://github.com/stellar/stellar-protocol/pull/1036))
745
+ - Updates the following SEP-10 utility functions to be compliant with the protocols ([#709](https://github.com/stellar/js-stellar-sdk/pull/709/), [stellar-protocol/#1036](https://github.com/stellar/stellar-protocol/pull/1036))
641
746
  - Updated `utils.buildChallengeTx()` to accept muxed accounts (`M...`) for client account IDs
642
747
  - Updated `utils.buildChallengeTx()` to accept a `memo` parameter to attach to the challenge transaction
643
748
  - Updated `utils.readChallengeTx()` to provide a `memo` property in the returned object
@@ -957,7 +1062,7 @@ The following functions were renamed:
957
1062
  - `xdr.OperationType.setOption()` -> `xdr.OperationType.setOptions()`
958
1063
  - `xdr.OperationType.manageDatum()` -> `xdr.OperationType.manageData()`
959
1064
 
960
- The following enum values were rename in `OperationType`:
1065
+ The following enum values were renamed in `OperationType`:
961
1066
 
962
1067
  - `setOption` -> `setOptions`
963
1068
  - `manageDatum` -> `manageData`
package/README.md CHANGED
@@ -65,7 +65,7 @@ You can use a CDN:
65
65
  <script src="https://cdnjs.cloudflare.com/ajax/libs/stellar-sdk/{version}/stellar-sdk.js"></script>
66
66
  ```
67
67
 
68
- Note that this method relies using a third party to host the JS library. This may not be entirely secure. You can self-host it via [Bower](http://bower.io):
68
+ Note that this method relies on using a third party to host the JS library. This may not be entirely secure. You can self-host it via [Bower](http://bower.io):
69
69
 
70
70
  ```shell
71
71
  bower install @stellar/stellar-sdk