@stellar/stellar-sdk 14.2.0 → 14.3.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 (294) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/stellar-sdk-minimal.js +273 -210
  3. package/dist/stellar-sdk-minimal.min.js +1 -1
  4. package/dist/stellar-sdk-no-axios.js +273 -210
  5. package/dist/stellar-sdk-no-axios.min.js +1 -1
  6. package/dist/stellar-sdk-no-eventsource.js +273 -210
  7. package/dist/stellar-sdk-no-eventsource.min.js +1 -1
  8. package/dist/stellar-sdk.js +273 -210
  9. package/dist/stellar-sdk.min.js +1 -1
  10. package/lib/contract/assembled_transaction.js +9 -4
  11. package/lib/contract/client.d.ts +1 -1
  12. package/lib/contract/client.js +25 -14
  13. package/lib/contract/sent_transaction.js +9 -4
  14. package/lib/contract/spec.js +10 -2
  15. package/lib/contract/types.d.ts +9 -1
  16. package/lib/errors/account_requires_memo.d.ts +0 -1
  17. package/lib/errors/account_requires_memo.js +0 -4
  18. package/lib/errors/bad_request.d.ts +0 -1
  19. package/lib/errors/bad_request.js +2 -8
  20. package/lib/errors/bad_response.d.ts +0 -1
  21. package/lib/errors/bad_response.js +2 -8
  22. package/lib/errors/network.d.ts +0 -1
  23. package/lib/errors/network.js +0 -3
  24. package/lib/errors/not_found.d.ts +0 -1
  25. package/lib/errors/not_found.js +2 -8
  26. package/lib/horizon/account_call_builder.d.ts +2 -1
  27. package/lib/horizon/account_call_builder.js +3 -3
  28. package/lib/horizon/assets_call_builder.d.ts +2 -1
  29. package/lib/horizon/assets_call_builder.js +2 -2
  30. package/lib/horizon/call_builder.d.ts +3 -1
  31. package/lib/horizon/call_builder.js +4 -3
  32. package/lib/horizon/claimable_balances_call_builder.d.ts +2 -1
  33. package/lib/horizon/claimable_balances_call_builder.js +3 -3
  34. package/lib/horizon/effect_call_builder.d.ts +2 -1
  35. package/lib/horizon/effect_call_builder.js +2 -2
  36. package/lib/horizon/friendbot_builder.d.ts +2 -1
  37. package/lib/horizon/friendbot_builder.js +2 -2
  38. package/lib/horizon/horizon_axios_client.d.ts +2 -2
  39. package/lib/horizon/horizon_axios_client.js +38 -30
  40. package/lib/horizon/index.d.ts +1 -1
  41. package/lib/horizon/index.js +1 -10
  42. package/lib/horizon/ledger_call_builder.d.ts +2 -1
  43. package/lib/horizon/ledger_call_builder.js +2 -2
  44. package/lib/horizon/liquidity_pool_call_builder.d.ts +2 -1
  45. package/lib/horizon/liquidity_pool_call_builder.js +3 -3
  46. package/lib/horizon/offer_call_builder.d.ts +2 -1
  47. package/lib/horizon/offer_call_builder.js +3 -3
  48. package/lib/horizon/operation_call_builder.d.ts +2 -1
  49. package/lib/horizon/operation_call_builder.js +3 -3
  50. package/lib/horizon/orderbook_call_builder.d.ts +2 -1
  51. package/lib/horizon/orderbook_call_builder.js +2 -2
  52. package/lib/horizon/path_call_builder.d.ts +2 -1
  53. package/lib/horizon/path_call_builder.js +2 -2
  54. package/lib/horizon/payment_call_builder.d.ts +2 -1
  55. package/lib/horizon/payment_call_builder.js +2 -2
  56. package/lib/horizon/server.d.ts +25 -10
  57. package/lib/horizon/server.js +23 -30
  58. package/lib/horizon/strict_receive_path_call_builder.d.ts +2 -1
  59. package/lib/horizon/strict_receive_path_call_builder.js +2 -2
  60. package/lib/horizon/strict_send_path_call_builder.d.ts +2 -1
  61. package/lib/horizon/strict_send_path_call_builder.js +2 -2
  62. package/lib/horizon/trade_aggregation_call_builder.d.ts +2 -1
  63. package/lib/horizon/trade_aggregation_call_builder.js +2 -2
  64. package/lib/horizon/trades_call_builder.d.ts +2 -1
  65. package/lib/horizon/trades_call_builder.js +2 -2
  66. package/lib/horizon/transaction_call_builder.d.ts +2 -1
  67. package/lib/horizon/transaction_call_builder.js +3 -3
  68. package/lib/minimal/contract/assembled_transaction.js +9 -4
  69. package/lib/minimal/contract/client.d.ts +1 -1
  70. package/lib/minimal/contract/client.js +25 -14
  71. package/lib/minimal/contract/sent_transaction.js +9 -4
  72. package/lib/minimal/contract/spec.js +10 -2
  73. package/lib/minimal/contract/types.d.ts +9 -1
  74. package/lib/minimal/errors/account_requires_memo.d.ts +0 -1
  75. package/lib/minimal/errors/account_requires_memo.js +0 -4
  76. package/lib/minimal/errors/bad_request.d.ts +0 -1
  77. package/lib/minimal/errors/bad_request.js +2 -8
  78. package/lib/minimal/errors/bad_response.d.ts +0 -1
  79. package/lib/minimal/errors/bad_response.js +2 -8
  80. package/lib/minimal/errors/network.d.ts +0 -1
  81. package/lib/minimal/errors/network.js +0 -3
  82. package/lib/minimal/errors/not_found.d.ts +0 -1
  83. package/lib/minimal/errors/not_found.js +2 -8
  84. package/lib/minimal/horizon/account_call_builder.d.ts +2 -1
  85. package/lib/minimal/horizon/account_call_builder.js +3 -3
  86. package/lib/minimal/horizon/assets_call_builder.d.ts +2 -1
  87. package/lib/minimal/horizon/assets_call_builder.js +2 -2
  88. package/lib/minimal/horizon/call_builder.d.ts +3 -1
  89. package/lib/minimal/horizon/call_builder.js +4 -3
  90. package/lib/minimal/horizon/claimable_balances_call_builder.d.ts +2 -1
  91. package/lib/minimal/horizon/claimable_balances_call_builder.js +3 -3
  92. package/lib/minimal/horizon/effect_call_builder.d.ts +2 -1
  93. package/lib/minimal/horizon/effect_call_builder.js +2 -2
  94. package/lib/minimal/horizon/friendbot_builder.d.ts +2 -1
  95. package/lib/minimal/horizon/friendbot_builder.js +2 -2
  96. package/lib/minimal/horizon/horizon_axios_client.d.ts +2 -2
  97. package/lib/minimal/horizon/horizon_axios_client.js +38 -30
  98. package/lib/minimal/horizon/index.d.ts +1 -1
  99. package/lib/minimal/horizon/index.js +1 -10
  100. package/lib/minimal/horizon/ledger_call_builder.d.ts +2 -1
  101. package/lib/minimal/horizon/ledger_call_builder.js +2 -2
  102. package/lib/minimal/horizon/liquidity_pool_call_builder.d.ts +2 -1
  103. package/lib/minimal/horizon/liquidity_pool_call_builder.js +3 -3
  104. package/lib/minimal/horizon/offer_call_builder.d.ts +2 -1
  105. package/lib/minimal/horizon/offer_call_builder.js +3 -3
  106. package/lib/minimal/horizon/operation_call_builder.d.ts +2 -1
  107. package/lib/minimal/horizon/operation_call_builder.js +3 -3
  108. package/lib/minimal/horizon/orderbook_call_builder.d.ts +2 -1
  109. package/lib/minimal/horizon/orderbook_call_builder.js +2 -2
  110. package/lib/minimal/horizon/path_call_builder.d.ts +2 -1
  111. package/lib/minimal/horizon/path_call_builder.js +2 -2
  112. package/lib/minimal/horizon/payment_call_builder.d.ts +2 -1
  113. package/lib/minimal/horizon/payment_call_builder.js +2 -2
  114. package/lib/minimal/horizon/server.d.ts +25 -10
  115. package/lib/minimal/horizon/server.js +23 -30
  116. package/lib/minimal/horizon/strict_receive_path_call_builder.d.ts +2 -1
  117. package/lib/minimal/horizon/strict_receive_path_call_builder.js +2 -2
  118. package/lib/minimal/horizon/strict_send_path_call_builder.d.ts +2 -1
  119. package/lib/minimal/horizon/strict_send_path_call_builder.js +2 -2
  120. package/lib/minimal/horizon/trade_aggregation_call_builder.d.ts +2 -1
  121. package/lib/minimal/horizon/trade_aggregation_call_builder.js +2 -2
  122. package/lib/minimal/horizon/trades_call_builder.d.ts +2 -1
  123. package/lib/minimal/horizon/trades_call_builder.js +2 -2
  124. package/lib/minimal/horizon/transaction_call_builder.d.ts +2 -1
  125. package/lib/minimal/horizon/transaction_call_builder.js +3 -3
  126. package/lib/minimal/rpc/api.d.ts +132 -0
  127. package/lib/minimal/rpc/axios.d.ts +1 -2
  128. package/lib/minimal/rpc/axios.js +17 -9
  129. package/lib/minimal/rpc/index.d.ts +0 -1
  130. package/lib/minimal/rpc/index.js +0 -9
  131. package/lib/minimal/rpc/jsonrpc.d.ts +2 -1
  132. package/lib/minimal/rpc/jsonrpc.js +4 -6
  133. package/lib/minimal/rpc/parsers.d.ts +1 -0
  134. package/lib/minimal/rpc/parsers.js +23 -0
  135. package/lib/minimal/rpc/server.d.ts +82 -20
  136. package/lib/minimal/rpc/server.js +56 -19
  137. package/lib/minimal/webauth/errors.d.ts +0 -2
  138. package/lib/minimal/webauth/errors.js +2 -8
  139. package/lib/no-axios/contract/assembled_transaction.js +9 -4
  140. package/lib/no-axios/contract/client.d.ts +1 -1
  141. package/lib/no-axios/contract/client.js +25 -14
  142. package/lib/no-axios/contract/sent_transaction.js +9 -4
  143. package/lib/no-axios/contract/spec.js +10 -2
  144. package/lib/no-axios/contract/types.d.ts +9 -1
  145. package/lib/no-axios/errors/account_requires_memo.d.ts +0 -1
  146. package/lib/no-axios/errors/account_requires_memo.js +0 -4
  147. package/lib/no-axios/errors/bad_request.d.ts +0 -1
  148. package/lib/no-axios/errors/bad_request.js +2 -8
  149. package/lib/no-axios/errors/bad_response.d.ts +0 -1
  150. package/lib/no-axios/errors/bad_response.js +2 -8
  151. package/lib/no-axios/errors/network.d.ts +0 -1
  152. package/lib/no-axios/errors/network.js +0 -3
  153. package/lib/no-axios/errors/not_found.d.ts +0 -1
  154. package/lib/no-axios/errors/not_found.js +2 -8
  155. package/lib/no-axios/horizon/account_call_builder.d.ts +2 -1
  156. package/lib/no-axios/horizon/account_call_builder.js +3 -3
  157. package/lib/no-axios/horizon/assets_call_builder.d.ts +2 -1
  158. package/lib/no-axios/horizon/assets_call_builder.js +2 -2
  159. package/lib/no-axios/horizon/call_builder.d.ts +3 -1
  160. package/lib/no-axios/horizon/call_builder.js +4 -3
  161. package/lib/no-axios/horizon/claimable_balances_call_builder.d.ts +2 -1
  162. package/lib/no-axios/horizon/claimable_balances_call_builder.js +3 -3
  163. package/lib/no-axios/horizon/effect_call_builder.d.ts +2 -1
  164. package/lib/no-axios/horizon/effect_call_builder.js +2 -2
  165. package/lib/no-axios/horizon/friendbot_builder.d.ts +2 -1
  166. package/lib/no-axios/horizon/friendbot_builder.js +2 -2
  167. package/lib/no-axios/horizon/horizon_axios_client.d.ts +2 -2
  168. package/lib/no-axios/horizon/horizon_axios_client.js +38 -30
  169. package/lib/no-axios/horizon/index.d.ts +1 -1
  170. package/lib/no-axios/horizon/index.js +1 -10
  171. package/lib/no-axios/horizon/ledger_call_builder.d.ts +2 -1
  172. package/lib/no-axios/horizon/ledger_call_builder.js +2 -2
  173. package/lib/no-axios/horizon/liquidity_pool_call_builder.d.ts +2 -1
  174. package/lib/no-axios/horizon/liquidity_pool_call_builder.js +3 -3
  175. package/lib/no-axios/horizon/offer_call_builder.d.ts +2 -1
  176. package/lib/no-axios/horizon/offer_call_builder.js +3 -3
  177. package/lib/no-axios/horizon/operation_call_builder.d.ts +2 -1
  178. package/lib/no-axios/horizon/operation_call_builder.js +3 -3
  179. package/lib/no-axios/horizon/orderbook_call_builder.d.ts +2 -1
  180. package/lib/no-axios/horizon/orderbook_call_builder.js +2 -2
  181. package/lib/no-axios/horizon/path_call_builder.d.ts +2 -1
  182. package/lib/no-axios/horizon/path_call_builder.js +2 -2
  183. package/lib/no-axios/horizon/payment_call_builder.d.ts +2 -1
  184. package/lib/no-axios/horizon/payment_call_builder.js +2 -2
  185. package/lib/no-axios/horizon/server.d.ts +25 -10
  186. package/lib/no-axios/horizon/server.js +23 -30
  187. package/lib/no-axios/horizon/strict_receive_path_call_builder.d.ts +2 -1
  188. package/lib/no-axios/horizon/strict_receive_path_call_builder.js +2 -2
  189. package/lib/no-axios/horizon/strict_send_path_call_builder.d.ts +2 -1
  190. package/lib/no-axios/horizon/strict_send_path_call_builder.js +2 -2
  191. package/lib/no-axios/horizon/trade_aggregation_call_builder.d.ts +2 -1
  192. package/lib/no-axios/horizon/trade_aggregation_call_builder.js +2 -2
  193. package/lib/no-axios/horizon/trades_call_builder.d.ts +2 -1
  194. package/lib/no-axios/horizon/trades_call_builder.js +2 -2
  195. package/lib/no-axios/horizon/transaction_call_builder.d.ts +2 -1
  196. package/lib/no-axios/horizon/transaction_call_builder.js +3 -3
  197. package/lib/no-axios/rpc/api.d.ts +132 -0
  198. package/lib/no-axios/rpc/axios.d.ts +1 -2
  199. package/lib/no-axios/rpc/axios.js +17 -9
  200. package/lib/no-axios/rpc/index.d.ts +0 -1
  201. package/lib/no-axios/rpc/index.js +0 -9
  202. package/lib/no-axios/rpc/jsonrpc.d.ts +2 -1
  203. package/lib/no-axios/rpc/jsonrpc.js +4 -6
  204. package/lib/no-axios/rpc/parsers.d.ts +1 -0
  205. package/lib/no-axios/rpc/parsers.js +23 -0
  206. package/lib/no-axios/rpc/server.d.ts +82 -20
  207. package/lib/no-axios/rpc/server.js +56 -19
  208. package/lib/no-axios/webauth/errors.d.ts +0 -2
  209. package/lib/no-axios/webauth/errors.js +2 -8
  210. package/lib/no-eventsource/contract/assembled_transaction.js +9 -4
  211. package/lib/no-eventsource/contract/client.d.ts +1 -1
  212. package/lib/no-eventsource/contract/client.js +25 -14
  213. package/lib/no-eventsource/contract/sent_transaction.js +9 -4
  214. package/lib/no-eventsource/contract/spec.js +10 -2
  215. package/lib/no-eventsource/contract/types.d.ts +9 -1
  216. package/lib/no-eventsource/errors/account_requires_memo.d.ts +0 -1
  217. package/lib/no-eventsource/errors/account_requires_memo.js +0 -4
  218. package/lib/no-eventsource/errors/bad_request.d.ts +0 -1
  219. package/lib/no-eventsource/errors/bad_request.js +2 -8
  220. package/lib/no-eventsource/errors/bad_response.d.ts +0 -1
  221. package/lib/no-eventsource/errors/bad_response.js +2 -8
  222. package/lib/no-eventsource/errors/network.d.ts +0 -1
  223. package/lib/no-eventsource/errors/network.js +0 -3
  224. package/lib/no-eventsource/errors/not_found.d.ts +0 -1
  225. package/lib/no-eventsource/errors/not_found.js +2 -8
  226. package/lib/no-eventsource/horizon/account_call_builder.d.ts +2 -1
  227. package/lib/no-eventsource/horizon/account_call_builder.js +3 -3
  228. package/lib/no-eventsource/horizon/assets_call_builder.d.ts +2 -1
  229. package/lib/no-eventsource/horizon/assets_call_builder.js +2 -2
  230. package/lib/no-eventsource/horizon/call_builder.d.ts +3 -1
  231. package/lib/no-eventsource/horizon/call_builder.js +4 -3
  232. package/lib/no-eventsource/horizon/claimable_balances_call_builder.d.ts +2 -1
  233. package/lib/no-eventsource/horizon/claimable_balances_call_builder.js +3 -3
  234. package/lib/no-eventsource/horizon/effect_call_builder.d.ts +2 -1
  235. package/lib/no-eventsource/horizon/effect_call_builder.js +2 -2
  236. package/lib/no-eventsource/horizon/friendbot_builder.d.ts +2 -1
  237. package/lib/no-eventsource/horizon/friendbot_builder.js +2 -2
  238. package/lib/no-eventsource/horizon/horizon_axios_client.d.ts +2 -2
  239. package/lib/no-eventsource/horizon/horizon_axios_client.js +38 -30
  240. package/lib/no-eventsource/horizon/index.d.ts +1 -1
  241. package/lib/no-eventsource/horizon/index.js +1 -10
  242. package/lib/no-eventsource/horizon/ledger_call_builder.d.ts +2 -1
  243. package/lib/no-eventsource/horizon/ledger_call_builder.js +2 -2
  244. package/lib/no-eventsource/horizon/liquidity_pool_call_builder.d.ts +2 -1
  245. package/lib/no-eventsource/horizon/liquidity_pool_call_builder.js +3 -3
  246. package/lib/no-eventsource/horizon/offer_call_builder.d.ts +2 -1
  247. package/lib/no-eventsource/horizon/offer_call_builder.js +3 -3
  248. package/lib/no-eventsource/horizon/operation_call_builder.d.ts +2 -1
  249. package/lib/no-eventsource/horizon/operation_call_builder.js +3 -3
  250. package/lib/no-eventsource/horizon/orderbook_call_builder.d.ts +2 -1
  251. package/lib/no-eventsource/horizon/orderbook_call_builder.js +2 -2
  252. package/lib/no-eventsource/horizon/path_call_builder.d.ts +2 -1
  253. package/lib/no-eventsource/horizon/path_call_builder.js +2 -2
  254. package/lib/no-eventsource/horizon/payment_call_builder.d.ts +2 -1
  255. package/lib/no-eventsource/horizon/payment_call_builder.js +2 -2
  256. package/lib/no-eventsource/horizon/server.d.ts +25 -10
  257. package/lib/no-eventsource/horizon/server.js +23 -30
  258. package/lib/no-eventsource/horizon/strict_receive_path_call_builder.d.ts +2 -1
  259. package/lib/no-eventsource/horizon/strict_receive_path_call_builder.js +2 -2
  260. package/lib/no-eventsource/horizon/strict_send_path_call_builder.d.ts +2 -1
  261. package/lib/no-eventsource/horizon/strict_send_path_call_builder.js +2 -2
  262. package/lib/no-eventsource/horizon/trade_aggregation_call_builder.d.ts +2 -1
  263. package/lib/no-eventsource/horizon/trade_aggregation_call_builder.js +2 -2
  264. package/lib/no-eventsource/horizon/trades_call_builder.d.ts +2 -1
  265. package/lib/no-eventsource/horizon/trades_call_builder.js +2 -2
  266. package/lib/no-eventsource/horizon/transaction_call_builder.d.ts +2 -1
  267. package/lib/no-eventsource/horizon/transaction_call_builder.js +3 -3
  268. package/lib/no-eventsource/rpc/api.d.ts +132 -0
  269. package/lib/no-eventsource/rpc/axios.d.ts +1 -2
  270. package/lib/no-eventsource/rpc/axios.js +17 -9
  271. package/lib/no-eventsource/rpc/index.d.ts +0 -1
  272. package/lib/no-eventsource/rpc/index.js +0 -9
  273. package/lib/no-eventsource/rpc/jsonrpc.d.ts +2 -1
  274. package/lib/no-eventsource/rpc/jsonrpc.js +4 -6
  275. package/lib/no-eventsource/rpc/parsers.d.ts +1 -0
  276. package/lib/no-eventsource/rpc/parsers.js +23 -0
  277. package/lib/no-eventsource/rpc/server.d.ts +82 -20
  278. package/lib/no-eventsource/rpc/server.js +56 -19
  279. package/lib/no-eventsource/webauth/errors.d.ts +0 -2
  280. package/lib/no-eventsource/webauth/errors.js +2 -8
  281. package/lib/rpc/api.d.ts +132 -0
  282. package/lib/rpc/axios.d.ts +1 -2
  283. package/lib/rpc/axios.js +17 -9
  284. package/lib/rpc/index.d.ts +0 -1
  285. package/lib/rpc/index.js +0 -9
  286. package/lib/rpc/jsonrpc.d.ts +2 -1
  287. package/lib/rpc/jsonrpc.js +4 -6
  288. package/lib/rpc/parsers.d.ts +1 -0
  289. package/lib/rpc/parsers.js +23 -0
  290. package/lib/rpc/server.d.ts +82 -20
  291. package/lib/rpc/server.js +56 -19
  292. package/lib/webauth/errors.d.ts +0 -2
  293. package/lib/webauth/errors.js +2 -8
  294. package/package.json +20 -45
