@stellar/stellar-sdk 16.0.1 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/README.md +41 -2
  2. package/dist/stellar-sdk-axios.js +5401 -3690
  3. package/dist/stellar-sdk-axios.js.map +1 -1
  4. package/dist/stellar-sdk-axios.min.js +12 -11
  5. package/dist/stellar-sdk-axios.min.js.map +1 -1
  6. package/dist/stellar-sdk.js +4850 -3681
  7. package/dist/stellar-sdk.js.map +1 -1
  8. package/dist/stellar-sdk.min.js +17 -17
  9. package/dist/stellar-sdk.min.js.map +1 -1
  10. package/lib/axios/cjs/base/auth.js +147 -30
  11. package/lib/axios/cjs/base/auth.js.map +1 -1
  12. package/lib/axios/cjs/base/index.js +113 -0
  13. package/lib/axios/cjs/base/index.js.map +1 -0
  14. package/lib/axios/cjs/base/keypair.js +39 -0
  15. package/lib/axios/cjs/base/keypair.js.map +1 -1
  16. package/lib/axios/cjs/base/scval.js +34 -0
  17. package/lib/axios/cjs/base/scval.js.map +1 -1
  18. package/lib/axios/cjs/bindings/client.js +170 -0
  19. package/lib/axios/cjs/bindings/client.js.map +1 -1
  20. package/lib/axios/cjs/bindings/config.js +1 -1
  21. package/lib/axios/cjs/bindings/generator.js +45 -16
  22. package/lib/axios/cjs/bindings/generator.js.map +1 -1
  23. package/lib/axios/cjs/bindings/types.js +151 -1
  24. package/lib/axios/cjs/bindings/types.js.map +1 -1
  25. package/lib/axios/cjs/bindings/utils.js +10 -0
  26. package/lib/axios/cjs/bindings/utils.js.map +1 -1
  27. package/lib/axios/cjs/cli/index.js +19 -22
  28. package/lib/axios/cjs/cli/index.js.map +1 -1
  29. package/lib/axios/cjs/cli/util.js +1 -20
  30. package/lib/axios/cjs/cli/util.js.map +1 -1
  31. package/lib/axios/cjs/contract/assembled_transaction.js +39 -17
  32. package/lib/axios/cjs/contract/assembled_transaction.js.map +1 -1
  33. package/lib/axios/cjs/contract/basic_node_signer.js +8 -42
  34. package/lib/axios/cjs/contract/basic_node_signer.js.map +1 -1
  35. package/lib/axios/cjs/contract/client.js +56 -3
  36. package/lib/axios/cjs/contract/client.js.map +1 -1
  37. package/lib/axios/cjs/contract/event_spec.js +164 -0
  38. package/lib/axios/cjs/contract/event_spec.js.map +1 -0
  39. package/lib/axios/cjs/contract/index.js +2 -0
  40. package/lib/axios/cjs/contract/index.js.map +1 -1
  41. package/lib/axios/cjs/contract/sent_transaction.js +0 -20
  42. package/lib/axios/cjs/contract/sent_transaction.js.map +1 -1
  43. package/lib/axios/cjs/contract/signer.js +96 -0
  44. package/lib/axios/cjs/contract/signer.js.map +1 -0
  45. package/lib/axios/cjs/contract/spec.js +107 -3
  46. package/lib/axios/cjs/contract/spec.js.map +1 -1
  47. package/lib/axios/cjs/contract/types.js.map +1 -1
  48. package/lib/axios/cjs/errors/transaction_failed.js +62 -0
  49. package/lib/axios/cjs/errors/transaction_failed.js.map +1 -0
  50. package/lib/axios/cjs/errors/wrap_http_error.js +20 -0
  51. package/lib/axios/cjs/errors/wrap_http_error.js.map +1 -0
  52. package/lib/axios/cjs/federation/server.js +15 -35
  53. package/lib/axios/cjs/federation/server.js.map +1 -1
  54. package/lib/axios/cjs/horizon/account_response.js +0 -20
  55. package/lib/axios/cjs/horizon/account_response.js.map +1 -1
  56. package/lib/axios/cjs/horizon/horizon_api.js +5 -0
  57. package/lib/axios/cjs/horizon/horizon_api.js.map +1 -1
  58. package/lib/axios/cjs/horizon/horizon_axios_client.js +1 -1
  59. package/lib/axios/cjs/horizon/server.js +20 -26
  60. package/lib/axios/cjs/horizon/server.js.map +1 -1
  61. package/lib/axios/cjs/index.js +66 -65
  62. package/lib/axios/cjs/index.js.map +1 -1
  63. package/lib/axios/cjs/rpc/api.js.map +1 -1
  64. package/lib/axios/cjs/rpc/axios.js +1 -1
  65. package/lib/axios/cjs/rpc/server.js +181 -13
  66. package/lib/axios/cjs/rpc/server.js.map +1 -1
  67. package/lib/axios/cjs/rpc/transaction.js +2 -20
  68. package/lib/axios/cjs/rpc/transaction.js.map +1 -1
  69. package/lib/axios/cjs/webauth/challenge_transaction.js +7 -22
  70. package/lib/axios/cjs/webauth/challenge_transaction.js.map +1 -1
  71. package/lib/axios/cjs/webauth/utils.js +1 -20
  72. package/lib/axios/cjs/webauth/utils.js.map +1 -1
  73. package/lib/axios/esm/base/auth.d.ts +181 -13
  74. package/lib/axios/esm/base/auth.js +146 -31
  75. package/lib/axios/esm/base/auth.js.map +1 -1
  76. package/lib/axios/esm/base/index.d.ts +2 -2
  77. package/lib/axios/esm/base/index.js +44 -0
  78. package/lib/axios/esm/base/index.js.map +1 -0
  79. package/lib/axios/esm/base/keypair.d.ts +27 -0
  80. package/lib/axios/esm/base/keypair.js +39 -0
  81. package/lib/axios/esm/base/keypair.js.map +1 -1
  82. package/lib/axios/esm/base/scval.d.ts +4 -0
  83. package/lib/axios/esm/base/scval.js +34 -0
  84. package/lib/axios/esm/base/scval.js.map +1 -1
  85. package/lib/axios/esm/bindings/client.d.ts +39 -0
  86. package/lib/axios/esm/bindings/client.js +171 -1
  87. package/lib/axios/esm/bindings/client.js.map +1 -1
  88. package/lib/axios/esm/bindings/config.js +1 -1
  89. package/lib/axios/esm/bindings/generator.d.ts +34 -0
  90. package/lib/axios/esm/bindings/generator.js +45 -16
  91. package/lib/axios/esm/bindings/generator.js.map +1 -1
  92. package/lib/axios/esm/bindings/types.d.ts +42 -0
  93. package/lib/axios/esm/bindings/types.js +153 -3
  94. package/lib/axios/esm/bindings/types.js.map +1 -1
  95. package/lib/axios/esm/bindings/utils.d.ts +10 -0
  96. package/lib/axios/esm/bindings/utils.js +9 -1
  97. package/lib/axios/esm/bindings/utils.js.map +1 -1
  98. package/lib/axios/esm/cli/index.js +19 -22
  99. package/lib/axios/esm/cli/index.js.map +1 -1
  100. package/lib/axios/esm/cli/util.d.ts +1 -1
  101. package/lib/axios/esm/cli/util.js +1 -20
  102. package/lib/axios/esm/cli/util.js.map +1 -1
  103. package/lib/axios/esm/contract/assembled_transaction.d.ts +7 -5
  104. package/lib/axios/esm/contract/assembled_transaction.js +39 -17
  105. package/lib/axios/esm/contract/assembled_transaction.js.map +1 -1
  106. package/lib/axios/esm/contract/basic_node_signer.d.ts +3 -0
  107. package/lib/axios/esm/contract/basic_node_signer.js +8 -42
  108. package/lib/axios/esm/contract/basic_node_signer.js.map +1 -1
  109. package/lib/axios/esm/contract/client.d.ts +49 -3
  110. package/lib/axios/esm/contract/client.js +56 -3
  111. package/lib/axios/esm/contract/client.js.map +1 -1
  112. package/lib/axios/esm/contract/event_spec.d.ts +78 -0
  113. package/lib/axios/esm/contract/event_spec.js +159 -0
  114. package/lib/axios/esm/contract/event_spec.js.map +1 -0
  115. package/lib/axios/esm/contract/index.d.ts +3 -0
  116. package/lib/axios/esm/contract/index.js +1 -0
  117. package/lib/axios/esm/contract/index.js.map +1 -1
  118. package/lib/axios/esm/contract/sent_transaction.js +0 -20
  119. package/lib/axios/esm/contract/sent_transaction.js.map +1 -1
  120. package/lib/axios/esm/contract/signer.d.ts +104 -0
  121. package/lib/axios/esm/contract/signer.js +91 -0
  122. package/lib/axios/esm/contract/signer.js.map +1 -0
  123. package/lib/axios/esm/contract/spec.d.ts +84 -0
  124. package/lib/axios/esm/contract/spec.js +107 -3
  125. package/lib/axios/esm/contract/spec.js.map +1 -1
  126. package/lib/axios/esm/contract/types.d.ts +25 -8
  127. package/lib/axios/esm/contract/types.js.map +1 -1
  128. package/lib/axios/esm/errors/index.d.ts +1 -0
  129. package/lib/axios/esm/errors/transaction_failed.d.ts +55 -0
  130. package/lib/axios/esm/errors/transaction_failed.js +60 -0
  131. package/lib/axios/esm/errors/transaction_failed.js.map +1 -0
  132. package/lib/axios/esm/errors/wrap_http_error.d.ts +20 -0
  133. package/lib/axios/esm/errors/wrap_http_error.js +18 -0
  134. package/lib/axios/esm/errors/wrap_http_error.js.map +1 -0
  135. package/lib/axios/esm/federation/server.js +15 -35
  136. package/lib/axios/esm/federation/server.js.map +1 -1
  137. package/lib/axios/esm/horizon/account_response.js +0 -20
  138. package/lib/axios/esm/horizon/account_response.js.map +1 -1
  139. package/lib/axios/esm/horizon/horizon_api.d.ts +12 -1
  140. package/lib/axios/esm/horizon/horizon_api.js +5 -0
  141. package/lib/axios/esm/horizon/horizon_api.js.map +1 -1
  142. package/lib/axios/esm/horizon/horizon_axios_client.js +1 -1
  143. package/lib/axios/esm/horizon/server.d.ts +10 -4
  144. package/lib/axios/esm/horizon/server.js +20 -26
  145. package/lib/axios/esm/horizon/server.js.map +1 -1
  146. package/lib/axios/esm/index.js +27 -29
  147. package/lib/axios/esm/index.js.map +1 -1
  148. package/lib/axios/esm/rpc/api.d.ts +21 -0
  149. package/lib/axios/esm/rpc/api.js.map +1 -1
  150. package/lib/axios/esm/rpc/axios.js +1 -1
  151. package/lib/axios/esm/rpc/server.d.ts +115 -3
  152. package/lib/axios/esm/rpc/server.js +181 -13
  153. package/lib/axios/esm/rpc/server.js.map +1 -1
  154. package/lib/axios/esm/rpc/transaction.js +2 -20
  155. package/lib/axios/esm/rpc/transaction.js.map +1 -1
  156. package/lib/axios/esm/webauth/challenge_transaction.js +7 -22
  157. package/lib/axios/esm/webauth/challenge_transaction.js.map +1 -1
  158. package/lib/axios/esm/webauth/utils.js +1 -20
  159. package/lib/axios/esm/webauth/utils.js.map +1 -1
  160. package/lib/cjs/base/auth.js +147 -30
  161. package/lib/cjs/base/auth.js.map +1 -1
  162. package/lib/cjs/base/index.js +113 -0
  163. package/lib/cjs/base/index.js.map +1 -0
  164. package/lib/cjs/base/keypair.js +39 -0
  165. package/lib/cjs/base/keypair.js.map +1 -1
  166. package/lib/cjs/base/scval.js +34 -0
  167. package/lib/cjs/base/scval.js.map +1 -1
  168. package/lib/cjs/bindings/client.js +170 -0
  169. package/lib/cjs/bindings/client.js.map +1 -1
  170. package/lib/cjs/bindings/config.js +1 -1
  171. package/lib/cjs/bindings/generator.js +45 -16
  172. package/lib/cjs/bindings/generator.js.map +1 -1
  173. package/lib/cjs/bindings/types.js +151 -1
  174. package/lib/cjs/bindings/types.js.map +1 -1
  175. package/lib/cjs/bindings/utils.js +10 -0
  176. package/lib/cjs/bindings/utils.js.map +1 -1
  177. package/lib/cjs/cli/index.js +19 -22
  178. package/lib/cjs/cli/index.js.map +1 -1
  179. package/lib/cjs/cli/util.js +1 -20
  180. package/lib/cjs/cli/util.js.map +1 -1
  181. package/lib/cjs/contract/assembled_transaction.js +39 -17
  182. package/lib/cjs/contract/assembled_transaction.js.map +1 -1
  183. package/lib/cjs/contract/basic_node_signer.js +8 -42
  184. package/lib/cjs/contract/basic_node_signer.js.map +1 -1
  185. package/lib/cjs/contract/client.js +56 -3
  186. package/lib/cjs/contract/client.js.map +1 -1
  187. package/lib/cjs/contract/event_spec.js +164 -0
  188. package/lib/cjs/contract/event_spec.js.map +1 -0
  189. package/lib/cjs/contract/index.js +2 -0
  190. package/lib/cjs/contract/index.js.map +1 -1
  191. package/lib/cjs/contract/sent_transaction.js +0 -20
  192. package/lib/cjs/contract/sent_transaction.js.map +1 -1
  193. package/lib/cjs/contract/signer.js +96 -0
  194. package/lib/cjs/contract/signer.js.map +1 -0
  195. package/lib/cjs/contract/spec.js +107 -3
  196. package/lib/cjs/contract/spec.js.map +1 -1
  197. package/lib/cjs/contract/types.js.map +1 -1
  198. package/lib/cjs/errors/transaction_failed.js +62 -0
  199. package/lib/cjs/errors/transaction_failed.js.map +1 -0
  200. package/lib/cjs/errors/wrap_http_error.js +20 -0
  201. package/lib/cjs/errors/wrap_http_error.js.map +1 -0
  202. package/lib/cjs/federation/server.js +15 -35
  203. package/lib/cjs/federation/server.js.map +1 -1
  204. package/lib/cjs/horizon/account_response.js +0 -20
  205. package/lib/cjs/horizon/account_response.js.map +1 -1
  206. package/lib/cjs/horizon/horizon_api.js +5 -0
  207. package/lib/cjs/horizon/horizon_api.js.map +1 -1
  208. package/lib/cjs/horizon/horizon_axios_client.js +1 -1
  209. package/lib/cjs/horizon/server.js +20 -26
  210. package/lib/cjs/horizon/server.js.map +1 -1
  211. package/lib/cjs/index.js +66 -65
  212. package/lib/cjs/index.js.map +1 -1
  213. package/lib/cjs/rpc/api.js.map +1 -1
  214. package/lib/cjs/rpc/axios.js +1 -1
  215. package/lib/cjs/rpc/server.js +181 -13
  216. package/lib/cjs/rpc/server.js.map +1 -1
  217. package/lib/cjs/rpc/transaction.js +2 -20
  218. package/lib/cjs/rpc/transaction.js.map +1 -1
  219. package/lib/cjs/webauth/challenge_transaction.js +7 -22
  220. package/lib/cjs/webauth/challenge_transaction.js.map +1 -1
  221. package/lib/cjs/webauth/utils.js +1 -20
  222. package/lib/cjs/webauth/utils.js.map +1 -1
  223. package/lib/esm/base/auth.d.ts +181 -13
  224. package/lib/esm/base/auth.js +146 -31
  225. package/lib/esm/base/auth.js.map +1 -1
  226. package/lib/esm/base/index.d.ts +2 -2
  227. package/lib/esm/base/index.js +44 -0
  228. package/lib/esm/base/index.js.map +1 -0
  229. package/lib/esm/base/keypair.d.ts +27 -0
  230. package/lib/esm/base/keypair.js +39 -0
  231. package/lib/esm/base/keypair.js.map +1 -1
  232. package/lib/esm/base/scval.d.ts +4 -0
  233. package/lib/esm/base/scval.js +34 -0
  234. package/lib/esm/base/scval.js.map +1 -1
  235. package/lib/esm/bindings/client.d.ts +39 -0
  236. package/lib/esm/bindings/client.js +171 -1
  237. package/lib/esm/bindings/client.js.map +1 -1
  238. package/lib/esm/bindings/config.js +1 -1
  239. package/lib/esm/bindings/generator.d.ts +34 -0
  240. package/lib/esm/bindings/generator.js +45 -16
  241. package/lib/esm/bindings/generator.js.map +1 -1
  242. package/lib/esm/bindings/types.d.ts +42 -0
  243. package/lib/esm/bindings/types.js +153 -3
  244. package/lib/esm/bindings/types.js.map +1 -1
  245. package/lib/esm/bindings/utils.d.ts +10 -0
  246. package/lib/esm/bindings/utils.js +9 -1
  247. package/lib/esm/bindings/utils.js.map +1 -1
  248. package/lib/esm/cli/index.js +19 -22
  249. package/lib/esm/cli/index.js.map +1 -1
  250. package/lib/esm/cli/util.d.ts +1 -1
  251. package/lib/esm/cli/util.js +1 -20
  252. package/lib/esm/cli/util.js.map +1 -1
  253. package/lib/esm/contract/assembled_transaction.d.ts +7 -5
  254. package/lib/esm/contract/assembled_transaction.js +39 -17
  255. package/lib/esm/contract/assembled_transaction.js.map +1 -1
  256. package/lib/esm/contract/basic_node_signer.d.ts +3 -0
  257. package/lib/esm/contract/basic_node_signer.js +8 -42
  258. package/lib/esm/contract/basic_node_signer.js.map +1 -1
  259. package/lib/esm/contract/client.d.ts +49 -3
  260. package/lib/esm/contract/client.js +56 -3
  261. package/lib/esm/contract/client.js.map +1 -1
  262. package/lib/esm/contract/event_spec.d.ts +78 -0
  263. package/lib/esm/contract/event_spec.js +159 -0
  264. package/lib/esm/contract/event_spec.js.map +1 -0
  265. package/lib/esm/contract/index.d.ts +3 -0
  266. package/lib/esm/contract/index.js +1 -0
  267. package/lib/esm/contract/index.js.map +1 -1
  268. package/lib/esm/contract/sent_transaction.js +0 -20
  269. package/lib/esm/contract/sent_transaction.js.map +1 -1
  270. package/lib/esm/contract/signer.d.ts +104 -0
  271. package/lib/esm/contract/signer.js +91 -0
  272. package/lib/esm/contract/signer.js.map +1 -0
  273. package/lib/esm/contract/spec.d.ts +84 -0
  274. package/lib/esm/contract/spec.js +107 -3
  275. package/lib/esm/contract/spec.js.map +1 -1
  276. package/lib/esm/contract/types.d.ts +25 -8
  277. package/lib/esm/contract/types.js.map +1 -1
  278. package/lib/esm/errors/index.d.ts +1 -0
  279. package/lib/esm/errors/transaction_failed.d.ts +55 -0
  280. package/lib/esm/errors/transaction_failed.js +60 -0
  281. package/lib/esm/errors/transaction_failed.js.map +1 -0
  282. package/lib/esm/errors/wrap_http_error.d.ts +20 -0
  283. package/lib/esm/errors/wrap_http_error.js +18 -0
  284. package/lib/esm/errors/wrap_http_error.js.map +1 -0
  285. package/lib/esm/federation/server.js +15 -35
  286. package/lib/esm/federation/server.js.map +1 -1
  287. package/lib/esm/horizon/account_response.js +0 -20
  288. package/lib/esm/horizon/account_response.js.map +1 -1
  289. package/lib/esm/horizon/horizon_api.d.ts +12 -1
  290. package/lib/esm/horizon/horizon_api.js +5 -0
  291. package/lib/esm/horizon/horizon_api.js.map +1 -1
  292. package/lib/esm/horizon/horizon_axios_client.js +1 -1
  293. package/lib/esm/horizon/server.d.ts +10 -4
  294. package/lib/esm/horizon/server.js +20 -26
  295. package/lib/esm/horizon/server.js.map +1 -1
  296. package/lib/esm/index.js +27 -29
  297. package/lib/esm/index.js.map +1 -1
  298. package/lib/esm/rpc/api.d.ts +21 -0
  299. package/lib/esm/rpc/api.js.map +1 -1
  300. package/lib/esm/rpc/axios.js +1 -1
  301. package/lib/esm/rpc/server.d.ts +115 -3
  302. package/lib/esm/rpc/server.js +181 -13
  303. package/lib/esm/rpc/server.js.map +1 -1
  304. package/lib/esm/rpc/transaction.js +2 -20
  305. package/lib/esm/rpc/transaction.js.map +1 -1
  306. package/lib/esm/webauth/challenge_transaction.js +7 -22
  307. package/lib/esm/webauth/challenge_transaction.js.map +1 -1
  308. package/lib/esm/webauth/utils.js +1 -20
  309. package/lib/esm/webauth/utils.js.map +1 -1
  310. package/package.json +35 -30
