@aastar/core 0.16.8 → 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,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utilities for SDK parameters
|
|
3
|
+
* Provides early error detection before contract calls
|
|
4
|
+
*/
|
|
5
|
+
import type { Address } from 'viem';
|
|
6
|
+
export declare class ValidationError extends Error {
|
|
7
|
+
field: string;
|
|
8
|
+
code: string;
|
|
9
|
+
constructor(field: string, message: string, code?: string);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Validates Ethereum address format
|
|
13
|
+
* @throws {ValidationError} if address is invalid
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateAddress(addr: unknown, fieldName: string): asserts addr is Address;
|
|
16
|
+
/**
|
|
17
|
+
* Validates bigint amount is non-negative
|
|
18
|
+
* @throws {ValidationError} if amount is negative
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateAmount(amount: bigint, fieldName: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Validates bigint is positive (> 0)
|
|
23
|
+
* @throws {ValidationError} if value is zero or negative
|
|
24
|
+
*/
|
|
25
|
+
export declare function validatePositive(value: bigint, fieldName: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Validates hex string format
|
|
28
|
+
* @throws {ValidationError} if not valid hex
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateHex(data: unknown, fieldName: string): asserts data is `0x${string}`;
|
|
31
|
+
/**
|
|
32
|
+
* Validates required parameter is present
|
|
33
|
+
* @throws {ValidationError} if value is null or undefined
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateRequired<T>(value: T | null | undefined, fieldName: string): asserts value is T;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utilities for SDK parameters
|
|
3
|
+
* Provides early error detection before contract calls
|
|
4
|
+
*/
|
|
5
|
+
import { isAddress } from 'viem';
|
|
6
|
+
export class ValidationError extends Error {
|
|
7
|
+
field;
|
|
8
|
+
code;
|
|
9
|
+
constructor(field, message, code = 'VALIDATION_ERROR') {
|
|
10
|
+
super(`Validation failed for ${field}: ${message}`);
|
|
11
|
+
this.field = field;
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.name = 'ValidationError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validates Ethereum address format
|
|
18
|
+
* @throws {ValidationError} if address is invalid
|
|
19
|
+
*/
|
|
20
|
+
export function validateAddress(addr, fieldName) {
|
|
21
|
+
if (typeof addr !== 'string' || !isAddress(addr)) {
|
|
22
|
+
throw new ValidationError(fieldName, `Invalid Ethereum address format. Got: ${addr}`, 'INVALID_ADDRESS');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validates bigint amount is non-negative
|
|
27
|
+
* @throws {ValidationError} if amount is negative
|
|
28
|
+
*/
|
|
29
|
+
export function validateAmount(amount, fieldName) {
|
|
30
|
+
if (amount < 0n) {
|
|
31
|
+
throw new ValidationError(fieldName, `Amount cannot be negative. Got: ${amount}`, 'INVALID_AMOUNT');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validates bigint is positive (> 0)
|
|
36
|
+
* @throws {ValidationError} if value is zero or negative
|
|
37
|
+
*/
|
|
38
|
+
export function validatePositive(value, fieldName) {
|
|
39
|
+
if (value <= 0n) {
|
|
40
|
+
throw new ValidationError(fieldName, `Value must be positive. Got: ${value}`, 'INVALID_VALUE');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Validates hex string format
|
|
45
|
+
* @throws {ValidationError} if not valid hex
|
|
46
|
+
*/
|
|
47
|
+
export function validateHex(data, fieldName) {
|
|
48
|
+
if (typeof data !== 'string' || !data.startsWith('0x')) {
|
|
49
|
+
throw new ValidationError(fieldName, `Must be a hex string starting with 0x. Got: ${data}`, 'INVALID_HEX');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validates required parameter is present
|
|
54
|
+
* @throws {ValidationError} if value is null or undefined
|
|
55
|
+
*/
|
|
56
|
+
export function validateRequired(value, fieldName) {
|
|
57
|
+
if (value === null || value === undefined) {
|
|
58
|
+
throw new ValidationError(fieldName, 'Required parameter is missing', 'REQUIRED_PARAMETER');
|
|
59
|
+
}
|
|
60
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aastar/core",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,20 +14,12 @@
|
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@vitest/coverage-v8": "4.0.17",
|
|
16
16
|
"abitype": "1.2.3",
|
|
17
|
-
"typescript": "5.7.2"
|
|
18
|
-
"vitest": "4.0.17"
|
|
17
|
+
"typescript": "5.7.2"
|
|
19
18
|
},
|
|
20
|
-
"publishConfig": {
|
|
21
|
-
"access": "public"
|
|
22
|
-
},
|
|
23
|
-
"license": "MIT",
|
|
24
19
|
"scripts": {
|
|
25
20
|
"clean": "find src -name '*.js' -o -name '*.d.ts' -o -name '*.map' | xargs rm -f",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"test
|
|
29
|
-
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src --ext .ts",
|
|
30
|
-
"lint:fix": "ESLINT_USE_FLAT_CONFIG=false eslint src --ext .ts --fix",
|
|
31
|
-
"audit:abi": "npx tsx scripts/audit-abi-coverage.ts"
|
|
21
|
+
"prebuild": "pnpm clean",
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"test": "vitest run"
|
|
32
24
|
}
|
|
33
25
|
}
|