@tonappchain/sdk 0.7.2-alpha-11 → 0.7.2-alpha-14

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 (41) hide show
  1. package/dist/artifacts/dev/ton/internal/build/CrossChainLayer.compiled.json +1 -1
  2. package/dist/src/adapters/BaseContractOpener.d.ts +76 -0
  3. package/dist/src/adapters/BaseContractOpener.js +445 -0
  4. package/dist/src/adapters/LiteClientOpener.d.ts +38 -0
  5. package/dist/src/adapters/LiteClientOpener.js +141 -0
  6. package/dist/src/adapters/OpenerUtils.d.ts +3 -0
  7. package/dist/src/adapters/OpenerUtils.js +39 -0
  8. package/dist/src/adapters/RetryableContractOpener.d.ts +40 -0
  9. package/dist/src/adapters/RetryableContractOpener.js +287 -0
  10. package/dist/src/adapters/SandboxOpener.d.ts +15 -0
  11. package/dist/src/adapters/SandboxOpener.js +35 -0
  12. package/dist/src/adapters/TonClient4Opener.d.ts +23 -0
  13. package/dist/src/adapters/TonClient4Opener.js +87 -0
  14. package/dist/src/adapters/TonClientOpener.d.ts +17 -0
  15. package/dist/src/adapters/TonClientOpener.js +72 -0
  16. package/dist/src/adapters/index.d.ts +7 -2
  17. package/dist/src/adapters/index.js +7 -2
  18. package/dist/src/index.d.ts +1 -1
  19. package/dist/src/index.js +3 -2
  20. package/dist/src/interfaces/ContractOpener.d.ts +71 -2
  21. package/dist/src/interfaces/ITacSDK.d.ts +11 -1
  22. package/dist/src/sdk/Configuration.js +2 -1
  23. package/dist/src/sdk/Consts.d.ts +10 -3
  24. package/dist/src/sdk/Consts.js +13 -5
  25. package/dist/src/sdk/StartTracking.d.ts +4 -1
  26. package/dist/src/sdk/StartTracking.js +11 -6
  27. package/dist/src/sdk/TONTransactionManager.d.ts +1 -3
  28. package/dist/src/sdk/TONTransactionManager.js +3 -4
  29. package/dist/src/sdk/TacSdk.d.ts +3 -1
  30. package/dist/src/sdk/TacSdk.js +5 -3
  31. package/dist/src/sdk/TxFinalizer.d.ts +1 -8
  32. package/dist/src/sdk/TxFinalizer.js +14 -125
  33. package/dist/src/sdk/Utils.d.ts +10 -0
  34. package/dist/src/sdk/Utils.js +53 -0
  35. package/dist/src/structs/InternalStruct.d.ts +2 -17
  36. package/dist/src/structs/Struct.d.ts +117 -5
  37. package/package.json +1 -1
  38. package/dist/src/adapters/contractOpener.d.ts +0 -24
  39. package/dist/src/adapters/contractOpener.js +0 -310
  40. package/dist/src/adapters/retryableContractOpener.d.ts +0 -29
  41. package/dist/src/adapters/retryableContractOpener.js +0 -138
