@stellar/stellar-sdk 12.3.0 → 13.0.0-rc.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 (514) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +29 -7
  3. package/dist/stellar-sdk-minimal.js +46009 -0
  4. package/dist/stellar-sdk-minimal.min.js +2 -0
  5. package/dist/stellar-sdk-minimal.min.js.LICENSE.txt +69 -0
  6. package/dist/stellar-sdk-no-axios.js +56648 -0
  7. package/dist/stellar-sdk-no-axios.min.js +2 -0
  8. package/dist/stellar-sdk-no-axios.min.js.LICENSE.txt +71 -0
  9. package/dist/stellar-sdk-no-eventsource.js +49822 -0
  10. package/dist/stellar-sdk-no-eventsource.min.js +2 -0
  11. package/dist/stellar-sdk-no-eventsource.min.js.LICENSE.txt +69 -0
  12. package/dist/stellar-sdk.js +28279 -27350
  13. package/dist/stellar-sdk.min.js +1 -1
  14. package/lib/browser.d.ts +2 -2
  15. package/lib/browser.js +5 -7
  16. package/lib/config.d.ts +31 -19
  17. package/lib/contract/assembled_transaction.d.ts +22 -14
  18. package/lib/contract/assembled_transaction.js +159 -128
  19. package/lib/contract/basic_node_signer.d.ts +6 -1
  20. package/lib/contract/client.d.ts +24 -24
  21. package/lib/contract/rust_result.d.ts +22 -12
  22. package/lib/contract/sent_transaction.d.ts +9 -4
  23. package/lib/contract/sent_transaction.js +6 -6
  24. package/lib/contract/spec.d.ts +8 -14
  25. package/lib/contract/types.d.ts +81 -13
  26. package/lib/contract/utils.d.ts +8 -1
  27. package/lib/errors/account_requires_memo.d.ts +24 -0
  28. package/lib/errors/account_requires_memo.js +38 -0
  29. package/lib/errors/bad_request.d.ts +14 -0
  30. package/lib/errors/bad_request.js +34 -0
  31. package/lib/errors/bad_response.d.ts +17 -0
  32. package/lib/errors/bad_response.js +34 -0
  33. package/lib/errors/index.d.ts +5 -0
  34. package/lib/errors/index.js +60 -0
  35. package/lib/errors/network.d.ts +33 -0
  36. package/lib/{errors.js → errors/network.js} +1 -59
  37. package/lib/errors/not_found.d.ts +14 -0
  38. package/lib/errors/not_found.js +34 -0
  39. package/lib/federation/api.d.ts +21 -0
  40. package/lib/federation/index.d.ts +1 -1
  41. package/lib/federation/index.js +16 -6
  42. package/lib/federation/server.d.ts +36 -38
  43. package/lib/federation/server.js +2 -2
  44. package/lib/horizon/account_call_builder.d.ts +10 -8
  45. package/lib/horizon/account_response.d.ts +5 -2
  46. package/lib/horizon/assets_call_builder.d.ts +3 -2
  47. package/lib/horizon/call_builder.js +9 -3
  48. package/lib/horizon/claimable_balances_call_builder.d.ts +10 -8
  49. package/lib/horizon/effect_call_builder.d.ts +8 -7
  50. package/lib/horizon/horizon_axios_client.d.ts +13 -6
  51. package/lib/horizon/horizon_axios_client.js +16 -4
  52. package/lib/horizon/index.d.ts +2 -1
  53. package/lib/horizon/index.js +1 -1
  54. package/lib/horizon/ledger_call_builder.d.ts +6 -4
  55. package/lib/horizon/liquidity_pool_call_builder.d.ts +3 -2
  56. package/lib/horizon/offer_call_builder.d.ts +12 -10
  57. package/lib/horizon/operation_call_builder.d.ts +11 -9
  58. package/lib/horizon/orderbook_call_builder.d.ts +7 -2
  59. package/lib/horizon/path_call_builder.d.ts +7 -2
  60. package/lib/horizon/payment_call_builder.d.ts +10 -6
  61. package/lib/horizon/server.d.ts +64 -55
  62. package/lib/horizon/server.js +6 -5
  63. package/lib/horizon/server_api.d.ts +0 -15
  64. package/lib/horizon/strict_receive_path_call_builder.d.ts +7 -2
  65. package/lib/horizon/strict_send_path_call_builder.d.ts +7 -2
  66. package/lib/horizon/trade_aggregation_call_builder.d.ts +4 -2
  67. package/lib/horizon/trades_call_builder.d.ts +8 -5
  68. package/lib/horizon/transaction_call_builder.d.ts +10 -7
  69. package/lib/horizon/types/assets.d.ts +0 -2
  70. package/lib/http-client/axios-client.d.ts +2 -0
  71. package/lib/http-client/axios-client.js +10 -0
  72. package/lib/http-client/fetch-client.d.ts +11 -0
  73. package/lib/http-client/fetch-client.js +229 -0
  74. package/lib/http-client/index.d.ts +5 -0
  75. package/lib/http-client/index.js +33 -0
  76. package/lib/http-client/types.d.ts +69 -0
  77. package/lib/http-client/types.js +34 -0
  78. package/lib/index.d.ts +3 -8
  79. package/lib/index.js +8 -5
  80. package/lib/minimal/browser.d.ts +6 -0
  81. package/lib/minimal/browser.js +35 -0
  82. package/lib/minimal/config.d.ts +64 -0
  83. package/lib/minimal/config.js +51 -0
  84. package/lib/minimal/contract/assembled_transaction.d.ts +555 -0
  85. package/lib/minimal/contract/assembled_transaction.js +752 -0
  86. package/lib/minimal/contract/basic_node_signer.d.ts +17 -0
  87. package/lib/minimal/contract/basic_node_signer.js +52 -0
  88. package/lib/minimal/contract/client.d.ts +52 -0
  89. package/lib/minimal/contract/client.js +180 -0
  90. package/lib/minimal/contract/index.d.ts +7 -0
  91. package/lib/minimal/contract/index.js +82 -0
  92. package/lib/minimal/contract/rust_result.d.ts +81 -0
  93. package/lib/minimal/contract/rust_result.js +66 -0
  94. package/lib/minimal/contract/sent_transaction.d.ts +84 -0
  95. package/lib/minimal/contract/sent_transaction.js +151 -0
  96. package/lib/minimal/contract/spec.d.ts +152 -0
  97. package/lib/minimal/contract/spec.js +1020 -0
  98. package/lib/minimal/contract/types.d.ts +180 -0
  99. package/lib/minimal/contract/types.js +8 -0
  100. package/lib/minimal/contract/utils.d.ts +46 -0
  101. package/lib/minimal/contract/utils.js +123 -0
  102. package/lib/minimal/errors/account_requires_memo.d.ts +24 -0
  103. package/lib/minimal/errors/account_requires_memo.js +38 -0
  104. package/lib/minimal/errors/bad_request.d.ts +14 -0
  105. package/lib/minimal/errors/bad_request.js +34 -0
  106. package/lib/minimal/errors/bad_response.d.ts +17 -0
  107. package/lib/minimal/errors/bad_response.js +34 -0
  108. package/lib/minimal/errors/index.d.ts +5 -0
  109. package/lib/minimal/errors/index.js +60 -0
  110. package/lib/minimal/errors/network.d.ts +33 -0
  111. package/lib/minimal/errors/network.js +41 -0
  112. package/lib/minimal/errors/not_found.d.ts +14 -0
  113. package/lib/minimal/errors/not_found.js +34 -0
  114. package/lib/minimal/federation/api.d.ts +32 -0
  115. package/lib/minimal/federation/api.js +7 -0
  116. package/lib/minimal/federation/index.d.ts +2 -0
  117. package/lib/minimal/federation/index.js +34 -0
  118. package/lib/minimal/federation/server.d.ts +116 -0
  119. package/lib/minimal/federation/server.js +252 -0
  120. package/lib/minimal/friendbot/index.d.ts +5 -0
  121. package/lib/minimal/friendbot/index.js +7 -0
  122. package/lib/minimal/horizon/account_call_builder.d.ts +56 -0
  123. package/lib/minimal/horizon/account_call_builder.js +62 -0
  124. package/lib/minimal/horizon/account_response.d.ts +61 -0
  125. package/lib/minimal/horizon/account_response.js +49 -0
  126. package/lib/minimal/horizon/assets_call_builder.d.ts +27 -0
  127. package/lib/minimal/horizon/assets_call_builder.js +43 -0
  128. package/lib/minimal/horizon/call_builder.d.ts +128 -0
  129. package/lib/minimal/horizon/call_builder.js +362 -0
  130. package/lib/minimal/horizon/claimable_balances_call_builder.d.ts +50 -0
  131. package/lib/minimal/horizon/claimable_balances_call_builder.js +56 -0
  132. package/lib/minimal/horizon/effect_call_builder.d.ts +53 -0
  133. package/lib/minimal/horizon/effect_call_builder.js +56 -0
  134. package/lib/minimal/horizon/friendbot_builder.d.ts +4 -0
  135. package/lib/minimal/horizon/friendbot_builder.js +32 -0
  136. package/lib/minimal/horizon/horizon_api.d.ts +527 -0
  137. package/lib/minimal/horizon/horizon_api.js +96 -0
  138. package/lib/minimal/horizon/horizon_axios_client.d.ts +37 -0
  139. package/lib/minimal/horizon/horizon_axios_client.js +60 -0
  140. package/lib/minimal/horizon/index.d.ts +8 -0
  141. package/lib/minimal/horizon/index.js +78 -0
  142. package/lib/minimal/horizon/ledger_call_builder.d.ts +23 -0
  143. package/lib/minimal/horizon/ledger_call_builder.js +37 -0
  144. package/lib/minimal/horizon/liquidity_pool_call_builder.d.ts +37 -0
  145. package/lib/minimal/horizon/liquidity_pool_call_builder.js +59 -0
  146. package/lib/minimal/horizon/offer_call_builder.d.ts +65 -0
  147. package/lib/minimal/horizon/offer_call_builder.js +79 -0
  148. package/lib/minimal/horizon/operation_call_builder.d.ts +69 -0
  149. package/lib/minimal/horizon/operation_call_builder.js +69 -0
  150. package/lib/minimal/horizon/orderbook_call_builder.d.ts +20 -0
  151. package/lib/minimal/horizon/orderbook_call_builder.js +45 -0
  152. package/lib/minimal/horizon/path_call_builder.d.ts +35 -0
  153. package/lib/minimal/horizon/path_call_builder.js +41 -0
  154. package/lib/minimal/horizon/payment_call_builder.d.ts +39 -0
  155. package/lib/minimal/horizon/payment_call_builder.js +46 -0
  156. package/lib/minimal/horizon/server.d.ts +389 -0
  157. package/lib/minimal/horizon/server.js +550 -0
  158. package/lib/minimal/horizon/server_api.d.ts +263 -0
  159. package/lib/minimal/horizon/server_api.js +19 -0
  160. package/lib/minimal/horizon/strict_receive_path_call_builder.d.ts +38 -0
  161. package/lib/minimal/horizon/strict_receive_path_call_builder.js +50 -0
  162. package/lib/minimal/horizon/strict_send_path_call_builder.d.ts +38 -0
  163. package/lib/minimal/horizon/strict_send_path_call_builder.js +50 -0
  164. package/lib/minimal/horizon/trade_aggregation_call_builder.d.ts +49 -0
  165. package/lib/minimal/horizon/trade_aggregation_call_builder.js +76 -0
  166. package/lib/minimal/horizon/trades_call_builder.d.ts +52 -0
  167. package/lib/minimal/horizon/trades_call_builder.js +72 -0
  168. package/lib/minimal/horizon/transaction_call_builder.d.ts +60 -0
  169. package/lib/minimal/horizon/transaction_call_builder.js +64 -0
  170. package/lib/minimal/horizon/types/account.d.ts +5 -0
  171. package/lib/minimal/horizon/types/account.js +5 -0
  172. package/lib/minimal/horizon/types/assets.d.ts +17 -0
  173. package/lib/minimal/horizon/types/assets.js +5 -0
  174. package/lib/minimal/horizon/types/effects.d.ts +285 -0
  175. package/lib/minimal/horizon/types/effects.js +62 -0
  176. package/lib/minimal/horizon/types/offer.d.ts +20 -0
  177. package/lib/minimal/horizon/types/offer.js +5 -0
  178. package/lib/minimal/horizon/types/trade.d.ts +13 -0
  179. package/lib/minimal/horizon/types/trade.js +5 -0
  180. package/lib/minimal/http-client/axios-client.d.ts +2 -0
  181. package/lib/minimal/http-client/axios-client.js +10 -0
  182. package/lib/minimal/http-client/fetch-client.d.ts +11 -0
  183. package/lib/minimal/http-client/fetch-client.js +229 -0
  184. package/lib/minimal/http-client/index.d.ts +5 -0
  185. package/lib/minimal/http-client/index.js +33 -0
  186. package/lib/minimal/http-client/types.d.ts +69 -0
  187. package/lib/minimal/http-client/types.js +34 -0
  188. package/lib/minimal/index.d.ts +32 -0
  189. package/lib/minimal/index.js +80 -0
  190. package/lib/minimal/rpc/api.d.ts +362 -0
  191. package/lib/minimal/rpc/api.js +32 -0
  192. package/lib/minimal/rpc/axios.d.ts +4 -0
  193. package/lib/minimal/rpc/axios.js +15 -0
  194. package/lib/minimal/rpc/browser.d.ts +4 -0
  195. package/lib/minimal/rpc/browser.js +27 -0
  196. package/lib/minimal/rpc/index.d.ts +8 -0
  197. package/lib/minimal/rpc/index.js +86 -0
  198. package/lib/minimal/rpc/jsonrpc.d.ts +35 -0
  199. package/lib/minimal/rpc/jsonrpc.js +52 -0
  200. package/lib/minimal/rpc/parsers.d.ts +39 -0
  201. package/lib/minimal/rpc/parsers.js +155 -0
  202. package/lib/minimal/rpc/server.d.ts +622 -0
  203. package/lib/minimal/rpc/server.js +877 -0
  204. package/lib/minimal/rpc/transaction.d.ts +21 -0
  205. package/lib/minimal/rpc/transaction.js +53 -0
  206. package/lib/minimal/rpc/utils.d.ts +1 -0
  207. package/lib/minimal/rpc/utils.js +9 -0
  208. package/lib/minimal/stellartoml/index.d.ts +131 -0
  209. package/lib/minimal/stellartoml/index.js +77 -0
  210. package/lib/minimal/utils.d.ts +20 -0
  211. package/lib/minimal/utils.js +38 -0
  212. package/lib/minimal/webauth/errors.d.ts +13 -0
  213. package/lib/minimal/webauth/errors.js +36 -0
  214. package/lib/minimal/webauth/index.d.ts +2 -0
  215. package/lib/minimal/webauth/index.js +27 -0
  216. package/lib/minimal/webauth/utils.d.ts +307 -0
  217. package/lib/minimal/webauth/utils.js +332 -0
  218. package/lib/no-axios/browser.d.ts +6 -0
  219. package/lib/no-axios/browser.js +35 -0
  220. package/lib/no-axios/config.d.ts +64 -0
  221. package/lib/no-axios/config.js +51 -0
  222. package/lib/no-axios/contract/assembled_transaction.d.ts +555 -0
  223. package/lib/no-axios/contract/assembled_transaction.js +752 -0
  224. package/lib/no-axios/contract/basic_node_signer.d.ts +17 -0
  225. package/lib/no-axios/contract/basic_node_signer.js +52 -0
  226. package/lib/no-axios/contract/client.d.ts +52 -0
  227. package/lib/no-axios/contract/client.js +180 -0
  228. package/lib/no-axios/contract/index.d.ts +7 -0
  229. package/lib/no-axios/contract/index.js +82 -0
  230. package/lib/no-axios/contract/rust_result.d.ts +81 -0
  231. package/lib/no-axios/contract/rust_result.js +66 -0
  232. package/lib/no-axios/contract/sent_transaction.d.ts +84 -0
  233. package/lib/no-axios/contract/sent_transaction.js +151 -0
  234. package/lib/no-axios/contract/spec.d.ts +152 -0
  235. package/lib/no-axios/contract/spec.js +1020 -0
  236. package/lib/no-axios/contract/types.d.ts +180 -0
  237. package/lib/no-axios/contract/types.js +8 -0
  238. package/lib/no-axios/contract/utils.d.ts +46 -0
  239. package/lib/no-axios/contract/utils.js +123 -0
  240. package/lib/no-axios/errors/account_requires_memo.d.ts +24 -0
  241. package/lib/no-axios/errors/account_requires_memo.js +38 -0
  242. package/lib/no-axios/errors/bad_request.d.ts +14 -0
  243. package/lib/no-axios/errors/bad_request.js +34 -0
  244. package/lib/no-axios/errors/bad_response.d.ts +17 -0
  245. package/lib/no-axios/errors/bad_response.js +34 -0
  246. package/lib/no-axios/errors/index.d.ts +5 -0
  247. package/lib/no-axios/errors/index.js +60 -0
  248. package/lib/no-axios/errors/network.d.ts +33 -0
  249. package/lib/no-axios/errors/network.js +41 -0
  250. package/lib/no-axios/errors/not_found.d.ts +14 -0
  251. package/lib/no-axios/errors/not_found.js +34 -0
  252. package/lib/no-axios/federation/api.d.ts +32 -0
  253. package/lib/no-axios/federation/api.js +7 -0
  254. package/lib/no-axios/federation/index.d.ts +2 -0
  255. package/lib/no-axios/federation/index.js +34 -0
  256. package/lib/no-axios/federation/server.d.ts +116 -0
  257. package/lib/no-axios/federation/server.js +252 -0
  258. package/lib/no-axios/friendbot/index.d.ts +5 -0
  259. package/lib/no-axios/friendbot/index.js +7 -0
  260. package/lib/no-axios/horizon/account_call_builder.d.ts +56 -0
  261. package/lib/no-axios/horizon/account_call_builder.js +62 -0
  262. package/lib/no-axios/horizon/account_response.d.ts +61 -0
  263. package/lib/no-axios/horizon/account_response.js +49 -0
  264. package/lib/no-axios/horizon/assets_call_builder.d.ts +27 -0
  265. package/lib/no-axios/horizon/assets_call_builder.js +43 -0
  266. package/lib/no-axios/horizon/call_builder.d.ts +128 -0
  267. package/lib/no-axios/horizon/call_builder.js +362 -0
  268. package/lib/no-axios/horizon/claimable_balances_call_builder.d.ts +50 -0
  269. package/lib/no-axios/horizon/claimable_balances_call_builder.js +56 -0
  270. package/lib/no-axios/horizon/effect_call_builder.d.ts +53 -0
  271. package/lib/no-axios/horizon/effect_call_builder.js +56 -0
  272. package/lib/no-axios/horizon/friendbot_builder.d.ts +4 -0
  273. package/lib/no-axios/horizon/friendbot_builder.js +32 -0
  274. package/lib/no-axios/horizon/horizon_api.d.ts +527 -0
  275. package/lib/no-axios/horizon/horizon_api.js +96 -0
  276. package/lib/no-axios/horizon/horizon_axios_client.d.ts +37 -0
  277. package/lib/no-axios/horizon/horizon_axios_client.js +60 -0
  278. package/lib/no-axios/horizon/index.d.ts +8 -0
  279. package/lib/no-axios/horizon/index.js +78 -0
  280. package/lib/no-axios/horizon/ledger_call_builder.d.ts +23 -0
  281. package/lib/no-axios/horizon/ledger_call_builder.js +37 -0
  282. package/lib/no-axios/horizon/liquidity_pool_call_builder.d.ts +37 -0
  283. package/lib/no-axios/horizon/liquidity_pool_call_builder.js +59 -0
  284. package/lib/no-axios/horizon/offer_call_builder.d.ts +65 -0
  285. package/lib/no-axios/horizon/offer_call_builder.js +79 -0
  286. package/lib/no-axios/horizon/operation_call_builder.d.ts +69 -0
  287. package/lib/no-axios/horizon/operation_call_builder.js +69 -0
  288. package/lib/no-axios/horizon/orderbook_call_builder.d.ts +20 -0
  289. package/lib/no-axios/horizon/orderbook_call_builder.js +45 -0
  290. package/lib/no-axios/horizon/path_call_builder.d.ts +35 -0
  291. package/lib/no-axios/horizon/path_call_builder.js +41 -0
  292. package/lib/no-axios/horizon/payment_call_builder.d.ts +39 -0
  293. package/lib/no-axios/horizon/payment_call_builder.js +46 -0
  294. package/lib/no-axios/horizon/server.d.ts +389 -0
  295. package/lib/no-axios/horizon/server.js +550 -0
  296. package/lib/no-axios/horizon/server_api.d.ts +263 -0
  297. package/lib/no-axios/horizon/server_api.js +19 -0
  298. package/lib/no-axios/horizon/strict_receive_path_call_builder.d.ts +38 -0
  299. package/lib/no-axios/horizon/strict_receive_path_call_builder.js +50 -0
  300. package/lib/no-axios/horizon/strict_send_path_call_builder.d.ts +38 -0
  301. package/lib/no-axios/horizon/strict_send_path_call_builder.js +50 -0
  302. package/lib/no-axios/horizon/trade_aggregation_call_builder.d.ts +49 -0
  303. package/lib/no-axios/horizon/trade_aggregation_call_builder.js +76 -0
  304. package/lib/no-axios/horizon/trades_call_builder.d.ts +52 -0
  305. package/lib/no-axios/horizon/trades_call_builder.js +72 -0
  306. package/lib/no-axios/horizon/transaction_call_builder.d.ts +60 -0
  307. package/lib/no-axios/horizon/transaction_call_builder.js +64 -0
  308. package/lib/no-axios/horizon/types/account.d.ts +5 -0
  309. package/lib/no-axios/horizon/types/account.js +5 -0
  310. package/lib/no-axios/horizon/types/assets.d.ts +17 -0
  311. package/lib/no-axios/horizon/types/assets.js +5 -0
  312. package/lib/no-axios/horizon/types/effects.d.ts +285 -0
  313. package/lib/no-axios/horizon/types/effects.js +62 -0
  314. package/lib/no-axios/horizon/types/offer.d.ts +20 -0
  315. package/lib/no-axios/horizon/types/offer.js +5 -0
  316. package/lib/no-axios/horizon/types/trade.d.ts +13 -0
  317. package/lib/no-axios/horizon/types/trade.js +5 -0
  318. package/lib/no-axios/http-client/axios-client.d.ts +2 -0
  319. package/lib/no-axios/http-client/axios-client.js +10 -0
  320. package/lib/no-axios/http-client/fetch-client.d.ts +11 -0
  321. package/lib/no-axios/http-client/fetch-client.js +229 -0
  322. package/lib/no-axios/http-client/index.d.ts +5 -0
  323. package/lib/no-axios/http-client/index.js +33 -0
  324. package/lib/no-axios/http-client/types.d.ts +69 -0
  325. package/lib/no-axios/http-client/types.js +34 -0
  326. package/lib/no-axios/index.d.ts +32 -0
  327. package/lib/no-axios/index.js +80 -0
  328. package/lib/no-axios/rpc/api.d.ts +362 -0
  329. package/lib/no-axios/rpc/api.js +32 -0
  330. package/lib/no-axios/rpc/axios.d.ts +4 -0
  331. package/lib/no-axios/rpc/axios.js +15 -0
  332. package/lib/no-axios/rpc/browser.d.ts +4 -0
  333. package/lib/no-axios/rpc/browser.js +27 -0
  334. package/lib/no-axios/rpc/index.d.ts +8 -0
  335. package/lib/no-axios/rpc/index.js +86 -0
  336. package/lib/no-axios/rpc/jsonrpc.d.ts +35 -0
  337. package/lib/no-axios/rpc/jsonrpc.js +52 -0
  338. package/lib/no-axios/rpc/parsers.d.ts +39 -0
  339. package/lib/no-axios/rpc/parsers.js +155 -0
  340. package/lib/no-axios/rpc/server.d.ts +622 -0
  341. package/lib/no-axios/rpc/server.js +877 -0
  342. package/lib/no-axios/rpc/transaction.d.ts +21 -0
  343. package/lib/no-axios/rpc/transaction.js +53 -0
  344. package/lib/no-axios/rpc/utils.d.ts +1 -0
  345. package/lib/no-axios/rpc/utils.js +9 -0
  346. package/lib/no-axios/stellartoml/index.d.ts +131 -0
  347. package/lib/no-axios/stellartoml/index.js +77 -0
  348. package/lib/no-axios/utils.d.ts +20 -0
  349. package/lib/no-axios/utils.js +38 -0
  350. package/lib/no-axios/webauth/errors.d.ts +13 -0
  351. package/lib/no-axios/webauth/errors.js +36 -0
  352. package/lib/no-axios/webauth/index.d.ts +2 -0
  353. package/lib/no-axios/webauth/index.js +27 -0
  354. package/lib/no-axios/webauth/utils.d.ts +307 -0
  355. package/lib/no-axios/webauth/utils.js +332 -0
  356. package/lib/no-eventsource/browser.d.ts +6 -0
  357. package/lib/no-eventsource/browser.js +35 -0
  358. package/lib/no-eventsource/config.d.ts +64 -0
  359. package/lib/no-eventsource/config.js +51 -0
  360. package/lib/no-eventsource/contract/assembled_transaction.d.ts +555 -0
  361. package/lib/no-eventsource/contract/assembled_transaction.js +752 -0
  362. package/lib/no-eventsource/contract/basic_node_signer.d.ts +17 -0
  363. package/lib/no-eventsource/contract/basic_node_signer.js +52 -0
  364. package/lib/no-eventsource/contract/client.d.ts +52 -0
  365. package/lib/no-eventsource/contract/client.js +180 -0
  366. package/lib/no-eventsource/contract/index.d.ts +7 -0
  367. package/lib/no-eventsource/contract/index.js +82 -0
  368. package/lib/no-eventsource/contract/rust_result.d.ts +81 -0
  369. package/lib/no-eventsource/contract/rust_result.js +66 -0
  370. package/lib/no-eventsource/contract/sent_transaction.d.ts +84 -0
  371. package/lib/no-eventsource/contract/sent_transaction.js +151 -0
  372. package/lib/no-eventsource/contract/spec.d.ts +152 -0
  373. package/lib/no-eventsource/contract/spec.js +1020 -0
  374. package/lib/no-eventsource/contract/types.d.ts +180 -0
  375. package/lib/no-eventsource/contract/types.js +8 -0
  376. package/lib/no-eventsource/contract/utils.d.ts +46 -0
  377. package/lib/no-eventsource/contract/utils.js +123 -0
  378. package/lib/no-eventsource/errors/account_requires_memo.d.ts +24 -0
  379. package/lib/no-eventsource/errors/account_requires_memo.js +38 -0
  380. package/lib/no-eventsource/errors/bad_request.d.ts +14 -0
  381. package/lib/no-eventsource/errors/bad_request.js +34 -0
  382. package/lib/no-eventsource/errors/bad_response.d.ts +17 -0
  383. package/lib/no-eventsource/errors/bad_response.js +34 -0
  384. package/lib/no-eventsource/errors/index.d.ts +5 -0
  385. package/lib/no-eventsource/errors/index.js +60 -0
  386. package/lib/no-eventsource/errors/network.d.ts +33 -0
  387. package/lib/no-eventsource/errors/network.js +41 -0
  388. package/lib/no-eventsource/errors/not_found.d.ts +14 -0
  389. package/lib/no-eventsource/errors/not_found.js +34 -0
  390. package/lib/no-eventsource/federation/api.d.ts +32 -0
  391. package/lib/no-eventsource/federation/api.js +7 -0
  392. package/lib/no-eventsource/federation/index.d.ts +2 -0
  393. package/lib/no-eventsource/federation/index.js +34 -0
  394. package/lib/no-eventsource/federation/server.d.ts +116 -0
  395. package/lib/no-eventsource/federation/server.js +252 -0
  396. package/lib/no-eventsource/friendbot/index.d.ts +5 -0
  397. package/lib/no-eventsource/friendbot/index.js +7 -0
  398. package/lib/no-eventsource/horizon/account_call_builder.d.ts +56 -0
  399. package/lib/no-eventsource/horizon/account_call_builder.js +62 -0
  400. package/lib/no-eventsource/horizon/account_response.d.ts +61 -0
  401. package/lib/no-eventsource/horizon/account_response.js +49 -0
  402. package/lib/no-eventsource/horizon/assets_call_builder.d.ts +27 -0
  403. package/lib/no-eventsource/horizon/assets_call_builder.js +43 -0
  404. package/lib/no-eventsource/horizon/call_builder.d.ts +128 -0
  405. package/lib/no-eventsource/horizon/call_builder.js +362 -0
  406. package/lib/no-eventsource/horizon/claimable_balances_call_builder.d.ts +50 -0
  407. package/lib/no-eventsource/horizon/claimable_balances_call_builder.js +56 -0
  408. package/lib/no-eventsource/horizon/effect_call_builder.d.ts +53 -0
  409. package/lib/no-eventsource/horizon/effect_call_builder.js +56 -0
  410. package/lib/no-eventsource/horizon/friendbot_builder.d.ts +4 -0
  411. package/lib/no-eventsource/horizon/friendbot_builder.js +32 -0
  412. package/lib/no-eventsource/horizon/horizon_api.d.ts +527 -0
  413. package/lib/no-eventsource/horizon/horizon_api.js +96 -0
  414. package/lib/no-eventsource/horizon/horizon_axios_client.d.ts +37 -0
  415. package/lib/no-eventsource/horizon/horizon_axios_client.js +60 -0
  416. package/lib/no-eventsource/horizon/index.d.ts +8 -0
  417. package/lib/no-eventsource/horizon/index.js +78 -0
  418. package/lib/no-eventsource/horizon/ledger_call_builder.d.ts +23 -0
  419. package/lib/no-eventsource/horizon/ledger_call_builder.js +37 -0
  420. package/lib/no-eventsource/horizon/liquidity_pool_call_builder.d.ts +37 -0
  421. package/lib/no-eventsource/horizon/liquidity_pool_call_builder.js +59 -0
  422. package/lib/no-eventsource/horizon/offer_call_builder.d.ts +65 -0
  423. package/lib/no-eventsource/horizon/offer_call_builder.js +79 -0
  424. package/lib/no-eventsource/horizon/operation_call_builder.d.ts +69 -0
  425. package/lib/no-eventsource/horizon/operation_call_builder.js +69 -0
  426. package/lib/no-eventsource/horizon/orderbook_call_builder.d.ts +20 -0
  427. package/lib/no-eventsource/horizon/orderbook_call_builder.js +45 -0
  428. package/lib/no-eventsource/horizon/path_call_builder.d.ts +35 -0
  429. package/lib/no-eventsource/horizon/path_call_builder.js +41 -0
  430. package/lib/no-eventsource/horizon/payment_call_builder.d.ts +39 -0
  431. package/lib/no-eventsource/horizon/payment_call_builder.js +46 -0
  432. package/lib/no-eventsource/horizon/server.d.ts +389 -0
  433. package/lib/no-eventsource/horizon/server.js +550 -0
  434. package/lib/no-eventsource/horizon/server_api.d.ts +263 -0
  435. package/lib/no-eventsource/horizon/server_api.js +19 -0
  436. package/lib/no-eventsource/horizon/strict_receive_path_call_builder.d.ts +38 -0
  437. package/lib/no-eventsource/horizon/strict_receive_path_call_builder.js +50 -0
  438. package/lib/no-eventsource/horizon/strict_send_path_call_builder.d.ts +38 -0
  439. package/lib/no-eventsource/horizon/strict_send_path_call_builder.js +50 -0
  440. package/lib/no-eventsource/horizon/trade_aggregation_call_builder.d.ts +49 -0
  441. package/lib/no-eventsource/horizon/trade_aggregation_call_builder.js +76 -0
  442. package/lib/no-eventsource/horizon/trades_call_builder.d.ts +52 -0
  443. package/lib/no-eventsource/horizon/trades_call_builder.js +72 -0
  444. package/lib/no-eventsource/horizon/transaction_call_builder.d.ts +60 -0
  445. package/lib/no-eventsource/horizon/transaction_call_builder.js +64 -0
  446. package/lib/no-eventsource/horizon/types/account.d.ts +5 -0
  447. package/lib/no-eventsource/horizon/types/account.js +5 -0
  448. package/lib/no-eventsource/horizon/types/assets.d.ts +17 -0
  449. package/lib/no-eventsource/horizon/types/assets.js +5 -0
  450. package/lib/no-eventsource/horizon/types/effects.d.ts +285 -0
  451. package/lib/no-eventsource/horizon/types/effects.js +62 -0
  452. package/lib/no-eventsource/horizon/types/offer.d.ts +20 -0
  453. package/lib/no-eventsource/horizon/types/offer.js +5 -0
  454. package/lib/no-eventsource/horizon/types/trade.d.ts +13 -0
  455. package/lib/no-eventsource/horizon/types/trade.js +5 -0
  456. package/lib/no-eventsource/http-client/axios-client.d.ts +2 -0
  457. package/lib/no-eventsource/http-client/axios-client.js +10 -0
  458. package/lib/no-eventsource/http-client/fetch-client.d.ts +11 -0
  459. package/lib/no-eventsource/http-client/fetch-client.js +229 -0
  460. package/lib/no-eventsource/http-client/index.d.ts +5 -0
  461. package/lib/no-eventsource/http-client/index.js +33 -0
  462. package/lib/no-eventsource/http-client/types.d.ts +69 -0
  463. package/lib/no-eventsource/http-client/types.js +34 -0
  464. package/lib/no-eventsource/index.d.ts +32 -0
  465. package/lib/no-eventsource/index.js +80 -0
  466. package/lib/no-eventsource/rpc/api.d.ts +362 -0
  467. package/lib/no-eventsource/rpc/api.js +32 -0
  468. package/lib/no-eventsource/rpc/axios.d.ts +4 -0
  469. package/lib/no-eventsource/rpc/axios.js +15 -0
  470. package/lib/no-eventsource/rpc/browser.d.ts +4 -0
  471. package/lib/no-eventsource/rpc/browser.js +27 -0
  472. package/lib/no-eventsource/rpc/index.d.ts +8 -0
  473. package/lib/no-eventsource/rpc/index.js +86 -0
  474. package/lib/no-eventsource/rpc/jsonrpc.d.ts +35 -0
  475. package/lib/no-eventsource/rpc/jsonrpc.js +52 -0
  476. package/lib/no-eventsource/rpc/parsers.d.ts +39 -0
  477. package/lib/no-eventsource/rpc/parsers.js +155 -0
  478. package/lib/no-eventsource/rpc/server.d.ts +622 -0
  479. package/lib/no-eventsource/rpc/server.js +877 -0
  480. package/lib/no-eventsource/rpc/transaction.d.ts +21 -0
  481. package/lib/no-eventsource/rpc/transaction.js +53 -0
  482. package/lib/no-eventsource/rpc/utils.d.ts +1 -0
  483. package/lib/no-eventsource/rpc/utils.js +9 -0
  484. package/lib/no-eventsource/stellartoml/index.d.ts +131 -0
  485. package/lib/no-eventsource/stellartoml/index.js +77 -0
  486. package/lib/no-eventsource/utils.d.ts +20 -0
  487. package/lib/no-eventsource/utils.js +38 -0
  488. package/lib/no-eventsource/webauth/errors.d.ts +13 -0
  489. package/lib/no-eventsource/webauth/errors.js +36 -0
  490. package/lib/no-eventsource/webauth/index.d.ts +2 -0
  491. package/lib/no-eventsource/webauth/index.js +27 -0
  492. package/lib/no-eventsource/webauth/utils.d.ts +307 -0
  493. package/lib/no-eventsource/webauth/utils.js +332 -0
  494. package/lib/rpc/api.d.ts +25 -11
  495. package/lib/rpc/axios.d.ts +3 -2
  496. package/lib/rpc/axios.js +3 -4
  497. package/lib/rpc/browser.d.ts +0 -2
  498. package/lib/rpc/browser.js +1 -11
  499. package/lib/rpc/index.d.ts +2 -1
  500. package/lib/rpc/index.js +15 -1
  501. package/lib/rpc/jsonrpc.d.ts +9 -1
  502. package/lib/rpc/parsers.d.ts +31 -11
  503. package/lib/rpc/parsers.js +14 -14
  504. package/lib/rpc/server.d.ts +207 -99
  505. package/lib/rpc/server.js +273 -133
  506. package/lib/rpc/transaction.d.ts +11 -9
  507. package/lib/stellartoml/index.d.ts +21 -11
  508. package/lib/stellartoml/index.js +3 -3
  509. package/lib/utils.d.ts +12 -4
  510. package/lib/utils.js +7 -0
  511. package/lib/webauth/errors.d.ts +9 -0
  512. package/lib/webauth/utils.d.ts +67 -54
  513. package/package.json +73 -21
  514. package/lib/errors.d.ts +0 -59
