@tonappchain/sdk 0.7.0-rc17 → 0.7.0-rc19
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/README.md +12 -7
- package/dist/artifacts/dev/index.d.ts +9 -0
- package/dist/artifacts/dev/index.js +52 -0
- package/dist/artifacts/dev/l2-evm/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
- package/dist/artifacts/dev/l2-evm/scripts/utils/encoding.d.ts +4 -0
- package/dist/artifacts/dev/l2-evm/scripts/utils/encoding.js +18 -0
- package/dist/artifacts/dev/l2-evm/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/dev/l2-evm/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -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 +485 -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/contracts/core/CrossChainLayer.sol/CrossChainLayer.json +1702 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/core/Settings.sol/Settings.json +742 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/core/tokens/CrossChainLayerERC20.sol/CrossChainLayerERC20.json +457 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/core/tokens/CrossChainLayerERC721.sol/CrossChainLayerERC721.json +595 -0
- package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +101 -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/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/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.d.ts +141 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/ERC721.d.ts +211 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/CrossChainLayer.d.ts +554 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/Settings.d.ts +407 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/TokenUtils.d.ts +373 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC20.d.ts +222 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC721.d.ts +288 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/TacSAFactory.d.ts +233 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/TacSmartAccount.d.ts +193 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.d.ts +241 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.js +327 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.d.ts +337 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.js +452 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/CrossChainLayer__factory.d.ts +1326 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/CrossChainLayer__factory.js +1730 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/Settings__factory.d.ts +583 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/Settings__factory.js +770 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/TokenUtils__factory.d.ts +540 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/TokenUtils__factory.js +714 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC20__factory.d.ts +363 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC20__factory.js +485 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC721__factory.d.ts +469 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC721__factory.js +623 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/smart-account/TacSAFactory__factory.d.ts +340 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/smart-account/TacSAFactory__factory.js +452 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/smart-account/TacSmartAccount__factory.d.ts +293 -0
- package/dist/artifacts/dev/tac/internal/typechain-types/factories/contracts/smart-account/TacSmartAccount__factory.js +393 -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/utils.d.ts +1 -0
- package/dist/artifacts/dev/tac/utils.js +5 -0
- package/dist/artifacts/dev/tac/wrappers.d.ts +14 -0
- package/dist/artifacts/dev/tac/wrappers.js +21 -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 +35 -0
- package/dist/artifacts/index.js +42 -0
- package/dist/artifacts/mainnet/index.d.ts +9 -0
- package/dist/artifacts/mainnet/index.js +52 -0
- package/dist/artifacts/mainnet/l2-evm/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
- package/dist/artifacts/mainnet/l2-evm/scripts/utils/encoding.d.ts +4 -0
- package/dist/artifacts/mainnet/l2-evm/scripts/utils/encoding.js +18 -0
- package/dist/artifacts/mainnet/l2-evm/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/mainnet/l2-evm/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
- package/dist/artifacts/mainnet/l2-evm/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -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 +485 -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/contracts/core/CrossChainLayer.sol/CrossChainLayer.json +1702 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/core/Settings.sol/Settings.json +742 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/core/tokens/CrossChainLayerERC20.sol/CrossChainLayerERC20.json +457 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/core/tokens/CrossChainLayerERC721.sol/CrossChainLayerERC721.json +595 -0
- package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +101 -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/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/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.d.ts +141 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/ERC721.d.ts +211 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/ERC721.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/CrossChainLayer.d.ts +554 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/CrossChainLayer.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/Settings.d.ts +407 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/Settings.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/TokenUtils.d.ts +373 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/TokenUtils.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC20.d.ts +222 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC20.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC721.d.ts +288 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC721.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/TacSAFactory.d.ts +233 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/TacSAFactory.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/TacSmartAccount.d.ts +193 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/TacSmartAccount.js +2 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.d.ts +241 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.js +327 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.d.ts +337 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.js +452 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/CrossChainLayer__factory.d.ts +1326 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/CrossChainLayer__factory.js +1730 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/Settings__factory.d.ts +583 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/Settings__factory.js +770 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/TokenUtils__factory.d.ts +540 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/TokenUtils__factory.js +714 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC20__factory.d.ts +363 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC20__factory.js +485 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC721__factory.d.ts +469 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC721__factory.js +623 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSAFactory__factory.d.ts +340 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSAFactory__factory.js +452 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSmartAccount__factory.d.ts +293 -0
- package/dist/artifacts/mainnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSmartAccount__factory.js +393 -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 +14 -0
- package/dist/artifacts/mainnet/tac/wrappers.js +21 -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/testnet/index.d.ts +9 -0
- package/dist/artifacts/testnet/index.js +52 -0
- package/dist/artifacts/testnet/l2-evm/artifacts/contracts/core/Structs.sol/IStructsInterface.json +1087 -0
- package/dist/artifacts/testnet/l2-evm/scripts/utils/encoding.d.ts +4 -0
- package/dist/artifacts/testnet/l2-evm/scripts/utils/encoding.js +18 -0
- package/dist/artifacts/testnet/l2-evm/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/testnet/l2-evm/typechain-types/common.js +2 -0
- package/dist/artifacts/testnet/l2-evm/typechain-types/contracts/core/Structs.sol/IStructsInterface.d.ts +356 -0
- package/dist/artifacts/testnet/l2-evm/typechain-types/contracts/core/Structs.sol/IStructsInterface.js +2 -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 +485 -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/contracts/core/CrossChainLayer.sol/CrossChainLayer.json +1702 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/core/Settings.sol/Settings.json +742 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/core/tokens/CrossChainLayerERC20.sol/CrossChainLayerERC20.json +457 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/core/tokens/CrossChainLayerERC721.sol/CrossChainLayerERC721.json +595 -0
- package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +101 -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/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/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.d.ts +141 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/ERC721.d.ts +211 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/ERC721.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/CrossChainLayer.d.ts +554 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/CrossChainLayer.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/Settings.d.ts +407 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/Settings.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/TokenUtils.d.ts +373 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/TokenUtils.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC20.d.ts +222 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC20.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC721.d.ts +288 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC721.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/TacSAFactory.d.ts +233 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/TacSAFactory.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/TacSmartAccount.d.ts +193 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/TacSmartAccount.js +2 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.d.ts +241 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.js +327 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.d.ts +337 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.js +452 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/CrossChainLayer__factory.d.ts +1326 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/CrossChainLayer__factory.js +1730 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/Settings__factory.d.ts +583 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/Settings__factory.js +770 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/TokenUtils__factory.d.ts +540 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/TokenUtils__factory.js +714 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC20__factory.d.ts +363 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC20__factory.js +485 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC721__factory.d.ts +469 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/core/tokens/CrossChainLayerERC721__factory.js +623 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSAFactory__factory.d.ts +340 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSAFactory__factory.js +452 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSmartAccount__factory.d.ts +293 -0
- package/dist/artifacts/testnet/tac/internal/typechain-types/factories/contracts/smart-account/TacSmartAccount__factory.js +393 -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 +14 -0
- package/dist/artifacts/testnet/tac/wrappers.js +21 -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/{adapters → src/adapters}/contractOpener.js +6 -4
- package/dist/{adapters → src/adapters}/retryableContractOpener.d.ts +2 -3
- package/dist/{adapters → src/adapters}/retryableContractOpener.js +10 -11
- package/dist/src/agnosticSdk/AgnosticSdk.d.ts +371 -0
- package/dist/src/agnosticSdk/AgnosticSdk.js +736 -0
- package/dist/{assets → src/assets}/FT.d.ts +4 -5
- package/dist/{assets → src/assets}/FT.js +29 -31
- package/dist/{assets → src/assets}/NFT.d.ts +7 -6
- package/dist/{assets → src/assets}/NFT.js +35 -24
- package/dist/{assets → src/assets}/TON.js +1 -1
- package/dist/{index.d.ts → src/index.d.ts} +2 -3
- package/dist/{index.js → src/index.js} +25 -7
- package/dist/src/interfaces/Asset.js +2 -0
- package/dist/src/interfaces/ContractOpener.js +2 -0
- package/dist/{interfaces → src/interfaces}/IConfiguration.d.ts +2 -2
- package/dist/src/interfaces/IConfiguration.js +2 -0
- package/dist/src/interfaces/IHttpClient.js +2 -0
- package/dist/src/interfaces/ILiteSequencerClient.js +2 -0
- package/dist/src/interfaces/ILiteSequencerClientFactory.js +2 -0
- package/dist/src/interfaces/ILogger.js +2 -0
- package/dist/src/interfaces/IOperationTracker.js +2 -0
- package/dist/src/interfaces/ISimulator.js +2 -0
- package/dist/src/interfaces/ITACTransactionManager.js +2 -0
- package/dist/src/interfaces/ITONTransactionManager.js +2 -0
- package/dist/{interfaces → src/interfaces}/ITacSDK.d.ts +4 -4
- package/dist/src/interfaces/ITacSDK.js +2 -0
- package/dist/src/interfaces/SenderAbstraction.js +2 -0
- package/dist/src/interfaces/WalletInstanse.js +2 -0
- package/dist/{sdk → src/sdk}/Configuration.d.ts +5 -5
- package/dist/{sdk → src/sdk}/Configuration.js +64 -22
- package/dist/{sdk → src/sdk}/Consts.d.ts +2 -0
- package/dist/{sdk → src/sdk}/Consts.js +3 -1
- package/dist/{sdk → src/sdk}/OperationTracker.js +14 -5
- package/dist/{sdk → src/sdk}/Simulator.js +2 -1
- package/dist/{sdk → src/sdk}/TACTransactionManager.js +11 -7
- package/dist/{sdk → src/sdk}/TacSdk.d.ts +3 -5
- package/dist/{sdk → src/sdk}/TacSdk.js +17 -8
- package/dist/{sdk → src/sdk}/Utils.d.ts +3 -0
- package/dist/{sdk → src/sdk}/Utils.js +21 -4
- package/dist/{structs → src/structs}/InternalStruct.d.ts +5 -5
- package/dist/{structs → src/structs}/Struct.d.ts +8 -26
- package/dist/{structs → src/structs}/Struct.js +1 -0
- package/package.json +21 -5
- 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 -14
- package/dist/wrappers/Settings.js +0 -55
- /package/dist/{interfaces/Asset.js → artifacts/dev/l2-evm/typechain-types/common.js} +0 -0
- /package/dist/{interfaces/ContractOpener.js → artifacts/dev/l2-evm/typechain-types/contracts/core/Structs.sol/IStructsInterface.js} +0 -0
- /package/dist/{interfaces/IConfiguration.js → artifacts/dev/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.js} +0 -0
- /package/dist/{interfaces/IHttpClient.js → artifacts/dev/tac/internal/typechain-types/@openzeppelin/contracts/token/ERC721/ERC721.js} +0 -0
- /package/dist/{interfaces/ILiteSequencerClient.js → artifacts/dev/tac/internal/typechain-types/common.js} +0 -0
- /package/dist/{interfaces/ILiteSequencerClientFactory.js → artifacts/dev/tac/internal/typechain-types/contracts/core/CrossChainLayer.js} +0 -0
- /package/dist/{interfaces/ILogger.js → artifacts/dev/tac/internal/typechain-types/contracts/core/Settings.js} +0 -0
- /package/dist/{interfaces/IOperationTracker.js → artifacts/dev/tac/internal/typechain-types/contracts/core/TokenUtils.js} +0 -0
- /package/dist/{interfaces/ISimulator.js → artifacts/dev/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC20.js} +0 -0
- /package/dist/{interfaces/ITACTransactionManager.js → artifacts/dev/tac/internal/typechain-types/contracts/core/tokens/CrossChainLayerERC721.js} +0 -0
- /package/dist/{interfaces/ITONTransactionManager.js → artifacts/dev/tac/internal/typechain-types/contracts/smart-account/TacSAFactory.js} +0 -0
- /package/dist/{interfaces/ITacSDK.js → artifacts/dev/tac/internal/typechain-types/contracts/smart-account/TacSmartAccount.js} +0 -0
- /package/dist/{interfaces/SenderAbstraction.js → artifacts/dev/tac/structs.js} +0 -0
- /package/dist/{interfaces/WalletInstanse.js → artifacts/mainnet/l2-evm/typechain-types/common.js} +0 -0
- /package/dist/{adapters → src/adapters}/contractOpener.d.ts +0 -0
- /package/dist/{assets → src/assets}/AssetCache.d.ts +0 -0
- /package/dist/{assets → src/assets}/AssetCache.js +0 -0
- /package/dist/{assets → src/assets}/AssetFactory.d.ts +0 -0
- /package/dist/{assets → src/assets}/AssetFactory.js +0 -0
- /package/dist/{assets → src/assets}/TON.d.ts +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/{errors → src/errors}/index.d.ts +0 -0
- /package/dist/{errors → src/errors}/index.js +0 -0
- /package/dist/{errors → src/errors}/instances.d.ts +0 -0
- /package/dist/{errors → src/errors}/instances.js +0 -0
- /package/dist/{interfaces → src/interfaces}/Asset.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/ContractOpener.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/IHttpClient.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/ILiteSequencerClient.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/ILiteSequencerClientFactory.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/ILogger.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/IOperationTracker.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/ISimulator.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/ITACTransactionManager.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/ITONTransactionManager.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/SenderAbstraction.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/WalletInstanse.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/index.d.ts +0 -0
- /package/dist/{interfaces → src/interfaces}/index.js +0 -0
- /package/dist/{sdk → src/sdk}/AxiosHttpClient.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/AxiosHttpClient.js +0 -0
- /package/dist/{sdk → src/sdk}/LiteSequencerClient.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/LiteSequencerClient.js +0 -0
- /package/dist/{sdk → src/sdk}/Logger.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/Logger.js +0 -0
- /package/dist/{sdk → src/sdk}/OperationTracker.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/Simulator.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/StartTracking.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/StartTracking.js +0 -0
- /package/dist/{sdk → src/sdk}/TACTransactionManager.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/TONTransactionManager.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/TONTransactionManager.js +0 -0
- /package/dist/{sdk → src/sdk}/TxFinalizer.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/TxFinalizer.js +0 -0
- /package/dist/{sdk → src/sdk}/Validator.d.ts +0 -0
- /package/dist/{sdk → src/sdk}/Validator.js +0 -0
- /package/dist/{sender → src/sender}/BatchSender.d.ts +0 -0
- /package/dist/{sender → src/sender}/BatchSender.js +0 -0
- /package/dist/{sender → src/sender}/RawSender.d.ts +0 -0
- /package/dist/{sender → src/sender}/RawSender.js +0 -0
- /package/dist/{sender → src/sender}/SenderFactory.d.ts +0 -0
- /package/dist/{sender → src/sender}/SenderFactory.js +0 -0
- /package/dist/{sender → src/sender}/TonConnectSender.d.ts +0 -0
- /package/dist/{sender → src/sender}/TonConnectSender.js +0 -0
- /package/dist/{sender → src/sender}/index.d.ts +0 -0
- /package/dist/{sender → src/sender}/index.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}/ContentUtils.js +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.d.ts +0 -0
- /package/dist/{wrappers → src/wrappers}/HighloadWalletV3.js +0 -0
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgnosticProxySDK = exports.ReplacementType = exports.HookType = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const mainnet_1 = require("../../artifacts/mainnet");
|
|
6
|
+
const testnet_1 = require("../../artifacts/testnet");
|
|
7
|
+
const Struct_1 = require("../structs/Struct");
|
|
8
|
+
/**
|
|
9
|
+
* HookType is an enum that contains the type of the hook
|
|
10
|
+
* @param Custom - The custom hook
|
|
11
|
+
* @param FullBalanceApprove - The full balance approve hook
|
|
12
|
+
* @param FullBalanceTransfer - The full balance transfer hook
|
|
13
|
+
*/
|
|
14
|
+
var HookType;
|
|
15
|
+
(function (HookType) {
|
|
16
|
+
HookType[HookType["Custom"] = 0] = "Custom";
|
|
17
|
+
HookType[HookType["FullBalanceApprove"] = 1] = "FullBalanceApprove";
|
|
18
|
+
HookType[HookType["FullBalanceTransfer"] = 2] = "FullBalanceTransfer";
|
|
19
|
+
})(HookType || (exports.HookType = HookType = {}));
|
|
20
|
+
/**
|
|
21
|
+
* ReplacementType is an enum that contains the type of the replacement
|
|
22
|
+
* @param Amount - The amount replacement
|
|
23
|
+
*/
|
|
24
|
+
var ReplacementType;
|
|
25
|
+
(function (ReplacementType) {
|
|
26
|
+
ReplacementType[ReplacementType["Amount"] = 0] = "Amount";
|
|
27
|
+
})(ReplacementType || (exports.ReplacementType = ReplacementType = {}));
|
|
28
|
+
/**
|
|
29
|
+
* SDK for building AgnosticProxy Zap calls with efficient hook encoding
|
|
30
|
+
* @param agnosticProxyAddress - The address of the agnostic proxy(optional)
|
|
31
|
+
*/
|
|
32
|
+
class AgnosticProxySDK {
|
|
33
|
+
constructor(network, agnosticProxyAddress) {
|
|
34
|
+
this.contractInterfaces = new Map();
|
|
35
|
+
switch (network) {
|
|
36
|
+
case Struct_1.Network.MAINNET:
|
|
37
|
+
this.agnosticProxyAddress = agnosticProxyAddress ?? mainnet_1.AGNOSTIC_PROXY_ADDRESS;
|
|
38
|
+
break;
|
|
39
|
+
case Struct_1.Network.TESTNET:
|
|
40
|
+
this.agnosticProxyAddress = agnosticProxyAddress ?? testnet_1.AGNOSTIC_PROXY_ADDRESS;
|
|
41
|
+
break;
|
|
42
|
+
case Struct_1.Network.DEV:
|
|
43
|
+
if (!agnosticProxyAddress) {
|
|
44
|
+
throw new Error("Agnostic proxy address is required for dev network");
|
|
45
|
+
}
|
|
46
|
+
this.agnosticProxyAddress = agnosticProxyAddress;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add a contract interface for encoding function calls
|
|
52
|
+
* Supports both human-readable ABI strings and generated ABI JSON objects
|
|
53
|
+
* @param address - The address of the contract to add interface for
|
|
54
|
+
* @param abi - The abi of the contract to add interface for
|
|
55
|
+
* @returns The sdk instance
|
|
56
|
+
*/
|
|
57
|
+
addContractInterface(address, abi) {
|
|
58
|
+
const parsedAbi = this._parseAbi(abi);
|
|
59
|
+
this.contractInterfaces.set(address.toLowerCase(), new ethers_1.Interface(parsedAbi));
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Parse ABI - handles both human-readable strings and generated ABI JSON objects
|
|
64
|
+
* Extracts only function definitions from JSON ABI
|
|
65
|
+
*/
|
|
66
|
+
_parseAbi(abi) {
|
|
67
|
+
const humanReadableAbi = [];
|
|
68
|
+
for (const item of abi) {
|
|
69
|
+
// If it's already a string (human-readable format), keep it
|
|
70
|
+
if (typeof item === 'string') {
|
|
71
|
+
humanReadableAbi.push(item);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
// If it's a JSON ABI object, parse it
|
|
75
|
+
if (typeof item === 'object' && item.type) {
|
|
76
|
+
// Only process functions
|
|
77
|
+
if (item.type === 'function') {
|
|
78
|
+
const signature = this._buildFunctionSignature(item);
|
|
79
|
+
if (signature) {
|
|
80
|
+
humanReadableAbi.push(signature);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Skip events, errors, constructor, etc.
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return humanReadableAbi;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Build human-readable function signature from JSON ABI function object
|
|
90
|
+
* @param func - The function to build signature for
|
|
91
|
+
* @returns The signature of the function
|
|
92
|
+
*/
|
|
93
|
+
_buildFunctionSignature(func) {
|
|
94
|
+
if (!func.name || !Array.isArray(func.inputs)) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
// Build parameter list
|
|
98
|
+
const params = func.inputs.map((input) => {
|
|
99
|
+
let paramType = input.type;
|
|
100
|
+
// Handle array types
|
|
101
|
+
if (input.type.includes('[]')) {
|
|
102
|
+
paramType = input.type;
|
|
103
|
+
}
|
|
104
|
+
// Add parameter name if available
|
|
105
|
+
if (input.name) {
|
|
106
|
+
return `${paramType} ${input.name}`;
|
|
107
|
+
}
|
|
108
|
+
return paramType;
|
|
109
|
+
}).join(', ');
|
|
110
|
+
// Build return types if available
|
|
111
|
+
let returnTypes = '';
|
|
112
|
+
if (func.outputs && func.outputs.length > 0) {
|
|
113
|
+
const outputs = func.outputs.map((output) => {
|
|
114
|
+
const outputType = output.type;
|
|
115
|
+
if (output.name) {
|
|
116
|
+
return `${outputType} ${output.name}`;
|
|
117
|
+
}
|
|
118
|
+
return outputType;
|
|
119
|
+
}).join(', ');
|
|
120
|
+
if (func.outputs.length === 1) {
|
|
121
|
+
returnTypes = ` returns (${outputs})`;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
returnTypes = ` returns (${outputs})`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Build full signature
|
|
128
|
+
const stateMutability = func.stateMutability || 'nonpayable';
|
|
129
|
+
let mutabilityKeyword = '';
|
|
130
|
+
if (stateMutability === 'view') {
|
|
131
|
+
mutabilityKeyword = ' view';
|
|
132
|
+
}
|
|
133
|
+
else if (stateMutability === 'pure') {
|
|
134
|
+
mutabilityKeyword = ' pure';
|
|
135
|
+
}
|
|
136
|
+
else if (stateMutability === 'payable') {
|
|
137
|
+
mutabilityKeyword = ' payable';
|
|
138
|
+
}
|
|
139
|
+
return `function ${func.name}(${params})${mutabilityKeyword} external${returnTypes}`;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Create a custom hook with optional dynamic value replacement
|
|
143
|
+
* @param contractAddress - The address of the contract to call
|
|
144
|
+
* @param functionName - The name of the function to call
|
|
145
|
+
* @param params - The parameters of the function to call
|
|
146
|
+
* @param options - The options of the custom hook
|
|
147
|
+
* @returns The custom hook
|
|
148
|
+
*/
|
|
149
|
+
createCustomHook(contractAddress, functionName, params, options = {}) {
|
|
150
|
+
const { isFromSAPerspective = true, value = 0n, dynamicReplacements } = options;
|
|
151
|
+
const contractInterface = this.contractInterfaces.get(contractAddress.toLowerCase());
|
|
152
|
+
if (!contractInterface) {
|
|
153
|
+
throw new Error(`Contract interface not found for address: ${contractAddress}`);
|
|
154
|
+
}
|
|
155
|
+
const data = contractInterface.encodeFunctionData(functionName, params);
|
|
156
|
+
let improvedMissionInfo = "0x";
|
|
157
|
+
// If dynamic replacements are specified, encode them
|
|
158
|
+
if (dynamicReplacements && dynamicReplacements.length > 0) {
|
|
159
|
+
// For now, support single replacement (can be extended)
|
|
160
|
+
const replacement = dynamicReplacements[0];
|
|
161
|
+
const replacementData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(["tuple(uint16,uint16,address,address)"], [[replacement.position, replacement.len, replacement.token, replacement.balanceAddress]]);
|
|
162
|
+
// Encode as ReplacementType.Amount with the replacement data
|
|
163
|
+
improvedMissionInfo = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(["uint8", "bytes"], [ReplacementType.Amount, replacementData]);
|
|
164
|
+
}
|
|
165
|
+
const customHookData = {
|
|
166
|
+
isFromSAPerspective,
|
|
167
|
+
contractAddress,
|
|
168
|
+
value,
|
|
169
|
+
data,
|
|
170
|
+
improvedMissionInfo
|
|
171
|
+
};
|
|
172
|
+
// Encode only the CustomHookData
|
|
173
|
+
const encodedHookData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(["tuple(bool,address,uint256,bytes,bytes)"], [[
|
|
174
|
+
customHookData.isFromSAPerspective,
|
|
175
|
+
customHookData.contractAddress,
|
|
176
|
+
customHookData.value,
|
|
177
|
+
customHookData.data,
|
|
178
|
+
customHookData.improvedMissionInfo
|
|
179
|
+
]]);
|
|
180
|
+
return {
|
|
181
|
+
hookType: HookType.Custom,
|
|
182
|
+
hookData: encodedHookData
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Create a full balance approve hook
|
|
187
|
+
* @param token - The token to approve
|
|
188
|
+
* @param to - The address to approve to
|
|
189
|
+
* @param isFromSAPerspective - Whether the hook is from the smart account perspective or from proxy perspective
|
|
190
|
+
* @returns The full balance approve hook
|
|
191
|
+
*/
|
|
192
|
+
createFullBalanceApproveHook(token, to, isFromSAPerspective = true) {
|
|
193
|
+
const approveHookData = {
|
|
194
|
+
token,
|
|
195
|
+
to,
|
|
196
|
+
isFromSAPerspective
|
|
197
|
+
};
|
|
198
|
+
// Encode only the ApproveHookData
|
|
199
|
+
const encodedHookData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(["tuple(address,address,bool)"], [[approveHookData.token, approveHookData.to, approveHookData.isFromSAPerspective]]);
|
|
200
|
+
return {
|
|
201
|
+
hookType: HookType.FullBalanceApprove,
|
|
202
|
+
hookData: encodedHookData
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Create a full balance transfer hook
|
|
207
|
+
* @param token - The token to transfer
|
|
208
|
+
* @param to - The address to transfer to
|
|
209
|
+
* @param isFromSAPerspective - Whether the hook is from the smart account perspective or from proxy perspective
|
|
210
|
+
* @returns The full balance transfer hook
|
|
211
|
+
*/
|
|
212
|
+
createFullBalanceTransferHook(token, to, isFromSAPerspective = true) {
|
|
213
|
+
const transferHookData = {
|
|
214
|
+
token,
|
|
215
|
+
to,
|
|
216
|
+
isFromSAPerspective
|
|
217
|
+
};
|
|
218
|
+
// Encode only the TransferHookData
|
|
219
|
+
const encodedHookData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(["tuple(address,address,bool)"], [[transferHookData.token, transferHookData.to, transferHookData.isFromSAPerspective]]);
|
|
220
|
+
return {
|
|
221
|
+
hookType: HookType.FullBalanceTransfer,
|
|
222
|
+
hookData: encodedHookData
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Helper to create dynamic amount replacement for a specific parameter
|
|
227
|
+
* @param paramIndex - The index of the parameter to replace
|
|
228
|
+
* @param token - The token to replace
|
|
229
|
+
* @param balanceAddress - The address to replace the parameter with
|
|
230
|
+
* @returns The amount replacement
|
|
231
|
+
*/
|
|
232
|
+
createAmountReplacement(paramIndex, token, balanceAddress) {
|
|
233
|
+
// Calculate position in calldata (4 bytes selector + 32 bytes per param)
|
|
234
|
+
const position = 4 + (paramIndex * 32);
|
|
235
|
+
return {
|
|
236
|
+
position,
|
|
237
|
+
len: 32, // uint256 is 32 bytes
|
|
238
|
+
token,
|
|
239
|
+
balanceAddress
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Advanced replacement calculator - calculates position and length for any parameter type
|
|
244
|
+
* Required that you have added the contract interface first using addContractInterface().
|
|
245
|
+
* If human readable abi is used, need to provide function and params names also
|
|
246
|
+
* @param contractAddress - The address of the contract to call
|
|
247
|
+
* @param functionName - The name of the function to call
|
|
248
|
+
* @param parameterName - The name of the parameter to replace
|
|
249
|
+
* @param token - The token to replace
|
|
250
|
+
* @param balanceAddress - The address to replace the parameter with
|
|
251
|
+
* @returns The replacement data
|
|
252
|
+
*/
|
|
253
|
+
calculateReplacementData(contractAddress, functionName, parameterName, token, balanceAddress) {
|
|
254
|
+
const contractInterface = this.contractInterfaces.get(contractAddress.toLowerCase());
|
|
255
|
+
if (!contractInterface) {
|
|
256
|
+
throw new Error(`Contract interface not found for address: ${contractAddress}. Please add it first using addContractInterface().`);
|
|
257
|
+
}
|
|
258
|
+
let functionFragment;
|
|
259
|
+
try {
|
|
260
|
+
functionFragment = contractInterface.getFunction(functionName);
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
throw new Error(`Function '${functionName}' not found in contract interface for ${contractAddress}`);
|
|
264
|
+
}
|
|
265
|
+
if (!functionFragment) {
|
|
266
|
+
throw new Error(`Function '${functionName}' not found in contract interface for ${contractAddress}`);
|
|
267
|
+
}
|
|
268
|
+
// Find the parameter by name
|
|
269
|
+
const paramIndex = functionFragment.inputs.findIndex(input => input.name === parameterName);
|
|
270
|
+
if (paramIndex === -1) {
|
|
271
|
+
const availableParams = functionFragment.inputs.map(input => `${input.name} (${input.type})`).join(', ');
|
|
272
|
+
throw new Error(`Parameter '${parameterName}' not found in function '${functionName}'. Available parameters: ${availableParams}`);
|
|
273
|
+
}
|
|
274
|
+
const param = functionFragment.inputs[paramIndex];
|
|
275
|
+
// Calculate position and length based on parameter type
|
|
276
|
+
const { position, len } = this._calculateParamPositionAndLength(functionFragment.inputs, paramIndex);
|
|
277
|
+
return {
|
|
278
|
+
position,
|
|
279
|
+
len,
|
|
280
|
+
token,
|
|
281
|
+
balanceAddress
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get replacement helper - shows available functions and parameters for a contract
|
|
286
|
+
* Required that you have added the contract interface first using addContractInterface().
|
|
287
|
+
* If human readable abi is used, need to provide function and params names also
|
|
288
|
+
* @param contractAddress - The address of the contract to call
|
|
289
|
+
* @returns The replacement helper
|
|
290
|
+
*/
|
|
291
|
+
getReplacementHelper(contractAddress) {
|
|
292
|
+
const contractInterface = this.contractInterfaces.get(contractAddress.toLowerCase());
|
|
293
|
+
if (!contractInterface) {
|
|
294
|
+
throw new Error(`Contract interface not found for address: ${contractAddress}. Please add it first using addContractInterface().`);
|
|
295
|
+
}
|
|
296
|
+
const functions = contractInterface.fragments
|
|
297
|
+
.filter(fragment => fragment.type === 'function')
|
|
298
|
+
.map(fragment => {
|
|
299
|
+
const func = fragment;
|
|
300
|
+
return {
|
|
301
|
+
name: func.name,
|
|
302
|
+
signature: func.format('full'),
|
|
303
|
+
parameters: func.inputs.map((input, index) => {
|
|
304
|
+
const canReplace = this._canParameterBeReplaced(input.type);
|
|
305
|
+
return {
|
|
306
|
+
name: input.name || `param${index}`,
|
|
307
|
+
type: input.type,
|
|
308
|
+
index,
|
|
309
|
+
canReplace: canReplace.canReplace,
|
|
310
|
+
reason: canReplace.reason
|
|
311
|
+
};
|
|
312
|
+
})
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
return {
|
|
316
|
+
contractAddress,
|
|
317
|
+
functions
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Interactive replacement builder - helps build replacement step by step
|
|
322
|
+
* @param contractAddress - The address of the contract to call
|
|
323
|
+
* @param functionName - The name of the function to call
|
|
324
|
+
* @param parameterName - The name of the parameter to replace
|
|
325
|
+
* @param token - The token to replace
|
|
326
|
+
* @param balanceAddress - The address to replace the parameter with
|
|
327
|
+
* @param options - The options of the interactive replacement builder
|
|
328
|
+
* @returns The interactive replacement builder
|
|
329
|
+
*/
|
|
330
|
+
buildReplacementInteractive(contractAddress, functionName, parameterName, token, balanceAddress, options = {}) {
|
|
331
|
+
const { showCalculation = true, validate = true } = options;
|
|
332
|
+
// Get the replacement data
|
|
333
|
+
const replacement = this.calculateReplacementData(contractAddress, functionName, parameterName, token, balanceAddress);
|
|
334
|
+
// Get function info for calculation details
|
|
335
|
+
const contractInterface = this.contractInterfaces.get(contractAddress.toLowerCase());
|
|
336
|
+
if (!contractInterface) {
|
|
337
|
+
throw new Error(`Contract interface not found for address: ${contractAddress}`);
|
|
338
|
+
}
|
|
339
|
+
const functionFragment = contractInterface.getFunction(functionName);
|
|
340
|
+
if (!functionFragment) {
|
|
341
|
+
throw new Error(`Function '${functionName}' not found in contract interface for ${contractAddress}`);
|
|
342
|
+
}
|
|
343
|
+
const paramIndex = functionFragment.inputs.findIndex(input => input.name === parameterName);
|
|
344
|
+
const param = functionFragment.inputs[paramIndex];
|
|
345
|
+
const calculation = {
|
|
346
|
+
functionSignature: functionFragment.format('full'),
|
|
347
|
+
parameterInfo: {
|
|
348
|
+
name: parameterName,
|
|
349
|
+
type: param.type,
|
|
350
|
+
index: paramIndex,
|
|
351
|
+
position: replacement.position,
|
|
352
|
+
length: replacement.len
|
|
353
|
+
},
|
|
354
|
+
positionCalculation: `Position = 4 bytes (selector) + ${paramIndex} * 32 bytes = ${replacement.position} bytes`
|
|
355
|
+
};
|
|
356
|
+
// Validation
|
|
357
|
+
const validation = {
|
|
358
|
+
isValid: true,
|
|
359
|
+
warnings: [],
|
|
360
|
+
suggestions: []
|
|
361
|
+
};
|
|
362
|
+
if (validate) {
|
|
363
|
+
// Check if parameter type is suitable for replacement
|
|
364
|
+
const typeCheck = this._canParameterBeReplaced(param.type);
|
|
365
|
+
if (!typeCheck.canReplace) {
|
|
366
|
+
validation.isValid = false;
|
|
367
|
+
validation.warnings.push(`Parameter type '${param.type}' ${typeCheck.reason}`);
|
|
368
|
+
}
|
|
369
|
+
// Check if it's a reasonable parameter to replace
|
|
370
|
+
if (param.name.toLowerCase().includes('amount') || param.name.toLowerCase().includes('value')) {
|
|
371
|
+
validation.suggestions.push(`✅ Parameter '${param.name}' looks suitable for dynamic replacement`);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
validation.warnings.push(`⚠️ Parameter '${param.name}' might not be intended for amount replacement`);
|
|
375
|
+
}
|
|
376
|
+
// Check token address
|
|
377
|
+
if (!ethers_1.ethers.isAddress(token)) {
|
|
378
|
+
validation.isValid = false;
|
|
379
|
+
validation.warnings.push(`Invalid token address: ${token}`);
|
|
380
|
+
}
|
|
381
|
+
if (!ethers_1.ethers.isAddress(balanceAddress)) {
|
|
382
|
+
validation.isValid = false;
|
|
383
|
+
validation.warnings.push(`Invalid balance address: ${balanceAddress}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
replacement,
|
|
388
|
+
calculation,
|
|
389
|
+
validation
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Private helper to calculate position and length for complex parameter types
|
|
394
|
+
* @param inputs - The inputs of the function
|
|
395
|
+
* @param targetIndex - The index of the parameter to calculate the position and length for
|
|
396
|
+
* @returns The position and length of the parameter
|
|
397
|
+
*/
|
|
398
|
+
_calculateParamPositionAndLength(inputs, targetIndex) {
|
|
399
|
+
// For now, we support simple types. Complex types (arrays, structs) would need more sophisticated calculation
|
|
400
|
+
// This is a simplified version that works for basic types like uint256, address, etc.
|
|
401
|
+
let position = 4; // Start after function selector
|
|
402
|
+
for (let i = 0; i < targetIndex; i++) {
|
|
403
|
+
const paramType = inputs[i].type;
|
|
404
|
+
position += this._getTypeSize(paramType);
|
|
405
|
+
}
|
|
406
|
+
const targetType = inputs[targetIndex].type;
|
|
407
|
+
const len = this._getTypeSize(targetType);
|
|
408
|
+
return { position, len };
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Get the size in bytes for a parameter type
|
|
412
|
+
* @param type - The type of the parameter
|
|
413
|
+
* @returns The size in bytes of the parameter
|
|
414
|
+
*/
|
|
415
|
+
_getTypeSize(type) {
|
|
416
|
+
// Basic types are all 32 bytes in calldata (due to ABI encoding)
|
|
417
|
+
if (type.startsWith('uint') || type.startsWith('int') || type === 'address' || type === 'bool' || type.startsWith('bytes32')) {
|
|
418
|
+
return 32;
|
|
419
|
+
}
|
|
420
|
+
// Dynamic types (bytes, string) are also 32 bytes for the offset
|
|
421
|
+
if (type === 'bytes' || type === 'string') {
|
|
422
|
+
return 32;
|
|
423
|
+
}
|
|
424
|
+
// Arrays are 32 bytes for the offset
|
|
425
|
+
if (type.includes('[]')) {
|
|
426
|
+
return 32;
|
|
427
|
+
}
|
|
428
|
+
// Default to 32 bytes for unknown types
|
|
429
|
+
return 32;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Check if a parameter type can be replaced with a balance
|
|
433
|
+
* @param type - The type of the parameter
|
|
434
|
+
* @returns The can replace and reason of the parameter
|
|
435
|
+
*/
|
|
436
|
+
_canParameterBeReplaced(type) {
|
|
437
|
+
if (type.startsWith('uint') && !type.includes('[]')) {
|
|
438
|
+
return { canReplace: true };
|
|
439
|
+
}
|
|
440
|
+
if (type.startsWith('int') && !type.includes('[]')) {
|
|
441
|
+
return { canReplace: true, reason: 'but be careful with signed integers' };
|
|
442
|
+
}
|
|
443
|
+
return {
|
|
444
|
+
canReplace: false,
|
|
445
|
+
reason: `is not suitable for balance replacement. Only uint/int types are supported.`
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Build a complete ZapCall
|
|
450
|
+
* @param hooks - The hooks of the zap call
|
|
451
|
+
* @param bridgeTokens - The tokens to bridge
|
|
452
|
+
* @param bridgeNFTs - The nfts to bridge
|
|
453
|
+
* @returns The zap call
|
|
454
|
+
*/
|
|
455
|
+
buildZapCall(hooks, bridgeTokens = [], bridgeNFTs = []) {
|
|
456
|
+
return {
|
|
457
|
+
hooks,
|
|
458
|
+
bridgeData: {
|
|
459
|
+
tokens: bridgeTokens,
|
|
460
|
+
nfts: bridgeNFTs,
|
|
461
|
+
isRequired: (bridgeTokens.length > 0 || bridgeNFTs.length > 0) ? true : false
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Encode ZapCall for transaction - Much more efficient now!
|
|
467
|
+
* @param zapCall - The zap call to encode
|
|
468
|
+
* @returns The encoded zap call that can be used as calldata in tac sdk
|
|
469
|
+
*/
|
|
470
|
+
encodeZapCall(zapCall) {
|
|
471
|
+
return ethers_1.ethers.AbiCoder.defaultAbiCoder().encode([
|
|
472
|
+
"tuple(" +
|
|
473
|
+
"tuple(uint8,bytes)[]," + // hooks: only hookType and hookData
|
|
474
|
+
"tuple(address[],tuple(address,uint256,uint256)[],bool)" + // bridgeData
|
|
475
|
+
")"
|
|
476
|
+
], [
|
|
477
|
+
[
|
|
478
|
+
zapCall.hooks.map(hook => [hook.hookType, hook.hookData]),
|
|
479
|
+
[
|
|
480
|
+
zapCall.bridgeData.tokens,
|
|
481
|
+
zapCall.bridgeData.nfts.map(nft => [nft.nft, nft.id, nft.amount]),
|
|
482
|
+
zapCall.bridgeData.isRequired
|
|
483
|
+
]
|
|
484
|
+
]
|
|
485
|
+
]);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Utility: Create multiple approve hooks at once
|
|
489
|
+
* @param approvals - The approvals to create
|
|
490
|
+
* @returns The multiple approve hooks
|
|
491
|
+
*/
|
|
492
|
+
createMultipleApproves(approvals) {
|
|
493
|
+
return approvals.map(approval => this.createFullBalanceApproveHook(approval.token, approval.spender, approval.isFromSA ?? true));
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Utility: Create a sequence of custom hooks
|
|
497
|
+
* @param calls - The calls to create
|
|
498
|
+
* @returns The hook sequence
|
|
499
|
+
*/
|
|
500
|
+
createHookSequence(calls) {
|
|
501
|
+
return calls.map(call => this.createCustomHook(call.contract, call.functionName, call.params, call.options));
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Debug helper: Decode hook data back to readable format
|
|
505
|
+
* @param hook - The hook to decode
|
|
506
|
+
* @returns The decoded hook
|
|
507
|
+
*/
|
|
508
|
+
decodeHookData(hook) {
|
|
509
|
+
try {
|
|
510
|
+
switch (hook.hookType) {
|
|
511
|
+
case HookType.Custom:
|
|
512
|
+
return ethers_1.ethers.AbiCoder.defaultAbiCoder().decode(["tuple(bool,address,uint256,bytes,bytes)"], hook.hookData)[0];
|
|
513
|
+
case HookType.FullBalanceApprove:
|
|
514
|
+
return ethers_1.ethers.AbiCoder.defaultAbiCoder().decode(["tuple(address,address,bool)"], hook.hookData)[0];
|
|
515
|
+
case HookType.FullBalanceTransfer:
|
|
516
|
+
return ethers_1.ethers.AbiCoder.defaultAbiCoder().decode(["tuple(address,address,bool)"], hook.hookData)[0];
|
|
517
|
+
default:
|
|
518
|
+
throw new Error(`Unknown hook type: ${hook.hookType}`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
catch (error) {
|
|
522
|
+
throw new Error(`Failed to decode hook data: ${error}`);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Debug helper: Get estimated gas for a ZapCall
|
|
527
|
+
* @param zapCall - The zap call to estimate the gas usage for
|
|
528
|
+
* @returns The estimated gas usage
|
|
529
|
+
*/
|
|
530
|
+
estimateGasUsage(zapCall) {
|
|
531
|
+
// Rough estimation based on hook types and operations
|
|
532
|
+
let gasEstimate = 50000; // Base gas
|
|
533
|
+
zapCall.hooks.forEach(hook => {
|
|
534
|
+
switch (hook.hookType) {
|
|
535
|
+
case HookType.Custom:
|
|
536
|
+
gasEstimate += 100000; // Custom calls can vary widely
|
|
537
|
+
break;
|
|
538
|
+
case HookType.FullBalanceApprove:
|
|
539
|
+
gasEstimate += 50000; // ERC20 approve
|
|
540
|
+
break;
|
|
541
|
+
case HookType.FullBalanceTransfer:
|
|
542
|
+
gasEstimate += 65000; // ERC20 transfer
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
if (zapCall.bridgeData.isRequired) {
|
|
547
|
+
gasEstimate += 200000; // Bridge operations
|
|
548
|
+
}
|
|
549
|
+
return gasEstimate;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Visualize ZapCall chain - Human readable description of all operations
|
|
553
|
+
* @param zapCall - The zap call to visualize
|
|
554
|
+
*/
|
|
555
|
+
visualizeZapCall(zapCall) {
|
|
556
|
+
console.log("🔗 ZapCall Chain Visualization");
|
|
557
|
+
console.log("================================");
|
|
558
|
+
if (zapCall.hooks.length === 0) {
|
|
559
|
+
console.log("❌ No hooks in this ZapCall");
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
zapCall.hooks.forEach((hook, index) => {
|
|
563
|
+
const stepNumber = (index + 1).toString().padStart(2, " ");
|
|
564
|
+
console.log(`\n${stepNumber}. ${this._describeHook(hook)}`);
|
|
565
|
+
});
|
|
566
|
+
// Bridge information
|
|
567
|
+
if (zapCall.bridgeData.isRequired) {
|
|
568
|
+
console.log("\n🌉 Bridge Operations:");
|
|
569
|
+
if (zapCall.bridgeData.tokens.length > 0) {
|
|
570
|
+
console.log(` 📤 Bridge tokens: ${zapCall.bridgeData.tokens.map(t => this._formatAddress(t)).join(", ")}`);
|
|
571
|
+
}
|
|
572
|
+
if (zapCall.bridgeData.nfts.length > 0) {
|
|
573
|
+
console.log(` 🖼️ Bridge NFTs: ${zapCall.bridgeData.nfts.length} NFT(s)`);
|
|
574
|
+
zapCall.bridgeData.nfts.forEach((nft, i) => {
|
|
575
|
+
console.log(` ${i + 1}. ${this._formatAddress(nft.nft)} #${nft.id} (amount: ${nft.amount})`);
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
console.log("\n🚫 No bridge operations required");
|
|
581
|
+
}
|
|
582
|
+
// Summary
|
|
583
|
+
console.log("\n📊 Summary:");
|
|
584
|
+
console.log(` Total hooks: ${zapCall.hooks.length}`);
|
|
585
|
+
console.log(` Estimated gas: ${this.estimateGasUsage(zapCall).toLocaleString()}`);
|
|
586
|
+
console.log(` Bridge required: ${zapCall.bridgeData.isRequired ? "Yes" : "No"}`);
|
|
587
|
+
console.log("================================");
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Private helper to describe individual hooks
|
|
591
|
+
* @param hook - The hook to describe
|
|
592
|
+
* @returns The description of the hook
|
|
593
|
+
*/
|
|
594
|
+
_describeHook(hook) {
|
|
595
|
+
try {
|
|
596
|
+
switch (hook.hookType) {
|
|
597
|
+
case HookType.Custom:
|
|
598
|
+
return this._describeCustomHook(hook);
|
|
599
|
+
case HookType.FullBalanceApprove:
|
|
600
|
+
return this._describeApproveHook(hook);
|
|
601
|
+
case HookType.FullBalanceTransfer:
|
|
602
|
+
return this._describeTransferHook(hook);
|
|
603
|
+
default:
|
|
604
|
+
return `❓ Unknown hook type: ${hook.hookType}`;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
catch (error) {
|
|
608
|
+
return `❌ Error describing hook: ${error}`;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Describe custom hook with function details
|
|
613
|
+
* @param hook - The hook to describe
|
|
614
|
+
* @returns The description of the hook
|
|
615
|
+
*/
|
|
616
|
+
_describeCustomHook(hook) {
|
|
617
|
+
const decoded = this.decodeHookData(hook);
|
|
618
|
+
const [isFromSA, contractAddress, value, data, improvedMissionInfo] = decoded;
|
|
619
|
+
// Try to decode function name from data
|
|
620
|
+
let functionDescription = "unknown function";
|
|
621
|
+
let hasReplacements = false;
|
|
622
|
+
if (data && data.length >= 10) { // At least 4 bytes for selector + some data
|
|
623
|
+
const selector = data.slice(0, 10); // "0x" + 8 hex chars
|
|
624
|
+
// Try to find function name from registered interfaces
|
|
625
|
+
for (const [address, contractInterface] of this.contractInterfaces) {
|
|
626
|
+
if (address === contractAddress.toLowerCase()) {
|
|
627
|
+
try {
|
|
628
|
+
const fragment = contractInterface.getFunction(selector);
|
|
629
|
+
if (fragment) {
|
|
630
|
+
functionDescription = `${fragment.name}(${fragment.inputs.map(input => input.type).join(", ")})`;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
catch {
|
|
635
|
+
// Function not found in this interface
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
// If not found in registered interfaces, just show selector
|
|
640
|
+
if (functionDescription === "unknown function") {
|
|
641
|
+
functionDescription = `function with selector ${selector}`;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
// Check for dynamic replacements
|
|
645
|
+
if (improvedMissionInfo && improvedMissionInfo !== "0x" && improvedMissionInfo.length > 2) {
|
|
646
|
+
hasReplacements = true;
|
|
647
|
+
}
|
|
648
|
+
const perspective = isFromSA ? "Smart Account" : "Proxy Contract";
|
|
649
|
+
const valueStr = value > 0n ? ` (sending ${ethers_1.ethers.formatEther(value)} ETH)` : "";
|
|
650
|
+
const replacementStr = hasReplacements ? " 🔄 [with dynamic value replacement]" : "";
|
|
651
|
+
return `📞 Custom call to ${this._formatAddress(contractAddress)} from ${perspective}${valueStr}
|
|
652
|
+
Function: ${functionDescription}${replacementStr}`;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Describe approve hook
|
|
656
|
+
* @param hook - The hook to describe
|
|
657
|
+
* @returns The description of the hook
|
|
658
|
+
*/
|
|
659
|
+
_describeApproveHook(hook) {
|
|
660
|
+
const decoded = this.decodeHookData(hook);
|
|
661
|
+
const [token, to, isFromSA] = decoded;
|
|
662
|
+
const perspective = isFromSA ? "Smart Account" : "Proxy Contract";
|
|
663
|
+
return `✅ Approve full balance of ${this._formatAddress(token)} to ${this._formatAddress(to)} from ${perspective}`;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Describe transfer hook
|
|
667
|
+
* @param hook - The hook to describe
|
|
668
|
+
* @returns The description of the hook
|
|
669
|
+
*/
|
|
670
|
+
_describeTransferHook(hook) {
|
|
671
|
+
const decoded = this.decodeHookData(hook);
|
|
672
|
+
const [token, to, isFromSA] = decoded;
|
|
673
|
+
const perspective = isFromSA ? "Smart Account" : "Proxy Contract";
|
|
674
|
+
return `💸 Transfer full balance of ${this._formatAddress(token)} to ${this._formatAddress(to)} from ${perspective}`;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Format address for display (show first 6 and last 4 characters)
|
|
678
|
+
* @param address - The address to format
|
|
679
|
+
* @returns The formatted address
|
|
680
|
+
*/
|
|
681
|
+
_formatAddress(address) {
|
|
682
|
+
if (!address || address.length < 10)
|
|
683
|
+
return address;
|
|
684
|
+
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Get a detailed breakdown of a ZapCall for logging
|
|
688
|
+
* @param zapCall - The zap call to get the breakdown for
|
|
689
|
+
* @returns The breakdown of the zap call
|
|
690
|
+
*/
|
|
691
|
+
getZapCallBreakdown(zapCall) {
|
|
692
|
+
const hookTypes = {};
|
|
693
|
+
const hookDescriptions = [];
|
|
694
|
+
zapCall.hooks.forEach((hook, index) => {
|
|
695
|
+
const typeName = HookType[hook.hookType];
|
|
696
|
+
hookTypes[typeName] = (hookTypes[typeName] || 0) + 1;
|
|
697
|
+
hookDescriptions.push(`${index + 1}. ${this._describeHook(hook)}`);
|
|
698
|
+
});
|
|
699
|
+
return {
|
|
700
|
+
totalHooks: zapCall.hooks.length,
|
|
701
|
+
hookTypes,
|
|
702
|
+
gasEstimate: this.estimateGasUsage(zapCall),
|
|
703
|
+
encodedSize: this.encodeZapCall(zapCall).length / 2, // bytes
|
|
704
|
+
bridgeRequired: zapCall.bridgeData.isRequired,
|
|
705
|
+
hookDescriptions
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Compare two ZapCalls and show differences
|
|
710
|
+
* @param zapCall1 - The first zap call to compare
|
|
711
|
+
* @param zapCall2 - The second zap call to compare
|
|
712
|
+
* @param label1 - The label of the first zap call
|
|
713
|
+
* @param label2 - The label of the second zap call
|
|
714
|
+
*/
|
|
715
|
+
compareZapCalls(zapCall1, zapCall2, label1 = "ZapCall 1", label2 = "ZapCall 2") {
|
|
716
|
+
console.log(`🔄 Comparing ${label1} vs ${label2}`);
|
|
717
|
+
console.log("=".repeat(50));
|
|
718
|
+
const breakdown1 = this.getZapCallBreakdown(zapCall1);
|
|
719
|
+
const breakdown2 = this.getZapCallBreakdown(zapCall2);
|
|
720
|
+
console.log(`📊 ${label1}:`);
|
|
721
|
+
console.log(` Hooks: ${breakdown1.totalHooks}, Gas: ${breakdown1.gasEstimate.toLocaleString()}, Size: ${breakdown1.encodedSize} bytes`);
|
|
722
|
+
console.log(`📊 ${label2}:`);
|
|
723
|
+
console.log(` Hooks: ${breakdown2.totalHooks}, Gas: ${breakdown2.gasEstimate.toLocaleString()}, Size: ${breakdown2.encodedSize} bytes`);
|
|
724
|
+
console.log("\n📈 Differences:");
|
|
725
|
+
console.log(` Hooks: ${breakdown2.totalHooks - breakdown1.totalHooks > 0 ? "+" : ""}${breakdown2.totalHooks - breakdown1.totalHooks}`);
|
|
726
|
+
console.log(` Gas: ${breakdown2.gasEstimate - breakdown1.gasEstimate > 0 ? "+" : ""}${(breakdown2.gasEstimate - breakdown1.gasEstimate).toLocaleString()}`);
|
|
727
|
+
console.log(` Size: ${breakdown2.encodedSize - breakdown1.encodedSize > 0 ? "+" : ""}${breakdown2.encodedSize - breakdown1.encodedSize} bytes`);
|
|
728
|
+
}
|
|
729
|
+
getAgnosticCallParams() {
|
|
730
|
+
return {
|
|
731
|
+
evmTargetAddress: this.agnosticProxyAddress,
|
|
732
|
+
methodName: "Zap(bytes,bytes)",
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
exports.AgnosticProxySDK = AgnosticProxySDK;
|