@sudobility/contracts 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +353 -0
- package/artifacts/contracts/Mailer.sol/Mailer.d.ts +1146 -0
- package/artifacts/contracts/Mailer.sol/Mailer.dbg.json +4 -0
- package/artifacts/contracts/Mailer.sol/Mailer.json +1096 -0
- package/artifacts/contracts/Mailer.sol/artifacts.d.ts +21 -0
- package/artifacts/contracts/MockUSDC.sol/MockUSDC.d.ts +284 -0
- package/artifacts/contracts/MockUSDC.sol/MockUSDC.dbg.json +4 -0
- package/artifacts/contracts/MockUSDC.sol/MockUSDC.json +234 -0
- package/artifacts/contracts/MockUSDC.sol/artifacts.d.ts +21 -0
- package/artifacts/contracts/interfaces/IERC20.sol/IERC20.d.ts +157 -0
- package/artifacts/contracts/interfaces/IERC20.sol/IERC20.dbg.json +4 -0
- package/artifacts/contracts/interfaces/IERC20.sol/IERC20.json +107 -0
- package/artifacts/contracts/interfaces/IERC20.sol/artifacts.d.ts +21 -0
- package/dist/evm/src/evm/index.d.ts +4 -0
- package/dist/evm/src/evm/index.d.ts.map +1 -0
- package/dist/evm/src/evm/index.js +10 -0
- package/dist/evm/src/evm/index.js.map +1 -0
- package/dist/evm/src/evm/mailer-client.d.ts +966 -0
- package/dist/evm/src/evm/mailer-client.d.ts.map +1 -0
- package/dist/evm/src/evm/mailer-client.js +619 -0
- package/dist/evm/src/evm/mailer-client.js.map +1 -0
- package/dist/evm/typechain-types/Mailer.d.ts +698 -0
- package/dist/evm/typechain-types/Mailer.d.ts.map +1 -0
- package/dist/evm/typechain-types/Mailer.js +3 -0
- package/dist/evm/typechain-types/Mailer.js.map +1 -0
- package/dist/evm/typechain-types/MockUSDC.d.ts +118 -0
- package/dist/evm/typechain-types/MockUSDC.d.ts.map +1 -0
- package/dist/evm/typechain-types/MockUSDC.js +3 -0
- package/dist/evm/typechain-types/MockUSDC.js.map +1 -0
- package/dist/evm/typechain-types/common.d.ts +51 -0
- package/dist/evm/typechain-types/common.d.ts.map +1 -0
- package/dist/evm/typechain-types/common.js +3 -0
- package/dist/evm/typechain-types/common.js.map +1 -0
- package/dist/evm/typechain-types/factories/Mailer__factory.d.ts +875 -0
- package/dist/evm/typechain-types/factories/Mailer__factory.d.ts.map +1 -0
- package/dist/evm/typechain-types/factories/Mailer__factory.js +1125 -0
- package/dist/evm/typechain-types/factories/Mailer__factory.js.map +1 -0
- package/dist/evm/typechain-types/factories/MockUSDC__factory.d.ts +193 -0
- package/dist/evm/typechain-types/factories/MockUSDC__factory.d.ts.map +1 -0
- package/dist/evm/typechain-types/factories/MockUSDC__factory.js +263 -0
- package/dist/evm/typechain-types/factories/MockUSDC__factory.js.map +1 -0
- package/dist/evm/typechain-types/factories/index.d.ts +4 -0
- package/dist/evm/typechain-types/factories/index.d.ts.map +1 -0
- package/dist/evm/typechain-types/factories/index.js +45 -0
- package/dist/evm/typechain-types/factories/index.js.map +1 -0
- package/dist/evm/typechain-types/factories/interfaces/IERC20__factory.d.ts +80 -0
- package/dist/evm/typechain-types/factories/interfaces/IERC20__factory.d.ts.map +1 -0
- package/dist/evm/typechain-types/factories/interfaces/IERC20__factory.js +116 -0
- package/dist/evm/typechain-types/factories/interfaces/IERC20__factory.js.map +1 -0
- package/dist/evm/typechain-types/factories/interfaces/index.d.ts +2 -0
- package/dist/evm/typechain-types/factories/interfaces/index.d.ts.map +1 -0
- package/dist/evm/typechain-types/factories/interfaces/index.js +9 -0
- package/dist/evm/typechain-types/factories/interfaces/index.js.map +1 -0
- package/dist/evm/typechain-types/index.d.ts +10 -0
- package/dist/evm/typechain-types/index.d.ts.map +1 -0
- package/dist/evm/typechain-types/index.js +44 -0
- package/dist/evm/typechain-types/index.js.map +1 -0
- package/dist/evm/typechain-types/interfaces/IERC20.d.ts +70 -0
- package/dist/evm/typechain-types/interfaces/IERC20.d.ts.map +1 -0
- package/dist/evm/typechain-types/interfaces/IERC20.js +3 -0
- package/dist/evm/typechain-types/interfaces/IERC20.js.map +1 -0
- package/dist/evm/typechain-types/interfaces/index.d.ts +2 -0
- package/dist/evm/typechain-types/interfaces/index.d.ts.map +1 -0
- package/dist/evm/typechain-types/interfaces/index.js +3 -0
- package/dist/evm/typechain-types/interfaces/index.js.map +1 -0
- package/dist/solana/solana/index.d.ts +3 -0
- package/dist/solana/solana/index.d.ts.map +1 -0
- package/dist/solana/solana/index.js +21 -0
- package/dist/solana/solana/index.js.map +1 -0
- package/dist/solana/solana/mailer-client.d.ts +282 -0
- package/dist/solana/solana/mailer-client.d.ts.map +1 -0
- package/dist/solana/solana/mailer-client.js +989 -0
- package/dist/solana/solana/mailer-client.js.map +1 -0
- package/dist/solana/solana/types.d.ts +28 -0
- package/dist/solana/solana/types.d.ts.map +1 -0
- package/dist/solana/solana/types.js +23 -0
- package/dist/solana/solana/types.js.map +1 -0
- package/dist/solana/utils/currency.d.ts +26 -0
- package/dist/solana/utils/currency.d.ts.map +1 -0
- package/dist/solana/utils/currency.js +36 -0
- package/dist/solana/utils/currency.js.map +1 -0
- package/dist/unified/package.json +3 -0
- package/dist/unified/src/evm/index.d.ts +4 -0
- package/dist/unified/src/evm/index.d.ts.map +1 -0
- package/dist/unified/src/evm/index.js +10 -0
- package/dist/unified/src/evm/index.js.map +1 -0
- package/dist/unified/src/evm/mailer-client.d.ts +966 -0
- package/dist/unified/src/evm/mailer-client.d.ts.map +1 -0
- package/dist/unified/src/evm/mailer-client.js +619 -0
- package/dist/unified/src/evm/mailer-client.js.map +1 -0
- package/dist/unified/src/react/context/MailerProvider.d.ts +102 -0
- package/dist/unified/src/react/context/MailerProvider.d.ts.map +1 -0
- package/dist/unified/src/react/context/MailerProvider.js +160 -0
- package/dist/unified/src/react/context/MailerProvider.js.map +1 -0
- package/dist/unified/src/react/hooks/useMailerMutations.d.ts +301 -0
- package/dist/unified/src/react/hooks/useMailerMutations.d.ts.map +1 -0
- package/dist/unified/src/react/hooks/useMailerMutations.js +417 -0
- package/dist/unified/src/react/hooks/useMailerMutations.js.map +1 -0
- package/dist/unified/src/react/hooks/useMailerQueries.d.ts +130 -0
- package/dist/unified/src/react/hooks/useMailerQueries.d.ts.map +1 -0
- package/dist/unified/src/react/hooks/useMailerQueries.js +197 -0
- package/dist/unified/src/react/hooks/useMailerQueries.js.map +1 -0
- package/dist/unified/src/react/index.d.ts +37 -0
- package/dist/unified/src/react/index.d.ts.map +1 -0
- package/dist/unified/src/react/index.js +70 -0
- package/dist/unified/src/react/index.js.map +1 -0
- package/dist/unified/src/solana/index.d.ts +3 -0
- package/dist/unified/src/solana/index.d.ts.map +1 -0
- package/dist/unified/src/solana/index.js +21 -0
- package/dist/unified/src/solana/index.js.map +1 -0
- package/dist/unified/src/solana/mailer-client.d.ts +282 -0
- package/dist/unified/src/solana/mailer-client.d.ts.map +1 -0
- package/dist/unified/src/solana/mailer-client.js +989 -0
- package/dist/unified/src/solana/mailer-client.js.map +1 -0
- package/dist/unified/src/solana/types.d.ts +28 -0
- package/dist/unified/src/solana/types.d.ts.map +1 -0
- package/dist/unified/src/solana/types.js +23 -0
- package/dist/unified/src/solana/types.js.map +1 -0
- package/dist/unified/src/unified/index.d.ts +4 -0
- package/dist/unified/src/unified/index.d.ts.map +1 -0
- package/dist/unified/src/unified/index.js +9 -0
- package/dist/unified/src/unified/index.js.map +1 -0
- package/dist/unified/src/unified/onchain-mailer-client.d.ts +173 -0
- package/dist/unified/src/unified/onchain-mailer-client.d.ts.map +1 -0
- package/dist/unified/src/unified/onchain-mailer-client.js +1048 -0
- package/dist/unified/src/unified/onchain-mailer-client.js.map +1 -0
- package/dist/unified/src/unified/types.d.ts +47 -0
- package/dist/unified/src/unified/types.d.ts.map +1 -0
- package/dist/unified/src/unified/types.js +3 -0
- package/dist/unified/src/unified/types.js.map +1 -0
- package/dist/unified/src/unified/wallet-detector.d.ts +28 -0
- package/dist/unified/src/unified/wallet-detector.d.ts.map +1 -0
- package/dist/unified/src/unified/wallet-detector.js +63 -0
- package/dist/unified/src/unified/wallet-detector.js.map +1 -0
- package/dist/unified/src/utils/chain-config.d.ts +75 -0
- package/dist/unified/src/utils/chain-config.d.ts.map +1 -0
- package/dist/unified/src/utils/chain-config.js +203 -0
- package/dist/unified/src/utils/chain-config.js.map +1 -0
- package/dist/unified/src/utils/currency.d.ts +26 -0
- package/dist/unified/src/utils/currency.d.ts.map +1 -0
- package/dist/unified/src/utils/currency.js +36 -0
- package/dist/unified/src/utils/currency.js.map +1 -0
- package/dist/unified/src/utils/index.d.ts +4 -0
- package/dist/unified/src/utils/index.d.ts.map +1 -0
- package/dist/unified/src/utils/index.js +20 -0
- package/dist/unified/src/utils/index.js.map +1 -0
- package/dist/unified/src/utils/validation.d.ts +10 -0
- package/dist/unified/src/utils/validation.d.ts.map +1 -0
- package/dist/unified/src/utils/validation.js +102 -0
- package/dist/unified/src/utils/validation.js.map +1 -0
- package/dist/unified/typechain-types/Mailer.d.ts +698 -0
- package/dist/unified/typechain-types/Mailer.d.ts.map +1 -0
- package/dist/unified/typechain-types/Mailer.js +3 -0
- package/dist/unified/typechain-types/Mailer.js.map +1 -0
- package/dist/unified/typechain-types/MockUSDC.d.ts +118 -0
- package/dist/unified/typechain-types/MockUSDC.d.ts.map +1 -0
- package/dist/unified/typechain-types/MockUSDC.js +3 -0
- package/dist/unified/typechain-types/MockUSDC.js.map +1 -0
- package/dist/unified/typechain-types/common.d.ts +51 -0
- package/dist/unified/typechain-types/common.d.ts.map +1 -0
- package/dist/unified/typechain-types/common.js +3 -0
- package/dist/unified/typechain-types/common.js.map +1 -0
- package/dist/unified/typechain-types/factories/Mailer__factory.d.ts +875 -0
- package/dist/unified/typechain-types/factories/Mailer__factory.d.ts.map +1 -0
- package/dist/unified/typechain-types/factories/Mailer__factory.js +1125 -0
- package/dist/unified/typechain-types/factories/Mailer__factory.js.map +1 -0
- package/dist/unified/typechain-types/factories/MockUSDC__factory.d.ts +193 -0
- package/dist/unified/typechain-types/factories/MockUSDC__factory.d.ts.map +1 -0
- package/dist/unified/typechain-types/factories/MockUSDC__factory.js +263 -0
- package/dist/unified/typechain-types/factories/MockUSDC__factory.js.map +1 -0
- package/dist/unified/typechain-types/factories/index.d.ts +4 -0
- package/dist/unified/typechain-types/factories/index.d.ts.map +1 -0
- package/dist/unified/typechain-types/factories/index.js +45 -0
- package/dist/unified/typechain-types/factories/index.js.map +1 -0
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.d.ts +80 -0
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.d.ts.map +1 -0
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.js +116 -0
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.js.map +1 -0
- package/dist/unified/typechain-types/factories/interfaces/index.d.ts +2 -0
- package/dist/unified/typechain-types/factories/interfaces/index.d.ts.map +1 -0
- package/dist/unified/typechain-types/factories/interfaces/index.js +9 -0
- package/dist/unified/typechain-types/factories/interfaces/index.js.map +1 -0
- package/dist/unified/typechain-types/index.d.ts +10 -0
- package/dist/unified/typechain-types/index.d.ts.map +1 -0
- package/dist/unified/typechain-types/index.js +44 -0
- package/dist/unified/typechain-types/index.js.map +1 -0
- package/dist/unified/typechain-types/interfaces/IERC20.d.ts +70 -0
- package/dist/unified/typechain-types/interfaces/IERC20.d.ts.map +1 -0
- package/dist/unified/typechain-types/interfaces/IERC20.js +3 -0
- package/dist/unified/typechain-types/interfaces/IERC20.js.map +1 -0
- package/dist/unified/typechain-types/interfaces/index.d.ts +2 -0
- package/dist/unified/typechain-types/interfaces/index.d.ts.map +1 -0
- package/dist/unified/typechain-types/interfaces/index.js +3 -0
- package/dist/unified/typechain-types/interfaces/index.js.map +1 -0
- package/dist/unified-esm/src/evm/index.d.ts +4 -0
- package/dist/unified-esm/src/evm/index.d.ts.map +1 -0
- package/dist/unified-esm/src/evm/index.js +5 -0
- package/dist/unified-esm/src/evm/index.js.map +1 -0
- package/dist/unified-esm/src/evm/mailer-client.d.ts +966 -0
- package/dist/unified-esm/src/evm/mailer-client.d.ts.map +1 -0
- package/dist/unified-esm/src/evm/mailer-client.js +615 -0
- package/dist/unified-esm/src/evm/mailer-client.js.map +1 -0
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts +102 -0
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts.map +1 -0
- package/dist/unified-esm/src/react/context/MailerProvider.js +120 -0
- package/dist/unified-esm/src/react/context/MailerProvider.js.map +1 -0
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts +301 -0
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts.map +1 -0
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js +400 -0
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js.map +1 -0
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts +130 -0
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts.map +1 -0
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js +186 -0
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js.map +1 -0
- package/dist/unified-esm/src/react/index.d.ts +37 -0
- package/dist/unified-esm/src/react/index.d.ts.map +1 -0
- package/dist/unified-esm/src/react/index.js +39 -0
- package/dist/unified-esm/src/react/index.js.map +1 -0
- package/dist/unified-esm/src/solana/index.d.ts +3 -0
- package/dist/unified-esm/src/solana/index.d.ts.map +1 -0
- package/dist/unified-esm/src/solana/index.js +3 -0
- package/dist/unified-esm/src/solana/index.js.map +1 -0
- package/dist/unified-esm/src/solana/mailer-client.d.ts +282 -0
- package/dist/unified-esm/src/solana/mailer-client.d.ts.map +1 -0
- package/dist/unified-esm/src/solana/mailer-client.js +985 -0
- package/dist/unified-esm/src/solana/mailer-client.js.map +1 -0
- package/dist/unified-esm/src/solana/types.d.ts +28 -0
- package/dist/unified-esm/src/solana/types.d.ts.map +1 -0
- package/dist/unified-esm/src/solana/types.js +16 -0
- package/dist/unified-esm/src/solana/types.js.map +1 -0
- package/dist/unified-esm/src/unified/index.d.ts +4 -0
- package/dist/unified-esm/src/unified/index.d.ts.map +1 -0
- package/dist/unified-esm/src/unified/index.js +4 -0
- package/dist/unified-esm/src/unified/index.js.map +1 -0
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts +173 -0
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts.map +1 -0
- package/dist/unified-esm/src/unified/onchain-mailer-client.js +1011 -0
- package/dist/unified-esm/src/unified/onchain-mailer-client.js.map +1 -0
- package/dist/unified-esm/src/unified/types.d.ts +47 -0
- package/dist/unified-esm/src/unified/types.d.ts.map +1 -0
- package/dist/unified-esm/src/unified/types.js +2 -0
- package/dist/unified-esm/src/unified/types.js.map +1 -0
- package/dist/unified-esm/src/unified/wallet-detector.d.ts +28 -0
- package/dist/unified-esm/src/unified/wallet-detector.d.ts.map +1 -0
- package/dist/unified-esm/src/unified/wallet-detector.js +59 -0
- package/dist/unified-esm/src/unified/wallet-detector.js.map +1 -0
- package/dist/unified-esm/src/utils/chain-config.d.ts +75 -0
- package/dist/unified-esm/src/utils/chain-config.d.ts.map +1 -0
- package/dist/unified-esm/src/utils/chain-config.js +199 -0
- package/dist/unified-esm/src/utils/chain-config.js.map +1 -0
- package/dist/unified-esm/src/utils/currency.d.ts +26 -0
- package/dist/unified-esm/src/utils/currency.d.ts.map +1 -0
- package/dist/unified-esm/src/utils/currency.js +31 -0
- package/dist/unified-esm/src/utils/currency.js.map +1 -0
- package/dist/unified-esm/src/utils/index.d.ts +4 -0
- package/dist/unified-esm/src/utils/index.d.ts.map +1 -0
- package/dist/unified-esm/src/utils/index.js +4 -0
- package/dist/unified-esm/src/utils/index.js.map +1 -0
- package/dist/unified-esm/src/utils/validation.d.ts +10 -0
- package/dist/unified-esm/src/utils/validation.d.ts.map +1 -0
- package/dist/unified-esm/src/utils/validation.js +96 -0
- package/dist/unified-esm/src/utils/validation.js.map +1 -0
- package/dist/unified-esm/typechain-types/Mailer.d.ts +698 -0
- package/dist/unified-esm/typechain-types/Mailer.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/Mailer.js +2 -0
- package/dist/unified-esm/typechain-types/Mailer.js.map +1 -0
- package/dist/unified-esm/typechain-types/MockUSDC.d.ts +118 -0
- package/dist/unified-esm/typechain-types/MockUSDC.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/MockUSDC.js +2 -0
- package/dist/unified-esm/typechain-types/MockUSDC.js.map +1 -0
- package/dist/unified-esm/typechain-types/common.d.ts +51 -0
- package/dist/unified-esm/typechain-types/common.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/common.js +2 -0
- package/dist/unified-esm/typechain-types/common.js.map +1 -0
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts +875 -0
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js +1121 -0
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js.map +1 -0
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.d.ts +193 -0
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.js +259 -0
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.js.map +1 -0
- package/dist/unified-esm/typechain-types/factories/index.d.ts +4 -0
- package/dist/unified-esm/typechain-types/factories/index.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/factories/index.js +7 -0
- package/dist/unified-esm/typechain-types/factories/index.js.map +1 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.d.ts +80 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.js +112 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.js.map +1 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/index.d.ts +2 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/index.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/index.js +5 -0
- package/dist/unified-esm/typechain-types/factories/interfaces/index.js.map +1 -0
- package/dist/unified-esm/typechain-types/index.d.ts +10 -0
- package/dist/unified-esm/typechain-types/index.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/index.js +5 -0
- package/dist/unified-esm/typechain-types/index.js.map +1 -0
- package/dist/unified-esm/typechain-types/interfaces/IERC20.d.ts +70 -0
- package/dist/unified-esm/typechain-types/interfaces/IERC20.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/interfaces/IERC20.js +2 -0
- package/dist/unified-esm/typechain-types/interfaces/IERC20.js.map +1 -0
- package/dist/unified-esm/typechain-types/interfaces/index.d.ts +2 -0
- package/dist/unified-esm/typechain-types/interfaces/index.d.ts.map +1 -0
- package/dist/unified-esm/typechain-types/interfaces/index.js +2 -0
- package/dist/unified-esm/typechain-types/interfaces/index.js.map +1 -0
- package/package.json +250 -0
- package/programs/mailer/Cargo.toml +29 -0
- package/programs/mailer/src/lib.rs +2034 -0
- package/programs/mailer/tests/integration_tests.rs +1236 -0
- package/typechain-types/Mailer.ts +1393 -0
- package/typechain-types/MockUSDC.ts +236 -0
- package/typechain-types/common.ts +131 -0
- package/typechain-types/factories/Mailer__factory.ts +1157 -0
- package/typechain-types/factories/MockUSDC__factory.ts +284 -0
- package/typechain-types/factories/index.ts +6 -0
- package/typechain-types/factories/interfaces/IERC20__factory.ts +115 -0
- package/typechain-types/factories/interfaces/index.ts +4 -0
- package/typechain-types/hardhat.d.ts +99 -0
- package/typechain-types/index.ts +12 -0
- package/typechain-types/interfaces/IERC20.ts +148 -0
- package/typechain-types/interfaces/index.ts +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# Multi-Chain Decentralized Messaging Contracts
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@johnqh/mail_box_contracts)
|
|
4
|
+
[](#testing)
|
|
5
|
+
[](#typescript-support)
|
|
6
|
+
[](#supported-chains)
|
|
7
|
+
|
|
8
|
+
A comprehensive multi-chain decentralized messaging system supporting both **EVM chains** and **Solana** with USDC fee integration, delegation management, and revenue sharing capabilities.
|
|
9
|
+
|
|
10
|
+
> **๐ค AI-Optimized**: This project includes comprehensive documentation, patterns, and tooling specifically designed for AI-assisted development. See [`AI_ASSISTANT_QUICKSTART.md`](./AI_ASSISTANT_QUICKSTART.md) and [`CLAUDE.md`](./CLAUDE.md) for AI development guides.
|
|
11
|
+
|
|
12
|
+
## ๐๏ธ Project Overview
|
|
13
|
+
|
|
14
|
+
This messaging system enables decentralized communication with built-in economic incentives through a two-tier fee system and revenue sharing mechanism. The system automatically detects your wallet type and routes to the appropriate blockchain implementation.
|
|
15
|
+
|
|
16
|
+
### ๐ Core Features
|
|
17
|
+
|
|
18
|
+
- **๐ Multi-Chain Support**: Works seamlessly on EVM chains (Ethereum, Polygon, etc.) and Solana
|
|
19
|
+
- **๐ค Automatic Chain Detection**: Detects wallet type and routes to appropriate implementation
|
|
20
|
+
- **๐ฅ Delegation System**: Delegate message handling with rejection capability
|
|
21
|
+
- **๐ง Two-Tier Messaging**: Priority (revenue share) vs Standard (fee-only) tiers
|
|
22
|
+
- **๐ฐ Revenue Sharing**: 90% back to senders, 10% to platform
|
|
23
|
+
- **โฐ Time-based Claims**: 60-day claim period for revenue shares
|
|
24
|
+
- **๐ก๏ธ Type-Safe**: Full TypeScript support across all chains
|
|
25
|
+
|
|
26
|
+
## ๐ฆ NPM Package Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Install the unified multi-chain TypeScript client library
|
|
30
|
+
npm install @johnqh/mail_box_contracts
|
|
31
|
+
|
|
32
|
+
# Or with yarn
|
|
33
|
+
yarn add @johnqh/mail_box_contracts
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## ๐ Quick Start - Unified Multi-Chain Client
|
|
37
|
+
|
|
38
|
+
### Option 1: Using ChainConfig with RpcHelpers (Recommended)
|
|
39
|
+
|
|
40
|
+
The simplest way to initialize clients using API keys - all chain information is automatically derived:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { Chain, ChainConfig } from '@sudobility/types';
|
|
44
|
+
import { RpcHelpers } from '@sudobility/configs';
|
|
45
|
+
import { buildChainConfig } from '@johnqh/mail_box_contracts';
|
|
46
|
+
import { MailerClient } from '@johnqh/mail_box_contracts';
|
|
47
|
+
|
|
48
|
+
// Step 1: Create config with just chain enum and API keys
|
|
49
|
+
const chainConfig: ChainConfig = {
|
|
50
|
+
chain: Chain.ETH_MAINNET,
|
|
51
|
+
alchemyApiKey: process.env.ALCHEMY_API_KEY,
|
|
52
|
+
etherscanApiKey: process.env.ETHERSCAN_MULTICHAIN_API_KEY
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Step 2: All chain info is automatically derived!
|
|
56
|
+
const chainInfo = RpcHelpers.deriveChainInfo(chainConfig);
|
|
57
|
+
console.log('Using:', chainInfo.name, 'at', chainInfo.rpcUrl);
|
|
58
|
+
console.log('USDC:', chainInfo.usdcAddress);
|
|
59
|
+
|
|
60
|
+
// Step 3: Build unified config and initialize client
|
|
61
|
+
const config = buildChainConfig(chainConfig, '0x...'); // Your mailer contract
|
|
62
|
+
const client = new MailerClient(config.evm.contracts.mailer, publicClient);
|
|
63
|
+
|
|
64
|
+
// Works with any chain - just change the Chain enum!
|
|
65
|
+
// Chain.BASE_MAINNET, Chain.POLYGON_MAINNET, Chain.SOLANA_MAINNET, etc.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Benefits:**
|
|
69
|
+
- โ
Single source of truth (Chain enum + API keys)
|
|
70
|
+
- โ
No hardcoded RPC URLs or addresses
|
|
71
|
+
- โ
Easy to switch between networks
|
|
72
|
+
- โ
Type-safe with full IDE autocomplete
|
|
73
|
+
- โ
Consistent across EVM and Solana
|
|
74
|
+
|
|
75
|
+
See [`examples/config-usage.ts`](./examples/config-usage.ts) for complete examples.
|
|
76
|
+
|
|
77
|
+
### Option 2: Using Pre-configured Configs
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { OnchainMailerClient, TESTNET_CHAIN_CONFIG } from '@johnqh/mail_box_contracts';
|
|
81
|
+
|
|
82
|
+
// Works with ANY wallet - automatically detects chain!
|
|
83
|
+
const client = new OnchainMailerClient(wallet, TESTNET_CHAIN_CONFIG);
|
|
84
|
+
|
|
85
|
+
// Same API works for both EVM and Solana
|
|
86
|
+
await client.sendMessage("Hello Multi-Chain!", "This works on any blockchain!", true);
|
|
87
|
+
await client.delegateTo("delegate-address"); // Format automatically validated
|
|
88
|
+
await client.claimRevenue(); // Chain-agnostic revenue claiming
|
|
89
|
+
|
|
90
|
+
console.log('Running on:', client.getChainType()); // 'evm' or 'solana'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## ๐ง Chain-Specific Usage
|
|
94
|
+
|
|
95
|
+
### EVM Chains (Ethereum, Polygon, Arbitrum, etc.)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { OnchainMailerClient } from '@johnqh/mail_box_contracts';
|
|
99
|
+
import { ethers } from 'ethers';
|
|
100
|
+
|
|
101
|
+
// The unified client automatically detects EVM wallets
|
|
102
|
+
const wallet = {
|
|
103
|
+
address: "0x...",
|
|
104
|
+
request: async () => {},
|
|
105
|
+
signTransaction: async (tx: any) => tx
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const client = new OnchainMailerClient(wallet, EVM_CHAIN_CONFIG);
|
|
109
|
+
|
|
110
|
+
// Send priority message with revenue sharing
|
|
111
|
+
await client.sendMessage("Hello EVM!", "Decentralized message", true);
|
|
112
|
+
|
|
113
|
+
// Delegate to another address
|
|
114
|
+
await client.delegateTo("0x...");
|
|
115
|
+
|
|
116
|
+
// Claim revenue share
|
|
117
|
+
await client.claimRevenue();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Solana
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { OnchainMailerClient } from '@johnqh/mail_box_contracts';
|
|
124
|
+
import { Keypair } from '@solana/web3.js';
|
|
125
|
+
import { Wallet } from '@coral-xyz/anchor';
|
|
126
|
+
|
|
127
|
+
// The unified client automatically detects Solana wallets
|
|
128
|
+
const keypair = Keypair.generate();
|
|
129
|
+
const wallet = new Wallet(keypair);
|
|
130
|
+
|
|
131
|
+
const client = new OnchainMailerClient(wallet, SOLANA_CHAIN_CONFIG);
|
|
132
|
+
|
|
133
|
+
// Send priority message with revenue sharing
|
|
134
|
+
await client.sendMessage("Hello Solana!", "Decentralized message", true);
|
|
135
|
+
|
|
136
|
+
// Delegate to another address
|
|
137
|
+
await client.delegateTo("...");
|
|
138
|
+
|
|
139
|
+
// Claim revenue share
|
|
140
|
+
await client.claimRevenue();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### TypeScript Support
|
|
144
|
+
|
|
145
|
+
Full TypeScript support with auto-generated contract types:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import type {
|
|
149
|
+
Mailer,
|
|
150
|
+
MockUSDC
|
|
151
|
+
} from 'mail_box_contracts/typechain-types';
|
|
152
|
+
|
|
153
|
+
// Fully typed contract interactions
|
|
154
|
+
const tx: ContractTransaction = await mailer.sendPriority(to, subject, body);
|
|
155
|
+
const receipt: ContractReceipt = await tx.wait();
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## ๐ Project Structure
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
mail_box_contracts/
|
|
162
|
+
โโโ contracts/ # EVM smart contracts (Solidity)
|
|
163
|
+
โ โโโ MailService.sol # EVM delegation management
|
|
164
|
+
โ โโโ Mailer.sol # EVM messaging with revenue sharing
|
|
165
|
+
โ โโโ MockUSDC.sol # Test USDC token
|
|
166
|
+
โโโ programs/ # Solana programs (Rust)
|
|
167
|
+
โ โโโ mailer/ # Solana messaging and delegation program
|
|
168
|
+
โโโ src/ # Multi-chain TypeScript clients
|
|
169
|
+
โ โโโ evm/ # EVM-specific clients
|
|
170
|
+
โ โโโ solana/ # Solana-specific clients
|
|
171
|
+
โ โโโ unified/ # Cross-chain unified client
|
|
172
|
+
โ โโโ utils/ # Shared utilities & validation
|
|
173
|
+
โโโ test/ # Comprehensive test suites (116 tests)
|
|
174
|
+
โ โโโ evm/ # EVM contract tests (75 tests)
|
|
175
|
+
โ โโโ solana/ # Solana program tests
|
|
176
|
+
โ โโโ unified/ # Cross-chain client tests (41 tests)
|
|
177
|
+
โโโ typechain-types/ # Auto-generated TypeScript types
|
|
178
|
+
โโโ examples/ # Complete usage examples
|
|
179
|
+
โโโ CLAUDE.md # AI assistant documentation
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## ๐ Quick Start
|
|
183
|
+
|
|
184
|
+
### Prerequisites
|
|
185
|
+
- Node.js 16+
|
|
186
|
+
- npm or yarn
|
|
187
|
+
|
|
188
|
+
### Installation
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Clone and install dependencies
|
|
192
|
+
npm install
|
|
193
|
+
|
|
194
|
+
# Compile contracts and generate types
|
|
195
|
+
npm run compile
|
|
196
|
+
|
|
197
|
+
# Run comprehensive test suite (116 tests)
|
|
198
|
+
npm test
|
|
199
|
+
|
|
200
|
+
# Deploy to local network
|
|
201
|
+
npm run deploy:local
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## ๐ Smart Contracts
|
|
205
|
+
|
|
206
|
+
### MailService Contract
|
|
207
|
+
|
|
208
|
+
**Purpose**: Domain registration and delegation management
|
|
209
|
+
|
|
210
|
+
**Key Functions**:
|
|
211
|
+
- `delegateTo(address)` - Delegate email handling (10 USDC fee)
|
|
212
|
+
- `rejectDelegation(address)` - Reject unwanted delegations
|
|
213
|
+
- `registerDomain(string, bool)` - Register domains (100 USDC fee)
|
|
214
|
+
- `setRegistrationFee(uint256)` - Owner fee management
|
|
215
|
+
|
|
216
|
+
**Fees**:
|
|
217
|
+
- Domain Registration: 100 USDC
|
|
218
|
+
- Delegation: 10 USDC
|
|
219
|
+
|
|
220
|
+
### Mailer Contract
|
|
221
|
+
|
|
222
|
+
**Purpose**: Message sending with revenue sharing
|
|
223
|
+
|
|
224
|
+
**Message Types**:
|
|
225
|
+
- **Priority Messages**: Full fee (0.1 USDC) + 90% revenue share
|
|
226
|
+
- `sendPriority(subject, body)`
|
|
227
|
+
- `sendPriorityPrepared(mailId)`
|
|
228
|
+
- **Standard Messages**: 10% fee only (0.01 USDC)
|
|
229
|
+
- `send(subject, body)`
|
|
230
|
+
- `sendPrepared(mailId)`
|
|
231
|
+
|
|
232
|
+
**Revenue Model**:
|
|
233
|
+
- Senders pay fees to send messages to themselves
|
|
234
|
+
- Priority senders get 90% back as claimable revenue
|
|
235
|
+
- 60-day claim period for revenue shares
|
|
236
|
+
- Expired shares go to contract owner
|
|
237
|
+
|
|
238
|
+
## ๐งช Testing
|
|
239
|
+
|
|
240
|
+
Comprehensive test coverage with 116 passing tests:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Run all tests
|
|
244
|
+
npm test
|
|
245
|
+
|
|
246
|
+
# Test categories:
|
|
247
|
+
# โ
EVM Tests (75 tests) - Contract functionality, fees, revenue sharing
|
|
248
|
+
# โ
Unified Tests (41 tests) - Cross-chain client, validation, wallet detection
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Test Highlights
|
|
252
|
+
- Fee calculation verification
|
|
253
|
+
- Event emission testing
|
|
254
|
+
- Revenue sharing mechanics
|
|
255
|
+
- Time-based claim expiration
|
|
256
|
+
- Error condition handling
|
|
257
|
+
- Edge cases and security
|
|
258
|
+
|
|
259
|
+
## ๐ง Development Commands
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Essential commands (run these frequently!)
|
|
263
|
+
npm run compile # Compile contracts + generate TypeScript types
|
|
264
|
+
npm test # Run all 116 tests (75 EVM + 41 Unified)
|
|
265
|
+
npm run build # Build TypeScript files
|
|
266
|
+
|
|
267
|
+
# AI-Optimized commands
|
|
268
|
+
npm run ai:dev # Show AI helper commands + status
|
|
269
|
+
npm run ai:status # Quick project health check
|
|
270
|
+
npm run ai:build # Clean build everything
|
|
271
|
+
npm run ai:test # Run comprehensive test suite (116 tests)
|
|
272
|
+
npm run ai:check # TypeScript + ESLint validation
|
|
273
|
+
|
|
274
|
+
# Development
|
|
275
|
+
npx hardhat node # Start local blockchain
|
|
276
|
+
npm run deploy:local # Deploy to local network
|
|
277
|
+
npm run clean # Clean artifacts
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## ๐ Architecture
|
|
281
|
+
|
|
282
|
+
### Revenue Sharing Flow
|
|
283
|
+
1. **Priority Message**: User pays 0.1 USDC
|
|
284
|
+
2. **Revenue Split**: 90% claimable by sender, 10% to owner
|
|
285
|
+
3. **Claim Period**: 60 days to claim revenue share
|
|
286
|
+
4. **Expiration**: Unclaimed shares go to contract owner
|
|
287
|
+
|
|
288
|
+
### Delegation System
|
|
289
|
+
1. **Delegate**: Pay 10 USDC to delegate email handling
|
|
290
|
+
2. **Reject**: Delegates can reject unwanted delegations
|
|
291
|
+
3. **Clear**: Set delegate to address(0) to clear
|
|
292
|
+
|
|
293
|
+
## ๐ ๏ธ TypeScript Integration
|
|
294
|
+
|
|
295
|
+
Full TypeScript support with auto-generated types:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
import { OnchainMailerClient } from "@johnqh/mail_box_contracts";
|
|
299
|
+
|
|
300
|
+
// Type-safe contract interactions using unified client
|
|
301
|
+
const client = new OnchainMailerClient(wallet, chainConfig);
|
|
302
|
+
await client.delegateTo(delegateAddress);
|
|
303
|
+
await client.sendMessage("Subject", "Body", true); // priority message
|
|
304
|
+
await client.claimRevenue();
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## ๐ Security Features
|
|
308
|
+
|
|
309
|
+
- **Owner-only functions** protected by `onlyOwner` modifier
|
|
310
|
+
- **USDC transfer validation** - operations only proceed if payment succeeds
|
|
311
|
+
- **Time-based expiration** for revenue claims
|
|
312
|
+
- **Address validation** for delegation rejection
|
|
313
|
+
- **Comprehensive error handling** with custom errors
|
|
314
|
+
|
|
315
|
+
## ๐ค AI-Assisted Development
|
|
316
|
+
|
|
317
|
+
This project is optimized for AI-assisted development with comprehensive documentation, patterns, and tooling:
|
|
318
|
+
|
|
319
|
+
### Quick Start for AI Assistants
|
|
320
|
+
1. **Read**: [`AI_ASSISTANT_QUICKSTART.md`](./AI_ASSISTANT_QUICKSTART.md) - Essential guide for AI development
|
|
321
|
+
2. **Reference**: [`CLAUDE.md`](./CLAUDE.md) - Comprehensive AI assistant documentation
|
|
322
|
+
3. **Patterns**: [`docs/AI_DEVELOPMENT_PATTERNS.md`](./docs/AI_DEVELOPMENT_PATTERNS.md) - Development patterns and examples
|
|
323
|
+
4. **Config**: [`.ai-config.json`](./.ai-config.json) - AI tool configuration
|
|
324
|
+
|
|
325
|
+
### AI Development Features
|
|
326
|
+
- **๐ง AI Commands**: `npm run ai:dev` for AI-optimized development workflows
|
|
327
|
+
- **๐ Test Coverage**: 116 tests with detailed patterns for AI reference
|
|
328
|
+
- **๐ Rich Documentation**: Comprehensive JSDoc comments and inline examples
|
|
329
|
+
- **๐ฏ Success Metrics**: Clear validation criteria and checklists
|
|
330
|
+
- **โก Quick Validation**: `npm run ai:check` for TypeScript + ESLint
|
|
331
|
+
- **๐ Project Status**: `npm run ai:status` for health check
|
|
332
|
+
|
|
333
|
+
### Documentation Structure
|
|
334
|
+
- **Primary Guide**: [`CLAUDE.md`](./CLAUDE.md) - Main AI assistant documentation
|
|
335
|
+
- **Quick Reference**: [`AI_ASSISTANT_QUICKSTART.md`](./AI_ASSISTANT_QUICKSTART.md) - Fast setup
|
|
336
|
+
- **Development Patterns**: [`docs/AI_DEVELOPMENT_PATTERNS.md`](./docs/AI_DEVELOPMENT_PATTERNS.md) - Code examples
|
|
337
|
+
- **Examples**: [`examples/`](./examples/) - Working code samples
|
|
338
|
+
|
|
339
|
+
## ๐ค Contributing
|
|
340
|
+
|
|
341
|
+
1. Fork the repository
|
|
342
|
+
2. Create feature branch: `git checkout -b feature/new-feature`
|
|
343
|
+
3. Add comprehensive tests for new functionality
|
|
344
|
+
4. Ensure all 116 tests pass: `npm test`
|
|
345
|
+
5. Submit pull request
|
|
346
|
+
|
|
347
|
+
## ๐ License
|
|
348
|
+
|
|
349
|
+
MIT License - see LICENSE file for details.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
**Built with**: Hardhat, TypeScript, Solidity ^0.8.24, Ethers v6
|