@stellar/stellar-sdk 12.3.0 → 13.0.0-beta.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 (511) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +29 -7
  3. package/dist/stellar-sdk-minimal.js +45947 -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 +56586 -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 +49760 -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 +28203 -27336
  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 +158 -127
  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 +7 -1
  23. package/lib/contract/sent_transaction.js +2 -2
  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/strict_receive_path_call_builder.d.ts +7 -2
  64. package/lib/horizon/strict_send_path_call_builder.d.ts +7 -2
  65. package/lib/horizon/trade_aggregation_call_builder.d.ts +4 -2
  66. package/lib/horizon/trades_call_builder.d.ts +8 -5
  67. package/lib/horizon/transaction_call_builder.d.ts +10 -7
  68. package/lib/http-client/axios-client.d.ts +2 -0
  69. package/lib/http-client/axios-client.js +10 -0
  70. package/lib/http-client/fetch-client.d.ts +11 -0
  71. package/lib/http-client/fetch-client.js +229 -0
  72. package/lib/http-client/index.d.ts +5 -0
  73. package/lib/http-client/index.js +33 -0
  74. package/lib/http-client/types.d.ts +69 -0
  75. package/lib/http-client/types.js +34 -0
  76. package/lib/index.d.ts +3 -4
  77. package/lib/index.js +7 -1
  78. package/lib/minimal/browser.d.ts +6 -0
  79. package/lib/minimal/browser.js +35 -0
  80. package/lib/minimal/config.d.ts +64 -0
  81. package/lib/minimal/config.js +51 -0
  82. package/lib/minimal/contract/assembled_transaction.d.ts +555 -0
  83. package/lib/minimal/contract/assembled_transaction.js +752 -0
  84. package/lib/minimal/contract/basic_node_signer.d.ts +17 -0
  85. package/lib/minimal/contract/basic_node_signer.js +52 -0
  86. package/lib/minimal/contract/client.d.ts +52 -0
  87. package/lib/minimal/contract/client.js +180 -0
  88. package/lib/minimal/contract/index.d.ts +7 -0
  89. package/lib/minimal/contract/index.js +82 -0
  90. package/lib/minimal/contract/rust_result.d.ts +81 -0
  91. package/lib/minimal/contract/rust_result.js +66 -0
  92. package/lib/minimal/contract/sent_transaction.d.ts +85 -0
  93. package/lib/minimal/contract/sent_transaction.js +151 -0
  94. package/lib/minimal/contract/spec.d.ts +152 -0
  95. package/lib/minimal/contract/spec.js +1020 -0
  96. package/lib/minimal/contract/types.d.ts +180 -0
  97. package/lib/minimal/contract/types.js +8 -0
  98. package/lib/minimal/contract/utils.d.ts +46 -0
  99. package/lib/minimal/contract/utils.js +123 -0
  100. package/lib/minimal/errors/account_requires_memo.d.ts +24 -0
  101. package/lib/minimal/errors/account_requires_memo.js +38 -0
  102. package/lib/minimal/errors/bad_request.d.ts +14 -0
  103. package/lib/minimal/errors/bad_request.js +34 -0
  104. package/lib/minimal/errors/bad_response.d.ts +17 -0
  105. package/lib/minimal/errors/bad_response.js +34 -0
  106. package/lib/minimal/errors/index.d.ts +5 -0
  107. package/lib/minimal/errors/index.js +60 -0
  108. package/lib/minimal/errors/network.d.ts +33 -0
  109. package/lib/minimal/errors/network.js +41 -0
  110. package/lib/minimal/errors/not_found.d.ts +14 -0
  111. package/lib/minimal/errors/not_found.js +34 -0
  112. package/lib/minimal/federation/api.d.ts +32 -0
  113. package/lib/minimal/federation/api.js +7 -0
  114. package/lib/minimal/federation/index.d.ts +2 -0
  115. package/lib/minimal/federation/index.js +34 -0
  116. package/lib/minimal/federation/server.d.ts +116 -0
  117. package/lib/minimal/federation/server.js +252 -0
  118. package/lib/minimal/friendbot/index.d.ts +5 -0
  119. package/lib/minimal/friendbot/index.js +7 -0
  120. package/lib/minimal/horizon/account_call_builder.d.ts +56 -0
  121. package/lib/minimal/horizon/account_call_builder.js +62 -0
  122. package/lib/minimal/horizon/account_response.d.ts +61 -0
  123. package/lib/minimal/horizon/account_response.js +49 -0
  124. package/lib/minimal/horizon/assets_call_builder.d.ts +27 -0
  125. package/lib/minimal/horizon/assets_call_builder.js +43 -0
  126. package/lib/minimal/horizon/call_builder.d.ts +128 -0
  127. package/lib/minimal/horizon/call_builder.js +362 -0
  128. package/lib/minimal/horizon/claimable_balances_call_builder.d.ts +50 -0
  129. package/lib/minimal/horizon/claimable_balances_call_builder.js +56 -0
  130. package/lib/minimal/horizon/effect_call_builder.d.ts +53 -0
  131. package/lib/minimal/horizon/effect_call_builder.js +56 -0
  132. package/lib/minimal/horizon/friendbot_builder.d.ts +4 -0
  133. package/lib/minimal/horizon/friendbot_builder.js +32 -0
  134. package/lib/minimal/horizon/horizon_api.d.ts +527 -0
  135. package/lib/minimal/horizon/horizon_api.js +96 -0
  136. package/lib/minimal/horizon/horizon_axios_client.d.ts +37 -0
  137. package/lib/minimal/horizon/horizon_axios_client.js +60 -0
  138. package/lib/minimal/horizon/index.d.ts +8 -0
  139. package/lib/minimal/horizon/index.js +78 -0
  140. package/lib/minimal/horizon/ledger_call_builder.d.ts +23 -0
  141. package/lib/minimal/horizon/ledger_call_builder.js +37 -0
  142. package/lib/minimal/horizon/liquidity_pool_call_builder.d.ts +37 -0
  143. package/lib/minimal/horizon/liquidity_pool_call_builder.js +59 -0
  144. package/lib/minimal/horizon/offer_call_builder.d.ts +65 -0
  145. package/lib/minimal/horizon/offer_call_builder.js +79 -0
  146. package/lib/minimal/horizon/operation_call_builder.d.ts +69 -0
  147. package/lib/minimal/horizon/operation_call_builder.js +69 -0
  148. package/lib/minimal/horizon/orderbook_call_builder.d.ts +20 -0
  149. package/lib/minimal/horizon/orderbook_call_builder.js +45 -0
  150. package/lib/minimal/horizon/path_call_builder.d.ts +35 -0
  151. package/lib/minimal/horizon/path_call_builder.js +41 -0
  152. package/lib/minimal/horizon/payment_call_builder.d.ts +39 -0
  153. package/lib/minimal/horizon/payment_call_builder.js +46 -0
  154. package/lib/minimal/horizon/server.d.ts +389 -0
  155. package/lib/minimal/horizon/server.js +550 -0
  156. package/lib/minimal/horizon/server_api.d.ts +278 -0
  157. package/lib/minimal/horizon/server_api.js +19 -0
  158. package/lib/minimal/horizon/strict_receive_path_call_builder.d.ts +38 -0
  159. package/lib/minimal/horizon/strict_receive_path_call_builder.js +50 -0
  160. package/lib/minimal/horizon/strict_send_path_call_builder.d.ts +38 -0
  161. package/lib/minimal/horizon/strict_send_path_call_builder.js +50 -0
  162. package/lib/minimal/horizon/trade_aggregation_call_builder.d.ts +49 -0
  163. package/lib/minimal/horizon/trade_aggregation_call_builder.js +76 -0
  164. package/lib/minimal/horizon/trades_call_builder.d.ts +52 -0
  165. package/lib/minimal/horizon/trades_call_builder.js +72 -0
  166. package/lib/minimal/horizon/transaction_call_builder.d.ts +60 -0
  167. package/lib/minimal/horizon/transaction_call_builder.js +64 -0
  168. package/lib/minimal/horizon/types/account.d.ts +5 -0
  169. package/lib/minimal/horizon/types/account.js +5 -0
  170. package/lib/minimal/horizon/types/assets.d.ts +19 -0
  171. package/lib/minimal/horizon/types/assets.js +5 -0
  172. package/lib/minimal/horizon/types/effects.d.ts +285 -0
  173. package/lib/minimal/horizon/types/effects.js +62 -0
  174. package/lib/minimal/horizon/types/offer.d.ts +20 -0
  175. package/lib/minimal/horizon/types/offer.js +5 -0
  176. package/lib/minimal/horizon/types/trade.d.ts +13 -0
  177. package/lib/minimal/horizon/types/trade.js +5 -0
  178. package/lib/minimal/http-client/axios-client.d.ts +2 -0
  179. package/lib/minimal/http-client/axios-client.js +10 -0
  180. package/lib/minimal/http-client/fetch-client.d.ts +11 -0
  181. package/lib/minimal/http-client/fetch-client.js +229 -0
  182. package/lib/minimal/http-client/index.d.ts +5 -0
  183. package/lib/minimal/http-client/index.js +33 -0
  184. package/lib/minimal/http-client/types.d.ts +69 -0
  185. package/lib/minimal/http-client/types.js +34 -0
  186. package/lib/minimal/index.d.ts +36 -0
  187. package/lib/minimal/index.js +83 -0
  188. package/lib/minimal/rpc/api.d.ts +359 -0
  189. package/lib/minimal/rpc/api.js +32 -0
  190. package/lib/minimal/rpc/axios.d.ts +4 -0
  191. package/lib/minimal/rpc/axios.js +15 -0
  192. package/lib/minimal/rpc/browser.d.ts +4 -0
  193. package/lib/minimal/rpc/browser.js +27 -0
  194. package/lib/minimal/rpc/index.d.ts +8 -0
  195. package/lib/minimal/rpc/index.js +72 -0
  196. package/lib/minimal/rpc/jsonrpc.d.ts +35 -0
  197. package/lib/minimal/rpc/jsonrpc.js +52 -0
  198. package/lib/minimal/rpc/parsers.d.ts +39 -0
  199. package/lib/minimal/rpc/parsers.js +155 -0
  200. package/lib/minimal/rpc/server.d.ts +584 -0
  201. package/lib/minimal/rpc/server.js +823 -0
  202. package/lib/minimal/rpc/transaction.d.ts +21 -0
  203. package/lib/minimal/rpc/transaction.js +53 -0
  204. package/lib/minimal/rpc/utils.d.ts +1 -0
  205. package/lib/minimal/rpc/utils.js +9 -0
  206. package/lib/minimal/stellartoml/index.d.ts +131 -0
  207. package/lib/minimal/stellartoml/index.js +77 -0
  208. package/lib/minimal/utils.d.ts +19 -0
  209. package/lib/minimal/utils.js +31 -0
  210. package/lib/minimal/webauth/errors.d.ts +13 -0
  211. package/lib/minimal/webauth/errors.js +36 -0
  212. package/lib/minimal/webauth/index.d.ts +2 -0
  213. package/lib/minimal/webauth/index.js +27 -0
  214. package/lib/minimal/webauth/utils.d.ts +307 -0
  215. package/lib/minimal/webauth/utils.js +332 -0
  216. package/lib/no-axios/browser.d.ts +6 -0
  217. package/lib/no-axios/browser.js +35 -0
  218. package/lib/no-axios/config.d.ts +64 -0
  219. package/lib/no-axios/config.js +51 -0
  220. package/lib/no-axios/contract/assembled_transaction.d.ts +555 -0
  221. package/lib/no-axios/contract/assembled_transaction.js +752 -0
  222. package/lib/no-axios/contract/basic_node_signer.d.ts +17 -0
  223. package/lib/no-axios/contract/basic_node_signer.js +52 -0
  224. package/lib/no-axios/contract/client.d.ts +52 -0
  225. package/lib/no-axios/contract/client.js +180 -0
  226. package/lib/no-axios/contract/index.d.ts +7 -0
  227. package/lib/no-axios/contract/index.js +82 -0
  228. package/lib/no-axios/contract/rust_result.d.ts +81 -0
  229. package/lib/no-axios/contract/rust_result.js +66 -0
  230. package/lib/no-axios/contract/sent_transaction.d.ts +85 -0
  231. package/lib/no-axios/contract/sent_transaction.js +151 -0
  232. package/lib/no-axios/contract/spec.d.ts +152 -0
  233. package/lib/no-axios/contract/spec.js +1020 -0
  234. package/lib/no-axios/contract/types.d.ts +180 -0
  235. package/lib/no-axios/contract/types.js +8 -0
  236. package/lib/no-axios/contract/utils.d.ts +46 -0
  237. package/lib/no-axios/contract/utils.js +123 -0
  238. package/lib/no-axios/errors/account_requires_memo.d.ts +24 -0
  239. package/lib/no-axios/errors/account_requires_memo.js +38 -0
  240. package/lib/no-axios/errors/bad_request.d.ts +14 -0
  241. package/lib/no-axios/errors/bad_request.js +34 -0
  242. package/lib/no-axios/errors/bad_response.d.ts +17 -0
  243. package/lib/no-axios/errors/bad_response.js +34 -0
  244. package/lib/no-axios/errors/index.d.ts +5 -0
  245. package/lib/no-axios/errors/index.js +60 -0
  246. package/lib/no-axios/errors/network.d.ts +33 -0
  247. package/lib/no-axios/errors/network.js +41 -0
  248. package/lib/no-axios/errors/not_found.d.ts +14 -0
  249. package/lib/no-axios/errors/not_found.js +34 -0
  250. package/lib/no-axios/federation/api.d.ts +32 -0
  251. package/lib/no-axios/federation/api.js +7 -0
  252. package/lib/no-axios/federation/index.d.ts +2 -0
  253. package/lib/no-axios/federation/index.js +34 -0
  254. package/lib/no-axios/federation/server.d.ts +116 -0
  255. package/lib/no-axios/federation/server.js +252 -0
  256. package/lib/no-axios/friendbot/index.d.ts +5 -0
  257. package/lib/no-axios/friendbot/index.js +7 -0
  258. package/lib/no-axios/horizon/account_call_builder.d.ts +56 -0
  259. package/lib/no-axios/horizon/account_call_builder.js +62 -0
  260. package/lib/no-axios/horizon/account_response.d.ts +61 -0
  261. package/lib/no-axios/horizon/account_response.js +49 -0
  262. package/lib/no-axios/horizon/assets_call_builder.d.ts +27 -0
  263. package/lib/no-axios/horizon/assets_call_builder.js +43 -0
  264. package/lib/no-axios/horizon/call_builder.d.ts +128 -0
  265. package/lib/no-axios/horizon/call_builder.js +362 -0
  266. package/lib/no-axios/horizon/claimable_balances_call_builder.d.ts +50 -0
  267. package/lib/no-axios/horizon/claimable_balances_call_builder.js +56 -0
  268. package/lib/no-axios/horizon/effect_call_builder.d.ts +53 -0
  269. package/lib/no-axios/horizon/effect_call_builder.js +56 -0
  270. package/lib/no-axios/horizon/friendbot_builder.d.ts +4 -0
  271. package/lib/no-axios/horizon/friendbot_builder.js +32 -0
  272. package/lib/no-axios/horizon/horizon_api.d.ts +527 -0
  273. package/lib/no-axios/horizon/horizon_api.js +96 -0
  274. package/lib/no-axios/horizon/horizon_axios_client.d.ts +37 -0
  275. package/lib/no-axios/horizon/horizon_axios_client.js +60 -0
  276. package/lib/no-axios/horizon/index.d.ts +8 -0
  277. package/lib/no-axios/horizon/index.js +78 -0
  278. package/lib/no-axios/horizon/ledger_call_builder.d.ts +23 -0
  279. package/lib/no-axios/horizon/ledger_call_builder.js +37 -0
  280. package/lib/no-axios/horizon/liquidity_pool_call_builder.d.ts +37 -0
  281. package/lib/no-axios/horizon/liquidity_pool_call_builder.js +59 -0
  282. package/lib/no-axios/horizon/offer_call_builder.d.ts +65 -0
  283. package/lib/no-axios/horizon/offer_call_builder.js +79 -0
  284. package/lib/no-axios/horizon/operation_call_builder.d.ts +69 -0
  285. package/lib/no-axios/horizon/operation_call_builder.js +69 -0
  286. package/lib/no-axios/horizon/orderbook_call_builder.d.ts +20 -0
  287. package/lib/no-axios/horizon/orderbook_call_builder.js +45 -0
  288. package/lib/no-axios/horizon/path_call_builder.d.ts +35 -0
  289. package/lib/no-axios/horizon/path_call_builder.js +41 -0
  290. package/lib/no-axios/horizon/payment_call_builder.d.ts +39 -0
  291. package/lib/no-axios/horizon/payment_call_builder.js +46 -0
  292. package/lib/no-axios/horizon/server.d.ts +389 -0
  293. package/lib/no-axios/horizon/server.js +550 -0
  294. package/lib/no-axios/horizon/server_api.d.ts +278 -0
  295. package/lib/no-axios/horizon/server_api.js +19 -0
  296. package/lib/no-axios/horizon/strict_receive_path_call_builder.d.ts +38 -0
  297. package/lib/no-axios/horizon/strict_receive_path_call_builder.js +50 -0
  298. package/lib/no-axios/horizon/strict_send_path_call_builder.d.ts +38 -0
  299. package/lib/no-axios/horizon/strict_send_path_call_builder.js +50 -0
  300. package/lib/no-axios/horizon/trade_aggregation_call_builder.d.ts +49 -0
  301. package/lib/no-axios/horizon/trade_aggregation_call_builder.js +76 -0
  302. package/lib/no-axios/horizon/trades_call_builder.d.ts +52 -0
  303. package/lib/no-axios/horizon/trades_call_builder.js +72 -0
  304. package/lib/no-axios/horizon/transaction_call_builder.d.ts +60 -0
  305. package/lib/no-axios/horizon/transaction_call_builder.js +64 -0
  306. package/lib/no-axios/horizon/types/account.d.ts +5 -0
  307. package/lib/no-axios/horizon/types/account.js +5 -0
  308. package/lib/no-axios/horizon/types/assets.d.ts +19 -0
  309. package/lib/no-axios/horizon/types/assets.js +5 -0
  310. package/lib/no-axios/horizon/types/effects.d.ts +285 -0
  311. package/lib/no-axios/horizon/types/effects.js +62 -0
  312. package/lib/no-axios/horizon/types/offer.d.ts +20 -0
  313. package/lib/no-axios/horizon/types/offer.js +5 -0
  314. package/lib/no-axios/horizon/types/trade.d.ts +13 -0
  315. package/lib/no-axios/horizon/types/trade.js +5 -0
  316. package/lib/no-axios/http-client/axios-client.d.ts +2 -0
  317. package/lib/no-axios/http-client/axios-client.js +10 -0
  318. package/lib/no-axios/http-client/fetch-client.d.ts +11 -0
  319. package/lib/no-axios/http-client/fetch-client.js +229 -0
  320. package/lib/no-axios/http-client/index.d.ts +5 -0
  321. package/lib/no-axios/http-client/index.js +33 -0
  322. package/lib/no-axios/http-client/types.d.ts +69 -0
  323. package/lib/no-axios/http-client/types.js +34 -0
  324. package/lib/no-axios/index.d.ts +36 -0
  325. package/lib/no-axios/index.js +83 -0
  326. package/lib/no-axios/rpc/api.d.ts +359 -0
  327. package/lib/no-axios/rpc/api.js +32 -0
  328. package/lib/no-axios/rpc/axios.d.ts +4 -0
  329. package/lib/no-axios/rpc/axios.js +15 -0
  330. package/lib/no-axios/rpc/browser.d.ts +4 -0
  331. package/lib/no-axios/rpc/browser.js +27 -0
  332. package/lib/no-axios/rpc/index.d.ts +8 -0
  333. package/lib/no-axios/rpc/index.js +72 -0
  334. package/lib/no-axios/rpc/jsonrpc.d.ts +35 -0
  335. package/lib/no-axios/rpc/jsonrpc.js +52 -0
  336. package/lib/no-axios/rpc/parsers.d.ts +39 -0
  337. package/lib/no-axios/rpc/parsers.js +155 -0
  338. package/lib/no-axios/rpc/server.d.ts +584 -0
  339. package/lib/no-axios/rpc/server.js +823 -0
  340. package/lib/no-axios/rpc/transaction.d.ts +21 -0
  341. package/lib/no-axios/rpc/transaction.js +53 -0
  342. package/lib/no-axios/rpc/utils.d.ts +1 -0
  343. package/lib/no-axios/rpc/utils.js +9 -0
  344. package/lib/no-axios/stellartoml/index.d.ts +131 -0
  345. package/lib/no-axios/stellartoml/index.js +77 -0
  346. package/lib/no-axios/utils.d.ts +19 -0
  347. package/lib/no-axios/utils.js +31 -0
  348. package/lib/no-axios/webauth/errors.d.ts +13 -0
  349. package/lib/no-axios/webauth/errors.js +36 -0
  350. package/lib/no-axios/webauth/index.d.ts +2 -0
  351. package/lib/no-axios/webauth/index.js +27 -0
  352. package/lib/no-axios/webauth/utils.d.ts +307 -0
  353. package/lib/no-axios/webauth/utils.js +332 -0
  354. package/lib/no-eventsource/browser.d.ts +6 -0
  355. package/lib/no-eventsource/browser.js +35 -0
  356. package/lib/no-eventsource/config.d.ts +64 -0
  357. package/lib/no-eventsource/config.js +51 -0
  358. package/lib/no-eventsource/contract/assembled_transaction.d.ts +555 -0
  359. package/lib/no-eventsource/contract/assembled_transaction.js +752 -0
  360. package/lib/no-eventsource/contract/basic_node_signer.d.ts +17 -0
  361. package/lib/no-eventsource/contract/basic_node_signer.js +52 -0
  362. package/lib/no-eventsource/contract/client.d.ts +52 -0
  363. package/lib/no-eventsource/contract/client.js +180 -0
  364. package/lib/no-eventsource/contract/index.d.ts +7 -0
  365. package/lib/no-eventsource/contract/index.js +82 -0
  366. package/lib/no-eventsource/contract/rust_result.d.ts +81 -0
  367. package/lib/no-eventsource/contract/rust_result.js +66 -0
  368. package/lib/no-eventsource/contract/sent_transaction.d.ts +85 -0
  369. package/lib/no-eventsource/contract/sent_transaction.js +151 -0
  370. package/lib/no-eventsource/contract/spec.d.ts +152 -0
  371. package/lib/no-eventsource/contract/spec.js +1020 -0
  372. package/lib/no-eventsource/contract/types.d.ts +180 -0
  373. package/lib/no-eventsource/contract/types.js +8 -0
  374. package/lib/no-eventsource/contract/utils.d.ts +46 -0
  375. package/lib/no-eventsource/contract/utils.js +123 -0
  376. package/lib/no-eventsource/errors/account_requires_memo.d.ts +24 -0
  377. package/lib/no-eventsource/errors/account_requires_memo.js +38 -0
  378. package/lib/no-eventsource/errors/bad_request.d.ts +14 -0
  379. package/lib/no-eventsource/errors/bad_request.js +34 -0
  380. package/lib/no-eventsource/errors/bad_response.d.ts +17 -0
  381. package/lib/no-eventsource/errors/bad_response.js +34 -0
  382. package/lib/no-eventsource/errors/index.d.ts +5 -0
  383. package/lib/no-eventsource/errors/index.js +60 -0
  384. package/lib/no-eventsource/errors/network.d.ts +33 -0
  385. package/lib/no-eventsource/errors/network.js +41 -0
  386. package/lib/no-eventsource/errors/not_found.d.ts +14 -0
  387. package/lib/no-eventsource/errors/not_found.js +34 -0
  388. package/lib/no-eventsource/federation/api.d.ts +32 -0
  389. package/lib/no-eventsource/federation/api.js +7 -0
  390. package/lib/no-eventsource/federation/index.d.ts +2 -0
  391. package/lib/no-eventsource/federation/index.js +34 -0
  392. package/lib/no-eventsource/federation/server.d.ts +116 -0
  393. package/lib/no-eventsource/federation/server.js +252 -0
  394. package/lib/no-eventsource/friendbot/index.d.ts +5 -0
  395. package/lib/no-eventsource/friendbot/index.js +7 -0
  396. package/lib/no-eventsource/horizon/account_call_builder.d.ts +56 -0
  397. package/lib/no-eventsource/horizon/account_call_builder.js +62 -0
  398. package/lib/no-eventsource/horizon/account_response.d.ts +61 -0
  399. package/lib/no-eventsource/horizon/account_response.js +49 -0
  400. package/lib/no-eventsource/horizon/assets_call_builder.d.ts +27 -0
  401. package/lib/no-eventsource/horizon/assets_call_builder.js +43 -0
  402. package/lib/no-eventsource/horizon/call_builder.d.ts +128 -0
  403. package/lib/no-eventsource/horizon/call_builder.js +362 -0
  404. package/lib/no-eventsource/horizon/claimable_balances_call_builder.d.ts +50 -0
  405. package/lib/no-eventsource/horizon/claimable_balances_call_builder.js +56 -0
  406. package/lib/no-eventsource/horizon/effect_call_builder.d.ts +53 -0
  407. package/lib/no-eventsource/horizon/effect_call_builder.js +56 -0
  408. package/lib/no-eventsource/horizon/friendbot_builder.d.ts +4 -0
  409. package/lib/no-eventsource/horizon/friendbot_builder.js +32 -0
  410. package/lib/no-eventsource/horizon/horizon_api.d.ts +527 -0
  411. package/lib/no-eventsource/horizon/horizon_api.js +96 -0
  412. package/lib/no-eventsource/horizon/horizon_axios_client.d.ts +37 -0
  413. package/lib/no-eventsource/horizon/horizon_axios_client.js +60 -0
  414. package/lib/no-eventsource/horizon/index.d.ts +8 -0
  415. package/lib/no-eventsource/horizon/index.js +78 -0
  416. package/lib/no-eventsource/horizon/ledger_call_builder.d.ts +23 -0
  417. package/lib/no-eventsource/horizon/ledger_call_builder.js +37 -0
  418. package/lib/no-eventsource/horizon/liquidity_pool_call_builder.d.ts +37 -0
  419. package/lib/no-eventsource/horizon/liquidity_pool_call_builder.js +59 -0
  420. package/lib/no-eventsource/horizon/offer_call_builder.d.ts +65 -0
  421. package/lib/no-eventsource/horizon/offer_call_builder.js +79 -0
  422. package/lib/no-eventsource/horizon/operation_call_builder.d.ts +69 -0
  423. package/lib/no-eventsource/horizon/operation_call_builder.js +69 -0
  424. package/lib/no-eventsource/horizon/orderbook_call_builder.d.ts +20 -0
  425. package/lib/no-eventsource/horizon/orderbook_call_builder.js +45 -0
  426. package/lib/no-eventsource/horizon/path_call_builder.d.ts +35 -0
  427. package/lib/no-eventsource/horizon/path_call_builder.js +41 -0
  428. package/lib/no-eventsource/horizon/payment_call_builder.d.ts +39 -0
  429. package/lib/no-eventsource/horizon/payment_call_builder.js +46 -0
  430. package/lib/no-eventsource/horizon/server.d.ts +389 -0
  431. package/lib/no-eventsource/horizon/server.js +550 -0
  432. package/lib/no-eventsource/horizon/server_api.d.ts +278 -0
  433. package/lib/no-eventsource/horizon/server_api.js +19 -0
  434. package/lib/no-eventsource/horizon/strict_receive_path_call_builder.d.ts +38 -0
  435. package/lib/no-eventsource/horizon/strict_receive_path_call_builder.js +50 -0
  436. package/lib/no-eventsource/horizon/strict_send_path_call_builder.d.ts +38 -0
  437. package/lib/no-eventsource/horizon/strict_send_path_call_builder.js +50 -0
  438. package/lib/no-eventsource/horizon/trade_aggregation_call_builder.d.ts +49 -0
  439. package/lib/no-eventsource/horizon/trade_aggregation_call_builder.js +76 -0
  440. package/lib/no-eventsource/horizon/trades_call_builder.d.ts +52 -0
  441. package/lib/no-eventsource/horizon/trades_call_builder.js +72 -0
  442. package/lib/no-eventsource/horizon/transaction_call_builder.d.ts +60 -0
  443. package/lib/no-eventsource/horizon/transaction_call_builder.js +64 -0
  444. package/lib/no-eventsource/horizon/types/account.d.ts +5 -0
  445. package/lib/no-eventsource/horizon/types/account.js +5 -0
  446. package/lib/no-eventsource/horizon/types/assets.d.ts +19 -0
  447. package/lib/no-eventsource/horizon/types/assets.js +5 -0
  448. package/lib/no-eventsource/horizon/types/effects.d.ts +285 -0
  449. package/lib/no-eventsource/horizon/types/effects.js +62 -0
  450. package/lib/no-eventsource/horizon/types/offer.d.ts +20 -0
  451. package/lib/no-eventsource/horizon/types/offer.js +5 -0
  452. package/lib/no-eventsource/horizon/types/trade.d.ts +13 -0
  453. package/lib/no-eventsource/horizon/types/trade.js +5 -0
  454. package/lib/no-eventsource/http-client/axios-client.d.ts +2 -0
  455. package/lib/no-eventsource/http-client/axios-client.js +10 -0
  456. package/lib/no-eventsource/http-client/fetch-client.d.ts +11 -0
  457. package/lib/no-eventsource/http-client/fetch-client.js +229 -0
  458. package/lib/no-eventsource/http-client/index.d.ts +5 -0
  459. package/lib/no-eventsource/http-client/index.js +33 -0
  460. package/lib/no-eventsource/http-client/types.d.ts +69 -0
  461. package/lib/no-eventsource/http-client/types.js +34 -0
  462. package/lib/no-eventsource/index.d.ts +36 -0
  463. package/lib/no-eventsource/index.js +83 -0
  464. package/lib/no-eventsource/rpc/api.d.ts +359 -0
  465. package/lib/no-eventsource/rpc/api.js +32 -0
  466. package/lib/no-eventsource/rpc/axios.d.ts +4 -0
  467. package/lib/no-eventsource/rpc/axios.js +15 -0
  468. package/lib/no-eventsource/rpc/browser.d.ts +4 -0
  469. package/lib/no-eventsource/rpc/browser.js +27 -0
  470. package/lib/no-eventsource/rpc/index.d.ts +8 -0
  471. package/lib/no-eventsource/rpc/index.js +72 -0
  472. package/lib/no-eventsource/rpc/jsonrpc.d.ts +35 -0
  473. package/lib/no-eventsource/rpc/jsonrpc.js +52 -0
  474. package/lib/no-eventsource/rpc/parsers.d.ts +39 -0
  475. package/lib/no-eventsource/rpc/parsers.js +155 -0
  476. package/lib/no-eventsource/rpc/server.d.ts +584 -0
  477. package/lib/no-eventsource/rpc/server.js +823 -0
  478. package/lib/no-eventsource/rpc/transaction.d.ts +21 -0
  479. package/lib/no-eventsource/rpc/transaction.js +53 -0
  480. package/lib/no-eventsource/rpc/utils.d.ts +1 -0
  481. package/lib/no-eventsource/rpc/utils.js +9 -0
  482. package/lib/no-eventsource/stellartoml/index.d.ts +131 -0
  483. package/lib/no-eventsource/stellartoml/index.js +77 -0
  484. package/lib/no-eventsource/utils.d.ts +19 -0
  485. package/lib/no-eventsource/utils.js +31 -0
  486. package/lib/no-eventsource/webauth/errors.d.ts +13 -0
  487. package/lib/no-eventsource/webauth/errors.js +36 -0
  488. package/lib/no-eventsource/webauth/index.d.ts +2 -0
  489. package/lib/no-eventsource/webauth/index.js +27 -0
  490. package/lib/no-eventsource/webauth/utils.d.ts +307 -0
  491. package/lib/no-eventsource/webauth/utils.js +332 -0
  492. package/lib/rpc/api.d.ts +13 -2
  493. package/lib/rpc/axios.d.ts +3 -2
  494. package/lib/rpc/axios.js +3 -4
  495. package/lib/rpc/browser.d.ts +0 -2
  496. package/lib/rpc/browser.js +1 -11
  497. package/lib/rpc/index.d.ts +2 -1
  498. package/lib/rpc/index.js +1 -1
  499. package/lib/rpc/jsonrpc.d.ts +9 -1
  500. package/lib/rpc/parsers.d.ts +30 -10
  501. package/lib/rpc/parsers.js +11 -11
  502. package/lib/rpc/server.d.ts +169 -99
  503. package/lib/rpc/server.js +92 -6
  504. package/lib/rpc/transaction.d.ts +11 -9
  505. package/lib/stellartoml/index.d.ts +21 -11
  506. package/lib/stellartoml/index.js +3 -3
  507. package/lib/utils.d.ts +11 -4
  508. package/lib/webauth/errors.d.ts +9 -0
  509. package/lib/webauth/utils.d.ts +67 -54
  510. package/package.json +59 -7
  511. package/lib/errors.d.ts +0 -59
