@tonappchain/sdk 0.7.2-alpha-11 → 0.7.2-alpha-13
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.
- package/dist/artifacts/dev/ton/internal/build/CrossChainLayer.compiled.json +1 -1
- package/dist/src/adapters/BaseContractOpener.d.ts +71 -0
- package/dist/src/adapters/BaseContractOpener.js +290 -0
- package/dist/src/adapters/LiteClientOpener.d.ts +33 -0
- package/dist/src/adapters/LiteClientOpener.js +117 -0
- package/dist/src/adapters/OpenerUtils.d.ts +3 -0
- package/dist/src/adapters/OpenerUtils.js +39 -0
- package/dist/src/adapters/RetryableContractOpener.d.ts +35 -0
- package/dist/src/adapters/{retryableContractOpener.js → RetryableContractOpener.js} +60 -12
- package/dist/src/adapters/SandboxOpener.d.ts +15 -0
- package/dist/src/adapters/SandboxOpener.js +35 -0
- package/dist/src/adapters/TonClient4Opener.d.ts +21 -0
- package/dist/src/adapters/TonClient4Opener.js +86 -0
- package/dist/src/adapters/TonClientOpener.d.ts +16 -0
- package/dist/src/adapters/TonClientOpener.js +70 -0
- package/dist/src/adapters/index.d.ts +7 -2
- package/dist/src/adapters/index.js +7 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/interfaces/ContractOpener.d.ts +69 -2
- package/dist/src/interfaces/ITacSDK.d.ts +5 -0
- package/dist/src/sdk/Configuration.js +1 -1
- package/dist/src/sdk/Consts.d.ts +5 -2
- package/dist/src/sdk/Consts.js +8 -4
- package/dist/src/sdk/StartTracking.d.ts +3 -4
- package/dist/src/sdk/StartTracking.js +7 -7
- package/dist/src/sdk/TONTransactionManager.d.ts +1 -3
- package/dist/src/sdk/TONTransactionManager.js +2 -3
- package/dist/src/sdk/TacSdk.d.ts +3 -1
- package/dist/src/sdk/TacSdk.js +5 -3
- package/dist/src/sdk/TxFinalizer.d.ts +1 -8
- package/dist/src/sdk/TxFinalizer.js +10 -122
- package/dist/src/sdk/Utils.d.ts +5 -0
- package/dist/src/sdk/Utils.js +24 -0
- package/dist/src/structs/InternalStruct.d.ts +1 -16
- package/dist/src/structs/Struct.d.ts +90 -5
- package/package.json +1 -1
- package/dist/src/adapters/contractOpener.d.ts +0 -24
- package/dist/src/adapters/contractOpener.js +0 -310
- package/dist/src/adapters/retryableContractOpener.d.ts +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "hash": "b7a220facd930fbfbf4b50baa2d2663dd81177c9e2de3f75973e40ddcac945a4", "hashBase64": "t6Ig+s2TD7+/S1C6otJmPdgRd8ni3j91lz5A3crJRaQ=", "hex": "b5ee9c7241024a010017d4000114ff00f4a413f4bcf2c80b010201200245020148032c02f4d0eda2edfb20c700925f04e001d0d30301ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87071b0e302fa400406010a135f03db3c0501748020d721d31f0101d33f01123020821058d9b21bba9a30fa0030f85001a1f8708e1782100659627fba99fa0030f85001a0f8709430f2c096e2e24904f0fa4031fa0031f401fa0031fa00013170f83a02d31f0101d33f01125365a1f846f80701830cf94130f8075003a101a6668200c02b5003a0128209e1338070f8370170f836a066b6085210a1a6645177a123821048e660b5bae3022382106c582059bae300238210497dae1dbae3023035218210cda6f261ba07080e1900da6c818120ed70f8365cbcf2e064f84e59a1a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fe04d31ffa00f404fa4055302170547000246ec0008e156c3101d0d300fa00fa0023963403fa0030039130e29134e255027f266ec000f84df84c5007a816a05240b915b0927034de5320a022a027a02f813c9170f836a0a052d0be5240b0e30210365f06298014fb02c88210ae7df95b2602cb1fcb3f12cb1f22cf16c9702802090d02fe333839393a3b5254a05006a05008a021a08014fb02f84e5003a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54266ec00092366de30d020a0b001a06c8f400f84dfa02f84cfa02c9019cc8cb1f2601cb3f5003cf1658fa02f40058cf16c982106c582059017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b3915be30ddb310c0078c88210d53276db580302cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0000748010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f80fc000938100cc928064e2f2f00402fe333602fa40d4d4fa403001d0d3ff0101f404f401fa40fa0030f828f8515250027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0500ac705f2e04704d7393078d721d3ff0131f8468307f40e6fa131f2e0c927c3009438333530e30d5424600f1102fe26044813505923d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d2183073d10002af48e6fa56c1291a4923070e201d0028307f416040304fc54557428705470007f097009a1f84ea15007a18fd551898307f47c6fa5208fc402d430d0fa40d20001209301fa00927058e2d430d0d20001209301fa00927058e2d4f404069232348e95342291348e8d3103d307d3073001c001f2e0cee202e201e30f029132e201b319e65b36365b20c2009831f85001a1f8707f9130e21213161702ee7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de2414202b8f8502ca153e9a129a15330bc22c200b08ec85b5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce214a04313e30d2b1401d428a121a05230bbf2e0665220b608c882103c497a612d02cb1fcb3f2b01cbff21fa0223fa025005cf1613cc12f400c920f80701830cf94130f8075003a1801c813a8a8209e1338070f83781348f58a070f836a00270f838a703a081337270f836a0f84f54200380188010150062226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0051a2a0507aa05066a113a0018e5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce215a044142b01e85253a1c200f2e064c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54c8500601cbff0101ca00c98210497dae1d01701800fa830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb005042a158a1f84e5210bef2e0658010fb0221d70b01c000b38e3bc88210d53276db5802cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00915be204fe8ee031333403d3ff01f828f8515220027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d05005c705f2e047028014fb0201fa4030c82301cbffc98210cda6f261017fe021821074cd76b2bae302352082101f95f86cbae302208210063199b71a1b1c1d01e4830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b38e40c8821086f27385580302cb1fcb3f5801cbffc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00925f03e24900de5b3233f84313c705f2e04801d3ff0131f8648014fb02c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54019c10455f05f84ec300f2e0c8c88210f358b6d05802cb1fcb3ff84efa02c9f841f84e58801072226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0070f86e4902feba8e69306c2232f841c705f2e046fa0030f86cc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082103531465cbae3022082105cec6be0ba1e1f00d2306c2232f841c705f2e046fa0030f86dc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fc8e69306c2232f841c705f2e046fa4030f863c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e0208210581879bcbae30220821060094a1bba202100e4306c2232f841c705f2e046fa4030f862f8428b02c705f2d050c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403fe8e6810255f05f841c705f2e0468b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082106a4fbe34bae3022082106e7145f9bae30222232400d810255f05f842c705f2e049f842f8618b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed540026306c2232f841c705f2e046d401fb04d430ed5404e62082107ee5a6d0ba8ec0306c2232f841c705f2e046d430f8716df86682107ee5a6d0c8c970830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00e0208210e97250b7bae302208210d53276dbba925f06e020821074db6fbdbae302208210149c7a93ba4925262700d4306c2232f841c705f2e046d32f0131f86bc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5400d2306c2232f841c705f2e046fa4030f86fc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403f08eda30f84112c705f2e046fa00305033a15220bbf2e0cfc8821058d9b21b5802cb1fcb3f21fa02c9f84f522280188010226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a0f870e0208210461d3038bae3023403821046a47169bae3025f04840ff2f049282901ba303233f84113c705f2e04601fa0030f8505210bbf2e0d0c882100659627f580302cb1fcb3f21fa02c9f84f705880188050226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a1f8704901d8f84fc705f2e04a01f40430206eb38ed8d0d3ff0101fa40fa00d4f40430f84e17a15005a121be8e3e316c22c85801cbff01fa02c9821049e265430170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00f80ff2c065e30d925f03e22a01e64034206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce2c80101cbffc9821046a471690170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb002b00a28e4dc85801cb055005cf165003fa0254712323ed41ed43ed44ed45ed479f5bc85003cf17c913775003cb6bcccced67ed65ed64ed63ed61747fed11987601cb6bcc01cf17ed41edf101f2ffc901fb00db060201202d340201202e2f00d3bb769ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f870f84ff8508020120303201fbb444bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f083f085f087f08bf08df08ff091f093f097f095f09bf0990310014f84ef851f844f84ff85001cbb4817da89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e103300707020f8468307f4866fa5908e1801d32f01315303bc946c2251109130e2f8468307f47c6fa5e810235f03f847f848f849f84af84bf845f8440201203539020120363801d5b6d0bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225037006e027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c9207001f90074c8cb0212ca07cbffc9d001004fb7b17f00e030619f28261f00ea00742034ccd04018056a00740250413c26700e1f06e02e1f06d4100201203a4301fbb40f5f00e4b0619f28261f00ea00743f00fda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e011a1a7fe0261e8086103b02e87f5343a60381037a58a0820812750070f8375348a0a603536aa081037aa070f838525aa0526ba01a70f83818a07181012070f838a0533470f838aa00a082010abd5003a070f83612a017a0810c1c70f836a024c3008e8d70f828541343f83c1024435012926c41e28ae66c21f80758a170f836a03c3f02fe23d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d238307f48e6fa56c123d3e0054306c22707121c8c9c87f01ca005006fa0215cc14cb0013cb0712cb07c9c858cf167001ca00ccc9c8ccc9001e91a4923070e201d040148307f41602019a51128307f47c6fa5208ebc02d430d0fa4031d20001209301fa00927058e2d430d0d2000192fa00927001e2d431f404310394303113a08e8d3101d307d3073001c001f2e0cee2029132e201b3124002fc7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de201a170b60913a04142005a5b8018811c488209e1338070f8377581058e82100966018070f837a08140b570f836a08024814bfa70f838a4a0005a5b801c8127e08209e1338070f8378208278d00738103b55870f837a081535370f836a08042815cb270f838a4a001d5b662dda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225044006a027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0013af220c7009130e0d31f840f0282104b19e42abd12f2f28308d71820f9014601faed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87001d3ff01f8445e21f910f2a0f84901d32f0131f869f823f849be4701fcf2e0cdf849f84abef2e0cbf800f848f867f823f868f848f84ba0f86af823f845f84ba8a1f8468307f4866fa5908e1c01d32f013122bb9bf84652108307f45b30f866def8468307f47c6fa5e85f03c8f84a01cb2fc9d0f84652308307f416f866c85801cbff0101cb2ff84901cb2ff84701cb2ff84801cb2ff84a01cb2fc948015a82104b19e42a017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb004900b2c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed547ddb5d57" }
|
|
1
|
+
{ "hash": "85de6d2e111cbc56b64af4ac6e0c705806e37d984440d197ff4b6fb39439b672", "hashBase64": "hd5tLhEcvFa2SvSsbgxwWAbjfZhEQNGX/0tvs5Q5tnI=", "hex": "b5ee9c7241024a010017d4000114ff00f4a413f4bcf2c80b010201200245020148032c02f4d0eda2edfb20c700925f04e001d0d30301ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87071b0e302fa400406010a135f03db3c0501748020d721d31f0101d33f01123020821058d9b21bba9a30fa0030f85001a1f8708e1782100659627fba99fa0030f85001a0f8709430f2c096e2e24904f0fa4031fa0031f401fa0031fa00013170f83a02d31f0101d33f01125365a1f846f80701830cf94130f8075003a101a6668200c02b5003a0128209e1338070f8370170f836a066b6085210a1a6645177a123821048e660b5bae3022382106c582059bae300238210497dae1dbae3023035218210cda6f261ba07080e1900da6c818120ed70f8365cbcf2e064f84e59a1a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fe04d31ffa00f404fa4055302170547000246ec0008e156c3101d0d300fa00fa0023963403fa0030039130e29134e255027f266ec000f84df84c5007a816a05240b915b0927034de5320a022a027a02f813c9170f836a0a052d0be5240b0e30210365f06298014fb02c88210ae7df95b2602cb1fcb3f12cb1f22cf16c9702802090d02fe333839393a3b5254a05006a05008a021a08014fb02f84e5003a0f86ec8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54266ec00092366de30d020a0b001a06c8f400f84dfa02f84cfa02c9019cc8cb1f2601cb3f5003cf1658fa02f40058cf16c982106c582059017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b3915be30ddb310c0078c88210d53276db580302cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0000748010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f80fc000938100cc928064e2f2f00402fe333602fa40d4d4fa403001d0d3ff0101f404f401fa40fa0030f828f8515250027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0500ac705f2e04704d7393078d721d3ff0131f8468307f40e6fa131f2e0c927c3009438333530e30d5424600f1102fe26044813505923d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d2183073d10002af48e6fa56c1291a4923070e201d0028307f416040304fc54557428705470007f097009a1f84ea15007a18fd551898307f47c6fa5208fc402d430d0fa40d20001209301fa00927058e2d430d0d20001209301fa00927058e2d4f404069232348e95342291348e8d3103d307d3073001c001f2e0cee202e201e30f029132e201b319e65b36365b20c2009831f85001a1f8707f9130e21213161702ee7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de2414202b8f8502ca153e9a129a15330bc22c200b08ec85b5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce214a04313e30d2b1401d428a121a05230bbf2e0665220b608c882103c497a612d02cb1fcb3f2b01cbff21fa0223fa025005cf1613cc12f400c920f80701830cf94130f8075003a1801c813a8a8209e1338070f83781348f58a070f836a00270f838a703a081337270f836a0f84f54200380188011150062226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0051a2a0506aa05055a113a0018e5441145033206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce215a044142b01e85253a1c200f2e064c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54c8500601cbff0101ca00c98210497dae1d01701800fa830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb005042a158a1f84e5210bef2e0658010fb0221d70b01c000b38e3bc88210d53276db5802cb1fcb3fc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00915be204fe8ee031333403d3ff01f828f8515220027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d05005c705f2e047028014fb0201fa4030c82301cbffc98210cda6f261017fe021821074cd76b2bae302352082101f95f86cbae302208210063199b71a1b1c1d01e4830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb0020d70b01c000b38e40c8821086f27385580302cb1fcb3f5801cbffc970018010810082226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00925f03e24900de5b3233f84313c705f2e04801d3ff0131f8648014fb02c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54019c10455f05f84ec300f2e0c8c88210f358b6d05802cb1fcb3ff84efa02c9f841f84e58801072226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb0070f86e4902feba8e69306c2232f841c705f2e046fa0030f86cc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082103531465cbae3022082105cec6be0ba1e1f00d2306c2232f841c705f2e046fa0030f86dc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5402fc8e69306c2232f841c705f2e046fa4030f863c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e0208210581879bcbae30220821060094a1bba202100e4306c2232f841c705f2e046fa4030f862f8428b02c705f2d050c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403fe8e6810255f05f841c705f2e0468b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed54e02082106a4fbe34bae3022082106e7145f9bae30222232400d810255f05f842c705f2e049f842f8618b02f862c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed540026306c2232f841c705f2e046d401fb04d430ed5404e62082107ee5a6d0ba8ec0306c2232f841c705f2e046d430f8716df86682107ee5a6d0c8c970830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00e0208210e97250b7bae302208210d53276dbba925f06e020821074db6fbdbae302208210149c7a93ba4925262700d4306c2232f841c705f2e046d32f0131f86bc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5400d2306c2232f841c705f2e046fa4030f86fc8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5403f08eda30f84112c705f2e046fa00305033a15220bbf2e0cfc8821058d9b21b5802cb1fcb3f21fa02c9f84f522280188010226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a0f870e0208210461d3038bae3023403821046a47169bae3025f04840ff2f049282901ba303233f84113c705f2e04601fa0030f8505210bbf2e0d0c882100659627f580302cb1fcb3f21fa02c9f84f705880188050226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb00f85001a1f8704901d8f84fc705f2e04a01f40430206eb38ed8d0d3ff0101fa40fa00d4f40430f84e17a15005a121be8e3e316c22c85801cbff01fa02c9821049e265430170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb00f80ff2c065e30d925f03e22a01e64034206e8e2b3080108011226eb32091719170e2c8500401cb055006cf165004fa02cb6a039358cc019130e201c901fb008e8cc802d012cf1680108011db3ce2c80101cbffc9821046a471690170830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb002b00a28e4dc85801cb055005cf165003fa0254712323ed41ed43ed44ed45ed479f5bc85003cf17c913775003cb6bcccced67ed65ed64ed63ed61747fed11987601cb6bcc01cf17ed41edf101f2ffc901fb00db060201202d340201202e2f00d3bb769ed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f870f84ff8508020120303201fbb444bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f083f085f087f08bf08df08ff091f093f097f095f09bf0990310014f84ef851f844f84ff85001cbb4817da89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e103300707020f8468307f4866fa5908e1801d32f01315303bc946c2251109130e2f8468307f47c6fa5e810235f03f847f848f849f84af84bf845f8440201203539020120363801d5b6d0bda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225037006e027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c9207001f90074c8cb0212ca07cbffc9d001004fb7b17f00e030619f28261f00ea00742034ccd04018056a00740250413c26700e1f06e02e1f06d4100201203a4301fbb40f5f00e4b0619f28261f00ea00743f00fda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e011a1a7fe0261e8086103b02e87f5343a60381037a58a0820812750070f8375348a0a603536aa081037aa070f838525aa0526ba01a70f83818a07181012070f838a0533470f838aa00a082010abd5003a070f83612a017a0810c1c70f836a024c3008e8d70f828541343f83c1024435012926c41e28ae66c21f80758a170f836a03c3f02fe23d70b01c0008e6caa0081505d70f836a0738103b582100966018070f837a0801c8127e08209e1338070f837a0a47020c88210d7b9c06e580802cb1fcb3f23cf165004fa0258cf1671fa0214cb00cb00c9712070c87001ca0014cc13cb0012cb07cb07c9c858cf167f01ca0058fa02ccc9c8ccc9e30d238307f48e6fa56c123d3e0054306c22707121c8c9c87f01ca005006fa0215cc14cb0013cb0712cb07c9c858cf167001ca00ccc9c8ccc9001e91a4923070e201d040148307f41602019a51128307f47c6fa5208ebc02d430d0fa4031d20001209301fa00927058e2d430d0d2000192fa00927001e2d431f404310394303113a08e8d3101d307d3073001c001f2e0cee2029132e201b3124002fc7021c000965b705300f8388f6921c0018ee221c0028e5b21c0048e2a5b8209da9c008019812af85870f837aa008170ae70f836a08019812af870f83c79810f5a70f838a0a4a08e2901c0038e1f308209da9c0080198126955870f8378143e470f836a07281051470f838a4a093f2c0cee2e2e30de30de201a170b60913a04142005a5b8018811c488209e1338070f8377581058e82100966018070f837a08140b570f836a08024814bfa70f838a4a0005a5b801c8127e08209e1338070f8378208278d00738103b55870f837a081535370f836a08042815cb270f838a4a001d5b662dda89a1f48003f0c3f48003f0c5f48003f0c7a803a1f40003f0dbf40003f0d9f40061f0dda803a1a7fe03f0c9a861f0e3a803a1a65e03f0d7a65e03f0cfa65e03f0d1a65e03f0d3a65e03f0d5a60603f0cbe80861f0cda861a1f48003f0dff40061f0e1f051f0a225044006a027070500370c85004cf168b02cf1612ca000101cbffcb00c921c8cb0113f40012f400cb00c97001f90074c8cb0212ca07cbffc9d0013af220c7009130e0d31f840f0282104b19e42abd12f2f28308d71820f9014601faed44d0fa4001f861fa4001f862fa4001f863d401d0fa0001f86dfa0001f86cfa0030f86ed401d0d3ff01f864d430f871d401d0d32f01f86bd32f01f867d32f01f868d32f01f869d32f01f86ad30301f865f40430f866d430d0fa4001f86ffa0030f87001d3ff01f8445e21f910f2a0f84901d32f0131f869f823f849be4701fcf2e0cdf849f84abef2e0cbf800f848f867f823f868f848f84ba0f86af823f845f84ba8a1f8468307f4866fa5908e1c01d32f013122bb9bf84652108307f45b30f866def8468307f47c6fa5e85f03c8f84a01cb2fc9d0f84652308307f416f866c85801cbff0101cb2ff84901cb2ff84701cb2ff84801cb2ff84a01cb2fc948015a82104b19e42a017f830771800cc8cb03cb01cb0813cbff02957158cb61cc987058cb6101d0cf16e2c98010fb004900b2c8f84fcf16f850fa02c9f846f845c8f84b01cb2ff84701cb2ff84801cb2ff84901cb2ff84a01cb2fcb03f400c9f851c8f84401cbffccc9c8f84dfa02f84cfa02f84efa02c9c8f841cf16f842cf16f843cf16ccccccccc9ed5477d5637a" }
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
abstract open<T extends Contract>(contract: T): OpenedContract<T> | SandboxContract<T>;
|
|
13
|
+
abstract getContractState(address: Address): Promise<ContractState>;
|
|
14
|
+
abstract getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
|
|
15
|
+
abstract getAddressInformation(address: Address): Promise<AddressInformation>;
|
|
16
|
+
abstract getConfig(): Promise<string>;
|
|
17
|
+
closeConnections?(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Common pagination logic for scanning transaction history
|
|
20
|
+
* @param addr Account address
|
|
21
|
+
* @param opts Search options
|
|
22
|
+
* @param predicate Function to check if transaction matches search criteria
|
|
23
|
+
* @returns Found transaction or null
|
|
24
|
+
*/
|
|
25
|
+
private scanTransactionHistory;
|
|
26
|
+
/**
|
|
27
|
+
* Find transaction by hash with pagination through account history
|
|
28
|
+
* @param addr Account address
|
|
29
|
+
* @param hash Transaction hash in any format (base64, hex)
|
|
30
|
+
* @param opts Search options
|
|
31
|
+
*/
|
|
32
|
+
getTransactionByHash(addr: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Find transaction by its transaction hash only.
|
|
35
|
+
* More efficient than getTransactionByHash when you know it's a transaction hash.
|
|
36
|
+
*/
|
|
37
|
+
getTransactionByTxHash(addr: Address, txHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Find transaction by its incoming message hash.
|
|
40
|
+
* Useful for finding the transaction that processed a specific message.
|
|
41
|
+
*/
|
|
42
|
+
getTransactionByInMsgHash(addr: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Find transaction by its outgoing message hash.
|
|
45
|
+
* Useful for finding the parent transaction that sent a specific message.
|
|
46
|
+
*/
|
|
47
|
+
getTransactionByOutMsgHash(addr: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Get adjacent transactions (children and parent)
|
|
50
|
+
* @param addr Account address
|
|
51
|
+
* @param hash Transaction hash in any format (base64, hex)
|
|
52
|
+
* @param opts Search options
|
|
53
|
+
*/
|
|
54
|
+
getAdjacentTransactions(addr: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Validate transaction phases and return error details
|
|
57
|
+
*/
|
|
58
|
+
private validateTransactionWithResult;
|
|
59
|
+
/**
|
|
60
|
+
* Find transaction by hash type
|
|
61
|
+
*/
|
|
62
|
+
private findTransactionByHashType;
|
|
63
|
+
/**
|
|
64
|
+
* Track transaction tree and validate all transactions
|
|
65
|
+
*/
|
|
66
|
+
trackTransactionTree(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Track transaction tree and validate all transactions (returns result instead of throwing)
|
|
69
|
+
*/
|
|
70
|
+
trackTransactionTreeWithResult(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<TrackTransactionTreeResult>;
|
|
71
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
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
|
+
/**
|
|
16
|
+
* Common pagination logic for scanning transaction history
|
|
17
|
+
* @param addr Account address
|
|
18
|
+
* @param opts Search options
|
|
19
|
+
* @param predicate Function to check if transaction matches search criteria
|
|
20
|
+
* @returns Found transaction or null
|
|
21
|
+
*/
|
|
22
|
+
async scanTransactionHistory(addr, opts, predicate) {
|
|
23
|
+
const limit = opts?.limit ?? Consts_1.DEFAULT_FIND_TX_LIMIT;
|
|
24
|
+
let currentLt = opts?.lt;
|
|
25
|
+
let currentHash = opts?.hash;
|
|
26
|
+
while (true) {
|
|
27
|
+
const batch = await this.getTransactions(addr, {
|
|
28
|
+
limit,
|
|
29
|
+
lt: currentLt,
|
|
30
|
+
hash: currentHash,
|
|
31
|
+
archival: opts?.archival ?? Consts_1.DEFAULT_FIND_TX_ARCHIVAL,
|
|
32
|
+
});
|
|
33
|
+
if (batch.length === 0)
|
|
34
|
+
break;
|
|
35
|
+
for (const tx of batch) {
|
|
36
|
+
if (predicate(tx)) {
|
|
37
|
+
return tx;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const oldestTx = batch[batch.length - 1];
|
|
41
|
+
if (oldestTx.prevTransactionLt === 0n)
|
|
42
|
+
break;
|
|
43
|
+
currentLt = oldestTx.prevTransactionLt.toString();
|
|
44
|
+
const hashHex = oldestTx.prevTransactionHash.toString(16).padStart(64, '0');
|
|
45
|
+
currentHash = Buffer.from(hashHex, 'hex').toString('base64');
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Find transaction by hash with pagination through account history
|
|
51
|
+
* @param addr Account address
|
|
52
|
+
* @param hash Transaction hash in any format (base64, hex)
|
|
53
|
+
* @param opts Search options
|
|
54
|
+
*/
|
|
55
|
+
async getTransactionByHash(addr, hash, opts) {
|
|
56
|
+
const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(hash);
|
|
57
|
+
return this.scanTransactionHistory(addr, opts, (tx) => {
|
|
58
|
+
// 1. check tx itself
|
|
59
|
+
if (tx.hash().toString('base64') === targetHashB64) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
// 2. check incoming message(external-in)
|
|
63
|
+
if (tx.inMessage && tx.inMessage.info.type === 'external-in') {
|
|
64
|
+
const msgHash = (0, Utils_1.getNormalizedExtMessageHash)(tx.inMessage);
|
|
65
|
+
if (msgHash === targetHashB64) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// 3. check incoming message(internal)
|
|
70
|
+
if (tx.inMessage && tx.inMessage.info.type === 'internal') {
|
|
71
|
+
const messageCell = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell();
|
|
72
|
+
const msgHash = messageCell.hash();
|
|
73
|
+
if (msgHash.toString('base64') === targetHashB64) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Find transaction by its transaction hash only.
|
|
82
|
+
* More efficient than getTransactionByHash when you know it's a transaction hash.
|
|
83
|
+
*/
|
|
84
|
+
async getTransactionByTxHash(addr, txHash, opts) {
|
|
85
|
+
const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(txHash);
|
|
86
|
+
return this.scanTransactionHistory(addr, opts, (tx) => {
|
|
87
|
+
return tx.hash().toString('base64') === targetHashB64;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Find transaction by its incoming message hash.
|
|
92
|
+
* Useful for finding the transaction that processed a specific message.
|
|
93
|
+
*/
|
|
94
|
+
async getTransactionByInMsgHash(addr, msgHash, opts) {
|
|
95
|
+
const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(msgHash);
|
|
96
|
+
return this.scanTransactionHistory(addr, opts, (tx) => {
|
|
97
|
+
// Check incoming message(external-in) - uses normalized hash
|
|
98
|
+
if (tx.inMessage && tx.inMessage.info.type === 'external-in') {
|
|
99
|
+
const hash = (0, Utils_1.getNormalizedExtMessageHash)(tx.inMessage);
|
|
100
|
+
if (hash === targetHashB64) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Check incoming message(internal) - uses full message cell hash
|
|
105
|
+
if (tx.inMessage && tx.inMessage.info.type === 'internal') {
|
|
106
|
+
const messageCell = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell();
|
|
107
|
+
const hash = messageCell.hash();
|
|
108
|
+
if (hash.toString('base64') === targetHashB64) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Find transaction by its outgoing message hash.
|
|
117
|
+
* Useful for finding the parent transaction that sent a specific message.
|
|
118
|
+
*/
|
|
119
|
+
async getTransactionByOutMsgHash(addr, msgHash, opts) {
|
|
120
|
+
const targetHashB64 = (0, Utils_1.normalizeHashToBase64)(msgHash);
|
|
121
|
+
return this.scanTransactionHistory(addr, opts, (tx) => {
|
|
122
|
+
for (const outMsg of tx.outMessages.values()) {
|
|
123
|
+
const messageCell = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(outMsg)).endCell();
|
|
124
|
+
const hash = messageCell.hash();
|
|
125
|
+
if (hash.toString('base64') === targetHashB64) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get adjacent transactions (children and parent)
|
|
134
|
+
* @param addr Account address
|
|
135
|
+
* @param hash Transaction hash in any format (base64, hex)
|
|
136
|
+
* @param opts Search options
|
|
137
|
+
*/
|
|
138
|
+
async getAdjacentTransactions(addr, hash, opts) {
|
|
139
|
+
// 1. Find the root transaction (hash will be normalized inside getTransactionByHash)
|
|
140
|
+
const rootTx = await this.getTransactionByHash(addr, hash, opts);
|
|
141
|
+
if (!rootTx)
|
|
142
|
+
return [];
|
|
143
|
+
const adjacent = [];
|
|
144
|
+
// 2. Follow every outgoing message to find child transactions
|
|
145
|
+
for (const msg of rootTx.outMessages.values()) {
|
|
146
|
+
const dst = msg.info.dest;
|
|
147
|
+
if (!dst || dst instanceof ton_1.ExternalAddress)
|
|
148
|
+
continue;
|
|
149
|
+
const msgHashB64 = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(msg)).endCell().hash().toString('base64');
|
|
150
|
+
// The outgoing message becomes an incoming message at the destination
|
|
151
|
+
const tx = await this.getTransactionByInMsgHash(dst, msgHashB64, opts);
|
|
152
|
+
if (tx)
|
|
153
|
+
adjacent.push(tx);
|
|
154
|
+
}
|
|
155
|
+
// 3. Optional: follow the incoming message to find parent transaction
|
|
156
|
+
if (rootTx.inMessage?.info.type === 'internal') {
|
|
157
|
+
const msgHashB64 = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(rootTx.inMessage)).endCell().hash().toString('base64');
|
|
158
|
+
// The incoming message was an outgoing message at the source
|
|
159
|
+
const tx = await this.getTransactionByOutMsgHash(rootTx.inMessage.info.src, msgHashB64, opts);
|
|
160
|
+
if (tx)
|
|
161
|
+
adjacent.push(tx);
|
|
162
|
+
}
|
|
163
|
+
return adjacent;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Validate transaction phases and return error details
|
|
167
|
+
*/
|
|
168
|
+
validateTransactionWithResult(tx, ignoreOpcodeList) {
|
|
169
|
+
if (tx.description.type !== 'generic' || !tx.inMessage)
|
|
170
|
+
return null;
|
|
171
|
+
// Skip validation for 1 nano messages
|
|
172
|
+
if (tx.inMessage.info.type === 'internal' && tx.inMessage.info.value.coins === Consts_1.IGNORE_MSG_VALUE_1_NANO) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const bodySlice = tx.inMessage.body.beginParse();
|
|
176
|
+
if (bodySlice.remainingBits < 32)
|
|
177
|
+
return null;
|
|
178
|
+
const opcode = bodySlice.loadUint(32);
|
|
179
|
+
if (ignoreOpcodeList.includes(opcode)) {
|
|
180
|
+
this.logger?.debug(`Skipping validation for tx: ${tx.hash().toString('base64')} (opcode in ignore list)`);
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
const { aborted, computePhase, actionPhase } = tx.description;
|
|
184
|
+
const txHash = tx.hash().toString('base64');
|
|
185
|
+
const exitCode = computePhase && computePhase.type !== 'skipped' ? computePhase.exitCode : 'N/A';
|
|
186
|
+
const resultCode = actionPhase ? actionPhase.resultCode : 'N/A';
|
|
187
|
+
if (aborted) {
|
|
188
|
+
if (!computePhase || computePhase.type === 'skipped') {
|
|
189
|
+
return { txHash, exitCode, resultCode, reason: 'compute_phase_missing' };
|
|
190
|
+
}
|
|
191
|
+
if (!computePhase.success || computePhase.exitCode !== 0) {
|
|
192
|
+
return { txHash, exitCode, resultCode, reason: 'compute_phase_failed' };
|
|
193
|
+
}
|
|
194
|
+
if (actionPhase && (!actionPhase.success || actionPhase.resultCode !== 0)) {
|
|
195
|
+
return { txHash, exitCode, resultCode, reason: 'action_phase_failed' };
|
|
196
|
+
}
|
|
197
|
+
return { txHash, exitCode, resultCode, reason: 'aborted' };
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Find transaction by hash type
|
|
203
|
+
*/
|
|
204
|
+
async findTransactionByHashType(address, hash, hashType, limit) {
|
|
205
|
+
const opts = { limit, archival: true };
|
|
206
|
+
if (hashType === 'in') {
|
|
207
|
+
return this.getTransactionByInMsgHash(address, hash, opts);
|
|
208
|
+
}
|
|
209
|
+
else if (hashType === 'out') {
|
|
210
|
+
return this.getTransactionByOutMsgHash(address, hash, opts);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
return this.getTransactionByHash(address, hash, opts);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Track transaction tree and validate all transactions
|
|
218
|
+
*/
|
|
219
|
+
async trackTransactionTree(address, hash, params = {
|
|
220
|
+
maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH,
|
|
221
|
+
ignoreOpcodeList: Consts_1.IGNORE_OPCODE,
|
|
222
|
+
limit: Consts_1.DEFAULT_FIND_TX_LIMIT,
|
|
223
|
+
direction: 'both',
|
|
224
|
+
}) {
|
|
225
|
+
const result = await this.trackTransactionTreeWithResult(address, hash, params);
|
|
226
|
+
if (!result.success && result.error) {
|
|
227
|
+
const { txHash, exitCode, resultCode, reason } = result.error;
|
|
228
|
+
throw (0, errors_1.txFinalizationError)(`${txHash}: reason= ${reason} (exitCode=${exitCode}, resultCode=${resultCode})`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Track transaction tree and validate all transactions (returns result instead of throwing)
|
|
233
|
+
*/
|
|
234
|
+
async trackTransactionTreeWithResult(address, hash, params = {
|
|
235
|
+
maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH,
|
|
236
|
+
ignoreOpcodeList: Consts_1.IGNORE_OPCODE,
|
|
237
|
+
limit: Consts_1.DEFAULT_FIND_TX_LIMIT,
|
|
238
|
+
direction: 'both',
|
|
239
|
+
}) {
|
|
240
|
+
const { maxDepth = Consts_1.DEFAULT_FIND_TX_MAX_DEPTH, ignoreOpcodeList = Consts_1.IGNORE_OPCODE, limit = Consts_1.DEFAULT_FIND_TX_LIMIT, direction = 'both', } = params;
|
|
241
|
+
const parsedAddress = ton_1.Address.parse(address);
|
|
242
|
+
const visitedHashes = new Set();
|
|
243
|
+
const queue = [{ address: parsedAddress, hash, depth: 0, hashType: 'unknown' }];
|
|
244
|
+
while (queue.length > 0) {
|
|
245
|
+
const { hash: currentHash, depth: currentDepth, address: currentAddress, hashType } = queue.shift();
|
|
246
|
+
if (visitedHashes.has(currentHash))
|
|
247
|
+
continue;
|
|
248
|
+
visitedHashes.add(currentHash);
|
|
249
|
+
this.logger?.debug(`Checking hash (depth ${currentDepth}): ${currentHash}`);
|
|
250
|
+
const tx = await this.findTransactionByHashType(currentAddress, currentHash, hashType, limit);
|
|
251
|
+
if (!tx) {
|
|
252
|
+
this.logger?.debug(`Transaction not found for hash: ${currentHash}`);
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
// Validate transaction and return error if found
|
|
256
|
+
const validationError = this.validateTransactionWithResult(tx, ignoreOpcodeList);
|
|
257
|
+
if (validationError) {
|
|
258
|
+
return { success: false, error: validationError };
|
|
259
|
+
}
|
|
260
|
+
// Add adjacent transactions to queue
|
|
261
|
+
if (currentDepth + 1 < maxDepth) {
|
|
262
|
+
if ((direction === 'forward' || direction === 'both') && tx.outMessages.size > 0) {
|
|
263
|
+
for (const msg of tx.outMessages.values()) {
|
|
264
|
+
const dst = msg.info.dest;
|
|
265
|
+
if (!dst || dst instanceof ton_1.ExternalAddress)
|
|
266
|
+
continue;
|
|
267
|
+
queue.push({
|
|
268
|
+
hash: (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(msg)).endCell().hash().toString('base64'),
|
|
269
|
+
address: dst,
|
|
270
|
+
depth: currentDepth + 1,
|
|
271
|
+
hashType: 'in',
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
// Backward: add parent (incoming message source)
|
|
276
|
+
if ((direction === 'backward' || direction === 'both') && tx.inMessage?.info.type === 'internal') {
|
|
277
|
+
queue.push({
|
|
278
|
+
hash: (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(tx.inMessage)).endCell().hash().toString('base64'),
|
|
279
|
+
address: tx.inMessage.info.src,
|
|
280
|
+
depth: currentDepth + 1,
|
|
281
|
+
hashType: 'out',
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
this.logger?.debug(`Finished checking hash (depth ${currentDepth}): ${currentHash}`);
|
|
286
|
+
}
|
|
287
|
+
return { success: true };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.BaseContractOpener = BaseContractOpener;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Address, Contract, OpenedContract, Transaction } from '@ton/ton';
|
|
2
|
+
import { AddressInformation, ContractState, GetTransactionsOptions, Network } from '../structs/Struct';
|
|
3
|
+
import { BaseContractOpener } from './BaseContractOpener';
|
|
4
|
+
type LiteServer = {
|
|
5
|
+
ip: number;
|
|
6
|
+
port: number;
|
|
7
|
+
id: {
|
|
8
|
+
'@type': string;
|
|
9
|
+
key: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare class LiteClientOpener extends BaseContractOpener {
|
|
13
|
+
private readonly client;
|
|
14
|
+
private readonly engine;
|
|
15
|
+
private constructor();
|
|
16
|
+
static create(options: {
|
|
17
|
+
liteservers: LiteServer[];
|
|
18
|
+
} | {
|
|
19
|
+
network: Network;
|
|
20
|
+
}): Promise<LiteClientOpener>;
|
|
21
|
+
open<T extends Contract>(contract: T): OpenedContract<T>;
|
|
22
|
+
closeConnections(): void;
|
|
23
|
+
getContractState(addr: Address): Promise<ContractState>;
|
|
24
|
+
getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
|
|
25
|
+
getAddressInformation(addr: Address): Promise<AddressInformation>;
|
|
26
|
+
getConfig(): Promise<string>;
|
|
27
|
+
}
|
|
28
|
+
export declare function liteClientOpener(options: {
|
|
29
|
+
liteservers: LiteServer[];
|
|
30
|
+
} | {
|
|
31
|
+
network: Network;
|
|
32
|
+
}): Promise<LiteClientOpener>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LiteClientOpener = void 0;
|
|
4
|
+
exports.liteClientOpener = liteClientOpener;
|
|
5
|
+
const ton_1 = require("@ton/ton");
|
|
6
|
+
const ton_lite_client_1 = require("@tonappchain/ton-lite-client");
|
|
7
|
+
const artifacts_1 = require("../../artifacts");
|
|
8
|
+
const Consts_1 = require("../sdk/Consts");
|
|
9
|
+
const Struct_1 = require("../structs/Struct");
|
|
10
|
+
const BaseContractOpener_1 = require("./BaseContractOpener");
|
|
11
|
+
function intToIP(int) {
|
|
12
|
+
const part1 = int & 255;
|
|
13
|
+
const part2 = (int >> 8) & 255;
|
|
14
|
+
const part3 = (int >> 16) & 255;
|
|
15
|
+
const part4 = (int >> 24) & 255;
|
|
16
|
+
return part4 + '.' + part3 + '.' + part2 + '.' + part1;
|
|
17
|
+
}
|
|
18
|
+
async function getDefaultLiteServers(network) {
|
|
19
|
+
const url = network === Struct_1.Network.TESTNET || network === Struct_1.Network.DEV
|
|
20
|
+
? artifacts_1.testnet.DEFAULT_LITESERVERS
|
|
21
|
+
: artifacts_1.mainnet.DEFAULT_LITESERVERS;
|
|
22
|
+
const resp = await fetch(url);
|
|
23
|
+
const liteClients = await resp.json();
|
|
24
|
+
return liteClients.liteservers;
|
|
25
|
+
}
|
|
26
|
+
class LiteClientOpener extends BaseContractOpener_1.BaseContractOpener {
|
|
27
|
+
constructor(client, engine) {
|
|
28
|
+
super();
|
|
29
|
+
this.client = client;
|
|
30
|
+
this.engine = engine;
|
|
31
|
+
}
|
|
32
|
+
static async create(options) {
|
|
33
|
+
const liteservers = 'liteservers' in options ? options.liteservers : await getDefaultLiteServers(options.network);
|
|
34
|
+
const engines = [];
|
|
35
|
+
for (const server of liteservers) {
|
|
36
|
+
const engine = await ton_lite_client_1.LiteSingleEngine.create({
|
|
37
|
+
host: `tcp://${intToIP(server.ip)}:${server.port}`,
|
|
38
|
+
publicKey: Buffer.from(server.id.key, 'base64'),
|
|
39
|
+
});
|
|
40
|
+
engines.push(engine);
|
|
41
|
+
}
|
|
42
|
+
const engine = new ton_lite_client_1.LiteRoundRobinEngine(engines);
|
|
43
|
+
const client = new ton_lite_client_1.LiteClient({ engine });
|
|
44
|
+
return new LiteClientOpener(client, engine);
|
|
45
|
+
}
|
|
46
|
+
open(contract) {
|
|
47
|
+
return this.client.open(contract);
|
|
48
|
+
}
|
|
49
|
+
closeConnections() {
|
|
50
|
+
this.engine.close();
|
|
51
|
+
}
|
|
52
|
+
async getContractState(addr) {
|
|
53
|
+
const block = await this.client.getMasterchainInfo();
|
|
54
|
+
const state = await this.client.getAccountState(addr, block.last);
|
|
55
|
+
const accountState = state.state?.storage?.state;
|
|
56
|
+
const code = accountState?.type === 'active' ? accountState?.state?.code?.toBoc() : null;
|
|
57
|
+
return {
|
|
58
|
+
balance: state.balance.coins,
|
|
59
|
+
state: state.state.storage.state.type === 'uninit' ? 'uninitialized' : state.state.storage.state.type,
|
|
60
|
+
code: code ?? null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async getTransactions(address, opts) {
|
|
64
|
+
// LiteClient requires valid lt and hash to fetch transactions
|
|
65
|
+
// If not provided, fetch from the latest transaction
|
|
66
|
+
let lt;
|
|
67
|
+
let hash;
|
|
68
|
+
if (opts.lt && opts.hash) {
|
|
69
|
+
lt = opts.lt;
|
|
70
|
+
hash = Buffer.from(opts.hash, 'base64');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
// Get latest transaction info first
|
|
74
|
+
const block = await this.client.getMasterchainInfo();
|
|
75
|
+
const state = await this.client.getAccountState(address, block.last);
|
|
76
|
+
if (!state.lastTx) {
|
|
77
|
+
// No transactions for this account
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
lt = state.lastTx.lt.toString();
|
|
81
|
+
hash = Buffer.from(state.lastTx.hash.toString(16).padStart(64, '0'), 'hex');
|
|
82
|
+
}
|
|
83
|
+
const txsBuffered = await this.client
|
|
84
|
+
.getAccountTransactions(address, lt, hash, opts.limit ?? Consts_1.DEFAULT_FIND_TX_LIMIT)
|
|
85
|
+
.then((r) => r.transactions);
|
|
86
|
+
const cell = ton_1.Cell.fromBoc(txsBuffered);
|
|
87
|
+
let txs = cell.map((c) => (0, ton_1.loadTransaction)(c.beginParse()));
|
|
88
|
+
// Apply to_lt filter if specified
|
|
89
|
+
if (opts.to_lt) {
|
|
90
|
+
const toLt = BigInt(opts.to_lt);
|
|
91
|
+
txs = txs.filter((tx) => {
|
|
92
|
+
const comparison = tx.lt > toLt;
|
|
93
|
+
return opts.inclusive ? tx.lt >= toLt : comparison;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return txs;
|
|
97
|
+
}
|
|
98
|
+
async getAddressInformation(addr) {
|
|
99
|
+
const block = await this.client.getMasterchainInfo();
|
|
100
|
+
const state = await this.client.getAccountState(addr, block.last);
|
|
101
|
+
return {
|
|
102
|
+
lastTransaction: {
|
|
103
|
+
lt: state.lastTx?.lt.toString() ?? '',
|
|
104
|
+
hash: Buffer.from(state.lastTx?.hash.toString(16) ?? '', 'hex').toString('base64'),
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async getConfig() {
|
|
109
|
+
const block = await this.client.getMasterchainInfo();
|
|
110
|
+
const { config } = await this.client.getConfig(block.last);
|
|
111
|
+
return (0, ton_1.beginCell)().storeDictDirect(config).endCell().toBoc().toString('base64');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.LiteClientOpener = LiteClientOpener;
|
|
115
|
+
async function liteClientOpener(options) {
|
|
116
|
+
return LiteClientOpener.create(options);
|
|
117
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Network } from '../structs/Struct';
|
|
2
|
+
export declare function getHttpEndpointWithRetry(network: Network, maxRetries?: number, delay?: number): Promise<string>;
|
|
3
|
+
export declare function getHttpV4EndpointWithRetry(network: Network, maxRetries?: number, delay?: number): Promise<string>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHttpEndpointWithRetry = getHttpEndpointWithRetry;
|
|
4
|
+
exports.getHttpV4EndpointWithRetry = getHttpV4EndpointWithRetry;
|
|
5
|
+
const ton_access_1 = require("@orbs-network/ton-access");
|
|
6
|
+
const Utils_1 = require("../sdk/Utils");
|
|
7
|
+
const Struct_1 = require("../structs/Struct");
|
|
8
|
+
async function getHttpEndpointWithRetry(network, maxRetries = 5, delay = 1000) {
|
|
9
|
+
let lastError;
|
|
10
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
11
|
+
try {
|
|
12
|
+
const tonNetwork = network === Struct_1.Network.MAINNET ? 'mainnet' : 'testnet';
|
|
13
|
+
return await (0, ton_access_1.getHttpEndpoint)({ network: tonNetwork });
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
lastError = error;
|
|
17
|
+
if (attempt < maxRetries - 1) {
|
|
18
|
+
await (0, Utils_1.sleep)(delay);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
throw lastError || new Error('Failed to get HTTP endpoint after retries');
|
|
23
|
+
}
|
|
24
|
+
async function getHttpV4EndpointWithRetry(network, maxRetries = 5, delay = 1000) {
|
|
25
|
+
let lastError;
|
|
26
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
27
|
+
try {
|
|
28
|
+
const tonNetwork = network === Struct_1.Network.MAINNET ? 'mainnet' : 'testnet';
|
|
29
|
+
return await (0, ton_access_1.getHttpV4Endpoint)({ network: tonNetwork });
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
lastError = error;
|
|
33
|
+
if (attempt < maxRetries - 1) {
|
|
34
|
+
await (0, Utils_1.sleep)(delay);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
throw lastError || new Error('Failed to get HTTP V4 endpoint after retries');
|
|
39
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SandboxContract } from '@ton/sandbox';
|
|
2
|
+
import { Address, Contract, OpenedContract, Transaction } from '@ton/ton';
|
|
3
|
+
import { ContractOpener, ILogger } from '../interfaces';
|
|
4
|
+
import { AddressInformation, ContractState, GetTransactionsOptions, Network, TrackTransactionTreeParams, TrackTransactionTreeResult } from '../structs/Struct';
|
|
5
|
+
export interface OpenerConfig {
|
|
6
|
+
/** Underlying opener implementation to use for this slot. */
|
|
7
|
+
opener: ContractOpener;
|
|
8
|
+
/** Number of retry attempts before falling back to the next opener. */
|
|
9
|
+
retries: number;
|
|
10
|
+
/** Delay in milliseconds between retries for this opener. */
|
|
11
|
+
retryDelay: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class RetryableContractOpener implements ContractOpener {
|
|
14
|
+
private readonly openerConfigs;
|
|
15
|
+
private logger?;
|
|
16
|
+
constructor(openerConfigs: OpenerConfig[], logger?: ILogger);
|
|
17
|
+
getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
|
|
18
|
+
getTransactionByHash(address: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
19
|
+
getAdjacentTransactions(address: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction[]>;
|
|
20
|
+
open<T extends Contract>(src: T): OpenedContract<T> | SandboxContract<T>;
|
|
21
|
+
getContractState(address: Address): Promise<ContractState>;
|
|
22
|
+
getAddressInformation(address: Address): Promise<AddressInformation>;
|
|
23
|
+
getConfig(): Promise<string>;
|
|
24
|
+
getTransactionByTxHash(address: Address, txHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
25
|
+
getTransactionByInMsgHash(address: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
26
|
+
getTransactionByOutMsgHash(address: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
27
|
+
closeConnections(): void;
|
|
28
|
+
trackTransactionTree(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<void>;
|
|
29
|
+
trackTransactionTreeWithResult(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<TrackTransactionTreeResult>;
|
|
30
|
+
private executeWithFallback;
|
|
31
|
+
private tryWithRetries;
|
|
32
|
+
private createRetryableContract;
|
|
33
|
+
private callMethodAcrossOpeners;
|
|
34
|
+
}
|
|
35
|
+
export declare function createDefaultRetryableOpener(tonRpcEndpoint: string, networkType: Network, maxRetries?: number, retryDelay?: number, logger?: ILogger): Promise<RetryableContractOpener>;
|