@tonappchain/sdk 0.7.0-rc9 → 0.7.1
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/LICENSE +20 -20
- package/README.md +198 -191
- package/dist/artifacts/dev/index.d.ts +9 -0
- package/dist/artifacts/dev/index.js +52 -0
- package/dist/artifacts/dev/tac/addresses.d.ts +4 -0
- package/dist/artifacts/dev/tac/addresses.js +8 -0
- package/dist/artifacts/dev/tac/artifacts.d.ts +330 -0
- package/dist/artifacts/dev/tac/artifacts.js +26 -0
- package/dist/artifacts/dev/tac/endpoints.d.ts +2 -0
- package/dist/artifacts/dev/tac/endpoints.js +5 -0
- package/dist/artifacts/dev/tac/index.d.ts +6 -0
- package/dist/artifacts/dev/tac/index.js +43 -0
- package/dist/artifacts/dev/tac/internal/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +296 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +114 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +194 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +164 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC20.sol/ICrossChainLayerERC20.json +278 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC721.sol/ICrossChainLayerERC721.json +380 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/tokens/IERC20WithDecimals.sol/IERC20WithDecimals.json +207 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +103 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/smart-account/interfaces/ITacSmartAccount.sol/ITacSmartAccount.json +181 -0
- package/dist/artifacts/dev/tac/internal/scripts/utils/encoding.d.ts +4 -0
- package/dist/artifacts/dev/tac/internal/scripts/utils/encoding.js +18 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +199 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/common.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +75 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +123 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ISettings.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +99 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.d.ts +182 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.d.ts +244 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.d.ts +133 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +77 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.js +2 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.d.ts +127 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.js +2 -0
- package/dist/artifacts/dev/tac/multicall.d.ts +1 -0
- package/dist/artifacts/dev/tac/multicall.js +22 -0
- package/dist/artifacts/dev/tac/structs.d.ts +1 -0
- package/dist/artifacts/dev/tac/structs.js +2 -0
- package/dist/artifacts/dev/tac/utils.d.ts +1 -0
- package/dist/artifacts/dev/tac/utils.js +5 -0
- package/dist/artifacts/dev/tac/wrappers.d.ts +9 -0
- package/dist/artifacts/dev/tac/wrappers.js +2 -0
- package/dist/artifacts/dev/ton/addresses.d.ts +1 -0
- package/dist/artifacts/dev/ton/addresses.js +5 -0
- package/dist/artifacts/dev/ton/artifacts.d.ts +47 -0
- package/dist/artifacts/dev/ton/artifacts.js +26 -0
- package/dist/artifacts/dev/ton/endpoints.d.ts +3 -0
- package/dist/artifacts/dev/ton/endpoints.js +6 -0
- package/dist/artifacts/dev/ton/index.d.ts +3 -0
- package/dist/artifacts/dev/ton/index.js +40 -0
- package/dist/artifacts/dev/ton/internal/build/CrossChainLayer.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/Executor.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/JettonMinter.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/JettonProxy.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/JettonWallet.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/NFTCollection.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/NFTItem.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/NFTProxy.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/build/Settings.compiled.json +1 -0
- package/dist/artifacts/dev/ton/internal/wrappers/Constants.d.ts +56 -0
- package/dist/artifacts/dev/ton/internal/wrappers/Constants.js +62 -0
- package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.d.ts +164 -0
- package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.js +336 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.d.ts +94 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.js +202 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.d.ts +80 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.js +158 -0
- package/dist/{wrappers → artifacts/dev/ton/internal/wrappers}/JettonWallet.d.ts +52 -13
- package/dist/artifacts/dev/ton/internal/wrappers/JettonWallet.js +193 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.d.ts +75 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.js +151 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.d.ts +82 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.js +148 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.d.ts +84 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.js +157 -0
- package/dist/artifacts/dev/ton/internal/wrappers/Settings.d.ts +80 -0
- package/dist/artifacts/dev/ton/internal/wrappers/Settings.js +152 -0
- package/dist/artifacts/dev/ton/internal/wrappers/utils/GasUtils.d.ts +79 -0
- package/dist/artifacts/dev/ton/internal/wrappers/utils/GasUtils.js +291 -0
- package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.d.ts +7 -0
- package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.js +27 -0
- package/dist/artifacts/dev/ton/wrappers.d.ts +8 -0
- package/dist/artifacts/dev/ton/wrappers.js +27 -0
- package/dist/artifacts/index.d.ts +3 -0
- package/dist/artifacts/index.js +39 -0
- package/dist/artifacts/mainnet/index.d.ts +9 -0
- package/dist/artifacts/mainnet/index.js +52 -0
- package/dist/artifacts/mainnet/tac/addresses.d.ts +4 -0
- package/dist/artifacts/mainnet/tac/addresses.js +7 -0
- package/dist/artifacts/mainnet/tac/artifacts.d.ts +330 -0
- package/dist/artifacts/mainnet/tac/artifacts.js +26 -0
- package/dist/artifacts/mainnet/tac/endpoints.d.ts +2 -0
- package/dist/artifacts/mainnet/tac/endpoints.js +5 -0
- package/dist/artifacts/mainnet/tac/index.d.ts +6 -0
- package/dist/artifacts/mainnet/tac/index.js +43 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +296 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +114 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +194 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +164 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC20.sol/ICrossChainLayerERC20.json +278 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC721.sol/ICrossChainLayerERC721.json +380 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/tokens/IERC20WithDecimals.sol/IERC20WithDecimals.json +207 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +103 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/smart-account/interfaces/ITacSmartAccount.sol/ITacSmartAccount.json +181 -0
- package/dist/artifacts/mainnet/tac/internal/scripts/utils/encoding.d.ts +4 -0
- package/dist/artifacts/mainnet/tac/internal/scripts/utils/encoding.js +18 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +199 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/common.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +75 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +123 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ISettings.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +99 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.d.ts +182 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.d.ts +244 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.d.ts +133 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +77 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.d.ts +127 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.js +2 -0
- package/dist/artifacts/mainnet/tac/multicall.d.ts +1 -0
- package/dist/artifacts/mainnet/tac/multicall.js +22 -0
- package/dist/artifacts/mainnet/tac/structs.d.ts +1 -0
- package/dist/artifacts/mainnet/tac/structs.js +2 -0
- package/dist/artifacts/mainnet/tac/utils.d.ts +1 -0
- package/dist/artifacts/mainnet/tac/utils.js +5 -0
- package/dist/artifacts/mainnet/tac/wrappers.d.ts +9 -0
- package/dist/artifacts/mainnet/tac/wrappers.js +2 -0
- package/dist/artifacts/mainnet/ton/addresses.d.ts +1 -0
- package/dist/artifacts/mainnet/ton/addresses.js +4 -0
- package/dist/artifacts/mainnet/ton/artifacts.d.ts +47 -0
- package/dist/artifacts/mainnet/ton/artifacts.js +26 -0
- package/dist/artifacts/mainnet/ton/endpoints.d.ts +3 -0
- package/dist/artifacts/mainnet/ton/endpoints.js +6 -0
- package/dist/artifacts/mainnet/ton/index.d.ts +3 -0
- package/dist/artifacts/mainnet/ton/index.js +40 -0
- package/dist/artifacts/mainnet/ton/internal/build/CrossChainLayer.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/Executor.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/JettonMinter.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/JettonProxy.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/JettonWallet.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/NFTCollection.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/NFTItem.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/NFTProxy.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/build/Settings.compiled.json +1 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/Constants.d.ts +56 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/Constants.js +62 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.d.ts +164 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.js +336 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.d.ts +94 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.js +202 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonProxy.d.ts +80 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonProxy.js +158 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonWallet.d.ts +95 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonWallet.js +193 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/NFTCollection.d.ts +75 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/NFTCollection.js +151 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/NFTItem.d.ts +82 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/NFTItem.js +148 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/NFTProxy.d.ts +84 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/NFTProxy.js +157 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/Settings.d.ts +80 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/Settings.js +152 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/utils/GasUtils.d.ts +79 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/utils/GasUtils.js +291 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +7 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/utils/MerkleRoots.js +27 -0
- package/dist/artifacts/mainnet/ton/wrappers.d.ts +8 -0
- package/dist/artifacts/mainnet/ton/wrappers.js +27 -0
- package/dist/artifacts/tacTypes.d.ts +13 -0
- package/dist/artifacts/tacTypes.js +2 -0
- package/dist/artifacts/testnet/index.d.ts +9 -0
- package/dist/artifacts/testnet/index.js +52 -0
- package/dist/artifacts/testnet/tac/addresses.d.ts +4 -0
- package/dist/artifacts/testnet/tac/addresses.js +7 -0
- package/dist/artifacts/testnet/tac/artifacts.d.ts +330 -0
- package/dist/artifacts/testnet/tac/artifacts.js +26 -0
- package/dist/artifacts/testnet/tac/endpoints.d.ts +2 -0
- package/dist/artifacts/testnet/tac/endpoints.js +5 -0
- package/dist/artifacts/testnet/tac/index.d.ts +6 -0
- package/dist/artifacts/testnet/tac/index.js +43 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +296 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +114 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +194 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +164 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC20.sol/ICrossChainLayerERC20.json +278 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/tokens/ICrossChainLayerERC721.sol/ICrossChainLayerERC721.json +380 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/tokens/IERC20WithDecimals.sol/IERC20WithDecimals.json +207 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +103 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/smart-account/interfaces/ITacSmartAccount.sol/ITacSmartAccount.json +181 -0
- package/dist/artifacts/testnet/tac/internal/scripts/utils/encoding.d.ts +4 -0
- package/dist/artifacts/testnet/tac/internal/scripts/utils/encoding.js +18 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +199 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/common.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +75 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +123 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ISettings.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +99 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.d.ts +182 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC20.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.d.ts +244 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/ICrossChainLayerERC721.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.d.ts +133 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/tokens/IERC20WithDecimals.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +77 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.d.ts +127 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ITacSmartAccount.js +2 -0
- package/dist/artifacts/testnet/tac/multicall.d.ts +1 -0
- package/dist/artifacts/testnet/tac/multicall.js +22 -0
- package/dist/artifacts/testnet/tac/structs.d.ts +1 -0
- package/dist/artifacts/testnet/tac/structs.js +2 -0
- package/dist/artifacts/testnet/tac/utils.d.ts +1 -0
- package/dist/artifacts/testnet/tac/utils.js +5 -0
- package/dist/artifacts/testnet/tac/wrappers.d.ts +9 -0
- package/dist/artifacts/testnet/tac/wrappers.js +2 -0
- package/dist/artifacts/testnet/ton/addresses.d.ts +1 -0
- package/dist/artifacts/testnet/ton/addresses.js +4 -0
- package/dist/artifacts/testnet/ton/artifacts.d.ts +47 -0
- package/dist/artifacts/testnet/ton/artifacts.js +26 -0
- package/dist/artifacts/testnet/ton/endpoints.d.ts +3 -0
- package/dist/artifacts/testnet/ton/endpoints.js +6 -0
- package/dist/artifacts/testnet/ton/index.d.ts +3 -0
- package/dist/artifacts/testnet/ton/index.js +40 -0
- package/dist/artifacts/testnet/ton/internal/build/CrossChainLayer.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/Executor.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/JettonMinter.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/JettonProxy.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/JettonWallet.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/NFTCollection.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/NFTItem.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/NFTProxy.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/build/Settings.compiled.json +1 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/Constants.d.ts +56 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/Constants.js +62 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.d.ts +164 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.js +336 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +94 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +202 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.d.ts +80 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.js +158 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.d.ts +95 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.js +193 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.d.ts +75 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.js +151 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.d.ts +82 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.js +148 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.d.ts +84 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.js +157 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/Settings.d.ts +80 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/Settings.js +152 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/GasUtils.d.ts +79 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/GasUtils.js +291 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.js +27 -0
- package/dist/artifacts/testnet/ton/wrappers.d.ts +8 -0
- package/dist/artifacts/testnet/ton/wrappers.js +27 -0
- package/dist/artifacts/tonTypes.d.ts +20 -0
- package/dist/artifacts/tonTypes.js +2 -0
- package/dist/{adapters → src/adapters}/contractOpener.d.ts +2 -1
- package/dist/{adapters → src/adapters}/contractOpener.js +39 -6
- package/dist/src/adapters/index.d.ts +2 -0
- package/dist/src/adapters/index.js +18 -0
- package/dist/{adapters → src/adapters}/retryableContractOpener.d.ts +6 -3
- package/dist/{adapters → src/adapters}/retryableContractOpener.js +10 -11
- package/dist/src/agnosticSdk/AbiHandler.d.ts +27 -0
- package/dist/src/agnosticSdk/AbiHandler.js +137 -0
- package/dist/src/agnosticSdk/AgnosticSdk.d.ts +201 -0
- package/dist/src/agnosticSdk/AgnosticSdk.js +201 -0
- package/dist/src/agnosticSdk/AgnosticStructs.d.ts +108 -0
- package/dist/src/agnosticSdk/AgnosticStructs.js +23 -0
- package/dist/src/agnosticSdk/DebugHelpers.d.ts +88 -0
- package/dist/src/agnosticSdk/DebugHelpers.js +274 -0
- package/dist/src/agnosticSdk/HooksHandler.d.ts +43 -0
- package/dist/src/agnosticSdk/HooksHandler.js +102 -0
- package/dist/src/agnosticSdk/ReplacementHelper.d.ts +95 -0
- package/dist/src/agnosticSdk/ReplacementHelper.js +235 -0
- package/dist/{assets → src/assets}/AssetCache.d.ts +1 -1
- package/dist/{assets → src/assets}/AssetFactory.d.ts +2 -2
- package/dist/{assets → src/assets}/AssetFactory.js +4 -3
- package/dist/{assets → src/assets}/FT.d.ts +14 -17
- package/dist/{assets → src/assets}/FT.js +94 -58
- package/dist/{assets → src/assets}/NFT.d.ts +15 -16
- package/dist/{assets → src/assets}/NFT.js +58 -32
- package/dist/{assets → src/assets}/TON.d.ts +8 -13
- package/dist/{assets → src/assets}/TON.js +27 -21
- package/dist/src/errors/index.d.ts +2 -0
- package/dist/{errors → src/errors}/index.js +8 -2
- package/dist/{errors → src/errors}/instances.d.ts +11 -1
- package/dist/src/errors/instances.js +58 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/{index.js → src/index.js} +38 -18
- package/dist/src/interfaces/Asset.d.ts +78 -0
- package/dist/src/interfaces/Asset.js +2 -0
- package/dist/src/interfaces/ContractOpener.d.ts +21 -0
- package/dist/src/interfaces/ContractOpener.js +2 -0
- package/dist/src/interfaces/IConfiguration.d.ts +35 -0
- package/dist/src/interfaces/IConfiguration.js +2 -0
- package/dist/src/interfaces/IHttpClient.d.ts +16 -0
- package/dist/src/interfaces/IHttpClient.js +2 -0
- package/dist/src/interfaces/ILiteSequencerClient.d.ts +43 -0
- package/dist/src/interfaces/ILiteSequencerClient.js +2 -0
- package/dist/src/interfaces/ILiteSequencerClientFactory.d.ts +9 -0
- package/dist/src/interfaces/ILiteSequencerClientFactory.js +2 -0
- package/dist/src/interfaces/ILogger.d.ts +10 -0
- package/dist/src/interfaces/ILogger.js +2 -0
- package/dist/src/interfaces/IOperationTracker.d.ts +81 -0
- package/dist/src/interfaces/IOperationTracker.js +2 -0
- package/dist/src/interfaces/ISimulator.d.ts +18 -0
- package/dist/src/interfaces/ISimulator.js +2 -0
- package/dist/src/interfaces/ITACTransactionManager.d.ts +15 -0
- package/dist/src/interfaces/ITACTransactionManager.js +2 -0
- package/dist/src/interfaces/ITONTransactionManager.d.ts +20 -0
- package/dist/src/interfaces/ITONTransactionManager.js +2 -0
- package/dist/src/interfaces/ITacSDK.d.ts +185 -0
- package/dist/src/interfaces/ITacSDK.js +2 -0
- package/dist/src/interfaces/SenderAbstraction.d.ts +35 -0
- package/dist/src/interfaces/SenderAbstraction.js +2 -0
- package/dist/src/interfaces/WalletInstanse.d.ts +20 -0
- package/dist/src/interfaces/WalletInstanse.js +2 -0
- package/dist/src/interfaces/index.d.ts +14 -0
- package/dist/src/interfaces/index.js +30 -0
- package/dist/src/sdk/AxiosHttpClient.d.ts +12 -0
- package/dist/src/sdk/AxiosHttpClient.js +23 -0
- package/dist/{sdk → src/sdk}/Configuration.d.ts +6 -5
- package/dist/src/sdk/Configuration.js +195 -0
- package/dist/{sdk → src/sdk}/Consts.d.ts +3 -0
- package/dist/{sdk → src/sdk}/Consts.js +4 -1
- package/dist/src/sdk/LiteSequencerClient.d.ts +18 -0
- package/dist/{sdk → src/sdk}/LiteSequencerClient.js +81 -25
- package/dist/{sdk → src/sdk}/Logger.d.ts +5 -5
- package/dist/{sdk → src/sdk}/Logger.js +12 -4
- package/dist/{sdk → src/sdk}/OperationTracker.d.ts +5 -13
- package/dist/{sdk → src/sdk}/OperationTracker.js +112 -16
- package/dist/src/sdk/Simulator.d.ts +11 -0
- package/dist/src/sdk/Simulator.js +70 -0
- package/dist/{sdk → src/sdk}/StartTracking.d.ts +1 -1
- package/dist/src/sdk/TACTransactionManager.d.ts +10 -0
- package/dist/src/sdk/TACTransactionManager.js +101 -0
- package/dist/src/sdk/TONTransactionManager.d.ts +17 -0
- package/dist/src/sdk/TONTransactionManager.js +220 -0
- package/dist/src/sdk/TacSdk.d.ts +44 -0
- package/dist/src/sdk/TacSdk.js +181 -0
- package/dist/{sdk → src/sdk}/TxFinalizer.d.ts +3 -2
- package/dist/{sdk → src/sdk}/TxFinalizer.js +13 -8
- package/dist/{sdk → src/sdk}/Utils.d.ts +14 -7
- package/dist/{sdk → src/sdk}/Utils.js +127 -34
- package/dist/{sdk → src/sdk}/Validator.d.ts +2 -2
- package/dist/{sdk → src/sdk}/Validator.js +6 -6
- package/dist/{sender → src/sender}/BatchSender.d.ts +1 -2
- package/dist/{sender → src/sender}/RawSender.d.ts +3 -3
- package/dist/{sender → src/sender}/SenderFactory.d.ts +1 -1
- package/dist/{sender → src/sender}/SenderFactory.js +1 -1
- package/dist/{sender → src/sender}/TonConnectSender.d.ts +2 -2
- package/dist/{sender → src/sender}/TonConnectSender.js +3 -3
- package/dist/{sender → src/sender}/index.d.ts +1 -1
- package/dist/{sender → src/sender}/index.js +1 -1
- package/dist/{structs → src/structs}/InternalStruct.d.ts +30 -6
- package/dist/{structs → src/structs}/Struct.d.ts +109 -62
- package/dist/{structs → src/structs}/Struct.js +7 -1
- package/dist/{wrappers → src/wrappers}/ContentUtils.js +0 -1
- package/dist/{wrappers → src/wrappers}/HighloadWalletV3.d.ts +2 -2
- package/package.json +118 -67
- package/dist/errors/index.d.ts +0 -2
- package/dist/errors/instances.js +0 -47
- package/dist/index.d.ts +0 -19
- package/dist/sdk/Configuration.js +0 -90
- package/dist/sdk/LiteSequencerClient.d.ts +0 -13
- package/dist/sdk/Simulator.d.ts +0 -23
- package/dist/sdk/Simulator.js +0 -169
- package/dist/sdk/TacSdk.d.ts +0 -32
- package/dist/sdk/TacSdk.js +0 -154
- package/dist/sdk/TransactionManager.d.ts +0 -22
- package/dist/sdk/TransactionManager.js +0 -269
- package/dist/sender/SenderAbstraction.d.ts +0 -22
- package/dist/sender/SenderAbstraction.js +0 -5
- package/dist/structs/Services.d.ts +0 -66
- package/dist/wrappers/JettonMaster.d.ts +0 -24
- package/dist/wrappers/JettonMaster.js +0 -53
- package/dist/wrappers/JettonWallet.js +0 -124
- package/dist/wrappers/Settings.d.ts +0 -10
- package/dist/wrappers/Settings.js +0 -38
- /package/dist/{structs/Services.js → artifacts/dev/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.js} +0 -0
- /package/dist/{assets → src/assets}/AssetCache.js +0 -0
- /package/dist/{assets → src/assets}/index.d.ts +0 -0
- /package/dist/{assets → src/assets}/index.js +0 -0
- /package/dist/{errors → src/errors}/errors.d.ts +0 -0
- /package/dist/{errors → src/errors}/errors.js +0 -0
- /package/dist/{sdk → src/sdk}/StartTracking.js +0 -0
- /package/dist/{sender → src/sender}/BatchSender.js +0 -0
- /package/dist/{sender → src/sender}/RawSender.js +0 -0
- /package/dist/{structs → src/structs}/InternalStruct.js +0 -0
- /package/dist/{wrappers → src/wrappers}/ContentUtils.d.ts +0 -0
- /package/dist/{wrappers → src/wrappers}/HighloadQueryId.d.ts +0 -0
- /package/dist/{wrappers → src/wrappers}/HighloadQueryId.js +0 -0
- /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
|
+
}
|