@stellar/stellar-sdk 12.0.0 → 12.0.1

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 (97) hide show
  1. package/CHANGELOG.md +98 -1
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +2796 -1194
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/browser.js +1 -1
  6. package/lib/config.js +3 -3
  7. package/lib/{contract_client → contract}/assembled_transaction.d.ts +74 -54
  8. package/lib/{contract_client → contract}/assembled_transaction.js +149 -167
  9. package/lib/{contract_client → contract}/basic_node_signer.d.ts +2 -2
  10. package/lib/{contract_client → contract}/basic_node_signer.js +5 -5
  11. package/lib/contract/client.d.ts +52 -0
  12. package/lib/contract/client.js +177 -0
  13. package/lib/contract/index.d.ts +7 -0
  14. package/lib/{contract_client → contract}/index.js +19 -8
  15. package/lib/{rust_types/result.js → contract/rust_result.js} +3 -3
  16. package/lib/{contract_client → contract}/sent_transaction.d.ts +26 -14
  17. package/lib/{contract_client → contract}/sent_transaction.js +51 -32
  18. package/lib/{contract_spec.d.ts → contract/spec.d.ts} +3 -3
  19. package/lib/{contract_spec.js → contract/spec.js} +169 -169
  20. package/lib/{contract_client → contract}/types.d.ts +10 -8
  21. package/lib/contract/utils.d.ts +41 -0
  22. package/lib/{contract_client → contract}/utils.js +15 -5
  23. package/lib/errors.js +10 -10
  24. package/lib/federation/server.js +10 -10
  25. package/lib/horizon/account_call_builder.d.ts +1 -0
  26. package/lib/horizon/account_call_builder.js +8 -8
  27. package/lib/horizon/account_response.js +7 -7
  28. package/lib/horizon/assets_call_builder.d.ts +1 -0
  29. package/lib/horizon/assets_call_builder.js +8 -8
  30. package/lib/horizon/call_builder.js +6 -6
  31. package/lib/horizon/claimable_balances_call_builder.d.ts +1 -0
  32. package/lib/horizon/claimable_balances_call_builder.js +8 -8
  33. package/lib/horizon/effect_call_builder.d.ts +1 -0
  34. package/lib/horizon/effect_call_builder.js +8 -8
  35. package/lib/horizon/friendbot_builder.d.ts +1 -0
  36. package/lib/horizon/friendbot_builder.js +8 -8
  37. package/lib/horizon/horizon_api.d.ts +1 -0
  38. package/lib/horizon/horizon_axios_client.js +1 -1
  39. package/lib/horizon/ledger_call_builder.d.ts +1 -0
  40. package/lib/horizon/ledger_call_builder.js +8 -8
  41. package/lib/horizon/liquidity_pool_call_builder.d.ts +1 -0
  42. package/lib/horizon/liquidity_pool_call_builder.js +8 -8
  43. package/lib/horizon/offer_call_builder.d.ts +1 -0
  44. package/lib/horizon/offer_call_builder.js +8 -8
  45. package/lib/horizon/operation_call_builder.d.ts +1 -0
  46. package/lib/horizon/operation_call_builder.js +8 -8
  47. package/lib/horizon/orderbook_call_builder.d.ts +1 -0
  48. package/lib/horizon/orderbook_call_builder.js +8 -8
  49. package/lib/horizon/path_call_builder.d.ts +1 -0
  50. package/lib/horizon/path_call_builder.js +8 -8
  51. package/lib/horizon/payment_call_builder.d.ts +1 -0
  52. package/lib/horizon/payment_call_builder.js +8 -8
  53. package/lib/horizon/server.js +6 -6
  54. package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -0
  55. package/lib/horizon/strict_receive_path_call_builder.js +8 -8
  56. package/lib/horizon/strict_send_path_call_builder.d.ts +1 -0
  57. package/lib/horizon/strict_send_path_call_builder.js +8 -8
  58. package/lib/horizon/trade_aggregation_call_builder.d.ts +1 -0
  59. package/lib/horizon/trade_aggregation_call_builder.js +8 -8
  60. package/lib/horizon/trades_call_builder.d.ts +1 -0
  61. package/lib/horizon/trades_call_builder.js +8 -8
  62. package/lib/horizon/transaction_call_builder.d.ts +1 -0
  63. package/lib/horizon/transaction_call_builder.js +8 -8
  64. package/lib/index.d.ts +27 -2
  65. package/lib/index.js +10 -16
  66. package/lib/{soroban → rpc}/api.d.ts +25 -10
  67. package/lib/{soroban → rpc}/axios.js +1 -1
  68. package/lib/{soroban → rpc}/browser.js +1 -1
  69. package/lib/rpc/index.d.ts +8 -0
  70. package/lib/{soroban → rpc}/index.js +1 -1
  71. package/lib/{soroban → rpc}/jsonrpc.js +3 -3
  72. package/lib/{soroban → rpc}/parsers.js +12 -3
  73. package/lib/{soroban → rpc}/server.d.ts +50 -0
  74. package/lib/{soroban → rpc}/server.js +209 -128
  75. package/lib/stellartoml/index.js +6 -6
  76. package/lib/utils.js +3 -3
  77. package/lib/webauth/errors.js +10 -10
  78. package/lib/webauth/utils.js +9 -9
  79. package/package.json +32 -15
  80. package/lib/contract_client/client.d.ts +0 -17
  81. package/lib/contract_client/client.js +0 -57
  82. package/lib/contract_client/index.d.ts +0 -6
  83. package/lib/contract_client/utils.d.ts +0 -23
  84. package/lib/rust_types/index.d.ts +0 -1
  85. package/lib/rust_types/index.js +0 -16
  86. package/lib/soroban/index.d.ts +0 -7
  87. /package/lib/{rust_types/result.d.ts → contract/rust_result.d.ts} +0 -0
  88. /package/lib/{contract_client → contract}/types.js +0 -0
  89. /package/lib/{soroban → rpc}/api.js +0 -0
  90. /package/lib/{soroban → rpc}/axios.d.ts +0 -0
  91. /package/lib/{soroban → rpc}/browser.d.ts +0 -0
  92. /package/lib/{soroban → rpc}/jsonrpc.d.ts +0 -0
  93. /package/lib/{soroban → rpc}/parsers.d.ts +0 -0
  94. /package/lib/{soroban → rpc}/transaction.d.ts +0 -0
  95. /package/lib/{soroban → rpc}/transaction.js +0 -0
  96. /package/lib/{soroban → rpc}/utils.d.ts +0 -0
  97. /package/lib/{soroban → rpc}/utils.js +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,103 @@ A breaking change will get clearly marked in this log.