@@ -1 +1 @@
1
- {"version":3,"file":"horizon_api.js","sources":["../../../src/horizon/horizon_api.ts"],"sourcesContent":["import type { AssetType, MemoType } from \"../base/index.js\";\n\n/* tslint:disable-next-line:no-namespace */\nexport namespace HorizonApi {\n export interface ResponseLink {\n href: string;\n templated?: boolean;\n }\n export interface BaseResponse<T extends string = never> {\n _links: { [key in T | \"self\"]: ResponseLink };\n }\n\n export interface SubmitTransactionResponse {\n hash: string;\n ledger: number;\n successful: boolean;\n envelope_xdr: string;\n result_xdr: string;\n result_meta_xdr: string;\n paging_token: string;\n }\n\n export interface SubmitAsyncTransactionResponse {\n hash: string;\n tx_status: string;\n error_result_xdr: string;\n }\n\n export interface FeeBumpTransactionResponse {\n hash: string;\n signatures: string[];\n }\n\n export interface InnerTransactionResponse {\n hash: string;\n signatures: string[];\n max_fee: string;\n }\n\n export interface TransactionPreconditions {\n timebounds?: {\n min_time: string;\n max_time: string;\n };\n ledgerbounds?: {\n min_ledger: number;\n max_ledger: number;\n };\n min_account_sequence?: string;\n min_account_sequence_age?: string;\n min_account_sequence_ledger_gap?: number;\n extra_signers?: string[];\n }\n\n export interface TransactionResponse\n extends\n SubmitTransactionResponse,\n BaseResponse<\n | \"account\"\n | \"ledger\"\n | \"operations\"\n | \"effects\"\n | \"succeeds\"\n | \"precedes\"\n > {\n created_at: string;\n fee_meta_xdr: string;\n fee_charged: number | string;\n max_fee: number | string;\n id: string;\n memo_type: MemoType;\n memo?: string;\n memo_bytes?: string;\n operation_count: number;\n paging_token: string;\n signatures: string[];\n source_account: string;\n source_account_sequence: string;\n fee_account: string;\n inner_transaction?: InnerTransactionResponse;\n fee_bump_transaction?: FeeBumpTransactionResponse;\n preconditions?: TransactionPreconditions;\n }\n\n export interface BalanceLineNative {\n balance: string;\n asset_type: AssetType.native;\n buying_liabilities: string;\n selling_liabilities: string;\n }\n export interface BalanceLineLiquidityPool {\n liquidity_pool_id: string;\n asset_type: AssetType.liquidityPoolShares;\n balance: string;\n limit: string;\n last_modified_ledger: number;\n is_authorized: boolean;\n is_authorized_to_maintain_liabilities: boolean;\n is_clawback_enabled: boolean;\n sponsor?: string;\n }\n export interface BalanceLineAsset<\n T extends AssetType.credit4 | AssetType.credit12 =\n | AssetType.credit4\n | AssetType.credit12,\n > {\n balance: string;\n limit: string;\n asset_type: T;\n asset_code: string;\n asset_issuer: string;\n buying_liabilities: string;\n selling_liabilities: string;\n last_modified_ledger: number;\n is_authorized: boolean;\n is_authorized_to_maintain_liabilities: boolean;\n is_clawback_enabled: boolean;\n sponsor?: string;\n }\n export type BalanceLine<T extends AssetType = AssetType> =\n T extends AssetType.native\n ? BalanceLineNative\n : T extends AssetType.credit4 | AssetType.credit12\n ? BalanceLineAsset<T>\n : T extends AssetType.liquidityPoolShares\n ? BalanceLineLiquidityPool\n : BalanceLineNative | BalanceLineAsset | BalanceLineLiquidityPool;\n\n export interface AssetAccounts {\n authorized: number;\n authorized_to_maintain_liabilities: number;\n unauthorized: number;\n }\n export interface AssetBalances {\n authorized: string;\n authorized_to_maintain_liabilities: string;\n unauthorized: string;\n }\n\n export interface PriceR {\n numerator: number;\n denominator: number;\n }\n\n export interface PriceRShorthand {\n n: number;\n d: number;\n }\n\n export interface AccountThresholds {\n low_threshold: number;\n med_threshold: number;\n high_threshold: number;\n }\n export interface Flags {\n auth_immutable: boolean;\n auth_required: boolean;\n auth_revocable: boolean;\n auth_clawback_enabled: boolean;\n }\n export interface AccountSigner {\n key: string;\n weight: number;\n type: string;\n sponsor?: string;\n }\n export interface AccountResponse extends BaseResponse<\n | \"transactions\"\n | \"operations\"\n | \"payments\"\n | \"effects\"\n | \"offers\"\n | \"trades\"\n | \"data\"\n > {\n id: string;\n paging_token: string;\n account_id: string;\n sequence: string;\n sequence_ledger?: number;\n sequence_time?: string;\n subentry_count: number;\n thresholds: AccountThresholds;\n last_modified_ledger: number;\n last_modified_time: string;\n flags: Flags;\n balances: BalanceLine[];\n signers: AccountSigner[];\n data: {\n [key: string]: string;\n };\n sponsor?: string;\n num_sponsoring: number;\n num_sponsored: number;\n }\n\n export enum LiquidityPoolType {\n constantProduct = \"constant_product\",\n }\n\n export enum OperationResponseType {\n createAccount = \"create_account\",\n payment = \"payment\",\n pathPayment = \"path_payment_strict_receive\",\n createPassiveOffer = \"create_passive_sell_offer\",\n manageOffer = \"manage_sell_offer\",\n setOptions = \"set_options\",\n changeTrust = \"change_trust\",\n allowTrust = \"allow_trust\",\n accountMerge = \"account_merge\",\n inflation = \"inflation\",\n manageData = \"manage_data\",\n bumpSequence = \"bump_sequence\",\n manageBuyOffer = \"manage_buy_offer\",\n pathPaymentStrictSend = \"path_payment_strict_send\",\n createClaimableBalance = \"create_claimable_balance\",\n claimClaimableBalance = \"claim_claimable_balance\",\n beginSponsoringFutureReserves = \"begin_sponsoring_future_reserves\",\n endSponsoringFutureReserves = \"end_sponsoring_future_reserves\",\n revokeSponsorship = \"revoke_sponsorship\",\n clawback = \"clawback\",\n clawbackClaimableBalance = \"clawback_claimable_balance\",\n setTrustLineFlags = \"set_trust_line_flags\",\n liquidityPoolDeposit = \"liquidity_pool_deposit\",\n liquidityPoolWithdraw = \"liquidity_pool_withdraw\",\n invokeHostFunction = \"invoke_host_function\",\n bumpFootprintExpiration = \"bump_footprint_expiration\",\n restoreFootprint = \"restore_footprint\",\n }\n export enum OperationResponseTypeI {\n createAccount = 0,\n payment = 1,\n pathPayment = 2,\n createPassiveOffer = 3,\n manageOffer = 4,\n setOptions = 5,\n changeTrust = 6,\n allowTrust = 7,\n accountMerge = 8,\n inflation = 9,\n manageData = 10,\n bumpSequence = 11,\n manageBuyOffer = 12,\n pathPaymentStrictSend = 13,\n createClaimableBalance = 14,\n claimClaimableBalance = 15,\n beginSponsoringFutureReserves = 16,\n endSponsoringFutureReserves = 17,\n revokeSponsorship = 18,\n clawback = 19,\n clawbackClaimableBalance = 20,\n setTrustLineFlags = 21,\n liquidityPoolDeposit = 22,\n liquidityPoolWithdraw = 23,\n invokeHostFunction = 24,\n bumpFootprintExpiration = 25,\n restoreFootprint = 26,\n }\n export interface BaseOperationResponse<\n T extends OperationResponseType = OperationResponseType,\n TI extends OperationResponseTypeI = OperationResponseTypeI,\n > extends BaseResponse<\"succeeds\" | \"precedes\" | \"effects\" | \"transaction\"> {\n id: string;\n paging_token: string;\n source_account: string;\n type: T;\n type_i: TI;\n created_at: string;\n transaction_hash: string;\n transaction_successful: boolean;\n }\n export interface CreateAccountOperationResponse extends BaseOperationResponse<\n OperationResponseType.createAccount,\n OperationResponseTypeI.createAccount\n > {\n account: string;\n funder: string;\n starting_balance: string;\n }\n export interface PaymentOperationResponse extends BaseOperationResponse<\n OperationResponseType.payment,\n OperationResponseTypeI.payment\n > {\n from: string;\n to: string;\n asset_type: AssetType;\n asset_code?: string;\n asset_issuer?: string;\n amount: string;\n to_muxed?: string;\n to_muxed_id?: string;\n }\n export interface PathPaymentOperationResponse extends BaseOperationResponse<\n OperationResponseType.pathPayment,\n OperationResponseTypeI.pathPayment\n > {\n amount: string;\n asset_code?: string;\n asset_issuer?: string;\n asset_type: AssetType;\n from: string;\n path: Array<{\n asset_code: string;\n asset_issuer: string;\n asset_type: AssetType;\n }>;\n source_amount: string;\n source_asset_code?: string;\n source_asset_issuer?: string;\n source_asset_type: AssetType;\n source_max: string;\n to: string;\n }\n export interface PathPaymentStrictSendOperationResponse extends BaseOperationResponse<\n OperationResponseType.pathPaymentStrictSend,\n OperationResponseTypeI.pathPaymentStrictSend\n > {\n amount: string;\n asset_code?: string;\n asset_issuer?: string;\n asset_type: AssetType;\n destination_min: string;\n from: string;\n path: Array<{\n asset_code: string;\n asset_issuer: string;\n asset_type: AssetType;\n }>;\n source_amount: string;\n source_asset_code?: string;\n source_asset_issuer?: string;\n source_asset_type: AssetType;\n to: string;\n }\n export interface ManageOfferOperationResponse extends BaseOperationResponse<\n OperationResponseType.manageOffer,\n OperationResponseTypeI.manageOffer\n > {\n offer_id: number | string;\n amount: string;\n buying_asset_type: AssetType;\n buying_asset_code?: string;\n buying_asset_issuer?: string;\n price: string;\n price_r: PriceR;\n selling_asset_type: AssetType;\n selling_asset_code?: string;\n selling_asset_issuer?: string;\n }\n export interface PassiveOfferOperationResponse extends BaseOperationResponse<\n OperationResponseType.createPassiveOffer,\n OperationResponseTypeI.createPassiveOffer\n > {\n offer_id: number | string;\n amount: string;\n buying_asset_type: AssetType;\n buying_asset_code?: string;\n buying_asset_issuer?: string;\n price: string;\n price_r: PriceR;\n selling_asset_type: AssetType;\n selling_asset_code?: string;\n selling_asset_issuer?: string;\n }\n export interface SetOptionsOperationResponse extends BaseOperationResponse<\n OperationResponseType.setOptions,\n OperationResponseTypeI.setOptions\n > {\n signer_key?: string;\n signer_weight?: number;\n master_key_weight?: number;\n low_threshold?: number;\n med_threshold?: number;\n high_threshold?: number;\n home_domain?: string;\n set_flags: Array<1 | 2 | 4>;\n set_flags_s: Array<\n | \"auth_required_flag\"\n | \"auth_revocable_flag\"\n | \"auth_clawback_enabled_flag\"\n >;\n clear_flags: Array<1 | 2 | 4>;\n clear_flags_s: Array<\n | \"auth_required_flag\"\n | \"auth_revocable_flag\"\n | \"auth_clawback_enabled_flag\"\n >;\n }\n export interface ChangeTrustOperationResponse extends BaseOperationResponse<\n OperationResponseType.changeTrust,\n OperationResponseTypeI.changeTrust\n > {\n asset_type:\n | AssetType.credit4\n | AssetType.credit12\n | AssetType.liquidityPoolShares;\n asset_code?: string;\n asset_issuer?: string;\n liquidity_pool_id?: string;\n trustee?: string;\n trustor: string;\n limit: string;\n }\n export interface AllowTrustOperationResponse extends BaseOperationResponse<\n OperationResponseType.allowTrust,\n OperationResponseTypeI.allowTrust\n > {\n asset_type: AssetType;\n asset_code: string;\n asset_issuer: string;\n authorize: boolean;\n authorize_to_maintain_liabilities: boolean;\n trustee: string;\n trustor: string;\n }\n export interface AccountMergeOperationResponse extends BaseOperationResponse<\n OperationResponseType.accountMerge,\n OperationResponseTypeI.accountMerge\n > {\n into: string;\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty interface names a public API response type\n export interface InflationOperationResponse extends BaseOperationResponse<\n OperationResponseType.inflation,\n OperationResponseTypeI.inflation\n > {}\n export interface ManageDataOperationResponse extends BaseOperationResponse<\n OperationResponseType.manageData,\n OperationResponseTypeI.manageData\n > {\n name: string;\n value: Buffer;\n }\n export interface BumpSequenceOperationResponse extends BaseOperationResponse<\n OperationResponseType.bumpSequence,\n OperationResponseTypeI.bumpSequence\n > {\n bump_to: string;\n }\n export interface Predicate {\n and?: Predicate[];\n or?: Predicate[];\n not?: Predicate;\n abs_before?: string;\n rel_before?: string;\n }\n\n export interface Claimant {\n destination: string;\n predicate: Predicate;\n }\n\n export interface CreateClaimableBalanceOperationResponse extends BaseOperationResponse<\n OperationResponseType.createClaimableBalance,\n OperationResponseTypeI.createClaimableBalance\n > {\n asset: string;\n amount: string;\n sponsor: string;\n claimants: Claimant[];\n }\n\n export interface ClaimClaimableBalanceOperationResponse extends BaseOperationResponse<\n OperationResponseType.claimClaimableBalance,\n OperationResponseTypeI.claimClaimableBalance\n > {\n balance_id: string;\n claimant: string;\n }\n\n export interface BeginSponsoringFutureReservesOperationResponse extends BaseOperationResponse<\n OperationResponseType.beginSponsoringFutureReserves,\n OperationResponseTypeI.beginSponsoringFutureReserves\n > {\n sponsored_id: string;\n }\n\n export interface EndSponsoringFutureReservesOperationResponse extends BaseOperationResponse<\n OperationResponseType.endSponsoringFutureReserves,\n OperationResponseTypeI.endSponsoringFutureReserves\n > {\n begin_sponsor: string;\n }\n\n export interface RevokeSponsorshipOperationResponse extends BaseOperationResponse<\n OperationResponseType.revokeSponsorship,\n OperationResponseTypeI.revokeSponsorship\n > {\n account_id?: string;\n claimable_balance_id?: string;\n data_account_id?: string;\n data_name?: string;\n offer_id?: string;\n trustline_account_id?: string;\n trustline_asset?: string;\n trustline_liquidity_pool_id?: string;\n signer_account_id?: string;\n signer_key?: string;\n }\n\n export interface ClawbackOperationResponse extends BaseOperationResponse<\n OperationResponseType.clawback,\n OperationResponseTypeI.clawback\n > {\n asset_type: AssetType;\n asset_code: string;\n asset_issuer: string;\n from: string;\n amount: string;\n }\n\n export interface ClawbackClaimableBalanceOperationResponse extends BaseOperationResponse<\n OperationResponseType.clawbackClaimableBalance,\n OperationResponseTypeI.clawbackClaimableBalance\n > {\n balance_id: string;\n }\n\n export interface SetTrustLineFlagsOperationResponse extends BaseOperationResponse<\n OperationResponseType.setTrustLineFlags,\n OperationResponseTypeI.setTrustLineFlags\n > {\n asset_type: AssetType;\n asset_code: string;\n asset_issuer: string;\n trustor: string;\n set_flags: Array<1 | 2 | 4>;\n clear_flags: Array<1 | 2 | 4>;\n }\n export interface Reserve {\n asset: string;\n amount: string;\n }\n export interface DepositLiquidityOperationResponse extends BaseOperationResponse<\n OperationResponseType.liquidityPoolDeposit,\n OperationResponseTypeI.liquidityPoolDeposit\n > {\n liquidity_pool_id: string;\n reserves_max: Reserve[];\n min_price: string;\n min_price_r: PriceRShorthand;\n max_price: string;\n max_price_r: PriceRShorthand;\n reserves_deposited: Reserve[];\n shares_received: string;\n }\n export interface WithdrawLiquidityOperationResponse extends BaseOperationResponse<\n OperationResponseType.liquidityPoolWithdraw,\n OperationResponseTypeI.liquidityPoolWithdraw\n > {\n liquidity_pool_id: string;\n reserves_min: Reserve[];\n shares: string;\n reserves_received: Reserve[];\n }\n\n export interface BalanceChange {\n asset_type: string;\n asset_code?: string;\n asset_issuer?: string;\n\n type: string;\n from: string;\n to: string;\n amount: string;\n destination_muxed_id?: string;\n }\n\n export interface InvokeHostFunctionOperationResponse extends BaseOperationResponse<\n OperationResponseType.invokeHostFunction,\n OperationResponseTypeI.invokeHostFunction\n > {\n function: string;\n parameters: {\n value: string;\n type: string;\n }[];\n address: string;\n salt: string;\n asset_balance_changes: BalanceChange[];\n }\n\n export interface BumpFootprintExpirationOperationResponse extends BaseOperationResponse<\n OperationResponseType.bumpFootprintExpiration,\n OperationResponseTypeI.bumpFootprintExpiration\n > {\n ledgers_to_expire: number;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty interface names a public API response type\n export interface RestoreFootprintOperationResponse extends BaseOperationResponse<\n OperationResponseType.restoreFootprint,\n OperationResponseTypeI.restoreFootprint\n > {}\n\n export interface ResponseCollection<T extends BaseResponse = BaseResponse> {\n _links: {\n self: ResponseLink;\n next: ResponseLink;\n prev: ResponseLink;\n };\n _embedded: {\n records: T[];\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty interface names a public API response type\n export interface TransactionResponseCollection extends ResponseCollection<TransactionResponse> {}\n\n export interface FeeDistribution {\n max: string;\n min: string;\n mode: string;\n p10: string;\n p20: string;\n p30: string;\n p40: string;\n p50: string;\n p60: string;\n p70: string;\n p80: string;\n p90: string;\n p95: string;\n p99: string;\n }\n export interface FeeStatsResponse {\n last_ledger: string;\n last_ledger_base_fee: string;\n ledger_capacity_usage: string;\n fee_charged: FeeDistribution;\n max_fee: FeeDistribution;\n }\n\n export type ErrorResponseData =\n | ErrorResponseData.RateLimitExceeded\n | ErrorResponseData.InternalServerError\n | ErrorResponseData.TransactionFailed;\n\n export namespace ErrorResponseData {\n export interface Base {\n status: number;\n title: string;\n type: string; // TODO\n details: string; // TODO\n instance: string; // TODO\n }\n\n export interface RateLimitExceeded extends Base {\n status: 429;\n title: \"Rate Limit Exceeded\";\n }\n export interface InternalServerError extends Base {\n status: 500;\n title: \"Internal Server Error\";\n }\n export interface TransactionFailed extends Base {\n status: 400;\n title: \"Transaction Failed\";\n extras: TransactionFailedExtras;\n }\n }\n\n export enum TransactionFailedResultCodes {\n TX_FAILED = \"tx_failed\",\n TX_BAD_SEQ = \"tx_bad_seq\",\n TX_BAD_AUTH = \"tx_bad_auth\",\n TX_BAD_AUTH_EXTRA = \"tx_bad_auth_extra\",\n TX_FEE_BUMP_INNER_SUCCESS = \"tx_fee_bump_inner_success\",\n TX_FEE_BUMP_INNER_FAILED = \"tx_fee_bump_inner_failed\",\n TX_NOT_SUPPORTED = \"tx_not_supported\",\n TX_SUCCESS = \"tx_success\",\n TX_TOO_EARLY = \"tx_too_early\",\n TX_TOO_LATE = \"tx_too_late\",\n TX_MISSING_OPERATION = \"tx_missing_operation\",\n TX_INSUFFICIENT_BALANCE = \"tx_insufficient_balance\",\n TX_NO_SOURCE_ACCOUNT = \"tx_no_source_account\",\n TX_INSUFFICIENT_FEE = \"tx_insufficient_fee\",\n TX_INTERNAL_ERROR = \"tx_internal_error\",\n }\n\n export interface TransactionFailedExtras {\n envelope_xdr: string; // base64\n result_codes: {\n transaction: TransactionFailedResultCodes;\n operations: string[];\n };\n result_xdr: string;\n }\n\n export interface RootResponse {\n horizon_version: string;\n core_version: string;\n ingest_latest_ledger: number;\n history_latest_ledger: number;\n history_latest_ledger_closed_at: string;\n history_elder_ledger: number;\n core_latest_ledger: number;\n network_passphrase: string;\n current_protocol_version: number;\n supported_protocol_version: number;\n core_supported_protocol_version: number;\n }\n}\n"],"names":["HorizonApi","LiquidityPoolType","OperationResponseType","OperationResponseTypeI","TransactionFailedResultCodes"],"mappings":"AAGO,IAAU;AAAA,CAAV,CAAUA,WAAAA,KAAV;AAiME,EAAA,CAAA,CAAKC,kBAAAA,KAAL;AACL,IAAAA,mBAAA,iBAAA,CAAA,GAAkB,kBAAA;AAAA,EAAA,CAAA,EADRD,WAAAA,CAAA,iBAAA,KAAAA,WAAAA,CAAA,iBAAA,GAAA,EAAA,CAAA,CAAA;AAIL,EAAA,CAAA,CAAKE,sBAAAA,KAAL;AACL,IAAAA,uBAAA,eAAA,CAAA,GAAgB,gBAAA;AAChB,IAAAA,uBAAA,SAAA,CAAA,GAAU,SAAA;AACV,IAAAA,uBAAA,aAAA,CAAA,GAAc,6BAAA;AACd,IAAAA,uBAAA,oBAAA,CAAA,GAAqB,2BAAA;AACrB,IAAAA,uBAAA,aAAA,CAAA,GAAc,mBAAA;AACd,IAAAA,uBAAA,YAAA,CAAA,GAAa,aAAA;AACb,IAAAA,uBAAA,aAAA,CAAA,GAAc,cAAA;AACd,IAAAA,uBAAA,YAAA,CAAA,GAAa,aAAA;AACb,IAAAA,uBAAA,cAAA,CAAA,GAAe,eAAA;AACf,IAAAA,uBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,IAAAA,uBAAA,YAAA,CAAA,GAAa,aAAA;AACb,IAAAA,uBAAA,cAAA,CAAA,GAAe,eAAA;AACf,IAAAA,uBAAA,gBAAA,CAAA,GAAiB,kBAAA;AACjB,IAAAA,uBAAA,uBAAA,CAAA,GAAwB,0BAAA;AACxB,IAAAA,uBAAA,wBAAA,CAAA,GAAyB,0BAAA;AACzB,IAAAA,uBAAA,uBAAA,CAAA,GAAwB,yBAAA;AACxB,IAAAA,uBAAA,+BAAA,CAAA,GAAgC,kCAAA;AAChC,IAAAA,uBAAA,6BAAA,CAAA,GAA8B,gCAAA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index.js\";\n\n/* tslint:disable-next-line:no-namespace */\nexport namespace HorizonApi {\n export interface ResponseLink {\n href: string;\n templated?: boolean;\n }\n export interface BaseResponse<T extends string = never> {\n _links: { [key in T | \"self\"]: ResponseLink };\n }\n\n export interface SubmitTransactionResponse {\n hash: string;\n ledger: number;\n successful: boolean;\n envelope_xdr: string;\n result_xdr: string;\n result_meta_xdr: string;\n paging_token: string;\n }\n\n export interface SubmitAsyncTransactionResponse {\n hash: string;\n tx_status: string;\n error_result_xdr: string;\n }\n\n export interface FeeBumpTransactionResponse {\n hash: string;\n signatures: string[];\n }\n\n export interface InnerTransactionResponse {\n hash: string;\n signatures: string[];\n max_fee: string;\n }\n\n export interface TransactionPreconditions {\n timebounds?: {\n min_time: string;\n max_time: string;\n };\n ledgerbounds?: {\n min_ledger: number;\n max_ledger: number;\n };\n min_account_sequence?: string;\n min_account_sequence_age?: string;\n min_account_sequence_ledger_gap?: number;\n extra_signers?: string[];\n }\n\n export interface TransactionResponse\n extends\n SubmitTransactionResponse,\n BaseResponse<\n | \"account\"\n | \"ledger\"\n | \"operations\"\n | \"effects\"\n | \"succeeds\"\n | \"precedes\"\n > {\n created_at: string;\n fee_meta_xdr: string;\n fee_charged: number | string;\n max_fee: number | string;\n id: string;\n memo_type: MemoType;\n memo?: string;\n memo_bytes?: string;\n operation_count: number;\n paging_token: string;\n signatures: string[];\n source_account: string;\n source_account_sequence: string;\n fee_account: string;\n inner_transaction?: InnerTransactionResponse;\n fee_bump_transaction?: FeeBumpTransactionResponse;\n preconditions?: TransactionPreconditions;\n }\n\n export interface BalanceLineNative {\n balance: string;\n asset_type: AssetType.native;\n buying_liabilities: string;\n selling_liabilities: string;\n }\n export interface BalanceLineLiquidityPool {\n liquidity_pool_id: string;\n asset_type: AssetType.liquidityPoolShares;\n balance: string;\n limit: string;\n last_modified_ledger: number;\n is_authorized: boolean;\n is_authorized_to_maintain_liabilities: boolean;\n is_clawback_enabled: boolean;\n sponsor?: string;\n }\n export interface BalanceLineAsset<\n T extends AssetType.credit4 | AssetType.credit12 =\n | AssetType.credit4\n | AssetType.credit12,\n > {\n balance: string;\n limit: string;\n asset_type: T;\n asset_code: string;\n asset_issuer: string;\n buying_liabilities: string;\n selling_liabilities: string;\n last_modified_ledger: number;\n is_authorized: boolean;\n is_authorized_to_maintain_liabilities: boolean;\n is_clawback_enabled: boolean;\n sponsor?: string;\n }\n export type BalanceLine<T extends AssetType = AssetType> =\n T extends AssetType.native\n ? BalanceLineNative\n : T extends AssetType.credit4 | AssetType.credit12\n ? BalanceLineAsset<T>\n : T extends AssetType.liquidityPoolShares\n ? BalanceLineLiquidityPool\n : BalanceLineNative | BalanceLineAsset | BalanceLineLiquidityPool;\n\n export interface AssetAccounts {\n authorized: number;\n authorized_to_maintain_liabilities: number;\n unauthorized: number;\n }\n export interface AssetBalances {\n authorized: string;\n authorized_to_maintain_liabilities: string;\n unauthorized: string;\n }\n\n export interface PriceR {\n numerator: number;\n denominator: number;\n }\n\n export interface PriceRShorthand {\n n: number;\n d: number;\n }\n\n export interface AccountThresholds {\n low_threshold: number;\n med_threshold: number;\n high_threshold: number;\n }\n export interface Flags {\n auth_immutable: boolean;\n auth_required: boolean;\n auth_revocable: boolean;\n auth_clawback_enabled: boolean;\n }\n export interface AccountSigner {\n key: string;\n weight: number;\n type: string;\n sponsor?: string;\n }\n export interface AccountResponse extends BaseResponse<\n | \"transactions\"\n | \"operations\"\n | \"payments\"\n | \"effects\"\n | \"offers\"\n | \"trades\"\n | \"data\"\n > {\n id: string;\n paging_token: string;\n account_id: string;\n sequence: string;\n sequence_ledger?: number;\n sequence_time?: string;\n subentry_count: number;\n thresholds: AccountThresholds;\n last_modified_ledger: number;\n last_modified_time: string;\n flags: Flags;\n balances: BalanceLine[];\n signers: AccountSigner[];\n data: {\n [key: string]: string;\n };\n sponsor?: string;\n num_sponsoring: number;\n num_sponsored: number;\n }\n\n export enum LiquidityPoolType {\n constantProduct = \"constant_product\",\n }\n\n export enum OperationResponseType {\n createAccount = \"create_account\",\n payment = \"payment\",\n pathPayment = \"path_payment_strict_receive\",\n createPassiveOffer = \"create_passive_sell_offer\",\n manageOffer = \"manage_sell_offer\",\n setOptions = \"set_options\",\n changeTrust = \"change_trust\",\n allowTrust = \"allow_trust\",\n accountMerge = \"account_merge\",\n inflation = \"inflation\",\n manageData = \"manage_data\",\n bumpSequence = \"bump_sequence\",\n manageBuyOffer = \"manage_buy_offer\",\n pathPaymentStrictSend = \"path_payment_strict_send\",\n createClaimableBalance = \"create_claimable_balance\",\n claimClaimableBalance = \"claim_claimable_balance\",\n beginSponsoringFutureReserves = \"begin_sponsoring_future_reserves\",\n endSponsoringFutureReserves = \"end_sponsoring_future_reserves\",\n revokeSponsorship = \"revoke_sponsorship\",\n clawback = \"clawback\",\n clawbackClaimableBalance = \"clawback_claimable_balance\",\n setTrustLineFlags = \"set_trust_line_flags\",\n liquidityPoolDeposit = \"liquidity_pool_deposit\",\n liquidityPoolWithdraw = \"liquidity_pool_withdraw\",\n invokeHostFunction = \"invoke_host_function\",\n bumpFootprintExpiration = \"bump_footprint_expiration\",\n restoreFootprint = \"restore_footprint\",\n }\n export enum OperationResponseTypeI {\n createAccount = 0,\n payment = 1,\n pathPayment = 2,\n createPassiveOffer = 3,\n manageOffer = 4,\n setOptions = 5,\n changeTrust = 6,\n allowTrust = 7,\n accountMerge = 8,\n inflation = 9,\n manageData = 10,\n bumpSequence = 11,\n manageBuyOffer = 12,\n pathPaymentStrictSend = 13,\n createClaimableBalance = 14,\n claimClaimableBalance = 15,\n beginSponsoringFutureReserves = 16,\n endSponsoringFutureReserves = 17,\n revokeSponsorship = 18,\n clawback = 19,\n clawbackClaimableBalance = 20,\n setTrustLineFlags = 21,\n liquidityPoolDeposit = 22,\n liquidityPoolWithdraw = 23,\n invokeHostFunction = 24,\n bumpFootprintExpiration = 25,\n restoreFootprint = 26,\n }\n export interface BaseOperationResponse<\n T extends OperationResponseType = OperationResponseType,\n TI extends OperationResponseTypeI = OperationResponseTypeI,\n > extends BaseResponse<\"succeeds\" | \"precedes\" | \"effects\" | \"transaction\"> {\n id: string;\n paging_token: string;\n source_account: string;\n type: T;\n type_i: TI;\n created_at: string;\n transaction_hash: string;\n transaction_successful: boolean;\n }\n export interface CreateAccountOperationResponse extends BaseOperationResponse<\n OperationResponseType.createAccount,\n OperationResponseTypeI.createAccount\n > {\n account: string;\n funder: string;\n starting_balance: string;\n }\n export interface PaymentOperationResponse extends BaseOperationResponse<\n OperationResponseType.payment,\n OperationResponseTypeI.payment\n > {\n from: string;\n to: string;\n asset_type: AssetType;\n asset_code?: string;\n asset_issuer?: string;\n amount: string;\n to_muxed?: string;\n to_muxed_id?: string;\n }\n export interface PathPaymentOperationResponse extends BaseOperationResponse<\n OperationResponseType.pathPayment,\n OperationResponseTypeI.pathPayment\n > {\n amount: string;\n asset_code?: string;\n asset_issuer?: string;\n asset_type: AssetType;\n from: string;\n path: Array<{\n asset_code: string;\n asset_issuer: string;\n asset_type: AssetType;\n }>;\n source_amount: string;\n source_asset_code?: string;\n source_asset_issuer?: string;\n source_asset_type: AssetType;\n source_max: string;\n to: string;\n }\n export interface PathPaymentStrictSendOperationResponse extends BaseOperationResponse<\n OperationResponseType.pathPaymentStrictSend,\n OperationResponseTypeI.pathPaymentStrictSend\n > {\n amount: string;\n asset_code?: string;\n asset_issuer?: string;\n asset_type: AssetType;\n destination_min: string;\n from: string;\n path: Array<{\n asset_code: string;\n asset_issuer: string;\n asset_type: AssetType;\n }>;\n source_amount: string;\n source_asset_code?: string;\n source_asset_issuer?: string;\n source_asset_type: AssetType;\n to: string;\n }\n export interface ManageOfferOperationResponse extends BaseOperationResponse<\n OperationResponseType.manageOffer,\n OperationResponseTypeI.manageOffer\n > {\n offer_id: number | string;\n amount: string;\n buying_asset_type: AssetType;\n buying_asset_code?: string;\n buying_asset_issuer?: string;\n price: string;\n price_r: PriceR;\n selling_asset_type: AssetType;\n selling_asset_code?: string;\n selling_asset_issuer?: string;\n }\n export interface PassiveOfferOperationResponse extends BaseOperationResponse<\n OperationResponseType.createPassiveOffer,\n OperationResponseTypeI.createPassiveOffer\n > {\n offer_id: number | string;\n amount: string;\n buying_asset_type: AssetType;\n buying_asset_code?: string;\n buying_asset_issuer?: string;\n price: string;\n price_r: PriceR;\n selling_asset_type: AssetType;\n selling_asset_code?: string;\n selling_asset_issuer?: string;\n }\n export interface SetOptionsOperationResponse extends BaseOperationResponse<\n OperationResponseType.setOptions,\n OperationResponseTypeI.setOptions\n > {\n signer_key?: string;\n signer_weight?: number;\n master_key_weight?: number;\n low_threshold?: number;\n med_threshold?: number;\n high_threshold?: number;\n home_domain?: string;\n set_flags: Array<1 | 2 | 4>;\n set_flags_s: Array<\n | \"auth_required_flag\"\n | \"auth_revocable_flag\"\n | \"auth_clawback_enabled_flag\"\n >;\n clear_flags: Array<1 | 2 | 4>;\n clear_flags_s: Array<\n | \"auth_required_flag\"\n | \"auth_revocable_flag\"\n | \"auth_clawback_enabled_flag\"\n >;\n }\n export interface ChangeTrustOperationResponse extends BaseOperationResponse<\n OperationResponseType.changeTrust,\n OperationResponseTypeI.changeTrust\n > {\n asset_type:\n | AssetType.credit4\n | AssetType.credit12\n | AssetType.liquidityPoolShares;\n asset_code?: string;\n asset_issuer?: string;\n liquidity_pool_id?: string;\n trustee?: string;\n trustor: string;\n limit: string;\n }\n export interface AllowTrustOperationResponse extends BaseOperationResponse<\n OperationResponseType.allowTrust,\n OperationResponseTypeI.allowTrust\n > {\n asset_type: AssetType;\n asset_code: string;\n asset_issuer: string;\n authorize: boolean;\n authorize_to_maintain_liabilities: boolean;\n trustee: string;\n trustor: string;\n }\n export interface AccountMergeOperationResponse extends BaseOperationResponse<\n OperationResponseType.accountMerge,\n OperationResponseTypeI.accountMerge\n > {\n into: string;\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty interface names a public API response type\n export interface InflationOperationResponse extends BaseOperationResponse<\n OperationResponseType.inflation,\n OperationResponseTypeI.inflation\n > {}\n export interface ManageDataOperationResponse extends BaseOperationResponse<\n OperationResponseType.manageData,\n OperationResponseTypeI.manageData\n > {\n name: string;\n value: Buffer;\n }\n export interface BumpSequenceOperationResponse extends BaseOperationResponse<\n OperationResponseType.bumpSequence,\n OperationResponseTypeI.bumpSequence\n > {\n bump_to: string;\n }\n export interface Predicate {\n and?: Predicate[];\n or?: Predicate[];\n not?: Predicate;\n abs_before?: string;\n rel_before?: string;\n }\n\n export interface Claimant {\n destination: string;\n predicate: Predicate;\n }\n\n export interface CreateClaimableBalanceOperationResponse extends BaseOperationResponse<\n OperationResponseType.createClaimableBalance,\n OperationResponseTypeI.createClaimableBalance\n > {\n asset: string;\n amount: string;\n sponsor: string;\n claimants: Claimant[];\n }\n\n export interface ClaimClaimableBalanceOperationResponse extends BaseOperationResponse<\n OperationResponseType.claimClaimableBalance,\n OperationResponseTypeI.claimClaimableBalance\n > {\n balance_id: string;\n claimant: string;\n }\n\n export interface BeginSponsoringFutureReservesOperationResponse extends BaseOperationResponse<\n OperationResponseType.beginSponsoringFutureReserves,\n OperationResponseTypeI.beginSponsoringFutureReserves\n > {\n sponsored_id: string;\n }\n\n export interface EndSponsoringFutureReservesOperationResponse extends BaseOperationResponse<\n OperationResponseType.endSponsoringFutureReserves,\n OperationResponseTypeI.endSponsoringFutureReserves\n > {\n begin_sponsor: string;\n }\n\n export interface RevokeSponsorshipOperationResponse extends BaseOperationResponse<\n OperationResponseType.revokeSponsorship,\n OperationResponseTypeI.revokeSponsorship\n > {\n account_id?: string;\n claimable_balance_id?: string;\n data_account_id?: string;\n data_name?: string;\n offer_id?: string;\n trustline_account_id?: string;\n trustline_asset?: string;\n trustline_liquidity_pool_id?: string;\n signer_account_id?: string;\n signer_key?: string;\n }\n\n export interface ClawbackOperationResponse extends BaseOperationResponse<\n OperationResponseType.clawback,\n OperationResponseTypeI.clawback\n > {\n asset_type: AssetType;\n asset_code: string;\n asset_issuer: string;\n from: string;\n amount: string;\n }\n\n export interface ClawbackClaimableBalanceOperationResponse extends BaseOperationResponse<\n OperationResponseType.clawbackClaimableBalance,\n OperationResponseTypeI.clawbackClaimableBalance\n > {\n balance_id: string;\n }\n\n export interface SetTrustLineFlagsOperationResponse extends BaseOperationResponse<\n OperationResponseType.setTrustLineFlags,\n OperationResponseTypeI.setTrustLineFlags\n > {\n asset_type: AssetType;\n asset_code: string;\n asset_issuer: string;\n trustor: string;\n set_flags: Array<1 | 2 | 4>;\n clear_flags: Array<1 | 2 | 4>;\n }\n export interface Reserve {\n asset: string;\n amount: string;\n }\n export interface DepositLiquidityOperationResponse extends BaseOperationResponse<\n OperationResponseType.liquidityPoolDeposit,\n OperationResponseTypeI.liquidityPoolDeposit\n > {\n liquidity_pool_id: string;\n reserves_max: Reserve[];\n min_price: string;\n min_price_r: PriceRShorthand;\n max_price: string;\n max_price_r: PriceRShorthand;\n reserves_deposited: Reserve[];\n shares_received: string;\n }\n export interface WithdrawLiquidityOperationResponse extends BaseOperationResponse<\n OperationResponseType.liquidityPoolWithdraw,\n OperationResponseTypeI.liquidityPoolWithdraw\n > {\n liquidity_pool_id: string;\n reserves_min: Reserve[];\n shares: string;\n reserves_received: Reserve[];\n }\n\n export interface BalanceChange {\n asset_type: string;\n asset_code?: string;\n asset_issuer?: string;\n\n type: string;\n from: string;\n to: string;\n amount: string;\n destination_muxed_id?: string;\n }\n\n export interface InvokeHostFunctionOperationResponse extends BaseOperationResponse<\n OperationResponseType.invokeHostFunction,\n OperationResponseTypeI.invokeHostFunction\n > {\n function: string;\n parameters: {\n value: string;\n type: string;\n }[];\n address: string;\n salt: string;\n asset_balance_changes: BalanceChange[];\n }\n\n export interface BumpFootprintExpirationOperationResponse extends BaseOperationResponse<\n OperationResponseType.bumpFootprintExpiration,\n OperationResponseTypeI.bumpFootprintExpiration\n > {\n ledgers_to_expire: number;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty interface names a public API response type\n export interface RestoreFootprintOperationResponse extends BaseOperationResponse<\n OperationResponseType.restoreFootprint,\n OperationResponseTypeI.restoreFootprint\n > {}\n\n export interface ResponseCollection<T extends BaseResponse = BaseResponse> {\n _links: {\n self: ResponseLink;\n next: ResponseLink;\n prev: ResponseLink;\n };\n _embedded: {\n records: T[];\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty interface names a public API response type\n export interface TransactionResponseCollection extends ResponseCollection<TransactionResponse> {}\n\n export interface FeeDistribution {\n max: string;\n min: string;\n mode: string;\n p10: string;\n p20: string;\n p30: string;\n p40: string;\n p50: string;\n p60: string;\n p70: string;\n p80: string;\n p90: string;\n p95: string;\n p99: string;\n }\n export interface FeeStatsResponse {\n last_ledger: string;\n last_ledger_base_fee: string;\n ledger_capacity_usage: string;\n fee_charged: FeeDistribution;\n max_fee: FeeDistribution;\n }\n\n export type ErrorResponseData =\n | ErrorResponseData.RateLimitExceeded\n | ErrorResponseData.InternalServerError\n | ErrorResponseData.TransactionFailed;\n\n export namespace ErrorResponseData {\n export interface Base {\n status: number;\n title: string;\n type: string; // TODO\n details: string; // TODO\n instance: string; // TODO\n }\n\n export interface RateLimitExceeded extends Base {\n status: 429;\n title: \"Rate Limit Exceeded\";\n }\n export interface InternalServerError extends Base {\n status: 500;\n title: \"Internal Server Error\";\n }\n export interface TransactionFailed extends Base {\n status: 400;\n title: \"Transaction Failed\";\n extras: TransactionFailedExtras;\n }\n }\n\n export enum TransactionFailedResultCodes {\n TX_FAILED = \"tx_failed\",\n TX_BAD_SEQ = \"tx_bad_seq\",\n TX_BAD_AUTH = \"tx_bad_auth\",\n TX_BAD_AUTH_EXTRA = \"tx_bad_auth_extra\",\n TX_FEE_BUMP_INNER_SUCCESS = \"tx_fee_bump_inner_success\",\n TX_FEE_BUMP_INNER_FAILED = \"tx_fee_bump_inner_failed\",\n TX_NOT_SUPPORTED = \"tx_not_supported\",\n TX_SUCCESS = \"tx_success\",\n TX_TOO_EARLY = \"tx_too_early\",\n TX_TOO_LATE = \"tx_too_late\",\n TX_MISSING_OPERATION = \"tx_missing_operation\",\n TX_INSUFFICIENT_BALANCE = \"tx_insufficient_balance\",\n TX_NO_SOURCE_ACCOUNT = \"tx_no_source_account\",\n TX_INSUFFICIENT_FEE = \"tx_insufficient_fee\",\n TX_INTERNAL_ERROR = \"tx_internal_error\",\n TX_BAD_SPONSORSHIP = \"tx_bad_sponsorship\",\n TX_BAD_MIN_SEQ_AGE_OR_GAP = \"tx_bad_min_seq_age_or_gap\",\n TX_MALFORMED = \"tx_malformed\",\n TX_SOROBAN_INVALID = \"tx_soroban_invalid\",\n TX_FROZEN_KEY_ACCESSED = \"tx_frozen_key_accessed\",\n }\n\n export interface TransactionFailedExtras {\n envelope_xdr: string; // base64\n result_codes: {\n transaction: TransactionFailedResultCodes;\n /** Omitted by Horizon when the transaction failed a transaction-level\n * check (e.g. `tx_bad_seq`) and no operations were evaluated. Typed as\n * required for backwards compatibility; treat as possibly undefined\n * when reading the raw response, or use\n * `TransactionFailedError.getResultCodes()` which normalizes it.\n * TODO(next major): make this `operations?: string[]`. */\n operations: string[];\n };\n result_xdr: string;\n }\n\n export interface RootResponse {\n horizon_version: string;\n core_version: string;\n ingest_latest_ledger: number;\n history_latest_ledger: number;\n history_latest_ledger_closed_at: string;\n history_elder_ledger: number;\n core_latest_ledger: number;\n network_passphrase: string;\n current_protocol_version: number;\n supported_protocol_version: number;\n core_supported_protocol_version: number;\n }\n}\n"],"names":["HorizonApi","LiquidityPoolType","OperationResponseType","OperationResponseTypeI","TransactionFailedResultCodes"],"mappings":"AAGO,IAAU;AAAA,CAAV,CAAUA,WAAAA,KAAV;AAiME,EAAA,CAAA,CAAKC,kBAAAA,KAAL;AACL,IAAAA,mBAAA,iBAAA,CAAA,GAAkB,kBAAA;AAAA,EAAA,CAAA,EADRD,WAAAA,CAAA,iBAAA,KAAAA,WAAAA,CAAA,iBAAA,GAAA,EAAA,CAAA,CAAA;AAIL,EAAA,CAAA,CAAKE,sBAAAA,KAAL;AACL,IAAAA,uBAAA,eAAA,CAAA,GAAgB,gBAAA;AAChB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AAAA,8BAAA,2BAAA,CAAA,GAA4B,2BAAA;AAC5B,IAAAA,8BAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,IAAAA,8BAAA,kBAAA,CAAA,GAAmB,kBAAA;AACnB,IAAAA,8BAAA,YAAA,CAAA,GAAa,YAAA;AACb,IAAAA,8BAAA,cAAA,CAAA,GAAe,cAAA;AACf,IAAAA,8BAAA,aAAA,CAAA,GAAc,aAAA;AACd,IAAAA,8BAAA,sBAAA,CAAA,GAAuB,sBAAA;AACvB,IAAAA,8BAAA,yBAAA,CAAA,GAA0B,yBAAA;AAC1B,IAAAA,8BAAA,sBAAA,CAAA,GAAuB,sBAAA;AACvB,IAAAA,8BAAA,qBAAA,CAAA,GAAsB,qBAAA;AACtB,IAAAA,8BAAA,mBAAA,CAAA,GAAoB,mBAAA;AACpB,IAAAA,8BAAA,oBAAA,CAAA,GAAqB,oBAAA;AACrB,IAAAA,8BAAA,2BAAA,CAAA,GAA4B,2BAAA;AAC5B,IAAAA,8BAAA,cAAA,CAAA,GAAe,cAAA;AACf,IAAAA,8BAAA,oBAAA,CAAA,GAAqB,oBAAA;AACrB,IAAAA,8BAAA,wBAAA,CAAA,GAAyB,wBAAA;AAAA,EAAA,CAAA,EApBfJ,WAAAA,CAAA,4BAAA,KAAAA,WAAAA,CAAA,4BAAA,GAAA,EAAA,CAAA,CAAA;AAAA,CAAA,EAlpBG,UAAA,KAAA,UAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { create as createFetchClient } from '../http-client/fetch-client.js';
2
2
 
