@aastar/sdk 0.16.6 → 0.16.11
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/gas-analytics-daily.yml +52 -0
- package/CHANGELOG.md +43 -0
- package/README.md +39 -139
- package/backup/run_sdk_regression.sh +135 -0
- package/config.anvil.json +1 -1
- package/config.sepolia.json +19 -1
- package/docs/API_REFERENCE.md +9 -169
- package/docs/L4_Manual_Test_CheatSheet.md +22 -65
- package/docs/Reputation-to-Credit_Mapping_Whitepaper.md +242 -0
- package/docs/TESTER_GUIDE_GASLESS.md +23 -277
- package/docs/api/@aastar/account/README.md +15 -0
- package/docs/api/@aastar/account/classes/UserOpClient.md +87 -0
- package/docs/api/@aastar/account/functions/createEOAWalletClient.md +21 -0
- package/docs/api/@aastar/account/functions/getUserOpHash.md +23 -0
- package/docs/api/@aastar/account/functions/packUserOpLimits.md +19 -0
- package/docs/api/@aastar/account/functions/toSimpleSmartAccount.md +83 -0
- package/docs/api/@aastar/account/type-aliases/EOAWalletClient.md +37 -0
- package/docs/api/@aastar/account/type-aliases/SimpleSmartAccount.md +39 -0
- package/docs/api/@aastar/core/README.md +211 -0
- package/docs/api/@aastar/core/classes/BLSSigner.md +147 -0
- package/docs/api/@aastar/core/classes/BaseClient.md +9657 -0
- package/docs/api/@aastar/core/classes/ContractConfigManager.md +25 -0
- package/docs/api/@aastar/core/classes/RequirementChecker.md +1837 -0
- package/docs/api/@aastar/core/classes/SepoliaFaucetAPI.md +13661 -0
- package/docs/api/@aastar/core/classes/StateValidator.md +133 -0
- package/docs/api/@aastar/core/enumerations/EntryPointVersion.md +17 -0
- package/docs/api/@aastar/core/enumerations/NodeType.md +33 -0
- package/docs/api/@aastar/core/enumerations/RolePermissionLevel.md +43 -0
- package/docs/api/@aastar/core/functions/accountActions.md +2720 -0
- package/docs/api/@aastar/core/functions/accountFactoryActions.md +2720 -0
- package/docs/api/@aastar/core/functions/aggregatorActions.md +2720 -0
- package/docs/api/@aastar/core/functions/createAAStarPublicClient.md +3105 -0
- package/docs/api/@aastar/core/functions/dvtActions.md +2720 -0
- package/docs/api/@aastar/core/functions/entryPointActions.md +2724 -0
- package/docs/api/@aastar/core/functions/gTokenActions.md +2714 -0
- package/docs/api/@aastar/core/functions/gTokenExtendedActions.md +2720 -0
- package/docs/api/@aastar/core/functions/getAddressUrl.md +32 -0
- package/docs/api/@aastar/core/functions/getAllCommunityConfigs.md +9 -0
- package/docs/api/@aastar/core/functions/getAllV2Contracts.md +20 -0
- package/docs/api/@aastar/core/functions/getBlockExplorer.md +26 -0
- package/docs/api/@aastar/core/functions/getChainId.md +26 -0
- package/docs/api/@aastar/core/functions/getCommunities.md +76 -0
- package/docs/api/@aastar/core/functions/getCommunity.md +32 -0
- package/docs/api/@aastar/core/functions/getCommunityConfig.md +15 -0
- package/docs/api/@aastar/core/functions/getContract.md +37 -0
- package/docs/api/@aastar/core/functions/getContractNetworks.md +18 -0
- package/docs/api/@aastar/core/functions/getContracts.md +194 -0
- package/docs/api/@aastar/core/functions/getCoreContracts.md +71 -0
- package/docs/api/@aastar/core/functions/getDeploymentDate.md +32 -0
- package/docs/api/@aastar/core/functions/getEntryPoint.md +25 -0
- package/docs/api/@aastar/core/functions/getNetwork.md +26 -0
- package/docs/api/@aastar/core/functions/getPaymasterV4_1.md +25 -0
- package/docs/api/@aastar/core/functions/getRoleName.md +15 -0
- package/docs/api/@aastar/core/functions/getRpcUrl.md +25 -0
- package/docs/api/@aastar/core/functions/getSimpleAccountFactory.md +25 -0
- package/docs/api/@aastar/core/functions/getSuperPaymasterV2.md +25 -0
- package/docs/api/@aastar/core/functions/getTestAccounts.md +30 -0
- package/docs/api/@aastar/core/functions/getTestTokenContracts.md +38 -0
- package/docs/api/@aastar/core/functions/getTokenContracts.md +31 -0
- package/docs/api/@aastar/core/functions/getTxUrl.md +32 -0
- package/docs/api/@aastar/core/functions/getV2ContractByAddress.md +28 -0
- package/docs/api/@aastar/core/functions/getV2ContractByName.md +28 -0
- package/docs/api/@aastar/core/functions/getV2ContractsByDate.md +26 -0
- package/docs/api/@aastar/core/functions/isContractNetworkSupported.md +27 -0
- package/docs/api/@aastar/core/functions/isRegisteredCommunity.md +15 -0
- package/docs/api/@aastar/core/functions/isV2Contract.md +27 -0
- package/docs/api/@aastar/core/functions/paymasterActions.md +2720 -0
- package/docs/api/@aastar/core/functions/paymasterFactoryActions.md +2720 -0
- package/docs/api/@aastar/core/functions/registryActions.md +2720 -0
- package/docs/api/@aastar/core/functions/reputationActions.md +2720 -0
- package/docs/api/@aastar/core/functions/sbtActions.md +2720 -0
- package/docs/api/@aastar/core/functions/stakingActions.md +2720 -0
- package/docs/api/@aastar/core/functions/superPaymasterActions.md +2720 -0
- package/docs/api/@aastar/core/functions/tokenActions.md +2714 -0
- package/docs/api/@aastar/core/functions/xPNTsFactoryActions.md +2720 -0
- package/docs/api/@aastar/core/interfaces/AccountBalance.md +41 -0
- package/docs/api/@aastar/core/interfaces/BalanceValidationParams.md +51 -0
- package/docs/api/@aastar/core/interfaces/ClientConfig.md +4841 -0
- package/docs/api/@aastar/core/interfaces/CommunityConfig.md +81 -0
- package/docs/api/@aastar/core/interfaces/ContractVersion.md +63 -0
- package/docs/api/@aastar/core/interfaces/DeploymentValidationParams.md +39 -0
- package/docs/api/@aastar/core/interfaces/RoleConfig.md +83 -0
- package/docs/api/@aastar/core/interfaces/RoleRequirement.md +43 -0
- package/docs/api/@aastar/core/interfaces/RoleValidationParams.md +55 -0
- package/docs/api/@aastar/core/interfaces/SuperPaymasterConfig.md +57 -0
- package/docs/api/@aastar/core/interfaces/TokenBalanceValidationParams.md +63 -0
- package/docs/api/@aastar/core/interfaces/TransactionOptions.md +24 -0
- package/docs/api/@aastar/core/interfaces/ValidationParams.md +25 -0
- package/docs/api/@aastar/core/interfaces/ValidationResult.md +25 -0
- package/docs/api/@aastar/core/type-aliases/AccountActions.md +151 -0
- package/docs/api/@aastar/core/type-aliases/AccountFactoryActions.md +55 -0
- package/docs/api/@aastar/core/type-aliases/AggregatorActions.md +471 -0
- package/docs/api/@aastar/core/type-aliases/BusinessResult.md +12 -0
- package/docs/api/@aastar/core/type-aliases/ContractCategory.md +5 -0
- package/docs/api/@aastar/core/type-aliases/ContractNetwork.md +5 -0
- package/docs/api/@aastar/core/type-aliases/DVTActions.md +319 -0
- package/docs/api/@aastar/core/type-aliases/EntryPointActions.md +103 -0
- package/docs/api/@aastar/core/type-aliases/GTokenExtendedActions.md +239 -0
- package/docs/api/@aastar/core/type-aliases/NetworkContracts.md +5 -0
- package/docs/api/@aastar/core/type-aliases/PaymasterActions.md +1087 -0
- package/docs/api/@aastar/core/type-aliases/PaymasterFactoryActions.md +263 -0
- package/docs/api/@aastar/core/type-aliases/RegistryActions.md +1543 -0
- package/docs/api/@aastar/core/type-aliases/ReputationActions.md +811 -0
- package/docs/api/@aastar/core/type-aliases/SBTActions.md +1199 -0
- package/docs/api/@aastar/core/type-aliases/StakingActions.md +703 -0
- package/docs/api/@aastar/core/type-aliases/SuperPaymasterActions.md +1311 -0
- package/docs/api/@aastar/core/type-aliases/SupportedNetwork.md +3 -0
- package/docs/api/@aastar/core/type-aliases/TokenActions.md +1227 -0
- package/docs/api/@aastar/core/type-aliases/XPNTsFactoryActions.md +395 -0
- package/docs/api/@aastar/core/variables/AASTAR_COMMUNITY.md +8 -0
- package/docs/api/@aastar/core/variables/ALL_ADDRESSES.md +75 -0
- package/docs/api/@aastar/core/variables/ALL_ROLES.md +5 -0
- package/docs/api/@aastar/core/variables/APNTS_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/BLSAggregatorABI.md +3 -0
- package/docs/api/@aastar/core/variables/BLSAggregatorArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/BLSHelpers.md +101 -0
- package/docs/api/@aastar/core/variables/BLSValidatorABI.md +3 -0
- package/docs/api/@aastar/core/variables/BLSValidatorArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/BLS_AGGREGATOR_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/BLS_VALIDATOR_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/BPS_DENOMINATOR.md +5 -0
- package/docs/api/@aastar/core/variables/BRANDING.md +67 -0
- package/docs/api/@aastar/core/variables/BREAD_COMMUNITY.md +8 -0
- package/docs/api/@aastar/core/variables/CHAIN_MAINNET.md +3 -0
- package/docs/api/@aastar/core/variables/CHAIN_SEPOLIA.md +5 -0
- package/docs/api/@aastar/core/variables/COMMUNITIES.md +5 -0
- package/docs/api/@aastar/core/variables/COMMUNITY_OWNERS.md +15 -0
- package/docs/api/@aastar/core/variables/CONTRACTS.md +179 -0
- package/docs/api/@aastar/core/variables/CONTRACT_METADATA.md +67 -0
- package/docs/api/@aastar/core/variables/CONTRACT_SRC_HASH.md +5 -0
- package/docs/api/@aastar/core/variables/CORE_ADDRESSES.md +51 -0
- package/docs/api/@aastar/core/variables/DEFAULT_ADMIN_ROLE.md +17 -0
- package/docs/api/@aastar/core/variables/DEFAULT_APNTS_PRICE_USD.md +5 -0
- package/docs/api/@aastar/core/variables/DEFAULT_CALL_GAS_LIMIT.md +3 -0
- package/docs/api/@aastar/core/variables/DEFAULT_GAS_TOKEN_MINT_AMOUNT.md +5 -0
- package/docs/api/@aastar/core/variables/DEFAULT_PRE_VERIFICATION_GAS.md +3 -0
- package/docs/api/@aastar/core/variables/DEFAULT_TIMEOUT_MS.md +5 -0
- package/docs/api/@aastar/core/variables/DEFAULT_TOKEN_NAME.md +3 -0
- package/docs/api/@aastar/core/variables/DEFAULT_TOKEN_SYMBOL.md +5 -0
- package/docs/api/@aastar/core/variables/DEFAULT_USDT_MINT_AMOUNT.md +5 -0
- package/docs/api/@aastar/core/variables/DEFAULT_VERIFICATION_GAS_LIMIT.md +5 -0
- package/docs/api/@aastar/core/variables/DVTValidatorABI.md +3 -0
- package/docs/api/@aastar/core/variables/DVTValidatorArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/DVT_VALIDATOR_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/ENTRY_POINT_0_8_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/ENTRY_POINT_0_9_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/ENTRY_POINT_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/EntryPointABI.md +3 -0
- package/docs/api/@aastar/core/variables/EntryPointArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/FAUCET_API_URL.md +5 -0
- package/docs/api/@aastar/core/variables/GTOKEN_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/GTOKEN_STAKING_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/GTokenABI.md +3 -0
- package/docs/api/@aastar/core/variables/GTokenArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/GTokenStakingABI.md +3 -0
- package/docs/api/@aastar/core/variables/GTokenStakingArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/INITIAL_ROLE_STAKES.md +13 -0
- package/docs/api/@aastar/core/variables/LINKS.md +33 -0
- package/docs/api/@aastar/core/variables/MAX_SERVICE_FEE.md +5 -0
- package/docs/api/@aastar/core/variables/MONITORING_ADDRESSES.md +15 -0
- package/docs/api/@aastar/core/variables/MySBTABI.md +3 -0
- package/docs/api/@aastar/core/variables/MySBTArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/NETWORKS.md +79 -0
- package/docs/api/@aastar/core/variables/NODE_STAKE_AMOUNTS.md +31 -0
- package/docs/api/@aastar/core/variables/OFFICIAL_ADDRESSES.md +11 -0
- package/docs/api/@aastar/core/variables/PAYMASTER_ADDRESSES.md +15 -0
- package/docs/api/@aastar/core/variables/PAYMASTER_FACTORY_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/PAYMASTER_V4_IMPL_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/PaymasterABI.md +3 -0
- package/docs/api/@aastar/core/variables/PaymasterArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/PaymasterFactoryABI.md +3 -0
- package/docs/api/@aastar/core/variables/PaymasterFactoryArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/PaymasterV4ABI.md +3 -0
- package/docs/api/@aastar/core/variables/PaymasterV4Artifact.md +13 -0
- package/docs/api/@aastar/core/variables/REGISTRY_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/REPUTATION_SYSTEM_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/ROLE_ANODE.md +29 -0
- package/docs/api/@aastar/core/variables/ROLE_COMMUNITY.md +29 -0
- package/docs/api/@aastar/core/variables/ROLE_DVT.md +29 -0
- package/docs/api/@aastar/core/variables/ROLE_ENDUSER.md +33 -0
- package/docs/api/@aastar/core/variables/ROLE_KMS.md +29 -0
- package/docs/api/@aastar/core/variables/ROLE_NAMES.md +3 -0
- package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_AOA.md +29 -0
- package/docs/api/@aastar/core/variables/ROLE_PAYMASTER_SUPER.md +33 -0
- package/docs/api/@aastar/core/variables/ROLE_PERMISSION_LEVELS.md +3 -0
- package/docs/api/@aastar/core/variables/RegistryABI.md +3 -0
- package/docs/api/@aastar/core/variables/RegistryArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/ReputationSystemABI.md +3 -0
- package/docs/api/@aastar/core/variables/ReputationSystemArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/SBT_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/SEPOLIA_CONTRACTS.md +175 -0
- package/docs/api/@aastar/core/variables/SEPOLIA_V2_VERSIONS.md +67 -0
- package/docs/api/@aastar/core/variables/SERVICE_FEE_RATE.md +5 -0
- package/docs/api/@aastar/core/variables/SUPER_PAYMASTER_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/SimpleAccountABI.md +3 -0
- package/docs/api/@aastar/core/variables/SimpleAccountArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/SimpleAccountFactoryABI.md +3 -0
- package/docs/api/@aastar/core/variables/SimpleAccountFactoryArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/SuperPaymasterABI.md +3 -0
- package/docs/api/@aastar/core/variables/SuperPaymasterArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/TEST_ACCOUNT_ADDRESSES.md +11 -0
- package/docs/api/@aastar/core/variables/TEST_ACCOUNT_POOL_SIZE.md +5 -0
- package/docs/api/@aastar/core/variables/TEST_COMMUNITIES.md +19 -0
- package/docs/api/@aastar/core/variables/TEST_TOKEN_ADDRESSES.md +19 -0
- package/docs/api/@aastar/core/variables/TOKEN_ADDRESSES.md +11 -0
- package/docs/api/@aastar/core/variables/V2_SUMMARY.md +39 -0
- package/docs/api/@aastar/core/variables/XPNTS_FACTORY_ADDRESS.md +3 -0
- package/docs/api/@aastar/core/variables/xPNTsFactoryABI.md +3 -0
- package/docs/api/@aastar/core/variables/xPNTsFactoryArtifact.md +13 -0
- package/docs/api/@aastar/core/variables/xPNTsTokenABI.md +3 -0
- package/docs/api/@aastar/core/variables/xPNTsTokenArtifact.md +13 -0
- package/docs/api/@aastar/paymaster/README.md +23 -0
- package/docs/api/@aastar/paymaster/classes/PaymasterClient.md +388 -0
- package/docs/api/@aastar/paymaster/classes/PaymasterOperator.md +451 -0
- package/docs/api/@aastar/paymaster/classes/SuperPaymasterAdminClient.md +189 -0
- package/docs/api/@aastar/paymaster/classes/SuperPaymasterClient.md +55 -0
- package/docs/api/@aastar/paymaster/functions/buildPaymasterData.md +34 -0
- package/docs/api/@aastar/paymaster/functions/buildSuperPaymasterData.md +30 -0
- package/docs/api/@aastar/paymaster/functions/checkEligibility.md +28 -0
- package/docs/api/@aastar/paymaster/functions/formatUserOpV07.md +15 -0
- package/docs/api/@aastar/paymaster/functions/getPaymasterV4Middleware.md +32 -0
- package/docs/api/@aastar/paymaster/functions/getSuperPaymasterMiddleware.md +32 -0
- package/docs/api/@aastar/paymaster/functions/getUserOpHashV07.md +21 -0
- package/docs/api/@aastar/paymaster/type-aliases/GaslessReadinessReport.md +55 -0
- package/docs/api/@aastar/paymaster/type-aliases/GaslessTransactionConfig.md +59 -0
- package/docs/api/@aastar/paymaster/type-aliases/PaymasterConfig.md +43 -0
- package/docs/api/@aastar/paymaster/type-aliases/PaymasterV4MiddlewareConfig.md +35 -0
- package/docs/api/@aastar/tokens/README.md +3 -0
- package/docs/api/@aastar/tokens/classes/FinanceClient.md +10385 -0
- package/docs/api/README.md +4 -8
- package/env.template +3 -5
- package/examples/l1-api-demo.ts +196 -107
- package/examples/l2-clients-demo.ts +70 -73
- package/examples/l3-community-launch.ts +49 -0
- package/examples/l3-user-onboarding.ts +36 -54
- package/examples/prepare-gasless.ts +1 -1
- package/examples/simple-gasless-demo.ts +55 -26
- package/examples/simple-superpaymaster-demo.ts +2 -2
- package/ext/aastar-shared-config/generate-comparison-table.sh +0 -0
- package/ext/aastar-shared-config/sync-abis.sh +0 -0
- package/ext/aastar-shared-config/sync-versions.mjs +0 -0
- package/ext/aastar-shared-config/verify-all.sh +0 -0
- package/ext/aastar-shared-config/verify-contracts.sh +0 -0
- package/l4-setup.sh +1 -11
- package/lib/shared-config/generate-comparison-table.sh +0 -0
- package/lib/shared-config/sync-abis.sh +0 -0
- package/lib/shared-config/sync-versions.mjs +0 -0
- package/lib/shared-config/verify-all.sh +0 -0
- package/lib/shared-config/verify-contracts.sh +0 -0
- package/package.json +36 -32
- package/packages/account/__tests__/index.test.ts +9 -0
- package/packages/account/node_modules/.bin/tsc +21 -0
- package/packages/account/node_modules/.bin/tsserver +21 -0
- package/packages/account/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/account/package.json +3 -5
- package/packages/account/src/eoa.ts +2 -4
- package/packages/account/tsconfig.json +2 -1
- package/packages/analytics/README.md +68 -0
- package/packages/analytics/__tests__/index.test.ts +25 -0
- package/packages/analytics/data/attribution_dataset.csv +29 -0
- package/packages/analytics/data/complete_dataset.csv +29 -0
- package/packages/analytics/data/eth_price_cache.json +4 -0
- package/packages/analytics/data/full_dataset.csv +11 -0
- package/packages/analytics/data/full_dataset.json +134 -0
- package/packages/analytics/data/parsed_transactions.csv +29 -0
- package/packages/analytics/node_modules/.bin/tsc +21 -0
- package/packages/analytics/node_modules/.bin/tsserver +21 -0
- package/packages/analytics/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/analytics/package.json +2 -5
- package/packages/analytics/reports/full/attribution_analysis_20260119.md +42 -0
- package/packages/analytics/reports/full/attribution_analysis_fresh_20260119.md +67 -0
- package/packages/analytics/reports/full/competitive_analysis_20260119.md +103 -0
- package/packages/analytics/reports/full/comprehensive_analysis_20260119.md +107 -0
- package/packages/analytics/reports/full/comprehensive_analysis_v4_1_20260119.md +74 -0
- package/packages/analytics/reports/full/economic_audit_v4_2_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_3_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_4_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_5_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_6_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_final_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_final_v2_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_final_v3_20260119.md +74 -0
- package/packages/analytics/reports/full/profit_audit_v4_final_v4_20260119.md +75 -0
- package/packages/analytics/reports/full/profit_audit_v4_final_v5_20260119.md +76 -0
- package/packages/analytics/reports/full/two_layer_analysis_20260119.md +81 -0
- package/packages/analytics/reports/full/two_layer_analysis_academic_20260119.md +81 -0
- package/packages/analytics/reports/full/two_layer_analysis_dynamic_20260119.md +81 -0
- package/packages/analytics/reports/full/two_layer_analysis_final_20260119.md +81 -0
- package/packages/analytics/reports/full/two_layer_analysis_final_fixed_20260119.md +81 -0
- package/packages/analytics/reports/full/two_layer_analysis_fixed_20260119.md +52 -0
- package/packages/analytics/reports/full/two_layer_analysis_normalized_20260119.md +81 -0
- package/packages/analytics/reports/full/tx_0xc30cfcbb.md +39 -0
- package/packages/analytics/src/analyzers/AttributionAnalyzer.ts +124 -0
- package/packages/analytics/src/analyzers/ComparisonAnalyzer.ts +89 -0
- package/packages/analytics/src/analyzers/TransactionAnalyzer.ts +111 -0
- package/packages/analytics/src/analyzers/TrendAnalyzer.ts +107 -0
- package/packages/analytics/src/cli-analyze-tx.ts +45 -0
- package/packages/analytics/src/cli.ts +39 -0
- package/packages/analytics/src/core/BenchmarkLoader.ts +163 -0
- package/packages/analytics/src/core/CostCalculator.ts +202 -0
- package/packages/analytics/src/core/DataCollector.ts +245 -0
- package/packages/analytics/src/gas-analyzer-v4.ts +118 -0
- package/packages/analytics/src/gas-analyzer.ts +184 -0
- package/packages/analytics/src/test-logparser.ts +63 -0
- package/packages/analytics/src/utils/EventDecoder.ts +152 -0
- package/packages/analytics/src/utils/LogParser.ts +220 -0
- package/packages/analytics/src/utils/PriceOracle.ts +117 -0
- package/packages/analytics/test/AttributionAnalyzer.test.ts +42 -0
- package/packages/analytics/test/CostCalculator.test.ts +75 -0
- package/packages/analytics/tsconfig.json +2 -1
- package/packages/community/__tests__/index.test.ts +9 -0
- package/packages/community/node_modules/.bin/tsc +21 -0
- package/packages/community/node_modules/.bin/tsserver +21 -0
- package/packages/community/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/community/package.json +27 -0
- package/packages/community/src/index.ts +326 -0
- package/packages/community/tsconfig.json +8 -0
- package/packages/core/__tests__/actions/account-comprehensive.test.ts +92 -0
- package/packages/core/__tests__/actions/aggregator.test.ts +62 -0
- package/packages/core/__tests__/actions/comprehensive-batch1.test.ts +86 -0
- package/packages/core/__tests__/actions/comprehensive-batch2.test.ts +39 -0
- package/packages/core/__tests__/actions/comprehensive-batch3.test.ts +35 -0
- package/packages/core/__tests__/actions/comprehensive-error.test.ts +115 -0
- package/packages/core/__tests__/actions/dvt.test.ts +39 -0
- package/packages/core/__tests__/actions/edge-cases.test.ts +39 -0
- package/packages/core/__tests__/actions/error-paths.test.ts +82 -0
- package/packages/core/__tests__/actions/factory.test.ts +81 -0
- package/packages/core/__tests__/actions/faucet.test.ts +131 -0
- package/packages/core/__tests__/actions/paymaster.test.ts +116 -0
- package/packages/core/__tests__/actions/registry.test.ts +81 -0
- package/packages/core/__tests__/actions/reputation.test.ts +43 -0
- package/packages/core/__tests__/actions/sbt.test.ts +145 -0
- package/packages/core/__tests__/actions/staking.test.ts +30 -0
- package/packages/core/__tests__/actions/superPaymaster.test.ts +158 -0
- package/packages/core/__tests__/actions/tokens-extended.test.ts +18 -0
- package/packages/core/__tests__/actions/tokens.test.ts +122 -0
- package/packages/core/__tests__/clients.test.ts +77 -0
- package/packages/core/__tests__/contracts-config.test.ts +69 -0
- package/packages/core/__tests__/index.test.ts +9 -0
- package/packages/core/__tests__/mocks/client.ts +40 -0
- package/packages/core/node_modules/.bin/tsc +21 -0
- package/packages/core/node_modules/.bin/tsserver +21 -0
- package/packages/core/node_modules/.bin/tsx +21 -0
- package/packages/core/node_modules/.bin/vite +21 -0
- package/packages/core/node_modules/.bin/vitest +21 -0
- package/packages/core/node_modules/.bin/yaml +21 -0
- package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/core/package.json +5 -12
- package/packages/core/src/abis/SuperPaymaster.json +1 -1
- package/packages/core/src/abis/aPNTs.json +1160 -0
- package/packages/core/src/abis/abi.config.json +3 -3
- package/packages/core/src/abis/index.ts +37 -50
- package/packages/core/src/actions/account.ts +137 -126
- package/packages/core/src/actions/aggregator.ts +363 -33
- package/packages/core/src/actions/dvt.ts +261 -45
- package/packages/core/src/actions/entryPoint.ts +56 -233
- package/packages/core/src/actions/factory.ts +671 -552
- package/packages/core/src/actions/faucet.ts +181 -322
- package/packages/core/src/actions/index.ts +2 -5
- package/packages/core/src/actions/paymaster.ts +780 -0
- package/packages/core/src/actions/registry.ts +926 -825
- package/packages/core/src/actions/reputation.ts +568 -278
- package/packages/core/src/actions/sbt.ts +867 -632
- package/packages/core/src/actions/staking.ts +440 -285
- package/packages/core/src/actions/superPaymaster.ts +1058 -793
- package/packages/core/src/actions/tokens.ts +468 -514
- package/packages/core/src/clients/BaseClient.ts +3 -3
- package/packages/core/src/clients/BundlerClient.ts +132 -0
- package/packages/core/src/communities.ts +2 -2
- package/packages/core/src/constants.ts +1 -32
- package/packages/core/src/contract-addresses.ts +3 -10
- package/packages/core/src/contract-versions.ts +374 -0
- package/packages/core/src/contracts.ts +2 -2
- package/packages/core/src/errors/index.ts +173 -0
- package/packages/core/src/index.ts +2 -1
- package/packages/core/src/requirementChecker.ts +39 -1
- package/packages/core/src/roles.ts +50 -61
- package/packages/core/src/validators/index.ts +88 -0
- package/packages/core/tsconfig.json +2 -1
- package/packages/dapp/__tests__/index.test.ts +9 -0
- package/packages/dapp/node_modules/.bin/tsc +21 -0
- package/packages/dapp/node_modules/.bin/tsserver +21 -0
- package/packages/dapp/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/dapp/package.json +3 -5
- package/packages/dapp/tsconfig.json +2 -1
- package/packages/enduser/__tests__/CommunityClient.test.ts +205 -0
- package/packages/enduser/__tests__/UserClient.test.ts +294 -0
- package/packages/enduser/__tests__/index.test.ts +16 -0
- package/packages/enduser/__tests__/mocks/client.ts +22 -0
- package/packages/enduser/node_modules/.bin/tsc +21 -0
- package/packages/enduser/node_modules/.bin/tsserver +21 -0
- package/packages/enduser/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/enduser/package.json +26 -0
- package/packages/enduser/src/CommunityClient.ts +235 -0
- package/packages/enduser/src/UserClient.ts +447 -0
- package/packages/enduser/src/index.ts +2 -0
- package/packages/enduser/src/testAccountManager.ts +374 -0
- package/packages/enduser/tsconfig.json +10 -0
- package/packages/identity/__tests__/index.test.ts +9 -0
- package/packages/identity/node_modules/.bin/tsc +21 -0
- package/packages/identity/node_modules/.bin/tsserver +21 -0
- package/packages/identity/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/identity/package.json +3 -5
- package/packages/identity/tsconfig.json +2 -1
- package/packages/operator/__tests__/PaymasterOperatorClient.test.ts +258 -0
- package/packages/operator/__tests__/ProtocolClient.test.ts +135 -0
- package/packages/operator/__tests__/index.test.ts +16 -0
- package/packages/operator/__tests__/mocks/client.ts +22 -0
- package/packages/operator/node_modules/.bin/tsc +21 -0
- package/packages/operator/node_modules/.bin/tsserver +21 -0
- package/packages/operator/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/operator/package.json +26 -0
- package/packages/operator/src/PaymasterOperatorClient.ts +454 -0
- package/packages/operator/src/ProtocolClient.ts +154 -0
- package/packages/operator/src/index.ts +2 -0
- package/packages/operator/tsconfig.json +10 -0
- package/packages/patterns/node_modules/.bin/tsc +21 -0
- package/packages/patterns/node_modules/.bin/tsserver +21 -0
- package/packages/paymaster/__tests__/PaymasterOperator.test.ts +123 -0
- package/packages/paymaster/__tests__/index.test.ts +9 -0
- package/packages/paymaster/node_modules/.bin/tsc +21 -0
- package/packages/paymaster/node_modules/.bin/tsserver +21 -0
- package/packages/paymaster/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/paymaster/package.json +4 -6
- package/packages/paymaster/src/V4/BundlerCompat.ts +47 -0
- package/packages/paymaster/src/V4/PaymasterClient.ts +122 -17
- package/packages/paymaster/src/V4/PaymasterUtils.ts +37 -23
- package/packages/paymaster/src/V4/SuperPaymasterClient.ts +17 -11
- package/packages/paymaster/tsconfig.json +8 -3
- package/packages/sdk/README.md +21 -0
- package/packages/sdk/__tests__/index.test.ts +9 -0
- package/packages/sdk/aastar/package.json +1 -1
- package/packages/sdk/aastar/tsconfig.json +2 -1
- package/packages/sdk/node_modules/.bin/tsc +21 -0
- package/packages/sdk/node_modules/.bin/tsserver +21 -0
- package/packages/sdk/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/sdk/package.json +4 -14
- package/packages/sdk/src/clients/admin.ts +10 -108
- package/packages/sdk/src/clients/community.ts +242 -176
- package/packages/sdk/src/clients/endUser.ts +168 -291
- package/packages/sdk/src/clients/operator.ts +87 -162
- package/packages/sdk/src/errors/decoder.ts +41 -84
- package/packages/sdk/src/index.ts +10 -9
- package/packages/sdk/src/utils/keys.ts +0 -15
- package/packages/sdk/src/utils/roleData.ts +26 -15
- package/packages/sdk/src/utils/testScenarios.ts +2 -2
- package/packages/sdk/src/utils/userOp.ts +3 -11
- package/packages/sdk/tsconfig.json +2 -1
- package/packages/tokens/__tests__/index.test.ts +9 -0
- package/packages/tokens/node_modules/.bin/tsc +21 -0
- package/packages/tokens/node_modules/.bin/tsserver +21 -0
- package/packages/tokens/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/packages/tokens/package.json +3 -5
- package/packages/tokens/src/index.ts +0 -15
- package/packages/tokens/tsconfig.json +2 -1
- package/publish.sh +30 -0
- package/run_l4_gasless_regression.sh +35 -5
- package/run_sdk_regression.sh +3 -9
- package/scripts/01_prepare_all.ts +198 -149
- package/scripts/02_test_eoa.ts +24 -27
- package/scripts/03_test_standard_aa.ts +153 -48
- package/scripts/04_test_paymaster_v4.ts +198 -41
- package/scripts/05_test_superpaymaster.ts +362 -40
- package/scripts/11_test_core_flows_full.ts +197 -75
- package/scripts/18_test_dvt_sdk_flow.ts +1 -1
- package/scripts/19_sdk_experiment_runner.ts +135 -42
- package/scripts/20_sdk_full_capability.ts +77 -75
- package/scripts/analyze_abi_coverage.ts +4 -4
- package/scripts/analyze_missing_functions.ts +136 -0
- package/scripts/canary-bundler.ts +47 -0
- package/scripts/check-chainlink.ts +28 -0
- package/scripts/check-jason-status.ts +61 -160
- package/scripts/check-roles.ts +1 -1
- package/scripts/complete-jack-superpaymaster.ts +1 -1
- package/scripts/deploy_and_init_v3.sh +0 -0
- package/scripts/deploy_jason_pm.ts +114 -0
- package/scripts/dev_tools/extract_abis.sh +0 -0
- package/scripts/dev_tools/extract_addresses_to_env.sh +0 -0
- package/scripts/extract-docs.sh +9 -78
- package/scripts/l4-debug-bob.ts +62 -0
- package/scripts/l4-paymasterv4-transfer-test.ts +12 -20
- package/scripts/l4-setup.ts +1235 -341
- package/scripts/l4-state.json +16 -14
- package/scripts/manual-update-price.ts +39 -0
- package/scripts/phase1_verify_contracts.ts +1 -1
- package/scripts/publish_all.sh +0 -0
- package/scripts/query-jack-token.ts +1 -1
- package/scripts/run_automated_experiment.sh +0 -0
- package/scripts/run_full_regression.sh +38 -0
- package/scripts/run_l4_gasless_regression.sh +0 -0
- package/scripts/run_sdk_experiment.sh +0 -0
- package/scripts/run_sdk_regression-v2.sh +0 -0
- package/scripts/sdk_regression_v2.ts +20 -34
- package/scripts/security_audit.sh +0 -0
- package/scripts/setup-bbq-community.ts +2 -2
- package/scripts/setup-dancing-community.ts +3 -3
- package/scripts/test-brown-v4-deploy.ts +2 -2
- package/scripts/test-faucet-and-gasless.ts +119 -139
- package/scripts/test-jack-gasless.ts +1 -1
- package/scripts/test-jack-registration.ts +2 -2
- package/scripts/test-jack-superpaymaster-api.ts +2 -2
- package/scripts/test-kms-gasless.ts +307 -93
- package/scripts/update-price-dvt.ts +53 -0
- package/scripts/v2_regression/01_setup_and_fund.ts +1 -1
- package/scripts/v2_regression/02_operator_onboarding.ts +140 -14
- package/scripts/v2_regression/03_community_registry.ts +58 -24
- package/scripts/v2_regression/04_enduser_flow.ts +49 -16
- package/scripts/v2_regression/05_admin_audit.ts +1 -1
- package/scripts/verify-bob-token.ts +41 -0
- package/sdk-abi-coverage.sh +1 -0
- package/sdk-build-and-test.sh +1 -0
- package/sdk-test-coverage.sh +1 -0
- package/simple-test-paymaster.sh +1 -1
- package/simple-test-superpaymaster.sh +3 -1
- package/tests/check-aa-balance.ts +31 -0
- package/tests/l1-regression.test.ts +13 -34
- package/tests/l4-test-anni-gasless.ts +497 -85
- package/tests/l4-test-jason1-gasless.ts +29 -21
- package/tests/l4-test-jason2-gasless.ts +21 -15
- package/tests/l4-test-pmv4-deposit.ts +2 -2
- package/tests/l4-test-pmv4-gasless.ts +2 -2
- package/tests/l4-test-pmv4-submit.ts +2 -2
- package/tests/regression/config.ts +4 -2
- package/tests/regression/index.ts +0 -0
- package/tests/regression/l1-tests.ts +16 -35
- package/tests/regression/l2-tests.ts +149 -93
- package/tests/regression/l3-tests.ts +16 -113
- package/tests/regression/l4-comprehensive-gasless.ts +478 -0
- package/tests/regression/l4-gasless.ts +115 -13
- package/tests/regression/l4-reputation-tiers.ts +102 -0
- package/tests/test-bundler-compat.ts +132 -0
- package/tests/test-candide-bundler.ts +117 -0
- package/tests/test-candide-paymaster.ts +101 -0
- package/tests/test-candide-sdk.ts +116 -0
- package/tests/test-candide-simple.ts +204 -0
- package/tests/test-pimlico-complete.ts +134 -0
- package/tests/utils/contractVerifier.ts +3 -3
- package/tsconfig.build.json +23 -0
- package/tsconfig.json +5 -19
- package/typedoc.json +5 -39
- package/update-version.sh +20 -0
- package/vitest.config.ts +6 -5
- package/.eslintrc.cjs +0 -30
- package/docs/ABI_Change_Tracking_Workflow.md +0 -41
- package/docs/Faucet_Gasless_Plan.md +0 -56
- package/docs/api/@aastar/account.md +0 -235
- package/docs/api/@aastar/analytics.md +0 -219
- package/docs/api/@aastar/core.md +0 -26830
- package/docs/api/@aastar/dapp.md +0 -130
- package/docs/api/@aastar/identity.md +0 -482
- package/docs/api/@aastar/paymaster.md +0 -1387
- package/docs/api/@aastar/sdk/README.md +0 -155
- package/docs/api/@aastar/sdk/node.md +0 -4044
- package/docs/api/@aastar/tokens.md +0 -1971
- package/docs/changelog.md +0 -99
- package/docs/examples/README.md +0 -18
- package/docs/guide/concepts/account-abstraction.md +0 -95
- package/docs/guide/concepts/rainbow-bridge.md +0 -68
- package/docs/guide/concepts/reputation.md +0 -95
- package/docs/guide/concepts/superpaymaster.md +0 -141
- package/docs/guide/use-cases/community-management.md +0 -141
- package/docs/guide/use-cases/gasless-transactions.md +0 -71
- package/docs/guide/use-cases/operator-staking.md +0 -84
- package/docs/guide/use-cases/yop.md +0 -72
- package/docs/refactor/2026-01-13-221242-trae-refactor.md +0 -224
- package/docs/refactor/2026-01-13-audit-analysis.md +0 -96
- package/docs/refactor/2026-01-13-audit-report-v0.16.2.md +0 -76
- package/docs/refactor/2026-01-13-audit-report-v0.17.0.md +0 -74
- package/docs/refactor/2026-01-13-cursor-refactor.md +0 -511
- package/docs/refactor/2026-01-13-refactor-plan.md +0 -88
- package/docs/refactor/2026-01-13-refactor-response-plan.md +0 -77
- package/docs/refactor/2026-01-13-refactor-review.md +0 -39
- package/docs/refactor/2026-01-13-sdk-enhancement-plan.md +0 -120
- package/docs/refactor/2026-01-14-audit-response.md +0 -242
- package/docs/refactor/2026-01-14-audit-summary.md +0 -133
- package/docs/refactor/cursor-2026-01-13-14-00-audit-report.md +0 -267
- package/packages/account/src/accounts/simple.test.ts +0 -93
- package/packages/account/src/eoa.test.ts +0 -37
- package/packages/account/src/index.test.ts +0 -34
- package/packages/core/scripts/audit-abi-coverage.ts +0 -165
- package/packages/core/scripts/debug-regex.ts +0 -36
- package/packages/core/src/abis/.abi-hashes.json +0 -26
- package/packages/core/src/actions/StateValidator.test.ts +0 -175
- package/packages/core/src/actions/account.test.ts +0 -155
- package/packages/core/src/actions/aggregator.test.ts +0 -88
- package/packages/core/src/actions/dvt.test.ts +0 -124
- package/packages/core/src/actions/entryPoint.test.ts +0 -176
- package/packages/core/src/actions/factory.test.ts +0 -250
- package/packages/core/src/actions/faucet.test.ts +0 -202
- package/packages/core/src/actions/gtokenExtended.test.ts +0 -162
- package/packages/core/src/actions/gtokenExtended.ts +0 -153
- package/packages/core/src/actions/paymasterV4.test.ts +0 -209
- package/packages/core/src/actions/paymasterV4.ts +0 -455
- package/packages/core/src/actions/registry.test.ts +0 -443
- package/packages/core/src/actions/reputation.test.ts +0 -225
- package/packages/core/src/actions/sbt.test.ts +0 -322
- package/packages/core/src/actions/staking.test.ts +0 -273
- package/packages/core/src/actions/superPaymaster.test.ts +0 -356
- package/packages/core/src/actions/tokens.test.ts +0 -60
- package/packages/core/src/actions/validators.test.ts +0 -239
- package/packages/core/src/actions/validators.ts +0 -590
- package/packages/core/src/contracts.test.ts +0 -58
- package/packages/core/src/requirementChecker.test.ts +0 -71
- package/packages/core/src/roles.test.ts +0 -34
- package/packages/core/src/utils/validation.test.ts +0 -50
- package/packages/core/src/utils/validation.ts +0 -66
- package/packages/core/vitest.config.ts +0 -14
- package/packages/paymaster/src/V4/PaymasterClient.test.ts +0 -114
- package/packages/paymaster/src/V4/PaymasterOperator.test.ts +0 -80
- package/packages/paymaster/src/V4/PaymasterUtils.test.ts +0 -54
- package/packages/paymaster/src/V4/SuperPaymasterClient.test.ts +0 -79
- package/packages/sdk/coverage_output.txt +0 -393
- package/packages/sdk/coverage_output_final.txt +0 -739
- package/packages/sdk/coverage_output_final_v2.txt +0 -722
- package/packages/sdk/coverage_output_final_v3.txt +0 -722
- package/packages/sdk/src/clients/ExperimentClient.test.ts +0 -65
- package/packages/sdk/src/clients/admin.test.ts +0 -98
- package/packages/sdk/src/clients/clients.test.ts +0 -104
- package/packages/sdk/src/clients/community.test.ts +0 -118
- package/packages/sdk/src/clients/endUser.test.ts +0 -221
- package/packages/sdk/src/clients/operator.test.ts +0 -162
- package/packages/sdk/src/errors/AAStarError.test.ts +0 -92
- package/packages/sdk/src/errors/AAStarError.ts +0 -70
- package/packages/sdk/src/errors/decoder.test.ts +0 -107
- package/packages/sdk/src/node/index.ts +0 -8
- package/packages/sdk/src/types/result.ts +0 -29
- package/packages/sdk/src/utils/errorHandler.test.ts +0 -102
- package/packages/sdk/src/utils/eventDecoder.test.ts +0 -56
- package/packages/sdk/src/utils/eventDecoder.ts +0 -66
- package/packages/sdk/src/utils/funding.test.ts +0 -117
- package/packages/sdk/src/utils/keys.test.ts +0 -105
- package/packages/sdk/src/utils/roleData.test.ts +0 -85
- package/packages/sdk/src/utils/testScenarios.test.ts +0 -79
- package/packages/sdk/src/utils/userOp.test.ts +0 -190
- package/scripts/debug-addr.ts +0 -43
- package/scripts/debug-community-registration.ts +0 -92
- package/scripts/debug-deploy-v4.ts +0 -116
- package/scripts/debug-paymaster.ts +0 -127
- package/scripts/debug-register-role.ts +0 -101
- package/scripts/debug-version.ts +0 -71
- package/scripts/debug_account_c.ts +0 -43
- package/scripts/debug_bls.ts +0 -58
- package/scripts/debug_config_v036.ts +0 -13
- package/scripts/debug_contracts.ts +0 -2
- package/scripts/debug_env.ts +0 -69
- package/scripts/debug_find_paymaster.ts +0 -98
- package/scripts/debug_isolated_registration.ts +0 -256
- package/scripts/debug_paymaster_config.ts +0 -19
- package/scripts/debug_pim_addr.ts +0 -23
- package/scripts/debug_pm_status.ts +0 -51
- package/scripts/debug_registry.ts +0 -39
- package/scripts/debug_registry_setup.ts +0 -129
- package/scripts/debug_sanity.ts +0 -32
- package/scripts/debug_shared_config.ts +0 -10
- package/scripts/debug_token_compat.ts +0 -51
- package/scripts/debug_tokens.ts +0 -41
- package/scripts/debug_vcheck.ts +0 -33
- package/scripts/test_groups.ts +0 -138
- package/scripts/test_multi_community_anvil.ts +0 -276
- package/scripts/test_new_sdk_apis_sepolia.ts +0 -193
- package/scripts/test_sdk_join_idempotent.ts +0 -233
- package/scripts/test_simple_sepolia.ts +0 -44
|
@@ -1,613 +1,732 @@
|
|
|
1
1
|
import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account, parseEther } from 'viem';
|
|
2
2
|
import { xPNTsFactoryABI, PaymasterFactoryABI } from '../abis/index.js';
|
|
3
|
+
import { validateAddress, validateRequired, validateAmount } from '../validators/index.js';
|
|
4
|
+
import { AAStarError } from '../errors/index.js';
|
|
3
5
|
|
|
4
6
|
// xPNTs Factory Actions (基于地址调用的通用接口)
|
|
5
7
|
export type XPNTsFactoryActions = {
|
|
6
8
|
// Token 部署
|
|
9
|
+
deployxPNTsToken: (args: { name: string, symbol: string, communityName: string, communityENS: string, exchangeRate: bigint, paymasterAOA: Address, account?: Account | Address }) => Promise<Hash>;
|
|
7
10
|
createToken: (args: { name: string, symbol: string, community: Address, account?: Account | Address }) => Promise<Hash>;
|
|
8
11
|
deployForCommunity: (args: { community: Address, account?: Account | Address }) => Promise<Hash>;
|
|
9
12
|
|
|
10
13
|
// 查询
|
|
11
14
|
getTokenAddress: (args: { community: Address }) => Promise<Address>;
|
|
12
15
|
predictAddress: (args: { community: Address, salt?: bigint }) => Promise<Address>;
|
|
16
|
+
hasToken: (args: { community: Address }) => Promise<boolean>;
|
|
13
17
|
isTokenDeployed: (args: { community: Address }) => Promise<boolean>;
|
|
14
18
|
getCommunityByToken: (args: { token: Address }) => Promise<Address>;
|
|
15
19
|
getAllTokens: () => Promise<Address[]>;
|
|
20
|
+
getDeployedCount: () => Promise<bigint>;
|
|
16
21
|
getTokenCount: () => Promise<bigint>;
|
|
17
22
|
deployedTokens: (args: { index: bigint }) => Promise<Address>;
|
|
18
23
|
communityToToken: (args: { community: Address }) => Promise<Address>;
|
|
19
24
|
|
|
20
25
|
// 配置
|
|
21
26
|
setRegistry: (args: { registry: Address, account?: Account | Address }) => Promise<Hash>;
|
|
27
|
+
setSuperPaymasterAddress: (args: { paymaster: Address, account?: Account | Address }) => Promise<Hash>;
|
|
22
28
|
setSuperPaymaster: (args: { paymaster: Address, account?: Account | Address }) => Promise<Hash>;
|
|
23
29
|
setImplementation: (args: { impl: Address, account?: Account | Address }) => Promise<Hash>;
|
|
24
30
|
getImplementation: () => Promise<Address>;
|
|
25
31
|
|
|
26
32
|
// 常量
|
|
27
33
|
REGISTRY: () => Promise<Address>;
|
|
34
|
+
SUPERPAYMASTER: () => Promise<Address>;
|
|
28
35
|
SUPER_PAYMASTER: () => Promise<Address>;
|
|
29
36
|
tokenImplementation: () => Promise<Address>;
|
|
30
37
|
|
|
31
38
|
// Ownership
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// Aliases
|
|
37
|
-
deployxPNTsToken: (args: { name: string, symbol: string, community: Address, account?: Account | Address }) => Promise<Hash>; // Alias
|
|
38
|
-
|
|
39
|
-
// Prediction & Economics
|
|
40
|
-
predictDepositAmount: (args: { community: Address, userCount: bigint }) => Promise<bigint>;
|
|
41
|
-
getPredictionParams: (args: { community: Address }) => Promise<any>;
|
|
42
|
-
getDepositBreakdown: (args: { community: Address }) => Promise<any>;
|
|
43
|
-
getAPNTsPrice: () => Promise<bigint>;
|
|
44
|
-
aPNTsPriceUSD: () => Promise<bigint>;
|
|
45
|
-
|
|
46
|
-
// Admin & Config
|
|
47
|
-
setIndustryMultiplier: (args: { industry: string, multiplier: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
48
|
-
setSuperPaymasterAddress: (args: { paymaster: Address, account?: Account | Address }) => Promise<Hash>;
|
|
49
|
-
updateAPNTsPrice: (args: { newPrice: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
50
|
-
updatePrediction: (args: { community: Address, userCount: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
51
|
-
updatePredictionCustom: (args: { community: Address, params: any, account?: Account | Address }) => Promise<Hash>;
|
|
52
|
-
|
|
53
|
-
// Views
|
|
54
|
-
hasToken: (args: { token: Address }) => Promise<boolean>;
|
|
55
|
-
getDeployedCount: () => Promise<bigint>;
|
|
56
|
-
industryMultipliers: (args: { industry: string }) => Promise<bigint>;
|
|
57
|
-
getIndustryMultiplier: (args: { industry: string }) => Promise<bigint>;
|
|
58
|
-
predictions: (args: { community: Address }) => Promise<any>;
|
|
59
|
-
|
|
60
|
-
// Constants
|
|
61
|
-
MIN_SUGGESTED_AMOUNT: () => Promise<bigint>;
|
|
62
|
-
DEFAULT_SAFETY_FACTOR: () => Promise<bigint>;
|
|
63
|
-
SUPERPAYMASTER: () => Promise<Address>; // Alias for SUPER_PAYMASTER due to ABI naming
|
|
39
|
+
owner: () => Promise<Address>;
|
|
40
|
+
transferOwnership: (args: { newOwner: Address, account?: Account | Address }) => Promise<Hash>;
|
|
41
|
+
renounceOwnership: (args: { account?: Account | Address }) => Promise<Hash>;
|
|
64
42
|
|
|
65
43
|
// Version
|
|
66
|
-
|
|
44
|
+
version: () => Promise<string>;
|
|
67
45
|
};
|
|
68
46
|
|
|
69
47
|
// Paymaster Factory Actions
|
|
70
48
|
export type PaymasterFactoryActions = {
|
|
71
49
|
// Deployment
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
deployPaymasterDeterministic: (args: { owner: Address, version?: string, initData?: Hex, salt: Hex, account?: Account | Address }) => Promise<Hash>;
|
|
75
|
-
predictPaymasterAddress: (args: { owner: Address, salt: Hex }) => Promise<Address>;
|
|
50
|
+
deployPaymaster: (args: { version?: string, initData?: Hex, account?: Account | Address }) => Promise<Hash>;
|
|
51
|
+
deployPaymasterDeterministic: (args: { version: string, salt: Hex, initData: Hex, account?: Account | Address }) => Promise<Hash>;
|
|
76
52
|
|
|
77
53
|
// Query
|
|
78
54
|
calculateAddress: (args: { owner: Address }) => Promise<Address>;
|
|
79
|
-
getPaymaster: (args: { owner: Address }) => Promise<Address>;
|
|
55
|
+
getPaymaster: (args: { owner: Address }) => Promise<Address>;
|
|
56
|
+
getPaymasterByOperator: (args: { operator: Address }) => Promise<Address>;
|
|
57
|
+
getOperatorByPaymaster: (args: { paymaster: Address }) => Promise<Address>;
|
|
80
58
|
getPaymasterCount: () => Promise<bigint>;
|
|
81
59
|
getAllPaymasters: () => Promise<Address[]>;
|
|
82
|
-
isPaymasterDeployed: (args: { owner: Address }) => Promise<boolean>;
|
|
83
|
-
|
|
84
60
|
hasPaymaster: (args: { owner: Address }) => Promise<boolean>;
|
|
85
|
-
|
|
86
|
-
paymasterList: (args: { index: bigint }) => Promise<Address>;
|
|
87
|
-
totalDeployed: () => Promise<bigint>;
|
|
88
|
-
|
|
89
|
-
getOperatorByPaymaster: (args: { paymaster: Address }) => Promise<Address>;
|
|
90
|
-
operatorByPaymaster: (args: { paymaster: Address }) => Promise<Address>;
|
|
91
|
-
getPaymasterByOperator: (args: { operator: Address }) => Promise<Address>;
|
|
92
|
-
paymasterByOperator: (args: { operator: Address }) => Promise<Address>;
|
|
93
|
-
getPaymasterInfo: (args: { paymaster: Address }) => Promise<any>;
|
|
94
|
-
|
|
95
|
-
hasImplementation: (args: { version: string }) => Promise<boolean>;
|
|
96
|
-
implementations: (args: { version: string }) => Promise<Address>;
|
|
61
|
+
isPaymasterDeployed: (args: { owner: Address }) => Promise<boolean>;
|
|
97
62
|
|
|
98
63
|
// Config
|
|
64
|
+
addImplementation: (args: { version: string, impl: Address, account?: Account | Address }) => Promise<Hash>;
|
|
65
|
+
upgradeImplementation: (args: { version: string, impl: Address, account?: Account | Address }) => Promise<Hash>;
|
|
66
|
+
setDefaultVersion: (args: { version: string, account?: Account | Address }) => Promise<Hash>;
|
|
99
67
|
setImplementationV4: (args: { impl: Address, account?: Account | Address }) => Promise<Hash>;
|
|
68
|
+
getImplementation: (args: { version: string }) => Promise<Address>;
|
|
100
69
|
getImplementationV4: () => Promise<Address>;
|
|
101
70
|
setRegistry: (args: { registry: Address, account?: Account | Address }) => Promise<Hash>;
|
|
102
71
|
|
|
103
|
-
addImplementation: (args: { version: string, implementation: Address, account?: Account | Address }) => Promise<Hash>;
|
|
104
|
-
upgradeImplementation: (args: { version: string, newImplementation: Address, account?: Account | Address }) => Promise<Hash>;
|
|
105
|
-
setDefaultVersion: (args: { version: string, account?: Account | Address }) => Promise<Hash>;
|
|
106
|
-
|
|
107
72
|
// Constants
|
|
108
73
|
REGISTRY: () => Promise<Address>;
|
|
109
74
|
ENTRY_POINT: () => Promise<Address>;
|
|
110
75
|
|
|
111
76
|
// Ownership
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
renouncePaymasterFactoryOwnership: (args: { account?: Account | Address }) => Promise<Hash>;
|
|
77
|
+
owner: () => Promise<Address>;
|
|
78
|
+
transferOwnership: (args: { newOwner: Address, account?: Account | Address }) => Promise<Hash>;
|
|
115
79
|
|
|
116
80
|
// Version
|
|
117
81
|
defaultVersion: () => Promise<string>;
|
|
118
|
-
|
|
82
|
+
totalDeployed: () => Promise<bigint>;
|
|
83
|
+
version: () => Promise<string>;
|
|
119
84
|
};
|
|
120
85
|
|
|
121
|
-
export const xPNTsFactoryActions = (address: Address) => (client: PublicClient | WalletClient): XPNTsFactoryActions =>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
86
|
+
export const xPNTsFactoryActions = (address: Address) => (client: PublicClient | WalletClient): XPNTsFactoryActions => {
|
|
87
|
+
const actions: XPNTsFactoryActions = {
|
|
88
|
+
async deployxPNTsToken({ name, symbol, communityName, communityENS, exchangeRate, paymasterAOA, account }) {
|
|
89
|
+
try {
|
|
90
|
+
validateRequired(name, 'name');
|
|
91
|
+
validateRequired(symbol, 'symbol');
|
|
92
|
+
validateRequired(communityName, 'communityName');
|
|
93
|
+
validateRequired(communityENS, 'communityENS');
|
|
94
|
+
validateAmount(exchangeRate, 'exchangeRate');
|
|
95
|
+
validateAddress(paymasterAOA, 'paymasterAOA');
|
|
96
|
+
return await (client as any).writeContract({
|
|
97
|
+
address,
|
|
98
|
+
abi: xPNTsFactoryABI,
|
|
99
|
+
functionName: 'deployxPNTsToken',
|
|
100
|
+
args: [name, symbol, communityName, communityENS, exchangeRate, paymasterAOA],
|
|
101
|
+
account: account as any,
|
|
102
|
+
chain: (client as any).chain
|
|
103
|
+
});
|
|
104
|
+
} catch (error) {
|
|
105
|
+
throw AAStarError.fromViemError(error as Error, 'deployxPNTsToken');
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
async createToken({ name, symbol, community, account }) {
|
|
110
|
+
return this.deployxPNTsToken({
|
|
111
|
+
name,
|
|
112
|
+
symbol,
|
|
113
|
+
communityName: name,
|
|
114
|
+
communityENS: symbol,
|
|
115
|
+
exchangeRate: parseEther('1'),
|
|
116
|
+
paymasterAOA: '0x0000000000000000000000000000000000000000',
|
|
117
|
+
account
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
async deployForCommunity({ community, account }) {
|
|
122
|
+
try {
|
|
123
|
+
validateAddress(community, 'community');
|
|
124
|
+
return await (client as any).writeContract({
|
|
125
|
+
address,
|
|
126
|
+
abi: xPNTsFactoryABI,
|
|
127
|
+
functionName: 'deployForCommunity',
|
|
128
|
+
args: [community],
|
|
129
|
+
account: account as any,
|
|
130
|
+
chain: (client as any).chain
|
|
131
|
+
});
|
|
132
|
+
} catch (error) {
|
|
133
|
+
throw AAStarError.fromViemError(error as Error, 'deployForCommunity');
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
async getTokenAddress({ community }) {
|
|
138
|
+
try {
|
|
139
|
+
validateAddress(community, 'community');
|
|
140
|
+
return await (client as PublicClient).readContract({
|
|
141
|
+
address,
|
|
142
|
+
abi: xPNTsFactoryABI,
|
|
143
|
+
functionName: 'getTokenAddress',
|
|
144
|
+
args: [community]
|
|
145
|
+
}) as Address;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
throw AAStarError.fromViemError(error as Error, 'getTokenAddress');
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
async predictAddress({ community, salt }) {
|
|
152
|
+
try {
|
|
153
|
+
validateAddress(community, 'community');
|
|
154
|
+
return await (client as PublicClient).readContract({
|
|
155
|
+
address,
|
|
156
|
+
abi: xPNTsFactoryABI,
|
|
157
|
+
functionName: 'predictAddress',
|
|
158
|
+
args: salt !== undefined ? [community, salt] : [community]
|
|
159
|
+
}) as Address;
|
|
160
|
+
} catch (error) {
|
|
161
|
+
throw AAStarError.fromViemError(error as Error, 'predictAddress');
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
async hasToken({ community }) {
|
|
166
|
+
try {
|
|
167
|
+
validateAddress(community, 'community');
|
|
168
|
+
return await (client as PublicClient).readContract({
|
|
169
|
+
address,
|
|
170
|
+
abi: xPNTsFactoryABI,
|
|
171
|
+
functionName: 'hasToken',
|
|
172
|
+
args: [community]
|
|
173
|
+
}) as boolean;
|
|
174
|
+
} catch (error) {
|
|
175
|
+
throw AAStarError.fromViemError(error as Error, 'hasToken');
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
async isTokenDeployed({ community }) {
|
|
180
|
+
return this.hasToken({ community });
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
async getCommunityByToken({ token }) {
|
|
184
|
+
try {
|
|
185
|
+
validateAddress(token, 'token');
|
|
186
|
+
return await (client as PublicClient).readContract({
|
|
187
|
+
address,
|
|
188
|
+
abi: xPNTsFactoryABI,
|
|
189
|
+
functionName: 'getCommunityByToken',
|
|
190
|
+
args: [token]
|
|
191
|
+
}) as Address;
|
|
192
|
+
} catch (error) {
|
|
193
|
+
throw AAStarError.fromViemError(error as Error, 'getCommunityByToken');
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
async getAllTokens() {
|
|
198
|
+
try {
|
|
199
|
+
return await (client as PublicClient).readContract({
|
|
200
|
+
address,
|
|
201
|
+
abi: xPNTsFactoryABI,
|
|
202
|
+
functionName: 'getAllTokens',
|
|
203
|
+
args: []
|
|
204
|
+
}) as Address[];
|
|
205
|
+
} catch (error) {
|
|
206
|
+
throw AAStarError.fromViemError(error as Error, 'getAllTokens');
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
async getDeployedCount() {
|
|
211
|
+
try {
|
|
212
|
+
return await (client as PublicClient).readContract({
|
|
213
|
+
address,
|
|
214
|
+
abi: xPNTsFactoryABI,
|
|
215
|
+
functionName: 'getDeployedCount',
|
|
216
|
+
args: []
|
|
217
|
+
}) as bigint;
|
|
218
|
+
} catch (error) {
|
|
219
|
+
throw AAStarError.fromViemError(error as Error, 'getDeployedCount');
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
async getTokenCount() {
|
|
224
|
+
return this.getDeployedCount();
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
async deployedTokens({ index }) {
|
|
228
|
+
try {
|
|
229
|
+
return await (client as PublicClient).readContract({
|
|
230
|
+
address,
|
|
231
|
+
abi: xPNTsFactoryABI,
|
|
232
|
+
functionName: 'deployedTokens',
|
|
233
|
+
args: [index]
|
|
234
|
+
}) as Address;
|
|
235
|
+
} catch (error) {
|
|
236
|
+
throw AAStarError.fromViemError(error as Error, 'deployedTokens');
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
async communityToToken({ community }) {
|
|
241
|
+
try {
|
|
242
|
+
validateAddress(community, 'community');
|
|
243
|
+
return await (client as PublicClient).readContract({
|
|
244
|
+
address,
|
|
245
|
+
abi: xPNTsFactoryABI,
|
|
246
|
+
functionName: 'communityToToken',
|
|
247
|
+
args: [community]
|
|
248
|
+
}) as Address;
|
|
249
|
+
} catch (error) {
|
|
250
|
+
throw AAStarError.fromViemError(error as Error, 'communityToToken');
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
async setRegistry({ registry, account }) {
|
|
255
|
+
try {
|
|
256
|
+
validateAddress(registry, 'registry');
|
|
257
|
+
return await (client as any).writeContract({
|
|
258
|
+
address,
|
|
259
|
+
abi: xPNTsFactoryABI,
|
|
260
|
+
functionName: 'setRegistry',
|
|
261
|
+
args: [registry],
|
|
262
|
+
account: account as any,
|
|
263
|
+
chain: (client as any).chain
|
|
264
|
+
});
|
|
265
|
+
} catch (error) {
|
|
266
|
+
throw AAStarError.fromViemError(error as Error, 'setRegistry');
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
async setSuperPaymasterAddress({ paymaster, account }) {
|
|
271
|
+
try {
|
|
272
|
+
validateAddress(paymaster, 'paymaster');
|
|
273
|
+
return await (client as any).writeContract({
|
|
274
|
+
address,
|
|
275
|
+
abi: xPNTsFactoryABI,
|
|
276
|
+
functionName: 'setSuperPaymasterAddress',
|
|
277
|
+
args: [paymaster],
|
|
278
|
+
account: account as any,
|
|
279
|
+
chain: (client as any).chain
|
|
280
|
+
});
|
|
281
|
+
} catch (error) {
|
|
282
|
+
throw AAStarError.fromViemError(error as Error, 'setSuperPaymasterAddress');
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
async setSuperPaymaster({ paymaster, account }) {
|
|
287
|
+
return this.setSuperPaymasterAddress({ paymaster, account });
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
async setImplementation({ impl, account }) {
|
|
291
|
+
try {
|
|
292
|
+
validateAddress(impl, 'impl');
|
|
293
|
+
return await (client as any).writeContract({
|
|
294
|
+
address,
|
|
295
|
+
abi: xPNTsFactoryABI,
|
|
296
|
+
functionName: 'setImplementation',
|
|
297
|
+
args: [impl],
|
|
298
|
+
account: account as any,
|
|
299
|
+
chain: (client as any).chain
|
|
300
|
+
});
|
|
301
|
+
} catch (error) {
|
|
302
|
+
throw AAStarError.fromViemError(error as Error, 'setImplementation');
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
async getImplementation() {
|
|
307
|
+
try {
|
|
308
|
+
return await (client as PublicClient).readContract({
|
|
309
|
+
address,
|
|
310
|
+
abi: xPNTsFactoryABI,
|
|
311
|
+
functionName: 'getImplementation',
|
|
312
|
+
args: []
|
|
313
|
+
}) as Address;
|
|
314
|
+
} catch (error) {
|
|
315
|
+
throw AAStarError.fromViemError(error as Error, 'getImplementation');
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
async REGISTRY() {
|
|
320
|
+
try {
|
|
321
|
+
return await (client as PublicClient).readContract({
|
|
322
|
+
address,
|
|
323
|
+
abi: xPNTsFactoryABI,
|
|
324
|
+
functionName: 'REGISTRY',
|
|
325
|
+
args: []
|
|
326
|
+
}) as Address;
|
|
327
|
+
} catch (error) {
|
|
328
|
+
throw AAStarError.fromViemError(error as Error, 'REGISTRY');
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
async SUPERPAYMASTER() {
|
|
333
|
+
try {
|
|
334
|
+
return await (client as PublicClient).readContract({
|
|
335
|
+
address,
|
|
336
|
+
abi: xPNTsFactoryABI,
|
|
337
|
+
functionName: 'SUPERPAYMASTER',
|
|
338
|
+
args: []
|
|
339
|
+
}) as Address;
|
|
340
|
+
} catch (error) {
|
|
341
|
+
throw AAStarError.fromViemError(error as Error, 'SUPERPAYMASTER');
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
async SUPER_PAYMASTER() {
|
|
346
|
+
return this.SUPERPAYMASTER();
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
async tokenImplementation() {
|
|
350
|
+
try {
|
|
351
|
+
return await (client as PublicClient).readContract({
|
|
352
|
+
address,
|
|
353
|
+
abi: xPNTsFactoryABI,
|
|
354
|
+
functionName: 'tokenImplementation',
|
|
355
|
+
args: []
|
|
356
|
+
}) as Address;
|
|
357
|
+
} catch (error) {
|
|
358
|
+
throw AAStarError.fromViemError(error as Error, 'tokenImplementation');
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
async owner() {
|
|
363
|
+
try {
|
|
364
|
+
return await (client as PublicClient).readContract({
|
|
365
|
+
address,
|
|
366
|
+
abi: xPNTsFactoryABI,
|
|
367
|
+
functionName: 'owner',
|
|
368
|
+
args: []
|
|
369
|
+
}) as Address;
|
|
370
|
+
} catch (error) {
|
|
371
|
+
throw AAStarError.fromViemError(error as Error, 'owner');
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
|
|
375
|
+
async transferOwnership({ newOwner, account }) {
|
|
376
|
+
try {
|
|
377
|
+
validateAddress(newOwner, 'newOwner');
|
|
378
|
+
return await (client as any).writeContract({
|
|
379
|
+
address,
|
|
380
|
+
abi: xPNTsFactoryABI,
|
|
381
|
+
functionName: 'transferOwnership',
|
|
382
|
+
args: [newOwner],
|
|
383
|
+
account: account as any,
|
|
384
|
+
chain: (client as any).chain
|
|
385
|
+
});
|
|
386
|
+
} catch (error) {
|
|
387
|
+
throw AAStarError.fromViemError(error as Error, 'transferOwnership');
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
async renounceOwnership({ account }) {
|
|
392
|
+
try {
|
|
393
|
+
return await (client as any).writeContract({
|
|
394
|
+
address,
|
|
395
|
+
abi: xPNTsFactoryABI,
|
|
396
|
+
functionName: 'renounceOwnership',
|
|
397
|
+
args: [],
|
|
398
|
+
account: account as any,
|
|
399
|
+
chain: (client as any).chain
|
|
400
|
+
});
|
|
401
|
+
} catch (error) {
|
|
402
|
+
throw AAStarError.fromViemError(error as Error, 'renounceOwnership');
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
|
|
406
|
+
async version() {
|
|
407
|
+
try {
|
|
408
|
+
return await (client as PublicClient).readContract({
|
|
409
|
+
address,
|
|
410
|
+
abi: xPNTsFactoryABI,
|
|
411
|
+
functionName: 'version',
|
|
412
|
+
args: []
|
|
413
|
+
}) as string;
|
|
414
|
+
} catch (error) {
|
|
415
|
+
throw AAStarError.fromViemError(error as Error, 'version');
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
return actions;
|
|
420
|
+
};
|
|
381
421
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
})
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
422
|
+
export const paymasterFactoryActions = (address: Address) => (client: PublicClient | WalletClient): PaymasterFactoryActions => {
|
|
423
|
+
const actions: PaymasterFactoryActions = {
|
|
424
|
+
async deployPaymaster({ version, initData, account }) {
|
|
425
|
+
try {
|
|
426
|
+
const defaultVer = 'v4.2';
|
|
427
|
+
const useVer = version || defaultVer;
|
|
428
|
+
|
|
429
|
+
return await (client as any).writeContract({
|
|
430
|
+
address,
|
|
431
|
+
abi: PaymasterFactoryABI,
|
|
432
|
+
functionName: 'deployPaymaster',
|
|
433
|
+
args: [useVer, initData || '0x'],
|
|
434
|
+
account: account as any,
|
|
435
|
+
chain: (client as any).chain
|
|
436
|
+
});
|
|
437
|
+
} catch (error) {
|
|
438
|
+
throw AAStarError.fromViemError(error as Error, 'deployPaymaster');
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
async deployPaymasterDeterministic({ version, salt, initData, account }) {
|
|
443
|
+
try {
|
|
444
|
+
validateRequired(version, 'version');
|
|
445
|
+
validateRequired(salt, 'salt');
|
|
446
|
+
return await (client as any).writeContract({
|
|
447
|
+
address,
|
|
448
|
+
abi: PaymasterFactoryABI,
|
|
449
|
+
functionName: 'deployPaymasterDeterministic',
|
|
450
|
+
args: [version, salt, initData || '0x'],
|
|
451
|
+
account: account as any,
|
|
452
|
+
chain: (client as any).chain
|
|
453
|
+
});
|
|
454
|
+
} catch (error) {
|
|
455
|
+
throw AAStarError.fromViemError(error as Error, 'deployPaymasterDeterministic');
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
async calculateAddress({ owner }) {
|
|
460
|
+
throw new Error('Predicting address not supported for standard deploy. Use getPaymaster after deploy.');
|
|
461
|
+
},
|
|
462
|
+
|
|
463
|
+
async getPaymaster({ owner }) {
|
|
464
|
+
return this.getPaymasterByOperator({ operator: owner });
|
|
465
|
+
},
|
|
466
|
+
|
|
467
|
+
async getPaymasterByOperator({ operator }) {
|
|
468
|
+
try {
|
|
469
|
+
validateAddress(operator, 'operator');
|
|
470
|
+
return await (client as PublicClient).readContract({
|
|
471
|
+
address,
|
|
472
|
+
abi: PaymasterFactoryABI,
|
|
473
|
+
functionName: 'getPaymasterByOperator',
|
|
474
|
+
args: [operator]
|
|
475
|
+
}) as Address;
|
|
476
|
+
} catch (error) {
|
|
477
|
+
throw AAStarError.fromViemError(error as Error, 'getPaymasterByOperator');
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
|
|
481
|
+
async getOperatorByPaymaster({ paymaster }) {
|
|
482
|
+
try {
|
|
483
|
+
validateAddress(paymaster, 'paymaster');
|
|
484
|
+
return await (client as PublicClient).readContract({
|
|
485
|
+
address,
|
|
486
|
+
abi: PaymasterFactoryABI,
|
|
487
|
+
functionName: 'getOperatorByPaymaster',
|
|
488
|
+
args: [paymaster]
|
|
489
|
+
}) as Address;
|
|
490
|
+
} catch (error) {
|
|
491
|
+
throw AAStarError.fromViemError(error as Error, 'getOperatorByPaymaster');
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
async getPaymasterCount() {
|
|
496
|
+
try {
|
|
497
|
+
return await (client as PublicClient).readContract({
|
|
498
|
+
address,
|
|
499
|
+
abi: PaymasterFactoryABI,
|
|
500
|
+
functionName: 'getPaymasterCount',
|
|
501
|
+
args: []
|
|
502
|
+
}) as bigint;
|
|
503
|
+
} catch (error) {
|
|
504
|
+
throw AAStarError.fromViemError(error as Error, 'getPaymasterCount');
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
|
|
508
|
+
async getAllPaymasters() {
|
|
509
|
+
try {
|
|
510
|
+
const count = await this.getPaymasterCount();
|
|
511
|
+
return await (client as PublicClient).readContract({
|
|
512
|
+
address,
|
|
513
|
+
abi: PaymasterFactoryABI,
|
|
514
|
+
functionName: 'getPaymasterList',
|
|
515
|
+
args: [0n, count]
|
|
516
|
+
}) as Address[];
|
|
517
|
+
} catch (error) {
|
|
518
|
+
throw AAStarError.fromViemError(error as Error, 'getAllPaymasters');
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
|
|
522
|
+
async hasPaymaster({ owner }) {
|
|
523
|
+
try {
|
|
524
|
+
validateAddress(owner, 'owner');
|
|
525
|
+
return await (client as PublicClient).readContract({
|
|
526
|
+
address,
|
|
527
|
+
abi: PaymasterFactoryABI,
|
|
528
|
+
functionName: 'hasPaymaster',
|
|
529
|
+
args: [owner]
|
|
530
|
+
}) as boolean;
|
|
531
|
+
} catch (error) {
|
|
532
|
+
throw AAStarError.fromViemError(error as Error, 'hasPaymaster');
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
|
|
536
|
+
async isPaymasterDeployed({ owner }) {
|
|
537
|
+
return this.hasPaymaster({ owner });
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
async addImplementation({ version, impl, account }) {
|
|
541
|
+
try {
|
|
542
|
+
validateRequired(version, 'version');
|
|
543
|
+
validateAddress(impl, 'impl');
|
|
544
|
+
return await (client as any).writeContract({
|
|
545
|
+
address,
|
|
546
|
+
abi: PaymasterFactoryABI,
|
|
547
|
+
functionName: 'addImplementation',
|
|
548
|
+
args: [version, impl],
|
|
549
|
+
account: account as any,
|
|
550
|
+
chain: (client as any).chain
|
|
551
|
+
});
|
|
552
|
+
} catch (error) {
|
|
553
|
+
throw AAStarError.fromViemError(error as Error, 'addImplementation');
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
|
|
557
|
+
async upgradeImplementation({ version, impl, account }) {
|
|
558
|
+
try {
|
|
559
|
+
validateRequired(version, 'version');
|
|
560
|
+
validateAddress(impl, 'impl');
|
|
561
|
+
return await (client as any).writeContract({
|
|
562
|
+
address,
|
|
563
|
+
abi: PaymasterFactoryABI,
|
|
564
|
+
functionName: 'upgradeImplementation',
|
|
565
|
+
args: [version, impl],
|
|
566
|
+
account: account as any,
|
|
567
|
+
chain: (client as any).chain
|
|
568
|
+
});
|
|
569
|
+
} catch (error) {
|
|
570
|
+
throw AAStarError.fromViemError(error as Error, 'upgradeImplementation');
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
|
|
574
|
+
async setDefaultVersion({ version, account }) {
|
|
575
|
+
try {
|
|
576
|
+
validateRequired(version, 'version');
|
|
577
|
+
return await (client as any).writeContract({
|
|
578
|
+
address,
|
|
579
|
+
abi: PaymasterFactoryABI,
|
|
580
|
+
functionName: 'setDefaultVersion',
|
|
581
|
+
args: [version],
|
|
582
|
+
account: account as any,
|
|
583
|
+
chain: (client as any).chain
|
|
584
|
+
});
|
|
585
|
+
} catch (error) {
|
|
586
|
+
throw AAStarError.fromViemError(error as Error, 'setDefaultVersion');
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
|
|
590
|
+
async getImplementation({ version }) {
|
|
591
|
+
try {
|
|
592
|
+
validateRequired(version, 'version');
|
|
593
|
+
return await (client as PublicClient).readContract({
|
|
594
|
+
address,
|
|
595
|
+
abi: PaymasterFactoryABI,
|
|
596
|
+
functionName: 'getImplementation',
|
|
597
|
+
args: [version]
|
|
598
|
+
}) as Address;
|
|
599
|
+
} catch (error) {
|
|
600
|
+
throw AAStarError.fromViemError(error as Error, 'getImplementation');
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
|
|
604
|
+
async setImplementationV4({ impl, account }) {
|
|
605
|
+
return this.upgradeImplementation({ version: 'v4', impl, account });
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
async getImplementationV4() {
|
|
609
|
+
try {
|
|
610
|
+
return await (client as PublicClient).readContract({
|
|
611
|
+
address,
|
|
612
|
+
abi: PaymasterFactoryABI,
|
|
613
|
+
functionName: 'getImplementation',
|
|
614
|
+
args: ['v4']
|
|
615
|
+
}) as Address;
|
|
616
|
+
} catch (error) {
|
|
617
|
+
throw AAStarError.fromViemError(error as Error, 'getImplementationV4');
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
|
|
621
|
+
async setRegistry({ registry, account }) {
|
|
622
|
+
try {
|
|
623
|
+
validateAddress(registry, 'registry');
|
|
624
|
+
return await (client as any).writeContract({
|
|
625
|
+
address,
|
|
626
|
+
abi: PaymasterFactoryABI,
|
|
627
|
+
functionName: 'setRegistry',
|
|
628
|
+
args: [registry],
|
|
629
|
+
account: account as any,
|
|
630
|
+
chain: (client as any).chain
|
|
631
|
+
});
|
|
632
|
+
} catch (error) {
|
|
633
|
+
throw AAStarError.fromViemError(error as Error, 'setRegistry');
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
|
|
637
|
+
async REGISTRY() {
|
|
638
|
+
try {
|
|
639
|
+
return await (client as PublicClient).readContract({
|
|
640
|
+
address,
|
|
641
|
+
abi: PaymasterFactoryABI,
|
|
642
|
+
functionName: 'REGISTRY',
|
|
643
|
+
args: []
|
|
644
|
+
}) as Address;
|
|
645
|
+
} catch (error) {
|
|
646
|
+
throw AAStarError.fromViemError(error as Error, 'REGISTRY');
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
async ENTRY_POINT() {
|
|
651
|
+
try {
|
|
652
|
+
return await (client as PublicClient).readContract({
|
|
653
|
+
address,
|
|
654
|
+
abi: PaymasterFactoryABI,
|
|
655
|
+
functionName: 'ENTRY_POINT',
|
|
656
|
+
args: []
|
|
657
|
+
}) as Address;
|
|
658
|
+
} catch (error) {
|
|
659
|
+
throw AAStarError.fromViemError(error as Error, 'ENTRY_POINT');
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
|
|
663
|
+
async owner() {
|
|
664
|
+
try {
|
|
665
|
+
return await (client as PublicClient).readContract({
|
|
666
|
+
address,
|
|
667
|
+
abi: PaymasterFactoryABI,
|
|
668
|
+
functionName: 'owner',
|
|
669
|
+
args: []
|
|
670
|
+
}) as Address;
|
|
671
|
+
} catch (error) {
|
|
672
|
+
throw AAStarError.fromViemError(error as Error, 'owner');
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
|
|
676
|
+
async transferOwnership({ newOwner, account }) {
|
|
677
|
+
try {
|
|
678
|
+
validateAddress(newOwner, 'newOwner');
|
|
679
|
+
return await (client as any).writeContract({
|
|
680
|
+
address,
|
|
681
|
+
abi: PaymasterFactoryABI,
|
|
682
|
+
functionName: 'transferOwnership',
|
|
683
|
+
args: [newOwner],
|
|
684
|
+
account: account as any,
|
|
685
|
+
chain: (client as any).chain
|
|
686
|
+
});
|
|
687
|
+
} catch (error) {
|
|
688
|
+
throw AAStarError.fromViemError(error as Error, 'transferOwnership');
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
|
|
692
|
+
async defaultVersion() {
|
|
693
|
+
try {
|
|
694
|
+
return await (client as PublicClient).readContract({
|
|
695
|
+
address,
|
|
696
|
+
abi: PaymasterFactoryABI,
|
|
697
|
+
functionName: 'defaultVersion',
|
|
698
|
+
args: []
|
|
699
|
+
}) as string;
|
|
700
|
+
} catch (error) {
|
|
701
|
+
throw AAStarError.fromViemError(error as Error, 'defaultVersion');
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
|
|
705
|
+
async totalDeployed() {
|
|
706
|
+
try {
|
|
707
|
+
return await (client as PublicClient).readContract({
|
|
708
|
+
address,
|
|
709
|
+
abi: PaymasterFactoryABI,
|
|
710
|
+
functionName: 'totalDeployed',
|
|
711
|
+
args: []
|
|
712
|
+
}) as bigint;
|
|
713
|
+
} catch (error) {
|
|
714
|
+
throw AAStarError.fromViemError(error as Error, 'totalDeployed');
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
|
|
718
|
+
async version() {
|
|
719
|
+
try {
|
|
720
|
+
return await (client as PublicClient).readContract({
|
|
721
|
+
address,
|
|
722
|
+
abi: PaymasterFactoryABI,
|
|
723
|
+
functionName: 'version',
|
|
724
|
+
args: []
|
|
725
|
+
}) as string;
|
|
726
|
+
} catch (error) {
|
|
727
|
+
throw AAStarError.fromViemError(error as Error, 'version');
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
return actions;
|
|
732
|
+
};
|