@layerzerolabs/protocol-stellar-v2 0.2.8

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 (265) hide show
  1. package/.turbo/turbo-build.log +727 -0
  2. package/.turbo/turbo-lint.log +158 -0
  3. package/.turbo/turbo-test.log +796 -0
  4. package/Cargo.lock +2237 -0
  5. package/Cargo.toml +63 -0
  6. package/clippy.toml +7 -0
  7. package/contracts/common-macros/Cargo.toml +20 -0
  8. package/contracts/common-macros/src/error.rs +53 -0
  9. package/contracts/common-macros/src/event.rs +16 -0
  10. package/contracts/common-macros/src/lib.rs +255 -0
  11. package/contracts/common-macros/src/ownable.rs +63 -0
  12. package/contracts/common-macros/src/snapshots/common_macros__tests__tests__snapshot_generated_storage_code.snap +310 -0
  13. package/contracts/common-macros/src/storage.rs +439 -0
  14. package/contracts/common-macros/src/tests.rs +287 -0
  15. package/contracts/common-macros/src/ttl_configurable.rs +60 -0
  16. package/contracts/endpoint-v2/ARCHITECTURE.md +233 -0
  17. package/contracts/endpoint-v2/Cargo.toml +30 -0
  18. package/contracts/endpoint-v2/src/constants.rs +52 -0
  19. package/contracts/endpoint-v2/src/endpoint_v2.rs +305 -0
  20. package/contracts/endpoint-v2/src/errors.rs +29 -0
  21. package/contracts/endpoint-v2/src/events.rs +207 -0
  22. package/contracts/endpoint-v2/src/interfaces/layerzero_composer.rs +26 -0
  23. package/contracts/endpoint-v2/src/interfaces/layerzero_endpoint_v2.rs +170 -0
  24. package/contracts/endpoint-v2/src/interfaces/layerzero_receiver.rs +43 -0
  25. package/contracts/endpoint-v2/src/interfaces/message_lib.rs +62 -0
  26. package/contracts/endpoint-v2/src/interfaces/message_lib_manager.rs +220 -0
  27. package/contracts/endpoint-v2/src/interfaces/messaging_channel.rs +121 -0
  28. package/contracts/endpoint-v2/src/interfaces/messaging_composer.rs +63 -0
  29. package/contracts/endpoint-v2/src/interfaces/mod.rs +17 -0
  30. package/contracts/endpoint-v2/src/interfaces/send_lib.rs +70 -0
  31. package/contracts/endpoint-v2/src/lib.rs +22 -0
  32. package/contracts/endpoint-v2/src/message_lib_manager.rs +315 -0
  33. package/contracts/endpoint-v2/src/messaging_channel.rs +218 -0
  34. package/contracts/endpoint-v2/src/messaging_composer.rs +76 -0
  35. package/contracts/endpoint-v2/src/storage.rs +78 -0
  36. package/contracts/endpoint-v2/src/tests/endpoint_setup.rs +131 -0
  37. package/contracts/endpoint-v2/src/tests/endpoint_v2/clear.rs +237 -0
  38. package/contracts/endpoint-v2/src/tests/endpoint_v2/delegate.rs +42 -0
  39. package/contracts/endpoint-v2/src/tests/endpoint_v2/initializable.rs +76 -0
  40. package/contracts/endpoint-v2/src/tests/endpoint_v2/lz_receive_alert.rs +211 -0
  41. package/contracts/endpoint-v2/src/tests/endpoint_v2/mod.rs +18 -0
  42. package/contracts/endpoint-v2/src/tests/endpoint_v2/native_token.rs +10 -0
  43. package/contracts/endpoint-v2/src/tests/endpoint_v2/owner.rs +10 -0
  44. package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +424 -0
  45. package/contracts/endpoint-v2/src/tests/endpoint_v2/quote.rs +144 -0
  46. package/contracts/endpoint-v2/src/tests/endpoint_v2/recover_token.rs +72 -0
  47. package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +29 -0
  48. package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +513 -0
  49. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_delegate.rs +43 -0
  50. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +27 -0
  51. package/contracts/endpoint-v2/src/tests/endpoint_v2/transfer_ownership.rs +30 -0
  52. package/contracts/endpoint-v2/src/tests/endpoint_v2/ttl_config.rs +202 -0
  53. package/contracts/endpoint-v2/src/tests/endpoint_v2/verifiable.rs +59 -0
  54. package/contracts/endpoint-v2/src/tests/endpoint_v2/verify.rs +172 -0
  55. package/contracts/endpoint-v2/src/tests/endpoint_v2/zro.rs +23 -0
  56. package/contracts/endpoint-v2/src/tests/message_lib_manager/mod.rs +10 -0
  57. package/contracts/endpoint-v2/src/tests/message_lib_manager/register_library.rs +131 -0
  58. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +35 -0
  59. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +28 -0
  60. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_config.rs +79 -0
  61. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +246 -0
  62. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_library.rs +285 -0
  63. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_send_library.rs +180 -0
  64. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library.rs +405 -0
  65. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library_timeout.rs +80 -0
  66. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_send_library.rs +131 -0
  67. package/contracts/endpoint-v2/src/tests/messaging_channel/burn.rs +358 -0
  68. package/contracts/endpoint-v2/src/tests/messaging_channel/clear.rs +316 -0
  69. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_nonce.rs +288 -0
  70. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_payload_hash.rs +316 -0
  71. package/contracts/endpoint-v2/src/tests/messaging_channel/internal.rs +388 -0
  72. package/contracts/endpoint-v2/src/tests/messaging_channel/lazy_inbound_nonce.rs +307 -0
  73. package/contracts/endpoint-v2/src/tests/messaging_channel/mod.rs +10 -0
  74. package/contracts/endpoint-v2/src/tests/messaging_channel/next_guid.rs +239 -0
  75. package/contracts/endpoint-v2/src/tests/messaging_channel/nilify.rs +324 -0
  76. package/contracts/endpoint-v2/src/tests/messaging_channel/outbound_nonce.rs +242 -0
  77. package/contracts/endpoint-v2/src/tests/messaging_channel/skip.rs +232 -0
  78. package/contracts/endpoint-v2/src/tests/messaging_composer/clear_compose.rs +212 -0
  79. package/contracts/endpoint-v2/src/tests/messaging_composer/compose_queue.rs +213 -0
  80. package/contracts/endpoint-v2/src/tests/messaging_composer/lz_compose_alert.rs +269 -0
  81. package/contracts/endpoint-v2/src/tests/messaging_composer/mod.rs +4 -0
  82. package/contracts/endpoint-v2/src/tests/messaging_composer/send_compose.rs +173 -0
  83. package/contracts/endpoint-v2/src/tests/mock.rs +132 -0
  84. package/contracts/endpoint-v2/src/tests/mod.rs +12 -0
  85. package/contracts/endpoint-v2/src/tests/util/build_payload.rs +126 -0
  86. package/contracts/endpoint-v2/src/tests/util/compute_guid.rs +82 -0
  87. package/contracts/endpoint-v2/src/tests/util/keccak256.rs +115 -0
  88. package/contracts/endpoint-v2/src/tests/util/mod.rs +3 -0
  89. package/contracts/endpoint-v2/src/util.rs +52 -0
  90. package/contracts/message-libs/Cargo.toml +12 -0
  91. package/contracts/message-libs/block-message-lib/Cargo.toml +19 -0
  92. package/contracts/message-libs/block-message-lib/src/lib.rs +70 -0
  93. package/contracts/message-libs/lib.rs +2 -0
  94. package/contracts/message-libs/message-lib-common/Cargo.toml +24 -0
  95. package/contracts/message-libs/message-lib-common/src/errors.rs +20 -0
  96. package/contracts/message-libs/message-lib-common/src/interfaces/dvn.rs +55 -0
  97. package/contracts/message-libs/message-lib-common/src/interfaces/executor.rs +46 -0
  98. package/contracts/message-libs/message-lib-common/src/interfaces/mod.rs +7 -0
  99. package/contracts/message-libs/message-lib-common/src/interfaces/treasury.rs +17 -0
  100. package/contracts/message-libs/message-lib-common/src/lib.rs +14 -0
  101. package/contracts/message-libs/message-lib-common/src/packet_codec_v1.rs +99 -0
  102. package/contracts/message-libs/message-lib-common/src/testing_utils.rs +27 -0
  103. package/contracts/message-libs/message-lib-common/src/tests/mod.rs +2 -0
  104. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1.rs +162 -0
  105. package/contracts/message-libs/message-lib-common/src/tests/worker_options.rs +319 -0
  106. package/contracts/message-libs/message-lib-common/src/worker_options.rs +190 -0
  107. package/contracts/message-libs/simple-message-lib/Cargo.toml +26 -0
  108. package/contracts/message-libs/simple-message-lib/src/errors.rs +11 -0
  109. package/contracts/message-libs/simple-message-lib/src/lib.rs +14 -0
  110. package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +136 -0
  111. package/contracts/message-libs/simple-message-lib/src/storage.rs +27 -0
  112. package/contracts/message-libs/simple-message-lib/src/test.rs +280 -0
  113. package/contracts/message-libs/treasury/Cargo.toml +27 -0
  114. package/contracts/message-libs/treasury/src/errors.rs +10 -0
  115. package/contracts/message-libs/treasury/src/events.rs +28 -0
  116. package/contracts/message-libs/treasury/src/interfaces/mod.rs +3 -0
  117. package/contracts/message-libs/treasury/src/interfaces/zro_fee_lib.rs +20 -0
  118. package/contracts/message-libs/treasury/src/lib.rs +20 -0
  119. package/contracts/message-libs/treasury/src/storage.rs +18 -0
  120. package/contracts/message-libs/treasury/src/tests/mod.rs +2 -0
  121. package/contracts/message-libs/treasury/src/tests/setup.rs +112 -0
  122. package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +562 -0
  123. package/contracts/message-libs/treasury/src/treasury.rs +140 -0
  124. package/contracts/message-libs/uln-302/Cargo.toml +28 -0
  125. package/contracts/message-libs/uln-302/src/config_validation.rs +173 -0
  126. package/contracts/message-libs/uln-302/src/errors.rs +29 -0
  127. package/contracts/message-libs/uln-302/src/events.rs +72 -0
  128. package/contracts/message-libs/uln-302/src/interfaces/mod.rs +5 -0
  129. package/contracts/message-libs/uln-302/src/interfaces/receive.rs +82 -0
  130. package/contracts/message-libs/uln-302/src/interfaces/send.rs +159 -0
  131. package/contracts/message-libs/uln-302/src/lib.rs +20 -0
  132. package/contracts/message-libs/uln-302/src/receive.rs +199 -0
  133. package/contracts/message-libs/uln-302/src/send.rs +349 -0
  134. package/contracts/message-libs/uln-302/src/storage.rs +47 -0
  135. package/contracts/message-libs/uln-302/src/tests/config/mod.rs +2 -0
  136. package/contracts/message-libs/uln-302/src/tests/config/oapp_uln_config.rs +291 -0
  137. package/contracts/message-libs/uln-302/src/tests/config/uln_config.rs +163 -0
  138. package/contracts/message-libs/uln-302/src/tests/mod.rs +7 -0
  139. package/contracts/message-libs/uln-302/src/tests/receive_uln302/commit_verification.rs +183 -0
  140. package/contracts/message-libs/uln-302/src/tests/receive_uln302/confirmations.rs +128 -0
  141. package/contracts/message-libs/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +104 -0
  142. package/contracts/message-libs/uln-302/src/tests/receive_uln302/mod.rs +66 -0
  143. package/contracts/message-libs/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +79 -0
  144. package/contracts/message-libs/uln-302/src/tests/receive_uln302/verifiable.rs +463 -0
  145. package/contracts/message-libs/uln-302/src/tests/receive_uln302/verify.rs +173 -0
  146. package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_executor_config.rs +132 -0
  147. package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +117 -0
  148. package/contracts/message-libs/uln-302/src/tests/send_uln302/mod.rs +6 -0
  149. package/contracts/message-libs/uln-302/src/tests/send_uln302/quote.rs +586 -0
  150. package/contracts/message-libs/uln-302/src/tests/send_uln302/send.rs +834 -0
  151. package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_executor_configs.rs +95 -0
  152. package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_send_uln_configs.rs +80 -0
  153. package/contracts/message-libs/uln-302/src/tests/setup.rs +268 -0
  154. package/contracts/message-libs/uln-302/src/tests/testing_utils.rs +47 -0
  155. package/contracts/message-libs/uln-302/src/tests/uln302/get_app_receive_uln_config.rs +51 -0
  156. package/contracts/message-libs/uln-302/src/tests/uln302/get_app_send_uln_config.rs +51 -0
  157. package/contracts/message-libs/uln-302/src/tests/uln302/get_oapp_executor_config.rs +48 -0
  158. package/contracts/message-libs/uln-302/src/tests/uln302/mod.rs +4 -0
  159. package/contracts/message-libs/uln-302/src/tests/uln302/set_config.rs +998 -0
  160. package/contracts/message-libs/uln-302/src/uln302.rs +117 -0
  161. package/contracts/oapp-macros/Cargo.toml +21 -0
  162. package/contracts/oapp-macros/src/lib.rs +408 -0
  163. package/contracts/oapp-macros/src/oapp_core.rs +49 -0
  164. package/contracts/oapp-macros/src/oapp_full.rs +15 -0
  165. package/contracts/oapp-macros/src/oapp_options_type3.rs +46 -0
  166. package/contracts/oapp-macros/src/oapp_receiver.rs +67 -0
  167. package/contracts/oapp-macros/src/oapp_sender.rs +23 -0
  168. package/contracts/oapp-macros/src/util.rs +103 -0
  169. package/contracts/oapp-macros/tests/test_macros.rs +522 -0
  170. package/contracts/oapps/Cargo.toml +12 -0
  171. package/contracts/oapps/counter/Cargo.toml +24 -0
  172. package/contracts/oapps/counter/integration_tests/mod.rs +3 -0
  173. package/contracts/oapps/counter/integration_tests/setup.rs +201 -0
  174. package/contracts/oapps/counter/integration_tests/test_with_sml.rs +166 -0
  175. package/contracts/oapps/counter/integration_tests/utils.rs +144 -0
  176. package/contracts/oapps/counter/src/codec.rs +63 -0
  177. package/contracts/oapps/counter/src/counter.rs +235 -0
  178. package/contracts/oapps/counter/src/errors.rs +9 -0
  179. package/contracts/oapps/counter/src/lib.rs +16 -0
  180. package/contracts/oapps/counter/src/options.rs +30 -0
  181. package/contracts/oapps/counter/src/storage.rs +33 -0
  182. package/contracts/oapps/counter/src/tests/mod.rs +37 -0
  183. package/contracts/oapps/counter/src/tests/test_codec.rs +64 -0
  184. package/contracts/oapps/counter/src/tests/test_counter.rs +390 -0
  185. package/contracts/oapps/counter/src/u256_ext.rs +21 -0
  186. package/contracts/oapps/lib.rs +2 -0
  187. package/contracts/oapps/oapp/Cargo.toml +21 -0
  188. package/contracts/oapps/oapp/src/errors.rs +9 -0
  189. package/contracts/oapps/oapp/src/lib.rs +10 -0
  190. package/contracts/oapps/oapp/src/oapp_core.rs +92 -0
  191. package/contracts/oapps/oapp/src/oapp_options_type3.rs +89 -0
  192. package/contracts/oapps/oapp/src/oapp_receiver.rs +72 -0
  193. package/contracts/oapps/oapp/src/oapp_sender.rs +66 -0
  194. package/contracts/oapps/oapp/src/tests/mod.rs +4 -0
  195. package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +162 -0
  196. package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +180 -0
  197. package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +157 -0
  198. package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +283 -0
  199. package/contracts/utils/Cargo.toml +21 -0
  200. package/contracts/utils/src/buffer_reader.rs +143 -0
  201. package/contracts/utils/src/buffer_writer.rs +117 -0
  202. package/contracts/utils/src/bytes_ext.rs +19 -0
  203. package/contracts/utils/src/errors.rs +30 -0
  204. package/contracts/utils/src/lib.rs +15 -0
  205. package/contracts/utils/src/option_ext.rs +38 -0
  206. package/contracts/utils/src/ownable.rs +88 -0
  207. package/contracts/utils/src/testing_utils.rs +100 -0
  208. package/contracts/utils/src/tests/buffer_reader.rs +1006 -0
  209. package/contracts/utils/src/tests/buffer_writer.rs +330 -0
  210. package/contracts/utils/src/tests/bytes_ext.rs +77 -0
  211. package/contracts/utils/src/tests/mod.rs +4 -0
  212. package/contracts/utils/src/tests/ownable.rs +149 -0
  213. package/contracts/utils/src/ttl.rs +164 -0
  214. package/contracts/workers/Cargo.toml +13 -0
  215. package/contracts/workers/executor/Cargo.toml +26 -0
  216. package/contracts/workers/executor/src/events.rs +22 -0
  217. package/contracts/workers/executor/src/executor.rs +347 -0
  218. package/contracts/workers/executor/src/interfaces/executor.rs +40 -0
  219. package/contracts/workers/executor/src/interfaces/mod.rs +5 -0
  220. package/contracts/workers/executor/src/interfaces/types.rs +51 -0
  221. package/contracts/workers/executor/src/lib.rs +10 -0
  222. package/contracts/workers/executor/src/storage.rs +23 -0
  223. package/contracts/workers/lib.rs +2 -0
  224. package/contracts/workers/worker-common/Cargo.toml +18 -0
  225. package/contracts/workers/worker-common/src/constants.rs +17 -0
  226. package/contracts/workers/worker-common/src/errors.rs +6 -0
  227. package/contracts/workers/worker-common/src/events.rs +34 -0
  228. package/contracts/workers/worker-common/src/interfaces/executor_fee_lib.rs +35 -0
  229. package/contracts/workers/worker-common/src/interfaces/mod.rs +7 -0
  230. package/contracts/workers/worker-common/src/interfaces/price_feed.rs +40 -0
  231. package/contracts/workers/worker-common/src/interfaces/worker.rs +60 -0
  232. package/contracts/workers/worker-common/src/lib.rs +19 -0
  233. package/contracts/workers/worker-common/src/storage.rs +32 -0
  234. package/contracts/workers/worker-common/src/worker_common.rs +166 -0
  235. package/package.json +25 -0
  236. package/rust-toolchain.toml +4 -0
  237. package/rustfmt.toml +17 -0
  238. package/sdk/.turbo/turbo-build.log +4 -0
  239. package/sdk/dist/generated/bml.d.ts +452 -0
  240. package/sdk/dist/generated/bml.js +72 -0
  241. package/sdk/dist/generated/counter.d.ts +824 -0
  242. package/sdk/dist/generated/counter.js +125 -0
  243. package/sdk/dist/generated/endpoint.d.ts +1676 -0
  244. package/sdk/dist/generated/endpoint.js +216 -0
  245. package/sdk/dist/generated/sml.d.ts +810 -0
  246. package/sdk/dist/generated/sml.js +132 -0
  247. package/sdk/dist/generated/uln302.d.ts +1227 -0
  248. package/sdk/dist/generated/uln302.js +185 -0
  249. package/sdk/dist/index.d.ts +5 -0
  250. package/sdk/dist/index.js +5 -0
  251. package/sdk/node_modules/.bin/tsc +21 -0
  252. package/sdk/node_modules/.bin/tsserver +21 -0
  253. package/sdk/node_modules/.bin/vitest +21 -0
  254. package/sdk/node_modules/.bin/zx +21 -0
  255. package/sdk/package.json +40 -0
  256. package/sdk/src/index.ts +5 -0
  257. package/sdk/test/index.test.ts +271 -0
  258. package/sdk/test/suites/constants.ts +13 -0
  259. package/sdk/test/suites/deploy.ts +277 -0
  260. package/sdk/test/suites/localnet.ts +42 -0
  261. package/sdk/test/suites/scan.ts +189 -0
  262. package/sdk/tsconfig.json +106 -0
  263. package/tools/ts-bindings-gen/Cargo.toml +14 -0
  264. package/tools/ts-bindings-gen/src/main.rs +147 -0
  265. package/turbo.json +12 -0