3
- const version = "16.0.1";
3
+ const version = "16.2.0";
4
4
  const SERVER_TIME_MAP = {};
5
5
  function toSeconds(ms) {
6
6
  return Math.floor(ms / 1e3);
@@ -203,8 +203,11 @@ export declare class HorizonServer {
203
203
  * - `skipMemoRequiredCheck` (optional): Allow skipping memo
204
204
  * required check, default: `false`. See
205
205
  * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).
206
- * @returns Promise that resolves or rejects with response from
207
- * horizon.
206
+ * @returns Promise that resolves with the response from Horizon. Rejects
207
+ * with a {@link TransactionFailedError} when Horizon reports transaction
208
+ * result codes, a {@link BadResponseError} for any other HTTP error
209
+ * response (the underlying client error is preserved as `cause` on both),
210
+ * or the original error for network-level failures.
208
211
  */
209
212
  submitTransaction(transaction: Transaction | FeeBumpTransaction, opts?: HorizonServer.SubmitTransactionOptions): Promise<HorizonApi.SubmitTransactionResponse>;
210
213
  /**
@@ -221,8 +224,11 @@ export declare class HorizonServer {
221
224
  * - `skipMemoRequiredCheck` (optional): Allow skipping memo
222
225
  * required check, default: `false`. See
223
226
  * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).
224
- * @returns Promise that resolves or rejects with response from
225
- * horizon.
227
+ * @returns Promise that resolves with the response from Horizon. Rejects
228
+ * with a {@link TransactionFailedError} when Horizon reports transaction
229
+ * result codes, a {@link BadResponseError} for any other HTTP error
230
+ * response (the underlying client error is preserved as `cause` on both),
231
+ * or the original error for network-level failures.
226
232
  */
227
233
  submitAsyncTransaction(transaction: Transaction | FeeBumpTransaction, opts?: HorizonServer.SubmitTransactionOptions): Promise<HorizonApi.SubmitAsyncTransactionResponse>;
228
234
  /**
@@ -24,7 +24,9 @@ import { CallBuilder } from './call_builder.js';
24
24
  import { Config } from '../config.js';
25
25
  import { NotFoundError } from '../errors/not_found.js';
26
26
  import { BadResponseError } from '../errors/bad_response.js';
27
+ import { TransactionFailedError } from '../errors/transaction_failed.js';
27
28
  import { AccountRequiresMemoError } from '../errors/account_requires_memo.js';
29
+ import { wrapHttpError } from '../errors/wrap_http_error.js';
28
30
  import { AccountCallBuilder } from './account_call_builder.js';
29
31
  import { AccountResponse } from './account_response.js';
30
32
  import { AssetsCallBuilder } from './assets_call_builder.js';
@@ -50,6 +52,12 @@ const ACCOUNT_REQUIRES_MEMO = "MQ==";
50
52
  function getAmountInLumens(amt) {
51
53
  return new BigNumber(amt).div(STROOPS_IN_LUMEN).toString();
52
54
  }
55
+ function toSubmissionError(error) {
56
+ return wrapHttpError(error, (details) => {
57
+ const message = `Transaction submission failed. Server responded: ${details.status} ${details.statusText}`;
58
+ return details.data?.extras?.result_codes ? new TransactionFailedError(message, details) : new BadResponseError(message, details);
59
+ });
60
+ }
53
61
  class HorizonServer {
54
62
  /**
55
63
  * Horizon Server URL (ex. `https://horizon-testnet.stellar.org`)
@@ -278,8 +286,11 @@ class HorizonServer {
278
286
  * - `skipMemoRequiredCheck` (optional): Allow skipping memo
279
287
  * required check, default: `false`. See
280
288
  * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).
281
- * @returns Promise that resolves or rejects with response from
282
- * horizon.
289
+ * @returns Promise that resolves with the response from Horizon. Rejects
290
+ * with a {@link TransactionFailedError} when Horizon reports transaction
291
+ * result codes, a {@link BadResponseError} for any other HTTP error
292
+ * response (the underlying client error is preserved as `cause` on both),
293
+ * or the original error for network-level failures.
283
294
  */
284
295
  async submitTransaction(transaction, opts = {
285
296
  skipMemoRequiredCheck: false
@@ -419,17 +430,7 @@ class HorizonServer {
419
430
  ...response.data,
420
431
  offerResults: hasManageOffer ? offerResults : void 0
421
432
  };
422
- }).catch((response) => {
423
- if (response instanceof Error) {
424
- return Promise.reject(response);
425
- }
426
- return Promise.reject(
427
- new BadResponseError(
428
- `Transaction submission failed. Server responded: ${response.status} ${response.statusText}`,
429
- response.data
430
- )
431
- );
432
- });
433
+ }).catch((error) => Promise.reject(toSubmissionError(error)));
433
434
  }