package/lib/rpc/server.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Server = exports.SUBMIT_TRANSACTION_TIMEOUT = exports.Durability = void 0;
6
+ exports.SUBMIT_TRANSACTION_TIMEOUT = exports.RpcServer = exports.LinearSleepStrategy = exports.Durability = exports.BasicSleepStrategy = void 0;
7
7
  var _urijs = _interopRequireDefault(require("urijs"));
8
8
  var _stellarBase = require("@stellar/stellar-base");
9
9
  var _axios = _interopRequireDefault(require("./axios"));
@@ -11,6 +11,7 @@ var jsonrpc = _interopRequireWildcard(require("./jsonrpc"));
11
11
  var _api = require("./api");
12
12
  var _transaction = require("./transaction");
13
13
  var _parsers = require("./parsers");
14
+ var _utils = require("../utils");
14
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -32,6 +33,13 @@ var Durability = exports.Durability = function (Durability) {
32
33
  Durability["Persistent"] = "persistent";
33
34
  return Durability;
34
35
  }({});
36
+ var DEFAULT_GET_TRANSACTION_TIMEOUT = 30;
37
+ var BasicSleepStrategy = exports.BasicSleepStrategy = function BasicSleepStrategy(_iter) {
38
+ return 1000;
39
+ };
40
+ var LinearSleepStrategy = exports.LinearSleepStrategy = function LinearSleepStrategy(iter) {
41
+ return 1000 * iter;
42
+ };
35
43
  function findCreatedAccountSequenceInTransactionMeta(meta) {
36
44
  var _operations$flatMap$f;
37
45
  var operations = [];
@@ -57,10 +65,10 @@ function findCreatedAccountSequenceInTransactionMeta(meta) {
57
65
  }
58
66
  throw new Error('No account created in transaction');
59
67
  }
