@sign-global/tokentable 0.0.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/.github/workflows/push.yml +33 -0
- package/.prettierignore +2 -0
- package/.prettierrc +7 -0
- package/README.md +186 -0
- package/dist/cjs/airdrop/BaseAirdropClient.d.ts +28 -0
- package/dist/cjs/airdrop/BaseAirdropClient.js +50 -0
- package/dist/cjs/airdrop/BaseAirdropClient.js.map +1 -0
- package/dist/cjs/airdrop/EvmAirdropClient.d.ts +19 -0
- package/dist/cjs/airdrop/EvmAirdropClient.js +65 -0
- package/dist/cjs/airdrop/EvmAirdropClient.js.map +1 -0
- package/dist/cjs/airdrop/TonAirdropClient.d.ts +24 -0
- package/dist/cjs/airdrop/TonAirdropClient.js +78 -0
- package/dist/cjs/airdrop/TonAirdropClient.js.map +1 -0
- package/dist/cjs/airdrop/common/index.d.ts +1034 -0
- package/dist/cjs/airdrop/common/index.js +37 -0
- package/dist/cjs/airdrop/common/index.js.map +1 -0
- package/dist/cjs/airdrop/common/projectDataForTon.d.ts +79 -0
- package/dist/cjs/airdrop/common/projectDataForTon.js +83 -0
- package/dist/cjs/airdrop/common/projectDataForTon.js.map +1 -0
- package/dist/cjs/airdrop/constants/chain-config.d.ts +1043 -0
- package/dist/cjs/airdrop/constants/chain-config.js +90 -0
- package/dist/cjs/airdrop/constants/chain-config.js.map +1 -0
- package/dist/cjs/airdrop/constants/index.d.ts +2 -0
- package/dist/cjs/airdrop/constants/index.js +20 -0
- package/dist/cjs/airdrop/constants/index.js.map +1 -0
- package/dist/cjs/airdrop/constants/network.d.ts +90 -0
- package/dist/cjs/airdrop/constants/network.js +79 -0
- package/dist/cjs/airdrop/constants/network.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/AirdropService.d.ts +36 -0
- package/dist/cjs/airdrop/core/evm/AirdropService.js +146 -0
- package/dist/cjs/airdrop/core/evm/AirdropService.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV2Client.d.ts +8 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV2Client.js +40 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV2Client.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV3Client.d.ts +16 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV3Client.js +49 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV3Client.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV3FeeClient.d.ts +6 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV3FeeClient.js +21 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV3FeeClient.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV4Client.d.ts +13 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV4Client.js +28 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropV4Client.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/ContractBaseClient.d.ts +28 -0
- package/dist/cjs/airdrop/core/evm/contracts/ContractBaseClient.js +60 -0
- package/dist/cjs/airdrop/core/evm/contracts/ContractBaseClient.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/DeployClient.d.ts +7 -0
- package/dist/cjs/airdrop/core/evm/contracts/DeployClient.js +38 -0
- package/dist/cjs/airdrop/core/evm/contracts/DeployClient.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/FeeCollectorClient.d.ts +6 -0
- package/dist/cjs/airdrop/core/evm/contracts/FeeCollectorClient.js +26 -0
- package/dist/cjs/airdrop/core/evm/contracts/FeeCollectorClient.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/KycClient.d.ts +6 -0
- package/dist/cjs/airdrop/core/evm/contracts/KycClient.js +26 -0
- package/dist/cjs/airdrop/core/evm/contracts/KycClient.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/AirdropV2.json +676 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/AirdropV3.json +740 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/AirdropV3_Fee.json +678 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/CustomFeeNativeAirdropV4.json +701 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/Deployer.json +271 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/FeeCollector.json +322 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/KycHook.json +312 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV1.d.ts +24 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV1.js +104 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV1.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV2.d.ts +28 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV2.js +102 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV2.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV3.d.ts +28 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV3.js +109 -0
- package/dist/cjs/airdrop/core/ton/AirdropClientV3.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/AirdropService.d.ts +40 -0
- package/dist/cjs/airdrop/core/ton/AirdropService.js +102 -0
- package/dist/cjs/airdrop/core/ton/AirdropService.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/TonContractBaseClient.d.ts +33 -0
- package/dist/cjs/airdrop/core/ton/TonContractBaseClient.js +215 -0
- package/dist/cjs/airdrop/core/ton/TonContractBaseClient.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/build/Leaf.compiled.json +1 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/constants.d.ts +40 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/constants.js +47 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/constants.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/date.utils.d.ts +3 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/date.utils.js +15 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/date.utils.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/index.d.ts +3 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/index.js +20 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/index.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/ton.utils.d.ts +17 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/ton.utils.js +87 -0
- package/dist/cjs/airdrop/core/ton/v1/utils/ton.utils.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/JettonMinter.d.ts +24 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/JettonMinter.js +67 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/JettonMinter.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/JettonWallet.d.ts +23 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/JettonWallet.js +63 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/JettonWallet.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/Leaf.d.ts +26 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/Leaf.js +77 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/Leaf.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/MerkleTokenDistributor.d.ts +62 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/MerkleTokenDistributor.js +228 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/MerkleTokenDistributor.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/index.d.ts +2 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/index.js +19 -0
- package/dist/cjs/airdrop/core/ton/v1/wrappers/index.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v2/build/Leaf.compiled.json +1 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/constants.d.ts +41 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/constants.js +48 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/constants.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/date.utils.d.ts +3 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/date.utils.js +15 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/date.utils.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/index.d.ts +3 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/index.js +20 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/index.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/ton.utils.d.ts +20 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/ton.utils.js +104 -0
- package/dist/cjs/airdrop/core/ton/v2/utils/ton.utils.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/Leaf.d.ts +24 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/Leaf.js +60 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/Leaf.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/MerkleTokenDistributor.d.ts +65 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/MerkleTokenDistributor.js +245 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/MerkleTokenDistributor.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/index.d.ts +2 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/index.js +19 -0
- package/dist/cjs/airdrop/core/ton/v2/wrappers/index.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v3/build/Leaf.compiled.json +1 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/constants.d.ts +40 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/constants.js +47 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/constants.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/date.utils.d.ts +3 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/date.utils.js +15 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/date.utils.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/index.d.ts +3 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/index.js +20 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/index.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/ton.utils.d.ts +17 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/ton.utils.js +87 -0
- package/dist/cjs/airdrop/core/ton/v3/utils/ton.utils.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/Leaf.d.ts +24 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/Leaf.js +60 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/Leaf.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/MerkleTokenDistributor.d.ts +63 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/MerkleTokenDistributor.js +225 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/MerkleTokenDistributor.js.map +1 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/index.d.ts +2 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/index.js +19 -0
- package/dist/cjs/airdrop/core/ton/v3/wrappers/index.js.map +1 -0
- package/dist/cjs/airdrop/index.d.ts +3 -0
- package/dist/cjs/airdrop/index.js +23 -0
- package/dist/cjs/airdrop/index.js.map +1 -0
- package/dist/cjs/airdrop/services/index.d.ts +23 -0
- package/dist/cjs/airdrop/services/index.js +44 -0
- package/dist/cjs/airdrop/services/index.js.map +1 -0
- package/dist/cjs/airdrop/services/wallet-service/ton/WalletService.d.ts +46 -0
- package/dist/cjs/airdrop/services/wallet-service/ton/WalletService.js +173 -0
- package/dist/cjs/airdrop/services/wallet-service/ton/WalletService.js.map +1 -0
- package/dist/cjs/airdrop/services/wallet-service/ton/index.d.ts +1 -0
- package/dist/cjs/airdrop/services/wallet-service/ton/index.js +6 -0
- package/dist/cjs/airdrop/services/wallet-service/ton/index.js.map +1 -0
- package/dist/cjs/airdrop/types/index.d.ts +105 -0
- package/dist/cjs/airdrop/types/index.js +21 -0
- package/dist/cjs/airdrop/types/index.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/utils/api-client.d.ts +18 -0
- package/dist/cjs/utils/api-client.js +47 -0
- package/dist/cjs/utils/api-client.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +3 -0
- package/dist/cjs/utils/index.js +20 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/utils.d.ts +7 -0
- package/dist/cjs/utils/utils.js +39 -0
- package/dist/cjs/utils/utils.js.map +1 -0
- package/dist/cjs/utils/web3.d.ts +1 -0
- package/dist/cjs/utils/web3.js +15 -0
- package/dist/cjs/utils/web3.js.map +1 -0
- package/dist/esm/airdrop/BaseAirdropClient.d.ts +28 -0
- package/dist/esm/airdrop/BaseAirdropClient.js +46 -0
- package/dist/esm/airdrop/BaseAirdropClient.js.map +1 -0
- package/dist/esm/airdrop/EvmAirdropClient.d.ts +19 -0
- package/dist/esm/airdrop/EvmAirdropClient.js +61 -0
- package/dist/esm/airdrop/EvmAirdropClient.js.map +1 -0
- package/dist/esm/airdrop/TonAirdropClient.d.ts +24 -0
- package/dist/esm/airdrop/TonAirdropClient.js +74 -0
- package/dist/esm/airdrop/TonAirdropClient.js.map +1 -0
- package/dist/esm/airdrop/common/index.d.ts +1034 -0
- package/dist/esm/airdrop/common/index.js +30 -0
- package/dist/esm/airdrop/common/index.js.map +1 -0
- package/dist/esm/airdrop/common/projectDataForTon.d.ts +79 -0
- package/dist/esm/airdrop/common/projectDataForTon.js +80 -0
- package/dist/esm/airdrop/common/projectDataForTon.js.map +1 -0
- package/dist/esm/airdrop/constants/chain-config.d.ts +1043 -0
- package/dist/esm/airdrop/constants/chain-config.js +87 -0
- package/dist/esm/airdrop/constants/chain-config.js.map +1 -0
- package/dist/esm/airdrop/constants/index.d.ts +2 -0
- package/dist/esm/airdrop/constants/index.js +3 -0
- package/dist/esm/airdrop/constants/index.js.map +1 -0
- package/dist/esm/airdrop/constants/network.d.ts +90 -0
- package/dist/esm/airdrop/constants/network.js +76 -0
- package/dist/esm/airdrop/constants/network.js.map +1 -0
- package/dist/esm/airdrop/core/evm/AirdropService.d.ts +36 -0
- package/dist/esm/airdrop/core/evm/AirdropService.js +142 -0
- package/dist/esm/airdrop/core/evm/AirdropService.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV2Client.d.ts +8 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV2Client.js +33 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV2Client.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV3Client.d.ts +16 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV3Client.js +42 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV3Client.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV3FeeClient.d.ts +6 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV3FeeClient.js +14 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV3FeeClient.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV4Client.d.ts +13 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV4Client.js +21 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropV4Client.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/ContractBaseClient.d.ts +28 -0
- package/dist/esm/airdrop/core/evm/contracts/ContractBaseClient.js +56 -0
- package/dist/esm/airdrop/core/evm/contracts/ContractBaseClient.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/DeployClient.d.ts +7 -0
- package/dist/esm/airdrop/core/evm/contracts/DeployClient.js +31 -0
- package/dist/esm/airdrop/core/evm/contracts/DeployClient.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/FeeCollectorClient.d.ts +6 -0
- package/dist/esm/airdrop/core/evm/contracts/FeeCollectorClient.js +19 -0
- package/dist/esm/airdrop/core/evm/contracts/FeeCollectorClient.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/KycClient.d.ts +6 -0
- package/dist/esm/airdrop/core/evm/contracts/KycClient.js +19 -0
- package/dist/esm/airdrop/core/evm/contracts/KycClient.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/AirdropV2.json +676 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/AirdropV3.json +740 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/AirdropV3_Fee.json +678 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/CustomFeeNativeAirdropV4.json +701 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/Deployer.json +271 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/FeeCollector.json +322 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/KycHook.json +312 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV1.d.ts +24 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV1.js +97 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV1.js.map +1 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV2.d.ts +28 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV2.js +95 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV2.js.map +1 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV3.d.ts +28 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV3.js +102 -0
- package/dist/esm/airdrop/core/ton/AirdropClientV3.js.map +1 -0
- package/dist/esm/airdrop/core/ton/AirdropService.d.ts +40 -0
- package/dist/esm/airdrop/core/ton/AirdropService.js +98 -0
- package/dist/esm/airdrop/core/ton/AirdropService.js.map +1 -0
- package/dist/esm/airdrop/core/ton/TonContractBaseClient.d.ts +33 -0
- package/dist/esm/airdrop/core/ton/TonContractBaseClient.js +211 -0
- package/dist/esm/airdrop/core/ton/TonContractBaseClient.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/build/Leaf.compiled.json +1 -0
- package/dist/esm/airdrop/core/ton/v1/utils/constants.d.ts +40 -0
- package/dist/esm/airdrop/core/ton/v1/utils/constants.js +44 -0
- package/dist/esm/airdrop/core/ton/v1/utils/constants.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/utils/date.utils.d.ts +3 -0
- package/dist/esm/airdrop/core/ton/v1/utils/date.utils.js +10 -0
- package/dist/esm/airdrop/core/ton/v1/utils/date.utils.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/utils/index.d.ts +3 -0
- package/dist/esm/airdrop/core/ton/v1/utils/index.js +4 -0
- package/dist/esm/airdrop/core/ton/v1/utils/index.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/utils/ton.utils.d.ts +17 -0
- package/dist/esm/airdrop/core/ton/v1/utils/ton.utils.js +69 -0
- package/dist/esm/airdrop/core/ton/v1/utils/ton.utils.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/JettonMinter.d.ts +24 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/JettonMinter.js +62 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/JettonMinter.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/JettonWallet.d.ts +23 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/JettonWallet.js +58 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/JettonWallet.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/Leaf.d.ts +26 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/Leaf.js +72 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/Leaf.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/MerkleTokenDistributor.d.ts +62 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/MerkleTokenDistributor.js +222 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/MerkleTokenDistributor.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/index.d.ts +2 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/index.js +3 -0
- package/dist/esm/airdrop/core/ton/v1/wrappers/index.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v2/build/Leaf.compiled.json +1 -0
- package/dist/esm/airdrop/core/ton/v2/utils/constants.d.ts +41 -0
- package/dist/esm/airdrop/core/ton/v2/utils/constants.js +45 -0
- package/dist/esm/airdrop/core/ton/v2/utils/constants.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v2/utils/date.utils.d.ts +3 -0
- package/dist/esm/airdrop/core/ton/v2/utils/date.utils.js +10 -0
- package/dist/esm/airdrop/core/ton/v2/utils/date.utils.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v2/utils/index.d.ts +3 -0
- package/dist/esm/airdrop/core/ton/v2/utils/index.js +4 -0
- package/dist/esm/airdrop/core/ton/v2/utils/index.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v2/utils/ton.utils.d.ts +20 -0
- package/dist/esm/airdrop/core/ton/v2/utils/ton.utils.js +83 -0
- package/dist/esm/airdrop/core/ton/v2/utils/ton.utils.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/Leaf.d.ts +24 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/Leaf.js +55 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/Leaf.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/MerkleTokenDistributor.d.ts +65 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/MerkleTokenDistributor.js +239 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/MerkleTokenDistributor.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/index.d.ts +2 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/index.js +3 -0
- package/dist/esm/airdrop/core/ton/v2/wrappers/index.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v3/build/Leaf.compiled.json +1 -0
- package/dist/esm/airdrop/core/ton/v3/utils/constants.d.ts +40 -0
- package/dist/esm/airdrop/core/ton/v3/utils/constants.js +44 -0
- package/dist/esm/airdrop/core/ton/v3/utils/constants.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v3/utils/date.utils.d.ts +3 -0
- package/dist/esm/airdrop/core/ton/v3/utils/date.utils.js +10 -0
- package/dist/esm/airdrop/core/ton/v3/utils/date.utils.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v3/utils/index.d.ts +3 -0
- package/dist/esm/airdrop/core/ton/v3/utils/index.js +4 -0
- package/dist/esm/airdrop/core/ton/v3/utils/index.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v3/utils/ton.utils.d.ts +17 -0
- package/dist/esm/airdrop/core/ton/v3/utils/ton.utils.js +69 -0
- package/dist/esm/airdrop/core/ton/v3/utils/ton.utils.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/Leaf.d.ts +24 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/Leaf.js +55 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/Leaf.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/MerkleTokenDistributor.d.ts +63 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/MerkleTokenDistributor.js +219 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/MerkleTokenDistributor.js.map +1 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/index.d.ts +2 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/index.js +3 -0
- package/dist/esm/airdrop/core/ton/v3/wrappers/index.js.map +1 -0
- package/dist/esm/airdrop/index.d.ts +3 -0
- package/dist/esm/airdrop/index.js +4 -0
- package/dist/esm/airdrop/index.js.map +1 -0
- package/dist/esm/airdrop/services/index.d.ts +23 -0
- package/dist/esm/airdrop/services/index.js +35 -0
- package/dist/esm/airdrop/services/index.js.map +1 -0
- package/dist/esm/airdrop/services/wallet-service/ton/WalletService.d.ts +46 -0
- package/dist/esm/airdrop/services/wallet-service/ton/WalletService.js +169 -0
- package/dist/esm/airdrop/services/wallet-service/ton/WalletService.js.map +1 -0
- package/dist/esm/airdrop/services/wallet-service/ton/index.d.ts +1 -0
- package/dist/esm/airdrop/services/wallet-service/ton/index.js +2 -0
- package/dist/esm/airdrop/services/wallet-service/ton/index.js.map +1 -0
- package/dist/esm/airdrop/types/index.d.ts +105 -0
- package/dist/esm/airdrop/types/index.js +18 -0
- package/dist/esm/airdrop/types/index.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/utils/api-client.d.ts +18 -0
- package/dist/esm/utils/api-client.js +43 -0
- package/dist/esm/utils/api-client.js.map +1 -0
- package/dist/esm/utils/index.d.ts +3 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/utils.d.ts +7 -0
- package/dist/esm/utils/utils.js +29 -0
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/esm/utils/web3.d.ts +1 -0
- package/dist/esm/utils/web3.js +9 -0
- package/dist/esm/utils/web3.js.map +1 -0
- package/index.ts +34 -0
- package/package.json +34 -0
- package/src/airdrop/BaseAirdropClient.ts +75 -0
- package/src/airdrop/EvmAirdropClient.ts +74 -0
- package/src/airdrop/TonAirdropClient.ts +93 -0
- package/src/airdrop/common/index.ts +49 -0
- package/src/airdrop/common/projectDataForTon.ts +79 -0
- package/src/airdrop/constants/chain-config.ts +102 -0
- package/src/airdrop/constants/index.ts +3 -0
- package/src/airdrop/constants/network.ts +78 -0
- package/src/airdrop/core/evm/AirdropService.ts +182 -0
- package/src/airdrop/core/evm/contracts/AirdropV2Client.ts +37 -0
- package/src/airdrop/core/evm/contracts/AirdropV3Client.ts +49 -0
- package/src/airdrop/core/evm/contracts/AirdropV3FeeClient.ts +16 -0
- package/src/airdrop/core/evm/contracts/AirdropV4Client.ts +36 -0
- package/src/airdrop/core/evm/contracts/ContractBaseClient.ts +85 -0
- package/src/airdrop/core/evm/contracts/DeployClient.ts +35 -0
- package/src/airdrop/core/evm/contracts/FeeCollectorClient.ts +21 -0
- package/src/airdrop/core/evm/contracts/KycClient.ts +21 -0
- package/src/airdrop/core/evm/contracts/abis/Airdrop.json +674 -0
- package/src/airdrop/core/evm/contracts/abis/AirdropV2.json +676 -0
- package/src/airdrop/core/evm/contracts/abis/AirdropV3.json +740 -0
- package/src/airdrop/core/evm/contracts/abis/AirdropV3_Fee.json +678 -0
- package/src/airdrop/core/evm/contracts/abis/CustomFeeNativeAirdropV4.json +701 -0
- package/src/airdrop/core/evm/contracts/abis/Deployer.json +271 -0
- package/src/airdrop/core/evm/contracts/abis/ERC721.json +737 -0
- package/src/airdrop/core/evm/contracts/abis/FeeCollector.json +322 -0
- package/src/airdrop/core/evm/contracts/abis/KycHook.json +312 -0
- package/src/airdrop/core/ton/AirdropClientV1.ts +122 -0
- package/src/airdrop/core/ton/AirdropClientV2.ts +118 -0
- package/src/airdrop/core/ton/AirdropClientV3.ts +127 -0
- package/src/airdrop/core/ton/AirdropService.ts +121 -0
- package/src/airdrop/core/ton/TonContractBaseClient.ts +235 -0
- package/src/airdrop/core/ton/v1/build/Leaf.compiled.json +1 -0
- package/src/airdrop/core/ton/v1/build/MerkleTokenDistributor.compiled.json +1 -0
- package/src/airdrop/core/ton/v1/utils/constants.ts +42 -0
- package/src/airdrop/core/ton/v1/utils/date.utils.ts +11 -0
- package/src/airdrop/core/ton/v1/utils/index.ts +3 -0
- package/src/airdrop/core/ton/v1/utils/ton.utils.ts +84 -0
- package/src/airdrop/core/ton/v1/wrappers/JettonMinter.ts +81 -0
- package/src/airdrop/core/ton/v1/wrappers/JettonWallet.ts +73 -0
- package/src/airdrop/core/ton/v1/wrappers/Leaf.ts +88 -0
- package/src/airdrop/core/ton/v1/wrappers/MerkleTokenDistributor.ts +317 -0
- package/src/airdrop/core/ton/v1/wrappers/index.ts +2 -0
- package/src/airdrop/core/ton/v2/build/Leaf.compiled.json +1 -0
- package/src/airdrop/core/ton/v2/build/MerkleTokenDistributor.compiled.json +1 -0
- package/src/airdrop/core/ton/v2/utils/constants.ts +43 -0
- package/src/airdrop/core/ton/v2/utils/date.utils.ts +11 -0
- package/src/airdrop/core/ton/v2/utils/index.ts +3 -0
- package/src/airdrop/core/ton/v2/utils/ton.utils.ts +102 -0
- package/src/airdrop/core/ton/v2/wrappers/Leaf.ts +69 -0
- package/src/airdrop/core/ton/v2/wrappers/MerkleTokenDistributor.ts +340 -0
- package/src/airdrop/core/ton/v2/wrappers/index.ts +2 -0
- package/src/airdrop/core/ton/v3/build/Leaf.compiled.json +1 -0
- package/src/airdrop/core/ton/v3/build/MerkleTokenDistributor.compiled.json +1 -0
- package/src/airdrop/core/ton/v3/utils/constants.ts +43 -0
- package/src/airdrop/core/ton/v3/utils/date.utils.ts +11 -0
- package/src/airdrop/core/ton/v3/utils/index.ts +3 -0
- package/src/airdrop/core/ton/v3/utils/ton.utils.ts +84 -0
- package/src/airdrop/core/ton/v3/wrappers/Leaf.ts +68 -0
- package/src/airdrop/core/ton/v3/wrappers/MerkleTokenDistributor.ts +316 -0
- package/src/airdrop/core/ton/v3/wrappers/index.ts +2 -0
- package/src/airdrop/index.ts +3 -0
- package/src/airdrop/services/index.ts +63 -0
- package/src/airdrop/services/wallet-service/ton/WalletService.ts +226 -0
- package/src/airdrop/services/wallet-service/ton/index.ts +1 -0
- package/src/airdrop/types/index.ts +128 -0
- package/src/index.ts +1 -0
- package/src/utils/api-client.ts +68 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/utils.ts +30 -0
- package/src/utils/web3.ts +8 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Address,
|
|
3
|
+
beginCell,
|
|
4
|
+
Builder,
|
|
5
|
+
Cell,
|
|
6
|
+
Contract,
|
|
7
|
+
contractAddress,
|
|
8
|
+
ContractProvider,
|
|
9
|
+
Dictionary,
|
|
10
|
+
Sender,
|
|
11
|
+
SendMode,
|
|
12
|
+
Slice,
|
|
13
|
+
toNano,
|
|
14
|
+
TupleItem
|
|
15
|
+
} from '@ton/core';
|
|
16
|
+
import { CodeType, dateToUnixTimestamp, intToString, OpCode, stringToInt, unixTimestampToDate } from '../utils';
|
|
17
|
+
|
|
18
|
+
export type MerkleTokenDistributorConfig = {
|
|
19
|
+
version: string;
|
|
20
|
+
adminAddress: Address;
|
|
21
|
+
root: bigint;
|
|
22
|
+
deployer: Address;
|
|
23
|
+
token?: Address;
|
|
24
|
+
startTime: Date;
|
|
25
|
+
endTime: Date;
|
|
26
|
+
leafCode: Cell;
|
|
27
|
+
claimFee: bigint;
|
|
28
|
+
claimFeeAddress: Address;
|
|
29
|
+
paused?: boolean;
|
|
30
|
+
feelessThreshold?: bigint;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export function tokenDistributorConfigToCell(config: MerkleTokenDistributorConfig): Cell {
|
|
34
|
+
const {
|
|
35
|
+
version,
|
|
36
|
+
adminAddress,
|
|
37
|
+
deployer,
|
|
38
|
+
endTime,
|
|
39
|
+
leafCode,
|
|
40
|
+
root,
|
|
41
|
+
startTime,
|
|
42
|
+
token,
|
|
43
|
+
claimFee,
|
|
44
|
+
claimFeeAddress,
|
|
45
|
+
paused = false,
|
|
46
|
+
feelessThreshold = 0
|
|
47
|
+
} = config;
|
|
48
|
+
const c2 = beginCell()
|
|
49
|
+
.storeCoins(claimFee)
|
|
50
|
+
.storeAddress(claimFeeAddress)
|
|
51
|
+
.storeUint(paused ? 1 : 0, 1)
|
|
52
|
+
.storeCoins(feelessThreshold)
|
|
53
|
+
.endCell();
|
|
54
|
+
|
|
55
|
+
const c1 = beginCell()
|
|
56
|
+
.storeAddress(deployer)
|
|
57
|
+
.storeAddress(token)
|
|
58
|
+
.storeUint(dateToUnixTimestamp(startTime), 32)
|
|
59
|
+
.storeUint(dateToUnixTimestamp(endTime), 32)
|
|
60
|
+
.storeRef(leafCode)
|
|
61
|
+
.endCell();
|
|
62
|
+
|
|
63
|
+
return beginCell()
|
|
64
|
+
.storeUint(stringToInt(version), 64)
|
|
65
|
+
.storeAddress(adminAddress)
|
|
66
|
+
.storeUint(root, 256)
|
|
67
|
+
.storeRef(c1)
|
|
68
|
+
.storeRef(c2)
|
|
69
|
+
.endCell();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type TokenDistributorEntry = {
|
|
73
|
+
address: Address;
|
|
74
|
+
claimableAmount: bigint;
|
|
75
|
+
claimableTimestamp: number;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const tokenDistributorEntryValue = {
|
|
79
|
+
serialize: (src: TokenDistributorEntry, buidler: Builder) => {
|
|
80
|
+
buidler.storeAddress(src.address).storeCoins(src.claimableAmount).storeUint(src.claimableTimestamp, 32);
|
|
81
|
+
},
|
|
82
|
+
parse: (src: Slice) => {
|
|
83
|
+
return {
|
|
84
|
+
address: src.loadAddress(),
|
|
85
|
+
claimableAmount: src.loadCoins(),
|
|
86
|
+
claimableTimestamp: src.loadUint(32)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export function generateEntriesDictionary(entries: TokenDistributorEntry[]): Dictionary<bigint, TokenDistributorEntry> {
|
|
92
|
+
const dict: Dictionary<bigint, TokenDistributorEntry> = Dictionary.empty(
|
|
93
|
+
Dictionary.Keys.BigUint(64),
|
|
94
|
+
tokenDistributorEntryValue
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
for (let i = 0; i < entries.length; i++) {
|
|
98
|
+
dict.set(BigInt(i), entries[i]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return dict;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export class MerkleTokenDistributor implements Contract {
|
|
105
|
+
constructor(readonly address: Address, readonly init?: { code: Cell; data: Cell }) {}
|
|
106
|
+
|
|
107
|
+
static createFromAddress(address: Address) {
|
|
108
|
+
return new MerkleTokenDistributor(address);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static createFromConfig(config: MerkleTokenDistributorConfig, code: Cell, workchain = 0) {
|
|
112
|
+
const data = tokenDistributorConfigToCell(config);
|
|
113
|
+
const init = { code, data };
|
|
114
|
+
return new MerkleTokenDistributor(contractAddress(workchain, init), init);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) {
|
|
118
|
+
await provider.internal(via, {
|
|
119
|
+
value,
|
|
120
|
+
sendMode: SendMode.PAY_GAS_SEPARATELY,
|
|
121
|
+
body: beginCell().endCell()
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async getVersion(provider: ContractProvider): Promise<string> {
|
|
126
|
+
const result = await provider.get('get_version', []);
|
|
127
|
+
|
|
128
|
+
return intToString(Number(result.stack.readBigNumber()));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async getLeafAddress(provider: ContractProvider, index: bigint): Promise<Address> {
|
|
132
|
+
const arg: TupleItem = {
|
|
133
|
+
value: index,
|
|
134
|
+
type: 'int'
|
|
135
|
+
};
|
|
136
|
+
const result = await provider.get('get_leaf_address', [arg]);
|
|
137
|
+
|
|
138
|
+
return result.stack.readAddress();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async getRoot(provider: ContractProvider): Promise<bigint> {
|
|
142
|
+
const result = await provider.get('get_root', []);
|
|
143
|
+
|
|
144
|
+
return result.stack.readBigNumber();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async getTime(provider: ContractProvider): Promise<[Date, Date] | [null, null]> {
|
|
148
|
+
const result = await provider.get('get_time', []);
|
|
149
|
+
const stack = result.stack;
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
return [unixTimestampToDate(stack.readNumber()), unixTimestampToDate(stack.readNumber())];
|
|
153
|
+
} catch (e) {
|
|
154
|
+
return [null, null];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async getToken(provider: ContractProvider): Promise<Address | null> {
|
|
159
|
+
const result = await provider.get('get_token', []);
|
|
160
|
+
|
|
161
|
+
try {
|
|
162
|
+
return result.stack.readAddress();
|
|
163
|
+
} catch (e) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async getAdminAddress(provider: ContractProvider): Promise<Address> {
|
|
169
|
+
const result = await provider.get('get_admin_address', []);
|
|
170
|
+
|
|
171
|
+
return result.stack.readAddress();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async getClaimFee(provider: ContractProvider): Promise<bigint> {
|
|
175
|
+
const result = await provider.get('get_claim_fee', []);
|
|
176
|
+
|
|
177
|
+
return result.stack.readBigNumber();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async getClaimFeeAddress(provider: ContractProvider): Promise<Address> {
|
|
181
|
+
const result = await provider.get('get_claim_fee_address', []);
|
|
182
|
+
|
|
183
|
+
return result.stack.readAddress();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async getPaused(provider: ContractProvider): Promise<boolean> {
|
|
187
|
+
const result = await provider.get('get_paused', []);
|
|
188
|
+
|
|
189
|
+
return result.stack.readNumber() === 1;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async getFeelessThreshold(provider: ContractProvider): Promise<bigint> {
|
|
193
|
+
const result = await provider.get('get_feeless_threshold', []);
|
|
194
|
+
|
|
195
|
+
return result.stack.readBigNumber();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async sendChangeAdmin(provider: ContractProvider, via: Sender, newAdmin: Address) {
|
|
199
|
+
const messageBody = beginCell().storeUint(OpCode.ChangeAdmin, 32).storeUint(0, 64).storeAddress(newAdmin).endCell();
|
|
200
|
+
const result = await provider.internal(via, {
|
|
201
|
+
value: '0.01',
|
|
202
|
+
body: messageBody
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async sendChangeCode(provider: ContractProvider, via: Sender, codeType: CodeType, newCode: Cell) {
|
|
209
|
+
const messageBody = beginCell()
|
|
210
|
+
.storeUint(OpCode.ChangeCode, 32)
|
|
211
|
+
.storeUint(0, 64)
|
|
212
|
+
.storeUint(codeType, 32)
|
|
213
|
+
.storeRef(newCode)
|
|
214
|
+
.endCell();
|
|
215
|
+
const result = await provider.internal(via, {
|
|
216
|
+
value: '0.01',
|
|
217
|
+
body: messageBody
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async sendChangeVersion(provider: ContractProvider, via: Sender, version: string) {
|
|
224
|
+
const messageBody = beginCell()
|
|
225
|
+
.storeUint(OpCode.ChangeVersion, 32)
|
|
226
|
+
.storeUint(0, 64)
|
|
227
|
+
.storeUint(stringToInt(version), 64)
|
|
228
|
+
.endCell();
|
|
229
|
+
const result = await provider.internal(via, {
|
|
230
|
+
value: '0.01',
|
|
231
|
+
body: messageBody
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async sendWithdraw(provider: ContractProvider, via: Sender, amount: string) {
|
|
238
|
+
const messageBody = beginCell()
|
|
239
|
+
.storeUint(OpCode.Withdraw, 32)
|
|
240
|
+
.storeUint(0, 64)
|
|
241
|
+
.storeCoins(toNano(amount))
|
|
242
|
+
.endCell();
|
|
243
|
+
const result = await provider.internal(via, {
|
|
244
|
+
value: '0.01',
|
|
245
|
+
body: messageBody
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
return result;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
async sendWithdrawTokens(provider: ContractProvider, via: Sender, amount: string) {
|
|
252
|
+
const messageBody = beginCell()
|
|
253
|
+
.storeUint(OpCode.WithdrawTokens, 32)
|
|
254
|
+
.storeUint(0, 64)
|
|
255
|
+
.storeCoins(toNano(amount))
|
|
256
|
+
.endCell();
|
|
257
|
+
const result = await provider.internal(via, {
|
|
258
|
+
value: '0.1',
|
|
259
|
+
body: messageBody
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
async sendSetBaseParams(
|
|
266
|
+
provider: ContractProvider,
|
|
267
|
+
via: Sender,
|
|
268
|
+
startTime: Date,
|
|
269
|
+
endTime: Date,
|
|
270
|
+
root: bigint,
|
|
271
|
+
token: Address
|
|
272
|
+
) {
|
|
273
|
+
const messageBody = beginCell()
|
|
274
|
+
.storeUint(OpCode.SetBaseParams, 32)
|
|
275
|
+
.storeUint(0, 64)
|
|
276
|
+
.storeAddress(token)
|
|
277
|
+
.storeUint(dateToUnixTimestamp(startTime), 32)
|
|
278
|
+
.storeUint(dateToUnixTimestamp(endTime), 32)
|
|
279
|
+
.storeUint(root, 256)
|
|
280
|
+
.endCell();
|
|
281
|
+
const result = await provider.internal(via, {
|
|
282
|
+
value: '0.01',
|
|
283
|
+
body: messageBody
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
async sendSetPaused(provider: ContractProvider, via: Sender, paused: boolean) {
|
|
290
|
+
const messageBody = beginCell()
|
|
291
|
+
.storeUint(OpCode.SetPaused, 32)
|
|
292
|
+
.storeUint(0, 64)
|
|
293
|
+
.storeUint(paused ? 1 : 0, 1)
|
|
294
|
+
.endCell();
|
|
295
|
+
const result = await provider.internal(via, {
|
|
296
|
+
value: '0.01',
|
|
297
|
+
body: messageBody
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
return result;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
async sendSetFeelessThreshold(provider: ContractProvider, via: Sender, feelessThreshold: bigint) {
|
|
304
|
+
const messageBody = beginCell()
|
|
305
|
+
.storeUint(OpCode.SetFeelessThreshold, 32)
|
|
306
|
+
.storeUint(0, 64)
|
|
307
|
+
.storeCoins(feelessThreshold)
|
|
308
|
+
.endCell();
|
|
309
|
+
const result = await provider.internal(via, {
|
|
310
|
+
value: '0.01',
|
|
311
|
+
body: messageBody
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { apiClient } from '../../utils/api-client';
|
|
2
|
+
import { safeParseJSON } from '../../utils/utils';
|
|
3
|
+
import { IAirdropData, IProject } from '../types';
|
|
4
|
+
|
|
5
|
+
export { TonWalletService } from './wallet-service/ton';
|
|
6
|
+
|
|
7
|
+
const createApiClient = (baseURL?: string) => {
|
|
8
|
+
return baseURL ? apiClient.extend({ baseURL }) : apiClient;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const getAirdropProject = async (projectId: string, baseURL?: string): Promise<IProject> => {
|
|
12
|
+
const client = createApiClient(baseURL);
|
|
13
|
+
const res = await client.get<any>(`/airdrop-open/projects/${projectId}`);
|
|
14
|
+
if (!res) return res; // res为null
|
|
15
|
+
const projectConfig = res?.themeConf;
|
|
16
|
+
const blockCountries = safeParseJSON(projectConfig?.blockCountries);
|
|
17
|
+
return {
|
|
18
|
+
...res,
|
|
19
|
+
blockCountries
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const getAirdropProjectId = async (
|
|
24
|
+
data: {
|
|
25
|
+
recipient: string;
|
|
26
|
+
slug: string;
|
|
27
|
+
},
|
|
28
|
+
baseURL?: string
|
|
29
|
+
): Promise<{ recipient: string; projectIds: string[] }> => {
|
|
30
|
+
const client = createApiClient(baseURL);
|
|
31
|
+
return client.post(`/airdrop-open/query-pid`, data);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const getAirdropPro = async (
|
|
35
|
+
slug: string,
|
|
36
|
+
baseURL?: string
|
|
37
|
+
): Promise<{
|
|
38
|
+
slug: string;
|
|
39
|
+
childProjectMapping: Record<string, string>;
|
|
40
|
+
}> => {
|
|
41
|
+
const client = createApiClient(baseURL);
|
|
42
|
+
return client.get(`/airdrop-open/airdrop-pro/${slug}`);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const getAirdropQuery = async (
|
|
46
|
+
data: {
|
|
47
|
+
recipient: string;
|
|
48
|
+
projectId: string;
|
|
49
|
+
recipientType: string;
|
|
50
|
+
},
|
|
51
|
+
baseURL?: string
|
|
52
|
+
): Promise<IAirdropData> => {
|
|
53
|
+
const client = createApiClient(baseURL);
|
|
54
|
+
return client.post(`/airdrop-open/query`, data);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const getJettonInfo = async (
|
|
58
|
+
data: { address: string; isTestnet: 'true' | 'false' },
|
|
59
|
+
baseURL?: string
|
|
60
|
+
): Promise<any> => {
|
|
61
|
+
const client = createApiClient(baseURL);
|
|
62
|
+
return client.get(`/airdrop-open/jetton/${data.address}?isTestnet=${data.isTestnet}`);
|
|
63
|
+
};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import TonWeb from 'tonweb';
|
|
2
|
+
import { Address } from '@ton/core';
|
|
3
|
+
import { JettonMaster, TonClient } from '@ton/ton';
|
|
4
|
+
import { delay, flipAddressType } from '../../../../utils';
|
|
5
|
+
|
|
6
|
+
import { Api, HttpClient, Event } from 'tonapi-sdk-js';
|
|
7
|
+
import { ChainConfig } from '../../../constants';
|
|
8
|
+
import { getJettonInfo } from '../../index';
|
|
9
|
+
import { CHAIN } from '@tonconnect/ui-react';
|
|
10
|
+
// import { getHttpEndpoint } from '@orbs-network/ton-access';
|
|
11
|
+
// import { CHAIN } from '@tonconnect/ui-react';
|
|
12
|
+
|
|
13
|
+
interface WaitForTransactionOptions {
|
|
14
|
+
address: string;
|
|
15
|
+
hash: string;
|
|
16
|
+
refetchInterval?: number;
|
|
17
|
+
refetchLimit?: number;
|
|
18
|
+
chainId: string;
|
|
19
|
+
contractAddress?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export abstract class TonWalletService {
|
|
23
|
+
// static walletClient = tonStore.walletClient;
|
|
24
|
+
|
|
25
|
+
static disconnect() {
|
|
26
|
+
//
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async getTonClient(chainId: string) {
|
|
30
|
+
const endpoint = ChainConfig[chainId as keyof typeof ChainConfig].rpcUrl;
|
|
31
|
+
// const endpoint = await getHttpEndpoint({ network: chainId === CHAIN.TESTNET ? 'testnet' : 'mainnet' });
|
|
32
|
+
return new TonClient({
|
|
33
|
+
endpoint: endpoint
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static getTonApiClient(chainId: string) {
|
|
38
|
+
const { tonApiPrefix } = ChainConfig[chainId as keyof typeof ChainConfig] as any;
|
|
39
|
+
|
|
40
|
+
const httpClient = new HttpClient({
|
|
41
|
+
baseUrl: tonApiPrefix
|
|
42
|
+
// baseApiParams: {
|
|
43
|
+
// headers: {
|
|
44
|
+
// Authorization: `Bearer ${tonApiKey}`,
|
|
45
|
+
// 'Content-type': 'application/json'
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const client = new Api(httpClient);
|
|
51
|
+
return client;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static waitForTransactionByClient = async (options: WaitForTransactionOptions): Promise<Event | null> => {
|
|
55
|
+
const { hash, refetchInterval = 3000, refetchLimit, chainId } = options;
|
|
56
|
+
|
|
57
|
+
return new Promise((resolve) => {
|
|
58
|
+
let refetches = 0;
|
|
59
|
+
const interval = setInterval(async () => {
|
|
60
|
+
refetches += 1;
|
|
61
|
+
|
|
62
|
+
console.log(hash, 'waiting transaction...');
|
|
63
|
+
const tonApi = this.getTonApiClient(chainId);
|
|
64
|
+
const events = await tonApi.events.getEvent(hash);
|
|
65
|
+
console.log(events, 'traceData');
|
|
66
|
+
if (!events.in_progress) {
|
|
67
|
+
await delay(3000);
|
|
68
|
+
clearInterval(interval);
|
|
69
|
+
resolve(events);
|
|
70
|
+
}
|
|
71
|
+
if (refetchLimit && refetches >= refetchLimit) {
|
|
72
|
+
clearInterval(interval);
|
|
73
|
+
resolve(null);
|
|
74
|
+
}
|
|
75
|
+
}, refetchInterval);
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
static waitForTransactionLegacy = async (options: WaitForTransactionOptions): Promise<Event | null> => {
|
|
80
|
+
const { refetchInterval = 3000, refetchLimit, chainId, address, contractAddress } = options;
|
|
81
|
+
|
|
82
|
+
const tonApi = this.getTonApiClient(chainId);
|
|
83
|
+
const tonClient = await this.getTonClient(chainId);
|
|
84
|
+
const walletAddress = Address.parse(address);
|
|
85
|
+
|
|
86
|
+
return new Promise((resolve) => {
|
|
87
|
+
let refetches = 0;
|
|
88
|
+
const interval = setInterval(async () => {
|
|
89
|
+
refetches += 1;
|
|
90
|
+
|
|
91
|
+
console.log('waiting transaction...');
|
|
92
|
+
|
|
93
|
+
let hash;
|
|
94
|
+
|
|
95
|
+
if (contractAddress) {
|
|
96
|
+
const res = await tonApi.accounts.getAccountEvents(address, {
|
|
97
|
+
limit: 5
|
|
98
|
+
});
|
|
99
|
+
const targetTransaction = res.events.find((it) => {
|
|
100
|
+
return (
|
|
101
|
+
it.actions.length &&
|
|
102
|
+
it.actions.find((action) => {
|
|
103
|
+
return action.simple_preview.accounts.find((ac) => {
|
|
104
|
+
return Address.parse(ac.address).toRawString() === Address.parse(contractAddress).toRawString();
|
|
105
|
+
});
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
console.log(targetTransaction, 'res');
|
|
110
|
+
if (targetTransaction) {
|
|
111
|
+
hash = targetTransaction.event_id;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
const state = await tonClient.getContractState(walletAddress);
|
|
115
|
+
console.log(state, 'state');
|
|
116
|
+
hash = state.lastTransaction?.hash;
|
|
117
|
+
}
|
|
118
|
+
if (hash) {
|
|
119
|
+
const events = await tonApi.events.getEvent(hash);
|
|
120
|
+
console.log(events, 'events');
|
|
121
|
+
if (!events.in_progress) {
|
|
122
|
+
clearInterval(interval);
|
|
123
|
+
resolve(events);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (refetchLimit && refetches >= refetchLimit) {
|
|
127
|
+
clearInterval(interval);
|
|
128
|
+
resolve(null);
|
|
129
|
+
}
|
|
130
|
+
}, refetchInterval);
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
static async waitForTransaction({
|
|
135
|
+
hash,
|
|
136
|
+
chainId,
|
|
137
|
+
address,
|
|
138
|
+
contractAddress
|
|
139
|
+
}: {
|
|
140
|
+
hash: string;
|
|
141
|
+
chainId: string;
|
|
142
|
+
address: string;
|
|
143
|
+
contractAddress?: string;
|
|
144
|
+
}) {
|
|
145
|
+
return this.waitForTransactionByClient({ hash, address, chainId, contractAddress });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static async fetchBalance(args: { chainId: string; address: string; token?: string }) {
|
|
149
|
+
try {
|
|
150
|
+
const config = ChainConfig[args.chainId as keyof typeof ChainConfig] as any;
|
|
151
|
+
const options = { method: 'GET' };
|
|
152
|
+
const rawAddress = flipAddressType(args.address);
|
|
153
|
+
|
|
154
|
+
const url = args.token
|
|
155
|
+
? `${config.tonApiPrefix}/v2/accounts/${rawAddress}/jettons?currencies=usd`
|
|
156
|
+
: `${config.tonApiPrefix}/v2/blockchain/accounts/${rawAddress}`;
|
|
157
|
+
|
|
158
|
+
const response = await fetch(url, options);
|
|
159
|
+
const responseJSON: any = await response.json();
|
|
160
|
+
const current = args.token
|
|
161
|
+
? responseJSON.balances.find((it: any) => it.jetton.address === flipAddressType(args.token!))
|
|
162
|
+
: { balance: responseJSON.balance / 1000000000 };
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
value: current?.balance || 0
|
|
166
|
+
};
|
|
167
|
+
} catch {
|
|
168
|
+
return {
|
|
169
|
+
value: 0
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
static async fetchToken(args: { chainId: string; address: string }) {
|
|
175
|
+
return getJettonInfo({
|
|
176
|
+
address: args.address,
|
|
177
|
+
isTestnet: args.chainId === CHAIN.TESTNET ? 'true' : 'false'
|
|
178
|
+
});
|
|
179
|
+
// const client = this.getTonApiClient(args.chainId as string);
|
|
180
|
+
// const data: any = await client.jettons.getJettonInfo(args.address);
|
|
181
|
+
// const { metadata, total_supply } = data;
|
|
182
|
+
// return {
|
|
183
|
+
// ...metadata,
|
|
184
|
+
// totalSupply: {
|
|
185
|
+
// value: total_supply,
|
|
186
|
+
// formatted: fromNano(total_supply)
|
|
187
|
+
// }
|
|
188
|
+
// };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static async signMessage() {}
|
|
192
|
+
|
|
193
|
+
static async addChain() {}
|
|
194
|
+
|
|
195
|
+
static async fetchEnsAddress() {
|
|
196
|
+
return '';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
static validateAddress(address: string) {
|
|
200
|
+
try {
|
|
201
|
+
Address.parse(address);
|
|
202
|
+
return true;
|
|
203
|
+
} catch (e) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
static isSameAddress(address1: string, address2: string) {
|
|
209
|
+
return Address.parse(address1).toRawString() === Address.parse(address2).toRawString();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
static getJettonAddress = async ({
|
|
213
|
+
chainId,
|
|
214
|
+
address,
|
|
215
|
+
token
|
|
216
|
+
}: {
|
|
217
|
+
chainId: string;
|
|
218
|
+
address: string;
|
|
219
|
+
token: string;
|
|
220
|
+
}) => {
|
|
221
|
+
const client = await this.getTonClient(chainId);
|
|
222
|
+
const jettonWallet = client.open(JettonMaster.create(Address.parse(token)));
|
|
223
|
+
|
|
224
|
+
return jettonWallet.getWalletAddress(Address.parse(address));
|
|
225
|
+
};
|
|
226
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TonWalletService } from './WalletService';
|