434
435
  /**
435
436
  * Submits an asynchronous transaction to the network. Unlike the synchronous version, which blocks
@@ -445,8 +446,11 @@ class HorizonServer {
445
446
  * - `skipMemoRequiredCheck` (optional): Allow skipping memo
446
447
  * required check, default: `false`. See
447
448
  * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).
448
- * @returns Promise that resolves or rejects with response from
449
- * horizon.
449
+ * @returns Promise that resolves with the response from Horizon. Rejects
450
+ * with a {@link TransactionFailedError} when Horizon reports transaction
451
+ * result codes, a {@link BadResponseError} for any other HTTP error
452
+ * response (the underlying client error is preserved as `cause` on both),
453
+ * or the original error for network-level failures.
450
454
  */
451
455
  async submitAsyncTransaction(transaction, opts = {
452
456
  skipMemoRequiredCheck: false
@@ -461,17 +465,7 @@ class HorizonServer {
461
465
  url.pathname = url.pathname.split("/").concat(["transactions_async"]).filter((value) => value.length > 0).join("/");
462
466
  return this.httpClient.post(url.toString(), `tx=${tx}`, {
463
467
  headers: { "Content-Type": "application/x-www-form-urlencoded" }
464
- }).then((response) => response.data).catch((response) => {
465
- if (response instanceof Error) {
466
- return Promise.reject(response);
467
- }
468
- return Promise.reject(
469
- new BadResponseError(
470
- `Transaction submission failed. Server responded: ${response.status} ${response.statusText}`,
471
- response.data
472
- )
473
- );
474
- });
468
+ }).then((response) => response.data).catch((error) => Promise.reject(toSubmissionError(error)));
475
469
  }
