@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
@@ -3,17 +3,19 @@ import { Api } from './api';
3
3
  /**
4
4
  * Combines the given raw transaction alongside the simulation results.
5
5
  * If the given transaction already has authorization entries in a host
6
- * function invocation (see {@link Operation.invokeHostFunction}), **the
7
- * simulation entries are ignored**.
6
+ * function invocation (see {@link Operation.invokeHostFunction}), **the
7
+ * simulation entries are ignored**.
8
8
  *
9
- * @param raw the initial transaction, w/o simulation applied
10
- * @param simulation the Soroban RPC simulation result (see
11
- * {@link Server.simulateTransaction})
9
+ * If the given transaction already has authorization entries in a host function
10
+ * invocation (see {@link Operation.invokeHostFunction}), **the simulation
11
+ * entries are ignored**.
12
12
  *
13
- * @returns a new, cloned transaction with the proper auth and resource (fee,
14
- * footprint) simulation data applied
13
+ * @param {Transaction|FeeBumpTransaction} raw the initial transaction, w/o simulation applied
14
+ * @param {Api.SimulateTransactionResponse|Api.RawSimulateTransactionResponse} simulation the Soroban RPC simulation result (see {@link module:rpc.Server#simulateTransaction})
15
+ * @returns {TransactionBuilder} a new, cloned transaction with the proper auth and resource (fee, footprint) simulation data applied
15
16
  *
16
- * @see {Server.simulateTransaction}
17
- * @see {Server.prepareTransaction}
17
+ * @memberof module:rpc
18
+ * @see {@link module:rpc.Server#simulateTransaction}
19
+ * @see {@link module:rpc.Server#prepareTransaction}
18
20
  */
19
21
  export declare function assembleTransaction(raw: Transaction | FeeBumpTransaction, simulation: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse): TransactionBuilder;
@@ -1,25 +1,35 @@
1
1
  import { Networks } from "@stellar/stellar-base";
2
- /** the maximum size of stellar.toml file */
2
+ /** @module StellarToml */
3
+ /**
4
+ * The maximum size of stellar.toml file, in bytes
5
+ * @constant {number}
6
+ * @default 102400
7
+ */
3
8
  export declare const STELLAR_TOML_MAX_SIZE: number;
4
- /** Resolver allows resolving `stellar.toml` files. */
9
+ /**
10
+ * Resolver allows resolving `stellar.toml` files.
11
+ * @memberof module:StellarToml
12
+ * @hideconstructor
13
+ */
5
14
  export declare class Resolver {
6
15
  /**
7
16
  * Returns a parsed `stellar.toml` file for a given domain.
8
- * ```js
9
- * StellarSdk.Resolver.resolve('acme.com')
17
+ * @see {@link https://developers.stellar.org/docs/tokens/publishing-asset-info | Stellar.toml doc}
18
+ *
19
+ * @param {string} domain Domain to get stellar.toml file for
20
+ * @param {object} [opts] Options object
21
+ * @param {boolean} [opts.allowHttp=false] - Allow connecting to http servers. This must be set to false in production deployments!
22
+ * @param {number} [opts.timeout=0] - Allow a timeout. Allows user to avoid nasty lag due to TOML resolve issue.
23
+ * @returns {Promise} A `Promise` that resolves to the parsed stellar.toml object
24
+ *
25
+ * @example
26
+ * StellarSdk.StellarToml.Resolver.resolve('acme.com')
10
27
  * .then(stellarToml => {
11
28
  * // stellarToml in an object representing domain stellar.toml file.
12
29
  * })
13
30
  * .catch(error => {
14
31
  * // stellar.toml does not exist or is invalid
15
32
  * });
16
- * ```
17
- * @see <a href="https://developers.stellar.org/docs/issuing-assets/publishing-asset-info/" target="_blank">Stellar.toml doc</a>
18
- * @param {string} domain Domain to get stellar.toml file for
19
- * @param {object} [opts] Options object
20
- * @param {boolean} [opts.allowHttp] - Allow connecting to http servers, default: `false`. This must be set to false in production deployments!
21
- * @param {number} [opts.timeout] - Allow a timeout, default: 0. Allows user to avoid nasty lag due to TOML resolve issue.
22
- * @returns {Promise} A `Promise` that resolves to the parsed stellar.toml object
23
33
  */
24
34
  static resolve(domain: string, opts?: Api.StellarTomlResolveOptions): Promise<Api.StellarToml>;
25
35
  }
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.STELLAR_TOML_MAX_SIZE = exports.Resolver = exports.Api = void 0;
7
- var _axios = _interopRequireDefault(require("axios"));
8
7
  var _toml = _interopRequireDefault(require("toml"));
