@aastar/core 0.16.7 → 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/dist/abis/PaymasterV4_2.json +1193 -0
- package/dist/abis/SuperPaymaster.json +1 -1
- package/dist/abis/aPNTs.json +1160 -0
- package/dist/abis/abi.config.json +3 -3
- package/dist/abis/index.d.ts +15 -104
- package/dist/abis/index.js +22 -46
- package/dist/actions/account.d.ts +0 -15
- package/dist/actions/account.js +143 -108
- package/dist/actions/aggregator.d.ts +68 -7
- package/dist/actions/aggregator.js +328 -28
- package/dist/actions/dvt.d.ts +33 -5
- package/dist/actions/dvt.js +238 -38
- package/dist/actions/entryPoint.d.ts +3 -63
- package/dist/actions/entryPoint.js +52 -184
- package/dist/actions/factory.d.ts +48 -115
- package/dist/actions/factory.js +638 -438
- package/dist/actions/faucet.d.ts +23 -27
- package/dist/actions/faucet.js +150 -289
- package/dist/actions/index.d.ts +1 -2
- package/dist/actions/index.js +2 -4
- package/dist/actions/paymaster.d.ts +147 -0
- package/dist/actions/paymaster.js +706 -0
- package/dist/actions/paymasterV4.d.ts +26 -95
- package/dist/actions/paymasterV4.js +28 -121
- package/dist/actions/registry.d.ts +116 -165
- package/dist/actions/registry.js +855 -654
- package/dist/actions/reputation.d.ts +74 -52
- package/dist/actions/reputation.js +548 -242
- package/dist/actions/sbt.d.ts +90 -100
- package/dist/actions/sbt.js +801 -518
- package/dist/actions/staking.d.ts +45 -32
- package/dist/actions/staking.js +431 -260
- package/dist/actions/superPaymaster.d.ts +140 -158
- package/dist/actions/superPaymaster.js +965 -631
- package/dist/actions/tokens.d.ts +130 -108
- package/dist/actions/tokens.js +470 -414
- package/dist/actions/validators.d.ts +0 -73
- package/dist/actions/validators.js +0 -94
- package/dist/clients/BaseClient.d.ts +3 -3
- package/dist/clients/BundlerClient.d.ts +55 -0
- package/dist/clients/BundlerClient.js +92 -0
- package/dist/communities.js +2 -2
- package/dist/constants.js +1 -28
- package/dist/contract-addresses.d.ts +5 -14
- package/dist/contract-addresses.js +3 -9
- package/dist/contract-versions.d.ts +138 -0
- package/dist/contract-versions.js +328 -0
- package/dist/contracts.d.ts +6 -24
- package/dist/contracts.js +2 -2
- package/dist/errors/index.d.ts +57 -0
- package/dist/errors/index.js +123 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/requirementChecker.d.ts +35 -1
- package/dist/requirementChecker.js +39 -1
- package/dist/roles.d.ts +50 -61
- package/dist/roles.js +50 -61
- package/dist/validators/index.d.ts +35 -0
- package/dist/validators/index.js +60 -0
- package/package.json +5 -13
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AAstar V2 Contract Versions
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: Contract addresses are defined in contract-addresses.ts
|
|
5
|
+
* This file imports and uses those addresses to maintain a single source of truth.
|
|
6
|
+
*
|
|
7
|
+
* All V2 contracts implement the VERSION interface:
|
|
8
|
+
* - VERSION: string (e.g., "2.0.0")
|
|
9
|
+
* - VERSION_CODE: uint256 (e.g., 20000)
|
|
10
|
+
*
|
|
11
|
+
* Last Updated: 2025-11-01
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Contract version information
|
|
15
|
+
*/
|
|
16
|
+
export interface ContractVersion {
|
|
17
|
+
/** Contract name */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Semantic version string (e.g., "2.0.0") */
|
|
20
|
+
version: string;
|
|
21
|
+
/** Numeric version code (e.g., 20000) */
|
|
22
|
+
versionCode: number;
|
|
23
|
+
/** Deployment date (YYYY-MM-DD) */
|
|
24
|
+
deployedAt: string;
|
|
25
|
+
/** Contract address on network */
|
|
26
|
+
address: string;
|
|
27
|
+
/** Key features in this version */
|
|
28
|
+
features?: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* V2 Contract Versions on Sepolia
|
|
32
|
+
*/
|
|
33
|
+
export declare const SEPOLIA_V2_VERSIONS: {
|
|
34
|
+
readonly core: {
|
|
35
|
+
readonly gToken: ContractVersion;
|
|
36
|
+
readonly superPaymaster: ContractVersion;
|
|
37
|
+
readonly registry: ContractVersion;
|
|
38
|
+
readonly gTokenStaking: ContractVersion;
|
|
39
|
+
readonly paymasterFactory: ContractVersion;
|
|
40
|
+
};
|
|
41
|
+
readonly tokens: {
|
|
42
|
+
readonly xPNTsFactory: ContractVersion;
|
|
43
|
+
readonly mySBT: ContractVersion;
|
|
44
|
+
};
|
|
45
|
+
readonly testTokens: {
|
|
46
|
+
readonly aPNTs: ContractVersion;
|
|
47
|
+
readonly bPNTs: ContractVersion;
|
|
48
|
+
};
|
|
49
|
+
readonly monitoring: {
|
|
50
|
+
readonly dvtValidator: ContractVersion;
|
|
51
|
+
readonly blsAggregator: ContractVersion;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Get all V2 contracts with VERSION interface
|
|
56
|
+
*
|
|
57
|
+
* @returns Array of all V2 contract versions
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const allV2Contracts = getAllV2Contracts();
|
|
62
|
+
* for (const contract of allV2Contracts) {
|
|
63
|
+
* console.log(`${contract.name} v${contract.version} at ${contract.address}`);
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function getAllV2Contracts(): ContractVersion[];
|
|
68
|
+
/**
|
|
69
|
+
* Get V2 contract by name
|
|
70
|
+
*
|
|
71
|
+
* @param name - Contract name
|
|
72
|
+
* @returns Contract version info or undefined
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const contract = getV2ContractByName('SuperPaymasterV2');
|
|
77
|
+
* if (contract) {
|
|
78
|
+
* console.log(`Version: ${contract.version}`);
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function getV2ContractByName(name: string): ContractVersion | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Get V2 contract by address
|
|
85
|
+
*
|
|
86
|
+
* @param address - Contract address (case-insensitive)
|
|
87
|
+
* @returns Contract version info or undefined
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const contract = getV2ContractByAddress('0xB97A20aca3D6770Deca299a1aD9DAFb12d1e5eCf');
|
|
92
|
+
* if (contract) {
|
|
93
|
+
* console.log(`Found: ${contract.name} v${contract.version}`);
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function getV2ContractByAddress(address: string): ContractVersion | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Check if an address is a V2 contract
|
|
100
|
+
*
|
|
101
|
+
* @param address - Contract address to check
|
|
102
|
+
* @returns True if address is a V2 contract
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* if (isV2Contract('0xB97A20aca3D6770Deca299a1aD9DAFb12d1e5eCf')) {
|
|
107
|
+
* console.log('This is a V2 contract with VERSION interface');
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function isV2Contract(address: string): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Get all V2 contracts deployed on a specific date
|
|
114
|
+
*
|
|
115
|
+
* @param date - Deployment date (YYYY-MM-DD)
|
|
116
|
+
* @returns Array of contracts deployed on that date
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const contracts = getV2ContractsByDate('2025-11-01');
|
|
121
|
+
* console.log(`${contracts.length} contracts deployed on 2025-11-01`);
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export declare function getV2ContractsByDate(date: string): ContractVersion[];
|
|
125
|
+
/**
|
|
126
|
+
* V2 Contract Summary
|
|
127
|
+
*/
|
|
128
|
+
export declare const V2_SUMMARY: {
|
|
129
|
+
readonly totalContracts: 11;
|
|
130
|
+
readonly categories: {
|
|
131
|
+
readonly core: 5;
|
|
132
|
+
readonly tokens: 2;
|
|
133
|
+
readonly testTokens: 2;
|
|
134
|
+
readonly monitoring: 2;
|
|
135
|
+
};
|
|
136
|
+
readonly latestDeployment: "2025-11-09";
|
|
137
|
+
readonly allContractsHaveVersion: true;
|
|
138
|
+
};
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AAstar V2 Contract Versions
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: Contract addresses are defined in contract-addresses.ts
|
|
5
|
+
* This file imports and uses those addresses to maintain a single source of truth.
|
|
6
|
+
*
|
|
7
|
+
* All V2 contracts implement the VERSION interface:
|
|
8
|
+
* - VERSION: string (e.g., "2.0.0")
|
|
9
|
+
* - VERSION_CODE: uint256 (e.g., 20000)
|
|
10
|
+
*
|
|
11
|
+
* Last Updated: 2025-11-01
|
|
12
|
+
*/
|
|
13
|
+
import { CORE_ADDRESSES, TOKEN_ADDRESSES, TEST_TOKEN_ADDRESSES, MONITORING_ADDRESSES, } from './contract-addresses.js';
|
|
14
|
+
/**
|
|
15
|
+
* V2 Contract Versions on Sepolia
|
|
16
|
+
*/
|
|
17
|
+
export const SEPOLIA_V2_VERSIONS = {
|
|
18
|
+
// ========================================
|
|
19
|
+
// Core System
|
|
20
|
+
// ========================================
|
|
21
|
+
core: {
|
|
22
|
+
gToken: {
|
|
23
|
+
name: 'GToken',
|
|
24
|
+
version: '2.0.0',
|
|
25
|
+
versionCode: 20000,
|
|
26
|
+
deployedAt: '2025-11-01',
|
|
27
|
+
address: CORE_ADDRESSES.gToken,
|
|
28
|
+
features: [
|
|
29
|
+
'VERSION interface',
|
|
30
|
+
'ERC20 governance token',
|
|
31
|
+
'Mintable with cap',
|
|
32
|
+
'Ownable',
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
superPaymaster: {
|
|
36
|
+
name: 'SuperPaymasterV2',
|
|
37
|
+
version: '2.3.3',
|
|
38
|
+
versionCode: 20303,
|
|
39
|
+
deployedAt: '2024-11-24',
|
|
40
|
+
address: CORE_ADDRESSES.superPaymaster,
|
|
41
|
+
features: [
|
|
42
|
+
'VERSION interface',
|
|
43
|
+
'Unified architecture',
|
|
44
|
+
'xPNTs gas token support',
|
|
45
|
+
'Reputation-based pricing',
|
|
46
|
+
'Multi-operator support',
|
|
47
|
+
'registerOperatorWithAutoStake (1-step registration)',
|
|
48
|
+
'CEI pattern fix - state changes before external calls',
|
|
49
|
+
'nonReentrant protection added',
|
|
50
|
+
'Price cache auto-update fix (was broken in v2.3.1)',
|
|
51
|
+
'Storage packing optimization (~800 gas saved)',
|
|
52
|
+
'Batch state updates (~200-400 gas saved)',
|
|
53
|
+
'Total gas optimization: ~5.5-11.2k gas vs v2.3.1',
|
|
54
|
+
'Internal SBT registry - no external balanceOf() calls (~800 gas saved per tx)',
|
|
55
|
+
'MySBT callback pattern: registerSBTHolder() on mint, removeSBTHolder() on burn',
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
registry: {
|
|
59
|
+
name: 'Registry',
|
|
60
|
+
version: '2.2.1',
|
|
61
|
+
versionCode: 20201,
|
|
62
|
+
deployedAt: '2025-11-09',
|
|
63
|
+
address: CORE_ADDRESSES.registry,
|
|
64
|
+
features: [
|
|
65
|
+
'VERSION interface',
|
|
66
|
+
'allowPermissionlessMint defaults to true',
|
|
67
|
+
'transferCommunityOwnership',
|
|
68
|
+
'Community registration',
|
|
69
|
+
'GToken staking requirement',
|
|
70
|
+
'Slash mechanism',
|
|
71
|
+
'Uses new GTokenStaking with GToken v2.0.0',
|
|
72
|
+
'isRegistered mapping (duplicate prevention)',
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
gTokenStaking: {
|
|
76
|
+
name: 'GTokenStaking',
|
|
77
|
+
version: '2.0.1',
|
|
78
|
+
versionCode: 20001,
|
|
79
|
+
deployedAt: '2025-11-05',
|
|
80
|
+
address: CORE_ADDRESSES.gTokenStaking,
|
|
81
|
+
features: [
|
|
82
|
+
'VERSION interface',
|
|
83
|
+
'User-level slash tracking',
|
|
84
|
+
'1:1 shares model',
|
|
85
|
+
'Lock mechanism',
|
|
86
|
+
'Percentage-based exit fee',
|
|
87
|
+
'Multiple locker support',
|
|
88
|
+
'Uses new GToken v2.0.0',
|
|
89
|
+
'stakeFor() function - stake on behalf of users',
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
paymasterFactory: {
|
|
93
|
+
name: 'PaymasterFactory',
|
|
94
|
+
version: '1.0.0',
|
|
95
|
+
versionCode: 10000,
|
|
96
|
+
deployedAt: '2025-11-01',
|
|
97
|
+
address: CORE_ADDRESSES.paymasterFactory,
|
|
98
|
+
features: [
|
|
99
|
+
'EIP-1167 Minimal Proxy',
|
|
100
|
+
'Version management',
|
|
101
|
+
'Permissionless Paymaster deployment',
|
|
102
|
+
'Operator tracking',
|
|
103
|
+
'Gas-efficient (~100k gas per deployment)',
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
// ========================================
|
|
108
|
+
// Token System
|
|
109
|
+
// ========================================
|
|
110
|
+
tokens: {
|
|
111
|
+
xPNTsFactory: {
|
|
112
|
+
name: 'xPNTsFactory',
|
|
113
|
+
version: '2.0.0',
|
|
114
|
+
versionCode: 20000,
|
|
115
|
+
deployedAt: '2025-11-01',
|
|
116
|
+
address: TOKEN_ADDRESSES.xPNTsFactory,
|
|
117
|
+
features: [
|
|
118
|
+
'VERSION interface',
|
|
119
|
+
'Unified architecture',
|
|
120
|
+
'Gas token creation',
|
|
121
|
+
'Community-specific tokens',
|
|
122
|
+
'Auto-approved spenders',
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
mySBT: {
|
|
126
|
+
name: 'MySBT',
|
|
127
|
+
version: '2.4.5',
|
|
128
|
+
versionCode: 20405,
|
|
129
|
+
deployedAt: '2024-11-24',
|
|
130
|
+
address: CORE_ADDRESSES.mySBT,
|
|
131
|
+
features: [
|
|
132
|
+
'IVersioned interface: version() returns 2004005, versionString() returns "v2.4.5"',
|
|
133
|
+
'VERSION constants: VERSION="2.4.5", VERSION_CODE=20405',
|
|
134
|
+
'NFT architecture refactor',
|
|
135
|
+
'Soulbound token (SBT)',
|
|
136
|
+
'Time-based reputation',
|
|
137
|
+
'Membership management',
|
|
138
|
+
'GToken mint fee (burn)',
|
|
139
|
+
'safeMint() - DAO-only faucet minting',
|
|
140
|
+
'mintWithAutoStake() - FIXED: correct token transfer order for stake + burn',
|
|
141
|
+
'airdropMint() - NEW: Operator-paid batch minting (no user approval needed)',
|
|
142
|
+
'Operator pays all costs: 0.4 GT per user (0.1 burn + 0.3 stake)',
|
|
143
|
+
'True airdrop: Uses stakeFor() to stake on behalf of users',
|
|
144
|
+
'Idempotent: Safe to call multiple times (adds membership if SBT exists)',
|
|
145
|
+
'Size optimized: 21KB bytecode (-21% vs v2.4.4, under 24KB limit)',
|
|
146
|
+
'SuperPaymaster V2.3.3 integration: registerSBTHolder() after mint, removeSBTHolder() before burn',
|
|
147
|
+
'Graceful degradation: try/catch for optional external calls',
|
|
148
|
+
'Fully tested: 14/14 tests passed including IVersioned interface',
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
// ========================================
|
|
153
|
+
// Test Tokens (For Development & Testing)
|
|
154
|
+
// ========================================
|
|
155
|
+
testTokens: {
|
|
156
|
+
aPNTs: {
|
|
157
|
+
name: 'aPNTs',
|
|
158
|
+
version: '2.0.0',
|
|
159
|
+
versionCode: 20000,
|
|
160
|
+
deployedAt: '2025-11-01',
|
|
161
|
+
address: TEST_TOKEN_ADDRESSES.aPNTs,
|
|
162
|
+
features: [
|
|
163
|
+
'VERSION interface',
|
|
164
|
+
'AAStar community gas token',
|
|
165
|
+
'Test token for development',
|
|
166
|
+
'Auto-approved spenders',
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
bPNTs: {
|
|
170
|
+
name: 'bPNTs',
|
|
171
|
+
version: '2.0.0',
|
|
172
|
+
versionCode: 20000,
|
|
173
|
+
deployedAt: '2025-11-03',
|
|
174
|
+
address: TEST_TOKEN_ADDRESSES.bPNTs,
|
|
175
|
+
features: [
|
|
176
|
+
'VERSION interface',
|
|
177
|
+
'BreadCommunity gas token',
|
|
178
|
+
'Test token for development',
|
|
179
|
+
'Auto-approved spenders',
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
// ========================================
|
|
184
|
+
// Monitoring System
|
|
185
|
+
// ========================================
|
|
186
|
+
monitoring: {
|
|
187
|
+
dvtValidator: {
|
|
188
|
+
name: 'DVTValidator',
|
|
189
|
+
version: '2.0.0',
|
|
190
|
+
versionCode: 20000,
|
|
191
|
+
deployedAt: '2025-11-01',
|
|
192
|
+
address: MONITORING_ADDRESSES.dvtValidator,
|
|
193
|
+
features: [
|
|
194
|
+
'VERSION interface',
|
|
195
|
+
'Distributed validator technology',
|
|
196
|
+
'Validator set management',
|
|
197
|
+
'Threshold validation',
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
blsAggregator: {
|
|
201
|
+
name: 'BLSAggregator',
|
|
202
|
+
version: '2.0.0',
|
|
203
|
+
versionCode: 20000,
|
|
204
|
+
deployedAt: '2025-11-01',
|
|
205
|
+
address: MONITORING_ADDRESSES.blsAggregator,
|
|
206
|
+
features: [
|
|
207
|
+
'VERSION interface',
|
|
208
|
+
'BLS signature aggregation',
|
|
209
|
+
'Multi-signature support',
|
|
210
|
+
'Gas optimization',
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Get all V2 contracts with VERSION interface
|
|
217
|
+
*
|
|
218
|
+
* @returns Array of all V2 contract versions
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```ts
|
|
222
|
+
* const allV2Contracts = getAllV2Contracts();
|
|
223
|
+
* for (const contract of allV2Contracts) {
|
|
224
|
+
* console.log(`${contract.name} v${contract.version} at ${contract.address}`);
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
export function getAllV2Contracts() {
|
|
229
|
+
const contracts = [];
|
|
230
|
+
// Core system
|
|
231
|
+
contracts.push(SEPOLIA_V2_VERSIONS.core.gToken);
|
|
232
|
+
contracts.push(SEPOLIA_V2_VERSIONS.core.superPaymaster);
|
|
233
|
+
contracts.push(SEPOLIA_V2_VERSIONS.core.registry);
|
|
234
|
+
contracts.push(SEPOLIA_V2_VERSIONS.core.gTokenStaking);
|
|
235
|
+
contracts.push(SEPOLIA_V2_VERSIONS.core.paymasterFactory);
|
|
236
|
+
// Token system
|
|
237
|
+
contracts.push(SEPOLIA_V2_VERSIONS.tokens.xPNTsFactory);
|
|
238
|
+
contracts.push(SEPOLIA_V2_VERSIONS.tokens.mySBT);
|
|
239
|
+
// Test tokens
|
|
240
|
+
contracts.push(SEPOLIA_V2_VERSIONS.testTokens.aPNTs);
|
|
241
|
+
contracts.push(SEPOLIA_V2_VERSIONS.testTokens.bPNTs);
|
|
242
|
+
// Monitoring system
|
|
243
|
+
contracts.push(SEPOLIA_V2_VERSIONS.monitoring.dvtValidator);
|
|
244
|
+
contracts.push(SEPOLIA_V2_VERSIONS.monitoring.blsAggregator);
|
|
245
|
+
return contracts;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get V2 contract by name
|
|
249
|
+
*
|
|
250
|
+
* @param name - Contract name
|
|
251
|
+
* @returns Contract version info or undefined
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* const contract = getV2ContractByName('SuperPaymasterV2');
|
|
256
|
+
* if (contract) {
|
|
257
|
+
* console.log(`Version: ${contract.version}`);
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export function getV2ContractByName(name) {
|
|
262
|
+
const all = getAllV2Contracts();
|
|
263
|
+
return all.find(c => c.name === name);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get V2 contract by address
|
|
267
|
+
*
|
|
268
|
+
* @param address - Contract address (case-insensitive)
|
|
269
|
+
* @returns Contract version info or undefined
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* const contract = getV2ContractByAddress('0xB97A20aca3D6770Deca299a1aD9DAFb12d1e5eCf');
|
|
274
|
+
* if (contract) {
|
|
275
|
+
* console.log(`Found: ${contract.name} v${contract.version}`);
|
|
276
|
+
* }
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
export function getV2ContractByAddress(address) {
|
|
280
|
+
const all = getAllV2Contracts();
|
|
281
|
+
return all.find(c => c.address.toLowerCase() === address.toLowerCase());
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Check if an address is a V2 contract
|
|
285
|
+
*
|
|
286
|
+
* @param address - Contract address to check
|
|
287
|
+
* @returns True if address is a V2 contract
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* if (isV2Contract('0xB97A20aca3D6770Deca299a1aD9DAFb12d1e5eCf')) {
|
|
292
|
+
* console.log('This is a V2 contract with VERSION interface');
|
|
293
|
+
* }
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export function isV2Contract(address) {
|
|
297
|
+
return getV2ContractByAddress(address) !== undefined;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get all V2 contracts deployed on a specific date
|
|
301
|
+
*
|
|
302
|
+
* @param date - Deployment date (YYYY-MM-DD)
|
|
303
|
+
* @returns Array of contracts deployed on that date
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```ts
|
|
307
|
+
* const contracts = getV2ContractsByDate('2025-11-01');
|
|
308
|
+
* console.log(`${contracts.length} contracts deployed on 2025-11-01`);
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
export function getV2ContractsByDate(date) {
|
|
312
|
+
const all = getAllV2Contracts();
|
|
313
|
+
return all.filter(c => c.deployedAt === date);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* V2 Contract Summary
|
|
317
|
+
*/
|
|
318
|
+
export const V2_SUMMARY = {
|
|
319
|
+
totalContracts: 11,
|
|
320
|
+
categories: {
|
|
321
|
+
core: 5, // GToken, SuperPaymasterV2, Registry, GTokenStaking, PaymasterFactory
|
|
322
|
+
tokens: 2, // xPNTsFactory, MySBT
|
|
323
|
+
testTokens: 2, // aPNTs, bPNTs
|
|
324
|
+
monitoring: 2, // DVTValidator, BLSAggregator
|
|
325
|
+
},
|
|
326
|
+
latestDeployment: '2025-11-09',
|
|
327
|
+
allContractsHaveVersion: true, // All V2 contracts now have VERSION interface
|
|
328
|
+
};
|
package/dist/contracts.d.ts
CHANGED
|
@@ -27,20 +27,14 @@ export declare const SEPOLIA_CONTRACTS: {
|
|
|
27
27
|
readonly dvtValidator: `0x${string}`;
|
|
28
28
|
readonly entryPoint: `0x${string}`;
|
|
29
29
|
readonly xPNTsFactory: `0x${string}`;
|
|
30
|
-
readonly reputationSystem: import("viem").Address;
|
|
31
30
|
};
|
|
32
31
|
readonly tokens: {
|
|
33
32
|
readonly xPNTsFactory: `0x${string}`;
|
|
34
|
-
readonly aPNTs: `0x${string}`;
|
|
35
|
-
readonly gToken: `0x${string}`;
|
|
36
|
-
readonly pimToken: import("viem").Address;
|
|
37
33
|
};
|
|
38
34
|
readonly testTokens: {
|
|
39
35
|
readonly mockUSDT: import("viem").Address;
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
42
|
-
readonly bpnts: `0x${string}`;
|
|
43
|
-
readonly pimToken: `0x${string}`;
|
|
36
|
+
readonly aPNTs: import("viem").Address;
|
|
37
|
+
readonly bPNTs: import("viem").Address;
|
|
44
38
|
};
|
|
45
39
|
readonly testAccounts: {
|
|
46
40
|
readonly simpleAccountFactory: import("viem").Address;
|
|
@@ -92,20 +86,14 @@ export declare const CONTRACTS: {
|
|
|
92
86
|
readonly dvtValidator: `0x${string}`;
|
|
93
87
|
readonly entryPoint: `0x${string}`;
|
|
94
88
|
readonly xPNTsFactory: `0x${string}`;
|
|
95
|
-
readonly reputationSystem: import("viem").Address;
|
|
96
89
|
};
|
|
97
90
|
readonly tokens: {
|
|
98
91
|
readonly xPNTsFactory: `0x${string}`;
|
|
99
|
-
readonly aPNTs: `0x${string}`;
|
|
100
|
-
readonly gToken: `0x${string}`;
|
|
101
|
-
readonly pimToken: import("viem").Address;
|
|
102
92
|
};
|
|
103
93
|
readonly testTokens: {
|
|
104
94
|
readonly mockUSDT: import("viem").Address;
|
|
105
|
-
readonly
|
|
106
|
-
readonly
|
|
107
|
-
readonly bpnts: `0x${string}`;
|
|
108
|
-
readonly pimToken: `0x${string}`;
|
|
95
|
+
readonly aPNTs: import("viem").Address;
|
|
96
|
+
readonly bPNTs: import("viem").Address;
|
|
109
97
|
};
|
|
110
98
|
readonly testAccounts: {
|
|
111
99
|
readonly simpleAccountFactory: import("viem").Address;
|
|
@@ -201,7 +189,6 @@ export declare function getCoreContracts(network: ContractNetwork): {
|
|
|
201
189
|
readonly dvtValidator: `0x${string}`;
|
|
202
190
|
readonly entryPoint: `0x${string}`;
|
|
203
191
|
readonly xPNTsFactory: `0x${string}`;
|
|
204
|
-
readonly reputationSystem: import("viem").Address;
|
|
205
192
|
};
|
|
206
193
|
/**
|
|
207
194
|
* Get token system contracts
|
|
@@ -218,9 +205,6 @@ export declare function getCoreContracts(network: ContractNetwork): {
|
|
|
218
205
|
*/
|
|
219
206
|
export declare function getTokenContracts(network: ContractNetwork): {
|
|
220
207
|
readonly xPNTsFactory: `0x${string}`;
|
|
221
|
-
readonly aPNTs: `0x${string}`;
|
|
222
|
-
readonly gToken: `0x${string}`;
|
|
223
|
-
readonly pimToken: import("viem").Address;
|
|
224
208
|
};
|
|
225
209
|
/**
|
|
226
210
|
* Get test token contracts (for development & testing)
|
|
@@ -236,10 +220,8 @@ export declare function getTokenContracts(network: ContractNetwork): {
|
|
|
236
220
|
*/
|
|
237
221
|
export declare function getTestTokenContracts(network: ContractNetwork): {
|
|
238
222
|
readonly mockUSDT: import("viem").Address;
|
|
239
|
-
readonly
|
|
240
|
-
readonly
|
|
241
|
-
readonly bpnts: `0x${string}`;
|
|
242
|
-
readonly pimToken: `0x${string}`;
|
|
223
|
+
readonly aPNTs: import("viem").Address;
|
|
224
|
+
readonly bPNTs: import("viem").Address;
|
|
243
225
|
};
|
|
244
226
|
/**
|
|
245
227
|
* Get PaymasterV4_1 address (AOA mode)
|
package/dist/contracts.js
CHANGED
|
@@ -47,7 +47,7 @@ export const SEPOLIA_CONTRACTS = {
|
|
|
47
47
|
/** AAStar Community - Test community for development (registered: 2025-11-01) */
|
|
48
48
|
aastar: {
|
|
49
49
|
owner: COMMUNITY_OWNERS.aastarOwner,
|
|
50
|
-
gasToken: TEST_TOKEN_ADDRESSES.
|
|
50
|
+
gasToken: TEST_TOKEN_ADDRESSES.aPNTs,
|
|
51
51
|
ensName: 'aastar.eth',
|
|
52
52
|
name: 'AAStar',
|
|
53
53
|
stake: '50', // 50 GToken staked in Registry
|
|
@@ -55,7 +55,7 @@ export const SEPOLIA_CONTRACTS = {
|
|
|
55
55
|
/** BreadCommunity - Test community for development (registered: 2025-11-03) */
|
|
56
56
|
breadCommunity: {
|
|
57
57
|
owner: COMMUNITY_OWNERS.breadCommunityOwner,
|
|
58
|
-
gasToken: TEST_TOKEN_ADDRESSES.
|
|
58
|
+
gasToken: TEST_TOKEN_ADDRESSES.bPNTs,
|
|
59
59
|
ensName: 'bread.eth',
|
|
60
60
|
name: 'BreadCommunity',
|
|
61
61
|
stake: '50', // 50 GToken staked in Registry
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utilities for SDK
|
|
3
|
+
* Provides consistent error types and error transformation from viem
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ErrorCode {
|
|
6
|
+
INVALID_ADDRESS = "E1001",
|
|
7
|
+
INVALID_AMOUNT = "E1002",
|
|
8
|
+
INVALID_PARAMETER = "E1003",
|
|
9
|
+
REQUIRED_PARAMETER = "E1004",
|
|
10
|
+
INVALID_HEX = "E1005",
|
|
11
|
+
CONTRACT_REVERT = "E2001",
|
|
12
|
+
INSUFFICIENT_BALANCE = "E2002",
|
|
13
|
+
UNAUTHORIZED = "E2003",
|
|
14
|
+
PAUSED = "E2004",
|
|
15
|
+
ROLE_NOT_CONFIGURED = "E2005",
|
|
16
|
+
TOKEN_NOT_FOUND = "E2006",
|
|
17
|
+
NETWORK_TIMEOUT = "E3001",
|
|
18
|
+
RPC_ERROR = "E3002",
|
|
19
|
+
CONNECTION_REFUSED = "E3003",
|
|
20
|
+
NOT_IMPLEMENTED = "E4001",
|
|
21
|
+
INTERNAL_ERROR = "E4002",
|
|
22
|
+
INVALID_CONFIGURATION = "E4003",
|
|
23
|
+
BUNDLER_ERROR = "E5001",
|
|
24
|
+
BUNDLER_USER_OP_REVERTED = "E5002",
|
|
25
|
+
BUNDLER_SIGNATURE_INVALID = "E5003",
|
|
26
|
+
BUNDLER_INSUFFICIENT_FUNDS = "E5004",
|
|
27
|
+
BUNDLER_NONCE_TOO_LOW = "E5005",
|
|
28
|
+
BUNDLER_RATE_LIMIT = "E5006"
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Base SDK error class with structured error information
|
|
32
|
+
*/
|
|
33
|
+
export declare class AAStarError extends Error {
|
|
34
|
+
code: ErrorCode;
|
|
35
|
+
cause?: Error | undefined;
|
|
36
|
+
data?: unknown | undefined;
|
|
37
|
+
constructor(code: ErrorCode, message: string, cause?: Error | undefined, data?: unknown | undefined);
|
|
38
|
+
/**
|
|
39
|
+
* Convert viem error to AAStarError with appropriate error code
|
|
40
|
+
*/
|
|
41
|
+
static fromViemError(error: Error, context?: string): AAStarError;
|
|
42
|
+
/**
|
|
43
|
+
* Parse bundler error strings into structured AAStarError
|
|
44
|
+
*/
|
|
45
|
+
static fromBundlerError(error: any): AAStarError;
|
|
46
|
+
/**
|
|
47
|
+
* Convert to JSON for logging/reporting
|
|
48
|
+
*/
|
|
49
|
+
toJSON(): {
|
|
50
|
+
name: string;
|
|
51
|
+
code: ErrorCode;
|
|
52
|
+
message: string;
|
|
53
|
+
data: unknown;
|
|
54
|
+
cause: string | undefined;
|
|
55
|
+
stack: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
}
|