476
470
  /**
477
471
  * @returns New {@link AccountCallBuilder} object configured by a current Horizon server configuration.
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sources":["../../../src/horizon/server.ts"],"sourcesContent":["/* tslint:disable:variable-name no-namespace */\n\nimport type { BigNumber } from \"../base/util/bignumber.js\";\nimport CustomBigNumber from \"../base/util/bignumber.js\";\nimport {\n Asset,\n FeeBumpTransaction,\n StrKey,\n Transaction,\n xdr,\n} from \"../base/index.js\";\n\nimport type { TransactionBuilder } from \"../base/index.js\";\nimport { CallBuilder } from \"./call_builder.js\";\nimport { Config } from \"../config.js\";\nimport {\n AccountRequiresMemoError,\n BadResponseError,\n NotFoundError,\n} from \"../errors/index.js\";\n\nimport { AccountCallBuilder } from \"./account_call_builder.js\";\nimport { AccountResponse } from \"./account_response.js\";\nimport { AssetsCallBuilder } from \"./assets_call_builder.js\";\nimport { ClaimableBalanceCallBuilder } from \"./claimable_balances_call_builder.js\";\nimport { EffectCallBuilder } from \"./effect_call_builder.js\";\nimport { FriendbotBuilder } from \"./friendbot_builder.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { LedgerCallBuilder } from \"./ledger_call_builder.js\";\nimport { LiquidityPoolCallBuilder } from \"./liquidity_pool_call_builder.js\";\nimport { OfferCallBuilder } from \"./offer_call_builder.js\";\nimport { OperationCallBuilder } from \"./operation_call_builder.js\";\nimport { OrderbookCallBuilder } from \"./orderbook_call_builder.js\";\nimport { PathCallBuilder } from \"./path_call_builder.js\";\nimport { PaymentCallBuilder } from \"./payment_call_builder.js\";\nimport { StrictReceivePathCallBuilder } from \"./strict_receive_path_call_builder.js\";\nimport { StrictSendPathCallBuilder } from \"./strict_send_path_call_builder.js\";\nimport { TradeAggregationCallBuilder } from \"./trade_aggregation_call_builder.js\";\nimport { TradesCallBuilder } from \"./trades_call_builder.js\";\nimport { TransactionCallBuilder } from \"./transaction_call_builder.js\";\nimport {\n createHttpClient,\n getCurrentServerTime,\n} from \"./horizon_axios_client.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\n/**\n * Default transaction submission timeout for Horizon requests, in milliseconds\n * @defaultValue 60000\n */\nexport const SUBMIT_TRANSACTION_TIMEOUT: number = 60 * 1000;\n\nconst STROOPS_IN_LUMEN = 10000000;\n\n// ACCOUNT_REQUIRES_MEMO is the base64 encoding of \"1\".\n// SEP 29 uses this value to define transaction memo requirements for incoming payments.\nconst ACCOUNT_REQUIRES_MEMO = \"MQ==\";\n\nfunction getAmountInLumens(amt: BigNumber) {\n return new CustomBigNumber(amt).div(STROOPS_IN_LUMEN).toString();\n}\n\n/**\n * Server handles the network connection to a [Horizon](https://developers.stellar.org/docs/data/horizon)\n * instance and exposes an interface for requests to that instance.\n *\n * @param serverURL - Horizon Server URL (ex. `https://horizon-testnet.stellar.org`).\n * @param opts - (optional) Options object\n */\nexport class HorizonServer {\n /**\n * Horizon Server URL (ex. `https://horizon-testnet.stellar.org`)\n *\n * TODO: Solve `this.serverURL`.\n */\n public readonly serverURL: URL;\n\n /**\n * HTTP client instance for making requests to Horizon.\n * Exposes interceptors, defaults, and other configuration options.\n *\n * @example\n * ```ts\n * // Add authentication header\n * server.httpClient.defaults.headers['Authorization'] = 'Bearer token';\n *\n * // Add request interceptor\n * server.httpClient.interceptors.request.use((config) => {\n * console.log('Request:', config.url);\n * return config;\n * });\n * ```\n */\n public readonly httpClient: HttpClient;\n constructor(serverURL: string, opts: HorizonServer.Options = {}) {\n this.serverURL = new URL(serverURL);\n\n const allowHttp =\n typeof opts.allowHttp === \"undefined\"\n ? Config.isAllowHttp()\n : opts.allowHttp;\n\n const customHeaders: Record<string, string> = {};\n\n if (opts.appName) {\n customHeaders[\"X-App-Name\"] = opts.appName;\n }\n if (opts.appVersion) {\n customHeaders[\"X-App-Version\"] = opts.appVersion;\n }\n if (opts.authToken) {\n customHeaders[\"X-Auth-Token\"] = opts.authToken;\n }\n if (opts.headers) {\n Object.assign(customHeaders, opts.headers);\n }\n\n this.httpClient = createHttpClient(customHeaders);\n\n if (this.serverURL.protocol !== \"https:\" && !allowHttp) {\n throw new Error(\"Cannot connect to insecure horizon server\");\n }\n }\n\n /**\n * Get timebounds for N seconds from now, when you're creating a transaction\n * with {@link TransactionBuilder}.\n *\n * By default, {@link TransactionBuilder} uses the current local time, but\n * your machine's local time could be different from Horizon's. This gives you\n * more assurance that your timebounds will reflect what you want.\n *\n * Note that this will generate your timebounds when you **init the transaction**,\n * not when you build or submit the transaction! So give yourself enough time to get\n * the transaction built and signed before submitting.\n *\n * @example\n * ```ts\n * const transaction = new StellarSdk.TransactionBuilder(accountId, {\n * fee: await StellarSdk.Server.fetchBaseFee(),\n * timebounds: await StellarSdk.Server.fetchTimebounds(100)\n * })\n * .addOperation(operation)\n * // normally we would need to call setTimeout here, but setting timebounds\n * // earlier does the trick!\n * .build();\n * ```\n *\n * @param seconds - Number of seconds past the current time to wait.\n * @param _isRetry - (optional) True if this is a retry. Only set this internally!\n * This is to avoid a scenario where Horizon is horking up the wrong date.\n * @returns Promise that resolves a `Timebounds` object\n * (with the shape `{ minTime: 0, maxTime: N }`) that you can set the `timebounds` option to.\n */\n public async fetchTimebounds(\n seconds: number,\n _isRetry: boolean = false,\n ): Promise<HorizonServer.Timebounds> {\n // httpClient instead of this.ledgers so we can get at them headers\n const serverPort = this.serverURL.port;\n const serverKey = serverPort\n ? `${this.serverURL.hostname}:${serverPort}`\n : this.serverURL.hostname;\n const currentTime = getCurrentServerTime(serverKey);\n\n if (currentTime) {\n return {\n minTime: 0,\n maxTime: currentTime + seconds,\n };\n }\n\n // if this is a retry, then the retry has failed, so use local time\n if (_isRetry) {\n return {\n minTime: 0,\n maxTime: Math.floor(new Date().getTime() / 1000) + seconds,\n };\n }\n\n // otherwise, retry (by calling the root endpoint)\n // toString automatically adds the trailing slash\n await this.httpClient.get(this.serverURL.toString());\n return this.fetchTimebounds(seconds, true);\n }\n\n /**\n * Fetch the base fee. Since this hits the server, if the server call fails,\n * you might get an error. You should be prepared to use a default value if\n * that happens!\n * @returns Promise that resolves to the base fee.\n */\n public async fetchBaseFee(): Promise<number> {\n const response = await this.feeStats();\n\n return parseInt(response.last_ledger_base_fee, 10) || 100;\n }\n\n /**\n * Fetch the fee stats endpoint.\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/aggregations/fee-stats | Fee Stats}\n * @returns Promise that resolves to the fee stats returned by Horizon.\n */\n public async feeStats(): Promise<HorizonApi.FeeStatsResponse> {\n const cb = new CallBuilder<HorizonApi.FeeStatsResponse>(\n this.serverURL,\n this.httpClient,\n );\n cb.filter.push([\"fee_stats\"]);\n return cb.call();\n }\n\n /**\n * Fetch the Horizon server's root endpoint.\n * @returns Promise that resolves to the root endpoint returned by Horizon.\n */\n public async root(): Promise<HorizonApi.RootResponse> {\n const cb = new CallBuilder<HorizonApi.RootResponse>(\n this.serverURL,\n this.httpClient,\n );\n return cb.call();\n }\n\n /**\n * Submits a transaction to the network.\n *\n * By default this function calls {@link Horizon.Server.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * If you submit any number of `manageOffer` operations, this will add an\n * attribute to the response that will help you analyze what happened with\n * your offers.\n *\n * For example, you'll want to examine `offerResults` to add affordances like\n * these to your app:\n * - If `wasImmediatelyFilled` is true, then no offer was created. So if you\n * normally watch the `Server.offers` endpoint for offer updates, you\n * instead need to check `Server.trades` to find the result of this filled\n * offer.\n * - If `wasImmediatelyDeleted` is true, then the offer you submitted was\n * deleted without reaching the orderbook or being matched (possibly because\n * your amounts were rounded down to zero). So treat the just-submitted\n * offer request as if it never happened.\n * - If `wasPartiallyFilled` is true, you can tell the user that\n * `amountBought` or `amountSold` have already been transferred.\n *\n * @example\n * ```ts\n * const res = {\n * ...response,\n * offerResults: [\n * {\n * // Exact ordered list of offers that executed, with the exception\n * // that the last one may not have executed entirely.\n * offersClaimed: [\n * sellerId: String,\n * offerId: String,\n * assetSold: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same shape as assetSold\n * assetBought: {}\n * ],\n *\n * // What effect your manageOffer op had\n * effect: \"manageOfferCreated|manageOfferUpdated|manageOfferDeleted\",\n *\n * // Whether your offer immediately got matched and filled\n * wasImmediatelyFilled: Boolean,\n *\n * // Whether your offer immediately got deleted, if for example the order was too small\n * wasImmediatelyDeleted: Boolean,\n *\n * // Whether the offer was partially, but not completely, filled\n * wasPartiallyFilled: Boolean,\n *\n * // The full requested amount of the offer is open for matching\n * isFullyOpen: Boolean,\n *\n * // The total amount of tokens bought / sold during transaction execution\n * amountBought: Number,\n * amountSold: Number,\n *\n * // if the offer was created, updated, or partially filled, this is\n * // the outstanding offer\n * currentOffer: {\n * offerId: String,\n * amount: String,\n * price: {\n * n: String,\n * d: String,\n * },\n *\n * selling: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same as `selling`\n * buying: {},\n * },\n *\n * // the index of this particular operation in the op stack\n * operationIndex: Number\n * }\n * ]\n * }\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-a-transaction | Submit a Transaction}\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves or rejects with response from\n * horizon.\n */\n public async submitTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n timeout: SUBMIT_TRANSACTION_TIMEOUT,\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => {\n if (!response.data.result_xdr) {\n return response.data;\n }\n\n const responseXDR = xdr.TransactionResult.fromXDR(\n response.data.result_xdr,\n \"base64\",\n );\n\n // TODO: fix stellar-base types.\n const results = (responseXDR as any).result().value();\n\n let offerResults;\n let hasManageOffer;\n\n if (results.length) {\n offerResults = results\n // TODO: fix stellar-base types.\n .map((result: any, i: number) => {\n if (\n result.value().switch().name !== \"manageBuyOffer\" &&\n result.value().switch().name !== \"manageSellOffer\"\n ) {\n return null;\n }\n\n hasManageOffer = true;\n\n let amountBought = new CustomBigNumber(0);\n let amountSold = new CustomBigNumber(0);\n\n const offerSuccess = result.value().value().success();\n\n const offersClaimed = offerSuccess\n .offersClaimed()\n // TODO: fix stellar-base types.\n .map((offerClaimedAtom: any) => {\n const offerClaimed = offerClaimedAtom.value();\n\n let sellerId: string = \"\";\n switch (offerClaimedAtom.switch()) {\n case xdr.ClaimAtomType.claimAtomTypeV0():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerEd25519(),\n );\n break;\n case xdr.ClaimAtomType.claimAtomTypeOrderBook():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerId().ed25519(),\n );\n break;\n // It shouldn't be possible for a claimed offer to have type\n // claimAtomTypeLiquidityPool:\n //\n // https://github.com/stellar/stellar-core/blob/c5f6349b240818f716617ca6e0f08d295a6fad9a/src/transactions/TransactionUtils.cpp#L1284\n //\n // However, you can never be too careful.\n default:\n throw new Error(\n `Invalid offer result type: ${offerClaimedAtom.switch()}`,\n );\n }\n\n const claimedOfferAmountBought = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountBought().toString(),\n );\n const claimedOfferAmountSold = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountSold().toString(),\n );\n\n // This is an offer that was filled by the one just submitted.\n // So this offer has an _opposite_ bought/sold frame of ref\n // than from what we just submitted!\n // So add this claimed offer's bought to the SOLD count and vice v\n\n amountBought = amountBought.plus(claimedOfferAmountSold);\n amountSold = amountSold.plus(claimedOfferAmountBought);\n\n const sold = Asset.fromOperation(offerClaimed.assetSold());\n const bought = Asset.fromOperation(\n offerClaimed.assetBought(),\n );\n\n const assetSold = {\n type: sold.getAssetType(),\n assetCode: sold.getCode(),\n issuer: sold.getIssuer(),\n };\n\n const assetBought = {\n type: bought.getAssetType(),\n assetCode: bought.getCode(),\n issuer: bought.getIssuer(),\n };\n\n return {\n sellerId,\n offerId: offerClaimed.offerId().toString(),\n assetSold,\n amountSold: getAmountInLumens(claimedOfferAmountSold),\n assetBought,\n amountBought: getAmountInLumens(claimedOfferAmountBought),\n };\n });\n\n const effect = offerSuccess.offer().switch().name;\n\n let currentOffer;\n\n if (\n typeof offerSuccess.offer().value === \"function\" &&\n offerSuccess.offer().value()\n ) {\n const offerXDR = offerSuccess.offer().value();\n\n currentOffer = {\n offerId: offerXDR.offerId().toString(),\n selling: {},\n buying: {},\n amount: getAmountInLumens(offerXDR.amount().toString()),\n price: {\n n: offerXDR.price().n(),\n d: offerXDR.price().d(),\n },\n };\n\n const selling = Asset.fromOperation(offerXDR.selling());\n\n currentOffer.selling = {\n type: selling.getAssetType(),\n assetCode: selling.getCode(),\n issuer: selling.getIssuer(),\n };\n\n const buying = Asset.fromOperation(offerXDR.buying());\n\n currentOffer.buying = {\n type: buying.getAssetType(),\n assetCode: buying.getCode(),\n issuer: buying.getIssuer(),\n };\n }\n\n return {\n offersClaimed,\n effect,\n operationIndex: i,\n currentOffer,\n\n // this value is in stroops so divide it out\n amountBought: getAmountInLumens(amountBought),\n amountSold: getAmountInLumens(amountSold),\n\n isFullyOpen:\n !offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasPartiallyFilled:\n !!offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasImmediatelyFilled:\n !!offersClaimed.length && effect === \"manageOfferDeleted\",\n wasImmediatelyDeleted:\n !offersClaimed.length && effect === \"manageOfferDeleted\",\n };\n })\n // TODO: fix stellar-base types.\n .filter((result: any) => !!result);\n }\n\n return {\n ...response.data,\n offerResults: hasManageOffer ? offerResults : undefined,\n };\n })\n .catch((response) => {\n if (response instanceof Error) {\n return Promise.reject(response);\n }\n return Promise.reject(\n new BadResponseError(\n `Transaction submission failed. Server responded: ${response.status} ${response.statusText}`,\n response.data,\n ),\n );\n });\n }\n\n /**\n * Submits an asynchronous transaction to the network. Unlike the synchronous version, which blocks\n * and waits for the transaction to be ingested in Horizon, this endpoint relays the response from\n * core directly back to the user.\n *\n * By default, this function calls {@link HorizonServer.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * @see [Submit-Async-Transaction](https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-async-transaction)\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves or rejects with response from\n * horizon.\n */\n public async submitAsyncTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitAsyncTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions_async\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => response.data)\n .catch((response) => {\n if (response instanceof Error) {\n return Promise.reject(response);\n }\n return Promise.reject(\n new BadResponseError(\n `Transaction submission failed. Server responded: ${response.status} ${response.statusText}`,\n response.data,\n ),\n );\n });\n }\n\n /**\n * @returns New {@link AccountCallBuilder} object configured by a current Horizon server configuration.\n */\n public accounts(): AccountCallBuilder {\n return new AccountCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link ClaimableBalanceCallBuilder} object configured by a current Horizon server configuration.\n */\n public claimableBalances(): ClaimableBalanceCallBuilder {\n return new ClaimableBalanceCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LedgerCallBuilder} object configured by a current Horizon server configuration.\n */\n public ledgers(): LedgerCallBuilder {\n return new LedgerCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link TransactionCallBuilder} object configured by a current Horizon server configuration.\n */\n public transactions(): TransactionCallBuilder {\n return new TransactionCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the offers on the DEX.\n *\n * You can query all offers for account using the function `.accountId`.\n *\n * @example\n * ```ts\n * server.offers()\n * .forAccount(accountId).call()\n * .then(function(offers) {\n * console.log(offers);\n * });\n * ```\n *\n * @returns New {@link OfferCallBuilder} object\n */\n public offers(): OfferCallBuilder {\n return new OfferCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param selling - Asset being sold\n * @param buying - Asset being bought\n * @returns New {@link OrderbookCallBuilder} object configured by a current Horizon server configuration.\n */\n public orderbook(selling: Asset, buying: Asset): OrderbookCallBuilder {\n return new OrderbookCallBuilder(\n this.serverURL,\n this.httpClient,\n\n selling,\n buying,\n );\n }\n\n /**\n * Returns\n * @returns New {@link TradesCallBuilder} object configured by a current Horizon server configuration.\n */\n public trades(): TradesCallBuilder {\n return new TradesCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link OperationCallBuilder} object configured by a current Horizon server configuration.\n */\n public operations(): OperationCallBuilder {\n return new OperationCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LiquidityPoolCallBuilder}\n * object configured to the current Horizon server settings.\n */\n public liquidityPools(): LiquidityPoolCallBuilder {\n return new LiquidityPoolCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path\n * payments. A strict receive path payment specifies a series of assets to\n * route a payment through, from source asset (the asset debited from the\n * payer) to destination asset (the asset credited to the payee).\n *\n * A strict receive path search is specified using:\n *\n * * The destination address.\n * * The source address or source assets.\n * * The asset and amount that the destination account should receive.\n *\n * As part of the search, horizon will load a list of assets available to the\n * source address and will find any payment paths from those source assets to\n * the desired destination asset. The search's amount parameter will be used\n * to determine if there a given path can satisfy a payment of the desired\n * amount.\n *\n * If a list of assets is passed as the source, horizon will find any payment\n * paths from those source assets to the desired destination asset.\n *\n * @param source - The sender's account ID or a list of assets. Any returned path will use a source that the sender can hold.\n * @param destinationAsset - The destination asset.\n * @param destinationAmount - The amount, denominated in the destination asset, that any returned path should be able to satisfy.\n * @returns New {@link StrictReceivePathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictReceivePaths(\n source: string | Asset[],\n destinationAsset: Asset,\n destinationAmount: string,\n ): PathCallBuilder {\n return new StrictReceivePathCallBuilder(\n this.serverURL,\n this.httpClient,\n source,\n destinationAsset,\n destinationAmount,\n );\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path payments. A strict send path payment specifies a\n * series of assets to route a payment through, from source asset (the asset debited from the payer) to destination\n * asset (the asset credited to the payee).\n *\n * A strict send path search is specified using:\n *\n * The asset and amount that is being sent.\n * The destination account or the destination assets.\n *\n * @param sourceAsset - The asset to be sent.\n * @param sourceAmount - The amount, denominated in the source asset, that any returned path should be able to satisfy.\n * @param destination - The destination account or the destination assets.\n * @returns New {@link StrictSendPathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictSendPaths(\n sourceAsset: Asset,\n sourceAmount: string,\n destination: string | Asset[],\n ): PathCallBuilder {\n return new StrictSendPathCallBuilder(\n this.serverURL,\n this.httpClient,\n sourceAsset,\n sourceAmount,\n destination,\n );\n }\n\n /**\n * @returns New {@link PaymentCallBuilder} instance configured with the current\n * Horizon server configuration.\n */\n public payments(): PaymentCallBuilder {\n return new PaymentCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link EffectCallBuilder} instance configured with the current\n * Horizon server configuration\n */\n public effects(): EffectCallBuilder {\n return new EffectCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param address - The Stellar ID that you want Friendbot to send lumens to\n * @returns New {@link FriendbotBuilder} instance configured with the current\n * Horizon server configuration\n */\n public friendbot(address: string): FriendbotBuilder {\n return new FriendbotBuilder(this.serverURL, this.httpClient, address);\n }\n\n /**\n * Get a new {@link AssetsCallBuilder} instance configured with the current\n * Horizon server configuration.\n * @returns New AssetsCallBuilder instance\n */\n public assets(): AssetsCallBuilder {\n return new AssetsCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * Fetches an account's most current state in the ledger, then creates and\n * returns an {@link AccountResponse} object.\n *\n * @param accountId - The account to load.\n *\n * @returns Returns a promise to the {@link AccountResponse} object\n * with populated sequence number.\n */\n public async loadAccount(accountId: string): Promise<AccountResponse> {\n const res = await this.accounts().accountId(accountId).call();\n\n return new AccountResponse(res);\n }\n\n /**\n *\n * @param base - base asset\n * @param counter - counter asset\n * @param start_time - lower time boundary represented as millis since epoch\n * @param end_time - upper time boundary represented as millis since epoch\n * @param resolution - segment duration as millis since epoch. *Supported values are 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).\n * @param offset - segments can be offset using this parameter. Expressed in milliseconds. *Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.\n * Returns new {@link TradeAggregationCallBuilder} object configured with the current Horizon server configuration.\n * @returns New TradeAggregationCallBuilder instance\n */\n public tradeAggregation(\n base: Asset,\n counter: Asset,\n start_time: number,\n end_time: number,\n resolution: number,\n offset: number,\n ): TradeAggregationCallBuilder {\n return new TradeAggregationCallBuilder(\n this.serverURL,\n this.httpClient,\n base,\n counter,\n start_time,\n end_time,\n resolution,\n offset,\n );\n }\n\n /**\n * Check if any of the destination accounts requires a memo.\n *\n * This function implements a memo required check as defined in\n * [SEP-29](https://stellar.org/protocol/sep-29). It will load each account\n * which is the destination and check if it has the data field\n * `config.memo_required` set to `\"MQ==\"`.\n *\n * Each account is checked sequentially instead of loading multiple accounts\n * at the same time from Horizon.\n *\n * @see {@link https://stellar.org/protocol/sep-29 | SEP-29: Account Memo Requirements}\n * @param transaction - The transaction to check.\n * @returns - If any of the destination account\n * requires a memo, the promise will throw {@link AccountRequiresMemoError}.\n * @throws */\n public async checkMemoRequired(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<void> {\n if (transaction instanceof FeeBumpTransaction) {\n transaction = transaction.innerTransaction;\n }\n\n if (transaction.memo.type !== \"none\") {\n return;\n }\n\n const destinations = new Set<string>();\n\n for (let i = 0; i < transaction.operations.length; i += 1) {\n const operation = transaction.operations[i];\n\n switch (operation.type) {\n case \"payment\":\n case \"pathPaymentStrictReceive\":\n case \"pathPaymentStrictSend\":\n case \"accountMerge\":\n break;\n default:\n continue;\n }\n const destination = operation.destination;\n if (destinations.has(destination)) {\n continue;\n }\n destinations.add(destination);\n\n // skip M account checks since it implies a memo\n if (destination.startsWith(\"M\")) {\n continue;\n }\n\n try {\n const account = await this.loadAccount(destination);\n if (\n account.data_attr[\"config.memo_required\"] === ACCOUNT_REQUIRES_MEMO\n ) {\n throw new AccountRequiresMemoError(\n \"account requires memo\",\n destination,\n i,\n );\n }\n } catch (e) {\n if (e instanceof AccountRequiresMemoError) {\n throw e;\n }\n\n // fail if the error is different to account not found\n if (!(e instanceof NotFoundError)) {\n throw e;\n }\n\n continue;\n }\n }\n }\n}\n\nexport namespace HorizonServer {\n /**\n * Options for configuring connections to Horizon servers.\n */\n export interface Options {\n /** Allow connecting to http servers, default: `false`. This must be set to false in production deployments! You can also use {@link Config} class to set this globally. */\n allowHttp?: boolean;\n /** Allow set custom header `X-App-Name`, default: `undefined`. */\n appName?: string;\n /** Allow set custom header `X-App-Version`, default: `undefined`. */\n appVersion?: string;\n /** Allow set custom header `X-Auth-Token`, default: `undefined`. */\n authToken?: string;\n headers?: Record<string, string>;\n }\n\n export interface Timebounds {\n minTime: number;\n maxTime: number;\n }\n\n export interface SubmitTransactionOptions {\n skipMemoRequiredCheck?: boolean;\n }\n}\n"],"names":["CustomBigNumber","xdr"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDO,MAAM,6BAAqC,EAAA,GAAK;AAEvD,MAAM,gBAAA,GAAmB,GAAA;AAIzB,MAAM,qBAAA,GAAwB,MAAA;AAE9B,SAAS,kBAAkB,GAAA,EAAgB;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G5B,MAAA,IAAI,WAAA,CAAY,UAAA,CAAW,GAAG,CAAA,EAAG;AAC/B,QAAA;AAAA,MACF;AAEA,MAAA,IAAI;AACF,QAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,WAAA,CAAY,WAAW,CAAA;AAClD,QAAA,IACE,OAAA,CAAQ,SAAA,CAAU,sBAAsB,CAAA,KAAM,qBAAA,EAC9C;AACA,UAAA,MAAM,IAAI,wBAAA;AAAA,YACR,uBAAA;AAAA,YACA,WAAA;AAAA,YACA;AAAA,WACF;AAAA,QACF;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,aAAa,wBAAA,EAA0B;AACzC,UAAA,MAAM,CAAA;AAAA,QACR;AAGA,QAAA,IAAI,EAAE,aAAa,aAAA,CAAA,EAAgB;AACjC,UAAA,MAAM,CAAA;AAAA,QACR;AAEA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"server.js","sources":["../../../src/horizon/server.ts"],"sourcesContent":["/* tslint:disable:variable-name no-namespace */\n\nimport type { BigNumber } from \"../base/util/bignumber.js\";\nimport CustomBigNumber from \"../base/util/bignumber.js\";\nimport {\n Asset,\n FeeBumpTransaction,\n StrKey,\n Transaction,\n xdr,\n} from \"../base/index.js\";\n\nimport type { TransactionBuilder } from \"../base/index.js\";\nimport { CallBuilder } from \"./call_builder.js\";\nimport { Config } from \"../config.js\";\nimport {\n AccountRequiresMemoError,\n BadResponseError,\n NotFoundError,\n TransactionFailedError,\n} from \"../errors/index.js\";\nimport { wrapHttpError } from \"../errors/wrap_http_error.js\";\n\nimport { AccountCallBuilder } from \"./account_call_builder.js\";\nimport { AccountResponse } from \"./account_response.js\";\nimport { AssetsCallBuilder } from \"./assets_call_builder.js\";\nimport { ClaimableBalanceCallBuilder } from \"./claimable_balances_call_builder.js\";\nimport { EffectCallBuilder } from \"./effect_call_builder.js\";\nimport { FriendbotBuilder } from \"./friendbot_builder.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { LedgerCallBuilder } from \"./ledger_call_builder.js\";\nimport { LiquidityPoolCallBuilder } from \"./liquidity_pool_call_builder.js\";\nimport { OfferCallBuilder } from \"./offer_call_builder.js\";\nimport { OperationCallBuilder } from \"./operation_call_builder.js\";\nimport { OrderbookCallBuilder } from \"./orderbook_call_builder.js\";\nimport { PathCallBuilder } from \"./path_call_builder.js\";\nimport { PaymentCallBuilder } from \"./payment_call_builder.js\";\nimport { StrictReceivePathCallBuilder } from \"./strict_receive_path_call_builder.js\";\nimport { StrictSendPathCallBuilder } from \"./strict_send_path_call_builder.js\";\nimport { TradeAggregationCallBuilder } from \"./trade_aggregation_call_builder.js\";\nimport { TradesCallBuilder } from \"./trades_call_builder.js\";\nimport { TransactionCallBuilder } from \"./transaction_call_builder.js\";\nimport {\n createHttpClient,\n getCurrentServerTime,\n} from \"./horizon_axios_client.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\n/**\n * Default transaction submission timeout for Horizon requests, in milliseconds\n * @defaultValue 60000\n */\nexport const SUBMIT_TRANSACTION_TIMEOUT: number = 60 * 1000;\n\nconst STROOPS_IN_LUMEN = 10000000;\n\n// ACCOUNT_REQUIRES_MEMO is the base64 encoding of \"1\".\n// SEP 29 uses this value to define transaction memo requirements for incoming payments.\nconst ACCOUNT_REQUIRES_MEMO = \"MQ==\";\n\nfunction getAmountInLumens(amt: BigNumber) {\n return new CustomBigNumber(amt).div(STROOPS_IN_LUMEN).toString();\n}\n\n// Maps a transaction submission rejection to an SDK error.\nfunction toSubmissionError(error: any): Error {\n return wrapHttpError(error, (details) => {\n const message = `Transaction submission failed. Server responded: ${details.status} ${details.statusText}`;\n return details.data?.extras?.result_codes\n ? new TransactionFailedError(message, details)\n : new BadResponseError(message, details);\n });\n}\n\n/**\n * Server handles the network connection to a [Horizon](https://developers.stellar.org/docs/data/horizon)\n * instance and exposes an interface for requests to that instance.\n *\n * @param serverURL - Horizon Server URL (ex. `https://horizon-testnet.stellar.org`).\n * @param opts - (optional) Options object\n */\nexport class HorizonServer {\n /**\n * Horizon Server URL (ex. `https://horizon-testnet.stellar.org`)\n *\n * TODO: Solve `this.serverURL`.\n */\n public readonly serverURL: URL;\n\n /**\n * HTTP client instance for making requests to Horizon.\n * Exposes interceptors, defaults, and other configuration options.\n *\n * @example\n * ```ts\n * // Add authentication header\n * server.httpClient.defaults.headers['Authorization'] = 'Bearer token';\n *\n * // Add request interceptor\n * server.httpClient.interceptors.request.use((config) => {\n * console.log('Request:', config.url);\n * return config;\n * });\n * ```\n */\n public readonly httpClient: HttpClient;\n constructor(serverURL: string, opts: HorizonServer.Options = {}) {\n this.serverURL = new URL(serverURL);\n\n const allowHttp =\n typeof opts.allowHttp === \"undefined\"\n ? Config.isAllowHttp()\n : opts.allowHttp;\n\n const customHeaders: Record<string, string> = {};\n\n if (opts.appName) {\n customHeaders[\"X-App-Name\"] = opts.appName;\n }\n if (opts.appVersion) {\n customHeaders[\"X-App-Version\"] = opts.appVersion;\n }\n if (opts.authToken) {\n customHeaders[\"X-Auth-Token\"] = opts.authToken;\n }\n if (opts.headers) {\n Object.assign(customHeaders, opts.headers);\n }\n\n this.httpClient = createHttpClient(customHeaders);\n\n if (this.serverURL.protocol !== \"https:\" && !allowHttp) {\n throw new Error(\"Cannot connect to insecure horizon server\");\n }\n }\n\n /**\n * Get timebounds for N seconds from now, when you're creating a transaction\n * with {@link TransactionBuilder}.\n *\n * By default, {@link TransactionBuilder} uses the current local time, but\n * your machine's local time could be different from Horizon's. This gives you\n * more assurance that your timebounds will reflect what you want.\n *\n * Note that this will generate your timebounds when you **init the transaction**,\n * not when you build or submit the transaction! So give yourself enough time to get\n * the transaction built and signed before submitting.\n *\n * @example\n * ```ts\n * const transaction = new StellarSdk.TransactionBuilder(accountId, {\n * fee: await StellarSdk.Server.fetchBaseFee(),\n * timebounds: await StellarSdk.Server.fetchTimebounds(100)\n * })\n * .addOperation(operation)\n * // normally we would need to call setTimeout here, but setting timebounds\n * // earlier does the trick!\n * .build();\n * ```\n *\n * @param seconds - Number of seconds past the current time to wait.\n * @param _isRetry - (optional) True if this is a retry. Only set this internally!\n * This is to avoid a scenario where Horizon is horking up the wrong date.\n * @returns Promise that resolves a `Timebounds` object\n * (with the shape `{ minTime: 0, maxTime: N }`) that you can set the `timebounds` option to.\n */\n public async fetchTimebounds(\n seconds: number,\n _isRetry: boolean = false,\n ): Promise<HorizonServer.Timebounds> {\n // httpClient instead of this.ledgers so we can get at them headers\n const serverPort = this.serverURL.port;\n const serverKey = serverPort\n ? `${this.serverURL.hostname}:${serverPort}`\n : this.serverURL.hostname;\n const currentTime = getCurrentServerTime(serverKey);\n\n if (currentTime) {\n return {\n minTime: 0,\n maxTime: currentTime + seconds,\n };\n }\n\n // if this is a retry, then the retry has failed, so use local time\n if (_isRetry) {\n return {\n minTime: 0,\n maxTime: Math.floor(new Date().getTime() / 1000) + seconds,\n };\n }\n\n // otherwise, retry (by calling the root endpoint)\n // toString automatically adds the trailing slash\n await this.httpClient.get(this.serverURL.toString());\n return this.fetchTimebounds(seconds, true);\n }\n\n /**\n * Fetch the base fee. Since this hits the server, if the server call fails,\n * you might get an error. You should be prepared to use a default value if\n * that happens!\n * @returns Promise that resolves to the base fee.\n */\n public async fetchBaseFee(): Promise<number> {\n const response = await this.feeStats();\n\n return parseInt(response.last_ledger_base_fee, 10) || 100;\n }\n\n /**\n * Fetch the fee stats endpoint.\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/aggregations/fee-stats | Fee Stats}\n * @returns Promise that resolves to the fee stats returned by Horizon.\n */\n public async feeStats(): Promise<HorizonApi.FeeStatsResponse> {\n const cb = new CallBuilder<HorizonApi.FeeStatsResponse>(\n this.serverURL,\n this.httpClient,\n );\n cb.filter.push([\"fee_stats\"]);\n return cb.call();\n }\n\n /**\n * Fetch the Horizon server's root endpoint.\n * @returns Promise that resolves to the root endpoint returned by Horizon.\n */\n public async root(): Promise<HorizonApi.RootResponse> {\n const cb = new CallBuilder<HorizonApi.RootResponse>(\n this.serverURL,\n this.httpClient,\n );\n return cb.call();\n }\n\n /**\n * Submits a transaction to the network.\n *\n * By default this function calls {@link Horizon.Server.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * If you submit any number of `manageOffer` operations, this will add an\n * attribute to the response that will help you analyze what happened with\n * your offers.\n *\n * For example, you'll want to examine `offerResults` to add affordances like\n * these to your app:\n * - If `wasImmediatelyFilled` is true, then no offer was created. So if you\n * normally watch the `Server.offers` endpoint for offer updates, you\n * instead need to check `Server.trades` to find the result of this filled\n * offer.\n * - If `wasImmediatelyDeleted` is true, then the offer you submitted was\n * deleted without reaching the orderbook or being matched (possibly because\n * your amounts were rounded down to zero). So treat the just-submitted\n * offer request as if it never happened.\n * - If `wasPartiallyFilled` is true, you can tell the user that\n * `amountBought` or `amountSold` have already been transferred.\n *\n * @example\n * ```ts\n * const res = {\n * ...response,\n * offerResults: [\n * {\n * // Exact ordered list of offers that executed, with the exception\n * // that the last one may not have executed entirely.\n * offersClaimed: [\n * sellerId: String,\n * offerId: String,\n * assetSold: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same shape as assetSold\n * assetBought: {}\n * ],\n *\n * // What effect your manageOffer op had\n * effect: \"manageOfferCreated|manageOfferUpdated|manageOfferDeleted\",\n *\n * // Whether your offer immediately got matched and filled\n * wasImmediatelyFilled: Boolean,\n *\n * // Whether your offer immediately got deleted, if for example the order was too small\n * wasImmediatelyDeleted: Boolean,\n *\n * // Whether the offer was partially, but not completely, filled\n * wasPartiallyFilled: Boolean,\n *\n * // The full requested amount of the offer is open for matching\n * isFullyOpen: Boolean,\n *\n * // The total amount of tokens bought / sold during transaction execution\n * amountBought: Number,\n * amountSold: Number,\n *\n * // if the offer was created, updated, or partially filled, this is\n * // the outstanding offer\n * currentOffer: {\n * offerId: String,\n * amount: String,\n * price: {\n * n: String,\n * d: String,\n * },\n *\n * selling: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same as `selling`\n * buying: {},\n * },\n *\n * // the index of this particular operation in the op stack\n * operationIndex: Number\n * }\n * ]\n * }\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-a-transaction | Submit a Transaction}\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves with the response from Horizon. Rejects\n * with a {@link TransactionFailedError} when Horizon reports transaction\n * result codes, a {@link BadResponseError} for any other HTTP error\n * response (the underlying client error is preserved as `cause` on both),\n * or the original error for network-level failures.\n */\n public async submitTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n timeout: SUBMIT_TRANSACTION_TIMEOUT,\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => {\n if (!response.data.result_xdr) {\n return response.data;\n }\n\n const responseXDR = xdr.TransactionResult.fromXDR(\n response.data.result_xdr,\n \"base64\",\n );\n\n // TODO: fix stellar-base types.\n const results = (responseXDR as any).result().value();\n\n let offerResults;\n let hasManageOffer;\n\n if (results.length) {\n offerResults = results\n // TODO: fix stellar-base types.\n .map((result: any, i: number) => {\n if (\n result.value().switch().name !== \"manageBuyOffer\" &&\n result.value().switch().name !== \"manageSellOffer\"\n ) {\n return null;\n }\n\n hasManageOffer = true;\n\n let amountBought = new CustomBigNumber(0);\n let amountSold = new CustomBigNumber(0);\n\n const offerSuccess = result.value().value().success();\n\n const offersClaimed = offerSuccess\n .offersClaimed()\n // TODO: fix stellar-base types.\n .map((offerClaimedAtom: any) => {\n const offerClaimed = offerClaimedAtom.value();\n\n let sellerId: string = \"\";\n switch (offerClaimedAtom.switch()) {\n case xdr.ClaimAtomType.claimAtomTypeV0():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerEd25519(),\n );\n break;\n case xdr.ClaimAtomType.claimAtomTypeOrderBook():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerId().ed25519(),\n );\n break;\n // It shouldn't be possible for a claimed offer to have type\n // claimAtomTypeLiquidityPool:\n //\n // https://github.com/stellar/stellar-core/blob/c5f6349b240818f716617ca6e0f08d295a6fad9a/src/transactions/TransactionUtils.cpp#L1284\n //\n // However, you can never be too careful.\n default:\n throw new Error(\n `Invalid offer result type: ${offerClaimedAtom.switch()}`,\n );\n }\n\n const claimedOfferAmountBought = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountBought().toString(),\n );\n const claimedOfferAmountSold = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountSold().toString(),\n );\n\n // This is an offer that was filled by the one just submitted.\n // So this offer has an _opposite_ bought/sold frame of ref\n // than from what we just submitted!\n // So add this claimed offer's bought to the SOLD count and vice v\n\n amountBought = amountBought.plus(claimedOfferAmountSold);\n amountSold = amountSold.plus(claimedOfferAmountBought);\n\n const sold = Asset.fromOperation(offerClaimed.assetSold());\n const bought = Asset.fromOperation(\n offerClaimed.assetBought(),\n );\n\n const assetSold = {\n type: sold.getAssetType(),\n assetCode: sold.getCode(),\n issuer: sold.getIssuer(),\n };\n\n const assetBought = {\n type: bought.getAssetType(),\n assetCode: bought.getCode(),\n issuer: bought.getIssuer(),\n };\n\n return {\n sellerId,\n offerId: offerClaimed.offerId().toString(),\n assetSold,\n amountSold: getAmountInLumens(claimedOfferAmountSold),\n assetBought,\n amountBought: getAmountInLumens(claimedOfferAmountBought),\n };\n });\n\n const effect = offerSuccess.offer().switch().name;\n\n let currentOffer;\n\n if (\n typeof offerSuccess.offer().value === \"function\" &&\n offerSuccess.offer().value()\n ) {\n const offerXDR = offerSuccess.offer().value();\n\n currentOffer = {\n offerId: offerXDR.offerId().toString(),\n selling: {},\n buying: {},\n amount: getAmountInLumens(offerXDR.amount().toString()),\n price: {\n n: offerXDR.price().n(),\n d: offerXDR.price().d(),\n },\n };\n\n const selling = Asset.fromOperation(offerXDR.selling());\n\n currentOffer.selling = {\n type: selling.getAssetType(),\n assetCode: selling.getCode(),\n issuer: selling.getIssuer(),\n };\n\n const buying = Asset.fromOperation(offerXDR.buying());\n\n currentOffer.buying = {\n type: buying.getAssetType(),\n assetCode: buying.getCode(),\n issuer: buying.getIssuer(),\n };\n }\n\n return {\n offersClaimed,\n effect,\n operationIndex: i,\n currentOffer,\n\n // this value is in stroops so divide it out\n amountBought: getAmountInLumens(amountBought),\n amountSold: getAmountInLumens(amountSold),\n\n isFullyOpen:\n !offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasPartiallyFilled:\n !!offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasImmediatelyFilled:\n !!offersClaimed.length && effect === \"manageOfferDeleted\",\n wasImmediatelyDeleted:\n !offersClaimed.length && effect === \"manageOfferDeleted\",\n };\n })\n // TODO: fix stellar-base types.\n .filter((result: any) => !!result);\n }\n\n return {\n ...response.data,\n offerResults: hasManageOffer ? offerResults : undefined,\n };\n })\n .catch((error) => Promise.reject(toSubmissionError(error)));\n }\n\n /**\n * Submits an asynchronous transaction to the network. Unlike the synchronous version, which blocks\n * and waits for the transaction to be ingested in Horizon, this endpoint relays the response from\n * core directly back to the user.\n *\n * By default, this function calls {@link HorizonServer.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * @see [Submit-Async-Transaction](https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-async-transaction)\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves with the response from Horizon. Rejects\n * with a {@link TransactionFailedError} when Horizon reports transaction\n * result codes, a {@link BadResponseError} for any other HTTP error\n * response (the underlying client error is preserved as `cause` on both),\n * or the original error for network-level failures.\n */\n public async submitAsyncTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitAsyncTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions_async\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => response.data)\n .catch((error) => Promise.reject(toSubmissionError(error)));\n }\n\n /**\n * @returns New {@link AccountCallBuilder} object configured by a current Horizon server configuration.\n */\n public accounts(): AccountCallBuilder {\n return new AccountCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link ClaimableBalanceCallBuilder} object configured by a current Horizon server configuration.\n */\n public claimableBalances(): ClaimableBalanceCallBuilder {\n return new ClaimableBalanceCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LedgerCallBuilder} object configured by a current Horizon server configuration.\n */\n public ledgers(): LedgerCallBuilder {\n return new LedgerCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link TransactionCallBuilder} object configured by a current Horizon server configuration.\n */\n public transactions(): TransactionCallBuilder {\n return new TransactionCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the offers on the DEX.\n *\n * You can query all offers for account using the function `.accountId`.\n *\n * @example\n * ```ts\n * server.offers()\n * .forAccount(accountId).call()\n * .then(function(offers) {\n * console.log(offers);\n * });\n * ```\n *\n * @returns New {@link OfferCallBuilder} object\n */\n public offers(): OfferCallBuilder {\n return new OfferCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param selling - Asset being sold\n * @param buying - Asset being bought\n * @returns New {@link OrderbookCallBuilder} object configured by a current Horizon server configuration.\n */\n public orderbook(selling: Asset, buying: Asset): OrderbookCallBuilder {\n return new OrderbookCallBuilder(\n this.serverURL,\n this.httpClient,\n\n selling,\n buying,\n );\n }\n\n /**\n * Returns\n * @returns New {@link TradesCallBuilder} object configured by a current Horizon server configuration.\n */\n public trades(): TradesCallBuilder {\n return new TradesCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link OperationCallBuilder} object configured by a current Horizon server configuration.\n */\n public operations(): OperationCallBuilder {\n return new OperationCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LiquidityPoolCallBuilder}\n * object configured to the current Horizon server settings.\n */\n public liquidityPools(): LiquidityPoolCallBuilder {\n return new LiquidityPoolCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path\n * payments. A strict receive path payment specifies a series of assets to\n * route a payment through, from source asset (the asset debited from the\n * payer) to destination asset (the asset credited to the payee).\n *\n * A strict receive path search is specified using:\n *\n * * The destination address.\n * * The source address or source assets.\n * * The asset and amount that the destination account should receive.\n *\n * As part of the search, horizon will load a list of assets available to the\n * source address and will find any payment paths from those source assets to\n * the desired destination asset. The search's amount parameter will be used\n * to determine if there a given path can satisfy a payment of the desired\n * amount.\n *\n * If a list of assets is passed as the source, horizon will find any payment\n * paths from those source assets to the desired destination asset.\n *\n * @param source - The sender's account ID or a list of assets. Any returned path will use a source that the sender can hold.\n * @param destinationAsset - The destination asset.\n * @param destinationAmount - The amount, denominated in the destination asset, that any returned path should be able to satisfy.\n * @returns New {@link StrictReceivePathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictReceivePaths(\n source: string | Asset[],\n destinationAsset: Asset,\n destinationAmount: string,\n ): PathCallBuilder {\n return new StrictReceivePathCallBuilder(\n this.serverURL,\n this.httpClient,\n source,\n destinationAsset,\n destinationAmount,\n );\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path payments. A strict send path payment specifies a\n * series of assets to route a payment through, from source asset (the asset debited from the payer) to destination\n * asset (the asset credited to the payee).\n *\n * A strict send path search is specified using:\n *\n * The asset and amount that is being sent.\n * The destination account or the destination assets.\n *\n * @param sourceAsset - The asset to be sent.\n * @param sourceAmount - The amount, denominated in the source asset, that any returned path should be able to satisfy.\n * @param destination - The destination account or the destination assets.\n * @returns New {@link StrictSendPathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictSendPaths(\n sourceAsset: Asset,\n sourceAmount: string,\n destination: string | Asset[],\n ): PathCallBuilder {\n return new StrictSendPathCallBuilder(\n this.serverURL,\n this.httpClient,\n sourceAsset,\n sourceAmount,\n destination,\n );\n }\n\n /**\n * @returns New {@link PaymentCallBuilder} instance configured with the current\n * Horizon server configuration.\n */\n public payments(): PaymentCallBuilder {\n return new PaymentCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link EffectCallBuilder} instance configured with the current\n * Horizon server configuration\n */\n public effects(): EffectCallBuilder {\n return new EffectCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param address - The Stellar ID that you want Friendbot to send lumens to\n * @returns New {@link FriendbotBuilder} instance configured with the current\n * Horizon server configuration\n */\n public friendbot(address: string): FriendbotBuilder {\n return new FriendbotBuilder(this.serverURL, this.httpClient, address);\n }\n\n /**\n * Get a new {@link AssetsCallBuilder} instance configured with the current\n * Horizon server configuration.\n * @returns New AssetsCallBuilder instance\n */\n public assets(): AssetsCallBuilder {\n return new AssetsCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * Fetches an account's most current state in the ledger, then creates and\n * returns an {@link AccountResponse} object.\n *\n * @param accountId - The account to load.\n *\n * @returns Returns a promise to the {@link AccountResponse} object\n * with populated sequence number.\n */\n public async loadAccount(accountId: string): Promise<AccountResponse> {\n const res = await this.accounts().accountId(accountId).call();\n\n return new AccountResponse(res);\n }\n\n /**\n *\n * @param base - base asset\n * @param counter - counter asset\n * @param start_time - lower time boundary represented as millis since epoch\n * @param end_time - upper time boundary represented as millis since epoch\n * @param resolution - segment duration as millis since epoch. *Supported values are 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).\n * @param offset - segments can be offset using this parameter. Expressed in milliseconds. *Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.\n * Returns new {@link TradeAggregationCallBuilder} object configured with the current Horizon server configuration.\n * @returns New TradeAggregationCallBuilder instance\n */\n public tradeAggregation(\n base: Asset,\n counter: Asset,\n start_time: number,\n end_time: number,\n resolution: number,\n offset: number,\n ): TradeAggregationCallBuilder {\n return new TradeAggregationCallBuilder(\n this.serverURL,\n this.httpClient,\n base,\n counter,\n start_time,\n end_time,\n resolution,\n offset,\n );\n }\n\n /**\n * Check if any of the destination accounts requires a memo.\n *\n * This function implements a memo required check as defined in\n * [SEP-29](https://stellar.org/protocol/sep-29). It will load each account\n * which is the destination and check if it has the data field\n * `config.memo_required` set to `\"MQ==\"`.\n *\n * Each account is checked sequentially instead of loading multiple accounts\n * at the same time from Horizon.\n *\n * @see {@link https://stellar.org/protocol/sep-29 | SEP-29: Account Memo Requirements}\n * @param transaction - The transaction to check.\n * @returns - If any of the destination account\n * requires a memo, the promise will throw {@link AccountRequiresMemoError}.\n * @throws */\n public async checkMemoRequired(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<void> {\n if (transaction instanceof FeeBumpTransaction) {\n transaction = transaction.innerTransaction;\n }\n\n if (transaction.memo.type !== \"none\") {\n return;\n }\n\n const destinations = new Set<string>();\n\n for (let i = 0; i < transaction.operations.length; i += 1) {\n const operation = transaction.operations[i];\n\n switch (operation.type) {\n case \"payment\":\n case \"pathPaymentStrictReceive\":\n case \"pathPaymentStrictSend\":\n case \"accountMerge\":\n break;\n default:\n continue;\n }\n const destination = operation.destination;\n if (destinations.has(destination)) {\n continue;\n }\n destinations.add(destination);\n\n // skip M account checks since it implies a memo\n if (destination.startsWith(\"M\")) {\n continue;\n }\n\n try {\n const account = await this.loadAccount(destination);\n if (\n account.data_attr[\"config.memo_required\"] === ACCOUNT_REQUIRES_MEMO\n ) {\n throw new AccountRequiresMemoError(\n \"account requires memo\",\n destination,\n i,\n );\n }\n } catch (e) {\n if (e instanceof AccountRequiresMemoError) {\n throw e;\n }\n\n // fail if the error is different to account not found\n if (!(e instanceof NotFoundError)) {\n throw e;\n }\n\n continue;\n }\n }\n }\n}\n\nexport namespace HorizonServer {\n /**\n * Options for configuring connections to Horizon servers.\n */\n export interface Options {\n /** Allow connecting to http servers, default: `false`. This must be set to false in production deployments! You can also use {@link Config} class to set this globally. */\n allowHttp?: boolean;\n /** Allow set custom header `X-App-Name`, default: `undefined`. */\n appName?: string;\n /** Allow set custom header `X-App-Version`, default: `undefined`. */\n appVersion?: string;\n /** Allow set custom header `X-Auth-Token`, default: `undefined`. */\n authToken?: string;\n headers?: Record<string, string>;\n }\n\n export interface Timebounds {\n minTime: number;\n maxTime: number;\n }\n\n export interface SubmitTransactionOptions {\n skipMemoRequiredCheck?: boolean;\n }\n}\n"],"names":["CustomBigNumber","xdr"],"mappings":";;;;;;;;;;;;;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GAAA,CAAI,WAAW,CAAA,EAAG;AACjC,QAAA;AAAA,MACF;AACA,MAAA,YAAA,CAAa,IAAI,WAAW,CAAA;AAG5B,MAAA,IAAI,WAAA,CAAY,UAAA,CAAW,GAAG,CAAA,EAAG;AAC/B,QAAA;AAAA,MACF;AAEA,MAAA,IAAI;AACF,QAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,WAAA,CAAY,WAAW,CAAA;AAClD,QAAA,IACE,OAAA,CAAQ,SAAA,CAAU,sBAAsB,CAAA,KAAM,qBAAA,EAC9C;AACA,UAAA,MAAM,IAAI,wBAAA;AAAA,YACR,uBAAA;AAAA,YACA,WAAA;AAAA,YACA;AAAA,WACF;AAAA,QACF;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,aAAa,wBAAA,EAA0B;AACzC,UAAA,MAAM,CAAA;AAAA,QACR;AAGA,QAAA,IAAI,EAAE,aAAa,aAAA,CAAA,EAAgB;AACjC,UAAA,MAAM,CAAA;AAAA,QACR;AAEA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;;"}
package/lib/esm/index.js CHANGED
@@ -2,6 +2,7 @@ export { NetworkError } from './errors/network.js';
2
2
  export { NotFoundError } from './errors/not_found.js';
