@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.
Files changed (60) hide show
  1. package/dist/abis/PaymasterV4_2.json +1193 -0
  2. package/dist/abis/SuperPaymaster.json +1 -1
  3. package/dist/abis/aPNTs.json +1160 -0
  4. package/dist/abis/abi.config.json +3 -3
  5. package/dist/abis/index.d.ts +15 -104
  6. package/dist/abis/index.js +22 -46
  7. package/dist/actions/account.d.ts +0 -15
  8. package/dist/actions/account.js +143 -108
  9. package/dist/actions/aggregator.d.ts +68 -7
  10. package/dist/actions/aggregator.js +328 -28
  11. package/dist/actions/dvt.d.ts +33 -5
  12. package/dist/actions/dvt.js +238 -38
  13. package/dist/actions/entryPoint.d.ts +3 -63
  14. package/dist/actions/entryPoint.js +52 -184
  15. package/dist/actions/factory.d.ts +48 -115
  16. package/dist/actions/factory.js +638 -438
  17. package/dist/actions/faucet.d.ts +23 -27
  18. package/dist/actions/faucet.js +150 -289
  19. package/dist/actions/index.d.ts +1 -2
  20. package/dist/actions/index.js +2 -4
  21. package/dist/actions/paymaster.d.ts +147 -0
  22. package/dist/actions/paymaster.js +706 -0
  23. package/dist/actions/paymasterV4.d.ts +26 -95
  24. package/dist/actions/paymasterV4.js +28 -121
  25. package/dist/actions/registry.d.ts +116 -165
  26. package/dist/actions/registry.js +855 -654
  27. package/dist/actions/reputation.d.ts +74 -52
  28. package/dist/actions/reputation.js +548 -242
  29. package/dist/actions/sbt.d.ts +90 -100
  30. package/dist/actions/sbt.js +801 -518
  31. package/dist/actions/staking.d.ts +45 -32
  32. package/dist/actions/staking.js +431 -260
  33. package/dist/actions/superPaymaster.d.ts +140 -158
  34. package/dist/actions/superPaymaster.js +965 -631
  35. package/dist/actions/tokens.d.ts +130 -108
  36. package/dist/actions/tokens.js +470 -414
  37. package/dist/actions/validators.d.ts +0 -73
  38. package/dist/actions/validators.js +0 -94
  39. package/dist/clients/BaseClient.d.ts +3 -3
  40. package/dist/clients/BundlerClient.d.ts +55 -0
  41. package/dist/clients/BundlerClient.js +92 -0
  42. package/dist/communities.js +2 -2
  43. package/dist/constants.js +1 -28
  44. package/dist/contract-addresses.d.ts +5 -14
  45. package/dist/contract-addresses.js +3 -9
  46. package/dist/contract-versions.d.ts +138 -0
  47. package/dist/contract-versions.js +328 -0
  48. package/dist/contracts.d.ts +6 -24
  49. package/dist/contracts.js +2 -2
  50. package/dist/errors/index.d.ts +57 -0
  51. package/dist/errors/index.js +123 -0
  52. package/dist/index.d.ts +2 -1
  53. package/dist/index.js +2 -1
  54. package/dist/requirementChecker.d.ts +35 -1
  55. package/dist/requirementChecker.js +39 -1
  56. package/dist/roles.d.ts +50 -61
  57. package/dist/roles.js +50 -61
  58. package/dist/validators/index.d.ts +35 -0
  59. package/dist/validators/index.js +60 -0
  60. 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.8",
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
- "build": "pnpm clean && tsc",
27
- "test": "vitest run",
28
- "test:coverage": "vitest run --coverage",
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
  }