@stellar/stellar-sdk 12.0.0-rc.2 → 12.0.0-rc.3

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 (50) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +1643 -466
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/{contract_client → contract}/assembled_transaction.d.ts +59 -40
  6. package/lib/{contract_client → contract}/assembled_transaction.js +128 -146
  7. package/lib/{contract_client → contract}/basic_node_signer.d.ts +2 -2
  8. package/lib/{contract_client → contract}/basic_node_signer.js +3 -3
  9. package/lib/contract/client.d.ts +51 -0
  10. package/lib/contract/client.js +177 -0
  11. package/lib/contract/index.d.ts +7 -0
  12. package/lib/{contract_client → contract}/index.js +19 -8
  13. package/lib/{contract_client → contract}/sent_transaction.d.ts +21 -10
  14. package/lib/{contract_client → contract}/sent_transaction.js +27 -13
  15. package/lib/{contract_spec.d.ts → contract/spec.d.ts} +3 -3
  16. package/lib/{contract_spec.js → contract/spec.js} +160 -160
  17. package/lib/{contract_client → contract}/types.d.ts +10 -8
  18. package/lib/contract/utils.d.ts +40 -0
  19. package/lib/{contract_client → contract}/utils.js +12 -2
  20. package/lib/index.d.ts +26 -2
  21. package/lib/index.js +10 -16
  22. package/lib/rpc/index.d.ts +7 -0
  23. package/lib/{soroban → rpc}/server.d.ts +49 -0
  24. package/lib/{soroban → rpc}/server.js +199 -118
  25. package/package.json +20 -3
  26. package/lib/contract_client/client.d.ts +0 -17
  27. package/lib/contract_client/client.js +0 -57
  28. package/lib/contract_client/index.d.ts +0 -6
  29. package/lib/contract_client/utils.d.ts +0 -23
  30. package/lib/rust_types/index.d.ts +0 -1
  31. package/lib/rust_types/index.js +0 -16
  32. package/lib/soroban/index.d.ts +0 -7
  33. /package/lib/{rust_types/result.d.ts → contract/rust_result.d.ts} +0 -0
  34. /package/lib/{rust_types/result.js → contract/rust_result.js} +0 -0
  35. /package/lib/{contract_client → contract}/types.js +0 -0
  36. /package/lib/{soroban → rpc}/api.d.ts +0 -0
  37. /package/lib/{soroban → rpc}/api.js +0 -0
  38. /package/lib/{soroban → rpc}/axios.d.ts +0 -0
  39. /package/lib/{soroban → rpc}/axios.js +0 -0
  40. /package/lib/{soroban → rpc}/browser.d.ts +0 -0
  41. /package/lib/{soroban → rpc}/browser.js +0 -0
  42. /package/lib/{soroban → rpc}/index.js +0 -0
  43. /package/lib/{soroban → rpc}/jsonrpc.d.ts +0 -0
  44. /package/lib/{soroban → rpc}/jsonrpc.js +0 -0
  45. /package/lib/{soroban → rpc}/parsers.d.ts +0 -0
  46. /package/lib/{soroban → rpc}/parsers.js +0 -0
  47. /package/lib/{soroban → rpc}/transaction.d.ts +0 -0
  48. /package/lib/{soroban → rpc}/transaction.js +0 -0
  49. /package/lib/{soroban → rpc}/utils.d.ts +0 -0
  50. /package/lib/{soroban → rpc}/utils.js +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,74 @@ A breaking change will get clearly marked in this log.
7
7
  ## Unreleased
8
8
 
9
9
 
10
+ ## [v12.0.0-rc.3](https://github.com/stellar/js-stellar-sdk/compare/v11.3.0...v12.0.0-rc.3)
11
+
12
+ ### Breaking Changes
13
+
14
+ - `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)):
15
+
16
+ ```diff
17
+ -import { ContractClient } from '@stellar/stellar-sdk/lib/contract_client'
18
+ +import { contract } from '@stellar/stellar-sdk'
19
+ +const { Client } = contract
20
+ ```
21
+
22
+ 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.
23
+
24
+ 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:
25
+
26
+ ```diff
27
+ import {
28
+ - ContractClient,
29
+ + Client,
30
+ AssembledTransaction,
31
+ - ContractClientOptions,
32
+ + ClientOptions,
33
+ SentTransaction,
34
+ -} from '@stellar/stellar-sdk/lib/contract_client'
35
+ +} from '@stellar/stellar-sdk/contract'
36
+ ```
37
+
38
+ - 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):
39
+
40
+ ```diff
41
+ -import { ContractSpec } from '@stellar/stellar-sdk'
42
+ +import { contract } from '@stellar/stellar-sdk'
43
+ +const { Spec } = contract
44
+ // OR
45
+ +import { Spec } from '@stellar/stellar-sdk/contract'
46
+ ```
47
+
48
+ - 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)).
49
+
50
+ ### Deprecated
51
+
52
+ - `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:
53
+
54
+ ```diff
55
+ -import { SorobanRpc } from '@stellar/stellar-sdk'
56
+ +import { rpc } from '@stellar/stellar-sdk'
57
+ ```
58
+
59
+ 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).
60
+
61
+ ```diff
62
+ -import { SorobanRpc } from '@stellar/stellar-sdk'
63
+ -const { Api } = SorobanRpc
64
+ +import { Api } from '@stellar/stellar-sdk/rpc'
65
+ ```
66
+
67
+ ### Added
68
+ * New methods on `contract.Client` ([#960](https://github.com/stellar/js-stellar-sdk/pull/960)):
69
+ - `from(opts: ContractClientOptions)` instantiates `contract.Client` by fetching the `contractId`'s WASM from the network to fill out the client's `ContractSpec`.
70
+ - `fromWasm` and `fromWasmHash` methods to instantiate a `contract.Client` when you already have the WASM bytes or hash alongside the `contract.ClientOptions`.
71
+ * New methods on `rpc.Server` ([#960](https://github.com/stellar/js-stellar-sdk/pull/960)):
72
+ - `getContractWasmByContractId` and `getContractWasmByHash` to retrieve a contract's WASM bytecode via its `contractId` or `wasmHash`, respectively.
73
+
74
+ ### Fixed
75
+ * 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.
76
+
77
+
10
78
  ## [v12.0.0-rc.2](https://github.com/stellar/js-stellar-sdk/compare/v11.3.0...v12.0.0-rc.2)
11
79
 
12
80
  **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)).
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