3
3
  export { BadRequestError } from './errors/bad_request.js';
4
4
  export { BadResponseError } from './errors/bad_response.js';
5
+ export { TransactionFailedError } from './errors/transaction_failed.js';
5
6
  export { AccountRequiresMemoError } from './errors/account_requires_memo.js';
6
7
  export { Config } from './config.js';
7
8
  export { Utils } from './utils.js';
@@ -20,47 +21,44 @@ export { index$6 as rpc };
20
21
  import * as index$5 from './contract/index.js';
21
22
  export { index$5 as contract };
22
23
  export { BindingGenerator } from './bindings/generator.js';
23
- import './node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/int.js';
24
- export { Hyper } from './node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/hyper.js';
25
- import './node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-int.js';
26
- export { UnsignedHyper } from './node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-hyper.js';
27
- import './node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/xdr-type.js';
28
24
  import 'buffer';
29
- export { default as xdr } from './base/generated/curr_generated.js';
30
25
  export { default as cereal } from './base/jsxdr.js';
31
- export { hash } from './base/hashing.js';
32
- export { sign, verify } from './base/signing.js';
33
- export { LiquidityPoolFeeV18, getLiquidityPoolId } from './base/get_liquidity_pool_id.js';
34
- export { Keypair } from './base/keypair.js';
35
- export { TransactionBase } from './base/transaction_base.js';
36
- export { Transaction } from './base/transaction.js';
37
- export { FeeBumpTransaction } from './base/fee_bump_transaction.js';
38
- export { BASE_FEE, TimeoutInfinite, TransactionBuilder } from './base/transaction_builder.js';
26
+ export { default as xdr } from './base/generated/curr_generated.js';
27
+ export { Account } from './base/account.js';
28
+ export { Address } from './base/address.js';
39
29
  export { Asset, AssetType } from './base/asset.js';