@@ -1 +1 @@
1
- { "hash": "b7a220facd930fbfbf4b50baa2d2663dd81177c9e2de3f75973e40ddcac945a4", "hashBase64": "t6Ig+s2TD7+/S1C6otJmPdgRd8ni3j91lz5A3crJRaQ=", "hex": "b5ee9c7241024a010017d4000114ff00f4a413f4bcf2c80b010201200245020148032c02f4d0eda2edfb20c700925f04e001d0d30301ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87071b0e302fa400406010a135f03db3c0501748020d721d31f0101d33f01123020821058d9b21bba9a30fa0030f85001a1f8708e1782100659627fba99fa0030f85001a0f8709430f2c096e2e24904f0fa4031fa0031f401fa0031fa00013170f83a02d31f0101d33f01125365a1f846f80701830cf94130f8075003a101a6668200c02b5003a0128209e1338070f8370170f836a066b6085210a1a6645177a123821048e660b5bae3022382106c582059bae300238210497dae1dbae3023035218210cda6f261ba07080e1900da6c818120ed70f8365cbcf2e064f84e59a1a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fe04d31ffa00f404fa4055302170547000246ec0008e156c3101d0d300fa00fa0023963403fa0030039130e29134e255027f266ec000f84df84c5007a816a05240b915b0927034de5320a022a027a02f813c9170f836a0a052d0be5240b0e30210365f06298014fb02c88210ae7df95b2602cb1fcb3f12cb1f22cf16c9702802090d02fe333839393a3b5254a05006a05008a021a08014fb02f84e5003a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54266ec00092366de30d020a0b001a06c8f400f84dfa02f84cfa02c9019cc8cb1f2601cb3f5003cf1658fa02f40058cf16c982106c582059017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b3915be30ddb310c0078c88210d53276db580302cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0000748010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f80fc000938100cc928064e2f2f00402fe333602fa40d4d4fa403001d0d3ff0101f404f401fa40fa0030f828f8515250027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0500ac705f2e04704d7393078d721d3ff0131f8468307f40e6fa131f2e0c927c3009438333530e30d5424600f1102fe26044813505923d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d2183073d10002af48e6fa56c1291a4923070e201d0028307f416040304fc54557428705470007f097009a1f84ea15007a18fd551898307f47c6fa5208fc402d430d0fa40d20001209301fa00927058e2d430d0d20001209301fa00927058e2d4f404069232348e95342291348e8d3103d307d3073001c001f2e0cee202e201e30f029132e201b319e65b36365b20c2009831f85001a1f8707f9130e21213161702ee7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de2414202b8f8502ca153e9a129a15330bc22c200b08ec85b5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce214a04313e30d2b1401d428a121a05230bbf2e0665220b608c882103c497a612d02cb1fcb3f2b01cbff21fa0223fa025005cf1613cc12f400c920f80701830cf94130f8075003a1801c813a8a8209e1338070f83781348f58a070f836a00270f838a703a081337270f836a0f84f54200380188010150062226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0051a2a0507aa05066a113a0018e5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce215a044142b01e85253a1c200f2e064c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54c8500601cbff0101ca00c98210497dae1d01701800fa830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb005042a158a1f84e5210bef2e0658010fb0221d70b01c000b38e3bc88210d53276db5802cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00915be204fe8ee031333403d3ff01f828f8515220027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d05005c705f2e047028014fb0201fa4030c82301cbffc98210cda6f261017fe021821074cd76b2bae302352082101f95f86cbae302208210063199b71a1b1c1d01e4830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b38e40c8821086f27385580302cb1fcb3f5801cbffc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00925f03e24900de5b3233f84313c705f2e04801d3ff0131f8648014fb02c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54019c10455f05f84ec300f2e0c8c88210f358b6d05802cb1fcb3ff84efa02c9f841f84e58801072226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0070f86e4902feba8e69306c2232f841c705f2e046fa0030f86cc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082103531465cbae3022082105cec6be0ba1e1f00d2306c2232f841c705f2e046fa0030f86dc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fc8e69306c2232f841c705f2e046fa4030f863c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e0208210581879bcbae30220821060094a1bba202100e4306c2232f841c705f2e046fa4030f862f8428b02c705f2d050c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403fe8e6810255f05f841c705f2e0468b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082106a4fbe34bae3022082106e7145f9bae30222232400d810255f05f842c705f2e049f842f8618b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed540026306c2232f841c705f2e046d401fb04d430ed5404e62082107ee5a6d0ba8ec0306c2232f841c705f2e046d430f8716df86682107ee5a6d0c8c970830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00e0208210e97250b7bae302208210d53276dbba925f06e020821074db6fbdbae302208210149c7a93ba4925262700d4306c2232f841c705f2e046d32f0131f86bc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5400d2306c2232f841c705f2e046fa4030f86fc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403f08eda30f84112c705f2e046fa00305033a15220bbf2e0cfc8821058d9b21b5802cb1fcb3f21fa02c9f84f522280188010226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a0f870e0208210461d3038bae3023403821046a47169bae3025f04840ff2f049282901ba303233f84113c705f2e04601fa0030f8505210bbf2e0d0c882100659627f580302cb1fcb3f21fa02c9f84f705880188050226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a1f8704901d8f84fc705f2e04a01f40430206eb38ed8d0d3ff0101fa40fa00d4f40430f84e17a15005a121be8e3e316c22c85801cbff01fa02c9821049e265430170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00f80ff2c065e30d925f03e22a01e64034206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce2c80101cbffc9821046a471690170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb002b00a28e4dc85801cb055005cf165003fa0254712323ed41ed43ed44ed45ed479f5bc85003cf17c913775003cb6bcccced67ed65ed64ed63ed61747fed11987601cb6bcc01cf17ed41edf101f2ffc901fb00db060201202d340201202e2f00d3bb769ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f870f84ff8508020120303201fbb444bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f083f085f087f08bf08df08ff091f093f097f095f09bf0990310014f84ef851f844f84ff85001cbb4817da89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e103300707020f8468307f4866fa5908e1801d32f01315303bc946c2251109130e2f8468307f47c6fa5e810235f03f847f848f849f84af84bf845f8440201203539020120363801d5b6d0bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225037006e027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c9207001f90074c8cb0212ca07cbffc9d001004fb7b17f00e030619f28261f00ea00742034ccd04018056a00740250413c26700e1f06e02e1f06d4100201203a4301fbb40f5f00e4b0619f28261f00ea00743f00fda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e011a1a7fe0261e8086103b02e87f5343a60381037a58a0820812750070f8375348a0a603536aa081037aa070f838525aa0526ba01a70f83818a07181012070f838a0533470f838aa00a082010abd5003a070f83612a017a0810c1c70f836a024c3008e8d70f828541343f83c1024435012926c41e28ae66c21f80758a170f836a03c3f02fe23d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d238307f48e6fa56c123d3e0054306c22707121c8c9c87f01ca005006fa0215cc14cb0013cb0712cb07c9c858cf167001ca00ccc9c8ccc9001e91a4923070e201d040148307f41602019a51128307f47c6fa5208ebc02d430d0fa4031d20001209301fa00927058e2d430d0d2000192fa00927001e2d431f404310394303113a08e8d3101d307d3073001c001f2e0cee2029132e201b3124002fc7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de201a170b60913a04142005a5b8018811c488209e1338070f8377581058e82100966018070f837a08140b570f836a08024814bfa70f838a4a0005a5b801c8127e08209e1338070f8378208278d00738103b55870f837a081535370f836a08042815cb270f838a4a001d5b662dda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225044006a027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0013af220c7009130e0d31f840f0282104b19e42abd12f2f28308d71820f9014601faed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87001d3ff01f8445e21f910f2a0f84901d32f0131f869f823f849be4701fcf2e0cdf849f84abef2e0cbf800f848f867f823f868f848f84ba0f86af823f845f84ba8a1f8468307f4866fa5908e1c01d32f013122bb9bf84652108307f45b30f866def8468307f47c6fa5e85f03c8f84a01cb2fc9d0f84652308307f416f866c85801cbff0101cb2ff84901cb2ff84701cb2ff84801cb2ff84a01cb2fc948015a82104b19e42a017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb004900b2c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed547ddb5d57" }
1
+ { "hash": "85de6d2e111cbc56b64af4ac6e0c705806e37d984440d197ff4b6fb39439b672", "hashBase64": "hd5tLhEcvFa2SvSsbgxwWAbjfZhEQNGX/0tvs5Q5tnI=", "hex": "b5ee9c7241024a010017d4000114ff00f4a413f4bcf2c80b010201200245020148032c02f4d0eda2edfb20c700925f04e001d0d30301ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87071b0e302fa400406010a135f03db3c0501748020d721d31f0101d33f01123020821058d9b21bba9a30fa0030f85001a1f8708e1782100659627fba99fa0030f85001a0f8709430f2c096e2e24904f0fa4031fa0031f401fa0031fa00013170f83a02d31f0101d33f01125365a1f846f80701830cf94130f8075003a101a6668200c02b5003a0128209e1338070f8370170f836a066b6085210a1a6645177a123821048e660b5bae3022382106c582059bae300238210497dae1dbae3023035218210cda6f261ba07080e1900da6c818120ed70f8365cbcf2e064f84e59a1a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fe04d31ffa00f404fa4055302170547000246ec0008e156c3101d0d300fa00fa0023963403fa0030039130e29134e255027f266ec000f84df84c5007a816a05240b915b0927034de5320a022a027a02f813c9170f836a0a052d0be5240b0e30210365f06298014fb02c88210ae7df95b2602cb1fcb3f12cb1f22cf16c9702802090d02fe333839393a3b5254a05006a05008a021a08014fb02f84e5003a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54266ec00092366de30d020a0b001a06c8f400f84dfa02f84cfa02c9019cc8cb1f2601cb3f5003cf1658fa02f40058cf16c982106c582059017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b3915be30ddb310c0078c88210d53276db580302cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0000748010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f80fc000938100cc928064e2f2f00402fe333602fa40d4d4fa403001d0d3ff0101f404f401fa40fa0030f828f8515250027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0500ac705f2e04704d7393078d721d3ff0131f8468307f40e6fa131f2e0c927c3009438333530e30d5424600f1102fe26044813505923d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d2183073d10002af48e6fa56c1291a4923070e201d0028307f416040304fc54557428705470007f097009a1f84ea15007a18fd551898307f47c6fa5208fc402d430d0fa40d20001209301fa00927058e2d430d0d20001209301fa00927058e2d4f404069232348e95342291348e8d3103d307d3073001c001f2e0cee202e201e30f029132e201b319e65b36365b20c2009831f85001a1f8707f9130e21213161702ee7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de2414202b8f8502ca153e9a129a15330bc22c200b08ec85b5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce214a04313e30d2b1401d428a121a05230bbf2e0665220b608c882103c497a612d02cb1fcb3f2b01cbff21fa0223fa025005cf1613cc12f400c920f80701830cf94130f8075003a1801c813a8a8209e1338070f83781348f58a070f836a00270f838a703a081337270f836a0f84f54200380188011150062226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0051a2a0506aa05055a113a0018e5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce215a044142b01e85253a1c200f2e064c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54c8500601cbff0101ca00c98210497dae1d01701800fa830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb005042a158a1f84e5210bef2e0658010fb0221d70b01c000b38e3bc88210d53276db5802cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00915be204fe8ee031333403d3ff01f828f8515220027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d05005c705f2e047028014fb0201fa4030c82301cbffc98210cda6f261017fe021821074cd76b2bae302352082101f95f86cbae302208210063199b71a1b1c1d01e4830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b38e40c8821086f27385580302cb1fcb3f5801cbffc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00925f03e24900de5b3233f84313c705f2e04801d3ff0131f8648014fb02c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54019c10455f05f84ec300f2e0c8c88210f358b6d05802cb1fcb3ff84efa02c9f841f84e58801072226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0070f86e4902feba8e69306c2232f841c705f2e046fa0030f86cc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082103531465cbae3022082105cec6be0ba1e1f00d2306c2232f841c705f2e046fa0030f86dc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fc8e69306c2232f841c705f2e046fa4030f863c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e0208210581879bcbae30220821060094a1bba202100e4306c2232f841c705f2e046fa4030f862f8428b02c705f2d050c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403fe8e6810255f05f841c705f2e0468b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082106a4fbe34bae3022082106e7145f9bae30222232400d810255f05f842c705f2e049f842f8618b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed540026306c2232f841c705f2e046d401fb04d430ed5404e62082107ee5a6d0ba8ec0306c2232f841c705f2e046d430f8716df86682107ee5a6d0c8c970830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00e0208210e97250b7bae302208210d53276dbba925f06e020821074db6fbdbae302208210149c7a93ba4925262700d4306c2232f841c705f2e046d32f0131f86bc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5400d2306c2232f841c705f2e046fa4030f86fc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403f08eda30f84112c705f2e046fa00305033a15220bbf2e0cfc8821058d9b21b5802cb1fcb3f21fa02c9f84f522280188010226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a0f870e0208210461d3038bae3023403821046a47169bae3025f04840ff2f049282901ba303233f84113c705f2e04601fa0030f8505210bbf2e0d0c882100659627f580302cb1fcb3f21fa02c9f84f705880188050226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a1f8704901d8f84fc705f2e04a01f40430206eb38ed8d0d3ff0101fa40fa00d4f40430f84e17a15005a121be8e3e316c22c85801cbff01fa02c9821049e265430170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00f80ff2c065e30d925f03e22a01e64034206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce2c80101cbffc9821046a471690170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb002b00a28e4dc85801cb055005cf165003fa0254712323ed41ed43ed44ed45ed479f5bc85003cf17c913775003cb6bcccced67ed65ed64ed63ed61747fed11987601cb6bcc01cf17ed41edf101f2ffc901fb00db060201202d340201202e2f00d3bb769ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f870f84ff8508020120303201fbb444bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f083f085f087f08bf08df08ff091f093f097f095f09bf0990310014f84ef851f844f84ff85001cbb4817da89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e103300707020f8468307f4866fa5908e1801d32f01315303bc946c2251109130e2f8468307f47c6fa5e810235f03f847f848f849f84af84bf845f8440201203539020120363801d5b6d0bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225037006e027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c9207001f90074c8cb0212ca07cbffc9d001004fb7b17f00e030619f28261f00ea00742034ccd04018056a00740250413c26700e1f06e02e1f06d4100201203a4301fbb40f5f00e4b0619f28261f00ea00743f00fda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e011a1a7fe0261e8086103b02e87f5343a60381037a58a0820812750070f8375348a0a603536aa081037aa070f838525aa0526ba01a70f83818a07181012070f838a0533470f838aa00a082010abd5003a070f83612a017a0810c1c70f836a024c3008e8d70f828541343f83c1024435012926c41e28ae66c21f80758a170f836a03c3f02fe23d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d238307f48e6fa56c123d3e0054306c22707121c8c9c87f01ca005006fa0215cc14cb0013cb0712cb07c9c858cf167001ca00ccc9c8ccc9001e91a4923070e201d040148307f41602019a51128307f47c6fa5208ebc02d430d0fa4031d20001209301fa00927058e2d430d0d2000192fa00927001e2d431f404310394303113a08e8d3101d307d3073001c001f2e0cee2029132e201b3124002fc7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de201a170b60913a04142005a5b8018811c488209e1338070f8377581058e82100966018070f837a08140b570f836a08024814bfa70f838a4a0005a5b801c8127e08209e1338070f8378208278d00738103b55870f837a081535370f836a08042815cb270f838a4a001d5b662dda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225044006a027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0013af220c7009130e0d31f840f0282104b19e42abd12f2f28308d71820f9014601faed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87001d3ff01f8445e21f910f2a0f84901d32f0131f869f823f849be4701fcf2e0cdf849f84abef2e0cbf800f848f867f823f868f848f84ba0f86af823f845f84ba8a1f8468307f4866fa5908e1c01d32f013122bb9bf84652108307f45b30f866def8468307f47c6fa5e85f03c8f84a01cb2fc9d0f84652308307f416f866c85801cbff0101cb2ff84901cb2ff84701cb2ff84801cb2ff84a01cb2fc948015a82104b19e42a017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb004900b2c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5477d5637a" }
@@ -0,0 +1,76 @@
1
+ import { SandboxContract } from '@ton/sandbox';
2
+ import { Address, Contract, OpenedContract, Transaction } from '@ton/ton';
3
+ import { ContractOpener, ILogger } from '../interfaces';
4
+ import { AddressInformation, GetTransactionsOptions } from '../structs/Struct';
5
+ import { ContractState, TrackTransactionTreeParams, TrackTransactionTreeResult } from '../structs/Struct';
6
+ /**
7
+ * Base class for ContractOpener implementations with common functionality
8
+ */
9
+ export declare abstract class BaseContractOpener implements ContractOpener {
10
+ protected logger?: ILogger;
11
+ protected constructor(logger?: ILogger);
12
+ setLogger(logger: ILogger): void;
13
+ abstract open<T extends Contract>(contract: T): OpenedContract<T> | SandboxContract<T>;
14
+ abstract getContractState(address: Address): Promise<ContractState>;
15
+ abstract getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
16
+ abstract getAddressInformation(address: Address): Promise<AddressInformation>;
17
+ abstract getConfig(): Promise<string>;
18
+ closeConnections?(): void;
19
+ /**
20
+ * Common pagination logic for scanning transaction history
21
+ * @param addr Account address
22
+ * @param opts Search options
23
+ * @param predicate Function to check if transaction matches search criteria
24
+ * @returns Found transaction or null
25
+ */
26
+ private scanTransactionHistory;
27
+ /**
28
+ * Find transaction by hash with pagination through account history
29
+ * @param addr Account address
30
+ * @param hash Transaction hash in any format (base64, hex)
31
+ * @param opts Search options
32
+ */
33
+ getTransactionByHash(addr: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
34
+ /**
35
+ * Find transaction by its transaction hash only.
36
+ * More efficient than getTransactionByHash when you know it's a transaction hash.
37
+ */
38
+ getTransactionByTxHash(addr: Address, txHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
39
+ /**
40
+ * Find transaction by its incoming message hash.
41
+ * Useful for finding the transaction that processed a specific message.
42
+ */
43
+ getTransactionByInMsgHash(addr: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
44
+ /**
45
+ * Find transaction by its outgoing message hash.
46
+ * Useful for finding the parent transaction that sent a specific message.
47
+ */
48
+ getTransactionByOutMsgHash(addr: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
49
+ /**
50
+ * Get adjacent transactions (children and parent)
51
+ * @param addr Account address
52
+ * @param hash Transaction hash in any format (base64, hex)
53
+ * @param opts Search options
54
+ */
55
+ getAdjacentTransactions(addr: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction[]>;
56
+ /**
57
+ * Validate transaction phases and return error details
58
+ */
59
+ private validateTransactionWithResult;
60
+ /**
61
+ * Find transaction by hash type
62
+ */
63
+ private findTransactionByHashType;
64
+ /**
65
+ * Retry lookup for root transaction because it may appear in indexers with a delay.
66
+ */
67
+ private findRootTransactionWithRetry;
68
+ /**
69
+ * Track transaction tree and validate all transactions
70
+ */
71
+ trackTransactionTree(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<void>;
72
+ /**
73
+ * Track transaction tree and validate all transactions (returns result instead of throwing)
74
+ */
75
+ trackTransactionTreeWithResult(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<TrackTransactionTreeResult>;
76
+ }
@@ -0,0 +1,445 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseContractOpener = void 0;
4
+ const ton_1 = require("@ton/ton");
5
+ const errors_1 = require("../errors");
6
+ const Consts_1 = require("../sdk/Consts");
7
+ const Utils_1 = require("../sdk/Utils");
8
+ /**
9
+ * Base class for ContractOpener implementations with common functionality
10
+ */
11
+ class BaseContractOpener {
12
+ constructor(logger) {
13
+ this.logger = logger;
14
+ }
15
+ setLogger(logger) {
16
+ if (!this.logger) {
17
+ this.logger = logger;
18
+ }
19
+ }
20
+ /**
21
+ * Common pagination logic for scanning transaction history
22
+ * @param addr Account address
23
+ * @param opts Search options
24
+ * @param predicate Function to check if transaction matches search criteria
25
+ * @returns Found transaction or null
26
+ */
27
+ async scanTransactionHistory(addr, opts, predicate) {
28
+ const limit = opts?.limit ?? Consts_1.DEFAULT_FIND_TX_LIMIT;
29
+ const inclusive = opts?.inclusive ?? true;
30
+ const toLt = opts?.to_lt ? BigInt(opts.to_lt) : undefined;
31
+ let currentLt = opts?.lt;
32
+ let currentHash = opts?.hash ? (0, Utils_1.normalizeHashToBase64)(opts.hash) : undefined;
33
+ const seenCursors = new Set();
34
+ let scannedTransactions = 0;
35
+ const maxScannedTransactions = opts?.maxScannedTransactions ?? Consts_1.DEFAULT_MAX_SCANNED_TRANSACTIONS;
36
+ while (true) {
37
+ const list = await this.getTransactions(addr, {
38
+ limit,
39
+ lt: currentLt,
40
+ hash: currentHash,
41
+ to_lt: opts?.to_lt,
42
+ inclusive,
43
+ archival: opts?.archival ?? Consts_1.DEFAULT_FIND_TX_ARCHIVAL,
44
+ timeoutMs: opts?.timeoutMs,
45
+ retryDelayMs: opts?.retryDelayMs,
46
+ });
47
+ if (list.length === 0) {
48
+ break;
49
+ }
50
+ let startIndex = 0;
51
+ const firstTx = list[0];
52
+ const firstTxMatchesCursor = currentLt &&
53
+ currentHash &&
54
+ firstTx.lt.toString() === currentLt &&
55
+ firstTx.hash().toString('base64') === currentHash;
56
+ if (firstTxMatchesCursor) {
57
+ startIndex = 1;
58
+ if (list.length === 1) {
59
+ if (firstTx.prevTransactionLt === 0n) {
60
+ break;
61
+ }
62
+ const nextLt = firstTx.prevTransactionLt.toString();
63
+ const nextHash = Buffer.from(firstTx.prevTransactionHash.toString(16).padStart(64, '0'), 'hex').toString('base64');
64
+ if (currentLt && BigInt(nextLt) >= BigInt(currentLt)) {
65
+ break;
66
+ }
67
+ const cursorKey = `${nextLt}:${nextHash}`;
68
+ if (seenCursors.has(cursorKey)) {
69
+ break;
70
+ }
71
+ seenCursors.add(cursorKey);
72
+ currentLt = nextLt;
73
+ currentHash = nextHash;
74
+ continue;
75
+ }
76
+ }
77
+ for (let i = startIndex; i < list.length; i++) {
78
+ const tx = list[i];
79
+ scannedTransactions += 1;
80
+ if (scannedTransactions > maxScannedTransactions) {
81
+ this.logger?.debug(`Scan limit reached (${maxScannedTransactions} transactions), stopping history scan`);
82
+ return null;
83
+ }
84
+ if (predicate(tx)) {
85
+ return tx;
86
+ }
87
+ }
88
+ const oldestTx = list[list.length - 1];
89
+ if (oldestTx.prevTransactionLt === 0n)
90
+ break;
91
+ if (toLt !== undefined) {
92
+ if (inclusive ? oldestTx.lt <= toLt : oldestTx.lt < toLt)
93
+ break;
94
+ }
95
+ const nextLt = oldestTx.lt.toString();
96
+ const nextHash = oldestTx.hash().toString('base64');
97
+ if (currentLt && BigInt(nextLt) >= BigInt(currentLt)) {
98
+ break;
99
+ }
100
+ const cursorKey = `${nextLt}:${nextHash}`;
101
+ if (seenCursors.has(cursorKey)) {
102
+ break;
103
+ }
104
+ seenCursors.add(cursorKey);
105
+ currentLt = nextLt;
106
+ currentHash = nextHash;
107
+ }
108
+ return null;
109
+ }
110
+ /**
111
+ * Find transaction by hash with pagination through account history
112
+ * @param addr Account address
113
+ * @param hash Transaction hash in any format (base64, hex)
114
+ * @param opts Search options
115
+ */
116
+ async getTransactionByHash(addr, hash, opts) {
117
+ const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(hash);
118
+ return this.scanTransactionHistory(addr, opts, (tx) => {
119
+ // 1. check tx itself
120
+ if (tx.hash().toString('base64') === targetHashB64) {
121
+ return true;
122
+ }
123
+ // 2. check incoming message(external-in)
124
+ if (tx.inMessage && tx.inMessage.info.type === 'external-in') {
125
+ const msgHash = (0, Utils_1.getNormalizedExtMessageHash)(tx.inMessage);
126
+ if (msgHash === targetHashB64) {
127
+ return true;
128
+ }
129
+ const rawMsgHash = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell().hash().toString('base64');
130
+ if (rawMsgHash === targetHashB64) {
131
+ return true;
132
+ }
133
+ }
134
+ // 3. check incoming message(internal)
135
+ if (tx.inMessage && tx.inMessage.info.type === 'internal') {
136
+ const messageCell = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell();
137
+ const msgHash = messageCell.hash();
138
+ if (msgHash.toString('base64') === targetHashB64) {
139
+ return true;
140
+ }
141
+ }
142
+ // 4. check outcoming message
143
+ for (const outMsg of tx.outMessages.values()) {
144
+ const messageCell = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(outMsg)).endCell();
145
+ const hash = messageCell.hash();
146
+ if (hash.toString('base64') === targetHashB64) {
147
+ return true;
148
+ }
149
+ }
150
+ return false;
151
+ });
152
+ }
153
+ /**
154
+ * Find transaction by its transaction hash only.
155
+ * More efficient than getTransactionByHash when you know it's a transaction hash.
156
+ */
157
+ async getTransactionByTxHash(addr, txHash, opts) {
158
+ const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(txHash);
159
+ return this.scanTransactionHistory(addr, opts, (tx) => {
160
+ return tx.hash().toString('base64') === targetHashB64;
161
+ });
162
+ }
163
+ /**
164
+ * Find transaction by its incoming message hash.
165
+ * Useful for finding the transaction that processed a specific message.
166
+ */
167
+ async getTransactionByInMsgHash(addr, msgHash, opts) {
168
+ const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(msgHash);
169
+ return this.scanTransactionHistory(addr, opts, (tx) => {
170
+ // Check incoming message(external-in) - uses normalized hash
171
+ if (tx.inMessage && tx.inMessage.info.type === 'external-in') {
172
+ const hash = (0, Utils_1.getNormalizedExtMessageHash)(tx.inMessage);
173
+ if (hash === targetHashB64) {
174
+ return true;
175
+ }
176
+ const rawHash = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell().hash().toString('base64');
177
+ if (rawHash === targetHashB64) {
178
+ return true;
179
+ }
180
+ }
181
+ // Check incoming message(internal) - uses full message cell hash
182
+ if (tx.inMessage && tx.inMessage.info.type === 'internal') {
183
+ const messageCell = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell();
184
+ const hash = messageCell.hash();
185
+ if (hash.toString('base64') === targetHashB64) {
186
+ return true;
187
+ }
188
+ }
189
+ return false;
190
+ });
191
+ }
192
+ /**
193
+ * Find transaction by its outgoing message hash.
194
+ * Useful for finding the parent transaction that sent a specific message.
195
+ */
196
+ async getTransactionByOutMsgHash(addr, msgHash, opts) {
197
+ const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(msgHash);
198
+ return this.scanTransactionHistory(addr, opts, (tx) => {
199
+ for (const outMsg of tx.outMessages.values()) {
200
+ const messageCell = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(outMsg)).endCell();
201
+ const hash = messageCell.hash();
202
+ if (hash.toString('base64') === targetHashB64) {
203
+ return true;
204
+ }
205
+ }
206
+ return false;
207
+ });
208
+ }
209
+ /**
210
+ * Get adjacent transactions (children and parent)
211
+ * @param addr Account address
212
+ * @param hash Transaction hash in any format (base64, hex)
213
+ * @param opts Search options
214
+ */
215
+ async getAdjacentTransactions(addr, hash, opts) {
216
+ // 1. Find the root transaction (hash will be normalized inside getTransactionByHash)
217
+ const rootTx = await this.getTransactionByHash(addr, hash, opts);
218
+ if (!rootTx)
219
+ return [];
220
+ const adjacent = [];
221
+ // 2. Follow every outgoing message to find child transactions
222
+ for (const msg of rootTx.outMessages.values()) {
223
+ const dst = msg.info.dest;
224
+ if (!dst || dst instanceof ton_1.ExternalAddress)
225
+ continue;
226
+ const msgHashB64 = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(msg)).endCell().hash().toString('base64');
227
+ // The outgoing message becomes an incoming message at the destination
228
+ const tx = await this.getTransactionByInMsgHash(dst, msgHashB64, opts);
229
+ if (tx)
230
+ adjacent.push(tx);
231
+ }
232
+ // 3. Optional: follow the incoming message to find parent transaction
233
+ if (rootTx.inMessage?.info.type === 'internal') {
234
+ const msgHashB64 = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(rootTx.inMessage)).endCell().hash().toString('base64');
235
+ // The incoming message was an outgoing message at the source
236
+ const tx = await this.getTransactionByOutMsgHash(rootTx.inMessage.info.src, msgHashB64, opts);
237
+ if (tx)
238
+ adjacent.push(tx);
239
+ }
240
+ return adjacent;
241
+ }
242
+ /**
243
+ * Validate transaction phases and return error details
244
+ */
245
+ validateTransactionWithResult(tx, ignoreOpcodeList) {
246
+ if (tx.description.type !== 'generic')
247
+ return null;
248
+ const { aborted, computePhase, actionPhase } = tx.description;
249
+ const txHash = tx.hash().toString('base64');
250
+ const exitCode = computePhase && computePhase.type !== 'skipped' ? computePhase.exitCode : 'N/A';
251
+ const resultCode = actionPhase ? actionPhase.resultCode : 'N/A';
252
+ if (aborted) {
253
+ return { txHash, exitCode, resultCode, reason: 'aborted' };
254
+ }
255
+ if (!computePhase) {
256
+ return { txHash, exitCode, resultCode, reason: 'compute_phase_missing' };
257
+ }
258
+ if (computePhase.type !== 'skipped' && (!computePhase.success || computePhase.exitCode !== 0)) {
259
+ return { txHash, exitCode, resultCode, reason: 'compute_phase_failed' };
260
+ }
261
+ if (actionPhase && (!actionPhase.success || actionPhase.resultCode !== 0)) {
262
+ return { txHash, exitCode, resultCode, reason: 'action_phase_failed' };
263
+ }
264
+ if (!tx.inMessage)
265
+ return null;
266
+ // Log optional skip hints (does not bypass phase validation)
267
+ if (tx.inMessage.info.type === 'internal' && tx.inMessage.info.value.coins === Consts_1.IGNORE_MSG_VALUE_1_NANO) {
268
+ this.logger?.debug(`Skipping extra checks for tx: ${txHash} (1 nano message)`);
269
+ return null;
270
+ }
271
+ const bodySlice = tx.inMessage.body.beginParse();
272
+ if (bodySlice.remainingBits >= 32) {
273
+ const opcode = bodySlice.loadUint(32);
274
+ if (ignoreOpcodeList.includes(opcode)) {
275
+ this.logger?.debug(`Skipping extra checks for tx: ${txHash} (opcode in ignore list)`);
276
+ }
277
+ }
278
+ return null;
279
+ }
280
+ /**
281
+ * Find transaction by hash type
282
+ */
283
+ async findTransactionByHashType(address, hash, hashType, opts) {
284
+ const searchOpts = { archival: true, ...opts };
285
+ if (hashType === 'in') {
286
+ return this.getTransactionByInMsgHash(address, hash, searchOpts);
287
+ }
288
+ else if (hashType === 'out') {
289
+ return this.getTransactionByOutMsgHash(address, hash, searchOpts);
290
+ }
291
+ else {
292
+ return this.getTransactionByHash(address, hash, searchOpts);
293
+ }
294
+ }
295
+ /**
296
+ * Retry lookup for root transaction because it may appear in indexers with a delay.
297
+ */
298
+ async findRootTransactionWithRetry(address, hash, hashType, limit, maxScannedTransactions, waitForRootTransaction) {
299
+ if (!waitForRootTransaction) {
300
+ return this.findTransactionByHashType(address, hash, hashType, {
301
+ limit,
302
+ archival: true,
303
+ maxScannedTransactions,
304
+ });
305
+ }
306
+ const attempts = Math.ceil(Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_TIMEOUT_MS / Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS);
307
+ const broadSearchOpts = { limit, archival: true, maxScannedTransactions };
308
+ const baselineInfo = await this.getAddressInformation(address);
309
+ let seenLt = baselineInfo.lastTransaction.lt || undefined;
310
+ // Capture baseline before first search.
311
+ const firstTx = await this.findTransactionByHashType(address, hash, hashType, broadSearchOpts);
312
+ if (firstTx) {
313
+ this.logger?.debug(`Root transaction found on attempt 1/${attempts}`);
314
+ return firstTx;
315
+ }
316
+ this.logger?.debug(`Root transaction not found yet (attempt 1/${attempts}), retrying in ${Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS}ms`);
317
+ await (0, Utils_1.sleep)(Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS);
318
+ for (let attempt = 2; attempt <= attempts; attempt++) {
319
+ const info = await this.getAddressInformation(address);
320
+ const currentLt = info.lastTransaction.lt || undefined;
321
+ if (!currentLt || currentLt === seenLt) {
322
+ this.logger?.debug(`Root transaction not found yet (attempt ${attempt}/${attempts}), lastTx unchanged, retrying in ${Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS}ms`);
323
+ await (0, Utils_1.sleep)(Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS);
324
+ continue;
325
+ }
326
+ seenLt = currentLt;
327
+ const tx = await this.findTransactionByHashType(address, hash, hashType, broadSearchOpts);
328
+ if (tx) {
329
+ this.logger?.debug(`Root transaction found on attempt ${attempt}/${attempts}`);
330
+ return tx;
331
+ }
332
+ this.logger?.debug(`Root transaction not found yet (attempt ${attempt}/${attempts}), retrying in ${Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS}ms`);
333
+ await (0, Utils_1.sleep)(Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS);
334
+ }
335
+ this.logger?.debug(`Root transaction not found after ${attempts} attempts`);
336
+ return null;
337
+ }
338
+ /**
339
+ * Track transaction tree and validate all transactions
340
+ */
341
+ async trackTransactionTree(address, hash, params = {
342
+ maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH,
343
+ ignoreOpcodeList: Consts_1.IGNORE_OPCODE,
344
+ limit: Consts_1.DEFAULT_FIND_TX_LIMIT,
345
+ direction: 'both',
346
+ waitForRootTransaction: Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION,
347
+ }) {
348
+ const result = await this.trackTransactionTreeWithResult(address, hash, params);
349
+ if (this.logger && typeof result.checkedCount === 'number') {
350
+ this.logger.debug(`Transaction tree checked: ${result.checkedCount} unique transaction(s)`);
351
+ }
352
+ if (!result.success && result.error) {
353
+ const { txHash, exitCode, resultCode, reason, address: errorAddress, hashType } = result.error;
354
+ const context = reason === 'not_found'
355
+ ? ` address=${errorAddress ?? 'unknown'} hashType=${hashType ?? 'unknown'}`
356
+ : '';
357
+ throw (0, errors_1.txFinalizationError)(`${txHash}: reason=${reason} (exitCode=${exitCode}, resultCode=${resultCode})${context}`);
358
+ }
359
+ }
360
+ /**
361
+ * Track transaction tree and validate all transactions (returns result instead of throwing)
362
+ */
363
+ async trackTransactionTreeWithResult(address, hash, params = {
364
+ maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH,
365
+ ignoreOpcodeList: Consts_1.IGNORE_OPCODE,
366
+ limit: Consts_1.DEFAULT_FIND_TX_LIMIT,
367
+ direction: 'both',
368
+ waitForRootTransaction: Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION,
369
+ }) {
370
+ const { maxDepth = Consts_1.DEFAULT_FIND_TX_MAX_DEPTH, ignoreOpcodeList = Consts_1.IGNORE_OPCODE, limit = Consts_1.DEFAULT_FIND_TX_LIMIT, maxScannedTransactions = Consts_1.DEFAULT_MAX_SCANNED_TRANSACTIONS, direction = 'both', waitForRootTransaction = Consts_1.DEFAULT_WAIT_FOR_ROOT_TRANSACTION, } = params;
371
+ const parsedAddress = ton_1.Address.parse(address);
372
+ const normalizedRootHash = (0, Utils_1.normalizeHashToBase64)(hash);
373
+ const visitedSearchKeys = new Set();
374
+ const processedTxHashes = new Set();
375
+ let checkedCount = 0;
376
+ const searchOpts = { limit, archival: true, maxScannedTransactions };
377
+ const queue = [
378
+ { address: parsedAddress, hash: normalizedRootHash, depth: 0, hashType: 'unknown' },
379
+ ];
380
+ while (queue.length > 0) {
381
+ const { hash: currentHash, depth: currentDepth, address: currentAddress, hashType } = queue.shift();
382
+ const visitedKey = `${currentAddress.toString()}:${currentHash}:${hashType}`;
383
+ if (visitedSearchKeys.has(visitedKey))
384
+ continue;
385
+ visitedSearchKeys.add(visitedKey);
386
+ const tx = currentDepth === 0
387
+ ? await this.findRootTransactionWithRetry(currentAddress, currentHash, hashType, limit, maxScannedTransactions, waitForRootTransaction)
388
+ : await this.findTransactionByHashType(currentAddress, currentHash, hashType, searchOpts);
389
+ if (!tx) {
390
+ this.logger?.debug(`Transaction not found for hash: ${currentHash} (address=${currentAddress?.toString()}, hashType=${hashType ?? 'unknown'})`);
391
+ return {
392
+ success: false,
393
+ checkedCount,
394
+ error: {
395
+ txHash: currentHash,
396
+ exitCode: 'N/A',
397
+ resultCode: 'N/A',
398
+ reason: 'not_found',
399
+ address: currentAddress?.toString(),
400
+ hashType: hashType ?? 'unknown',
401
+ },
402
+ };
403
+ }
404
+ const txHash = tx.hash().toString('base64');
405
+ if (processedTxHashes.has(txHash)) {
406
+ continue;
407
+ }
408
+ processedTxHashes.add(txHash);
409
+ checkedCount += 1;
410
+ this.logger?.debug(`Checking tx (depth ${currentDepth}): ${txHash}`);
411
+ // Validate transaction and return error if found
412
+ const validationError = this.validateTransactionWithResult(tx, ignoreOpcodeList);
413
+ if (validationError) {
414
+ return { success: false, checkedCount, error: validationError };
415
+ }
416
+ // Add adjacent transactions to queue
417
+ if (currentDepth < maxDepth) {
418
+ if ((direction === 'forward' || direction === 'both') && tx.outMessages.size > 0) {
419
+ for (const msg of tx.outMessages.values()) {
420
+ const dst = msg.info.dest;
421
+ if (!dst || dst instanceof ton_1.ExternalAddress)
422
+ continue;
423
+ queue.push({
424
+ hash: (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(msg)).endCell().hash().toString('base64'),
425
+ address: dst,
426
+ depth: currentDepth + 1,
427
+ hashType: 'in',
428
+ });
429
+ }
430
+ }
431
+ // Backward: add parent (incoming message source)
432
+ if ((direction === 'backward' || direction === 'both') && tx.inMessage?.info.type === 'internal') {
433
+ queue.push({
434
+ hash: (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell().hash().toString('base64'),
435
+ address: tx.inMessage.info.src,
436
+ depth: currentDepth + 1,
437
+ hashType: 'out',
438
+ });
439
+ }
440
+ }
441
+ }
442
+ return { success: true, checkedCount };
443
+ }
444
+ }
445
+ exports.BaseContractOpener = BaseContractOpener;
@@ -0,0 +1,38 @@
1
+ import { Address, Contract, OpenedContract, Transaction } from '@ton/ton';
2
+ import { ILogger } from '../interfaces';
3
+ import { AddressInformation, ContractState, GetTransactionsOptions, Network } from '../structs/Struct';
4
+ import { BaseContractOpener } from './BaseContractOpener';
5
+ type LiteServer = {
6
+ ip: number;
7
+ port: number;
8
+ id: {
9
+ '@type': string;
10
+ key: string;
11
+ };
12
+ };
13
+ export declare class LiteClientOpener extends BaseContractOpener {
14
+ private readonly client;
15
+ private readonly engine;
16
+ private readonly singleEngines;
17
+ private isClosing;
18
+ private isClosed;
19
+ private constructor();
20
+ static create(options: {
21
+ liteservers: LiteServer[];
22
+ } | {
23
+ network: Network;
24
+ }, logger?: ILogger): Promise<LiteClientOpener>;
25
+ open<T extends Contract>(contract: T): OpenedContract<T>;
26
+ private disableReconnect;
27
+ closeConnections(): void;
28
+ getContractState(addr: Address): Promise<ContractState>;
29
+ getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
30
+ getAddressInformation(addr: Address): Promise<AddressInformation>;
31
+ getConfig(): Promise<string>;
32
+ }
33
+ export declare function liteClientOpener(options: {
34
+ liteservers: LiteServer[];
35
+ } | {
36
+ network: Network;
37
+ }, logger?: ILogger): Promise<LiteClientOpener>;
38
+ export {};