@@ -50,8 +50,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
50
50
  var AssembledTransaction = exports.AssembledTransaction = function () {
51
51
  function AssembledTransaction(options) {
52
52
  var _this = this,
53
- _this$options$simulat,
54
- _this$options$allowHt;
53
+ _this$options$simulat;
55
54
  _classCallCheck(this, AssembledTransaction);
56
55
  _defineProperty(this, "simulate", _asyncToGenerator(_regenerator().m(function _callee() {
57
56
  var _ref2,
@@ -407,8 +406,14 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
407
406
  })));
408
407
  this.options = options;
409
408
  this.options.simulate = (_this$options$simulat = this.options.simulate) !== null && _this$options$simulat !== void 0 ? _this$options$simulat : true;
410
- this.server = new _rpc.Server(this.options.rpcUrl, {
411
- allowHttp: (_this$options$allowHt = this.options.allowHttp) !== null && _this$options$allowHt !== void 0 ? _this$options$allowHt : false
409
+ var _this$options = this.options,
410
+ server = _this$options.server,
411
+ allowHttp = _this$options.allowHttp,
412
+ headers = _this$options.headers,
413
+ rpcUrl = _this$options.rpcUrl;
414
+ this.server = server !== null && server !== void 0 ? server : new _rpc.Server(rpcUrl, {
415
+ allowHttp: allowHttp,
416
+ headers: headers
412
417
  });
413
418
  }
414
419
  return _createClass(AssembledTransaction, [{
@@ -13,7 +13,7 @@ import type { ClientOptions, MethodOptions } from "./types";
13
13
  *
14
14
  * @class
15
15
  * @param {module:contract.Spec} spec {@link Spec} to construct a Client for
16
- * @param {ClientOptions} options see {@link ClientOptions}
16
+ * @param {module:contract.ClientOptions} options see {@link ClientOptions}
17
17
  */
18
18
  export declare class Client {
19
19
  readonly spec: Spec;
@@ -34,6 +34,7 @@ function _specFromWasmHash() {
34
34
  var format,
35
35
  rpcUrl,
36
36
  allowHttp,
37
+ headers,
37
38
  serverOpts,
38
39
  server,
39
40
  wasm,
@@ -48,9 +49,10 @@ function _specFromWasmHash() {
48
49
  }
49
50
  throw new TypeError("options must contain rpcUrl");
50
51
  case 1:
51
- rpcUrl = options.rpcUrl, allowHttp = options.allowHttp;
52
+ rpcUrl = options.rpcUrl, allowHttp = options.allowHttp, headers = options.headers;
52
53
  serverOpts = {
53
- allowHttp: allowHttp
54
+ allowHttp: allowHttp,
55
+ headers: headers
54
56
  };
55
57
  server = new _rpc.Server(rpcUrl, serverOpts);
56
58
  _context5.n = 2;
@@ -83,6 +85,14 @@ var Client = exports.Client = function () {
83
85
  });
84
86
  this.spec = spec;
85
87
  this.options = options;
88
+ if (options.server === undefined) {
89
+ var allowHttp = options.allowHttp,
90
+ headers = options.headers;
91
+ options.server = new _rpc.Server(options.rpcUrl, {
92
+ allowHttp: allowHttp,
93
+ headers: headers
94
+ });
95
+ }
86
96
  this.spec.funcs().forEach(function (xdrFn) {
87
97
  var method = xdrFn.name().toString();
88
98
  if (method === CONSTRUCTOR_FUNC) {
@@ -152,10 +162,11 @@ var Client = exports.Client = function () {
152
162
  key: "fromWasmHash",
153
163
  value: (function () {
154
164
  var _fromWasmHash = _asyncToGenerator(_regenerator().m(function _callee2(wasmHash, options) {
165
+ var _options$server;
155
166
  var format,
156
167
  rpcUrl,
157
168
  allowHttp,
158
- serverOpts,
169
+ headers,
159
170
  server,
160
171
  wasm,
161
172
  _args2 = arguments;
@@ -169,11 +180,11 @@ var Client = exports.Client = function () {
169
180
  }
170
181
  throw new TypeError("options must contain rpcUrl");
171
182
  case 1:
172
- rpcUrl = options.rpcUrl, allowHttp = options.allowHttp;
173
- serverOpts = {
174
- allowHttp: allowHttp
175
- };
176
- server = new _rpc.Server(rpcUrl, serverOpts);
183
+ rpcUrl = options.rpcUrl, allowHttp = options.allowHttp, headers = options.headers;
184
+ server = (_options$server = options.server) !== null && _options$server !== void 0 ? _options$server : new _rpc.Server(rpcUrl, {
185
+ allowHttp: allowHttp,
186
+ headers: headers
187
+ });
177
188
  _context2.n = 2;
178
189
  return server.getContractWasmByHash(wasmHash, format);
179
190
  case 2:
@@ -212,7 +223,7 @@ var Client = exports.Client = function () {
212
223
  key: "from",
213
224
  value: (function () {
214
225
  var _from = _asyncToGenerator(_regenerator().m(function _callee4(options) {
215
- var rpcUrl, contractId, allowHttp, serverOpts, server, wasm;
226
+ var rpcUrl, contractId, allowHttp, headers, server, wasm;
216
227
  return _regenerator().w(function (_context4) {
217
228
  while (1) switch (_context4.n) {
218
229
  case 0:
@@ -222,11 +233,11 @@ var Client = exports.Client = function () {
222
233
  }
223
234
  throw new TypeError("options must contain rpcUrl and contractId");
224
235
  case 1:
225
- rpcUrl = options.rpcUrl, contractId = options.contractId, allowHttp = options.allowHttp;
226
- serverOpts = {
227
- allowHttp: allowHttp
228
- };
229
- server = new _rpc.Server(rpcUrl, serverOpts);
236
+ rpcUrl = options.rpcUrl, contractId = options.contractId, allowHttp = options.allowHttp, headers = options.headers;
237
+ server = new _rpc.Server(rpcUrl, {
238
+ allowHttp: allowHttp,
239
+ headers: headers
240
+ });
230
241
  _context4.n = 2;
231
242
  return server.getContractWasmByContractId(contractId);
232
243
  case 2:
@@ -32,8 +32,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
32
32
  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); }
33
33
  var SentTransaction = exports.SentTransaction = function () {
34
34
  function SentTransaction(assembled) {
35
- var _this = this,
36
- _this$assembled$optio2;
35
+ var _this = this;
37
36
  _classCallCheck(this, SentTransaction);
38
37
  _defineProperty(this, "send", function () {
39
38
  var _ref = _asyncToGenerator(_regenerator().m(function _callee2(watcher) {
@@ -90,8 +89,14 @@ var SentTransaction = exports.SentTransaction = function () {
90
89
  };
91
90
  }());
92
91
  this.assembled = assembled;
93
- this.server = new _rpc.Server(this.assembled.options.rpcUrl, {
94
- allowHttp: (_this$assembled$optio2 = this.assembled.options.allowHttp) !== null && _this$assembled$optio2 !== void 0 ? _this$assembled$optio2 : false
92
+ var _this$assembled$optio2 = this.assembled.options,
93
+ server = _this$assembled$optio2.server,
94
+ allowHttp = _this$assembled$optio2.allowHttp,
95
+ headers = _this$assembled$optio2.headers,
96
+ rpcUrl = _this$assembled$optio2.rpcUrl;
97
+ this.server = server !== null && server !== void 0 ? server : new _rpc.Server(rpcUrl, {
98
+ allowHttp: allowHttp,
99
+ headers: headers
95
100
  });
96
101
  }
97
102
  return _createClass(SentTransaction, [{
@@ -559,7 +559,7 @@ var Spec = exports.Spec = function () {
559
559
  }
560
560
  if (value === _stellarBase.xdr.ScSpecType.scSpecTypeOption().value) {
561
561
  var opt = ty.option();
562
- if (val === undefined) {
562
+ if (val === null || val === undefined) {
563
563
  return _stellarBase.xdr.ScVal.scvVoid();
564
564
  }
565
565
  return this.nativeToScVal(val, opt.valueType());
@@ -823,12 +823,20 @@ var Spec = exports.Spec = function () {
823
823
  var _this5 = this;
824
824
  var t = typeDef.switch();
825
825
  var value = t.value;
826
+ if (value === _stellarBase.xdr.ScSpecType.scSpecTypeOption().value) {
827
+ switch (scv.switch().value) {
828
+ case _stellarBase.xdr.ScValType.scvVoid().value:
829
+ return null;
830
+ default:
831
+ return this.scValToNative(scv, typeDef.option().valueType());
832
+ }
833
+ }
826
834
  if (value === _stellarBase.xdr.ScSpecType.scSpecTypeUdt().value) {
827
835
  return this.scValUdtToNative(scv, typeDef.udt());
828
836
  }
829
837
  switch (scv.switch().value) {
830
838
  case _stellarBase.xdr.ScValType.scvVoid().value:
831
- return undefined;
839
+ return null;
832
840
  case _stellarBase.xdr.ScValType.scvU64().value:
833
841
  case _stellarBase.xdr.ScValType.scvI64().value:
834
842
  case _stellarBase.xdr.ScValType.scvU128().value:
@@ -1,4 +1,5 @@
1
1
  import { Memo, MemoType, Operation, Transaction, xdr } from "@stellar/stellar-base";
2
+ import { Server } from "../rpc";
2
3
  export type XDR_BASE64 = string;
3
4
  /**
4
5
  * An unsigned 32-bit integer.
@@ -150,11 +151,13 @@ export type ClientOptions = {
150
151
  */
151
152
  rpcUrl: string;
152
153
  /**
153
- * If true, will allow HTTP requests to the Soroban network. If false, will
154
+ * If true, will allow HTTP requests to the RPC. If false, will
154
155
  * only allow HTTPS requests.
155
156
  * @default false
156
157
  */
157
158
  allowHttp?: boolean;
159
+ /** Optional headers to include in requests to the RPC. */
160
+ headers?: Record<string, string>;
158
161
  /**
159
162
  * This gets filled in automatically from the ContractSpec when you
160
163
  * instantiate a {@link Client}.
@@ -175,6 +178,11 @@ export type ClientOptions = {
175
178
  errorTypes?: Record<number, {
176
179
  message: string;
177
180
  }>;
181
+ /**
182
+ * The Server instance to use for RPC calls. If not provided, one will be
183
+ * created automatically from `rpcUrl` and `serverOptions`.
184
+ */
185
+ server?: Server;
178
186
  };
179
187
  /**
180
188
  * Options for a smart contract method invocation.
@@ -17,7 +17,6 @@
17
17
  * console.log('The account is used in operation: ', err.operationIndex)
18
18
  */
19
19
  export declare class AccountRequiresMemoError extends Error {
20
- __proto__: AccountRequiresMemoError;
21
20
  accountId: string;
22
21
  operationIndex: number;
23
22
  constructor(message: string, accountId: string, operationIndex: number);
@@ -24,11 +24,7 @@ var AccountRequiresMemoError = exports.AccountRequiresMemoError = function (_Err
24
24
  function AccountRequiresMemoError(message, accountId, operationIndex) {
25
25
  var _this;
26
26
  _classCallCheck(this, AccountRequiresMemoError);
27
- var trueProto = (this instanceof AccountRequiresMemoError ? this.constructor : void 0).prototype;
28
27
  _this = _callSuper(this, AccountRequiresMemoError, [message]);
29
- _this.__proto__ = trueProto;
30
- _this.constructor = AccountRequiresMemoError;
31
- _this.name = "AccountRequiresMemoError";
32
28
  _this.accountId = accountId;
33
29
  _this.operationIndex = operationIndex;
34
30
  return _this;
@@ -10,5 +10,4 @@ import { NetworkError } from "./network";
10
10
  * @param {any} response Response details, received from the Horizon server
11
11
  */
12
12
  export declare class BadRequestError extends NetworkError {
13
- constructor(message: string, response: any);
14
13
  }
@@ -19,15 +19,9 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var BadRequestError = exports.BadRequestError = function (_NetworkError) {
22
- function BadRequestError(message, response) {
23
- var _this;
22
+ function BadRequestError() {
24
23
  _classCallCheck(this, BadRequestError);
25
- var trueProto = (this instanceof BadRequestError ? this.constructor : void 0).prototype;
26
- _this = _callSuper(this, BadRequestError, [message, response]);
27
- _this.__proto__ = trueProto;
28
- _this.constructor = BadRequestError;
29
- _this.name = "BadRequestError";
30
- return _this;
24
+ return _callSuper(this, BadRequestError, arguments);
31
25
  }
32
26
  _inherits(BadRequestError, _NetworkError);
33
27
  return _createClass(BadRequestError);
@@ -13,5 +13,4 @@ import { NetworkError } from "./network";
13
13
  * @param {any} response Response details, received from the server.
14
14
  */
15
15
  export declare class BadResponseError extends NetworkError {
16
- constructor(message: string, response: any);
17
16
  }
@@ -19,15 +19,9 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var BadResponseError = exports.BadResponseError = function (_NetworkError) {
22
- function BadResponseError(message, response) {
23
- var _this;
22
+ function BadResponseError() {
24
23
  _classCallCheck(this, BadResponseError);
25
- var trueProto = (this instanceof BadResponseError ? this.constructor : void 0).prototype;
26
- _this = _callSuper(this, BadResponseError, [message, response]);
27
- _this.__proto__ = trueProto;
28
- _this.constructor = BadResponseError;
29
- _this.name = "BadResponseError";
30
- return _this;
24
+ return _callSuper(this, BadResponseError, arguments);
31
25
  }
32
26
  _inherits(BadResponseError, _NetworkError);
33
27
  return _createClass(BadResponseError);
@@ -18,7 +18,6 @@ export declare class NetworkError extends Error {
18
18
  statusText?: string;
19
19
  url?: string;
20
20
  };
21
- __proto__: NetworkError;
22
21
  constructor(message: string, response: any);
23
22
  /**
24
23
  * Returns the error response sent by the Horizon server.
@@ -24,10 +24,7 @@ var NetworkError = exports.NetworkError = function (_Error) {
24
24
  function NetworkError(message, response) {
25
25
  var _this;
26
26
  _classCallCheck(this, NetworkError);
27
- var trueProto = (this instanceof NetworkError ? this.constructor : void 0).prototype;
28
27
  _this = _callSuper(this, NetworkError, [message]);
29
- _this.__proto__ = trueProto;
30
- _this.constructor = NetworkError;
31
28
  _this.response = response;
32
29
  return _this;
33
30
  }
@@ -10,5 +10,4 @@ import { NetworkError } from "./network";
10
10
  * @param {any} response Response details, received from the Horizon server
11
11
  */
12
12
  export declare class NotFoundError extends NetworkError {
13
- constructor(message: string, response: any);
14
13
  }
@@ -19,15 +19,9 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var NotFoundError = exports.NotFoundError = function (_NetworkError) {
22
- function NotFoundError(message, response) {
23
- var _this;
22
+ function NotFoundError() {
24
23
  _classCallCheck(this, NotFoundError);
25
- var trueProto = (this instanceof NotFoundError ? this.constructor : void 0).prototype;
26
- _this = _callSuper(this, NotFoundError, [message, response]);
27
- _this.__proto__ = trueProto;
28
- _this.constructor = NotFoundError;
29
- _this.name = "NotFoundError";
30
- return _this;
24
+ return _callSuper(this, NotFoundError, arguments);
31
25
  }
32
26
  _inherits(NotFoundError, _NetworkError);
33
27
  return _createClass(NotFoundError);
@@ -1,6 +1,7 @@
1
1
  import { Asset } from "@stellar/stellar-base";
2
2
  import { CallBuilder } from "./call_builder";
3
3
  import { ServerApi } from "./server_api";
4
+ import { HttpClient } from "../http-client";
4
5
  /**
5
6
  * Creates a new {@link AccountCallBuilder} pointed to server defined by `serverUrl`.
6
7
  *
@@ -14,7 +15,7 @@ import { ServerApi } from "./server_api";
14
15
  * @param {string} serverUrl Horizon server URL.
15
16
  */
16
17
  export declare class AccountCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.AccountRecord>> {
17
- constructor(serverUrl: URI);
18
+ constructor(serverUrl: URI, httpClient: HttpClient);
18
19
  /**
19
20
  * Returns information and links relating to a single account.
20
21
  * The balances section in the returned JSON will also list all the trust lines this account has set up.
@@ -19,10 +19,10 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var AccountCallBuilder = exports.AccountCallBuilder = function (_CallBuilder) {
22
- function AccountCallBuilder(serverUrl) {
22
+ function AccountCallBuilder(serverUrl, httpClient) {
23
23
  var _this;
24
24
  _classCallCheck(this, AccountCallBuilder);
25
- _this = _callSuper(this, AccountCallBuilder, [serverUrl]);
25
+ _this = _callSuper(this, AccountCallBuilder, [serverUrl, httpClient]);
26
26
  _this.url.segment("accounts");
27
27
  return _this;
28
28
  }
@@ -30,7 +30,7 @@ var AccountCallBuilder = exports.AccountCallBuilder = function (_CallBuilder) {
30
30
  return _createClass(AccountCallBuilder, [{
31
31
  key: "accountId",
32
32
  value: function accountId(id) {
33
- var builder = new _call_builder.CallBuilder(this.url.clone());
33
+ var builder = new _call_builder.CallBuilder(this.url.clone(), this.httpClient);
34
34
  builder.filter.push([id]);
35
35
  return builder;
36
36
  }
@@ -1,5 +1,6 @@
1
1
  import { CallBuilder } from "./call_builder";
2
2
  import { ServerApi } from "./server_api";
3
+ import { HttpClient } from "../http-client";
3
4
  /**
4
5
  * Creates a new {@link AssetsCallBuilder} pointed to server defined by serverUrl.
5
6
  *
@@ -11,7 +12,7 @@ import { ServerApi } from "./server_api";
11
12
  * @param {string} serverUrl Horizon server URL.
12
13
  */
13
14
  export declare class AssetsCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.AssetRecord>> {
14
- constructor(serverUrl: URI);
15
+ constructor(serverUrl: URI, httpClient: HttpClient);
15
16
  /**
16
17
  * This endpoint filters all assets by the asset code.
17
18
  * @param {string} value For example: `USD`
@@ -19,10 +19,10 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var AssetsCallBuilder = exports.AssetsCallBuilder = function (_CallBuilder) {
22
- function AssetsCallBuilder(serverUrl) {
22
+ function AssetsCallBuilder(serverUrl, httpClient) {
23
23
  var _this;
24
24
  _classCallCheck(this, AssetsCallBuilder);
25
- _this = _callSuper(this, AssetsCallBuilder, [serverUrl]);
25
+ _this = _callSuper(this, AssetsCallBuilder, [serverUrl, httpClient]);
26
26
  _this.url.segment("assets");
27
27
  return _this;
28
28
  }
@@ -1,5 +1,6 @@
1
1
  import URI from "urijs";
2
2
  import { HorizonApi } from "./horizon_api";
3
+ import { HttpClient } from "../http-client";
3
4
  import { ServerApi } from "./server_api";
4
5
  export interface EventSourceOptions<T> {
5
6
  onmessage?: (value: T extends ServerApi.CollectionPage<infer U> ? U : T) => void;
@@ -18,7 +19,8 @@ export declare class CallBuilder<T extends HorizonApi.FeeStatsResponse | Horizon
18
19
  filter: string[][];
19
20
  protected originalSegments: string[];
20
21
  protected neighborRoot: string;
21
- constructor(serverUrl: URI, neighborRoot?: string);
22
+ protected httpClient: HttpClient;
23
+ constructor(serverUrl: URI, httpClient: HttpClient, neighborRoot?: string);
22
24
  /**
23
25
  * Triggers a HTTP request using this builder's current configuration.
24
26
  * @returns {Promise} a Promise that resolves to the server's response.
@@ -27,13 +27,14 @@ if (typeof true !== "undefined" && true) {
27
27
  EventSource = (_ref = (_anyGlobal$EventSourc = anyGlobal.EventSource) !== null && _anyGlobal$EventSourc !== void 0 ? _anyGlobal$EventSourc : (_anyGlobal$window = anyGlobal.window) === null || _anyGlobal$window === void 0 ? void 0 : _anyGlobal$window.EventSource) !== null && _ref !== void 0 ? _ref : require("eventsource");
28
28
  }
29
29
  var CallBuilder = exports.CallBuilder = function () {
30
- function CallBuilder(serverUrl) {
31
- var neighborRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
30
+ function CallBuilder(serverUrl, httpClient) {
31
+ var neighborRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
32
32
  _classCallCheck(this, CallBuilder);
33
33
  this.url = serverUrl.clone();
34
34
  this.filter = [];
35
35
  this.originalSegments = this.url.segment() || [];
36
36
  this.neighborRoot = neighborRoot;
37
+ this.httpClient = httpClient;
37
38
  }
38
39
  return _createClass(CallBuilder, [{
39
40
  key: "call",
@@ -241,7 +242,7 @@ var CallBuilder = exports.CallBuilder = function () {
241
242
  if (url.protocol() === "") {
242
243
  url = url.protocol(this.url.protocol());
243
244
  }
244
- return _context3.a(2, _horizon_axios_client.AxiosClient.get(url.toString()).then(function (response) {
245
+ return _context3.a(2, this.httpClient.get(url.toString()).then(function (response) {
245
246
  return response.data;
246
247
  }).catch(this._handleNetworkError));
247
248
  }
@@ -1,6 +1,7 @@
1
1
  import { Asset } from "@stellar/stellar-base";
2
2
  import { CallBuilder } from "./call_builder";
3
3
  import { ServerApi } from "./server_api";
4
+ import { HttpClient } from "../http-client";
4
5
  /**
5
6
  * Creates a new {@link ClaimableBalanceCallBuilder} pointed to server defined by serverUrl.
6
7
  *
@@ -14,7 +15,7 @@ import { ServerApi } from "./server_api";
14
15
  * @param {string} serverUrl Horizon server URL.
15
16
  */
16
17
  export declare class ClaimableBalanceCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.ClaimableBalanceRecord>> {
17
- constructor(serverUrl: URI);
18
+ constructor(serverUrl: URI, httpClient: HttpClient);
18
19
  /**
19
20
  * The claimable balance details endpoint provides information on a single claimable balance.
20
21
  *
@@ -19,10 +19,10 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var ClaimableBalanceCallBuilder = exports.ClaimableBalanceCallBuilder = function (_CallBuilder) {
22
- function ClaimableBalanceCallBuilder(serverUrl) {
22
+ function ClaimableBalanceCallBuilder(serverUrl, httpClient) {
23
23
  var _this;
24
24
  _classCallCheck(this, ClaimableBalanceCallBuilder);
25
- _this = _callSuper(this, ClaimableBalanceCallBuilder, [serverUrl]);
25
+ _this = _callSuper(this, ClaimableBalanceCallBuilder, [serverUrl, httpClient]);
26
26
  _this.url.segment("claimable_balances");
27
27
  return _this;
28
28
  }
@@ -30,7 +30,7 @@ var ClaimableBalanceCallBuilder = exports.ClaimableBalanceCallBuilder = function
30
30
  return _createClass(ClaimableBalanceCallBuilder, [{
31
31
  key: "claimableBalance",
32
32
  value: function claimableBalance(claimableBalanceId) {
33
- var builder = new _call_builder.CallBuilder(this.url.clone());
33
+ var builder = new _call_builder.CallBuilder(this.url.clone(), this.httpClient);
34
34
  builder.filter.push([claimableBalanceId]);
35
35
  return builder;
36
36
  }
@@ -1,5 +1,6 @@
1
1
  import { CallBuilder } from "./call_builder";
2
2
  import { ServerApi } from "./server_api";
3
+ import { HttpClient } from "../http-client";
3
4
  /**
4
5
  * Creates a new {@link EffectCallBuilder} pointed to server defined by serverUrl.
5
6
  * Do not create this object directly, use {@link Horizon.Server#effects}.
@@ -12,7 +13,7 @@ import { ServerApi } from "./server_api";
12
13
  * @param {string} serverUrl Horizon server URL.
13
14
  */
14
15
  export declare class EffectCallBuilder extends CallBuilder<ServerApi.CollectionPage<ServerApi.EffectRecord>> {
15
- constructor(serverUrl: URI);
16
+ constructor(serverUrl: URI, httpClient: HttpClient);
16
17
  /**
17
18
  * This endpoint represents all effects that changed a given account. It will return relevant effects from the creation of the account to the current ledger.
18
19
  * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/get-effects-by-account-id|Effects for Account}
@@ -19,10 +19,10 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var EffectCallBuilder = exports.EffectCallBuilder = function (_CallBuilder) {
22
- function EffectCallBuilder(serverUrl) {
22
+ function EffectCallBuilder(serverUrl, httpClient) {
23
23
  var _this;
24
24
  _classCallCheck(this, EffectCallBuilder);
25
- _this = _callSuper(this, EffectCallBuilder, [serverUrl, "effects"]);
25
+ _this = _callSuper(this, EffectCallBuilder, [serverUrl, httpClient, "effects"]);
26
26
  _this.url.segment("effects");
27
27
  return _this;
28
28
  }
@@ -1,4 +1,5 @@
1
1
  import { CallBuilder } from "./call_builder";
2
+ import { HttpClient } from "../http-client";
2
3
  export declare class FriendbotBuilder extends CallBuilder<any> {
3
- constructor(serverUrl: URI, address: string);
4
+ constructor(serverUrl: URI, httpClient: HttpClient, address: string);
4
5
  }
@@ -19,10 +19,10 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
19
19
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
20
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  var FriendbotBuilder = exports.FriendbotBuilder = function (_CallBuilder) {
22
- function FriendbotBuilder(serverUrl, address) {
22
+ function FriendbotBuilder(serverUrl, httpClient, address) {
23
23
  var _this;
24
24
  _classCallCheck(this, FriendbotBuilder);
25
- _this = _callSuper(this, FriendbotBuilder, [serverUrl]);
25
+ _this = _callSuper(this, FriendbotBuilder, [serverUrl, httpClient]);
26
26
  _this.url.segment("friendbot");
27
27
  _this.url.setQuery("addr", address);
28
28
  return _this;
@@ -1,3 +1,4 @@
1
+ import { HttpClient } from "../http-client";
1
2
  export declare const version: string;
2
3
  export interface ServerTime {
3
4
  serverTime: number;
@@ -21,8 +22,7 @@ export interface ServerTime {
21
22
  * @memberof module:Horizon
22
23
  */
23
24
  export declare const SERVER_TIME_MAP: Record<string, ServerTime>;
24
- export declare const AxiosClient: import("../http-client").HttpClient;
25
- export default AxiosClient;
25
+ export declare function createHttpClient(headers?: Record<string, string>): HttpClient;
26
26
  /**
27
27
  * Given a hostname, get the current time of that server (i.e., use the last-
28
28
  * recorded server time and offset it by the time since then.) If there IS no