30
+ export { AuthClawbackEnabledFlag, AuthImmutableFlag, AuthRequiredFlag, AuthRevocableFlag, Operation } from './base/operation.js';
31
+ export { BASE_FEE, TimeoutInfinite, TransactionBuilder } from './base/transaction_builder.js';
32
+ export { Claimant } from './base/claimant.js';
33
+ export { Contract } from './base/contract.js';
34
+ export { FeeBumpTransaction } from './base/fee_bump_transaction.js';
35
+ export { Hyper } from './node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/hyper.js';
36
+ export { Int128 } from './base/numbers/int128.js';
37
+ export { Int256 } from './base/numbers/int256.js';
38
+ export { Keypair } from './base/keypair.js';
40
39
  export { LiquidityPoolAsset } from './base/liquidity_pool_asset.js';
40
+ export { LiquidityPoolFeeV18, getLiquidityPoolId } from './base/get_liquidity_pool_id.js';
41
41
  export { LiquidityPoolId } from './base/liquidity_pool_id.js';
42
- export { AuthClawbackEnabledFlag, AuthImmutableFlag, AuthRequiredFlag, AuthRevocableFlag, Operation } from './base/operation.js';
43
42
  export { Memo, MemoHash, MemoID, MemoNone, MemoReturn, MemoText } from './base/memo.js';
