@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,28 +1,54 @@
|
|
|
1
1
|
import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
|
|
2
2
|
import { ReputationSystemABI } from '../abis/index.js';
|
|
3
|
+
import { validateAddress, validateRequired, validateAmount } from '../validators/index.js';
|
|
4
|
+
import { AAStarError } from '../errors/index.js';
|
|
5
|
+
|
|
6
|
+
export type ReputationRule = {
|
|
7
|
+
baseScore: bigint;
|
|
8
|
+
activityBonus: bigint;
|
|
9
|
+
maxBonus: bigint;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ReputationBreakdown = {
|
|
14
|
+
baseScore: bigint;
|
|
15
|
+
nftBonus: bigint;
|
|
16
|
+
activityBonus: bigint;
|
|
17
|
+
multiplier: bigint;
|
|
18
|
+
};
|
|
3
19
|
|
|
4
20
|
export type ReputationActions = {
|
|
5
|
-
//
|
|
6
|
-
setReputationRule: (args: { ruleId: Hex, rule:
|
|
7
|
-
getReputationRule: (args: { ruleId: Hex }) => Promise<
|
|
21
|
+
// Rule Configuration
|
|
22
|
+
setReputationRule: (args: { ruleId: Hex, rule: ReputationRule, account?: Account | Address }) => Promise<Hash>;
|
|
23
|
+
getReputationRule: (args: { ruleId: Hex }) => Promise<ReputationRule>;
|
|
8
24
|
enableRule: (args: { ruleId: Hex, account?: Account | Address }) => Promise<Hash>;
|
|
9
25
|
disableRule: (args: { ruleId: Hex, account?: Account | Address }) => Promise<Hash>;
|
|
10
26
|
isRuleActive: (args: { ruleId: Hex }) => Promise<boolean>;
|
|
11
27
|
getActiveRules: (args: { community: Address }) => Promise<Hex[]>;
|
|
12
28
|
getRuleCount: () => Promise<bigint>;
|
|
29
|
+
setRule: (args: { ruleId: Hex, base: bigint, bonus: bigint, max: bigint, desc: string, account?: Account | Address }) => Promise<Hash>;
|
|
30
|
+
communityRules: (args: { community: Address, ruleId: Hex }) => Promise<ReputationRule>;
|
|
31
|
+
communityActiveRules: (args: { community: Address, index: bigint }) => Promise<Hex>;
|
|
32
|
+
defaultRule: () => Promise<ReputationRule>;
|
|
13
33
|
|
|
14
|
-
//
|
|
15
|
-
computeScore: (args: { user: Address,
|
|
34
|
+
// Score Calculation
|
|
35
|
+
computeScore: (args: { user: Address, communities: Address[], ruleIds: Hex[][], activities: bigint[][] }) => Promise<bigint>;
|
|
36
|
+
calculateReputation: (args: { user: Address, community: Address, timestamp: bigint }) => Promise<{ communityScore: bigint, globalScore: bigint }>;
|
|
37
|
+
getReputationBreakdown: (args: { user: Address, community: Address, timestamp: bigint }) => Promise<ReputationBreakdown>;
|
|
16
38
|
getUserScore: (args: { user: Address }) => Promise<bigint>;
|
|
17
39
|
getCommunityScore: (args: { community: Address }) => Promise<bigint>;
|
|
18
|
-
communityReputations: (args: { community: Address, user: Address }) => Promise<bigint>;
|
|
40
|
+
communityReputations: (args: { community: Address, user: Address }) => Promise<bigint>;
|
|
41
|
+
setCommunityReputation: (args: { community: Address, user: Address, score: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
19
42
|
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
calculateReputation: (args: { user: Address, community: Address }) => Promise<bigint>; // Alias for computeScore or specific calculation
|
|
43
|
+
// NFT Boost
|
|
44
|
+
setNFTBoost: (args: { collection: Address, boost: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
23
45
|
nftCollectionBoost: (args: { collection: Address }) => Promise<bigint>;
|
|
46
|
+
nftHoldStart: (args: { user: Address, collection: Address }) => Promise<bigint>;
|
|
47
|
+
updateNFTHoldStart: (args: { collection: Address, account?: Account | Address }) => Promise<Hash>;
|
|
48
|
+
boostedCollections: (args: { index: bigint }) => Promise<Address>;
|
|
49
|
+
entropyFactors: (args: { community: Address }) => Promise<bigint>;
|
|
24
50
|
|
|
25
|
-
//
|
|
51
|
+
// Batch Operations
|
|
26
52
|
batchUpdateScores: (args: { users: Address[], scores: bigint[], account?: Account | Address }) => Promise<Hash>;
|
|
27
53
|
batchSyncToRegistry: (args: { users: Address[], account?: Account | Address }) => Promise<Hash>;
|
|
28
54
|
syncToRegistry: (args: {
|
|
@@ -37,342 +63,606 @@ export type ReputationActions = {
|
|
|
37
63
|
|
|
38
64
|
// Admin & Config
|
|
39
65
|
setRegistry: (args: { registry: Address, account?: Account | Address }) => Promise<Hash>;
|
|
40
|
-
setEntropyFactor: (args: { factor: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
66
|
+
setEntropyFactor: (args: { community: Address, factor: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
41
67
|
getEntropyFactor: () => Promise<bigint>;
|
|
42
68
|
|
|
43
69
|
// Constants
|
|
44
70
|
REGISTRY: () => Promise<Address>;
|
|
45
71
|
|
|
46
72
|
// Ownership
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// Admin & Config (Missing)
|
|
52
|
-
setCommunityReputation: (args: { community: Address, reputation: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
53
|
-
updateNFTHoldStart: (args: { user: Address, collection: Address, start: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
54
|
-
|
|
55
|
-
// Views (Missing)
|
|
56
|
-
communityRules: (args: { community: Address, ruleId: Hex }) => Promise<boolean>;
|
|
57
|
-
defaultRule: () => Promise<Hex>;
|
|
58
|
-
entropyFactors: (args: { factorId: bigint }) => Promise<bigint>;
|
|
59
|
-
nftHoldStart: (args: { user: Address, collection: Address }) => Promise<bigint>;
|
|
60
|
-
boostedCollections: (args: { collection: Address }) => Promise<bigint>;
|
|
61
|
-
communityActiveRules: (args: { community: Address, ruleId: Hex }) => Promise<boolean>;
|
|
62
|
-
getReputationBreakdown: (args: { user: Address, community: Address }) => Promise<any>;
|
|
63
|
-
setNFTBoost: (args: { collection: Address, boost: bigint, account?: Account | Address }) => Promise<Hash>;
|
|
73
|
+
owner: () => Promise<Address>;
|
|
74
|
+
transferOwnership: (args: { newOwner: Address, account?: Account | Address }) => Promise<Hash>;
|
|
75
|
+
renounceOwnership: (args: { account?: Account | Address }) => Promise<Hash>;
|
|
64
76
|
|
|
65
77
|
// Version
|
|
66
|
-
|
|
78
|
+
version: () => Promise<string>;
|
|
67
79
|
};
|
|
68
80
|
|
|
69
81
|
export const reputationActions = (address: Address) => (client: PublicClient | WalletClient): ReputationActions => ({
|
|
70
|
-
//
|
|
82
|
+
// Rule Configuration
|
|
71
83
|
async setReputationRule({ ruleId, rule, account }) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
try {
|
|
85
|
+
validateRequired(ruleId, 'ruleId');
|
|
86
|
+
validateRequired(rule, 'rule');
|
|
87
|
+
return await (client as any).writeContract({
|
|
88
|
+
address,
|
|
89
|
+
abi: ReputationSystemABI,
|
|
90
|
+
functionName: 'setReputationRule',
|
|
91
|
+
args: [ruleId, rule],
|
|
92
|
+
account: account as any,
|
|
93
|
+
chain: (client as any).chain
|
|
94
|
+
});
|
|
95
|
+
} catch (error) {
|
|
96
|
+
throw AAStarError.fromViemError(error as Error, 'setReputationRule');
|
|
97
|
+
}
|
|
80
98
|
},
|
|
81
99
|
|
|
82
100
|
async getReputationRule({ ruleId }) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
try {
|
|
102
|
+
validateRequired(ruleId, 'ruleId');
|
|
103
|
+
const result = await (client as PublicClient).readContract({
|
|
104
|
+
address,
|
|
105
|
+
abi: ReputationSystemABI,
|
|
106
|
+
functionName: 'getReputationRule',
|
|
107
|
+
args: [ruleId]
|
|
108
|
+
}) as any;
|
|
109
|
+
|
|
110
|
+
if (Array.isArray(result)) {
|
|
111
|
+
return {
|
|
112
|
+
baseScore: result[0],
|
|
113
|
+
activityBonus: result[1],
|
|
114
|
+
maxBonus: result[2],
|
|
115
|
+
description: result[3]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return result as ReputationRule;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
throw AAStarError.fromViemError(error as Error, 'getReputationRule');
|
|
121
|
+
}
|
|
89
122
|
},
|
|
90
123
|
|
|
91
124
|
async enableRule({ ruleId, account }) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
125
|
+
try {
|
|
126
|
+
validateRequired(ruleId, 'ruleId');
|
|
127
|
+
return await (client as any).writeContract({
|
|
128
|
+
address,
|
|
129
|
+
abi: ReputationSystemABI,
|
|
130
|
+
functionName: 'enableRule',
|
|
131
|
+
args: [ruleId],
|
|
132
|
+
account: account as any,
|
|
133
|
+
chain: (client as any).chain
|
|
134
|
+
});
|
|
135
|
+
} catch (error) {
|
|
136
|
+
throw AAStarError.fromViemError(error as Error, 'enableRule');
|
|
137
|
+
}
|
|
100
138
|
},
|
|
101
139
|
|
|
102
140
|
async disableRule({ ruleId, account }) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
141
|
+
try {
|
|
142
|
+
validateRequired(ruleId, 'ruleId');
|
|
143
|
+
return await (client as any).writeContract({
|
|
144
|
+
address,
|
|
145
|
+
abi: ReputationSystemABI,
|
|
146
|
+
functionName: 'disableRule',
|
|
147
|
+
args: [ruleId],
|
|
148
|
+
account: account as any,
|
|
149
|
+
chain: (client as any).chain
|
|
150
|
+
});
|
|
151
|
+
} catch (error) {
|
|
152
|
+
throw AAStarError.fromViemError(error as Error, 'disableRule');
|
|
153
|
+
}
|
|
111
154
|
},
|
|
112
155
|
|
|
113
156
|
async isRuleActive({ ruleId }) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
157
|
+
try {
|
|
158
|
+
validateRequired(ruleId, 'ruleId');
|
|
159
|
+
return await (client as PublicClient).readContract({
|
|
160
|
+
address,
|
|
161
|
+
abi: ReputationSystemABI,
|
|
162
|
+
functionName: 'isRuleActive',
|
|
163
|
+
args: [ruleId]
|
|
164
|
+
}) as boolean;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
throw AAStarError.fromViemError(error as Error, 'isRuleActive');
|
|
167
|
+
}
|
|
120
168
|
},
|
|
121
169
|
|
|
122
170
|
async getActiveRules({ community }) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
171
|
+
try {
|
|
172
|
+
validateAddress(community, 'community');
|
|
173
|
+
return await (client as PublicClient).readContract({
|
|
174
|
+
address,
|
|
175
|
+
abi: ReputationSystemABI,
|
|
176
|
+
functionName: 'getActiveRules',
|
|
177
|
+
args: [community]
|
|
178
|
+
}) as Hex[];
|
|
179
|
+
} catch (error) {
|
|
180
|
+
throw AAStarError.fromViemError(error as Error, 'getActiveRules');
|
|
181
|
+
}
|
|
129
182
|
},
|
|
130
183
|
|
|
131
184
|
async getRuleCount() {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
185
|
+
try {
|
|
186
|
+
return await (client as PublicClient).readContract({
|
|
187
|
+
address,
|
|
188
|
+
abi: ReputationSystemABI,
|
|
189
|
+
functionName: 'getRuleCount',
|
|
190
|
+
args: []
|
|
191
|
+
}) as bigint;
|
|
192
|
+
} catch (error) {
|
|
193
|
+
throw AAStarError.fromViemError(error as Error, 'getRuleCount');
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
// Score Calculation
|
|
198
|
+
async computeScore({ user, communities, ruleIds, activities }) {
|
|
199
|
+
try {
|
|
200
|
+
validateAddress(user, 'user');
|
|
201
|
+
validateRequired(communities, 'communities');
|
|
202
|
+
validateRequired(ruleIds, 'ruleIds');
|
|
203
|
+
validateRequired(activities, 'activities');
|
|
204
|
+
return await (client as PublicClient).readContract({
|
|
205
|
+
address,
|
|
206
|
+
abi: ReputationSystemABI,
|
|
207
|
+
functionName: 'computeScore',
|
|
208
|
+
args: [user, communities, ruleIds, activities]
|
|
209
|
+
}) as bigint;
|
|
210
|
+
} catch (error) {
|
|
211
|
+
throw AAStarError.fromViemError(error as Error, 'computeScore');
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
async calculateReputation({ user, community, timestamp }) {
|
|
216
|
+
try {
|
|
217
|
+
validateAddress(user, 'user');
|
|
218
|
+
validateAddress(community, 'community');
|
|
219
|
+
const result = await (client as PublicClient).readContract({
|
|
220
|
+
address,
|
|
221
|
+
abi: ReputationSystemABI,
|
|
222
|
+
functionName: 'calculateReputation',
|
|
223
|
+
args: [user, community, timestamp]
|
|
224
|
+
}) as any;
|
|
225
|
+
|
|
226
|
+
if (Array.isArray(result)) {
|
|
227
|
+
return { communityScore: result[0], globalScore: result[1] };
|
|
228
|
+
}
|
|
229
|
+
return result as { communityScore: bigint, globalScore: bigint };
|
|
230
|
+
} catch (error) {
|
|
231
|
+
throw AAStarError.fromViemError(error as Error, 'calculateReputation');
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
async getReputationBreakdown({ user, community, timestamp }) {
|
|
236
|
+
try {
|
|
237
|
+
validateAddress(user, 'user');
|
|
238
|
+
validateAddress(community, 'community');
|
|
239
|
+
const result = await (client as PublicClient).readContract({
|
|
240
|
+
address,
|
|
241
|
+
abi: ReputationSystemABI,
|
|
242
|
+
functionName: 'getReputationBreakdown',
|
|
243
|
+
args: [user, community, timestamp]
|
|
244
|
+
}) as any;
|
|
245
|
+
|
|
246
|
+
if (Array.isArray(result)) {
|
|
247
|
+
return {
|
|
248
|
+
baseScore: result[0],
|
|
249
|
+
nftBonus: result[1],
|
|
250
|
+
activityBonus: result[2],
|
|
251
|
+
multiplier: result[3]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
return result as ReputationBreakdown;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
throw AAStarError.fromViemError(error as Error, 'getReputationBreakdown');
|
|
257
|
+
}
|
|
148
258
|
},
|
|
149
259
|
|
|
150
260
|
async getUserScore({ user }) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
261
|
+
try {
|
|
262
|
+
validateAddress(user, 'user');
|
|
263
|
+
return await (client as PublicClient).readContract({
|
|
264
|
+
address,
|
|
265
|
+
abi: ReputationSystemABI,
|
|
266
|
+
functionName: 'getUserScore',
|
|
267
|
+
args: [user]
|
|
268
|
+
}) as bigint;
|
|
269
|
+
} catch (error) {
|
|
270
|
+
throw AAStarError.fromViemError(error as Error, 'getUserScore');
|
|
271
|
+
}
|
|
157
272
|
},
|
|
158
273
|
|
|
159
274
|
async getCommunityScore({ community }) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
275
|
+
try {
|
|
276
|
+
validateAddress(community, 'community');
|
|
277
|
+
return await (client as PublicClient).readContract({
|
|
278
|
+
address,
|
|
279
|
+
abi: ReputationSystemABI,
|
|
280
|
+
functionName: 'getCommunityScore',
|
|
281
|
+
args: [community]
|
|
282
|
+
}) as bigint;
|
|
283
|
+
} catch (error) {
|
|
284
|
+
throw AAStarError.fromViemError(error as Error, 'getCommunityScore');
|
|
285
|
+
}
|
|
166
286
|
},
|
|
167
287
|
|
|
168
|
-
// Public mapping getter
|
|
169
288
|
async communityReputations({ community, user }) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
289
|
+
try {
|
|
290
|
+
validateAddress(community, 'community');
|
|
291
|
+
validateAddress(user, 'user');
|
|
292
|
+
return await (client as PublicClient).readContract({
|
|
293
|
+
address,
|
|
294
|
+
abi: ReputationSystemABI,
|
|
295
|
+
functionName: 'communityReputations',
|
|
296
|
+
args: [community, user]
|
|
297
|
+
}) as bigint;
|
|
298
|
+
} catch (error) {
|
|
299
|
+
throw AAStarError.fromViemError(error as Error, 'communityReputations');
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
async setCommunityReputation({ community, user, score, account }) {
|
|
304
|
+
try {
|
|
305
|
+
validateAddress(community, 'community');
|
|
306
|
+
validateAddress(user, 'user');
|
|
307
|
+
validateAmount(score, 'score');
|
|
308
|
+
return await (client as any).writeContract({
|
|
309
|
+
address,
|
|
310
|
+
abi: ReputationSystemABI,
|
|
311
|
+
functionName: 'setCommunityReputation',
|
|
312
|
+
args: [community, user, score],
|
|
313
|
+
account: account as any,
|
|
314
|
+
chain: (client as any).chain
|
|
315
|
+
});
|
|
316
|
+
} catch (error) {
|
|
317
|
+
throw AAStarError.fromViemError(error as Error, 'setCommunityReputation');
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
async setRule({ ruleId, base, bonus, max, desc, account }) {
|
|
322
|
+
try {
|
|
323
|
+
validateRequired(ruleId, 'ruleId');
|
|
324
|
+
validateAmount(base, 'base');
|
|
325
|
+
validateAmount(bonus, 'bonus');
|
|
326
|
+
validateAmount(max, 'max');
|
|
327
|
+
validateRequired(desc, 'desc');
|
|
328
|
+
return await (client as any).writeContract({
|
|
329
|
+
address,
|
|
330
|
+
abi: ReputationSystemABI,
|
|
331
|
+
functionName: 'setRule',
|
|
332
|
+
args: [ruleId, base, bonus, max, desc],
|
|
333
|
+
account: account as any,
|
|
334
|
+
chain: (client as any).chain
|
|
335
|
+
});
|
|
336
|
+
} catch (error) {
|
|
337
|
+
throw AAStarError.fromViemError(error as Error, 'setRule');
|
|
338
|
+
}
|
|
176
339
|
},
|
|
177
340
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
341
|
+
async communityRules({ community, ruleId }) {
|
|
342
|
+
try {
|
|
343
|
+
validateAddress(community, 'community');
|
|
344
|
+
validateRequired(ruleId, 'ruleId');
|
|
345
|
+
const result = await (client as PublicClient).readContract({
|
|
346
|
+
address,
|
|
347
|
+
abi: ReputationSystemABI,
|
|
348
|
+
functionName: 'communityRules',
|
|
349
|
+
args: [community, ruleId]
|
|
350
|
+
}) as any;
|
|
351
|
+
|
|
352
|
+
if (Array.isArray(result)) {
|
|
353
|
+
return {
|
|
354
|
+
baseScore: result[0],
|
|
355
|
+
activityBonus: result[1],
|
|
356
|
+
maxBonus: result[2],
|
|
357
|
+
description: result[3]
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
return result as ReputationRule;
|
|
361
|
+
} catch (error) {
|
|
362
|
+
throw AAStarError.fromViemError(error as Error, 'communityRules');
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
async communityActiveRules({ community, index }) {
|
|
367
|
+
try {
|
|
368
|
+
validateAddress(community, 'community');
|
|
369
|
+
validateRequired(index, 'index');
|
|
370
|
+
return await (client as PublicClient).readContract({
|
|
371
|
+
address,
|
|
372
|
+
abi: ReputationSystemABI,
|
|
373
|
+
functionName: 'communityActiveRules',
|
|
374
|
+
args: [community, index]
|
|
375
|
+
}) as Hex;
|
|
376
|
+
} catch (error) {
|
|
377
|
+
throw AAStarError.fromViemError(error as Error, 'communityActiveRules');
|
|
378
|
+
}
|
|
181
379
|
},
|
|
182
380
|
|
|
183
|
-
async
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
381
|
+
async defaultRule() {
|
|
382
|
+
try {
|
|
383
|
+
const result = await (client as PublicClient).readContract({
|
|
384
|
+
address,
|
|
385
|
+
abi: ReputationSystemABI,
|
|
386
|
+
functionName: 'defaultRule',
|
|
387
|
+
args: []
|
|
388
|
+
}) as any;
|
|
389
|
+
|
|
390
|
+
if (Array.isArray(result)) {
|
|
391
|
+
return {
|
|
392
|
+
baseScore: result[0],
|
|
393
|
+
activityBonus: result[1],
|
|
394
|
+
maxBonus: result[2],
|
|
395
|
+
description: result[3]
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
return result as ReputationRule;
|
|
399
|
+
} catch (error) {
|
|
400
|
+
throw AAStarError.fromViemError(error as Error, 'defaultRule');
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
// NFT Boost
|
|
405
|
+
async setNFTBoost({ collection, boost, account }) {
|
|
406
|
+
try {
|
|
407
|
+
validateAddress(collection, 'collection');
|
|
408
|
+
validateAmount(boost, 'boost');
|
|
409
|
+
return await (client as any).writeContract({
|
|
410
|
+
address,
|
|
411
|
+
abi: ReputationSystemABI,
|
|
412
|
+
functionName: 'setNFTBoost',
|
|
413
|
+
args: [collection, boost],
|
|
414
|
+
account: account as any,
|
|
415
|
+
chain: (client as any).chain
|
|
416
|
+
});
|
|
417
|
+
} catch (error) {
|
|
418
|
+
throw AAStarError.fromViemError(error as Error, 'setNFTBoost');
|
|
419
|
+
}
|
|
192
420
|
},
|
|
193
421
|
|
|
194
422
|
async nftCollectionBoost({ collection }) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
423
|
+
try {
|
|
424
|
+
validateAddress(collection, 'collection');
|
|
425
|
+
return await (client as PublicClient).readContract({
|
|
426
|
+
address,
|
|
427
|
+
abi: ReputationSystemABI,
|
|
428
|
+
functionName: 'nftCollectionBoost',
|
|
429
|
+
args: [collection]
|
|
430
|
+
}) as bigint;
|
|
431
|
+
} catch (error) {
|
|
432
|
+
throw AAStarError.fromViemError(error as Error, 'nftCollectionBoost');
|
|
433
|
+
}
|
|
201
434
|
},
|
|
202
435
|
|
|
203
|
-
|
|
436
|
+
async nftHoldStart({ user, collection }) {
|
|
437
|
+
try {
|
|
438
|
+
validateAddress(user, 'user');
|
|
439
|
+
validateAddress(collection, 'collection');
|
|
440
|
+
return await (client as PublicClient).readContract({
|
|
441
|
+
address,
|
|
442
|
+
abi: ReputationSystemABI,
|
|
443
|
+
functionName: 'nftHoldStart',
|
|
444
|
+
args: [user, collection]
|
|
445
|
+
}) as bigint;
|
|
446
|
+
} catch (error) {
|
|
447
|
+
throw AAStarError.fromViemError(error as Error, 'nftHoldStart');
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
|
|
451
|
+
async updateNFTHoldStart({ collection, account }) {
|
|
452
|
+
try {
|
|
453
|
+
validateAddress(collection, 'collection');
|
|
454
|
+
return await (client as any).writeContract({
|
|
455
|
+
address,
|
|
456
|
+
abi: ReputationSystemABI,
|
|
457
|
+
functionName: 'updateNFTHoldStart',
|
|
458
|
+
args: [collection],
|
|
459
|
+
account: account as any,
|
|
460
|
+
chain: (client as any).chain
|
|
461
|
+
});
|
|
462
|
+
} catch (error) {
|
|
463
|
+
throw AAStarError.fromViemError(error as Error, 'updateNFTHoldStart');
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
|
|
467
|
+
async boostedCollections({ index }) {
|
|
468
|
+
try {
|
|
469
|
+
validateRequired(index, 'index');
|
|
470
|
+
return await (client as PublicClient).readContract({
|
|
471
|
+
address,
|
|
472
|
+
abi: ReputationSystemABI,
|
|
473
|
+
functionName: 'boostedCollections',
|
|
474
|
+
args: [index]
|
|
475
|
+
}) as Address;
|
|
476
|
+
} catch (error) {
|
|
477
|
+
throw AAStarError.fromViemError(error as Error, 'boostedCollections');
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
|
|
481
|
+
async entropyFactors({ community }) {
|
|
482
|
+
try {
|
|
483
|
+
validateAddress(community, 'community');
|
|
484
|
+
return await (client as PublicClient).readContract({
|
|
485
|
+
address,
|
|
486
|
+
abi: ReputationSystemABI,
|
|
487
|
+
functionName: 'entropyFactors',
|
|
488
|
+
args: [community]
|
|
489
|
+
}) as bigint;
|
|
490
|
+
} catch (error) {
|
|
491
|
+
throw AAStarError.fromViemError(error as Error, 'entropyFactors');
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
// Batch Operations
|
|
204
496
|
async batchUpdateScores({ users, scores, account }) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
497
|
+
try {
|
|
498
|
+
validateRequired(users, 'users');
|
|
499
|
+
validateRequired(scores, 'scores');
|
|
500
|
+
return await (client as any).writeContract({
|
|
501
|
+
address,
|
|
502
|
+
abi: ReputationSystemABI,
|
|
503
|
+
functionName: 'batchUpdateScores',
|
|
504
|
+
args: [users, scores],
|
|
505
|
+
account: account as any,
|
|
506
|
+
chain: (client as any).chain
|
|
507
|
+
});
|
|
508
|
+
} catch (error) {
|
|
509
|
+
throw AAStarError.fromViemError(error as Error, 'batchUpdateScores');
|
|
510
|
+
}
|
|
213
511
|
},
|
|
214
512
|
|
|
215
513
|
async batchSyncToRegistry({ users, account }) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
514
|
+
try {
|
|
515
|
+
validateRequired(users, 'users');
|
|
516
|
+
return await (client as any).writeContract({
|
|
517
|
+
address,
|
|
518
|
+
abi: ReputationSystemABI,
|
|
519
|
+
functionName: 'batchSyncToRegistry',
|
|
520
|
+
args: [users],
|
|
521
|
+
account: account as any,
|
|
522
|
+
chain: (client as any).chain
|
|
523
|
+
});
|
|
524
|
+
} catch (error) {
|
|
525
|
+
throw AAStarError.fromViemError(error as Error, 'batchSyncToRegistry');
|
|
526
|
+
}
|
|
224
527
|
},
|
|
225
528
|
|
|
226
529
|
async syncToRegistry({ user, communities, ruleIds, activities, epoch, proof, account }) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
530
|
+
try {
|
|
531
|
+
validateAddress(user, 'user');
|
|
532
|
+
validateRequired(communities, 'communities');
|
|
533
|
+
validateRequired(ruleIds, 'ruleIds');
|
|
534
|
+
validateRequired(activities, 'activities');
|
|
535
|
+
validateAmount(epoch, 'epoch');
|
|
536
|
+
validateRequired(proof, 'proof');
|
|
537
|
+
return await (client as any).writeContract({
|
|
538
|
+
address,
|
|
539
|
+
abi: ReputationSystemABI,
|
|
540
|
+
functionName: 'syncToRegistry',
|
|
541
|
+
args: [user, communities, ruleIds, activities, epoch, proof],
|
|
542
|
+
account: account as any,
|
|
543
|
+
chain: (client as any).chain
|
|
544
|
+
});
|
|
545
|
+
} catch (error) {
|
|
546
|
+
throw AAStarError.fromViemError(error as Error, 'syncToRegistry');
|
|
547
|
+
}
|
|
235
548
|
},
|
|
236
549
|
|
|
237
550
|
// Admin & Config
|
|
238
551
|
async setRegistry({ registry, account }) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
552
|
+
try {
|
|
553
|
+
validateAddress(registry, 'registry');
|
|
554
|
+
return await (client as any).writeContract({
|
|
555
|
+
address,
|
|
556
|
+
abi: ReputationSystemABI,
|
|
557
|
+
functionName: 'setRegistry',
|
|
558
|
+
args: [registry],
|
|
559
|
+
account: account as any,
|
|
560
|
+
chain: (client as any).chain
|
|
561
|
+
});
|
|
562
|
+
} catch (error) {
|
|
563
|
+
throw AAStarError.fromViemError(error as Error, 'setRegistry');
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
|
|
567
|
+
async setEntropyFactor({ community, factor, account }) {
|
|
568
|
+
try {
|
|
569
|
+
validateAddress(community, 'community');
|
|
570
|
+
validateAmount(factor, 'factor');
|
|
571
|
+
return await (client as any).writeContract({
|
|
572
|
+
address,
|
|
573
|
+
abi: ReputationSystemABI,
|
|
574
|
+
functionName: 'setEntropyFactor',
|
|
575
|
+
args: [community, factor],
|
|
576
|
+
account: account as any,
|
|
577
|
+
chain: (client as any).chain
|
|
578
|
+
});
|
|
579
|
+
} catch (error) {
|
|
580
|
+
throw AAStarError.fromViemError(error as Error, 'setEntropyFactor');
|
|
581
|
+
}
|
|
258
582
|
},
|
|
259
583
|
|
|
260
584
|
async getEntropyFactor() {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
585
|
+
try {
|
|
586
|
+
return await (client as PublicClient).readContract({
|
|
587
|
+
address,
|
|
588
|
+
abi: ReputationSystemABI,
|
|
589
|
+
functionName: 'getEntropyFactor',
|
|
590
|
+
args: []
|
|
591
|
+
}) as bigint;
|
|
592
|
+
} catch (error) {
|
|
593
|
+
throw AAStarError.fromViemError(error as Error, 'getEntropyFactor');
|
|
594
|
+
}
|
|
267
595
|
},
|
|
268
596
|
|
|
269
597
|
// Constants
|
|
270
598
|
async REGISTRY() {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
599
|
+
try {
|
|
600
|
+
return await (client as PublicClient).readContract({
|
|
601
|
+
address,
|
|
602
|
+
abi: ReputationSystemABI,
|
|
603
|
+
functionName: 'REGISTRY',
|
|
604
|
+
args: []
|
|
605
|
+
}) as Address;
|
|
606
|
+
} catch (error) {
|
|
607
|
+
throw AAStarError.fromViemError(error as Error, 'REGISTRY');
|
|
608
|
+
}
|
|
277
609
|
},
|
|
278
610
|
|
|
279
611
|
// Ownership
|
|
280
|
-
async
|
|
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
|
-
return (client as PublicClient).readContract({ address, abi: ReputationSystemABI, functionName: 'communityRules', args: [community, ruleId] }) as Promise<boolean>;
|
|
336
|
-
},
|
|
337
|
-
async defaultRule() {
|
|
338
|
-
return (client as PublicClient).readContract({ address, abi: ReputationSystemABI, functionName: 'defaultRule', args: [] }) as Promise<Hex>;
|
|
339
|
-
},
|
|
340
|
-
async entropyFactors({ factorId }) {
|
|
341
|
-
return (client as PublicClient).readContract({ address, abi: ReputationSystemABI, functionName: 'entropyFactors', args: [factorId] }) as Promise<bigint>;
|
|
342
|
-
},
|
|
343
|
-
async nftHoldStart({ user, collection }) {
|
|
344
|
-
return (client as PublicClient).readContract({ address, abi: ReputationSystemABI, functionName: 'nftHoldStart', args: [user, collection] }) as Promise<bigint>;
|
|
345
|
-
},
|
|
346
|
-
async boostedCollections({ collection }) {
|
|
347
|
-
return (client as PublicClient).readContract({ address, abi: ReputationSystemABI, functionName: 'boostedCollections', args: [collection] }) as Promise<bigint>;
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
async communityActiveRules({ community, ruleId }) {
|
|
351
|
-
return (client as PublicClient).readContract({ address, abi: ReputationSystemABI, functionName: 'communityActiveRules', args: [community, ruleId] }) as Promise<boolean>;
|
|
352
|
-
},
|
|
353
|
-
|
|
354
|
-
async getReputationBreakdown({ user, community }) {
|
|
355
|
-
return (client as PublicClient).readContract({ address, abi: ReputationSystemABI, functionName: 'getReputationBreakdown', args: [user, community] });
|
|
356
|
-
},
|
|
357
|
-
|
|
358
|
-
async setNFTBoost({ collection, boost, account }) {
|
|
359
|
-
return (client as any).writeContract({
|
|
360
|
-
address,
|
|
361
|
-
abi: ReputationSystemABI,
|
|
362
|
-
functionName: 'setNFTBoost',
|
|
363
|
-
args: [collection, boost],
|
|
364
|
-
account: account as any,
|
|
365
|
-
chain: (client as any).chain
|
|
366
|
-
});
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
// Version
|
|
370
|
-
async reputationVersion() {
|
|
371
|
-
return (client as PublicClient).readContract({
|
|
372
|
-
address,
|
|
373
|
-
abi: ReputationSystemABI,
|
|
374
|
-
functionName: 'version',
|
|
375
|
-
args: []
|
|
376
|
-
}) as Promise<string>;
|
|
612
|
+
async owner() {
|
|
613
|
+
try {
|
|
614
|
+
return await (client as PublicClient).readContract({
|
|
615
|
+
address,
|
|
616
|
+
abi: ReputationSystemABI,
|
|
617
|
+
functionName: 'owner',
|
|
618
|
+
args: []
|
|
619
|
+
}) as Promise<Address>;
|
|
620
|
+
} catch (error) {
|
|
621
|
+
throw AAStarError.fromViemError(error as Error, 'owner');
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
|
|
625
|
+
async transferOwnership({ newOwner, account }) {
|
|
626
|
+
try {
|
|
627
|
+
validateAddress(newOwner, 'newOwner');
|
|
628
|
+
return await (client as any).writeContract({
|
|
629
|
+
address,
|
|
630
|
+
abi: ReputationSystemABI,
|
|
631
|
+
functionName: 'transferOwnership',
|
|
632
|
+
args: [newOwner],
|
|
633
|
+
account: account as any,
|
|
634
|
+
chain: (client as any).chain
|
|
635
|
+
});
|
|
636
|
+
} catch (error) {
|
|
637
|
+
throw AAStarError.fromViemError(error as Error, 'transferOwnership');
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
|
|
641
|
+
async renounceOwnership({ account }) {
|
|
642
|
+
try {
|
|
643
|
+
return await (client as any).writeContract({
|
|
644
|
+
address,
|
|
645
|
+
abi: ReputationSystemABI,
|
|
646
|
+
functionName: 'renounceOwnership',
|
|
647
|
+
args: [],
|
|
648
|
+
account: account as any,
|
|
649
|
+
chain: (client as any).chain
|
|
650
|
+
});
|
|
651
|
+
} catch (error) {
|
|
652
|
+
throw AAStarError.fromViemError(error as Error, 'renounceOwnership');
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
|
|
656
|
+
async version() {
|
|
657
|
+
try {
|
|
658
|
+
return await (client as PublicClient).readContract({
|
|
659
|
+
address,
|
|
660
|
+
abi: ReputationSystemABI,
|
|
661
|
+
functionName: 'version',
|
|
662
|
+
args: []
|
|
663
|
+
}) as Promise<string>;
|
|
664
|
+
} catch (error) {
|
|
665
|
+
throw AAStarError.fromViemError(error as Error, 'version');
|
|
666
|
+
}
|
|
377
667
|
}
|
|
378
668
|
});
|