60
- var Server = exports.Server = function () {
61
- function Server(serverURL) {
68
+ var RpcServer = exports.RpcServer = function () {
69
+ function RpcServer(serverURL) {
62
70
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
63
- _classCallCheck(this, Server);
71
+ _classCallCheck(this, RpcServer);
64
72
  this.serverURL = (0, _urijs.default)(serverURL);
65
73
  if (opts.headers && Object.keys(opts.headers).length !== 0) {
66
74
  _axios.default.interceptors.request.use(function (config) {
@@ -72,7 +80,7 @@ var Server = exports.Server = function () {
72
80
  throw new Error("Cannot connect to insecure Soroban RPC server if `allowHttp` isn't set");
73
81
  }
74
82
  }
75
- return _createClass(Server, [{
83
+ return _createClass(RpcServer, [{
76
84
  key: "getAccount",
77
85
  value: (function () {
78
86
  var _getAccount = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(address) {
@@ -336,19 +344,65 @@ var Server = exports.Server = function () {
336
344
  return _getLedgerEntries;
337
345
  }()
338
346
  }, {
339
- key: "getTransaction",
347
+ key: "pollTransaction",
340
348
  value: (function () {
341
- var _getTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(hash) {
349
+ var _pollTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(hash, opts) {
350
+ var _opts$attempts, _opts$attempts2;
351
+ var maxAttempts, foundInfo, attempt, _opts$sleepStrategy;
342
352
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
343
353
  while (1) switch (_context8.prev = _context8.next) {
344
354
  case 0:
345
- return _context8.abrupt("return", this._getTransaction(hash).then(function (raw) {
355
+ maxAttempts = ((_opts$attempts = opts === null || opts === void 0 ? void 0 : opts.attempts) !== null && _opts$attempts !== void 0 ? _opts$attempts : 0) < 1 ? DEFAULT_GET_TRANSACTION_TIMEOUT : (_opts$attempts2 = opts === null || opts === void 0 ? void 0 : opts.attempts) !== null && _opts$attempts2 !== void 0 ? _opts$attempts2 : DEFAULT_GET_TRANSACTION_TIMEOUT;
356
+ attempt = 1;
357
+ case 2:
358
+ if (!(attempt < maxAttempts)) {
359
+ _context8.next = 13;
360
+ break;
361
+ }
362
+ _context8.next = 5;
363
+ return this.getTransaction(hash);
364
+ case 5:
365
+ foundInfo = _context8.sent;
366
+ if (!(foundInfo.status !== _api.Api.GetTransactionStatus.NOT_FOUND)) {
367
+ _context8.next = 8;
368
+ break;
369
+ }
370
+ return _context8.abrupt("return", foundInfo);
371
+ case 8:
372
+ _context8.next = 10;
373
+ return _utils.Utils.sleep(((_opts$sleepStrategy = opts === null || opts === void 0 ? void 0 : opts.sleepStrategy) !== null && _opts$sleepStrategy !== void 0 ? _opts$sleepStrategy : BasicSleepStrategy)(attempt));
374
+ case 10:
375
+ attempt++;
376
+ _context8.next = 2;
377
+ break;
378
+ case 13:
379
+ return _context8.abrupt("return", foundInfo);
380
+ case 14:
381
+ case "end":
382
+ return _context8.stop();
383
+ }
384
+ }, _callee8, this);
385
+ }));
386
+ function pollTransaction(_x6, _x7) {
387
+ return _pollTransaction.apply(this, arguments);
388
+ }
389
+ return pollTransaction;
390
+ }())
391
+ }, {
392
+ key: "getTransaction",
393
+ value: (function () {
394
+ var _getTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee9(hash) {
395
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
396
+ while (1) switch (_context9.prev = _context9.next) {
397
+ case 0:
398
+ return _context9.abrupt("return", this._getTransaction(hash).then(function (raw) {
346
399
  var foundInfo = {};
347
400
  if (raw.status !== _api.Api.GetTransactionStatus.NOT_FOUND) {
348
401
  Object.assign(foundInfo, (0, _parsers.parseTransactionInfo)(raw));
349
402
  }
350
403
  var result = _objectSpread({
351
404
  status: raw.status,
405
+ txHash: hash,
352
406
  latestLedger: raw.latestLedger,
353
407
  latestLedgerCloseTime: raw.latestLedgerCloseTime,
354
408
  oldestLedger: raw.oldestLedger,
@@ -358,11 +412,11 @@ var Server = exports.Server = function () {
358
412
  }));
359
413
  case 1:
360
414
  case "end":
361
- return _context8.stop();
415
+ return _context9.stop();
362
416
  }
363
- }, _callee8, this);
417
+ }, _callee9, this);
364
418
  }));
365
- function getTransaction(_x6) {
419
+ function getTransaction(_x8) {
366
420
  return _getTransaction2.apply(this, arguments);
367
421
  }
368
422
  return getTransaction;
@@ -370,20 +424,20 @@ var Server = exports.Server = function () {
370
424
  }, {
371
425
  key: "_getTransaction",
372
426
  value: function () {
373
- var _getTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee9(hash) {
374
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
375
- while (1) switch (_context9.prev = _context9.next) {
427
+ var _getTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee10(hash) {
428
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
429
+ while (1) switch (_context10.prev = _context10.next) {
376
430
  case 0:
377
- return _context9.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getTransaction', {
431
+ return _context10.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getTransaction', {
378
432
  hash: hash
379
433
  }));
380
434
  case 1:
381
435
  case "end":
382
- return _context9.stop();
436
+ return _context10.stop();
383
437
  }
384
- }, _callee9, this);
438
+ }, _callee10, this);
385
439
  }));
386
- function _getTransaction(_x7) {
440
+ function _getTransaction(_x9) {
387
441
  return _getTransaction3.apply(this, arguments);
388
442
  }
389
443
  return _getTransaction;
@@ -391,11 +445,11 @@ var Server = exports.Server = function () {
391
445
  }, {
392
446
  key: "getTransactions",
393
447
  value: (function () {
394
- var _getTransactions2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee10(request) {
395
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
396
- while (1) switch (_context10.prev = _context10.next) {
448
+ var _getTransactions2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee11(request) {
449
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
450
+ while (1) switch (_context11.prev = _context11.next) {
397
451
  case 0:
398
- return _context10.abrupt("return", this._getTransactions(request).then(function (raw) {
452
+ return _context11.abrupt("return", this._getTransactions(request).then(function (raw) {
399
453
  var result = {
400
454
  transactions: raw.transactions.map(_parsers.parseRawTransactions),
401
455
  latestLedger: raw.latestLedger,
@@ -408,11 +462,11 @@ var Server = exports.Server = function () {
408
462
  }));
409
463
  case 1:
410
464
  case "end":
411
- return _context10.stop();
465
+ return _context11.stop();
412
466
  }
413
- }, _callee10, this);
467
+ }, _callee11, this);
414
468
  }));
415
- function getTransactions(_x8) {
469
+ function getTransactions(_x10) {
416
470
  return _getTransactions2.apply(this, arguments);
417
471
  }
418
472
  return getTransactions;
@@ -420,18 +474,18 @@ var Server = exports.Server = function () {
420
474
  }, {
421
475
  key: "_getTransactions",
422
476
  value: function () {
423
- var _getTransactions3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee11(request) {
424
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
425
- while (1) switch (_context11.prev = _context11.next) {
477
+ var _getTransactions3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee12(request) {
478
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
479
+ while (1) switch (_context12.prev = _context12.next) {
426
480
  case 0:
427
- return _context11.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getTransactions', request));
481
+ return _context12.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getTransactions', request));
428
482
  case 1:
429
483
  case "end":
430
- return _context11.stop();
484
+ return _context12.stop();
431
485
  }
432
- }, _callee11, this);
486
+ }, _callee12, this);
433
487
  }));
434
- function _getTransactions(_x9) {
488
+ function _getTransactions(_x11) {
435
489
  return _getTransactions3.apply(this, arguments);
436
490
  }
437
491
  return _getTransactions;
@@ -439,18 +493,18 @@ var Server = exports.Server = function () {
439
493
  }, {
440
494
  key: "getEvents",
441
495
  value: (function () {
442
- var _getEvents2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee12(request) {
443
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
444
- while (1) switch (_context12.prev = _context12.next) {
496
+ var _getEvents2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee13(request) {
497
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
498
+ while (1) switch (_context13.prev = _context13.next) {
445
499
  case 0:
446
- return _context12.abrupt("return", this._getEvents(request).then(_parsers.parseRawEvents));
500
+ return _context13.abrupt("return", this._getEvents(request).then(_parsers.parseRawEvents));
447
501
  case 1:
448
502
  case "end":
449
- return _context12.stop();
503
+ return _context13.stop();
450
504
  }
451
- }, _callee12, this);
505
+ }, _callee13, this);
452
506
  }));
453
- function getEvents(_x10) {
507
+ function getEvents(_x12) {
454
508
  return _getEvents2.apply(this, arguments);
455
509
  }
456
510
  return getEvents;
@@ -458,12 +512,12 @@ var Server = exports.Server = function () {
458
512
  }, {
459
513
  key: "_getEvents",
460
514
  value: function () {
461
- var _getEvents3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee13(request) {
515
+ var _getEvents3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee14(request) {
462
516
  var _request$filters;
463
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
464
- while (1) switch (_context13.prev = _context13.next) {
517
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
518
+ while (1) switch (_context14.prev = _context14.next) {
465
519
  case 0:
466
- return _context13.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
520
+ return _context14.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getEvents', _objectSpread(_objectSpread({
467
521
  filters: (_request$filters = request.filters) !== null && _request$filters !== void 0 ? _request$filters : [],
468
522
  pagination: _objectSpread(_objectSpread({}, request.cursor && {
469
523
  cursor: request.cursor
@@ -472,14 +526,16 @@ var Server = exports.Server = function () {
472
526
  })
473
527
  }, request.startLedger && {
474
528
  startLedger: request.startLedger
529
+ }), request.endLedger && {
530
+ endLedger: request.endLedger
475
531
  })));
476
532
  case 1:
477
533
  case "end":
478
- return _context13.stop();
534
+ return _context14.stop();
479
535
  }
480
- }, _callee13, this);
536
+ }, _callee14, this);
481
537
  }));
482
- function _getEvents(_x11) {
538
+ function _getEvents(_x13) {
483
539
  return _getEvents3.apply(this, arguments);
484
540
  }
485
541
  return _getEvents;
@@ -487,16 +543,16 @@ var Server = exports.Server = function () {
487
543
  }, {
488
544
  key: "getNetwork",
489
545
  value: (function () {
490
- var _getNetwork = _asyncToGenerator(_regeneratorRuntime().mark(function _callee14() {
491
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
492
- while (1) switch (_context14.prev = _context14.next) {
546
+ var _getNetwork = _asyncToGenerator(_regeneratorRuntime().mark(function _callee15() {
547
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
548
+ while (1) switch (_context15.prev = _context15.next) {
493
549
  case 0:
494
- return _context14.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getNetwork'));
550
+ return _context15.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getNetwork'));
495
551
  case 1:
496
552
  case "end":
497
- return _context14.stop();
553
+ return _context15.stop();
498
554
  }
499
- }, _callee14, this);
555
+ }, _callee15, this);
500
556
  }));
501
557
  function getNetwork() {
502
558
  return _getNetwork.apply(this, arguments);
@@ -506,16 +562,16 @@ var Server = exports.Server = function () {
506
562
  }, {
507
563
  key: "getLatestLedger",
508
564
  value: (function () {
509
- var _getLatestLedger = _asyncToGenerator(_regeneratorRuntime().mark(function _callee15() {
510
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
511
- while (1) switch (_context15.prev = _context15.next) {
565
+ var _getLatestLedger = _asyncToGenerator(_regeneratorRuntime().mark(function _callee16() {
566
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
567
+ while (1) switch (_context16.prev = _context16.next) {
512
568
  case 0:
513
- return _context15.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getLatestLedger'));
569
+ return _context16.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getLatestLedger'));
514
570
  case 1:
515
571
  case "end":
516
- return _context15.stop();
572
+ return _context16.stop();
517
573
  }
518
- }, _callee15, this);
574
+ }, _callee16, this);
519
575
  }));
520
576
  function getLatestLedger() {
521
577
  return _getLatestLedger.apply(this, arguments);
@@ -525,18 +581,18 @@ var Server = exports.Server = function () {
525
581
  }, {
526
582
  key: "simulateTransaction",
527
583
  value: (function () {
528
- var _simulateTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee16(tx, addlResources) {
529
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
530
- while (1) switch (_context16.prev = _context16.next) {
584
+ var _simulateTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee17(tx, addlResources) {
585
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
586
+ while (1) switch (_context17.prev = _context17.next) {
531
587
  case 0:
532
- return _context16.abrupt("return", this._simulateTransaction(tx, addlResources).then(_parsers.parseRawSimulation));
588
+ return _context17.abrupt("return", this._simulateTransaction(tx, addlResources).then(_parsers.parseRawSimulation));
533
589
  case 1:
534
590
  case "end":
535
- return _context16.stop();
591
+ return _context17.stop();
536
592
  }
537
- }, _callee16, this);
593
+ }, _callee17, this);
538
594
  }));
539
- function simulateTransaction(_x12, _x13) {
595
+ function simulateTransaction(_x14, _x15) {
540
596
  return _simulateTransaction2.apply(this, arguments);
541
597
  }
542
598
  return simulateTransaction;
@@ -544,11 +600,11 @@ var Server = exports.Server = function () {
544
600
  }, {
545
601
  key: "_simulateTransaction",
546
602
  value: function () {
547
- var _simulateTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee17(transaction, addlResources) {
548
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
549
- while (1) switch (_context17.prev = _context17.next) {
603
+ var _simulateTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee18(transaction, addlResources) {
604
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
605
+ while (1) switch (_context18.prev = _context18.next) {
550
606
  case 0:
551
- return _context17.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
607
+ return _context18.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
552
608
  transaction: transaction.toXDR()
553
609
  }, addlResources !== undefined && {
554
610
  resourceConfig: {
@@ -557,11 +613,11 @@ var Server = exports.Server = function () {
557
613
  })));
558
614
  case 1:
559
615
  case "end":
560
- return _context17.stop();
616
+ return _context18.stop();
561
617
  }
562
- }, _callee17, this);
618
+ }, _callee18, this);
563
619
  }));
564
- function _simulateTransaction(_x14, _x15) {
620
+ function _simulateTransaction(_x16, _x17) {
565
621
  return _simulateTransaction3.apply(this, arguments);
566
622
  }
567
623
  return _simulateTransaction;
@@ -569,29 +625,29 @@ var Server = exports.Server = function () {
569
625
  }, {
570
626
  key: "prepareTransaction",
571
627
  value: (function () {
572
- var _prepareTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee18(tx) {
628
+ var _prepareTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee19(tx) {
573
629
  var simResponse;
574
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
575
- while (1) switch (_context18.prev = _context18.next) {
630
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
631
+ while (1) switch (_context19.prev = _context19.next) {
576
632
  case 0:
577
- _context18.next = 2;
633
+ _context19.next = 2;
578
634
  return this.simulateTransaction(tx);
579
635
  case 2:
580
- simResponse = _context18.sent;
636
+ simResponse = _context19.sent;
581
637
  if (!_api.Api.isSimulationError(simResponse)) {
582
- _context18.next = 5;
638
+ _context19.next = 5;
583
639
  break;
584
640
  }
585
641
  throw new Error(simResponse.error);
586
642
  case 5:
587
- return _context18.abrupt("return", (0, _transaction.assembleTransaction)(tx, simResponse).build());
643
+ return _context19.abrupt("return", (0, _transaction.assembleTransaction)(tx, simResponse).build());
588
644
  case 6:
589
645
  case "end":
590
- return _context18.stop();
646
+ return _context19.stop();
591
647
  }
592
- }, _callee18, this);
648
+ }, _callee19, this);
593
649
  }));
594
- function prepareTransaction(_x16) {
650
+ function prepareTransaction(_x18) {
595
651
  return _prepareTransaction.apply(this, arguments);
596
652
  }
597
653
  return prepareTransaction;
@@ -599,18 +655,18 @@ var Server = exports.Server = function () {
599
655
  }, {
600
656
  key: "sendTransaction",
601
657
  value: (function () {
602
- var _sendTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee19(transaction) {
603
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
604
- while (1) switch (_context19.prev = _context19.next) {
658
+ var _sendTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee20(transaction) {
659
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
660
+ while (1) switch (_context20.prev = _context20.next) {
605
661
  case 0:
606
- return _context19.abrupt("return", this._sendTransaction(transaction).then(_parsers.parseRawSendTransaction));
662
+ return _context20.abrupt("return", this._sendTransaction(transaction).then(_parsers.parseRawSendTransaction));
607
663
  case 1:
608
664
  case "end":
609
- return _context19.stop();
665
+ return _context20.stop();
610
666
  }
611
- }, _callee19, this);
667
+ }, _callee20, this);
612
668
  }));
613
- function sendTransaction(_x17) {
669
+ function sendTransaction(_x19) {
614
670
  return _sendTransaction2.apply(this, arguments);
615
671
  }
616
672
  return sendTransaction;
@@ -618,20 +674,20 @@ var Server = exports.Server = function () {
618
674
  }, {
619
675
  key: "_sendTransaction",
620
676
  value: function () {
621
- var _sendTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee20(transaction) {
622
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
623
- while (1) switch (_context20.prev = _context20.next) {
677
+ var _sendTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee21(transaction) {
678
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
679
+ while (1) switch (_context21.prev = _context21.next) {
624
680
  case 0:
625
- return _context20.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'sendTransaction', {
681
+ return _context21.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'sendTransaction', {
626
682
  transaction: transaction.toXDR()
627
683
  }));
628
684
  case 1:
629
685
  case "end":
630
- return _context20.stop();
686
+ return _context21.stop();
631
687
  }
632
- }, _callee20, this);
688
+ }, _callee21, this);
633
689
  }));
634
- function _sendTransaction(_x18) {
690
+ function _sendTransaction(_x20) {
635
691
  return _sendTransaction3.apply(this, arguments);
636
692
  }
637
693
  return _sendTransaction;
@@ -639,58 +695,58 @@ var Server = exports.Server = function () {
639
695
  }, {
640
696
  key: "requestAirdrop",
641
697
  value: (function () {
642
- var _requestAirdrop = _asyncToGenerator(_regeneratorRuntime().mark(function _callee21(address, friendbotUrl) {
698
+ var _requestAirdrop = _asyncToGenerator(_regeneratorRuntime().mark(function _callee22(address, friendbotUrl) {
643
699
  var account, response, meta, sequence, _error$response, _error$response$detai;
644
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
645
- while (1) switch (_context21.prev = _context21.next) {
700
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
701
+ while (1) switch (_context22.prev = _context22.next) {
646
702
  case 0:
647
703
  account = typeof address === 'string' ? address : address.accountId();
648
- _context21.t0 = friendbotUrl;
649
- if (_context21.t0) {
650
- _context21.next = 6;
704
+ _context22.t0 = friendbotUrl;
705
+ if (_context22.t0) {
706
+ _context22.next = 6;
651
707
  break;
652
708
  }
653
- _context21.next = 5;
709
+ _context22.next = 5;
654
710
  return this.getNetwork();
655
711
  case 5:
656
- _context21.t0 = _context21.sent.friendbotUrl;
712
+ _context22.t0 = _context22.sent.friendbotUrl;
657
713
  case 6:
658
- friendbotUrl = _context21.t0;
714
+ friendbotUrl = _context22.t0;
659
715
  if (friendbotUrl) {
660
- _context21.next = 9;
716
+ _context22.next = 9;
661
717
  break;
662
718
  }
663
719
  throw new Error('No friendbot URL configured for current network');
664
720
  case 9:
665
- _context21.prev = 9;
666
- _context21.next = 12;
721
+ _context22.prev = 9;
722
+ _context22.next = 12;
667
723
  return _axios.default.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
668
724
  case 12:
669
- response = _context21.sent;
725
+ response = _context22.sent;
670
726
  meta = _stellarBase.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
671
727
  sequence = findCreatedAccountSequenceInTransactionMeta(meta);
672
- return _context21.abrupt("return", new _stellarBase.Account(account, sequence));
728
+ return _context22.abrupt("return", new _stellarBase.Account(account, sequence));
673
729
  case 18:
674
- _context21.prev = 18;
675
- _context21.t1 = _context21["catch"](9);
676
- if (!(((_error$response = _context21.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
677
- _context21.next = 23;
730
+ _context22.prev = 18;
731
+ _context22.t1 = _context22["catch"](9);
732
+ if (!(((_error$response = _context22.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
733
+ _context22.next = 23;
678
734
  break;
679
735
  }
680
- if (!((_error$response$detai = _context21.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
681
- _context21.next = 23;
736
+ if (!((_error$response$detai = _context22.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
737
+ _context22.next = 23;
682
738
  break;
683
739
  }
684
- return _context21.abrupt("return", this.getAccount(account));
740
+ return _context22.abrupt("return", this.getAccount(account));
685
741
  case 23:
686
- throw _context21.t1;
742
+ throw _context22.t1;
687
743
  case 24:
688
744
  case "end":
689
- return _context21.stop();
745
+ return _context22.stop();
690
746
  }
691
- }, _callee21, this, [[9, 18]]);
747
+ }, _callee22, this, [[9, 18]]);
692
748
  }));
693
- function requestAirdrop(_x19, _x20) {
749
+ function requestAirdrop(_x21, _x22) {
694
750
  return _requestAirdrop.apply(this, arguments);
695
751
  }
696
752
  return requestAirdrop;
@@ -698,16 +754,16 @@ var Server = exports.Server = function () {
698
754
  }, {
699
755
  key: "getFeeStats",
700
756
  value: (function () {
701
- var _getFeeStats = _asyncToGenerator(_regeneratorRuntime().mark(function _callee22() {
702
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
703
- while (1) switch (_context22.prev = _context22.next) {
757
+ var _getFeeStats = _asyncToGenerator(_regeneratorRuntime().mark(function _callee23() {
758
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
759
+ while (1) switch (_context23.prev = _context23.next) {
704
760
  case 0:
705
- return _context22.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getFeeStats'));
761
+ return _context23.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getFeeStats'));
706
762
  case 1:
707
763
  case "end":
708
- return _context22.stop();
764
+ return _context23.stop();
709
765
  }
710
- }, _callee22, this);
766
+ }, _callee23, this);
711
767
  }));
712
768
  function getFeeStats() {
713
769
  return _getFeeStats.apply(this, arguments);
@@ -717,21 +773,105 @@ var Server = exports.Server = function () {
717
773
  }, {
718
774
  key: "getVersionInfo",
719
775
  value: (function () {
720
- var _getVersionInfo = _asyncToGenerator(_regeneratorRuntime().mark(function _callee23() {
721
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
722
- while (1) switch (_context23.prev = _context23.next) {
776
+ var _getVersionInfo = _asyncToGenerator(_regeneratorRuntime().mark(function _callee24() {
777
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
778
+ while (1) switch (_context24.prev = _context24.next) {
723
779
  case 0:
724
- return _context23.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getVersionInfo'));
780
+ return _context24.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getVersionInfo'));
725
781
  case 1:
726
782
  case "end":
727
- return _context23.stop();
783
+ return _context24.stop();
728
784
  }
729
- }, _callee23, this);
785
+ }, _callee24, this);
730
786
  }));
731
787
  function getVersionInfo() {
732
788
  return _getVersionInfo.apply(this, arguments);
733
789
  }
734
790
  return getVersionInfo;
735
791
  }())
792
+ }, {
793
+ key: "getSACBalance",
794
+ value: (function () {
795
+ var _getSACBalance = _asyncToGenerator(_regeneratorRuntime().mark(function _callee25(contractId, sac, networkPassphrase) {
796
+ var passphrase, sacId, key, ledgerKey, response, _response$entries$2, lastModifiedLedgerSeq, liveUntilLedgerSeq, val, entry;
797
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
798
+ while (1) switch (_context25.prev = _context25.next) {
799
+ case 0:
800
+ if (_stellarBase.StrKey.isValidContract(contractId)) {
801
+ _context25.next = 2;
802
+ break;
803
+ }
804
+ throw new TypeError("expected contract ID, got ".concat(contractId));
805
+ case 2:
806
+ if (!(networkPassphrase !== null && networkPassphrase !== void 0)) {
807
+ _context25.next = 6;
808
+ break;
809
+ }
810
+ _context25.t0 = networkPassphrase;
811
+ _context25.next = 9;
812
+ break;
813
+ case 6:
814
+ _context25.next = 8;
815
+ return this.getNetwork().then(function (n) {
816
+ return n.passphrase;
817
+ });
818
+ case 8:
819
+ _context25.t0 = _context25.sent;
820
+ case 9:
821
+ passphrase = _context25.t0;
822
+ sacId = sac.contractId(passphrase);
823
+ key = _stellarBase.xdr.ScVal.scvVec([(0, _stellarBase.nativeToScVal)("Balance", {
824
+ type: "symbol"
825
+ }), (0, _stellarBase.nativeToScVal)(contractId, {
826
+ type: "address"
827
+ })]);
828
+ ledgerKey = _stellarBase.xdr.LedgerKey.contractData(new _stellarBase.xdr.LedgerKeyContractData({
829
+ contract: new _stellarBase.Address(sacId).toScAddress(),
830
+ durability: _stellarBase.xdr.ContractDataDurability.persistent(),
831
+ key: key
832
+ }));
833
+ _context25.next = 15;
834
+ return this.getLedgerEntries(ledgerKey);
835
+ case 15:
836
+ response = _context25.sent;
837
+ if (!(response.entries.length === 0)) {
838
+ _context25.next = 18;
839
+ break;
840
+ }
841
+ return _context25.abrupt("return", {
842
+ latestLedger: response.latestLedger
843
+ });
844
+ case 18:
845
+ _response$entries$2 = response.entries[0], lastModifiedLedgerSeq = _response$entries$2.lastModifiedLedgerSeq, liveUntilLedgerSeq = _response$entries$2.liveUntilLedgerSeq, val = _response$entries$2.val;
846
+ if (!(val.switch().value !== _stellarBase.xdr.LedgerEntryType.contractData().value)) {
847
+ _context25.next = 21;
848
+ break;
849
+ }
850
+ return _context25.abrupt("return", {
851
+ latestLedger: response.latestLedger
852
+ });
853
+ case 21:
854
+ entry = (0, _stellarBase.scValToNative)(val.contractData().val());
855
+ return _context25.abrupt("return", {
856
+ latestLedger: response.latestLedger,
857
+ balanceEntry: {
858
+ liveUntilLedgerSeq: liveUntilLedgerSeq,
859
+ lastModifiedLedgerSeq: lastModifiedLedgerSeq,
860
+ amount: entry.amount.toString(),
861
+ authorized: entry.authorized,
862
+ clawback: entry.clawback
863
+ }
864
+ });
865
+ case 23:
866
+ case "end":
867
+ return _context25.stop();
868
+ }
869
+ }, _callee25, this);
870
+ }));
871
+ function getSACBalance(_x23, _x24, _x25) {
872
+ return _getSACBalance.apply(this, arguments);
873
+ }
874
+ return getSACBalance;
875
+ }())
736
876
  }]);
737
877
  }();