8
+ var _httpClient = require("../http-client");
9
9
  var _config = require("../config");
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
@@ -18,7 +18,7 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
19
  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); }
20
20
  var STELLAR_TOML_MAX_SIZE = exports.STELLAR_TOML_MAX_SIZE = 100 * 1024;
21
- var CancelToken = _axios.default.CancelToken;
21
+ var CancelToken = _httpClient.httpClient.CancelToken;
22
22
  var Resolver = exports.Resolver = function () {
23
23
  function Resolver() {
24
24
  _classCallCheck(this, Resolver);
@@ -39,7 +39,7 @@ var Resolver = exports.Resolver = function () {
39
39
  allowHttp = typeof opts.allowHttp === "undefined" ? _config.Config.isAllowHttp() : opts.allowHttp;
40
40
  timeout = typeof opts.timeout === "undefined" ? _config.Config.getTimeout() : opts.timeout;
41
41
  protocol = allowHttp ? "http" : "https";
42
- return _context.abrupt("return", _axios.default.get("".concat(protocol, "://").concat(domain, "/.well-known/stellar.toml"), {
42
+ return _context.abrupt("return", _httpClient.httpClient.get("".concat(protocol, "://").concat(domain, "/.well-known/stellar.toml"), {
43
43
  maxContentLength: STELLAR_TOML_MAX_SIZE,
44
44
  cancelToken: timeout ? new CancelToken(function (cancel) {
45
45
  return setTimeout(function () {
package/lib/utils.d.ts CHANGED
@@ -1,12 +1,20 @@
1
1
  import { Transaction } from "@stellar/stellar-base";
2
+ /**
3
+ * Miscellaneous utilities.
4
+ *
5
+ * @hideconstructor
6
+ */
2
7
  export declare class Utils {
3
8
  /**
4
- * Verifies if the current date is within the transaction's timebonds
9
+ * Verifies if the current date is within the transaction's timebounds
10
+ *
11
+ * @param {Transaction} transaction The transaction whose timebounds will be validated.
12
+ * @param {number} [gracePeriod=0] An additional window of time that should be considered valid on either end of the transaction's time range.
13
+ *
14
+ * @returns {boolean} Returns true if the current time is within the transaction's [minTime, maxTime] range.
5
15
  *
6
16
  * @static
7
- * @function
8
- * @param {Transaction} transaction the transaction whose timebonds will be validated.
9
- * @returns {boolean} returns true if the current time is within the transaction's [minTime, maxTime] range.
10
17
  */
11
18
  static validateTimebounds(transaction: Transaction, gracePeriod?: number): boolean;
19
+ static sleep(ms: number): Promise<void>;
12
20
  }
package/lib/utils.js CHANGED
@@ -27,5 +27,12 @@ var Utils = exports.Utils = function () {
27
27
  maxTime = _transaction$timeBoun.maxTime;
28
28
  return now >= Number.parseInt(minTime, 10) - gracePeriod && now <= Number.parseInt(maxTime, 10) + gracePeriod;
29
29
  }
30
+ }, {
31
+ key: "sleep",
32
+ value: function sleep(ms) {
33
+ return new Promise(function (resolve) {
34
+ return setTimeout(resolve, ms);
35
+ });
36
+ }
30
37
  }]);
31
38
  }();
@@ -1,3 +1,12 @@
1
+ /**
2
+ * InvalidChallengeError is raised when a challenge transaction does not meet
3
+ * the requirements for a SEP-10 challenge transaction (for example, a non-zero
4
+ * sequence number).
5
+ * @memberof module:WebAuth
6
+ * @category Errors
7
+ *
8
+ * @param {string} message Human-readable error message.
9
+ */
1
10
  export declare class InvalidChallengeError extends Error {
2
11
  __proto__: InvalidChallengeError;
3
12
  constructor(message: string);
@@ -1,11 +1,13 @@
1
+ /**
2
+ * Stellar Web Authentication
3
+ * @module WebAuth
4
+ * @see {@link https://stellar.org/protocol-10 | SEP-10 Specification}
5
+ */
1
6
  import { FeeBumpTransaction, Keypair, Transaction } from "@stellar/stellar-base";
2
7
  import { ServerApi } from "../horizon/server_api";
3
8
  /**
4
- * Returns a valid [SEP-10](https://stellar.org/protocol/sep-10) challenge
5
- * transaction which you can use for Stellar Web Authentication.
6
- *
7
- * @function
8
- * @memberof WebAuth
9
+ * Returns a valid {@link https://stellar.org/protocol/sep-10 | SEP-10}
10
+ * challenge transaction which you can use for Stellar Web Authentication.
9
11
  *
10
12
  * @param {Keypair} serverKeypair Keypair for server's signing account.
11
13
  * @param {string} clientAccountID The stellar account (G...) or muxed account
@@ -26,13 +28,17 @@ import { ServerApi } from "../horizon/server_api";
26
28
  * @param {string} [clientSigningKey] The public key assigned to the SIGNING_KEY
27
29
  * attribute specified on the stellar.toml hosted on the client domain. Only
28
30
  * necessary when the 'client_domain' parameter is passed.
29
- *
30
31
  * @returns {string} A base64 encoded string of the raw TransactionEnvelope xdr
31
32
  * struct for the transaction.
32
- * @see [SEP-10: Stellar Web Auth](https://stellar.org/protocol/sep-10).
33
+ * @throws {Error} Will throw if `clientAccountID is a muxed account, and `memo`
34
+ * is present.
35
+ * @throws {Error} Will throw if `clientDomain` is provided, but
36
+ * `clientSigningKey` is missing
37
+ *
38
+ * @see {@link https://stellar.org/protocol/sep-10 | SEP-10: Stellar Web Auth}
33
39
  *
34
40
  * @example
35
- * import { Keypair, Networks, WebAuth } from 'stellar-sdk'
41
+ * import { Keypair, Networks, WebAuth } from 'stellar-sdk'
36
42
  *
37
43
  * let serverKeyPair = Keypair.fromSecret("server-secret")
38
44
  * let challenge = WebAuth.buildChallengeTx(
@@ -44,7 +50,21 @@ import { ServerApi } from "../horizon/server_api";
44
50
  */
45
51
  export declare function buildChallengeTx(serverKeypair: Keypair, clientAccountID: string, homeDomain: string, timeout: number | undefined, networkPassphrase: string, webAuthDomain: string, memo?: string | null, clientDomain?: string | null, clientSigningKey?: string | null): string;
46
52
  /**
47
- * Reads a SEP 10 challenge transaction and returns the decoded transaction and
53
+ * A parsed and validated challenge transaction, and some of its constituent details.
54
+ * @memberof module:WebAuth
55
+ */
56
+ export type ChallengeTxDetails = {
57
+ /** The challenge transaction. */
58
+ tx: Transaction;
59
+ /** The Stellar public key (master key) used to sign the Manage Data operation. */
60
+ clientAccountId: string;
61
+ /** The matched home domain. */
62
+ matchedHomeDomain: string;
63
+ /** The memo attached to the transaction, which will be null if not present */
64
+ memo?: string;
65
+ };
66
+ /**
67
+ * Reads a SEP-10 challenge transaction and returns the decoded transaction and
48
68
  * client account ID contained within.
49
69
  *
50
70
  * It also verifies that the transaction has been signed by the server.
@@ -52,29 +72,26 @@ export declare function buildChallengeTx(serverKeypair: Keypair, clientAccountID
52
72
  * It does not verify that the transaction has been signed by the client or that
53
73
  * any signatures other than the server's on the transaction are valid. Use one
54
74
  * of the following functions to completely verify the transaction:
55
- * - {@link verifyChallengeTxThreshold}
56
- * - {@link verifyChallengeTxSigners}
57
75
  *
58
- * @function
59
- * @memberof WebAuth
76
+ * - {@link module:WebAuth~verifyChallengeTxThreshold}
77
+ * - {@link module:WebAuth~verifyChallengeTxSigners}
60
78
  *
61
79
  * @param {string} challengeTx SEP0010 challenge transaction in base64.
62
80
  * @param {string} serverAccountID The server's stellar account (public key).
63
81
  * @param {string} networkPassphrase The network passphrase, e.g.: 'Test SDF
64
82
  * Network ; September 2015' (see {@link Networks})
65
- * @param {string|string[]} [homeDomains] The home domain that is expected to be
66
- * included in the first Manage Data operation's string key. If an array is
67
- * provided, one of the domain names in the array must match.
83
+ * @param {string | Array.<string>} homeDomains The home domain that is expected
84
+ * to be included in the first Manage Data operation's string key. If an
85
+ * array is provided, one of the domain names in the array must match.
68
86
  * @param {string} webAuthDomain The home domain that is expected to be included
69
87
  * as the value of the Manage Data operation with the 'web_auth_domain' key.
70
88
  * If no such operation is included, this parameter is not used.
71
- *
72
- * @returns {Transaction|string|string|string} The actual transaction and the
73
- * stellar public key (master key) used to sign the Manage Data operation,
89
+ * @returns {module:WebAuth.ChallengeTxDetails} The actual transaction and the
90
+ * Stellar public key (master key) used to sign the Manage Data operation,
74
91
  * the matched home domain, and the memo attached to the transaction, which
75
92
  * will be null if not present.
76
93
  *
77
- * @see [SEP-10: Stellar Web Auth](https://stellar.org/protocol/sep-10).
94
+ * @see {@link https://stellar.org/protocol/sep-10 | SEP-10: Stellar Web Auth}
78
95
  */
79
96
  export declare function readChallengeTx(challengeTx: string, serverAccountID: string, networkPassphrase: string, homeDomains: string | string[], webAuthDomain: string): {
80
97
  tx: Transaction;
@@ -93,38 +110,39 @@ export declare function readChallengeTx(challengeTx: string, serverAccountID: st
93
110
  * ignored.
94
111
  *
95
112
  * Errors will be raised if:
96
- * - The transaction is invalid according to {@link readChallengeTx}.
113
+ * - The transaction is invalid according to
114
+ * {@link module:WebAuth~readChallengeTx}.
97
115
  * - No client signatures are found on the transaction.
98
116
  * - One or more signatures in the transaction are not identifiable as the
99
117
  * server account or one of the signers provided in the arguments.
100
118
  * - The signatures are all valid but do not meet the threshold.
101
119
  *
102
- * @function
103
- * @memberof WebAuth
104
- *
105
120
  * @param {string} challengeTx SEP0010 challenge transaction in base64.
106
121
  * @param {string} serverAccountID The server's stellar account (public key).
107
122
  * @param {string} networkPassphrase The network passphrase, e.g.: 'Test SDF
108
123
  * Network ; September 2015' (see {@link Networks}).
109
124
  * @param {number} threshold The required signatures threshold for verifying
110
125
  * this transaction.
111
- * @param {ServerApi.AccountRecordSigners[]} signerSummary a map of all
126
+ * @param {Array.<ServerApi.AccountRecordSigners>} signerSummary a map of all
112
127
  * authorized signers to their weights. It's used to validate if the
113
128
  * transaction signatures have met the given threshold.
114
- * @param {string|string[]} [homeDomains] The home domain(s) that should be
115
- * included in the first Manage Data operation's string key. Required in
129
+ * @param {string | Array.<string>} homeDomains The home domain(s) that should
130
+ * be included in the first Manage Data operation's string key. Required in
116
131
  * verifyChallengeTxSigners() => readChallengeTx().
117
132
  * @param {string} webAuthDomain The home domain that is expected to be included
118
133
  * as the value of the Manage Data operation with the 'web_auth_domain' key,
119
134
  * if present. Used in verifyChallengeTxSigners() => readChallengeTx().
135
+ * @returns {Array.<string>} The list of signers public keys that have signed
136
+ * the transaction, excluding the server account ID, given that the threshold
137
+ * was met.
138
+ * @throws {module:WebAuth.InvalidChallengeError} Will throw if the collective
139
+ * weight of the transaction's signers does not meet the necessary threshold
140
+ * to verify this transaction.
120
141
  *
121
- * @returns {string[]} The list of signers public keys that have signed the
122
- * transaction, excluding the server account ID, given that the threshold was
123
- * met.
142
+ * @see {@link https://stellar.org/protocol/sep-10 | SEP-10: Stellar Web Auth}
124
143
  *
125
- * @see [SEP-10: Stellar Web Auth](https://stellar.org/protocol/sep-10).
126
144
  * @example
127
- * import { Networks, TransactionBuilder, WebAuth } from 'stellar-sdk';
145
+ * import { Networks, TransactionBuilder, WebAuth } from 'stellar-sdk';
128
146
  *
129
147
  * const serverKP = Keypair.random();
130
148
  * const clientKP1 = Keypair.random();
@@ -186,30 +204,28 @@ export declare function verifyChallengeTxThreshold(challengeTx: string, serverAc
186
204
  * ignored.
187
205
  *
188
206
  * Errors will be raised if:
189
- * - The transaction is invalid according to {@link readChallengeTx}.
207
+ * - The transaction is invalid according to
208
+ * {@link module:WebAuth~readChallengeTx}.
190
209
  * - No client signatures are found on the transaction.
191
210
  * - One or more signatures in the transaction are not identifiable as the
192
211
  * server account or one of the signers provided in the arguments.
193
212
  *
194
- * @function
195
- * @memberof WebAuth
196
- *
197
213
  * @param {string} challengeTx SEP0010 challenge transaction in base64.
198
214
  * @param {string} serverAccountID The server's stellar account (public key).
199
215
  * @param {string} networkPassphrase The network passphrase, e.g.: 'Test SDF
200
216
  * Network ; September 2015' (see {@link Networks}).
201
- * @param {string[]} signers The signers public keys. This list should contain
202
- * the public keys for all signers that have signed the transaction.
203
- * @param {string|string[]} [homeDomains] The home domain(s) that should be
204
- * included in the first Manage Data operation's string key. Required in
217
+ * @param {Array.<string>} signers The signers public keys. This list should
218
+ * contain the public keys for all signers that have signed the transaction.
219
+ * @param {string | Array.<string>} [homeDomains] The home domain(s) that should
220
+ * be included in the first Manage Data operation's string key. Required in
205
221
  * readChallengeTx().
206
222
  * @param {string} webAuthDomain The home domain that is expected to be included
207
223
  * as the value of the Manage Data operation with the 'web_auth_domain' key,
208
224
  * if present. Used in readChallengeTx().
209
- * @returns {string[]} The list of signers public keys that have signed the
210
- * transaction, excluding the server account ID.
225
+ * @returns {Array.<string>} The list of signers public keys that have signed
226
+ * the transaction, excluding the server account ID.
211
227
  *
212
- * @see [SEP-10: Stellar Web Auth](https://stellar.org/protocol/sep-10).
228
+ * @see {@link https://stellar.org/protocol/sep-10|SEP-10: Stellar Web Auth}
213
229
  * @example
214
230
  * import { Networks, TransactionBuilder, WebAuth } from 'stellar-sdk';
215
231
  *
@@ -249,11 +265,10 @@ export declare function verifyChallengeTxSigners(challengeTx: string, serverAcco
249
265
  /**
250
266
  * Verifies if a transaction was signed by the given account id.
251
267
  *
252
- * @function
253
- * @memberof WebAuth
254
- * @param {Transaction} transaction
255
- * @param {string} accountID
256
- * @returns {boolean}.
268
+ * @param {Transaction | FeeBumpTransaction} transaction The signed transaction.
269
+ * @param {string} accountID The signer's public key.
270
+ * @returns {boolean} Whether or not `accountID` was found to have signed the
271
+ * transaction.
257
272
  *
258
273
  * @example
259
274
  * let keypair = Keypair.random();
@@ -272,12 +287,10 @@ export declare function verifyTxSignedBy(transaction: FeeBumpTransaction | Trans
272
287
  * returning a list of non-repeated signers that were found to have signed the
273
288
  * given transaction.
274
289
  *
275
- * @function
276
- * @memberof WebAuth
277
- * @param {Transaction} transaction the signed transaction.
278
- * @param {string[]} signers The signers public keys.
279
- * @returns {string[]} a list of signers that were found to have signed the
280
- * transaction.
290
+ * @param {Transaction | FeeBumpTransaction} transaction The signed transaction.
291
+ * @param {Array.<string>} signers The signer's public keys.
292
+ * @returns {Array.<string>} A list of signers that were found to have signed
293
+ * the transaction.
281
294
  *
282
295
  * @example
283
296
  * let keypair1 = Keypair.random();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-sdk",
3
- "version": "12.3.0",
3
+ "version": "13.0.0-rc.1",
4
4
  "description": "A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.",
5
5
  "keywords": [
6
6
  "stellar"
@@ -36,28 +36,77 @@
36
36
  "./rpc": {
37
37
  "types": "./lib/rpc/index.d.ts",
38
38
  "default": "./lib/rpc/index.js"
39
+ },
40
+ "./no-axios": {
41
+ "browser": "./dist/stellar-sdk-no-axios.min.js",
42
+ "types": "./lib/no-axios/index.d.ts",
43
+ "default": "./lib/no-axios/index.js"
44
+ },
45
+ "./no-axios/contract": {
46
+ "types": "./lib/no-axios/contract/index.d.ts",
47
+ "default": "./lib/no-axios/contract/index.js"
48
+ },
49
+ "./no-axios/rpc": {
50
+ "types": "./lib/no-axios/rpc/index.d.ts",
51
+ "default": "./lib/no-axios/rpc/index.js"
52
+ },
53
+ "./no-eventsource": {
54
+ "browser": "./dist/stellar-sdk-no-eventsource.min.js",
55
+ "types": "./lib/no-eventsource/index.d.ts",
56
+ "default": "./lib/no-eventsource/index.js"
57
+ },
58
+ "./no-eventsource/contract": {
59
+ "types": "./lib/no-eventsource/contract/index.d.ts",
60
+ "default": "./lib/no-eventsource/contract/index.js"
61
+ },
62
+ "./no-eventsource/rpc": {
63
+ "types": "./lib/no-eventsource/rpc/index.d.ts",
64
+ "default": "./lib/no-eventsource/rpc/index.js"
65
+ },
66
+ "./minimal": {
67
+ "browser": "./dist/stellar-sdk-minimal.min.js",
68
+ "types": "./lib/minimal/index.d.ts",
69
+ "default": "./lib/minimal/index.js"
70
+ },
71
+ "./minimal/contract": {
72
+ "types": "./lib/minimal/contract/index.d.ts",
73
+ "default": "./lib/minimal/contract/index.js"
74
+ },
75
+ "./minimal/rpc": {
76
+ "types": "./lib/minimal/rpc/index.d.ts",
77
+ "default": "./lib/minimal/rpc/index.js"
39
78
  }
40
79
  },
41
80
  "scripts": {
42
81
  "build": "cross-env NODE_ENV=development yarn _build",
43
82
  "build:prod": "cross-env NODE_ENV=production yarn _build",
44
83
  "build:node": "yarn _babel && yarn build:ts",
45
- "build:ts": "tsc -p ./config/tsconfig.json",
84
+ "build:node:no-axios": "cross-env OUTPUT_DIR=lib/no-axios USE_AXIOS=false yarn build:node",
85
+ "build:node:no-eventsource": "cross-env OUTPUT_DIR=lib/no-eventsource USE_EVENTSOURCE=false yarn build:node",
86
+ "build:node:minimal": "cross-env OUTPUT_DIR=lib/minimal USE_AXIOS=false USE_EVENTSOURCE=false yarn build:node",
87
+ "build:node:all": "yarn build:node && yarn build:node:no-axios && yarn build:node:no-eventsource && yarn build:node:minimal",
88
+ "clean:temp": "rm -f ./config/tsconfig.tmp.json",
89
+ "build:ts": "node config/set-output-dir.js && tsc -p ./config/tsconfig.tmp.json && yarn clean:temp",
46
90
  "build:test": "tsc -p ./test/unit/tsconfig.json",
47
91
  "build:browser": "webpack -c config/webpack.config.browser.js",
92
+ "build:browser:no-axios": "cross-env USE_AXIOS=false webpack -c config/webpack.config.browser.js",
93
+ "build:browser:no-eventsource": "cross-env USE_EVENTSOURCE=false webpack -c config/webpack.config.browser.js",
94
+ "build:browser:minimal": "cross-env USE_AXIOS=false USE_EVENTSOURCE=false webpack -c config/webpack.config.browser.js",
95
+ "build:browser:all": "yarn build:browser && cross-env no_clean=true yarn build:browser:no-axios && cross-env no_clean=true yarn build:browser:no-eventsource && cross-env no_clean=true yarn build:browser:minimal",
48
96
  "build:docs": "cross-env NODE_ENV=docs yarn _babel",
49
97
  "clean": "rm -rf lib/ dist/ coverage/ .nyc_output/ jsdoc/ test/e2e/.soroban",
50
- "docs": "yarn build:docs && jsdoc -c ./config/.jsdoc.json --verbose",
98
+ "docs": "yarn build:docs && jsdoc -c ./config/.jsdoc.json",
51
99
  "test": "yarn build:test && yarn test:node && yarn test:integration && yarn test:browser",
52
100
  "test:e2e": "./test/e2e/initialize.sh && yarn _nyc mocha --recursive 'test/e2e/src/test-*.js'",
53
101
  "test:node": "yarn _nyc mocha --recursive 'test/unit/**/*.js'",
54
102
  "test:integration": "yarn _nyc mocha --recursive 'test/integration/**/*.js'",
55
103
  "test:browser": "karma start config/karma.conf.js",
104
+ "test:browser:no-axios": "cross-env USE_AXIOS=false yarn build:browser && cross-env USE_AXIOS=false karma start config/karma.conf.js",
56
105
  "fmt": "yarn _prettier && yarn eslint -c .eslintrc.js src/ --fix",
57
106
  "preversion": "yarn clean && yarn _prettier && yarn build:prod && yarn test",
58
107
  "prepare": "yarn build:prod",
59
- "_build": "yarn build:node && yarn build:test && yarn build:browser",
60
- "_babel": "babel --extensions '.ts' --out-dir lib/ src/",
108
+ "_build": "yarn build:node:all && yarn build:test && yarn build:browser:all",
109
+ "_babel": "babel --extensions '.ts' --out-dir ${OUTPUT_DIR:-lib} src/",
61
110
  "_nyc": "nyc --nycrc-path config/.nycrc",
62
111
  "_prettier": "prettier --ignore-path config/.prettierignore --write './test/**/*.js'"
63
112
  },
@@ -93,21 +142,21 @@
93
142
  ]
94
143
  },
95
144
  "devDependencies": {
96
- "@babel/cli": "^7.25.6",
97
- "@babel/core": "^7.24.9",
98
- "@babel/eslint-plugin": "^7.24.7",
99
- "@babel/preset-env": "^7.25.4",
100
- "@babel/preset-typescript": "^7.24.7",
101
- "@babel/register": "^7.24.6",
102
- "@definitelytyped/dtslint": "^0.2.23",
145
+ "@babel/cli": "^7.25.9",
146
+ "@babel/core": "^7.26.0",
147
+ "@babel/eslint-plugin": "^7.25.9",
148
+ "@babel/preset-env": "^7.26.0",
149
+ "@babel/preset-typescript": "^7.26.0",
150
+ "@babel/register": "^7.25.9",
151
+ "@definitelytyped/dtslint": "^0.2.27",
103
152
  "@istanbuljs/nyc-config-babel": "3.0.0",
104
153
  "@stellar/tsconfig": "^1.0.2",
105
154
  "@types/chai": "^4.3.19",
106
155
  "@types/detect-node": "^2.0.0",
107
156
  "@types/eventsource": "^1.1.12",
108
157
  "@types/json-schema": "^7.0.15",
109
- "@types/lodash": "^4.17.7",
110
- "@types/mocha": "^10.0.8",
158
+ "@types/lodash": "^4.17.13",
159
+ "@types/mocha": "^10.0.9",
111
160
  "@types/node": "^20.14.11",
112
161
  "@types/randombytes": "^2.0.1",
113
162
  "@types/sinon": "^17.0.2",
@@ -116,6 +165,8 @@
116
165
  "axios-mock-adapter": "^1.22.0",
117
166
  "babel-loader": "^9.1.3",
118
167
  "babel-plugin-istanbul": "^7.0.0",
168
+ "babel-plugin-transform-define": "^2.1.4",
169
+ "better-docs": "^2.7.3",
119
170
  "buffer": "^6.0.3",
120
171
  "chai": "^4.3.10",
121
172
  "chai-as-promised": "^7.1.1",
@@ -134,8 +185,8 @@
134
185
  "eslint-webpack-plugin": "^4.2.0",
135
186
  "ghooks": "^2.0.4",
136
187
  "husky": "^9.1.6",
137
- "jsdoc": "^4.0.2",
138
- "json-schema-faker": "^0.5.6",
188
+ "jsdoc": "^4.0.4",
189
+ "json-schema-faker": "^0.5.8",
139
190
  "karma": "^6.4.3",
140
191
  "karma-chai": "^0.1.0",
141
192
  "karma-chrome-launcher": "^3.1.0",
@@ -146,9 +197,9 @@
146
197
  "karma-webpack": "^5.0.1",
147
198
  "lint-staged": "^15.2.10",
148
199
  "lodash": "^4.17.21",
149
- "minami": "^1.1.1",
150
- "mocha": "^10.6.0",
200
+ "mocha": "^10.8.2",
151
201
  "node-polyfill-webpack-plugin": "^3.0.0",
202
+ "null-loader": "^4.0.1",
152
203
  "nyc": "^17.0.0",
153
204
  "prettier": "^3.3.3",
154
205
  "randombytes": "^2.1.0",
@@ -157,15 +208,16 @@
157
208
  "taffydb": "^2.7.3",
158
209
  "terser-webpack-plugin": "^5.3.10",
159
210
  "ts-node": "^10.9.2",
160
- "typescript": "^5.6.2",
161
- "webpack": "^5.94.0",
211
+ "typescript": "^5.6.3",
212
+ "webpack": "^5.96.1",
162
213
  "webpack-cli": "^5.0.1"
163
214
  },
164
215
  "dependencies": {
165
- "@stellar/stellar-base": "^12.1.1",
216
+ "@stellar/stellar-base": "^13.0.0",
166
217
  "axios": "^1.7.7",
167
218
  "bignumber.js": "^9.1.2",
168
219
  "eventsource": "^2.0.2",
220
+ "feaxios": "^0.0.20",
169
221
  "randombytes": "^2.1.0",
170
222
  "toml": "^3.0.0",
171
223
  "urijs": "^1.19.1"
package/lib/errors.d.ts DELETED
@@ -1,59 +0,0 @@
1
- import { HorizonApi } from "./horizon/horizon_api";
2
- export declare class NetworkError extends Error {
3
- response: {
4
- data?: HorizonApi.ErrorResponseData;
5
- status?: number;
6
- statusText?: string;
7
- url?: string;
8
- };
9
- __proto__: NetworkError;
10
- constructor(message: string, response: any);
11
- getResponse(): {
12
- data?: HorizonApi.ErrorResponseData;
13
- status?: number;
14
- statusText?: string;
15
- url?: string;
16
- };
17
- }
18
- export declare class NotFoundError extends NetworkError {
19
- constructor(message: string, response: any);
20
- }
21
- export declare class BadRequestError extends NetworkError {
22
- constructor(message: string, response: any);
23
- }
24
- export declare class BadResponseError extends NetworkError {
25
- constructor(message: string, response: any);
26
- }
27
- /**
28
- * AccountRequiresMemoError is raised when a transaction is trying to submit an
29
- * operation to an account which requires a memo. See
30
- * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md)
31
- * for more information.
32
- *
33
- * This error contains two attributes to help you identify the account requiring
34
- * the memo and the operation where the account is the destination
35
- *
36
- * ```
37
- * console.log('The following account requires a memo ', err.accountId)
38
- * console.log('The account is used in operation: ', err.operationIndex)
39
- * ```
40
- *
41
- */
42
- export declare class AccountRequiresMemoError extends Error {
43
- __proto__: AccountRequiresMemoError;
44
- /**
45
- * accountId account which requires a memo.
46
- */
47
- accountId: string;
48
- /**
49
- * operationIndex operation where accountId is the destination.
50
- */
51
- operationIndex: number;
52
- /**
53
- * Create an AccountRequiresMemoError
54
- * @param {message} message - error message
55
- * @param {string} accountId - The account which requires a memo.
56
- * @param {number} operationIndex - The index of the operation where `accountId` is the destination.
57
- */
58
- constructor(message: string, accountId: string, operationIndex: number);
59
- }