@stellar/stellar-sdk 11.0.0 → 11.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 (36) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +21 -33
  3. package/dist/stellar-sdk.js +757 -255
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/config.js +2 -2
  6. package/lib/contract_spec.d.ts +22 -1
  7. package/lib/contract_spec.js +684 -187
  8. package/lib/errors.js +2 -2
  9. package/lib/federation/server.js +2 -2
  10. package/lib/horizon/account_call_builder.js +2 -2
  11. package/lib/horizon/account_response.js +2 -2
  12. package/lib/horizon/assets_call_builder.js +2 -2
  13. package/lib/horizon/call_builder.js +2 -2
  14. package/lib/horizon/claimable_balances_call_builder.js +2 -2
  15. package/lib/horizon/effect_call_builder.js +2 -2
  16. package/lib/horizon/friendbot_builder.js +2 -2
  17. package/lib/horizon/ledger_call_builder.js +2 -2
  18. package/lib/horizon/liquidity_pool_call_builder.js +2 -2
  19. package/lib/horizon/offer_call_builder.js +2 -2
  20. package/lib/horizon/operation_call_builder.js +2 -2
  21. package/lib/horizon/orderbook_call_builder.js +2 -2
  22. package/lib/horizon/path_call_builder.js +2 -2
  23. package/lib/horizon/payment_call_builder.js +2 -2
  24. package/lib/horizon/server.js +2 -2
  25. package/lib/horizon/strict_receive_path_call_builder.js +2 -2
  26. package/lib/horizon/strict_send_path_call_builder.js +2 -2
  27. package/lib/horizon/trade_aggregation_call_builder.js +2 -2
  28. package/lib/horizon/trades_call_builder.js +2 -2
  29. package/lib/horizon/transaction_call_builder.js +2 -2
  30. package/lib/soroban/parsers.js +2 -2
  31. package/lib/soroban/server.d.ts +7 -3
  32. package/lib/soroban/server.js +19 -13
  33. package/lib/stellartoml/index.js +2 -2
  34. package/lib/utils.js +2 -2
  35. package/lib/webauth/errors.js +2 -2
  36. package/package.json +11 -9
package/lib/config.js CHANGED
@@ -8,8 +8,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
8
8
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
9
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
10
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ 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); }
13
13
  var defaultConfig = {
14
14
  allowHttp: false,
15
15
  timeout: 0
@@ -1,4 +1,5 @@
1
- import { xdr } from '@stellar/stellar-base';
1
+ import { JSONSchema7 } from "json-schema";
2
+ import { xdr } from ".";
2
3
  export interface Union<T> {
3
4
  tag: string;
4
5
  values?: T;
@@ -8,6 +9,7 @@ export interface Union<T> {
8
9
  * This allows the class to be used to convert between native and raw `xdr.ScVal`s.
9
10
  *
10
11
  * @example
12
+ * ```js
11
13
  * const specEntries = [...]; // XDR spec entries of a smart contract
12
14
  * const contractSpec = new ContractSpec(specEntries);
13
15
  *
@@ -25,6 +27,7 @@ export interface Union<T> {
25
27
  * const result = contractSpec.funcResToNative('funcName', resultScv);
26
28
  *
27
29
  * console.log(result); // {success: true}
30
+ * ```
28
31
  */
29
32
  export declare class ContractSpec {
30
33
  entries: xdr.ScSpecEntry[];
@@ -36,6 +39,13 @@ export declare class ContractSpec {
36
39
  * @throws {Error} if entries is invalid
37
40
  */
38
41
  constructor(entries: xdr.ScSpecEntry[] | string[]);
42
+ /**
43
+ * Gets the XDR functions from the spec.
44
+ *
45
+ * @returns {xdr.ScSpecFunctionV0[]} all contract functions
46
+ *
47
+ */
48
+ funcs(): xdr.ScSpecFunctionV0[];
39
49
  /**
40
50
  * Gets the XDR function spec for the given function name.
41
51
  *
@@ -127,4 +137,15 @@ export declare class ContractSpec {
127
137
  private unionToNative;
128
138
  private structToNative;
129
139
  private enumToNative;
140
+ /**
141
+ * Converts the contract spec to a JSON schema.
142
+ *
143
+ * If `funcName` is provided, the schema will be a reference to the function schema.
144
+ *
145
+ * @param {string} [funcName] the name of the function to convert
146
+ * @returns {JSONSchema7} the converted JSON schema
147
+ *
148
+ * @throws {Error} if the contract spec is invalid
149
+ */
150
+ jsonSchema(funcName?: string): JSONSchema7;
130
151
  }