@tonappchain/sdk 0.7.0-rc9 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +198 -191
  3. package/dist/artifacts/dev/index.d.ts +9 -0
  4. package/dist/artifacts/dev/index.js +52 -0
  5. package/dist/artifacts/dev/tac/addresses.d.ts +4 -0
  6. package/dist/artifacts/dev/tac/addresses.js +8 -0
  7. package/dist/artifacts/dev/tac/artifacts.d.ts +330 -0
  8. package/dist/artifacts/dev/tac/artifacts.js +26 -0
  9. package/dist/artifacts/dev/tac/endpoints.d.ts +2 -0
  10. package/dist/artifacts/dev/tac/endpoints.js +5 -0
  11. package/dist/artifacts/dev/tac/index.d.ts +6 -0
  12. package/dist/artifacts/dev/tac/index.js +43 -0
  13. package/dist/artifacts/dev/tac/internal/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +296 -0
  14. package/dist/artifacts/dev/tac/internal/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
  15. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +114 -0
  16. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +194 -0
  17. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +164 -0
  18. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC20.sol/ICrossChainLayerERC20.json +278 -0
  19. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC721.sol/ICrossChainLayerERC721.json +380 -0
  20. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/tokens/IERC20WithDecimals.sol/IERC20WithDecimals.json +207 -0
  21. package/dist/artifacts/dev/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +103 -0
  22. package/dist/artifacts/dev/tac/internal/artifacts/contracts/smart-account/interfaces/ITacSmartAccount.sol/ITacSmartAccount.json +181 -0
  23. package/dist/artifacts/dev/tac/internal/scripts/utils/encoding.d.ts +4 -0
  24. package/dist/artifacts/dev/tac/internal/scripts/utils/encoding.js +18 -0
  25. package/dist/artifacts/dev/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +199 -0
  26. package/dist/artifacts/dev/tac/internal/typechain-types/common.d.ts +50 -0
  27. package/dist/artifacts/dev/tac/internal/typechain-types/common.js +2 -0
  28. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
  29. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -0
  30. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +75 -0
  31. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.js +2 -0
  32. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +123 -0
  33. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ISettings.js +2 -0
  34. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +99 -0
  35. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.js +2 -0
  36. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.d.ts +182 -0
  37. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.js +2 -0
  38. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.d.ts +244 -0
  39. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.js +2 -0
  40. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.d.ts +133 -0
  41. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.js +2 -0
  42. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +77 -0
  43. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.js +2 -0
  44. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.d.ts +127 -0
  45. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.js +2 -0
  46. package/dist/artifacts/dev/tac/multicall.d.ts +1 -0
  47. package/dist/artifacts/dev/tac/multicall.js +22 -0
  48. package/dist/artifacts/dev/tac/structs.d.ts +1 -0
  49. package/dist/artifacts/dev/tac/structs.js +2 -0
  50. package/dist/artifacts/dev/tac/utils.d.ts +1 -0
  51. package/dist/artifacts/dev/tac/utils.js +5 -0
  52. package/dist/artifacts/dev/tac/wrappers.d.ts +9 -0
  53. package/dist/artifacts/dev/tac/wrappers.js +2 -0
  54. package/dist/artifacts/dev/ton/addresses.d.ts +1 -0
  55. package/dist/artifacts/dev/ton/addresses.js +5 -0
  56. package/dist/artifacts/dev/ton/artifacts.d.ts +47 -0
  57. package/dist/artifacts/dev/ton/artifacts.js +26 -0
  58. package/dist/artifacts/dev/ton/endpoints.d.ts +3 -0
  59. package/dist/artifacts/dev/ton/endpoints.js +6 -0
  60. package/dist/artifacts/dev/ton/index.d.ts +3 -0
  61. package/dist/artifacts/dev/ton/index.js +40 -0
  62. package/dist/artifacts/dev/ton/internal/build/CrossChainLayer.compiled.json +1 -0
  63. package/dist/artifacts/dev/ton/internal/build/Executor.compiled.json +1 -0
  64. package/dist/artifacts/dev/ton/internal/build/JettonMinter.compiled.json +1 -0
  65. package/dist/artifacts/dev/ton/internal/build/JettonProxy.compiled.json +1 -0
  66. package/dist/artifacts/dev/ton/internal/build/JettonWallet.compiled.json +1 -0
  67. package/dist/artifacts/dev/ton/internal/build/NFTCollection.compiled.json +1 -0
  68. package/dist/artifacts/dev/ton/internal/build/NFTItem.compiled.json +1 -0
  69. package/dist/artifacts/dev/ton/internal/build/NFTProxy.compiled.json +1 -0
  70. package/dist/artifacts/dev/ton/internal/build/Settings.compiled.json +1 -0
  71. package/dist/artifacts/dev/ton/internal/wrappers/Constants.d.ts +56 -0
  72. package/dist/artifacts/dev/ton/internal/wrappers/Constants.js +62 -0
  73. package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.d.ts +164 -0
  74. package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.js +336 -0
  75. package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.d.ts +94 -0
  76. package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.js +202 -0
  77. package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.d.ts +80 -0
  78. package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.js +158 -0
  79. package/dist/{wrappers → artifacts/dev/ton/internal/wrappers}/JettonWallet.d.ts +52 -13
  80. package/dist/artifacts/dev/ton/internal/wrappers/JettonWallet.js +193 -0
  81. package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.d.ts +75 -0
  82. package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.js +151 -0
  83. package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.d.ts +82 -0
  84. package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.js +148 -0
  85. package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.d.ts +84 -0
  86. package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.js +157 -0
  87. package/dist/artifacts/dev/ton/internal/wrappers/Settings.d.ts +80 -0
  88. package/dist/artifacts/dev/ton/internal/wrappers/Settings.js +152 -0
  89. package/dist/artifacts/dev/ton/internal/wrappers/utils/GasUtils.d.ts +79 -0
  90. package/dist/artifacts/dev/ton/internal/wrappers/utils/GasUtils.js +291 -0
  91. package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.d.ts +7 -0
  92. package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.js +27 -0
  93. package/dist/artifacts/dev/ton/wrappers.d.ts +8 -0
  94. package/dist/artifacts/dev/ton/wrappers.js +27 -0
  95. package/dist/artifacts/index.d.ts +3 -0
  96. package/dist/artifacts/index.js +39 -0
  97. package/dist/artifacts/mainnet/index.d.ts +9 -0
  98. package/dist/artifacts/mainnet/index.js +52 -0
  99. package/dist/artifacts/mainnet/tac/addresses.d.ts +4 -0
  100. package/dist/artifacts/mainnet/tac/addresses.js +7 -0
  101. package/dist/artifacts/mainnet/tac/artifacts.d.ts +330 -0
  102. package/dist/artifacts/mainnet/tac/artifacts.js +26 -0
  103. package/dist/artifacts/mainnet/tac/endpoints.d.ts +2 -0
  104. package/dist/artifacts/mainnet/tac/endpoints.js +5 -0
  105. package/dist/artifacts/mainnet/tac/index.d.ts +6 -0
  106. package/dist/artifacts/mainnet/tac/index.js +43 -0
  107. package/dist/artifacts/mainnet/tac/internal/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +296 -0
  108. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
  109. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +114 -0
  110. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +194 -0
  111. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +164 -0
  112. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC20.sol/ICrossChainLayerERC20.json +278 -0
  113. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC721.sol/ICrossChainLayerERC721.json +380 -0
  114. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/tokens/IERC20WithDecimals.sol/IERC20WithDecimals.json +207 -0
  115. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +103 -0
  116. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/smart-account/interfaces/ITacSmartAccount.sol/ITacSmartAccount.json +181 -0
  117. package/dist/artifacts/mainnet/tac/internal/scripts/utils/encoding.d.ts +4 -0
  118. package/dist/artifacts/mainnet/tac/internal/scripts/utils/encoding.js +18 -0
  119. package/dist/artifacts/mainnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +199 -0
  120. package/dist/artifacts/mainnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.js +2 -0
  121. package/dist/artifacts/mainnet/tac/internal/typechain-types/common.d.ts +50 -0
  122. package/dist/artifacts/mainnet/tac/internal/typechain-types/common.js +2 -0
  123. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
  124. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -0
  125. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +75 -0
  126. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.js +2 -0
  127. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +123 -0
  128. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ISettings.js +2 -0
  129. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +99 -0
  130. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.js +2 -0
  131. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.d.ts +182 -0
  132. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.js +2 -0
  133. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.d.ts +244 -0
  134. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.js +2 -0
  135. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.d.ts +133 -0
  136. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.js +2 -0
  137. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +77 -0
  138. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.js +2 -0
  139. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.d.ts +127 -0
  140. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.js +2 -0
  141. package/dist/artifacts/mainnet/tac/multicall.d.ts +1 -0
  142. package/dist/artifacts/mainnet/tac/multicall.js +22 -0
  143. package/dist/artifacts/mainnet/tac/structs.d.ts +1 -0
  144. package/dist/artifacts/mainnet/tac/structs.js +2 -0
  145. package/dist/artifacts/mainnet/tac/utils.d.ts +1 -0
  146. package/dist/artifacts/mainnet/tac/utils.js +5 -0
  147. package/dist/artifacts/mainnet/tac/wrappers.d.ts +9 -0
  148. package/dist/artifacts/mainnet/tac/wrappers.js +2 -0
  149. package/dist/artifacts/mainnet/ton/addresses.d.ts +1 -0
  150. package/dist/artifacts/mainnet/ton/addresses.js +4 -0
  151. package/dist/artifacts/mainnet/ton/artifacts.d.ts +47 -0
  152. package/dist/artifacts/mainnet/ton/artifacts.js +26 -0
  153. package/dist/artifacts/mainnet/ton/endpoints.d.ts +3 -0
  154. package/dist/artifacts/mainnet/ton/endpoints.js +6 -0
  155. package/dist/artifacts/mainnet/ton/index.d.ts +3 -0
  156. package/dist/artifacts/mainnet/ton/index.js +40 -0
  157. package/dist/artifacts/mainnet/ton/internal/build/CrossChainLayer.compiled.json +1 -0
  158. package/dist/artifacts/mainnet/ton/internal/build/Executor.compiled.json +1 -0
  159. package/dist/artifacts/mainnet/ton/internal/build/JettonMinter.compiled.json +1 -0
  160. package/dist/artifacts/mainnet/ton/internal/build/JettonProxy.compiled.json +1 -0
  161. package/dist/artifacts/mainnet/ton/internal/build/JettonWallet.compiled.json +1 -0
  162. package/dist/artifacts/mainnet/ton/internal/build/NFTCollection.compiled.json +1 -0
  163. package/dist/artifacts/mainnet/ton/internal/build/NFTItem.compiled.json +1 -0
  164. package/dist/artifacts/mainnet/ton/internal/build/NFTProxy.compiled.json +1 -0
  165. package/dist/artifacts/mainnet/ton/internal/build/Settings.compiled.json +1 -0
  166. package/dist/artifacts/mainnet/ton/internal/wrappers/Constants.d.ts +56 -0
  167. package/dist/artifacts/mainnet/ton/internal/wrappers/Constants.js +62 -0
  168. package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.d.ts +164 -0
  169. package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.js +336 -0
  170. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.d.ts +94 -0
  171. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.js +202 -0
  172. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonProxy.d.ts +80 -0
  173. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonProxy.js +158 -0
  174. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonWallet.d.ts +95 -0
  175. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonWallet.js +193 -0
  176. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTCollection.d.ts +75 -0
  177. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTCollection.js +151 -0
  178. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTItem.d.ts +82 -0
  179. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTItem.js +148 -0
  180. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTProxy.d.ts +84 -0
  181. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTProxy.js +157 -0
  182. package/dist/artifacts/mainnet/ton/internal/wrappers/Settings.d.ts +80 -0
  183. package/dist/artifacts/mainnet/ton/internal/wrappers/Settings.js +152 -0
  184. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/GasUtils.d.ts +79 -0
  185. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/GasUtils.js +291 -0
  186. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +7 -0
  187. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/MerkleRoots.js +27 -0
  188. package/dist/artifacts/mainnet/ton/wrappers.d.ts +8 -0
  189. package/dist/artifacts/mainnet/ton/wrappers.js +27 -0
  190. package/dist/artifacts/tacTypes.d.ts +13 -0
  191. package/dist/artifacts/tacTypes.js +2 -0
  192. package/dist/artifacts/testnet/index.d.ts +9 -0
  193. package/dist/artifacts/testnet/index.js +52 -0
  194. package/dist/artifacts/testnet/tac/addresses.d.ts +4 -0
  195. package/dist/artifacts/testnet/tac/addresses.js +7 -0
  196. package/dist/artifacts/testnet/tac/artifacts.d.ts +330 -0
  197. package/dist/artifacts/testnet/tac/artifacts.js +26 -0
  198. package/dist/artifacts/testnet/tac/endpoints.d.ts +2 -0
  199. package/dist/artifacts/testnet/tac/endpoints.js +5 -0
  200. package/dist/artifacts/testnet/tac/index.d.ts +6 -0
  201. package/dist/artifacts/testnet/tac/index.js +43 -0
  202. package/dist/artifacts/testnet/tac/internal/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +296 -0
  203. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
  204. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +114 -0
  205. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +194 -0
  206. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +164 -0
  207. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC20.sol/ICrossChainLayerERC20.json +278 -0
  208. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC721.sol/ICrossChainLayerERC721.json +380 -0
  209. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/tokens/IERC20WithDecimals.sol/IERC20WithDecimals.json +207 -0
  210. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +103 -0
  211. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/smart-account/interfaces/ITacSmartAccount.sol/ITacSmartAccount.json +181 -0
  212. package/dist/artifacts/testnet/tac/internal/scripts/utils/encoding.d.ts +4 -0
  213. package/dist/artifacts/testnet/tac/internal/scripts/utils/encoding.js +18 -0
  214. package/dist/artifacts/testnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +199 -0
  215. package/dist/artifacts/testnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.js +2 -0
  216. package/dist/artifacts/testnet/tac/internal/typechain-types/common.d.ts +50 -0
  217. package/dist/artifacts/testnet/tac/internal/typechain-types/common.js +2 -0
  218. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
  219. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -0
  220. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +75 -0
  221. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.js +2 -0
  222. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +123 -0
  223. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ISettings.js +2 -0
  224. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +99 -0
  225. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.js +2 -0
  226. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.d.ts +182 -0
  227. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.js +2 -0
  228. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.d.ts +244 -0
  229. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.js +2 -0
  230. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.d.ts +133 -0
  231. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.js +2 -0
  232. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +77 -0
  233. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.js +2 -0
  234. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.d.ts +127 -0
  235. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.js +2 -0
  236. package/dist/artifacts/testnet/tac/multicall.d.ts +1 -0
  237. package/dist/artifacts/testnet/tac/multicall.js +22 -0
  238. package/dist/artifacts/testnet/tac/structs.d.ts +1 -0
  239. package/dist/artifacts/testnet/tac/structs.js +2 -0
  240. package/dist/artifacts/testnet/tac/utils.d.ts +1 -0
  241. package/dist/artifacts/testnet/tac/utils.js +5 -0
  242. package/dist/artifacts/testnet/tac/wrappers.d.ts +9 -0
  243. package/dist/artifacts/testnet/tac/wrappers.js +2 -0
  244. package/dist/artifacts/testnet/ton/addresses.d.ts +1 -0
  245. package/dist/artifacts/testnet/ton/addresses.js +4 -0
  246. package/dist/artifacts/testnet/ton/artifacts.d.ts +47 -0
  247. package/dist/artifacts/testnet/ton/artifacts.js +26 -0
  248. package/dist/artifacts/testnet/ton/endpoints.d.ts +3 -0
  249. package/dist/artifacts/testnet/ton/endpoints.js +6 -0
  250. package/dist/artifacts/testnet/ton/index.d.ts +3 -0
  251. package/dist/artifacts/testnet/ton/index.js +40 -0
  252. package/dist/artifacts/testnet/ton/internal/build/CrossChainLayer.compiled.json +1 -0
  253. package/dist/artifacts/testnet/ton/internal/build/Executor.compiled.json +1 -0
  254. package/dist/artifacts/testnet/ton/internal/build/JettonMinter.compiled.json +1 -0
  255. package/dist/artifacts/testnet/ton/internal/build/JettonProxy.compiled.json +1 -0
  256. package/dist/artifacts/testnet/ton/internal/build/JettonWallet.compiled.json +1 -0
  257. package/dist/artifacts/testnet/ton/internal/build/NFTCollection.compiled.json +1 -0
  258. package/dist/artifacts/testnet/ton/internal/build/NFTItem.compiled.json +1 -0
  259. package/dist/artifacts/testnet/ton/internal/build/NFTProxy.compiled.json +1 -0
  260. package/dist/artifacts/testnet/ton/internal/build/Settings.compiled.json +1 -0
  261. package/dist/artifacts/testnet/ton/internal/wrappers/Constants.d.ts +56 -0
  262. package/dist/artifacts/testnet/ton/internal/wrappers/Constants.js +62 -0
  263. package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.d.ts +164 -0
  264. package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.js +336 -0
  265. package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +94 -0
  266. package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +202 -0
  267. package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.d.ts +80 -0
  268. package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.js +158 -0
  269. package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.d.ts +95 -0
  270. package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.js +193 -0
  271. package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.d.ts +75 -0
  272. package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.js +151 -0
  273. package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.d.ts +82 -0
  274. package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.js +148 -0
  275. package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.d.ts +84 -0
  276. package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.js +157 -0
  277. package/dist/artifacts/testnet/ton/internal/wrappers/Settings.d.ts +80 -0
  278. package/dist/artifacts/testnet/ton/internal/wrappers/Settings.js +152 -0
  279. package/dist/artifacts/testnet/ton/internal/wrappers/utils/GasUtils.d.ts +79 -0
  280. package/dist/artifacts/testnet/ton/internal/wrappers/utils/GasUtils.js +291 -0
  281. package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +7 -0
  282. package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.js +27 -0
  283. package/dist/artifacts/testnet/ton/wrappers.d.ts +8 -0
  284. package/dist/artifacts/testnet/ton/wrappers.js +27 -0
  285. package/dist/artifacts/tonTypes.d.ts +20 -0
  286. package/dist/artifacts/tonTypes.js +2 -0
  287. package/dist/{adapters → src/adapters}/contractOpener.d.ts +2 -1
  288. package/dist/{adapters → src/adapters}/contractOpener.js +39 -6
  289. package/dist/src/adapters/index.d.ts +2 -0
  290. package/dist/src/adapters/index.js +18 -0
  291. package/dist/{adapters → src/adapters}/retryableContractOpener.d.ts +6 -3
  292. package/dist/{adapters → src/adapters}/retryableContractOpener.js +10 -11
  293. package/dist/src/agnosticSdk/AbiHandler.d.ts +27 -0
  294. package/dist/src/agnosticSdk/AbiHandler.js +137 -0
  295. package/dist/src/agnosticSdk/AgnosticSdk.d.ts +201 -0
  296. package/dist/src/agnosticSdk/AgnosticSdk.js +201 -0
  297. package/dist/src/agnosticSdk/AgnosticStructs.d.ts +108 -0
  298. package/dist/src/agnosticSdk/AgnosticStructs.js +23 -0
  299. package/dist/src/agnosticSdk/DebugHelpers.d.ts +88 -0
  300. package/dist/src/agnosticSdk/DebugHelpers.js +274 -0
  301. package/dist/src/agnosticSdk/HooksHandler.d.ts +43 -0
  302. package/dist/src/agnosticSdk/HooksHandler.js +102 -0
  303. package/dist/src/agnosticSdk/ReplacementHelper.d.ts +95 -0
  304. package/dist/src/agnosticSdk/ReplacementHelper.js +235 -0
  305. package/dist/{assets → src/assets}/AssetCache.d.ts +1 -1
  306. package/dist/{assets → src/assets}/AssetFactory.d.ts +2 -2
  307. package/dist/{assets → src/assets}/AssetFactory.js +1 -1
  308. package/dist/{assets → src/assets}/FT.d.ts +14 -17
  309. package/dist/{assets → src/assets}/FT.js +94 -58
  310. package/dist/{assets → src/assets}/NFT.d.ts +15 -16
  311. package/dist/{assets → src/assets}/NFT.js +58 -32
  312. package/dist/{assets → src/assets}/TON.d.ts +7 -13
  313. package/dist/{assets → src/assets}/TON.js +22 -20
  314. package/dist/src/errors/index.d.ts +2 -0
  315. package/dist/{errors → src/errors}/index.js +8 -2
  316. package/dist/{errors → src/errors}/instances.d.ts +11 -1
  317. package/dist/src/errors/instances.js +58 -0
  318. package/dist/src/index.d.ts +21 -0
  319. package/dist/{index.js → src/index.js} +38 -18
  320. package/dist/src/interfaces/Asset.d.ts +78 -0
  321. package/dist/src/interfaces/Asset.js +2 -0
  322. package/dist/src/interfaces/ContractOpener.d.ts +21 -0
  323. package/dist/src/interfaces/ContractOpener.js +2 -0
  324. package/dist/src/interfaces/IConfiguration.d.ts +35 -0
  325. package/dist/src/interfaces/IConfiguration.js +2 -0
  326. package/dist/src/interfaces/IHttpClient.d.ts +16 -0
  327. package/dist/src/interfaces/IHttpClient.js +2 -0
  328. package/dist/src/interfaces/ILiteSequencerClient.d.ts +43 -0
  329. package/dist/src/interfaces/ILiteSequencerClient.js +2 -0
  330. package/dist/src/interfaces/ILiteSequencerClientFactory.d.ts +9 -0
  331. package/dist/src/interfaces/ILiteSequencerClientFactory.js +2 -0
  332. package/dist/src/interfaces/ILogger.d.ts +10 -0
  333. package/dist/src/interfaces/ILogger.js +2 -0
  334. package/dist/src/interfaces/IOperationTracker.d.ts +81 -0
  335. package/dist/src/interfaces/IOperationTracker.js +2 -0
  336. package/dist/src/interfaces/ISimulator.d.ts +18 -0
  337. package/dist/src/interfaces/ISimulator.js +2 -0
  338. package/dist/src/interfaces/ITACTransactionManager.d.ts +15 -0
  339. package/dist/src/interfaces/ITACTransactionManager.js +2 -0
  340. package/dist/src/interfaces/ITONTransactionManager.d.ts +20 -0
  341. package/dist/src/interfaces/ITONTransactionManager.js +2 -0
  342. package/dist/src/interfaces/ITacSDK.d.ts +185 -0
  343. package/dist/src/interfaces/ITacSDK.js +2 -0
  344. package/dist/src/interfaces/SenderAbstraction.d.ts +35 -0
  345. package/dist/src/interfaces/SenderAbstraction.js +2 -0
  346. package/dist/src/interfaces/WalletInstanse.d.ts +20 -0
  347. package/dist/src/interfaces/WalletInstanse.js +2 -0
  348. package/dist/src/interfaces/index.d.ts +14 -0
  349. package/dist/src/interfaces/index.js +30 -0
  350. package/dist/src/sdk/AxiosHttpClient.d.ts +12 -0
  351. package/dist/src/sdk/AxiosHttpClient.js +23 -0
  352. package/dist/{sdk → src/sdk}/Configuration.d.ts +6 -5
  353. package/dist/src/sdk/Configuration.js +195 -0
  354. package/dist/{sdk → src/sdk}/Consts.d.ts +3 -0
  355. package/dist/{sdk → src/sdk}/Consts.js +4 -1
  356. package/dist/src/sdk/LiteSequencerClient.d.ts +18 -0
  357. package/dist/{sdk → src/sdk}/LiteSequencerClient.js +81 -25
  358. package/dist/{sdk → src/sdk}/Logger.d.ts +5 -5
  359. package/dist/{sdk → src/sdk}/Logger.js +12 -4
  360. package/dist/{sdk → src/sdk}/OperationTracker.d.ts +5 -13
  361. package/dist/{sdk → src/sdk}/OperationTracker.js +112 -16
  362. package/dist/src/sdk/Simulator.d.ts +11 -0
  363. package/dist/src/sdk/Simulator.js +70 -0
  364. package/dist/{sdk → src/sdk}/StartTracking.d.ts +1 -1
  365. package/dist/src/sdk/TACTransactionManager.d.ts +10 -0
  366. package/dist/src/sdk/TACTransactionManager.js +101 -0
  367. package/dist/src/sdk/TONTransactionManager.d.ts +17 -0
  368. package/dist/src/sdk/TONTransactionManager.js +220 -0
  369. package/dist/src/sdk/TacSdk.d.ts +44 -0
  370. package/dist/src/sdk/TacSdk.js +181 -0
  371. package/dist/{sdk → src/sdk}/TxFinalizer.d.ts +3 -2
  372. package/dist/{sdk → src/sdk}/TxFinalizer.js +13 -8
  373. package/dist/{sdk → src/sdk}/Utils.d.ts +14 -7
  374. package/dist/{sdk → src/sdk}/Utils.js +127 -34
  375. package/dist/{sdk → src/sdk}/Validator.d.ts +2 -2
  376. package/dist/{sdk → src/sdk}/Validator.js +6 -6
  377. package/dist/{sender → src/sender}/BatchSender.d.ts +1 -2
  378. package/dist/{sender → src/sender}/RawSender.d.ts +3 -3
  379. package/dist/{sender → src/sender}/SenderFactory.d.ts +1 -1
  380. package/dist/{sender → src/sender}/SenderFactory.js +1 -1
  381. package/dist/{sender → src/sender}/TonConnectSender.d.ts +2 -2
  382. package/dist/{sender → src/sender}/TonConnectSender.js +3 -3
  383. package/dist/{sender → src/sender}/index.d.ts +1 -1
  384. package/dist/{sender → src/sender}/index.js +1 -1
  385. package/dist/{structs → src/structs}/InternalStruct.d.ts +30 -6
  386. package/dist/{structs → src/structs}/Struct.d.ts +109 -62
  387. package/dist/{structs → src/structs}/Struct.js +7 -1
  388. package/dist/{wrappers → src/wrappers}/ContentUtils.js +0 -1
  389. package/dist/{wrappers → src/wrappers}/HighloadWalletV3.d.ts +2 -2
  390. package/package.json +57 -6
  391. package/dist/errors/index.d.ts +0 -2
  392. package/dist/errors/instances.js +0 -47
  393. package/dist/index.d.ts +0 -19
  394. package/dist/sdk/Configuration.js +0 -90
  395. package/dist/sdk/LiteSequencerClient.d.ts +0 -13
  396. package/dist/sdk/Simulator.d.ts +0 -23
  397. package/dist/sdk/Simulator.js +0 -169
  398. package/dist/sdk/TacSdk.d.ts +0 -32
  399. package/dist/sdk/TacSdk.js +0 -154
  400. package/dist/sdk/TransactionManager.d.ts +0 -22
  401. package/dist/sdk/TransactionManager.js +0 -269
  402. package/dist/sender/SenderAbstraction.d.ts +0 -22
  403. package/dist/sender/SenderAbstraction.js +0 -5
  404. package/dist/structs/Services.d.ts +0 -66
  405. package/dist/wrappers/JettonMaster.d.ts +0 -24
  406. package/dist/wrappers/JettonMaster.js +0 -53
  407. package/dist/wrappers/JettonWallet.js +0 -124
  408. package/dist/wrappers/Settings.d.ts +0 -10
  409. package/dist/wrappers/Settings.js +0 -38
  410. /package/dist/{structs/Services.js → artifacts/dev/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.js} +0 -0
  411. /package/dist/{assets → src/assets}/AssetCache.js +0 -0
  412. /package/dist/{assets → src/assets}/index.d.ts +0 -0
  413. /package/dist/{assets → src/assets}/index.js +0 -0
  414. /package/dist/{errors → src/errors}/errors.d.ts +0 -0
  415. /package/dist/{errors → src/errors}/errors.js +0 -0
  416. /package/dist/{sdk → src/sdk}/StartTracking.js +0 -0
  417. /package/dist/{sender → src/sender}/BatchSender.js +0 -0
  418. /package/dist/{sender → src/sender}/RawSender.js +0 -0
  419. /package/dist/{structs → src/structs}/InternalStruct.js +0 -0
  420. /package/dist/{wrappers → src/wrappers}/ContentUtils.d.ts +0 -0
  421. /package/dist/{wrappers → src/wrappers}/HighloadQueryId.d.ts +0 -0
  422. /package/dist/{wrappers → src/wrappers}/HighloadQueryId.js +0 -0
  423. /package/dist/{wrappers → src/wrappers}/HighloadWalletV3.js +0 -0
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DebugHelpers = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const AgnosticStructs_1 = require("./AgnosticStructs");
6
+ class DebugHelpers {
7
+ /**
8
+ * Build a complete ZapCall
9
+ * @param hooks - The hooks of the zap call
10
+ * @param bridgeTokens - The tokens to bridge
11
+ * @param bridgeNFTs - The nfts to bridge
12
+ * @returns The zap call
13
+ */
14
+ buildZapCall(hooks, bridgeTokens = [], bridgeNFTs = []) {
15
+ return {
16
+ hooks,
17
+ bridgeData: {
18
+ tokens: bridgeTokens,
19
+ nfts: bridgeNFTs,
20
+ isRequired: bridgeTokens.length > 0 || bridgeNFTs.length > 0,
21
+ },
22
+ };
23
+ }
24
+ /**
25
+ * Debug helper: Decode hook data back to readable format
26
+ * @param hook - The hook to decode
27
+ * @returns The decoded hook
28
+ */
29
+ decodeHookData(hook) {
30
+ try {
31
+ switch (hook.hookType) {
32
+ case AgnosticStructs_1.HookType.Custom:
33
+ return ethers_1.ethers.AbiCoder.defaultAbiCoder().decode(['tuple(bool,address,uint256,bytes,bytes)'], hook.hookData)[0];
34
+ case AgnosticStructs_1.HookType.FullBalanceApprove:
35
+ return ethers_1.ethers.AbiCoder.defaultAbiCoder().decode(['tuple(address,address,bool)'], hook.hookData)[0];
36
+ case AgnosticStructs_1.HookType.FullBalanceTransfer:
37
+ return ethers_1.ethers.AbiCoder.defaultAbiCoder().decode(['tuple(address,address,bool)'], hook.hookData)[0];
38
+ default:
39
+ throw new Error(`Unknown hook type: ${hook.hookType}`);
40
+ }
41
+ }
42
+ catch (error) {
43
+ throw new Error(`Failed to decode hook data: ${error}`);
44
+ }
45
+ }
46
+ /**
47
+ * Debug helper: Get estimated gas for a ZapCall
48
+ * @param zapCall - The zap call to estimate the gas usage for
49
+ * @returns The estimated gas usage
50
+ */
51
+ estimateGasUsage(zapCall) {
52
+ // Rough estimation based on hook types and operations
53
+ let gasEstimate = 50000; // Base gas
54
+ zapCall.hooks.forEach((hook) => {
55
+ switch (hook.hookType) {
56
+ case AgnosticStructs_1.HookType.Custom:
57
+ gasEstimate += 100000; // Custom calls can vary widely
58
+ break;
59
+ case AgnosticStructs_1.HookType.FullBalanceApprove:
60
+ gasEstimate += 50000; // ERC20 approve
61
+ break;
62
+ case AgnosticStructs_1.HookType.FullBalanceTransfer:
63
+ gasEstimate += 65000; // ERC20 transfer
64
+ break;
65
+ }
66
+ });
67
+ if (zapCall.bridgeData.isRequired) {
68
+ gasEstimate += 200000; // Bridge operations
69
+ }
70
+ return gasEstimate;
71
+ }
72
+ /**
73
+ * Visualize ZapCall chain - Human readable description of all operations
74
+ * @param zapCall - The zap call to visualize
75
+ */
76
+ visualizeZapCall(zapCall, contractInterfaces) {
77
+ console.log('🔗 ZapCall Chain Visualization');
78
+ console.log('================================');
79
+ if (zapCall.hooks.length === 0) {
80
+ console.log('❌ No hooks in this ZapCall');
81
+ return;
82
+ }
83
+ zapCall.hooks.forEach((hook, index) => {
84
+ const stepNumber = (index + 1).toString().padStart(2, ' ');
85
+ console.log(`\n${stepNumber}. ${this._describeHook(hook, contractInterfaces)}`);
86
+ });
87
+ // Bridge information
88
+ if (zapCall.bridgeData.isRequired) {
89
+ console.log('\n🌉 Bridge Operations:');
90
+ if (zapCall.bridgeData.tokens.length > 0) {
91
+ console.log(` 📤 Bridge tokens: ${zapCall.bridgeData.tokens.map((t) => this._formatAddress(t)).join(', ')}`);
92
+ }
93
+ if (zapCall.bridgeData.nfts.length > 0) {
94
+ console.log(` 🖼️ Bridge NFTs: ${zapCall.bridgeData.nfts.length} NFT(s)`);
95
+ zapCall.bridgeData.nfts.forEach((nft, i) => {
96
+ console.log(` ${i + 1}. ${this._formatAddress(nft.nft)} #${nft.id} (amount: ${nft.amount})`);
97
+ });
98
+ }
99
+ }
100
+ else {
101
+ console.log('\n🚫 No bridge operations required');
102
+ }
103
+ // Summary
104
+ console.log('\n📊 Summary:');
105
+ console.log(` Total hooks: ${zapCall.hooks.length}`);
106
+ console.log(` Estimated gas: ${this.estimateGasUsage(zapCall).toLocaleString()}`);
107
+ console.log(` Bridge required: ${zapCall.bridgeData.isRequired ? 'Yes' : 'No'}`);
108
+ console.log('================================');
109
+ }
110
+ /**
111
+ * Private helper to describe individual hooks
112
+ * @param hook - The hook to describe
113
+ * @returns The description of the hook
114
+ */
115
+ _describeHook(hook, contractInterfaces) {
116
+ try {
117
+ switch (hook.hookType) {
118
+ case AgnosticStructs_1.HookType.Custom:
119
+ return this._describeCustomHook(hook, contractInterfaces);
120
+ case AgnosticStructs_1.HookType.FullBalanceApprove:
121
+ return this._describeApproveHook(hook);
122
+ case AgnosticStructs_1.HookType.FullBalanceTransfer:
123
+ return this._describeTransferHook(hook);
124
+ default:
125
+ return `❓ Unknown hook type: ${hook.hookType}`;
126
+ }
127
+ }
128
+ catch (error) {
129
+ return `❌ Error describing hook: ${error}`;
130
+ }
131
+ }
132
+ /**
133
+ * Describe custom hook with function details
134
+ * @param hook - The hook to describe
135
+ * @returns The description of the hook
136
+ */
137
+ _describeCustomHook(hook, contractInterfaces) {
138
+ const decoded = this.decodeHookData(hook);
139
+ const [isFromSA, contractAddress, value, data, improvedMissionInfo] = decoded;
140
+ // Try to decode function name from data
141
+ let functionDescription = 'unknown function';
142
+ let hasReplacements = false;
143
+ if (data && data.length >= 10) {
144
+ // At least 4 bytes for selector + some data
145
+ const selector = data.slice(0, 10); // "0x" + 8 hex chars
146
+ // Try to find function name from registered interfaces
147
+ for (const [address, contractInterface] of contractInterfaces) {
148
+ if (address === contractAddress.toLowerCase()) {
149
+ try {
150
+ const fragment = contractInterface.getFunction(selector);
151
+ if (fragment) {
152
+ functionDescription = `${fragment.name}(${fragment.inputs.map((input) => input.type).join(', ')})`;
153
+ break;
154
+ }
155
+ }
156
+ catch {
157
+ // Function not found in this interface
158
+ }
159
+ }
160
+ }
161
+ // If not found in registered interfaces, just show selector
162
+ if (functionDescription === 'unknown function') {
163
+ functionDescription = `function with selector ${selector}`;
164
+ }
165
+ }
166
+ // Check for dynamic replacements
167
+ if (improvedMissionInfo && improvedMissionInfo !== '0x' && improvedMissionInfo.length > 2) {
168
+ hasReplacements = true;
169
+ }
170
+ const perspective = isFromSA ? 'Smart Account' : 'Proxy Contract';
171
+ const valueStr = value > 0n ? ` (sending ${ethers_1.ethers.formatEther(value)} ETH)` : '';
172
+ const replacementStr = hasReplacements ? ' 🔄 [with dynamic value replacement]' : '';
173
+ return `📞 Custom call to ${this._formatAddress(contractAddress)} from ${perspective}${valueStr}
174
+ Function: ${functionDescription}${replacementStr}`;
175
+ }
176
+ /**
177
+ * Describe approve hook
178
+ * @param hook - The hook to describe
179
+ * @returns The description of the hook
180
+ */
181
+ _describeApproveHook(hook) {
182
+ const decoded = this.decodeHookData(hook);
183
+ const [token, to, isFromSA] = decoded;
184
+ const perspective = isFromSA ? 'Smart Account' : 'Proxy Contract';
185
+ return `✅ Approve full balance of ${this._formatAddress(token)} to ${this._formatAddress(to)} from ${perspective}`;
186
+ }
187
+ /**
188
+ * Describe transfer hook
189
+ * @param hook - The hook to describe
190
+ * @returns The description of the hook
191
+ */
192
+ _describeTransferHook(hook) {
193
+ const decoded = this.decodeHookData(hook);
194
+ const [token, to, isFromSA] = decoded;
195
+ const perspective = isFromSA ? 'Smart Account' : 'Proxy Contract';
196
+ return `💸 Transfer full balance of ${this._formatAddress(token)} to ${this._formatAddress(to)} from ${perspective}`;
197
+ }
198
+ /**
199
+ * Format address for display (show first 6 and last 4 characters)
200
+ * @param address - The address to format
201
+ * @returns The formatted address
202
+ */
203
+ _formatAddress(address) {
204
+ if (!address || address.length < 10)
205
+ return address;
206
+ return `${address.slice(0, 6)}...${address.slice(-4)}`;
207
+ }
208
+ /**
209
+ * Get a detailed breakdown of a ZapCall for logging
210
+ * @param zapCall - The zap call to get the breakdown for
211
+ * @returns The breakdown of the zap call
212
+ */
213
+ getZapCallBreakdown(zapCall, contractInterfaces) {
214
+ const hookTypes = {};
215
+ const hookDescriptions = [];
216
+ zapCall.hooks.forEach((hook, index) => {
217
+ const typeName = AgnosticStructs_1.HookType[hook.hookType];
218
+ hookTypes[typeName] = (hookTypes[typeName] || 0) + 1;
219
+ hookDescriptions.push(`${index + 1}. ${this._describeHook(hook, contractInterfaces)}`);
220
+ });
221
+ return {
222
+ totalHooks: zapCall.hooks.length,
223
+ hookTypes,
224
+ gasEstimate: this.estimateGasUsage(zapCall),
225
+ encodedSize: this.encodeZapCall(zapCall).length / 2, // bytes
226
+ bridgeRequired: zapCall.bridgeData.isRequired,
227
+ hookDescriptions,
228
+ };
229
+ }
230
+ /**
231
+ * Compare two ZapCalls and show differences
232
+ * @param zapCall1 - The first zap call to compare
233
+ * @param zapCall2 - The second zap call to compare
234
+ * @param label1 - The label of the first zap call
235
+ * @param label2 - The label of the second zap call
236
+ */
237
+ compareZapCalls(zapCall1, zapCall2, label1 = 'ZapCall 1', label2 = 'ZapCall 2', contractInterfaces) {
238
+ console.log(`🔄 Comparing ${label1} vs ${label2}`);
239
+ console.log('='.repeat(50));
240
+ const breakdown1 = this.getZapCallBreakdown(zapCall1, contractInterfaces);
241
+ const breakdown2 = this.getZapCallBreakdown(zapCall2, contractInterfaces);
242
+ console.log(`📊 ${label1}:`);
243
+ console.log(` Hooks: ${breakdown1.totalHooks}, Gas: ${breakdown1.gasEstimate.toLocaleString()}, Size: ${breakdown1.encodedSize} bytes`);
244
+ console.log(`📊 ${label2}:`);
245
+ console.log(` Hooks: ${breakdown2.totalHooks}, Gas: ${breakdown2.gasEstimate.toLocaleString()}, Size: ${breakdown2.encodedSize} bytes`);
246
+ console.log('\n📈 Differences:');
247
+ console.log(` Hooks: ${breakdown2.totalHooks - breakdown1.totalHooks > 0 ? '+' : ''}${breakdown2.totalHooks - breakdown1.totalHooks}`);
248
+ console.log(` Gas: ${breakdown2.gasEstimate - breakdown1.gasEstimate > 0 ? '+' : ''}${(breakdown2.gasEstimate - breakdown1.gasEstimate).toLocaleString()}`);
249
+ console.log(` Size: ${breakdown2.encodedSize - breakdown1.encodedSize > 0 ? '+' : ''}${breakdown2.encodedSize - breakdown1.encodedSize} bytes`);
250
+ }
251
+ /**
252
+ * Encode ZapCall for transaction
253
+ * @param zapCall - The zap call to encode
254
+ * @returns The encoded zap call that can be used as calldata in tac sdk
255
+ */
256
+ encodeZapCall(zapCall) {
257
+ return ethers_1.ethers.AbiCoder.defaultAbiCoder().encode([
258
+ 'tuple(' +
259
+ 'tuple(uint8,bytes)[],' + // hooks: only hookType and hookData
260
+ 'tuple(address[],tuple(address,uint256,uint256)[],bool)' + // bridgeData
261
+ ')',
262
+ ], [
263
+ [
264
+ zapCall.hooks.map((hook) => [hook.hookType, hook.hookData]),
265
+ [
266
+ zapCall.bridgeData.tokens,
267
+ zapCall.bridgeData.nfts.map((nft) => [nft.nft, nft.id, nft.amount]),
268
+ zapCall.bridgeData.isRequired,
269
+ ],
270
+ ],
271
+ ]);
272
+ }
273
+ }
274
+ exports.DebugHelpers = DebugHelpers;
@@ -0,0 +1,43 @@
1
+ import { Interface } from 'ethers';
2
+ import { AmountChange, Hook } from './AgnosticStructs';
3
+ export declare class HooksHandler {
4
+ /**
5
+ * Create a custom hook with optional dynamic value replacement
6
+ * @param contractAddress - The address of the contract to call
7
+ * @param functionName - The name of the function to call
8
+ * @param params - The parameters of the function to call
9
+ * @param options - The options of the custom hook
10
+ * @returns The custom hook
11
+ */
12
+ createCustomHook(contractAddress: string, functionName: string, params: any[], contractInterfaces: Map<string, Interface>, options?: {
13
+ isFromSAPerspective?: boolean;
14
+ value?: bigint;
15
+ dynamicReplacements?: AmountChange[];
16
+ }): Hook;
17
+ /**
18
+ * Create a full balance approve hook
19
+ * @param token - The token to approve
20
+ * @param to - The address to approve to
21
+ * @param isFromSAPerspective - Whether the hook is from the smart account perspective or from proxy perspective
22
+ * @returns The full balance approve hook
23
+ */
24
+ createFullBalanceApproveHook(token: string, to: string, isFromSAPerspective?: boolean): Hook;
25
+ /**
26
+ * Create a full balance transfer hook
27
+ * @param token - The token to transfer
28
+ * @param to - The address to transfer to
29
+ * @param isFromSAPerspective - Whether the hook is from the smart account perspective or from proxy perspective
30
+ * @returns The full balance transfer hook
31
+ */
32
+ createFullBalanceTransferHook(token: string, to: string, isFromSAPerspective?: boolean): Hook;
33
+ /**
34
+ * Utility: Create multiple approve hooks at once
35
+ * @param approvals - The approvals to create
36
+ * @returns The multiple approve hooks
37
+ */
38
+ createMultipleApproves(approvals: {
39
+ token: string;
40
+ spender: string;
41
+ isFromSA?: boolean;
42
+ }[]): Hook[];
43
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HooksHandler = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const AgnosticStructs_1 = require("./AgnosticStructs");
6
+ class HooksHandler {
7
+ /**
8
+ * Create a custom hook with optional dynamic value replacement
9
+ * @param contractAddress - The address of the contract to call
10
+ * @param functionName - The name of the function to call
11
+ * @param params - The parameters of the function to call
12
+ * @param options - The options of the custom hook
13
+ * @returns The custom hook
14
+ */
15
+ createCustomHook(contractAddress, functionName, params, contractInterfaces, options = {}) {
16
+ const { isFromSAPerspective = true, value = 0n, dynamicReplacements } = options;
17
+ const contractInterface = contractInterfaces.get(contractAddress.toLowerCase());
18
+ if (!contractInterface) {
19
+ throw new Error(`Contract interface not found for address: ${contractAddress}`);
20
+ }
21
+ const data = contractInterface.encodeFunctionData(functionName, params);
22
+ let improvedMissionInfo = '0x';
23
+ // If dynamic replacements are specified, encode them
24
+ if (dynamicReplacements && dynamicReplacements.length > 0) {
25
+ // For now, support single replacement (can be extended)
26
+ const replacement = dynamicReplacements[0];
27
+ const replacementData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['tuple(uint16,uint16,address,address)'], [[replacement.position, replacement.len, replacement.token, replacement.balanceAddress]]);
28
+ // Encode as ReplacementType.Amount with the replacement data
29
+ improvedMissionInfo = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['uint8', 'bytes'], [AgnosticStructs_1.ReplacementType.Amount, replacementData]);
30
+ }
31
+ const customHookData = {
32
+ isFromSAPerspective,
33
+ contractAddress: ethers_1.ethers.getAddress(contractAddress.toLowerCase()), // Normalize address to checksum format
34
+ value,
35
+ data,
36
+ improvedMissionInfo,
37
+ };
38
+ // Encode only the CustomHookData
39
+ const encodedHookData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['tuple(bool,address,uint256,bytes,bytes)'], [
40
+ [
41
+ customHookData.isFromSAPerspective,
42
+ customHookData.contractAddress,
43
+ customHookData.value,
44
+ customHookData.data,
45
+ customHookData.improvedMissionInfo,
46
+ ],
47
+ ]);
48
+ return {
49
+ hookType: AgnosticStructs_1.HookType.Custom,
50
+ hookData: encodedHookData,
51
+ };
52
+ }
53
+ /**
54
+ * Create a full balance approve hook
55
+ * @param token - The token to approve
56
+ * @param to - The address to approve to
57
+ * @param isFromSAPerspective - Whether the hook is from the smart account perspective or from proxy perspective
58
+ * @returns The full balance approve hook
59
+ */
60
+ createFullBalanceApproveHook(token, to, isFromSAPerspective = true) {
61
+ const approveHookData = {
62
+ token,
63
+ to,
64
+ isFromSAPerspective,
65
+ };
66
+ // Encode only the ApproveHookData
67
+ const encodedHookData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['tuple(address,address,bool)'], [[approveHookData.token, approveHookData.to, approveHookData.isFromSAPerspective]]);
68
+ return {
69
+ hookType: AgnosticStructs_1.HookType.FullBalanceApprove,
70
+ hookData: encodedHookData,
71
+ };
72
+ }
73
+ /**
74
+ * Create a full balance transfer hook
75
+ * @param token - The token to transfer
76
+ * @param to - The address to transfer to
77
+ * @param isFromSAPerspective - Whether the hook is from the smart account perspective or from proxy perspective
78
+ * @returns The full balance transfer hook
79
+ */
80
+ createFullBalanceTransferHook(token, to, isFromSAPerspective = true) {
81
+ const transferHookData = {
82
+ token,
83
+ to,
84
+ isFromSAPerspective,
85
+ };
86
+ // Encode only the TransferHookData
87
+ const encodedHookData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['tuple(address,address,bool)'], [[transferHookData.token, transferHookData.to, transferHookData.isFromSAPerspective]]);
88
+ return {
89
+ hookType: AgnosticStructs_1.HookType.FullBalanceTransfer,
90
+ hookData: encodedHookData,
91
+ };
92
+ }
93
+ /**
94
+ * Utility: Create multiple approve hooks at once
95
+ * @param approvals - The approvals to create
96
+ * @returns The multiple approve hooks
97
+ */
98
+ createMultipleApproves(approvals) {
99
+ return approvals.map((approval) => this.createFullBalanceApproveHook(approval.token, approval.spender, approval.isFromSA ?? true));
100
+ }
101
+ }
102
+ exports.HooksHandler = HooksHandler;
@@ -0,0 +1,95 @@
1
+ import { Interface } from 'ethers';
2
+ import { AmountChange } from './AgnosticStructs';
3
+ export declare class ReplacementHelper {
4
+ /**
5
+ * Helper to create dynamic amount replacement for a specific parameter
6
+ * @param paramIndex - The index of the parameter to replace
7
+ * @param token - The token to replace
8
+ * @param balanceAddress - The address to replace the parameter with
9
+ * @returns The amount replacement
10
+ */
11
+ createAmountReplacement(paramIndex: number, token: string, balanceAddress: string): AmountChange;
12
+ /**
13
+ * Advanced replacement calculator - calculates position and length for any parameter type
14
+ * Required that you have added the contract interface first using addContractInterface().
15
+ * If human readable abi is used, need to provide function and params names also
16
+ * @param contractAddress - The address of the contract to call
17
+ * @param functionName - The name of the function to call
18
+ * @param parameterName - The name of the parameter to replace
19
+ * @param token - The token to replace
20
+ * @param balanceAddress - The address to replace the parameter with
21
+ * @returns The replacement data
22
+ */
23
+ calculateReplacementData(contractAddress: string, functionName: string, parameterName: string, token: string, balanceAddress: string, contractInterfaces: Map<string, Interface>): AmountChange;
24
+ /**
25
+ * Get replacement helper - shows available functions and parameters for a contract
26
+ * Required that you have added the contract interface first using addContractInterface().
27
+ * If human readable abi is used, need to provide function and params names also
28
+ * @param contractAddress - The address of the contract to call
29
+ * @returns The replacement helper
30
+ */
31
+ getReplacementHelper(contractAddress: string, contractInterfaces: Map<string, Interface>): {
32
+ contractAddress: string;
33
+ functions: {
34
+ name: string;
35
+ signature: string;
36
+ parameters: {
37
+ name: string;
38
+ type: string;
39
+ index: number;
40
+ canReplace: boolean;
41
+ reason?: string;
42
+ }[];
43
+ }[];
44
+ };
45
+ /**
46
+ * Interactive replacement builder - helps build replacement step by step
47
+ * @param contractAddress - The address of the contract to call
48
+ * @param functionName - The name of the function to call
49
+ * @param parameterName - The name of the parameter to replace
50
+ * @param token - The token to replace
51
+ * @param balanceAddress - The address to replace the parameter with
52
+ * @param options - The options of the interactive replacement builder
53
+ * @returns The interactive replacement builder
54
+ */
55
+ buildReplacementInteractive(contractAddress: string, functionName: string, parameterName: string, token: string, balanceAddress: string, contractInterfaces: Map<string, Interface>, options?: {
56
+ validate?: boolean;
57
+ }): {
58
+ replacement: AmountChange;
59
+ calculation: {
60
+ functionSignature: string;
61
+ parameterInfo: {
62
+ name: string;
63
+ type: string;
64
+ index: number;
65
+ position: number;
66
+ length: number;
67
+ };
68
+ positionCalculation: string;
69
+ };
70
+ validation: {
71
+ isValid: boolean;
72
+ warnings: string[];
73
+ suggestions: string[];
74
+ };
75
+ };
76
+ /**
77
+ * Private helper to calculate position and length for complex parameter types
78
+ * @param inputs - The inputs of the function
79
+ * @param targetIndex - The index of the parameter to calculate the position and length for
80
+ * @returns The position and length of the parameter
81
+ */
82
+ private _calculateParamPositionAndLength;
83
+ /**
84
+ * Get the size in bytes for a parameter type
85
+ * @param type - The type of the parameter
86
+ * @returns The size in bytes of the parameter
87
+ */
88
+ private _getTypeSize;
89
+ /**
90
+ * Check if a parameter type can be replaced with a balance
91
+ * @param type - The type of the parameter
92
+ * @returns The can replace and reason of the parameter
93
+ */
94
+ private _canParameterBeReplaced;
95
+ }