@@ -0,0 +1,13 @@
1
+ import { Asset, Keypair, Networks} from '@stellar/stellar-sdk';
2
+
3
+ const CORE_URL = 'http://localhost:8000';
4
+ export const FRIENDBOT_URL = `${CORE_URL}/friendbot`;
5
+ export const RPC_URL = `${CORE_URL}/rpc`;
6
+ export const NETWORK_PASSPHRASE = Networks.STANDALONE;
7
+ export const DEFAULT_DEPLOYER = Keypair.fromSecret('SDLCA3JUES3G6R4FTI6XXDIWW7QCNMZNWPYQQIKQ26TEIZUFOLIVIUDK');
8
+ export const ZRO_DISTRIBUTOR = Keypair.fromSecret('SB6QAFXFRR2MXYHW4RRZ23JDGKHDCYCT5YTQEGG3WNT5VKZADJQFVNWG');
9
+ export const EID = 30111;
10
+ export const NATIVE_TOKEN_ADDRESS = Asset.native().contractId(NETWORK_PASSPHRASE);
11
+ export const ZRO_ASSET = new Asset('ZRO', DEFAULT_DEPLOYER.publicKey());
12
+ export const ZRO_TOKEN_ADDRESS = ZRO_ASSET.contractId(NETWORK_PASSPHRASE);
13
+ export const MSG_TYPE_VANILLA = 1;
@@ -0,0 +1,277 @@
1
+ import {
2
+ Asset,
3
+ BASE_FEE,
4
+ hash,
5
+ Keypair,
6
+ Operation,
7
+ rpc,
8
+ TransactionBuilder,
9
+ xdr
10
+ } from '@stellar/stellar-sdk';
11
+ import { readFileSync } from 'fs';
12
+
13
+ import { DEFAULT_DEPLOYER, NETWORK_PASSPHRASE, RPC_URL, ZRO_ASSET, ZRO_DISTRIBUTOR } from './constants';
14
+
15
+ /**
16
+ * Query and display the TTL (Time To Live) of uploaded WASM code
17
+ *
18
+ * @param wasmHash - The hex-encoded SHA-256 hash of the WASM code
19
+ * @param server - The Stellar RPC server instance
20
+ * @param rpcUrl - Optional RPC URL (defaults to RPC_URL constant)
21
+ */
22
+ async function queryWasmTtl(
23
+ wasmHash: string,
24
+ server: rpc.Server,
25
+ rpcUrl?: string
26
+ ): Promise<void> {
27
+ try {
28
+ const latestLedger = await server.getLatestLedger();
29
+ const currentLedger = latestLedger.sequence;
30
+
31
+ // Create the LedgerKey for contract code using XDR encoding
32
+ const wasmHashBuffer = Buffer.from(wasmHash, 'hex');
33
+ // Ensure hash is exactly 32 bytes
34
+ const hashBytes = wasmHashBuffer.length === 32 ? wasmHashBuffer : wasmHashBuffer.slice(0, 32);
35
+ // Create LedgerKeyContractCode with hash
36
+ const ledgerKeyContractCode = new xdr.LedgerKeyContractCode({
37
+ hash: hashBytes
38
+ });
39
+ const ledgerKey = xdr.LedgerKey.contractCode(ledgerKeyContractCode);
40
+ const ledgerKeyXdr = ledgerKey.toXDR('base64');
41
+
42
+ // Query contract code entry using direct RPC call
43
+ const rpcEndpoint = rpcUrl || (server as any).serverURL || RPC_URL;
44
+ const response = await fetch(rpcEndpoint, {
45
+ method: 'POST',
46
+ headers: { 'Content-Type': 'application/json' },
47
+ body: JSON.stringify({
48
+ jsonrpc: '2.0',
49
+ id: 1,
50
+ method: 'getLedgerEntries',
51
+ params: {
52
+ keys: [ledgerKeyXdr]
53
+ }
54
+ })
55
+ });
56
+
57
+ const result = await response.json();
58
+ if (result.error) {
59
+ console.warn(`⚠️ Could not retrieve WASM TTL: ${result.error.message}`);
60
+ } else if (result.result?.entries?.[0]?.liveUntilLedgerSeq) {
61
+ const liveUntilLedgerSeq = result.result.entries[0].liveUntilLedgerSeq;
62
+ const ttlLedgers = liveUntilLedgerSeq - currentLedger;
63
+ const ttlDays = (ttlLedgers * 5) / (24 * 3600); // ~5 seconds per ledger
64
+ console.log(`⏰ WASM TTL: live until ledger ${liveUntilLedgerSeq} (${ttlLedgers} ledgers remaining, ~${ttlDays.toFixed(2)} days)`);
65
+ }
66
+ } catch (error) {
67
+ // If querying TTL fails, it might be because the code isn't indexed yet
68
+ // This is non-fatal, so we just log a warning
69
+ console.warn(`⚠️ Could not retrieve WASM TTL: ${error instanceof Error ? error.message : String(error)}`);
70
+ }
71
+ }
72
+
73
+ export async function uploadWasm(
74
+ wasmBuffer: Buffer,
75
+ keypair: Keypair,
76
+ server: rpc.Server,
77
+ ): Promise<string> {
78
+ console.log(`📦 WASM buffer size: ${wasmBuffer.length} bytes (${(wasmBuffer.length / 1024).toFixed(2)} KB)`);
79
+
80
+ const account = await server.getAccount(keypair.publicKey());
81
+
82
+ const uploadTx = new TransactionBuilder(account, {
83
+ fee: BASE_FEE,
84
+ networkPassphrase: NETWORK_PASSPHRASE,
85
+ })
86
+ .addOperation(Operation.uploadContractWasm({ wasm: wasmBuffer }))
87
+ .setTimeout(30)
88
+ .build();
89
+
90
+ const simulated = await server.simulateTransaction(uploadTx);
91
+ const preparedTx = rpc.assembleTransaction(uploadTx, simulated).build();
92
+
93
+ console.log(`💰 Upload transaction fee: ${preparedTx.fee} stroops (${(Number(preparedTx.fee) / 10000000).toFixed(7)} XLM)`);
94
+
95
+ preparedTx.sign(keypair);
96
+
97
+ const sendResult = await server.sendTransaction(preparedTx);
98
+
99
+ if (sendResult.status !== 'PENDING') {
100
+ throw new Error(`Transaction failed: ${JSON.stringify(sendResult)}`);
101
+ }
102
+
103
+ // Wait for transaction to be confirmed
104
+ const txResult = await server.pollTransaction(sendResult.hash);
105
+
106
+ if (txResult.status !== 'SUCCESS') {
107
+ throw new Error(`Transaction not successful: ${JSON.stringify(txResult)}`);
108
+ }
109
+
110
+ // Compute the WASM hash (SHA-256 of the WASM bytes)
111
+ const wasmHash = hash(wasmBuffer).toString('hex');
112
+
113
+ // Query and display the WASM code TTL
114
+ await queryWasmTtl(wasmHash, server);
115
+
116
+ return wasmHash;
117
+ }
118
+
119
+ /**
120
+ * Generic contract deployment helper that works with any contract Client
121
+ *
122
+ * @param ClientClass - The contract Client class (e.g., EndpointClient, SMLClient)
123
+ * @param wasmFilePath - Path to the compiled WASM file
124
+ * @param constructorArgs - Arguments for the contract's constructor
125
+ * @param deployer - The keypair that will deploy the contract
126
+ * @param options - Optional deployment options (salt, fee, timeout, etc.)
127
+ * @returns The deployed contract's Client instance with the contractId
128
+ */
129
+ export async function deployContract<T extends { options: { contractId: string } }>(
130
+ ClientClass: {
131
+ deploy: (
132
+ args: any,
133
+ options: any,
134
+ ) => Promise<{ signAndSend: () => Promise<{ result: T }> }>;
135
+ },
136
+ wasmFilePath: string,
137
+ constructorArgs: any,
138
+ deployer: Keypair,
139
+ options: {
140
+ salt?: Buffer;
141
+ rpcUrl?: string;
142
+ networkPassphrase?: string;
143
+ allowHttp?: boolean;
144
+ } = {},
145
+ ): Promise<T> {
146
+ const {
147
+ rpcUrl = RPC_URL,
148
+ networkPassphrase = NETWORK_PASSPHRASE,
149
+ allowHttp = true,
150
+ salt,
151
+ } = options;
152
+
153
+ const server = new rpc.Server(rpcUrl, {
154
+ allowHttp: allowHttp,
155
+ });
156
+
157
+ // Step 1: Read WASM file
158
+ console.log('📖 Reading WASM file from:', wasmFilePath);
159
+ const wasmBuffer = readFileSync(wasmFilePath);
160
+
161
+ // Step 2: Upload WASM and get hash
162
+ console.log('📤 Uploading WASM...');
163
+ const wasmHash = await uploadWasm(wasmBuffer, deployer, server);
164
+ console.log('✅ WASM uploaded, hash:', wasmHash);
165
+
166
+ // Step 3: Deploy the contract
167
+ console.log('🚀 Deploying contract...');
168
+ const deployTx = await ClientClass.deploy(constructorArgs, {
169
+ wasmHash: wasmHash,
170
+ publicKey: deployer.publicKey(),
171
+ signTransaction: async (tx: string) => {
172
+ const transaction = TransactionBuilder.fromXDR(tx, networkPassphrase);
173
+ transaction.sign(deployer);
174
+ return {
175
+ signedTxXdr: transaction.toXDR(),
176
+ signerAddress: deployer.publicKey(),
177
+ };
178
+ },
179
+ rpcUrl: rpcUrl,
180
+ networkPassphrase: networkPassphrase,
181
+ allowHttp: allowHttp,
182
+ salt: salt,
183
+ });
184
+
185
+ // Step 4: Sign and send
186
+ const sentTx = await deployTx.signAndSend();
187
+
188
+ // Step 5: Extract contract ID from result
189
+ const contractClient = sentTx.result;
190
+ const contractId = contractClient.options.contractId;
191
+ console.log('✅ Contract deployed at:', contractId);
192
+
193
+ return contractClient;
194
+ }
195
+
196
+ export async function deployNativeSac(): Promise<void> {
197
+ await deployAssetSac(Asset.native());
198
+ console.log('✅ Native SAC deployed');
199
+ }
200
+
201
+ export async function deployZroToken(): Promise<void> {
202
+ const server = new rpc.Server(RPC_URL, {
203
+ allowHttp: true,
204
+ });
205
+
206
+ // First, issue the ZRO token.
207
+ // We can't changeTrust of Issuer account, because the Issuer can't hold the asset.
208
+ const account = await server.getAccount(DEFAULT_DEPLOYER.publicKey());
209
+ const transaction = new TransactionBuilder(account, {
210
+ fee: BASE_FEE,
211
+ networkPassphrase: NETWORK_PASSPHRASE,
212
+ })
213
+ .addOperation(Operation.changeTrust({ asset: ZRO_ASSET, source: ZRO_DISTRIBUTOR.publicKey() }))
214
+ .addOperation(Operation.payment({ asset: ZRO_ASSET, amount: '10000', destination: ZRO_DISTRIBUTOR.publicKey() }))
215
+ .setTimeout(10)
216
+ .build();
217
+ transaction.sign(DEFAULT_DEPLOYER, ZRO_DISTRIBUTOR);
218
+
219
+ const sendResult = await server.sendTransaction(transaction);
220
+ if (sendResult.status !== 'PENDING') {
221
+ throw new Error(`Failed to issue ZRO token: ${JSON.stringify(sendResult)}`);
222
+ }
223
+ const txResult = await server.pollTransaction(sendResult.hash);
224
+ if (txResult.status !== 'SUCCESS') {
225
+ throw new Error(`Failed to issue ZRO token: ${JSON.stringify(txResult)}`);
226
+ }
227
+ console.log('✅ ZRO asset issued');
228
+
229
+ // Deploy the Stellar Asset Contract (SAC)
230
+ await deployAssetSac(ZRO_ASSET);
231
+ console.log('✅ ZRO SAC deployed');
232
+ }
233
+
234
+ /**
235
+ * Deploy SAC for a custom asset using TypeScript
236
+ */
237
+ export async function deployAssetSac(asset: Asset): Promise<string> {
238
+ console.log('Deploying SAC for asset:', asset.toString());
239
+
240
+ const server = new rpc.Server(RPC_URL, { allowHttp: true });
241
+ const account = await server.getAccount(DEFAULT_DEPLOYER.publicKey());
242
+
243
+ // Build transaction with createStellarAssetContract operation
244
+ const deployTx = new TransactionBuilder(account, {
245
+ fee: BASE_FEE,
246
+ networkPassphrase: NETWORK_PASSPHRASE,
247
+ })
248
+ .addOperation(
249
+ Operation.createStellarAssetContract({
250
+ asset: asset,
251
+ })
252
+ )
253
+ .setTimeout(30)
254
+ .build();
255
+
256
+ // Simulate transaction first (required for contract operations)
257
+ const simulated = await server.simulateTransaction(deployTx);
258
+
259
+ // Check if simulation was successful
260
+ if (rpc.Api.isSimulationError(simulated)) {
261
+ throw new Error(`Transaction simulation failed: ${JSON.stringify(simulated)}`);
262
+ }
263
+
264
+ const preparedTx = rpc.assembleTransaction(deployTx, simulated).build();
265
+
266
+ // Sign and send
267
+ preparedTx.sign(DEFAULT_DEPLOYER);
268
+ const sendResult = await server.sendTransaction(preparedTx);
269
+ if (sendResult.status !== 'PENDING') {
270
+ throw new Error(`Failed to deploy SAC: ${JSON.stringify(sendResult)}`);
271
+ }
272
+ const txResult = await server.pollTransaction(sendResult.hash);
273
+ if (txResult.status !== 'SUCCESS') {
274
+ throw new Error(`SAC deployment not successful: ${JSON.stringify(txResult)}`);
275
+ }
276
+ return asset.contractId(NETWORK_PASSPHRASE);
277
+ }
@@ -0,0 +1,42 @@
1
+ import axios from 'axios';
2
+ import { $,sleep } from 'zx';
3
+
4
+ import { DEFAULT_DEPLOYER, FRIENDBOT_URL, ZRO_DISTRIBUTOR } from './constants';
5
+ import { deployNativeSac, deployZroToken } from './deploy';
6
+
7
+ export async function startStellarLocalnet(): Promise<void> {
8
+ console.log('🚀 Starting Stellar localnet...');
9
+
10
+ //TODO: pnpm localnet up --only stellar
11
+ await $`stellar container start local`;
12
+
13
+ // Wait for Stellar to start
14
+ for (let i = 0; i < 60; i++) {
15
+ try {
16
+ // Ensure faucet service is started and fund the default deployer account
17
+ await fundAccount(DEFAULT_DEPLOYER.publicKey());
18
+ await fundAccount(ZRO_DISTRIBUTOR.publicKey());
19
+ console.log(`✅ Account ${DEFAULT_DEPLOYER.publicKey()} funded`);
20
+ console.log('✅ Stellar localnet started');
21
+ break;
22
+ } catch (_e) {
23
+ await sleep(1000);
24
+ console.log('⏳ Waiting for Stellar localnet to start...');
25
+ }
26
+ }
27
+ await deployNativeSac();
28
+ await deployZroToken();
29
+ }
30
+
31
+ export async function fundAccount(publicKey: string): Promise<void> {
32
+ await axios.get(FRIENDBOT_URL, {
33
+ params: {
34
+ addr: publicKey,
35
+ },
36
+ });
37
+ }
38
+
39
+ export async function stopStellarLocalnet(): Promise<void> {
40
+ await $`stellar container stop`;
41
+ console.log('✅ Stellar localnet stopped');
42
+ }
@@ -0,0 +1,189 @@
1
+ import { rpc, xdr } from '@stellar/stellar-sdk';
2
+
3
+ import { RPC_URL } from './constants';
4
+
5
+ /**
6
+ * Event filter for scanning contract events
7
+ */
8
+ export interface EventFilter {
9
+ contractId: string;
10
+ }
11
+
12
+ /**
13
+ * Parsed contract event
14
+ */
15
+ export interface ParsedContractEvent {
16
+ type: string;
17
+ contractId: string;
18
+ topics: any[];
19
+ data: any;
20
+ ledger: number;
21
+ txHash: string;
22
+ }
23
+
24
+ /**
25
+ * PacketSent event structure from endpoint_v2.rs
26
+ */
27
+ export interface PacketSentEvent {
28
+ encoded_packet: Buffer;
29
+ options: Buffer;
30
+ send_library: string;
31
+ }
32
+
33
+ /**
34
+ * Scan for contract events within a ledger range
35
+ */
36
+ export async function scanEvents(
37
+ startLedger: number,
38
+ filter: EventFilter,
39
+ ): Promise<ParsedContractEvent[]> {
40
+ const server = new rpc.Server(RPC_URL, { allowHttp: true });
41
+
42
+ console.log('🔍 Scanning events from ledger', startLedger);
43
+
44
+ try {
45
+ const events = await server.getEvents({
46
+ startLedger: startLedger,
47
+ filters: [{type: 'contract', contractIds: [filter.contractId]}],
48
+ });
49
+
50
+ const parsedEvents: ParsedContractEvent[] = [];
51
+
52
+ for (const event of events.events || []) {
53
+ try {
54
+ const parsedEvent: ParsedContractEvent = {
55
+ type: event.type,
56
+ contractId: event.contractId?.contractId() || '',
57
+ topics: event.topic.map((t) => {
58
+ try {
59
+ return xdr.ScVal.fromXDR(Buffer.from(t, 'base64'));
60
+ } catch {
61
+ return t;
62
+ }
63
+ }),
64
+ data: event.value ? xdr.ScVal.fromXDR(event.value.toXDR()) : undefined,
65
+ ledger: event.ledger,
66
+ txHash: event.txHash,
67
+ };
68
+ parsedEvents.push(parsedEvent);
69
+ } catch (e) {
70
+ console.warn('Failed to parse event:', e);
71
+ }
72
+ }
73
+
74
+ console.log(`✅ Found ${parsedEvents.length} events`);
75
+ return parsedEvents;
76
+ } catch (error: any) {
77
+ console.error('Error scanning events:', error.message);
78
+ throw error;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Scan for PacketSent events from the Endpoint contract
84
+ */
85
+ export async function scanPacketSentEvents(
86
+ endpointAddress: string,
87
+ startLedger: number,
88
+ ): Promise<PacketSentEvent[]> {
89
+ console.log('📦 Scanning for PacketSent events...');
90
+ const events = await scanEvents(startLedger, {
91
+ contractId: endpointAddress,
92
+ });
93
+
94
+ // Filter for PacketSent events
95
+ // PacketSent event has topics like ["PacketSent"] or similar
96
+ const packetSentEvents: PacketSentEvent[] = [];
97
+
98
+ for (const event of events) {
99
+ try {
100
+ // Check if this is a PacketSent event
101
+ // The first topic should be the event name
102
+ const firstTopic = event.topics[0];
103
+
104
+ // Convert ScVal to string to check event name
105
+ let eventName = '';
106
+ if (firstTopic && firstTopic._switch?.name === 'scvSymbol') {
107
+ eventName = firstTopic.value()?.toString() || '';
108
+ }
109
+
110
+ if (eventName === 'PacketSent') {
111
+ // Parse the event data
112
+ // PacketSent { encoded_packet, options, send_library }
113
+ const eventData = event.data;
114
+
115
+ // Try to extract fields from the struct
116
+ if (eventData && eventData._switch?.name === 'scvMap') {
117
+ const map = eventData.value();
118
+ const packetEvent: Partial<PacketSentEvent> = {};
119
+
120
+ for (const entry of map || []) {
121
+ const key = entry.key().value()?.toString();
122
+ const value = entry.val();
123
+
124
+ if (key === 'encoded_packet' && value._switch?.name === 'scvBytes') {
125
+ packetEvent.encoded_packet = Buffer.from(value.value());
126
+ } else if (key === 'options' && value._switch?.name === 'scvBytes') {
127
+ packetEvent.options = Buffer.from(value.value());
128
+ } else if (key === 'send_library' && value._switch?.name === 'scvAddress') {
129
+ packetEvent.send_library = value.value()?.toString() || '';
130
+ }
131
+ }
132
+
133
+ if (packetEvent.encoded_packet && packetEvent.options !== undefined && packetEvent.send_library) {
134
+ packetSentEvents.push(packetEvent as PacketSentEvent);
135
+ }
136
+ }
137
+ }
138
+ } catch (e) {
139
+ console.warn('Failed to parse PacketSent event:', e);
140
+ }
141
+ }
142
+
143
+ console.log(`✅ Found ${packetSentEvents.length} PacketSent events`);
144
+ return packetSentEvents;
145
+ }
146
+
147
+ /**
148
+ * Wait for new ledgers and scan for events
149
+ */
150
+ export async function waitAndScanEvents(
151
+ startLedger: number,
152
+ contractAddress: string,
153
+ eventName: string,
154
+ maxWaitSeconds: number = 30,
155
+ ): Promise<ParsedContractEvent[]> {
156
+ const server = new rpc.Server(RPC_URL, { allowHttp: true });
157
+ const endTime = Date.now() + maxWaitSeconds * 1000;
158
+
159
+ console.log(`⏳ Waiting for ${eventName} events...`);
160
+
161
+ while (Date.now() < endTime) {
162
+ const currentLedger = await server.getLatestLedger();
163
+
164
+ if (currentLedger.sequence > startLedger) {
165
+ const events = await scanEvents(startLedger, {
166
+ contractId: contractAddress,
167
+ });
168
+
169
+ const matchingEvents = events.filter((e) => {
170
+ const firstTopic = e.topics[0];
171
+ if (firstTopic && firstTopic._switch?.name === 'scvSymbol') {
172
+ const name = firstTopic.value()?.toString() || '';
173
+ return name === eventName;
174
+ }
175
+ return false;
176
+ });
177
+
178
+ if (matchingEvents.length > 0) {
179
+ return matchingEvents;
180
+ }
181
+ }
182
+
183
+ // Wait 1 second before checking again
184
+ await new Promise((resolve) => setTimeout(resolve, 1000));
185
+ }
186
+
187
+ throw new Error(`Timeout waiting for ${eventName} events`);
188
+ }
189
+
@@ -0,0 +1,106 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+ /* Projects */
5
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
6
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
7
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
8
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
9
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
10
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
11
+ /* Language and Environment */
12
+ "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
13
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
14
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
15
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
16
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
17
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
18
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
19
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
20
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
21
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
22
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
23
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
24
+ /* Modules */
25
+ "module": "NodeNext", /* Specify what module code is generated. */
26
+ // "rootDir": "./", /* Specify the root folder within your source files. */
27
+ "moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
28
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
29
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
30
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
31
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
32
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
33
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
34
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
35
+ // "resolveJsonModule": true, /* Enable importing .json files. */
36
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
37
+ /* JavaScript Support */
38
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
39
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
40
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
41
+ /* Emit */
42
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
43
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
44
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
45
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
46
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
47
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
48
+ // "removeComments": true, /* Disable emitting comments. */
49
+ // "noEmit": true, /* Disable emitting files from a compilation. */
50
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
51
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
52
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
53
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
54
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
55
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
56
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
57
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
58
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
59
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
60
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
61
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
62
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
63
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
64
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
65
+ /* Interop Constraints */
66
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
67
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
68
+ // "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
69
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
70
+ // "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
71
+ /* Type Checking */
72
+ // "strict": true, /* Enable all strict type-checking options. */
73
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
74
+ "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
75
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
76
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
77
+ "strictPropertyInitialization": false, /* Check for class properties that are declared but not set in the constructor. */
78
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
79
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
80
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
81
+ "noUnusedLocals": false, /* Enable error reporting when local variables aren't read. */
82
+ "noUnusedParameters": false, /* Raise an error when a function parameter isn't read. */
83
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
84
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
85
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
86
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
87
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
88
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
89
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
90
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
91
+ /* Completeness */
92
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
93
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
94
+ },
95
+ "exclude": [
96
+ "node_modules",
97
+ "**/__mocks__/*",
98
+ "**/__tests__/*",
99
+ "**/*.spec.ts",
100
+ "**/*.test.ts",
101
+ "dist"
102
+ ],
103
+ "include": [
104
+ "src/*"
105
+ ]
106
+ }
@@ -0,0 +1,14 @@
1
+ [package]
2
+ name = "ts-bindings-gen"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+
7
+ [[bin]]
8
+ name = "ts-bindings-gen"
9
+ path = "src/main.rs"
10
+
11
+ [dependencies]
12
+ anyhow = "1.0"
13
+ soroban-spec-typescript = "23.0.3"
14
+