@@ -0,0 +1,555 @@
1
+ import { Account, SorobanDataBuilder, TransactionBuilder, authorizeEntry as stellarBaseAuthorizeEntry, xdr } from "@stellar/stellar-base";
2
+ import type { AssembledTransactionOptions, ClientOptions, Tx, XDR_BASE64 } from "./types";
3
+ import { Api } from "../rpc/api";
4
+ import { SentTransaction } from "./sent_transaction";
5
+ import { Spec } from "./spec";
6
+ /** @module contract */
7
+ /**
8
+ * The main workhorse of {@link Client}. This class is used to wrap a
9
+ * transaction-under-construction and provide high-level interfaces to the most
10
+ * common workflows, while still providing access to low-level stellar-sdk
11
+ * transaction manipulation.
12
+ *
13
+ * Most of the time, you will not construct an `AssembledTransaction` directly,
14
+ * but instead receive one as the return value of a `Client` method. If
15
+ * you're familiar with the libraries generated by soroban-cli's `contract
16
+ * bindings typescript` command, these also wraps `Client` and return
17
+ * `AssembledTransaction` instances.
18
+ *
19
+ * Let's look at examples of how to use `AssembledTransaction` for a variety of
20
+ * use-cases:
21
+ *
22
+ * #### 1. Simple read call
23
+ *
24
+ * Since these only require simulation, you can get the `result` of the call
25
+ * right after constructing your `AssembledTransaction`:
26
+ *
27
+ * ```ts
28
+ * const { result } = await AssembledTransaction.build({
29
+ * method: 'myReadMethod',
30
+ * args: spec.funcArgsToScVals('myReadMethod', {
31
+ * args: 'for',
32
+ * my: 'method',
33
+ * ...
34
+ * }),
35
+ * contractId: 'C123…',
36
+ * networkPassphrase: '…',
37
+ * rpcUrl: 'https://…',
38
+ * publicKey: undefined, // irrelevant, for simulation-only read calls
39
+ * parseResultXdr: (result: xdr.ScVal) =>
40
+ * spec.funcResToNative('myReadMethod', result),
41
+ * })
42
+ * ```
43
+ *
44
+ * While that looks pretty complicated, most of the time you will use this in
45
+ * conjunction with {@link Client}, which simplifies it to:
46
+ *
47
+ * ```ts
48
+ * const { result } = await client.myReadMethod({
49
+ * args: 'for',
50
+ * my: 'method',
51
+ * ...
52
+ * })
53
+ * ```
54
+ *
55
+ * #### 2. Simple write call
56
+ *
57
+ * For write calls that will be simulated and then sent to the network without
58
+ * further manipulation, only one more step is needed:
59
+ *
60
+ * ```ts
61
+ * const assembledTx = await client.myWriteMethod({
62
+ * args: 'for',
63
+ * my: 'method',
64
+ * ...
65
+ * })
66
+ * const sentTx = await assembledTx.signAndSend()
67
+ * ```
68
+ *
69
+ * Here we're assuming that you're using a {@link Client}, rather than
70
+ * constructing `AssembledTransaction`'s directly.
71
+ *
72
+ * Note that `sentTx`, the return value of `signAndSend`, is a
73
+ * {@link SentTransaction}. `SentTransaction` is similar to
74
+ * `AssembledTransaction`, but is missing many of the methods and fields that
75
+ * are only relevant while assembling a transaction. It also has a few extra
76
+ * methods and fields that are only relevant after the transaction has been
77
+ * sent to the network.
78
+ *
79
+ * Like `AssembledTransaction`, `SentTransaction` also has a `result` getter,
80
+ * which contains the parsed final return value of the contract call. Most of
81
+ * the time, you may only be interested in this, so rather than getting the
82
+ * whole `sentTx` you may just want to:
83
+ *
84
+ * ```ts
85
+ * const tx = await client.myWriteMethod({ args: 'for', my: 'method', ... })
86
+ * const { result } = await tx.signAndSend()
87
+ * ```
88
+ *
89
+ * #### 3. More fine-grained control over transaction construction
90
+ *
91
+ * If you need more control over the transaction before simulating it, you can
92
+ * set various {@link MethodOptions} when constructing your
93
+ * `AssembledTransaction`. With a {@link Client}, this is passed as a
94
+ * second object after the arguments (or the only object, if the method takes
95
+ * no arguments):
96
+ *
97
+ * ```ts
98
+ * const tx = await client.myWriteMethod(
99
+ * {
100
+ * args: 'for',
101
+ * my: 'method',
102
+ * ...
103
+ * }, {
104
+ * fee: '10000', // default: {@link BASE_FEE}
105
+ * simulate: false,
106
+ * timeoutInSeconds: 20, // default: {@link DEFAULT_TIMEOUT}
107
+ * }
108
+ * )
109
+ * ```
110
+ *
111
+ * Since we've skipped simulation, we can now edit the `raw` transaction and
112
+ * then manually call `simulate`:
113
+ *
114
+ * ```ts
115
+ * tx.raw.addMemo(Memo.text('Nice memo, friend!'))
116
+ * await tx.simulate()
117
+ * ```
118
+ *
119
+ * If you need to inspect the simulation later, you can access it with
120
+ * `tx.simulation`.
121
+ *
122
+ * #### 4. Multi-auth workflows
123
+ *
124
+ * Soroban, and Stellar in general, allows multiple parties to sign a
125
+ * transaction.
126
+ *
127
+ * Let's consider an Atomic Swap contract. Alice wants to give 10 of her Token
128
+ * A tokens to Bob for 5 of his Token B tokens.
129
+ *
130
+ * ```ts
131
+ * const ALICE = 'G123...'
132
+ * const BOB = 'G456...'
133
+ * const TOKEN_A = 'C123…'
134
+ * const TOKEN_B = 'C456…'
135
+ * const AMOUNT_A = 10n
136
+ * const AMOUNT_B = 5n
137
+ * ```
138
+ *
139
+ * Let's say Alice is also going to be the one signing the final transaction
140
+ * envelope, meaning she is the invoker. So your app, from Alice's browser,
141
+ * simulates the `swap` call:
142
+ *
143
+ * ```ts
144
+ * const tx = await swapClient.swap({
145
+ * a: ALICE,
146
+ * b: BOB,
147
+ * token_a: TOKEN_A,
148
+ * token_b: TOKEN_B,
149
+ * amount_a: AMOUNT_A,
150
+ * amount_b: AMOUNT_B,
151
+ * })
152
+ * ```
153
+ *
154
+ * But your app can't `signAndSend` this right away, because Bob needs to sign
155
+ * it first. You can check this:
156
+ *
157
+ * ```ts
158
+ * const whoElseNeedsToSign = tx.needsNonInvokerSigningBy()
159
+ * ```
160
+ *
161
+ * You can verify that `whoElseNeedsToSign` is an array of length `1`,
162
+ * containing only Bob's public key.
163
+ *
164
+ * Then, still on Alice's machine, you can serialize the
165
+ * transaction-under-assembly:
166
+ *
167
+ * ```ts
168
+ * const json = tx.toJSON()
169
+ * ```
170
+ *
171
+ * And now you need to send it to Bob's browser. How you do this depends on
172
+ * your app. Maybe you send it to a server first, maybe you use WebSockets, or
173
+ * maybe you have Alice text the JSON blob to Bob and have him paste it into
174
+ * your app in his browser (note: this option might be error-prone 😄).
175
+ *
176
+ * Once you get the JSON blob into your app on Bob's machine, you can
177
+ * deserialize it:
178
+ *
179
+ * ```ts
180
+ * const tx = swapClient.txFromJSON(json)
181
+ * ```
182
+ *
183
+ * Or, if you're using a client generated with `soroban contract bindings
184
+ * typescript`, this deserialization will look like:
185
+ *
186
+ * ```ts
187
+ * const tx = swapClient.fromJSON.swap(json)
188
+ * ```
189
+ *
190
+ * Then you can have Bob sign it. What Bob will actually need to sign is some
191
+ * _auth entries_ within the transaction, not the transaction itself or the
192
+ * transaction envelope. Your app can verify that Bob has the correct wallet
193
+ * selected, then:
194
+ *
195
+ * ```ts
196
+ * await tx.signAuthEntries()
197
+ * ```
198
+ *
199
+ * Under the hood, this uses `signAuthEntry`, which you either need to inject
200
+ * during initial construction of the `Client`/`AssembledTransaction`,
201
+ * or which you can pass directly to `signAuthEntries`.
202
+ *
203
+ * Now Bob can again serialize the transaction and send back to Alice, where
204
+ * she can finally call `signAndSend()`.
205
+ *
206
+ * To see an even more complicated example, where Alice swaps with Bob but the
207
+ * transaction is invoked by yet another party, check out
208
+ * [test-swap.js](../../test/e2e/src/test-swap.js).
209
+ *
210
+ * @memberof module:contract
211
+ */
212
+ export declare class AssembledTransaction<T> {
213
+ options: AssembledTransactionOptions<T>;
214
+ /**
215
+ * The TransactionBuilder as constructed in `{@link
216
+ * AssembledTransaction}.build`. Feel free set `simulate: false` to modify
217
+ * this object before calling `tx.simulate()` manually. Example:
218
+ *
219
+ * ```ts
220
+ * const tx = await myContract.myMethod(
221
+ * { args: 'for', my: 'method', ... },
222
+ * { simulate: false }
223
+ * );
224
+ * tx.raw.addMemo(Memo.text('Nice memo, friend!'))
225
+ * await tx.simulate();
226
+ * ```
227
+ */
228
+ raw?: TransactionBuilder;
229
+ /**
230
+ * The Transaction as it was built with `raw.build()` right before
231
+ * simulation. Once this is set, modifying `raw` will have no effect unless
232
+ * you call `tx.simulate()` again.
233
+ */
234
+ built?: Tx;
235
+ /**
236
+ * The result of the transaction simulation. This is set after the first call
237
+ * to `simulate`. It is difficult to serialize and deserialize, so it is not
238
+ * included in the `toJSON` and `fromJSON` methods. See `simulationData`
239
+ * cached, serializable access to the data needed by AssembledTransaction
240
+ * logic.
241
+ */
242
+ simulation?: Api.SimulateTransactionResponse;
243
+ /**
244
+ * Cached simulation result. This is set after the first call to
245
+ * {@link AssembledTransaction#simulationData}, and is used to facilitate
246
+ * serialization and deserialization of the AssembledTransaction.
247
+ *
248
+ * Most of the time, if you need this data, you can call
249
+ * `tx.simulation.result`.
250
+ *
251
+ * If you need access to this data after a transaction has been serialized
252
+ * and then deserialized, you can call `simulationData.result`.
253
+ */
254
+ private simulationResult?;
255
+ /**
256
+ * Cached simulation transaction data. This is set after the first call to
257
+ * {@link AssembledTransaction#simulationData}, and is used to facilitate
258
+ * serialization and deserialization of the AssembledTransaction.
259
+ *
260
+ * Most of the time, if you need this data, you can call
261
+ * `simulation.transactionData`.
262
+ *
263
+ * If you need access to this data after a transaction has been serialized
264
+ * and then deserialized, you can call `simulationData.transactionData`.
265
+ */
266
+ private simulationTransactionData?;
267
+ /**
268
+ * The Soroban server to use for all RPC calls. This is constructed from the
269
+ * `rpcUrl` in the options.
270
+ */
271
+ private server;
272
+ /**
273
+ * The signed transaction.
274
+ */
275
+ signed?: Tx;
276
+ /**
277
+ * A list of the most important errors that various AssembledTransaction
278
+ * methods can throw. Feel free to catch specific errors in your application
279
+ * logic.
280
+ */
281
+ static Errors: {
282
+ ExpiredState: {
283
+ new (message?: string): {
284
+ name: string;
285
+ message: string;
286
+ stack?: string;
287
+ };
288
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
289
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
290
+ stackTraceLimit: number;
291
+ };
292
+ RestorationFailure: {
293
+ new (message?: string): {
294
+ name: string;
295
+ message: string;
296
+ stack?: string;
297
+ };
298
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
299
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
300
+ stackTraceLimit: number;
301
+ };
302
+ NeedsMoreSignatures: {
303
+ new (message?: string): {
304
+ name: string;
305
+ message: string;
306
+ stack?: string;
307
+ };
308
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
309
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
310
+ stackTraceLimit: number;
311
+ };
312
+ NoSignatureNeeded: {
313
+ new (message?: string): {
314
+ name: string;
315
+ message: string;
316
+ stack?: string;
317
+ };
318
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
319
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
320
+ stackTraceLimit: number;
321
+ };
322
+ NoUnsignedNonInvokerAuthEntries: {
323
+ new (message?: string): {
324
+ name: string;
325
+ message: string;
326
+ stack?: string;
327
+ };
328
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
329
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
330
+ stackTraceLimit: number;
331
+ };
332
+ NoSigner: {
333
+ new (message?: string): {
334
+ name: string;
335
+ message: string;
336
+ stack?: string;
337
+ };
338
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
339
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
340
+ stackTraceLimit: number;
341
+ };
342
+ NotYetSimulated: {
343
+ new (message?: string): {
344
+ name: string;
345
+ message: string;
346
+ stack?: string;
347
+ };
348
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
349
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
350
+ stackTraceLimit: number;
351
+ };
352
+ FakeAccount: {
353
+ new (message?: string): {
354
+ name: string;
355
+ message: string;
356
+ stack?: string;
357
+ };
358
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
359
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
360
+ stackTraceLimit: number;
361
+ };
362
+ };
363
+ /**
364
+ * Serialize the AssembledTransaction to a JSON string. This is useful for
365
+ * saving the transaction to a database or sending it over the wire for
366
+ * multi-auth workflows. `fromJSON` can be used to deserialize the
367
+ * transaction. This only works with transactions that have been simulated.
368
+ */
369
+ toJSON(): string;
370
+ static fromJSON<T>(options: Omit<AssembledTransactionOptions<T>, "args">, { tx, simulationResult, simulationTransactionData, }: {
371
+ tx: XDR_BASE64;
372
+ simulationResult: {
373
+ auth: XDR_BASE64[];
374
+ retval: XDR_BASE64;
375
+ };
376
+ simulationTransactionData: XDR_BASE64;
377
+ }): AssembledTransaction<T>;
378
+ /**
379
+ * Serialize the AssembledTransaction to a base64-encoded XDR string.
380
+ */
381
+ toXDR(): string;
382
+ /**
383
+ * Deserialize the AssembledTransaction from a base64-encoded XDR string.
384
+ */
385
+ static fromXDR<T>(options: Omit<AssembledTransactionOptions<T>, "args" | "method" | "parseResultXdr">, encodedXDR: string, spec: Spec): AssembledTransaction<T>;
386
+ private constructor();
387
+ /**
388
+ * Construct a new AssembledTransaction. This is the only way to create a new
389
+ * AssembledTransaction; the main constructor is private.
390
+ *
391
+ * This is an asynchronous constructor for two reasons:
392
+ *
393
+ * 1. It needs to fetch the account from the network to get the current
394
+ * sequence number.
395
+ * 2. It needs to simulate the transaction to get the expected fee.
396
+ *
397
+ * If you don't want to simulate the transaction, you can set `simulate` to
398
+ * `false` in the options.
399
+ *
400
+ * @example
401
+ * const tx = await AssembledTransaction.build({
402
+ * ...,
403
+ * simulate: false,
404
+ * })
405
+ */
406
+ static build<T>(options: AssembledTransactionOptions<T>): Promise<AssembledTransaction<T>>;
407
+ private static buildFootprintRestoreTransaction;
408
+ simulate: ({ restore }?: {
409
+ restore?: boolean;
410
+ }) => Promise<this>;
411
+ get simulationData(): {
412
+ result: Api.SimulateHostFunctionResult;
413
+ transactionData: xdr.SorobanTransactionData;
414
+ };
415
+ get result(): T;
416
+ private parseError;
417
+ /**
418
+ * Sign the transaction with the signTransaction function included previously.
419
+ * If you did not previously include one, you need to include one now.
420
+ */
421
+ sign: ({ force, signTransaction, }?: {
422
+ /**
423
+ * If `true`, sign and send the transaction even if it is a read call
424
+ */
425
+ force?: boolean;
426
+ /**
427
+ * You must provide this here if you did not provide one before
428
+ */
429
+ signTransaction?: ClientOptions["signTransaction"];
430
+ }) => Promise<void>;
431
+ /**
432
+ * Sends the transaction to the network to return a `SentTransaction` that
433
+ * keeps track of all the attempts to fetch the transaction.
434
+ */
435
+ send(): Promise<SentTransaction<T>>;
436
+ /**
437
+ * Sign the transaction with the `signTransaction` function included previously.
438
+ * If you did not previously include one, you need to include one now.
439
+ * After signing, this method will send the transaction to the network and
440
+ * return a `SentTransaction` that keeps track * of all the attempts to fetch the transaction.
441
+ */
442
+ signAndSend: ({ force, signTransaction, }?: {
443
+ /**
444
+ * If `true`, sign and send the transaction even if it is a read call
445
+ */
446
+ force?: boolean;
447
+ /**
448
+ * You must provide this here if you did not provide one before
449
+ */
450
+ signTransaction?: ClientOptions["signTransaction"];
451
+ }) => Promise<SentTransaction<T>>;
452
+ /**
453
+ * Get a list of accounts, other than the invoker of the simulation, that
454
+ * need to sign auth entries in this transaction.
455
+ *
456
+ * Soroban allows multiple people to sign a transaction. Someone needs to
457
+ * sign the final transaction envelope; this person/account is called the
458
+ * _invoker_, or _source_. Other accounts might need to sign individual auth
459
+ * entries in the transaction, if they're not also the invoker.
460
+ *
461
+ * This function returns a list of accounts that need to sign auth entries,
462
+ * assuming that the same invoker/source account will sign the final
463
+ * transaction envelope as signed the initial simulation.
464
+ *
465
+ * One at a time, for each public key in this array, you will need to
466
+ * serialize this transaction with `toJSON`, send to the owner of that key,
467
+ * deserialize the transaction with `txFromJson`, and call
468
+ * {@link AssembledTransaction#signAuthEntries}. Then re-serialize and send to
469
+ * the next account in this list.
470
+ */
471
+ needsNonInvokerSigningBy: ({ includeAlreadySigned, }?: {
472
+ /**
473
+ * Whether or not to include auth entries that have already been signed.
474
+ * Default: false
475
+ */
476
+ includeAlreadySigned?: boolean;
477
+ }) => string[];
478
+ /**
479
+ * If {@link AssembledTransaction#needsNonInvokerSigningBy} returns a
480
+ * non-empty list, you can serialize the transaction with `toJSON`, send it to
481
+ * the owner of one of the public keys in the map, deserialize with
482
+ * `txFromJSON`, and call this method on their machine. Internally, this will
483
+ * use `signAuthEntry` function from connected `wallet` for each.
484
+ *
485
+ * Then, re-serialize the transaction and either send to the next
486
+ * `needsNonInvokerSigningBy` owner, or send it back to the original account
487
+ * who simulated the transaction so they can {@link AssembledTransaction#sign}
488
+ * the transaction envelope and {@link AssembledTransaction#send} it to the
489
+ * network.
490
+ *
491
+ * Sending to all `needsNonInvokerSigningBy` owners in parallel is not
492
+ * currently supported!
493
+ */
494
+ signAuthEntries: ({ expiration, signAuthEntry, address, authorizeEntry, }?: {
495
+ /**
496
+ * When to set each auth entry to expire. Could be any number of blocks in
497
+ * the future. Can be supplied as a promise or a raw number. Default:
498
+ * about 8.3 minutes from now.
499
+ */
500
+ expiration?: number | Promise<number>;
501
+ /**
502
+ * Sign all auth entries for this account. Default: the account that
503
+ * constructed the transaction
504
+ */
505
+ address?: string;
506
+ /**
507
+ * You must provide this here if you did not provide one before and you are not passing `authorizeEntry`. Default: the `signAuthEntry` function from the `Client` options. Must sign things as the given `publicKey`.
508
+ */
509
+ signAuthEntry?: ClientOptions["signAuthEntry"];
510
+ /**
511
+ * If you have a pro use-case and need to override the default `authorizeEntry` function, rather than using the one in @stellar/stellar-base, you can do that! Your function needs to take at least the first argument, `entry: xdr.SorobanAuthorizationEntry`, and return a `Promise<xdr.SorobanAuthorizationEntry>`.
512
+ *
513
+ * Note that you if you pass this, then `signAuthEntry` will be ignored.
514
+ */
515
+ authorizeEntry?: typeof stellarBaseAuthorizeEntry;
516
+ }) => Promise<void>;
517
+ /**
518
+ * Whether this transaction is a read call. This is determined by the
519
+ * simulation result and the transaction data. If the transaction is a read
520
+ * call, it will not need to be signed and sent to the network. If this
521
+ * returns `false`, then you need to call `signAndSend` on this transaction.
522
+ */
523
+ get isReadCall(): boolean;
524
+ /**
525
+ * Restores the footprint (resource ledger entries that can be read or written)
526
+ * of an expired transaction.
527
+ *
528
+ * The method will:
529
+ * 1. Build a new transaction aimed at restoring the necessary resources.
530
+ * 2. Sign this new transaction if a `signTransaction` handler is provided.
531
+ * 3. Send the signed transaction to the network.
532
+ * 4. Await and return the response from the network.
533
+ *
534
+ * Preconditions:
535
+ * - A `signTransaction` function must be provided during the Client initialization.
536
+ * - The provided `restorePreamble` should include a minimum resource fee and valid
537
+ * transaction data.
538
+ *
539
+ * @throws {Error} - Throws an error if no `signTransaction` function is provided during
540
+ * Client initialization.
541
+ * @throws {AssembledTransaction.Errors.RestoreFailure} - Throws a custom error if the
542
+ * restore transaction fails, providing the details of the failure.
543
+ */
544
+ restoreFootprint(
545
+ /**
546
+ * The preamble object containing data required to
547
+ * build the restore transaction.
548
+ */
549
+ restorePreamble: {
550
+ minResourceFee: string;
551
+ transactionData: SorobanDataBuilder;
552
+ },
553
+ /** The account that is executing the footprint restore operation. If omitted, will use the account from the AssembledTransaction. */
554
+ account?: Account): Promise<Api.GetTransactionResponse>;
555
+ }