44
- export { Account } from './base/account.js';
45
43
  export { MuxedAccount } from './base/muxed_account.js';
46
- export { Claimant } from './base/claimant.js';
47
44
  export { Networks } from './base/network.js';
48
- export { StrKey } from './base/strkey.js';
45
+ export { ScInt } from './base/numbers/sc_int.js';
49
46
  export { SignerKey } from './base/signerkey.js';
50
47
  export { Soroban } from './base/soroban.js';
51
- export { decodeAddressToMuxedAccount, encodeMuxedAccount, encodeMuxedAccountToAddress, extractBaseAddress } from './base/util/decode_encode_muxed_account.js';
52
- export { Contract } from './base/contract.js';
53
- export { Address } from './base/address.js';
54
- export { nativeToScVal, scValToNative, scvSortedMap } from './base/scval.js';
55
- export { humanizeEvents } from './base/events.js';
56
48
  export { SorobanDataBuilder } from './base/sorobandata_builder.js';
57
- export { authorizeEntry, authorizeInvocation, buildAuthorizationEntryPreimage, buildWithDelegatesEntry } from './base/auth.js';
58
- export { buildInvocationTree, walkInvocationTree } from './base/invocation.js';
59
- export { scValToBigInt } from './base/numbers/index.js';
60
- export { Int128 } from './base/numbers/int128.js';
61
- export { Int256 } from './base/numbers/int256.js';
62
- export { ScInt } from './base/numbers/sc_int.js';
49
+ export { StrKey } from './base/strkey.js';
50
+ export { Transaction } from './base/transaction.js';
51
+ export { TransactionBase } from './base/transaction_base.js';
63
52
  export { Uint128 } from './base/numbers/uint128.js';
64
53
  export { Uint256 } from './base/numbers/uint256.js';
54
+ export { UnsignedHyper } from './node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-hyper.js';
65
55
  export { XdrLargeInt } from './base/numbers/xdr_large_int.js';
56
+ export { authorizeEntry, authorizeInvocation, buildAuthorizationEntryPreimage, buildWithDelegatesEntry, checkAuthEntryReadiness, inspectAuthEntry } from './base/auth.js';
57
+ export { buildInvocationTree, walkInvocationTree } from './base/invocation.js';
58
+ export { decodeAddressToMuxedAccount, encodeMuxedAccount, encodeMuxedAccountToAddress, extractBaseAddress } from './base/util/decode_encode_muxed_account.js';
59
+ export { hash } from './base/hashing.js';
60
+ export { humanizeEvents } from './base/events.js';
61
+ export { nativeToScVal, scValToNative, scvSortedMap } from './base/scval.js';
62
+ export { scValToBigInt } from './base/numbers/index.js';
63
+ export { sign, verify } from './base/signing.js';
66
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -576,5 +576,26 @@ export declare namespace Api {
576
576
  /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */
577
577
  metadataXdr: string;
578
578
  }
579
+ /** A single input parameter of a {@link ContractMethod}. */
580
+ export interface ContractMethodInput {
581
+ /** the declared parameter name */
582
+ name: string;
583
+ /** a human-readable type name, e.g. `U32`, `Address`, or a UDT's name */
584
+ type: string;
585
+ }
586
+ /**
587
+ * A callable method declared in a contract's spec, as returned by
588
+ * `RpcServer.getContractMethods`.
589
+ */
590
+ export interface ContractMethod {
591
+ /** the on-chain method name */
592
+ name: string;
593
+ /** the method's parameters, in declaration order */
594
+ inputs: ContractMethodInput[];
595
+ /** human-readable return type name(s); empty when the method returns void */
596
+ outputs: string[];
597
+ /** the method's spec doc string, when the contract declares one */
598
+ doc?: string;
599
+ }
579
600
  export {};
580
601
  }