7
7
  ## Unreleased
8
8
 
9
9
 
10
+ ## [v12.0.1](https://github.com/stellar/js-stellar-sdk/compare/v11.3.0...v12.0.1)
11
+
12
+ - This is a re-tag of `v12.0.0-rc.3` with dependency updates and a single new feature.
13
+
14
+ ### Added
15
+ - `rpc.server.simulateTransaction` now supports an optional `stateChanges?: LedgerEntryChange[]` field ([#963](https://github.com/stellar/js-stellar-sdk/pull/963)):
16
+ * 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:
17
+
18
+ ```typescript
19
+ interface LedgerEntryChange {
20
+ type: number;
21
+ key: xdr.LedgerKey;
22
+ before: xdr.LedgerEntry | null;
23
+ after: xdr.LedgerEntry | null;
24
+ }
25
+ ```
26
+
27
+
28
+ ## [v12.0.0-rc.3](https://github.com/stellar/js-stellar-sdk/compare/v11.3.0...v12.0.0-rc.3)
29
+
30
+ ### Breaking Changes
31
+
32
+ - `ContractClient` functionality previously added in [v11.3.0](https://github.com/stellar/js-stellar-sdk/releases/tag/v11.3.0) was exported in a non-standard way. You can now import it as any other `stellar-sdk` module ([#962](https://github.com/stellar/js-stellar-sdk/pull/962)):
33
+
34
+ ```diff
35
+ -import { ContractClient } from '@stellar/stellar-sdk/lib/contract_client'
36
+ +import { contract } from '@stellar/stellar-sdk'
37
+ +const { Client } = contract
38
+ ```
39
+
40
+ Note 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](https://github.com/stellar/js-stellar-base/blob/b96281b9b3f94af23a913f93bdb62477f5434ccc/src/contract.js#L6-L19). 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.
41
+
42
+ Additionally, this is available from the `/contract` entrypoint, if your version of Node [and TypeScript](https://stackoverflow.com/a/70020984/249801) support [the `exports` declaration](https://nodejs.org/api/packages.html#exports). Finally, some of its exports have been renamed:
43
+
44
+ ```diff
45
+ import {
46
+ - ContractClient,
47
+ + Client,
48
+ AssembledTransaction,
49
+ - ContractClientOptions,
50
+ + ClientOptions,
51
+ SentTransaction,
52
+ -} from '@stellar/stellar-sdk/lib/contract_client'
53
+ +} from '@stellar/stellar-sdk/contract'
54
+ ```
55
+
56
+ - The `ContractSpec` class is now nested under the `contract` module, and has been **renamed** to `Spec` ([#962](https://github.com/stellar/js-stellar-sdk/pull/962)). Alternatively, you can import this from the `contract` entrypoint, if your version of Node [and TypeScript](https://stackoverflow.com/a/70020984/249801) support [the `exports` declaration](https://nodejs.org/api/packages.html#exports):
57
+
58
+ ```diff
59
+ -import { ContractSpec } from '@stellar/stellar-sdk'
60
+ +import { contract } from '@stellar/stellar-sdk'
61
+ +const { Spec } = contract
62
+ // OR
63
+ +import { Spec } from '@stellar/stellar-sdk/contract'
64
+ ```
65
+
66
+ - 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)).
67
+
68
+ ### Deprecated
69
+
70
+ - `SorobanRpc` module is now also exported as `rpc` ([#962](https://github.com/stellar/js-stellar-sdk/pull/962)). You can import it with either name for now, but `SorobanRpc` will be removed in a future release:
71
+
72
+ ```diff
73
+ -import { SorobanRpc } from '@stellar/stellar-sdk'
74
+ +import { rpc } from '@stellar/stellar-sdk'
75
+ ```
76
+
77
+ You can also now import it at the `/rpc` entrypoint, if your version of Node [and TypeScript](https://stackoverflow.com/a/70020984/249801) support [the `exports` declaration](https://nodejs.org/api/packages.html#exports).
78
+
79
+ ```diff
80
+ -import { SorobanRpc } from '@stellar/stellar-sdk'
81
+ -const { Api } = SorobanRpc
82
+ +import { Api } from '@stellar/stellar-sdk/rpc'
83
+ ```
84
+
85
+ ### Added
86
+ * New methods on `contract.Client` ([#960](https://github.com/stellar/js-stellar-sdk/pull/960)):
87
+ - `from(opts: ContractClientOptions)` instantiates `contract.Client` by fetching the `contractId`'s WASM from the network to fill out the client's `ContractSpec`.
88
+ - `fromWasm` and `fromWasmHash` methods to instantiate a `contract.Client` when you already have the WASM bytes or hash alongside the `contract.ClientOptions`.
89
+ * New methods on `rpc.Server` ([#960](https://github.com/stellar/js-stellar-sdk/pull/960)):
90
+ - `getContractWasmByContractId` and `getContractWasmByHash` to retrieve a contract's WASM bytecode via its `contractId` or `wasmHash`, respectively.
91
+
92
+ ### Fixed
93
+ * 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 `contract` module to be used in non-Node environments.
94
+
95
+
96
+ ## [v12.0.0-rc.2](https://github.com/stellar/js-stellar-sdk/compare/v11.3.0...v12.0.0-rc.2)
97
+
98
+ **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](https://github.com/stellar/js-stellar-sdk/pull/949)).
99
+
100
+ ### Breaking Changes
101
+ * 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 `txTooLate` error response from the server. Five minutes is also the value used by the CLI, so this brings the two into alignment ([#956](https://github.com/stellar/js-stellar-sdk/pull/956)).
102
+
103
+ ### Fixed
104
+ * Dependencies have been properly updated to pull in Protocol 21 XDR ([#959](https://github.com/stellar/js-stellar-sdk/pull/959)).
105
+
106
+
10
107
  ## [v12.0.0-rc.1](https://github.com/stellar/js-stellar-sdk/compare/v11.3.0...v12.0.0-rc.1)
11
108
 
12
109
  ### Breaking Changes
@@ -17,7 +114,7 @@ A breaking change will get clearly marked in this log.
17
114
  * `ContractClient` now properly handles methods that take no arguments by making `MethodOptions` the only parameter, bringing it inline with the types generated by Soroban CLI's `soroban contract bindings typescript` ([#940](https://github.com/stellar/js-stellar-sdk/pull/940)).
18
115
  * `ContractClient` now allows `publicKey` to be undefined ([#941](https://github.com/stellar/js-stellar-sdk/pull/941)).
19
116
  * `SentTransaction` will only pass `allowHttp` if (and only if) its corresponding `AssembledTransaction#options` config allowed it ([#952](https://github.com/stellar/js-stellar-sdk/pull/952)).
20
-
117
+ * `SentTransaction` will now modify the time bounds of the transaction to be `timeoutInSeconds` seconds after the transaction has been simulated. Previously this was set when the transaction is built, before the simulation. This makes the time bounds line up with the timeout retry logic in `SentTransaction`.
21
118
 
22
119
  ## [v11.3.0](https://github.com/stellar/js-stellar-sdk/compare/v11.2.2...v11.3.0)
23
120
 
package/README.md CHANGED
@@ -96,7 +96,7 @@ The usage documentation for this library lives in a handful of places:
96
96
  You can also refer to:
97
97
 
98
98
  * the [documentation](https://developers.stellar.org/network/horizon) for the Horizon REST API (if using the `Horizon` module) and
99
- * the [documentation](https://soroban.stellar.org/docs/reference/rpc) for Soroban RPC's API (if using the `SorobanRpc` module)
99
+ * the [documentation](https://soroban.stellar.org/docs/reference/rpc) for Soroban RPC's API (if using the `rpc` module)
100
100
 
101
101
  ### Usage with React-Native
102
102