@aastar/sdk 0.14.0 → 0.16.6
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/.eslintrc.cjs +30 -0
- package/.gitmodules +9 -0
- package/README.md +299 -0
- package/aastar-sdk.code-workspace +14 -0
- package/abis/BLSAggregator.json +572 -0
- package/abis/BLSValidator.json +39 -0
- package/abis/DVTValidator.json +383 -0
- package/abis/Eip7702Support.json +24 -0
- package/abis/EntryPoint.json +1379 -0
- package/abis/GToken.json +510 -0
- package/abis/GTokenStaking.json +918 -0
- package/abis/LegacyAccount.json +625 -0
- package/abis/MySBT.json +1547 -0
- package/abis/Paymaster.json +1192 -0
- package/abis/PaymasterFactory.json +637 -0
- package/abis/PaymasterV4_2.json +1193 -0
- package/abis/Registry.json +1677 -0
- package/abis/ReputationSystem.json +659 -0
- package/abis/SenderCreator.json +99 -0
- package/abis/Simple7702Account.json +395 -0
- package/abis/SimpleAccount.json +625 -0
- package/abis/SimpleAccountFactory.json +108 -0
- package/abis/SimpleAccountFactoryV08.json +87 -0
- package/abis/SimpleAccountV08.json +557 -0
- package/abis/SuperPaymaster.json +1568 -0
- package/abis/UserOperationLib.json +57 -0
- package/abis/aPNTs.json +1160 -0
- package/abis/xPNTsFactory.json +715 -0
- package/abis/xPNTsToken.json +1160 -0
- package/config/networks/README.md +54 -0
- package/config/networks/mainnet.env.example +39 -0
- package/config/networks/optimism-sepolia.env.example +35 -0
- package/config/networks/optimism.env.example +36 -0
- package/config/networks/sepolia.env.example +36 -0
- package/config.anvil.json +1 -0
- package/config.sepolia.json +1 -0
- package/config.test.json +27 -0
- package/data/experiment_data.csv +36 -0
- package/data/industry_baseline_2025-12-23.json +154 -0
- package/data/industry_baseline_latest.json +154 -0
- package/docs/ABI_Change_Tracking_Workflow.md +41 -0
- package/docs/ABI_MAINTENANCE_PLAN.md +132 -0
- package/docs/API_REFERENCE.md +956 -0
- package/docs/Configuration_Sync.md +47 -0
- package/docs/DAO_Mining_Distribution_Plan.md +522 -0
- package/docs/DEMO_REFACTOR_PLAN.md +289 -0
- package/docs/DOCUMENTATION_PLAN.md +455 -0
- package/docs/ENV_SEPOLIA_UPDATE.md +68 -0
- package/docs/Faucet_Gasless_Plan.md +56 -0
- package/docs/L2_BUSINESS_CLIENTS_PLAN.md +394 -0
- package/docs/L4_Manual_Test_CheatSheet.md +215 -0
- package/docs/Plan.md +266 -0
- package/docs/Regression_Testing_Guide.md +70 -0
- package/docs/SDK_ABI_COVERAGE.md +839 -0
- package/docs/SDK_COVERAGE_STRATEGY.md +397 -0
- package/docs/SDK_Optimization_Evaluation_Plan.md +51 -0
- package/docs/SDK_REGRESSION_AND_API_PLAN.md +98 -0
- package/docs/SDK_STAGE3_PLAN.md +151 -0
- package/docs/SEPOLIA_ENV_REFERENCE.md +51 -0
- package/docs/STAGE3.md +191 -0
- package/docs/Script_Comparison_Report.md +91 -0
- package/docs/Sepolia_Latest_Deployment.md +117 -0
- package/docs/TESTER_GUIDE_GASLESS.md +663 -0
- package/docs/TEST_COVERAGE_MATRIX.md +72 -0
- package/docs/TODO_SDK_COVERAGE.md +55 -0
- package/docs/USER_CASE_DESIGN.md +110 -0
- package/docs/Verifier_L4_Gasless_Plan.md +454 -0
- package/docs/api/@aastar/account.md +235 -0
- package/docs/api/@aastar/analytics.md +219 -0
- package/docs/api/@aastar/core.md +26830 -0
- package/docs/api/@aastar/dapp.md +130 -0
- package/docs/api/@aastar/identity.md +482 -0
- package/docs/api/@aastar/paymaster.md +1387 -0
- package/docs/api/@aastar/sdk/README.md +155 -0
- package/docs/api/@aastar/sdk/node.md +4044 -0
- package/docs/api/@aastar/tokens.md +1971 -0
- package/docs/api/README.md +10 -0
- package/docs/changelog.md +99 -0
- package/docs/examples/README.md +18 -0
- package/docs/examples/community-flow.md +28 -0
- package/docs/examples/enduser-flow.md +24 -0
- package/docs/examples/index.md +18 -0
- package/docs/examples/multi-chain.md +31 -0
- package/docs/examples/operator-flow.md +28 -0
- package/docs/guide/CLI_GUIDE.md +65 -0
- package/docs/guide/DOCUMENTATION_PLAN.md +455 -0
- package/docs/guide/Security-solution.md +106 -0
- package/docs/guide/TEST_COMMANDS.md +320 -0
- package/docs/guide/concepts/account-abstraction.md +95 -0
- package/docs/guide/concepts/rainbow-bridge.md +68 -0
- package/docs/guide/concepts/reputation.md +95 -0
- package/docs/guide/concepts/superpaymaster.md +141 -0
- package/docs/guide/getting-started.md +133 -0
- package/docs/guide/installation.md +40 -0
- package/docs/guide/paper-data-collection.md +69 -0
- package/docs/guide/quick-start.md +52 -0
- package/docs/guide/task_breakdown.md +121 -0
- package/docs/guide/use-cases/community-management.md +141 -0
- package/docs/guide/use-cases/gasless-transactions.md +71 -0
- package/docs/guide/use-cases/operator-staking.md +84 -0
- package/docs/guide/use-cases/yop.md +72 -0
- package/docs/old-solution.md +1078 -0
- package/docs/paper-data-collection.md +69 -0
- package/docs/refactor/2026-01-13-221242-trae-refactor.md +224 -0
- package/docs/refactor/2026-01-13-audit-analysis.md +96 -0
- package/docs/refactor/2026-01-13-audit-report-v0.16.2.md +76 -0
- package/docs/refactor/2026-01-13-audit-report-v0.17.0.md +74 -0
- package/docs/refactor/2026-01-13-cursor-refactor.md +511 -0
- package/docs/refactor/2026-01-13-refactor-plan.md +88 -0
- package/docs/refactor/2026-01-13-refactor-response-plan.md +77 -0
- package/docs/refactor/2026-01-13-refactor-review.md +39 -0
- package/docs/refactor/2026-01-13-sdk-enhancement-plan.md +120 -0
- package/docs/refactor/2026-01-14-audit-response.md +242 -0
- package/docs/refactor/2026-01-14-audit-summary.md +133 -0
- package/docs/refactor/cursor-2026-01-13-14-00-audit-report.md +267 -0
- package/docs/technical_plan.md +510 -0
- package/docs/zh/examples/community-flow.md +38 -0
- package/docs/zh/examples/complete-workflow.md +10 -0
- package/docs/zh/examples/enduser-flow.md +33 -0
- package/docs/zh/examples/index.md +18 -0
- package/docs/zh/examples/multi-chain.md +46 -0
- package/docs/zh/examples/operator-flow.md +37 -0
- package/docs/zh/guide/CLI_GUIDE.md +48 -0
- package/docs/zh/guide/DOCUMENTATION_PLAN.md +455 -0
- package/docs/zh/guide/Plan.md +266 -0
- package/docs/zh/guide/SDK_Optimization_Evaluation_Plan.md +51 -0
- package/docs/zh/guide/Security-solution.md +106 -0
- package/docs/zh/guide/TEST_COMMANDS.md +125 -0
- package/docs/zh/guide/TEST_COVERAGE_MATRIX.md +72 -0
- package/docs/zh/guide/concepts/account-abstraction.md +95 -0
- package/docs/zh/guide/concepts/rainbow-bridge.md +68 -0
- package/docs/zh/guide/concepts/reputation.md +95 -0
- package/docs/zh/guide/concepts/superpaymaster.md +141 -0
- package/docs/zh/guide/getting-started.md +133 -0
- package/docs/zh/guide/installation.md +107 -0
- package/docs/zh/guide/old-solution.md +1078 -0
- package/docs/zh/guide/paper-data-collection.md +69 -0
- package/docs/zh/guide/quick-start.md +134 -0
- package/docs/zh/guide/sdk-readme.md +253 -0
- package/docs/zh/guide/task_breakdown.md +76 -0
- package/docs/zh/guide/technical_plan.md +510 -0
- package/docs/zh/guide/use-cases/community-management.md +141 -0
- package/docs/zh/guide/use-cases/gasless-transactions.md +71 -0
- package/docs/zh/guide/use-cases/operator-staking.md +84 -0
- package/docs/zh/guide/use-cases/yop.md +72 -0
- package/env.template +32 -0
- package/examples/l1-api-demo.ts +184 -0
- package/examples/l2-clients-demo.ts +138 -0
- package/examples/l3-user-onboarding.ts +74 -0
- package/examples/prepare-gasless.ts +89 -0
- package/examples/sdk-demo/DEVELOPER_GUIDE.md +159 -0
- package/examples/sdk-demo/README.md +30 -0
- package/examples/sdk-demo/usage.ts +137 -0
- package/examples/simple-gasless-demo.ts +80 -0
- package/examples/simple-superpaymaster-demo.ts +96 -0
- package/ext/aastar-shared-config/.env.example +6 -0
- package/ext/aastar-shared-config/.github/workflows/check-secrets.yml +257 -0
- package/ext/aastar-shared-config/AGENTS.md +21 -0
- package/ext/aastar-shared-config/CHANGELOG.md +99 -0
- package/ext/aastar-shared-config/LICENSE +21 -0
- package/ext/aastar-shared-config/QUICK_START.md +215 -0
- package/ext/aastar-shared-config/README.md +412 -0
- package/ext/aastar-shared-config/SHARED_CONFIG_SUMMARY.md +273 -0
- package/ext/aastar-shared-config/check-locker-status.mjs +7 -0
- package/ext/aastar-shared-config/favicon.ico +0 -0
- package/ext/aastar-shared-config/generate-comparison-table.sh +67 -0
- package/ext/aastar-shared-config/package.json +46 -0
- package/ext/aastar-shared-config/pnpm-lock.yaml +1182 -0
- package/ext/aastar-shared-config/src/abis/BLSAggregator.json +1 -0
- package/ext/aastar-shared-config/src/abis/DVTValidator.json +1 -0
- package/ext/aastar-shared-config/src/abis/GToken.json +1 -0
- package/ext/aastar-shared-config/src/abis/GTokenStaking.json +1 -0
- package/ext/aastar-shared-config/src/abis/MySBT.json +1 -0
- package/ext/aastar-shared-config/src/abis/PaymasterFactory.json +1 -0
- package/ext/aastar-shared-config/src/abis/PaymasterV4.json +1098 -0
- package/ext/aastar-shared-config/src/abis/Registry.json +1 -0
- package/ext/aastar-shared-config/src/abis/SimpleAccount.json +557 -0
- package/ext/aastar-shared-config/src/abis/SimpleAccountFactory.json +87 -0
- package/ext/aastar-shared-config/src/abis/SuperPaymasterV2.json +1 -0
- package/ext/aastar-shared-config/src/abis/index.ts +45 -0
- package/ext/aastar-shared-config/src/abis/xPNTsFactory.json +1 -0
- package/ext/aastar-shared-config/src/abis/xPNTsToken.json +1 -0
- package/ext/aastar-shared-config/src/branding.ts +32 -0
- package/ext/aastar-shared-config/src/communities.ts +93 -0
- package/ext/aastar-shared-config/src/constants.ts +67 -0
- package/ext/aastar-shared-config/src/contract-addresses.ts +95 -0
- package/ext/aastar-shared-config/src/contract-versions.ts +374 -0
- package/ext/aastar-shared-config/src/contracts.ts +414 -0
- package/ext/aastar-shared-config/src/index.ts +14 -0
- package/ext/aastar-shared-config/src/networks.ts +117 -0
- package/ext/aastar-shared-config/sync-abis.sh +92 -0
- package/ext/aastar-shared-config/sync-versions.mjs +150 -0
- package/ext/aastar-shared-config/tsconfig.json +18 -0
- package/ext/aastar-shared-config/tsup.config.ts +10 -0
- package/ext/aastar-shared-config/verify-all.sh +207 -0
- package/ext/aastar-shared-config/verify-contracts.sh +85 -0
- package/ext/aastar-shared-config/verify-mysbt-v243.mjs +27 -0
- package/ext/aastar-shared-config/verify-onchain-versions.mjs +93 -0
- package/l4-setup.sh +11 -0
- package/lib/SHARED_CONFIG_REFERENCE.md +133 -0
- package/lib/shared-config/.env.example +6 -0
- package/lib/shared-config/.github/workflows/check-secrets.yml +257 -0
- package/lib/shared-config/AGENTS.md +21 -0
- package/lib/shared-config/CHANGELOG.md +99 -0
- package/lib/shared-config/LICENSE +21 -0
- package/lib/shared-config/QUICK_START.md +215 -0
- package/lib/shared-config/README.md +412 -0
- package/lib/shared-config/SHARED_CONFIG_SUMMARY.md +273 -0
- package/lib/shared-config/check-locker-status.mjs +7 -0
- package/lib/shared-config/favicon.ico +0 -0
- package/lib/shared-config/generate-comparison-table.sh +67 -0
- package/lib/shared-config/package.json +46 -0
- package/lib/shared-config/pnpm-lock.yaml +1182 -0
- package/lib/shared-config/src/abis/BLSAggregator.json +1 -0
- package/lib/shared-config/src/abis/DVTValidator.json +1 -0
- package/lib/shared-config/src/abis/GToken.json +1 -0
- package/lib/shared-config/src/abis/GTokenStaking.json +1 -0
- package/lib/shared-config/src/abis/MySBT.json +1 -0
- package/lib/shared-config/src/abis/PaymasterFactory.json +1 -0
- package/lib/shared-config/src/abis/PaymasterV4.json +1098 -0
- package/lib/shared-config/src/abis/Registry.json +1 -0
- package/lib/shared-config/src/abis/SimpleAccount.json +557 -0
- package/lib/shared-config/src/abis/SimpleAccountFactory.json +87 -0
- package/lib/shared-config/src/abis/SuperPaymasterV2.json +1 -0
- package/lib/shared-config/src/abis/index.ts +45 -0
- package/lib/shared-config/src/abis/xPNTsFactory.json +1 -0
- package/lib/shared-config/src/abis/xPNTsToken.json +1 -0
- package/lib/shared-config/src/branding.ts +32 -0
- package/lib/shared-config/src/communities.ts +93 -0
- package/lib/shared-config/src/constants.ts +67 -0
- package/lib/shared-config/src/contract-addresses.ts +95 -0
- package/lib/shared-config/src/contract-versions.ts +374 -0
- package/lib/shared-config/src/contracts.ts +414 -0
- package/lib/shared-config/src/index.ts +14 -0
- package/lib/shared-config/src/networks.ts +117 -0
- package/lib/shared-config/sync-abis.sh +92 -0
- package/lib/shared-config/sync-versions.mjs +150 -0
- package/lib/shared-config/tsconfig.json +18 -0
- package/lib/shared-config/tsup.config.ts +10 -0
- package/lib/shared-config/verify-all.sh +207 -0
- package/lib/shared-config/verify-contracts.sh +85 -0
- package/lib/shared-config/verify-mysbt-v243.mjs +27 -0
- package/lib/shared-config/verify-onchain-versions.mjs +93 -0
- package/package.json +58 -22
- package/packages/account/package.json +23 -0
- package/packages/account/src/accounts/simple.test.ts +93 -0
- package/packages/account/src/accounts/simple.ts +84 -0
- package/packages/account/src/eoa.test.ts +37 -0
- package/packages/account/src/eoa.ts +33 -0
- package/packages/account/src/index.test.ts +34 -0
- package/packages/account/src/index.ts +61 -0
- package/packages/account/tsconfig.json +11 -0
- package/packages/analytics/package.json +28 -0
- package/packages/analytics/src/index.ts +145 -0
- package/packages/analytics/tsconfig.json +11 -0
- package/packages/core/package.json +32 -0
- package/packages/core/scripts/audit-abi-coverage.ts +165 -0
- package/packages/core/scripts/debug-regex.ts +36 -0
- package/packages/core/src/abis/.abi-hashes.json +26 -0
- package/packages/core/src/abis/BLSAggregator.json +686 -0
- package/packages/core/src/abis/BLSValidator.json +42 -0
- package/packages/core/src/abis/DVTValidator.json +368 -0
- package/packages/core/src/abis/Eip7702Support.json +24 -0
- package/packages/core/src/abis/EntryPoint.json +1382 -0
- package/packages/core/src/abis/GToken.json +513 -0
- package/packages/core/src/abis/GTokenStaking.json +949 -0
- package/packages/core/src/abis/LegacyAccount.json +625 -0
- package/packages/core/src/abis/MySBT.json +1518 -0
- package/packages/core/src/abis/Paymaster.json +1143 -0
- package/packages/core/src/abis/PaymasterFactory.json +640 -0
- package/packages/core/src/abis/Registry.json +1942 -0
- package/packages/core/src/abis/ReputationSystem.json +699 -0
- package/packages/core/src/abis/SenderCreator.json +99 -0
- package/packages/core/src/abis/Simple7702Account.json +395 -0
- package/packages/core/src/abis/SimpleAccount.json +560 -0
- package/packages/core/src/abis/SimpleAccountFactory.json +111 -0
- package/packages/core/src/abis/SimpleAccountFactoryV08.json +87 -0
- package/packages/core/src/abis/SimpleAccountV08.json +557 -0
- package/packages/core/src/abis/SuperPaymaster.json +1781 -0
- package/packages/core/src/abis/UserOperationLib.json +57 -0
- package/packages/core/src/abis/abi.config.json +24 -0
- package/packages/core/src/abis/index.ts +104 -0
- package/packages/core/src/abis/xPNTsFactory.json +718 -0
- package/packages/core/src/abis/xPNTsToken.json +1280 -0
- package/packages/core/src/actions/StateValidator.test.ts +175 -0
- package/packages/core/src/actions/StateValidator.ts +253 -0
- package/packages/core/src/actions/account.test.ts +155 -0
- package/packages/core/src/actions/account.ts +179 -0
- package/packages/core/src/actions/aggregator.test.ts +88 -0
- package/packages/core/src/actions/aggregator.ts +41 -0
- package/packages/core/src/actions/dvt.test.ts +124 -0
- package/packages/core/src/actions/dvt.ts +53 -0
- package/packages/core/src/actions/entryPoint.test.ts +176 -0
- package/packages/core/src/actions/entryPoint.ts +266 -0
- package/packages/core/src/actions/factory.test.ts +250 -0
- package/packages/core/src/actions/factory.ts +613 -0
- package/packages/core/src/actions/faucet.test.ts +202 -0
- package/packages/core/src/actions/faucet.ts +421 -0
- package/packages/core/src/actions/gtokenExtended.test.ts +162 -0
- package/packages/core/src/actions/gtokenExtended.ts +153 -0
- package/packages/core/src/actions/index.ts +18 -0
- package/packages/core/src/actions/paymasterV4.test.ts +209 -0
- package/packages/core/src/actions/paymasterV4.ts +455 -0
- package/packages/core/src/actions/registry.test.ts +443 -0
- package/packages/core/src/actions/registry.ts +860 -0
- package/packages/core/src/actions/reputation.test.ts +225 -0
- package/packages/core/src/actions/reputation.ts +378 -0
- package/packages/core/src/actions/sbt.test.ts +322 -0
- package/packages/core/src/actions/sbt.ts +681 -0
- package/packages/core/src/actions/staking.test.ts +273 -0
- package/packages/core/src/actions/staking.ts +421 -0
- package/packages/core/src/actions/superPaymaster.test.ts +356 -0
- package/packages/core/src/actions/superPaymaster.ts +828 -0
- package/packages/core/src/actions/tokens.test.ts +60 -0
- package/packages/core/src/actions/tokens.ts +527 -0
- package/packages/core/src/actions/validators.test.ts +239 -0
- package/packages/core/src/actions/validators.ts +590 -0
- package/packages/core/src/branding.ts +32 -0
- package/packages/core/src/clients/BaseClient.ts +78 -0
- package/packages/core/src/clients/types.ts +69 -0
- package/packages/core/src/clients.ts +13 -0
- package/packages/core/src/communities.ts +93 -0
- package/packages/core/src/config/ContractConfigManager.ts +63 -0
- package/packages/core/src/constants.ts +145 -0
- package/packages/core/src/contract-addresses.ts +125 -0
- package/packages/core/src/contracts.test.ts +58 -0
- package/packages/core/src/contracts.ts +414 -0
- package/packages/core/src/crypto/blsSigner.ts +124 -0
- package/packages/core/src/crypto/index.ts +1 -0
- package/packages/core/src/index.ts +22 -0
- package/packages/core/src/networks.ts +127 -0
- package/packages/core/src/requirementChecker.test.ts +71 -0
- package/packages/core/src/requirementChecker.ts +187 -0
- package/packages/core/src/roles.test.ts +34 -0
- package/packages/core/src/roles.ts +255 -0
- package/packages/core/src/utils/validation.test.ts +50 -0
- package/packages/core/src/utils/validation.ts +66 -0
- package/packages/core/src/utils.ts +23 -0
- package/packages/core/tsconfig.json +12 -0
- package/packages/core/vitest.config.ts +14 -0
- package/packages/dapp/package.json +30 -0
- package/packages/dapp/src/index.ts +4 -0
- package/packages/dapp/src/ui/components/EvaluationPanel.tsx +40 -0
- package/packages/dapp/src/ui/hooks/useCreditScore.ts +44 -0
- package/packages/dapp/src/ui/hooks/useSuperPaymaster.ts +31 -0
- package/packages/dapp/src/ui/index.ts +22 -0
- package/packages/dapp/tsconfig.json +12 -0
- package/packages/identity/package.json +25 -0
- package/packages/identity/src/index.ts +114 -0
- package/packages/identity/src/mysbt.ts +48 -0
- package/packages/identity/tsconfig.json +11 -0
- package/packages/paymaster/package.json +25 -0
- package/packages/paymaster/src/SuperPaymaster/index.ts +168 -0
- package/packages/paymaster/src/V4/PaymasterClient.test.ts +114 -0
- package/packages/paymaster/src/V4/PaymasterClient.ts +385 -0
- package/packages/paymaster/src/V4/PaymasterOperator.test.ts +80 -0
- package/packages/paymaster/src/V4/PaymasterOperator.ts +282 -0
- package/packages/paymaster/src/V4/PaymasterUtils.test.ts +54 -0
- package/packages/paymaster/src/V4/PaymasterUtils.ts +185 -0
- package/packages/paymaster/src/V4/SuperPaymasterClient.test.ts +79 -0
- package/packages/paymaster/src/V4/SuperPaymasterClient.ts +123 -0
- package/packages/paymaster/src/V4/index.ts +4 -0
- package/packages/paymaster/src/index.ts +5 -0
- package/packages/paymaster/tsconfig.json +11 -0
- package/packages/sdk/README.md +150 -0
- package/packages/sdk/aastar/package.json +21 -0
- package/packages/sdk/aastar/src/index.ts +3 -0
- package/packages/sdk/aastar/tsconfig.json +7 -0
- package/packages/sdk/coverage_output.txt +393 -0
- package/packages/sdk/coverage_output_final.txt +739 -0
- package/packages/sdk/coverage_output_final_v2.txt +722 -0
- package/packages/sdk/coverage_output_final_v3.txt +722 -0
- package/packages/sdk/examples/config.json +1 -0
- package/packages/sdk/examples/regression_test.ts +106 -0
- package/packages/sdk/package.json +44 -0
- package/packages/sdk/src/clients/ExperimentClient.test.ts +65 -0
- package/packages/sdk/src/clients/ExperimentClient.ts +80 -0
- package/packages/sdk/src/clients/admin.test.ts +98 -0
- package/packages/sdk/src/clients/admin.ts +154 -0
- package/packages/sdk/src/clients/clients.test.ts +104 -0
- package/packages/sdk/src/clients/community.test.ts +118 -0
- package/packages/sdk/src/clients/community.ts +337 -0
- package/packages/sdk/src/clients/endUser.test.ts +221 -0
- package/packages/sdk/src/clients/endUser.ts +551 -0
- package/packages/sdk/src/clients/operator.test.ts +162 -0
- package/packages/sdk/src/clients/operator.ts +355 -0
- package/packages/sdk/src/errors/AAStarError.test.ts +92 -0
- package/packages/sdk/src/errors/AAStarError.ts +70 -0
- package/packages/sdk/src/errors/decoder.test.ts +107 -0
- package/packages/sdk/src/errors/decoder.ts +91 -0
- package/packages/sdk/src/index.ts +23 -0
- package/packages/sdk/src/node/index.ts +8 -0
- package/packages/sdk/src/types/result.ts +29 -0
- package/packages/sdk/src/utils/errorHandler.test.ts +102 -0
- package/packages/sdk/src/utils/errorHandler.ts +167 -0
- package/packages/sdk/src/utils/eventDecoder.test.ts +56 -0
- package/packages/sdk/src/utils/eventDecoder.ts +66 -0
- package/packages/sdk/src/utils/funding.test.ts +117 -0
- package/packages/sdk/src/utils/funding.ts +280 -0
- package/packages/sdk/src/utils/keys.test.ts +105 -0
- package/packages/sdk/src/utils/keys.ts +174 -0
- package/packages/sdk/src/utils/roleData.test.ts +85 -0
- package/packages/sdk/src/utils/roleData.ts +140 -0
- package/packages/sdk/src/utils/testScenarios.test.ts +79 -0
- package/packages/sdk/src/utils/testScenarios.ts +128 -0
- package/packages/sdk/src/utils/userOp.test.ts +190 -0
- package/packages/sdk/src/utils/userOp.ts +265 -0
- package/packages/sdk/tests/scenarios/01_onboard_community.ts +62 -0
- package/packages/sdk/tests/scenarios/02_onboard_operator.ts +109 -0
- package/packages/sdk/tests/scenarios/03_onboard_user.ts +53 -0
- package/packages/sdk/tests/scenarios/04_gasless_tx_flow.ts +68 -0
- package/packages/sdk/tests/scenarios/check_entrypoint.ts +19 -0
- package/packages/sdk/tests/scenarios/check_initialization.ts +65 -0
- package/packages/sdk/tests/scenarios/debug_addresses.ts +26 -0
- package/packages/sdk/tests/scenarios/diagnose_scenario4.ts +55 -0
- package/packages/sdk/tests/scenarios/setup.ts +33 -0
- package/packages/sdk/tests/scenarios/test_entrypoint_nonce.ts +46 -0
- package/packages/sdk/tsconfig.json +11 -0
- package/packages/tokens/package.json +25 -0
- package/packages/tokens/src/index.ts +273 -0
- package/packages/tokens/tsconfig.json +11 -0
- package/pnpm-workspace.yaml +2 -0
- package/run_l4_gasless_regression.sh +79 -0
- package/run_sdk_regression.sh +238 -0
- package/scripts/00_utils.ts +59 -0
- package/scripts/00_verify_phase1.ts +130 -0
- package/scripts/01_1_prep_gtoken.ts +81 -0
- package/scripts/01_2_register_sbt.ts +88 -0
- package/scripts/01_3_prep_tokens_paymaster.ts +102 -0
- package/scripts/01_prepare_all.ts +222 -0
- package/scripts/02_test_eoa.ts +53 -0
- package/scripts/03_test_standard_aa.ts +68 -0
- package/scripts/04_0_check_deploy.ts +24 -0
- package/scripts/04_1_check_allowance.ts +44 -0
- package/scripts/04_2_construct_verify.ts +96 -0
- package/scripts/04_3_verify_estimate.ts +66 -0
- package/scripts/04_4_verify_pack.ts +74 -0
- package/scripts/04_test_paymaster_v4.ts +60 -0
- package/scripts/05_1_deposit.ts +48 -0
- package/scripts/05_test_superpaymaster.ts +58 -0
- package/scripts/06_local_test_v3_admin.ts +163 -0
- package/scripts/06_local_test_v3_execution.ts +132 -0
- package/scripts/06_local_test_v3_full.ts +490 -0
- package/scripts/06_local_test_v3_funding.ts +124 -0
- package/scripts/06_local_test_v3_reputation.ts +234 -0
- package/scripts/07_local_test_v3_audit.ts +181 -0
- package/scripts/08_local_test_registry_lifecycle.ts +382 -0
- package/scripts/09_local_test_community_lifecycle.ts +385 -0
- package/scripts/09_local_test_community_simple.ts +108 -0
- package/scripts/09_scenario_bread_independent.ts +247 -0
- package/scripts/10_scenario_super_shared.ts +196 -0
- package/scripts/10_test_protocol_admin_full.ts +173 -0
- package/scripts/11_scenario_hacker_defense.ts +104 -0
- package/scripts/11_test_core_flows_full.ts +157 -0
- package/scripts/12_test_slash_mechanism.ts +205 -0
- package/scripts/12_test_slash_queries.ts +83 -0
- package/scripts/12_test_staking_exit.ts +152 -0
- package/scripts/12_test_staking_slash.ts +301 -0
- package/scripts/12_test_tier2_slash.ts +139 -0
- package/scripts/13_test_sbt_burn_linkage.ts +266 -0
- package/scripts/14_test_credit_redesign.ts +266 -0
- package/scripts/15_test_bls_full.ts +148 -0
- package/scripts/15_test_dvt_bls_full.ts +140 -0
- package/scripts/17_test_cross_role_collaboration.ts +95 -0
- package/scripts/18_sdk_e2e_verification.ts +67 -0
- package/scripts/18_test_dvt_sdk_flow.ts +138 -0
- package/scripts/18_test_lifecycle_completion.ts +144 -0
- package/scripts/19_sdk_experiment_runner.ts +114 -0
- package/scripts/19_sdk_experiment_runner.ts.backup +391 -0
- package/scripts/20_sdk_full_capability.ts +93 -0
- package/scripts/20_test_superpaymaster_new_apis.ts +193 -0
- package/scripts/21_test_paymasterv4_complete.ts +341 -0
- package/scripts/22_test_bls_signing.ts +260 -0
- package/scripts/23_test_middleware.ts +197 -0
- package/scripts/98_edge_reentrancy.ts +85 -0
- package/scripts/99_bug_hunting_fast.ts +99 -0
- package/scripts/analyze_abi_coverage.ts +169 -0
- package/scripts/check-admin.ts +95 -0
- package/scripts/check-jason-status.ts +184 -0
- package/scripts/check-roles.ts +36 -0
- package/scripts/clear-nonce.ts +47 -0
- package/scripts/collect_industry_baseline.ts +236 -0
- package/scripts/complete-jack-superpaymaster.ts +171 -0
- package/scripts/complete_env_config.ts +97 -0
- package/scripts/debug-addr.ts +43 -0
- package/scripts/debug-community-registration.ts +92 -0
- package/scripts/debug-deploy-v4.ts +116 -0
- package/scripts/debug-paymaster.ts +127 -0
- package/scripts/debug-register-role.ts +101 -0
- package/scripts/debug-version.ts +71 -0
- package/scripts/debug_account_c.ts +43 -0
- package/scripts/debug_bls.ts +58 -0
- package/scripts/debug_config_v036.ts +13 -0
- package/scripts/debug_contracts.ts +2 -0
- package/scripts/debug_env.ts +69 -0
- package/scripts/debug_find_paymaster.ts +98 -0
- package/scripts/debug_isolated_registration.ts +256 -0
- package/scripts/debug_paymaster_config.ts +19 -0
- package/scripts/debug_pim_addr.ts +23 -0
- package/scripts/debug_pm_status.ts +51 -0
- package/scripts/debug_registry.ts +39 -0
- package/scripts/debug_registry_setup.ts +129 -0
- package/scripts/debug_sanity.ts +32 -0
- package/scripts/debug_shared_config.ts +10 -0
- package/scripts/debug_token_compat.ts +51 -0
- package/scripts/debug_tokens.ts +41 -0
- package/scripts/debug_vcheck.ts +33 -0
- package/scripts/deploy-sync.ts +104 -0
- package/scripts/deploy_and_init_v3.sh +134 -0
- package/scripts/deploy_anvil_accounts.ts +144 -0
- package/scripts/deploy_paymaster_v4.ts +139 -0
- package/scripts/deploy_test_accounts.ts +401 -0
- package/scripts/deprecated/check_aa_entrypoint.ts +29 -0
- package/scripts/deprecated/check_paymaster_deposits.ts +45 -0
- package/scripts/deprecated/debug_aoa_function.ts +28 -0
- package/scripts/deprecated/debug_aoa_issue.ts +16 -0
- package/scripts/deprecated/debug_pimlico_aa23.ts +40 -0
- package/scripts/deprecated/debug_summary.ts +34 -0
- package/scripts/deprecated/deploy_v07_aa.ts +99 -0
- package/scripts/deprecated/fix_all_issues.ts +61 -0
- package/scripts/deprecated/fund_bpnts.ts +52 -0
- package/scripts/deprecated/get_factory_addresses.ts +28 -0
- package/scripts/deprecated/recheck_pim.ts +34 -0
- package/scripts/dev_tools/extract_abis.sh +151 -0
- package/scripts/dev_tools/extract_addresses_to_env.sh +67 -0
- package/scripts/dev_tools/final_safe_harmonize.py +77 -0
- package/scripts/dev_tools/safe_harmonize.py +107 -0
- package/scripts/dev_tools/surgical_harmonize.py +83 -0
- package/scripts/experiment/stage3/SETUP_GUIDE.md +258 -0
- package/scripts/experiment/stage3/archived_scripts/00_token_distribution.ts +78 -0
- package/scripts/experiment/stage3/archived_scripts/01_dao_launch.ts +96 -0
- package/scripts/experiment/stage3/archived_scripts/01b_bread_launch.ts +112 -0
- package/scripts/experiment/stage3/archived_scripts/02_operator_setup.ts +84 -0
- package/scripts/experiment/stage3/archived_scripts/02b_operator_b_setup.ts +104 -0
- package/scripts/experiment/stage3/archived_scripts/02c_finalize_operators.ts +86 -0
- package/scripts/experiment/stage3/archived_scripts/02d_operator_collateral.ts +89 -0
- package/scripts/experiment/stage3/archived_scripts/03_user_onboarding.ts +83 -0
- package/scripts/experiment/stage3/archived_scripts/03b_deploy_aa_account.ts +61 -0
- package/scripts/experiment/stage3/archived_scripts/03c_aa_onboarding.ts +104 -0
- package/scripts/experiment/stage3/archived_scripts/03d_mint_points.ts +60 -0
- package/scripts/experiment/stage3/archived_scripts/04_benchmarking.ts +100 -0
- package/scripts/experiment/stage3/archived_scripts/05_multi_op_setup.ts +149 -0
- package/scripts/experiment/stage3/archived_scripts/README.md +58 -0
- package/scripts/experiment/stage3/archived_scripts/check_roles.ts +29 -0
- package/scripts/experiment/stage3/archived_scripts/decode_error.ts +23 -0
- package/scripts/experiment/stage3/archived_scripts/fund_user.ts +51 -0
- package/scripts/experiment/stage3/archived_scripts/gen_b_key.ts +3 -0
- package/scripts/experiment/stage3/archived_scripts/gen_keys.ts +4 -0
- package/scripts/experiment/stage3/archived_scripts/setup.ts +105 -0
- package/scripts/experiment/stage3/archived_scripts/test_key.ts +4 -0
- package/scripts/experiment/stage3/archived_scripts/verify_state.ts +59 -0
- package/scripts/experiment/stage3/refactored/00_token_distribution.ts +46 -0
- package/scripts/experiment/stage3/refactored/02_operator_setup.ts +65 -0
- package/scripts/experiment/stage3/refactored/03_user_onboarding.ts +68 -0
- package/scripts/experiment/stage3/refactored/05_multi_op_setup.ts +63 -0
- package/scripts/experiment/stage3/refactored/README.md +71 -0
- package/scripts/extract-docs.sh +141 -0
- package/scripts/fund-jack.ts +38 -0
- package/scripts/generate_env_from_deployment.ts +109 -0
- package/scripts/inspect-anni-token.ts +116 -0
- package/scripts/inspect-factory.ts +83 -0
- package/scripts/l4-paymasterv4-transfer-test.ts +228 -0
- package/scripts/l4-setup.ts +453 -0
- package/scripts/l4-state.json +80 -0
- package/scripts/phase1_verify_contracts.ts +207 -0
- package/scripts/pre_test_sync.ts +83 -0
- package/scripts/prepare_sepolia_resources.ts +154 -0
- package/scripts/publish_all.sh +39 -0
- package/scripts/query-jack-token.ts +22 -0
- package/scripts/quick_setup.ts +124 -0
- package/scripts/quick_setup_account.ts +80 -0
- package/scripts/run_automated_experiment.sh +121 -0
- package/scripts/run_daily_experiment.ts +70 -0
- package/scripts/run_l4_gasless_regression.sh +32 -0
- package/scripts/run_sdk_experiment.sh +13 -0
- package/scripts/run_sdk_regression-v2.sh +38 -0
- package/scripts/sdk_regression_v2.ts +162 -0
- package/scripts/security_audit.sh +172 -0
- package/scripts/setup-bbq-community.ts +187 -0
- package/scripts/setup-dancing-community.ts +223 -0
- package/scripts/setup_test_accounts.ts +88 -0
- package/scripts/setup_test_environment.ts +147 -0
- package/scripts/sync_anvil_config.cjs +44 -0
- package/scripts/sync_config_to_env.ts +88 -0
- package/scripts/sync_contract_addresses.ts +186 -0
- package/scripts/sync_sepolia_config.cjs +90 -0
- package/scripts/sync_sepolia_config.mjs +74 -0
- package/scripts/test-brown-v4-deploy.ts +90 -0
- package/scripts/test-faucet-and-gasless.ts +170 -0
- package/scripts/test-jack-gasless.ts +119 -0
- package/scripts/test-jack-registration.ts +133 -0
- package/scripts/test-jack-superpaymaster-api.ts +112 -0
- package/scripts/test-kms-gasless.ts +138 -0
- package/scripts/test_groups.ts +138 -0
- package/scripts/test_multi_community_anvil.ts +276 -0
- package/scripts/test_new_sdk_apis_sepolia.ts +193 -0
- package/scripts/test_sdk_join_idempotent.ts +233 -0
- package/scripts/test_simple_sepolia.ts +44 -0
- package/scripts/update_env_from_config.ts +83 -0
- package/scripts/v2_regression/00_validate_env.ts +101 -0
- package/scripts/v2_regression/01_setup_and_fund.ts +132 -0
- package/scripts/v2_regression/02_operator_onboarding.ts +174 -0
- package/scripts/v2_regression/03_community_registry.ts +139 -0
- package/scripts/v2_regression/04_enduser_flow.ts +141 -0
- package/scripts/v2_regression/05_admin_audit.ts +157 -0
- package/scripts/v2_regression/README.md +161 -0
- package/scripts/validate_env.ts +112 -0
- package/scripts/verify-tx-status.ts +81 -0
- package/scripts/verify_onchain_milestone.ts +114 -0
- package/scripts/verify_phase1.ts +66 -0
- package/scripts/verify_phase2.ts +66 -0
- package/sdk_experiment_data.csv +4 -0
- package/simple-test-paymaster.sh +2 -0
- package/simple-test-superpaymaster.sh +1 -0
- package/tests/l1-regression.test.ts +458 -0
- package/tests/l4-test-anni-gasless.ts +105 -0
- package/tests/l4-test-jason1-gasless.ts +150 -0
- package/tests/l4-test-jason2-gasless.ts +174 -0
- package/tests/l4-test-pmv4-deposit.ts +111 -0
- package/tests/l4-test-pmv4-gasless.ts +166 -0
- package/tests/l4-test-pmv4-submit.ts +223 -0
- package/tests/regression/README.md +168 -0
- package/tests/regression/config.ts +215 -0
- package/tests/regression/display-versions.ts +85 -0
- package/tests/regression/index.ts +67 -0
- package/tests/regression/l1-tests.ts +267 -0
- package/tests/regression/l2-tests.ts +171 -0
- package/tests/regression/l3-tests.ts +125 -0
- package/tests/regression/l4-gasless.ts +897 -0
- package/tests/regression/l4-runner.ts +52 -0
- package/tests/reports/phase1_contract_verification.md +45 -0
- package/tests/utils/contractVerifier.ts +237 -0
- package/tests/utils/userOpHelper.ts +194 -0
- package/tsconfig.json +41 -0
- package/typedoc.json +59 -0
- package/vitest.config.ts +16 -0
- package/dist/clients/admin.d.ts +0 -12
- package/dist/clients/admin.d.ts.map +0 -1
- package/dist/clients/admin.js +0 -20
- package/dist/clients/admin.js.map +0 -1
- package/dist/clients/community.d.ts +0 -12
- package/dist/clients/community.d.ts.map +0 -1
- package/dist/clients/community.js +0 -18
- package/dist/clients/community.js.map +0 -1
- package/dist/clients/endUser.d.ts +0 -12
- package/dist/clients/endUser.d.ts.map +0 -1
- package/dist/clients/endUser.js +0 -20
- package/dist/clients/endUser.js.map +0 -1
- package/dist/clients/operator.d.ts +0 -18
- package/dist/clients/operator.d.ts.map +0 -1
- package/dist/clients/operator.js +0 -65
- package/dist/clients/operator.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
<p align="left">
|
|
4
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" style="display:inline-block; margin-right: 10px;" />
|
|
5
|
+
<img src="https://img.shields.io/badge/TypeScript-5.0-blue" alt="TypeScript" style="display:inline-block; margin-right: 10px;" />
|
|
6
|
+
<img src="https://img.shields.io/badge/Status-0.14.0-green" alt="Status" style="display:inline-block;" />
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
**Comprehensive Account Abstraction Infrastructure SDK - Powering the Mycelium Network**
|
|
10
|
+
**完整的账户抽象基础设施 SDK - 为 Mycelium 网络提供动力**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📚 Table of Contents / 目录
|
|
15
|
+
|
|
16
|
+
- [Introduction / 简介](#introduction--简介)
|
|
17
|
+
- [SDK v2 Architecture / 架构设计](#sdk-v2-architecture--架构设计)
|
|
18
|
+
- [Installation / 安装](#installation--安装)
|
|
19
|
+
- [Quick Start / 快速开始](#quick-start--快速开始)
|
|
20
|
+
- [Testing Commands / 测试命令](#testing-commands--测试命令)
|
|
21
|
+
- [Academic Research / 学术研究](#academic-research--学术研究)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Introduction / 简介
|
|
26
|
+
|
|
27
|
+
**AAStar SDK** is a high-integration toolkit for the Mycelium network. We've refactored 17 fragmented modules into 7 professional core packages, aimed at providing a unified, high-performance, and easy-to-maintain development experience.
|
|
28
|
+
|
|
29
|
+
**AAStar SDK** 是 Mycelium 网络的高集成度开发工具包。我们将原有的 17 个碎片化模块重构为 7 个专业核心包,旨在提供统一、高性能且易于维护的开发体验。
|
|
30
|
+
|
|
31
|
+
### Core Features / 核心特性
|
|
32
|
+
|
|
33
|
+
- ✅ **Role-Based Clients**: Specific APIs for End Users, Communities, Operators, and Admins. (**角色化客户端**)
|
|
34
|
+
- ✅ **Infrastructure Ready**: Deep integration with SuperPaymaster and EOA Bridge. (**基础设施就绪**)
|
|
35
|
+
- ✅ **Seamless User Experience**: Gasless transactions via community credit system. (**无感交互体验**)
|
|
36
|
+
- ✅ **DVT Security Module**: Decentralized verification and aggregate signatures. (**DVT 安全模块**)
|
|
37
|
+
- ✅ **Scientific Reproducibility**: Version-locked for academic research and data collection. (**科学可复现**)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## SDK v2 Architecture / 架构设计
|
|
42
|
+
|
|
43
|
+
AAStar SDK v2 采用 **「装饰器 (Actions-Decorator)」** 模式(借鉴自 `viem` 与 `permissionless.js`)。它将低层次的合约交互与高层次的业务逻辑解耦,为生态系统中的四种角色提供专属的 Client 封装。
|
|
44
|
+
|
|
45
|
+
### Core Concepts / 核心理念
|
|
46
|
+
|
|
47
|
+
- **Semantic Actions**: Encapsulate complex flows (e.g., "Operator Onboarding") into a single SDK call. (**语义化 Action**)
|
|
48
|
+
- **Provider Agnostic**: Perfectly fits any `viem` transport layer (Pimlico, Alchemy, or local Anvil). (**Provider 无关性**)
|
|
49
|
+
- **Security Hardened**: Locked dependency versions and automated supply chain audits. (**安全加固**)
|
|
50
|
+
|
|
51
|
+
### Role-Based API Matrix / 角色化 API 矩阵
|
|
52
|
+
|
|
53
|
+
| Client / 客户端 | Targeted Developer / 目标开发者 | Core Responsibility / 核心职责 |
|
|
54
|
+
| :--- | :--- | :--- |
|
|
55
|
+
| **`EndUserClient`** | dApp Developer | Gasless UX, Smart Account management, Credit queries |
|
|
56
|
+
| **`CommunityClient`** | Community/DAO Admin | Auto-onboarding, xPNTs deployment, SBT & Reputation |
|
|
57
|
+
| **`OperatorClient`** | Node/Operator | SuperPaymaster registration, Staking, Pool management |
|
|
58
|
+
| **`AdminClient`** | Protocol Admin | DVT aggregations, Slashing, Global parameters |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Installation / 安装
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pnpm install @aastar/sdk @aastar/core viem
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Quick Start / 快速开始
|
|
71
|
+
|
|
72
|
+
### Basic Example (Operator) / 基础示例 (运营商)
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { createOperatorClient } from '@aastar/sdk';
|
|
76
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
77
|
+
import { foundry } from 'viem/chains';
|
|
78
|
+
import { http } from 'viem';
|
|
79
|
+
|
|
80
|
+
// Create Operator Client
|
|
81
|
+
const operatorClient = createOperatorClient({
|
|
82
|
+
chain: foundry,
|
|
83
|
+
transport: http('http://127.0.0.1:8545'),
|
|
84
|
+
account: privateKeyToAccount('0x...'),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// One-click Onboarding to SuperPaymaster (Stake + Deposit)
|
|
88
|
+
// 一键入驻 SuperPaymaster(质押 + 存款)
|
|
89
|
+
await operatorClient.onboardToSuperPaymaster({
|
|
90
|
+
stakeAmount: parseEther('50'),
|
|
91
|
+
depositAmount: parseEther('50')
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Testing Commands / 测试命令
|
|
98
|
+
|
|
99
|
+
本项目提供两套完整的回归测试。
|
|
100
|
+
|
|
101
|
+
### SDK Regression (Using SDK Clients) / SDK 回归测试
|
|
102
|
+
```bash
|
|
103
|
+
pnpm run test:full_sdk
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
- **Scenario**:
|
|
107
|
+
- ✅ Operator Staking (质押)
|
|
108
|
+
- ✅ Paymaster Deposit (存款)
|
|
109
|
+
- ✅ Community Registration (社区注册)
|
|
110
|
+
- ✅ SBT Minting (SBT 铸造)
|
|
111
|
+
- ✅ Admin Slashing (奖励)
|
|
112
|
+
- ✅ Credit Query (信用查询)
|
|
113
|
+
|
|
114
|
+
### Full Protocol Regression (Anvil Dedicated) / 完整协议回归测试
|
|
115
|
+
```bash
|
|
116
|
+
pnpm run test:full_anvil
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Academic Research / 学术研究
|
|
122
|
+
|
|
123
|
+
The SDK supports doctoral data collection for the SuperPaymaster paper. Official experiment logger is available at `scripts/19_sdk_experiment_runner.ts`.
|
|
124
|
+
|
|
125
|
+
本 SDK 支撑了 SuperPaymaster 论文的博士实验数据采集。官方实验记录器位于 `scripts/19_sdk_experiment_runner.ts`。
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Support & Contributing / 支持与贡献
|
|
130
|
+
|
|
131
|
+
- **Repository / 代码仓库**: [AAStarCommunity/aastar-sdk](https://github.com/AAStarCommunity/aastar-sdk)
|
|
132
|
+
- **Discord**: [Join our community / 加入我们的社区](https://discord.gg/aastar)
|
|
133
|
+
- **License / 许可证**: MIT
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
The AAStar SDK is built with TypeScript and can be used in any Node.js or browser environment. We recommend using `pnpm` for package management.
|
|
4
|
+
|
|
5
|
+
## Install the Main Package
|
|
6
|
+
|
|
7
|
+
The `@aastar/sdk` package provides the easiest entry point by grouping all core functionalities.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @aastar/sdk viem@2.x
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Modular Installation (Optional)
|
|
14
|
+
|
|
15
|
+
If you only need specific functionalities, you can install individual packages to keep your bundle size small:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Core utilities and types
|
|
19
|
+
pnpm add @aastar/core
|
|
20
|
+
|
|
21
|
+
# Account Abstraction and 7702 support
|
|
22
|
+
pnpm add @aastar/account
|
|
23
|
+
|
|
24
|
+
# Paymaster and sponsorship logic
|
|
25
|
+
pnpm add @aastar/paymaster
|
|
26
|
+
|
|
27
|
+
# Finance and GToken utilities
|
|
28
|
+
pnpm add @aastar/finance
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
- **Node.js**: v18 or higher.
|
|
34
|
+
- **TypeScript**: v5.0 or higher (recommended for type safety).
|
|
35
|
+
- **Viem**: v2.43 or higher.
|
|
36
|
+
|
|
37
|
+
## Next Steps
|
|
38
|
+
|
|
39
|
+
- Choose your role and create a [Client](./quick-start).
|
|
40
|
+
- Explore the [Core Concepts](../concepts/account-abstraction).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# 論文數據採集指南 (PhD Data Collection Guide)
|
|
2
|
+
|
|
3
|
+
本文檔為 AAStar 系統論文中的數據採集提供標準化指南。所有實驗數據必須通過 `aastar-sdk` 獲取,以確保真實性與可重複性。
|
|
4
|
+
|
|
5
|
+
## 1. 實驗設置 (Environmental Setup)
|
|
6
|
+
|
|
7
|
+
### 網絡環境
|
|
8
|
+
- **Local**: 使用 `anvil` 進行基準測試(無網絡延遲)。
|
|
9
|
+
- **Testnet**: 使用 `Sepolia` 進行公鏈環境驗證。
|
|
10
|
+
- **L2**: 使用 `Optimism` (或 OP Sepolia) 進行低 Gas 性能測試。
|
|
11
|
+
|
|
12
|
+
### 賬戶準備
|
|
13
|
+
確保 `.env.v3` 中配置了以下地址:
|
|
14
|
+
- `TEST_SIMPLE_ACCOUNT_A`: 標準 AA 賬戶。
|
|
15
|
+
- `TEST_SIMPLE_ACCOUNT_B`: AOA (V4) 實驗賬戶。
|
|
16
|
+
- `TEST_SIMPLE_ACCOUNT_C`: SuperPaymaster 實驗賬戶。
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. 核心指標 (Key Metrics)
|
|
21
|
+
|
|
22
|
+
實驗腳本會自動採集以下維度:
|
|
23
|
+
|
|
24
|
+
| 指標 | 英文名稱 | 採集方式 |
|
|
25
|
+
| :--- | :--- | :--- |
|
|
26
|
+
| **Gas 消耗** | Gas Usage | `receipt.gasUsed` |
|
|
27
|
+
| **延遲** | Latency | `Date.now() - start` (毫秒) |
|
|
28
|
+
| **交易成本** | Tx Cost | `gasUsed * effectiveGasPrice` |
|
|
29
|
+
| **吞吐量** | Throughput | 批量運行時的 `count / total_time` |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 3. 自動化運行 (Automation)
|
|
34
|
+
|
|
35
|
+
直接使用統一腳本運行:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 運行所有配置的網絡(推薦)
|
|
39
|
+
./scripts/run_automated_experiment.sh all
|
|
40
|
+
|
|
41
|
+
# 僅運行本地測試
|
|
42
|
+
./scripts/run_automated_experiment.sh local
|
|
43
|
+
|
|
44
|
+
# 僅運行 Sepolia 測試
|
|
45
|
+
./scripts/run_automated_experiment.sh sepolia
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 4. 數據導出與處理
|
|
49
|
+
|
|
50
|
+
數據會自動保存至 `sdk_experiment_data.csv`。
|
|
51
|
+
|
|
52
|
+
**建議流程**:
|
|
53
|
+
1. 每個場景運行 30 次 (`EXPERIMENT_RUNS=30`) 以獲取統計顯著性。
|
|
54
|
+
2. 使用 `pandas` 或 `Excel` 計算均值 (Mean) 與標準差 (Std Dev)。
|
|
55
|
+
3. 使用 `scripts/collect_industry_baseline.ts` 獲取對比組(EOA, Pimlico)數據。
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 5. 常規檢查清單
|
|
60
|
+
|
|
61
|
+
- [ ] RPC 節點是否連通。
|
|
62
|
+
- [ ] 實驗賬戶是否有足夠的 Gas 餘額 (或代幣)。
|
|
63
|
+
- [ ] `PRIVATE_KEY_JASON` 是否已在本地導出。
|
|
64
|
+
- [ ] 是否已清理舊的 CSV 數據。
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
> [!IMPORTANT]
|
|
69
|
+
> **嚴禁**手動修改 CSV 數據。所有偏差應在論文的 "Limitations" 或 "Discussion" 章節中說明。
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Quick Start
|
|
2
|
+
|
|
3
|
+
Get up and running with the AAStar SDK in less than 5 minutes.
|
|
4
|
+
|
|
5
|
+
## 1. Environment Setup
|
|
6
|
+
|
|
7
|
+
Create a `.env` file with your private key and RPC provider:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
PRIVATE_KEY_JASON=0x...
|
|
11
|
+
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/...
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 2. Basic Initialization
|
|
15
|
+
|
|
16
|
+
Initialize the SDK by choosing a role-based client. Most developers start with the `EndUserClient`.
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { createEndUserClient } from '@aastar/sdk';
|
|
20
|
+
import { http } from 'viem';
|
|
21
|
+
import { sepolia } from 'viem/chains';
|
|
22
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
23
|
+
|
|
24
|
+
const account = privateKeyToAccount(process.env.PRIVATE_KEY_JASON);
|
|
25
|
+
|
|
26
|
+
const user = createEndUserClient({
|
|
27
|
+
chain: sepolia,
|
|
28
|
+
transport: http(process.env.SEPOLIA_RPC_URL),
|
|
29
|
+
account
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 3. Execute a Gasless Transaction
|
|
34
|
+
|
|
35
|
+
Enable your users to interact with your dapp without holding native gas tokens.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Send a sponsored transaction via SuperPaymaster
|
|
39
|
+
const hash = await user.sendGaslessTransaction({
|
|
40
|
+
to: '0x...',
|
|
41
|
+
data: '0x...',
|
|
42
|
+
communityAddress: '0x...', // Your registered community
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log(`Transaction sent: ${hash}`);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 4. Next Steps
|
|
49
|
+
|
|
50
|
+
- **Manage Communities**: Use the [CommunityClient](../api/roles/community) to set reputation rules.
|
|
51
|
+
- **Become a Provider**: Use the [OperatorClient](../api/roles/operator) to stake and sponsor gas.
|
|
52
|
+
- **Advanced Features**: Explore the [API Reference](../api/) for deep customization.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# SuperPaymaster Experiment Task Breakdown
|
|
2
|
+
|
|
3
|
+
Based on the PhD research requirements and the "Three-Step" (Prepare, Test, Analyze) strategy.
|
|
4
|
+
|
|
5
|
+
## Phase 0: Foundation & Configuration
|
|
6
|
+
|
|
7
|
+
- [x] **0.1. Environment Setup (`.env.v3`)**
|
|
8
|
+
- [x] Create `projects/env/.env.v3`.
|
|
9
|
+
- [x] Populate RPC variables (`SEPOLIA_RPC_URL`, `ALCHEMY_BUNDLER_RPC_URL`).
|
|
10
|
+
- [x] Populate Account Key in .env.v3
|
|
11
|
+
- [x] Populate Contract Addresses (Superseding `.env` if needed, but prioritizing `@aastar/shared-config`).
|
|
12
|
+
|
|
13
|
+
- [x] **0.2. SDK Architecture Refinement**
|
|
14
|
+
- [x] Validate `@aastar/shared-config` integration for addresses (`SuperPaymaster`, `MySBT`, `GToken`).
|
|
15
|
+
- [x] Ensure `@aastar/core` exports `viem` clients configured for Sepolia and all networks.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Phase 1: Preparation (The "Ammo")
|
|
19
|
+
|
|
20
|
+
- [x] **1.1. Automated Preparation (The "Ammo") (`scripts/01_prepare_all.ts`)**
|
|
21
|
+
- [x] **Unified Script**: Runs all checks below.
|
|
22
|
+
- [x] **Account Check**: Computes addresses for A, B, C.
|
|
23
|
+
- [x] **ETH Check**: Funds 0.05 ETH from Supplier if low.
|
|
24
|
+
- [x] **Identity Check**: Checks MySBT balance for SuperPaymaster User (C). Mints if missing.
|
|
25
|
+
- [x] **Asset Check**: Checks xPNTs (GToken) balance for SuperPaymaster User (C). Transfers if low.
|
|
26
|
+
|
|
27
|
+
## Phase 2: Testing (The Execution)
|
|
28
|
+
1. Transfer ERC20 Test in sepolia, op sepolia and op mainnet.
|
|
29
|
+
2. Perform 48 times ERC20 Transfers, 2 times per hour in random time in one hour.
|
|
30
|
+
3. Use Alchemy bundler RPC in .env.v3 as default bundler.
|
|
31
|
+
4. Use PIM as erc20 gas token in pimlico paymaster test.
|
|
32
|
+
5. Make all scripts for every test and use run_daily_experiment.ts to orchestrate the above scripts.
|
|
33
|
+
6. Transfer any ERC20(use aPNTs, get it from supplier) to target receiver: TEST_RECEIVER_ADDRESS in .env.v3.
|
|
34
|
+
|
|
35
|
+
- [/] **2.1. Baseline 1: EOA Transfers (`scripts/02_test_eoa.ts`)**
|
|
36
|
+
- [ ] Use `PRIVATE_KEY_RELAYER` as test EOA, address: 0xb5600060e6de5E11D3636731964218E53caadf0E.
|
|
37
|
+
- [ ] Log metrics.
|
|
38
|
+
|
|
39
|
+
- [ ] **2.2. Baseline 2: Standard AA (`scripts/03_test_standard_aa.ts`)**
|
|
40
|
+
- [ ] Use `TEST_SIMPLE_ACCOUNT_A` + `pimlico/permissionless` ,https://docs.pimlico.io/references/bundler/endpoints/eth_sendUserOperation, use PIM as erc20 gas token, get it from supplier, token address: 0xFC3e86566895Fb007c6A0d3809eb2827DF94F751, use Alchemy bundler RPC in .env.v3
|
|
41
|
+
- [ ] Perform 48 UserOps in 24 hours.
|
|
42
|
+
- [ ] Log metrics.
|
|
43
|
+
|
|
44
|
+
- [ ] **2.3. Experiment: SuperPaymaster (`scripts/04_test_superpaymaster.ts`)**
|
|
45
|
+
*Core of the PhD contribution.*
|
|
46
|
+
- [ ] Use `TEST_SIMPLE_ACCOUNT_B` +Alchemy bundler + Paymaster (Verifying Paymaster V4.1,来自于@aastar/shared-config).
|
|
47
|
+
- [ ] Use `TEST_SIMPLE_ACCOUNT_C` + `@aastar/superpaymaster` get address from @aastar/shared-config, use Alchemy bundler.
|
|
48
|
+
- [ ] Construct UserOp with `paymasterAndData` (V3 format).
|
|
49
|
+
- [ ] Send to Bundler.
|
|
50
|
+
- [ ] Log metrics (Gas Used, L1 Fee, Time).
|
|
51
|
+
|
|
52
|
+
- [ ] **2.4. Automation Runner (`scripts/run_daily_experiment.ts`)**
|
|
53
|
+
- [ ] Orchestrate the above scripts.
|
|
54
|
+
- [ ] Add random delays (simulation of real usage).
|
|
55
|
+
- [ ] Output to `data/raw_experiment_data.csv`.
|
|
56
|
+
|
|
57
|
+
## Phase 3: Analysis (The Result)
|
|
58
|
+
|
|
59
|
+
- [ ] **3.1. Data Analysis (`scripts/05_analyze_data.ts`)**
|
|
60
|
+
- [ ] Read CSV.
|
|
61
|
+
- [ ] Compute Averages & Standard Deviation.
|
|
62
|
+
- [ ] Compare Cost vs Baseline.
|
|
63
|
+
- [ ] Compare Time vs Baseline.
|
|
64
|
+
- [ ] Generate Markdown Table for Thesis.
|
|
65
|
+
|
|
66
|
+
## Phase 4: 特性验证与联动测试 [/]
|
|
67
|
+
|
|
68
|
+
### Phase 5: Staking 退出与 Slash 测试 (12_*.ts) [⚠️ Debugging]
|
|
69
|
+
- [ ] unlock → withdraw 正常流程 (Fixed: Slash deduction bug)
|
|
70
|
+
- [ ] Slash 参数验证(罚没、国库、退款)
|
|
71
|
+
- [ ] 时间锁测试(提前退出拒绝)
|
|
72
|
+
- [ ] 在 Registry 中增加 roleLockDurations 映射
|
|
73
|
+
- [ ] Debug Registry.sol registration logic (RoleNotGranted)
|
|
74
|
+
- [ ] Fix syntax errors and add raw error logging in 13_test_sbt_burn_linkage.ts
|
|
75
|
+
- [ ] Verify active SBT burn and exit linkage
|
|
76
|
+
|
|
77
|
+
### Phase 6: MySBT Burn & Linkage Integration (Active Debugging)
|
|
78
|
+
- [ ] 实现 Registry.exitRole 与 MySBT 销毁/停用联动
|
|
79
|
+
- [ ] 在 IMySBTV3 中添加 deactivateMembership 接口
|
|
80
|
+
- [ ] 在 MySBT 中实现权限受控的 deactivateMembership
|
|
81
|
+
- [ ] 在 Registry.exitRole 中增加对 ROLE_ENDUSER 的 SBT 联动调用
|
|
82
|
+
- [ ] 验证 `13_test_sbt_burn_linkage.ts`
|
|
83
|
+
- [ ] 完整流程 (正在解决 Anvil Revert)
|
|
84
|
+
- [ ] 同步最新合约 ABI 到 SDK
|
|
85
|
+
- [ ] 解决 registerRoleSelf 报错 (正在排查 Eve 地址与角色状态)
|
|
86
|
+
- [ ] 确保 getMemberships 在角色退出后返回 isActive: false
|
|
87
|
+
|
|
88
|
+
### Phase 7: 集成与覆盖率报告
|
|
89
|
+
- [ ] 更新 test:local 脚本包含所有新测试
|
|
90
|
+
- [ ] 生成覆盖率报告(目标 80%+)
|
|
91
|
+
- [ ] 执行完整回归并验证通过
|
|
92
|
+
|
|
93
|
+
## Phase 8: SDK 架构演进与对齐 [⚠️ 暂停]
|
|
94
|
+
|
|
95
|
+
> **WARNING**: 优先级调整:在达到 80% 测试覆盖率之前,暂停以下工作:
|
|
96
|
+
> - SDK 标准化封装(SuperPaymasterClient)
|
|
97
|
+
> - 链上数据采集与基准测试
|
|
98
|
+
|
|
99
|
+
### 阶段一:架构标准化 (v0.4.x)
|
|
100
|
+
- [ ] 基于 viem 与 AirAccount (Permissionless-style) 的架构重构
|
|
101
|
+
- [ ] 定义 SuperPaymasterClient 与语义化 Error Mapper
|
|
102
|
+
|
|
103
|
+
### 阶段二:生产力工具 (v0.5.x)
|
|
104
|
+
- [ ] UserOp Factory 与基线/对比测试数据导出 (CSV)
|
|
105
|
+
|
|
106
|
+
### 阶段三:UI 集成 (v0.6.x)
|
|
107
|
+
- [ ] React Hooks 与评价面板组件
|
|
108
|
+
|
|
109
|
+
## Phase 9: 论文量化评估准备 [⚠️ 暂停]
|
|
110
|
+
- [ ] 搭建基线测试 (EOA vs Pimlico) 脚本
|
|
111
|
+
- [ ] 自动化 CSV 采集与绘图数据预处理
|
|
112
|
+
|
|
113
|
+
## Appendix: Account Roles & Keys
|
|
114
|
+
|
|
115
|
+
| Role | Variable | Purpose |
|
|
116
|
+
| :--- | :--- | :--- |
|
|
117
|
+
| **Supplier** | `SUPPLIER_KEY` | Holds test ETH & GTokens. Funds others. |
|
|
118
|
+
| **Operator** | `OPERATOR_JASON_KEY` | Admin of AAStar. Mints SBTs. |
|
|
119
|
+
| **Relayer** | `RELAYER_KEY` | Performs EOA baseline tests. |
|
|
120
|
+
| **AA User 1**| `OWNER_JASON_KEY` | Controls SuperPaymaster AA. |
|
|
121
|
+
| **AA User 2**| `OWNER_ANNI_KEY` | Controls Standard Paymaster AA. |
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Community Management Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for managing DAOs and communities with AAStar SDK.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This guide shows how to:
|
|
8
|
+
- Register a community
|
|
9
|
+
- Manage members with SBTs
|
|
10
|
+
- Configure reputation systems
|
|
11
|
+
- Deploy community tokens
|
|
12
|
+
- Set up gas sponsorship
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
- Community admin account
|
|
19
|
+
- Basic understanding of DAOs
|
|
20
|
+
- Testnet ETH for transactions
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Step 1: Register Community
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { createCommunityClient } from '@aastar/core';
|
|
28
|
+
import { http } from 'viem';
|
|
29
|
+
import { sepolia } from 'viem/chains';
|
|
30
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
31
|
+
|
|
32
|
+
const community = createCommunityClient({
|
|
33
|
+
chain: sepolia,
|
|
34
|
+
transport: http(process.env.RPC_URL),
|
|
35
|
+
account: privateKeyToAccount(process.env.COMMUNITY_KEY),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Register community
|
|
39
|
+
const txHash = await community.registerCommunity({
|
|
40
|
+
name: 'DevDAO',
|
|
41
|
+
metadata: 'ipfs://QmCommunityMetadata...',
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
console.log('Community registered:', txHash);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Step 2: Deploy Community Token
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { parseEther } from 'viem';
|
|
53
|
+
|
|
54
|
+
const tokenAddress = await community.deployXPNTs({
|
|
55
|
+
name: 'DevDAO Points',
|
|
56
|
+
symbol: 'DDP',
|
|
57
|
+
initialSupply: parseEther('1000000'),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
console.log('Token deployed at:', tokenAddress);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Step 3: Configure Reputation System
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
await community.setReputationRules({
|
|
69
|
+
rules: [
|
|
70
|
+
{ metric: 'code_contributions', weight: 40 },
|
|
71
|
+
{ metric: 'community_engagement', weight: 30 },
|
|
72
|
+
{ metric: 'governance_participation', weight: 30 },
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Step 4: Manage Members
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// Mint membership SBT
|
|
83
|
+
await community.mintSBT({
|
|
84
|
+
to: memberAddress,
|
|
85
|
+
tokenId: 1n,
|
|
86
|
+
metadata: 'ipfs://QmMembershipBadge...',
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Distribute points
|
|
90
|
+
import { mintXPNTs } from '@aastar/tokens';
|
|
91
|
+
|
|
92
|
+
await mintXPNTs(community, memberAddress, parseEther('100'));
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Complete Example
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
async function setupCommunity() {
|
|
101
|
+
const community = createCommunityClient({...});
|
|
102
|
+
|
|
103
|
+
// 1. Register
|
|
104
|
+
await community.registerCommunity({
|
|
105
|
+
name: 'DevDAO',
|
|
106
|
+
metadata: 'ipfs://...',
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// 2. Deploy token
|
|
110
|
+
const tokenAddress = await community.deployXPNTs({
|
|
111
|
+
name: 'DevDAO Points',
|
|
112
|
+
symbol: 'DDP',
|
|
113
|
+
initialSupply: parseEther('1000000'),
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// 3. Set reputation rules
|
|
117
|
+
await community.setReputationRules({
|
|
118
|
+
rules: [
|
|
119
|
+
{ metric: 'contributions', weight: 50 },
|
|
120
|
+
{ metric: 'engagement', weight: 50 },
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// 4. Onboard members
|
|
125
|
+
const members = ['0x...', '0x...'];
|
|
126
|
+
for (const member of members) {
|
|
127
|
+
await community.mintSBT({ to: member, tokenId: 1n });
|
|
128
|
+
await mintXPNTs(community, member, parseEther('100'));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
console.log('Community setup complete!');
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Related
|
|
138
|
+
|
|
139
|
+
- [Community API](/api/roles/community)
|
|
140
|
+
- [Tokens Module](/api/modules/tokens)
|
|
141
|
+
- [Identity Module](/api/modules/identity)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Gasless Transactions Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for implementing gasless transactions with SuperPaymaster.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Enable users to send transactions without holding ETH for gas fees.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
- User has community SBT
|
|
14
|
+
- Community has gas sponsorship enabled
|
|
15
|
+
- User within credit limit
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Implementation
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { createEndUserClient } from '@aastar/core';
|
|
23
|
+
import { getPaymasterAndData, checkEligibility } from '@aastar/paymaster';
|
|
24
|
+
|
|
25
|
+
async function sendGaslessTransaction() {
|
|
26
|
+
const user = createEndUserClient({...});
|
|
27
|
+
|
|
28
|
+
// 1. Check eligibility
|
|
29
|
+
const eligible = await checkEligibility(
|
|
30
|
+
user.account.address,
|
|
31
|
+
communityAddress,
|
|
32
|
+
process.env.RPC_URL
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (!eligible) {
|
|
36
|
+
throw new Error('Not eligible');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 2. Check credit
|
|
40
|
+
const credit = await user.getCreditLimit();
|
|
41
|
+
console.log('Credit:', formatEther(credit));
|
|
42
|
+
|
|
43
|
+
// 3. Create UserOperation
|
|
44
|
+
const userOp = {...};
|
|
45
|
+
|
|
46
|
+
// 4. Get paymaster data
|
|
47
|
+
const paymasterAndData = getPaymasterAndData(userOp, {
|
|
48
|
+
paymasterAddress: CONTRACTS.sepolia.superPaymaster,
|
|
49
|
+
communityAddress,
|
|
50
|
+
xPNTsAddress: CONTRACTS.sepolia.xPNTsToken,
|
|
51
|
+
verificationGasLimit: 100000n,
|
|
52
|
+
postOpGasLimit: 50000n,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// 5. Submit
|
|
56
|
+
const txHash = await submitUserOperation({
|
|
57
|
+
...userOp,
|
|
58
|
+
paymasterAndData,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
console.log('Gasless TX:', txHash);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Related
|
|
68
|
+
|
|
69
|
+
- [End User API](/api/roles/enduser)
|
|
70
|
+
- [Paymaster Module](/api/modules/paymaster)
|
|
71
|
+
- [SuperPaymaster Concept](/guide/concepts/superpaymaster)
|