@aastar/core 0.16.14 → 0.16.16

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "SuperPaymaster Contract ABIs Manifest",
3
3
  "source": "SuperPaymaster/contracts/src",
4
- "buildTime": "2026-01-24T05:34:30Z",
4
+ "buildTime": "2026-01-25T16:22:49Z",
5
5
  "totalHash": "677e2b2d8087c4d0a9b97cf4711b18d3784f3477c554019248e3920091435c93",
6
6
  "files": [
7
7
  { "name": "BLSAggregator.json", "hash": "d9141785a07dfad178ba6e2a8a6213e5efc86c501ea8a0886f43a28cb9a6e24c" },
@@ -196,6 +196,16 @@ export type RegistryActions = {
196
196
  renounceOwnership: (args: {
197
197
  account?: Account | Address;
198
198
  }) => Promise<Hash>;
199
+ grantRole: (args: {
200
+ roleId: Hex;
201
+ user: Address;
202
+ account?: Account | Address;
203
+ }) => Promise<Hash>;
204
+ revokeRole: (args: {
205
+ roleId: Hex;
206
+ user: Address;
207
+ account?: Account | Address;
208
+ }) => Promise<Hash>;
199
209
  version: () => Promise<string>;
200
210
  };
201
211
  export declare const registryActions: (address: Address) => (client: PublicClient | WalletClient) => RegistryActions;
@@ -867,6 +867,42 @@ export const registryActions = (address) => (client) => ({
867
867
  throw AAStarError.fromViemError(error, 'renounceOwnership');
868
868
  }
869
869
  },
870
+ // AccessControl
871
+ async grantRole({ roleId, user, account }) {
872
+ try {
873
+ validateRequired(roleId, 'roleId');
874
+ validateAddress(user, 'user');
875
+ return await client.writeContract({
876
+ address,
877
+ abi: RegistryABI,
878
+ functionName: 'grantRole',
879
+ args: [roleId, user],
880
+ account: account,
881
+ chain: client.chain
882
+ });
883
+ }
884
+ catch (error) {
885
+ throw AAStarError.fromViemError(error, 'grantRole');
886
+ }
887
+ },
888
+ async revokeRole({ roleId, user, account }) {
889
+ try {
890
+ validateRequired(roleId, 'roleId');
891
+ validateAddress(user, 'user');
892
+ return await client.writeContract({
893
+ address,
894
+ abi: RegistryABI,
895
+ functionName: 'revokeRole',
896
+ args: [roleId, user],
897
+ account: account,
898
+ chain: client.chain
899
+ });
900
+ }
901
+ catch (error) {
902
+ throw AAStarError.fromViemError(error, 'revokeRole');
903
+ }
904
+ },
905
+ // Version
870
906
  async version() {
871
907
  try {
872
908
  return await client.readContract({
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Canonical Contract Addresses for Supported Networks
3
+ * These are hardcoded as defaults for NPM distribution.
4
+ */
5
+ export declare const CANONICAL_ADDRESSES: {
6
+ readonly 11155111: {
7
+ readonly registry: "0x7Ba70C5bFDb3A4d0cBd220534f3BE177fefc1788";
8
+ readonly gToken: "0x9ceDeC089921652D050819ca5BE53765fc05aa9E";
9
+ readonly staking: "0x1118eAf2427a5B9e488e28D35338d22EaCBc37fC";
10
+ readonly sbt: "0x677423f5Dad98D19cAE8661c36F094289cb6171a";
11
+ readonly reputationSystem: "0x4b256541Ff4021f8D8229908C2BEd9c15Fd8afCC";
12
+ readonly superPaymaster: "0x16cE0c7d846f9446bbBeb9C5a84A4D140fAeD94A";
13
+ readonly paymasterFactory: "0xfDE4671581F21C9e54Cafa95FA6Da98678750F4d";
14
+ readonly paymasterV4Impl: "0x0EBEDa248D53678D493f62719b3ce34DDb3CAcFf";
15
+ readonly xPNTsFactory: "0x6EafdA3477F3eec1F848505e1c06dFB5532395b6";
16
+ readonly blsAggregator: "0xe380d443842A8A37F691B9f3EF58e40073759edc";
17
+ readonly blsValidator: "0x04590731005d25d379A55b6c3136B5CD1eaC757F";
18
+ readonly dvtValidator: "0xcB42417Cfb374e923BAF729040d9973FB7676537";
19
+ readonly entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
20
+ readonly aPNTs: "0xDf669834F04988BcEE0E3B6013B6b867Bd38778d";
21
+ readonly priceFeed: "0x694AA1769357215DE4FAC081bf1f309aDC325306";
22
+ readonly simpleAccountFactory: "0x91E60482a2B343004dF29EB205C4F6916E864700";
23
+ };
24
+ readonly 11155420: {
25
+ readonly registry: "0xcf6860Ab57de8669756997e414D9c52B6e301972";
26
+ readonly gToken: "0xC341c88453372021d0221834307613c2e99fE718";
27
+ readonly staking: "0x5f57B931C849e8E255F22755506eB2255aB22a7C";
28
+ readonly sbt: "0x2c3Ca1553dC1B8870381E8E56C7b3e3A3ae162f0";
29
+ readonly reputationSystem: "0x891EC0f84D9275839B8dAf74e87B23F2DBd7f9c9";
30
+ readonly superPaymaster: "0x9eC1FE8134A1C05aD34ba2E4e8758dAe0a009B94";
31
+ readonly paymasterFactory: "0x1e3b9d12eAc27867a523d0537902441B0E7D98d8";
32
+ readonly paymasterV4Impl: "0x906123080207F250B1C9F299991512Cb31f35b2f";
33
+ readonly xPNTsFactory: "0x7792a49C9E91e0E9B631B27D885d15e971B7482A";
34
+ readonly blsAggregator: "0x6e06b17b1a4D2D973F7E3e026e24b4393315736c";
35
+ readonly blsValidator: "0x260fa905CcE1f5b29Afe9d627c01fAAE4A66A7F5";
36
+ readonly dvtValidator: "0x0087cA806109E150438116cAA414580BB5fa9195";
37
+ readonly entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
38
+ readonly aPNTs: "0x3BBcA92Ad828b3dD619c980Ba09f929b9d2BC440";
39
+ readonly priceFeed: "0x61Ec26aA57019C486B10502285c5A3D4A4750AD7";
40
+ readonly simpleAccountFactory: "0x91E6060613810449d098b0b5Ec8b51A0FE8c8985";
41
+ };
42
+ };
43
+ export type CanonicalAddresses = (typeof CANONICAL_ADDRESSES)[keyof typeof CANONICAL_ADDRESSES];
44
+ export type SupportedChainId = keyof typeof CANONICAL_ADDRESSES;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Canonical Contract Addresses for Supported Networks
3
+ * These are hardcoded as defaults for NPM distribution.
4
+ */
5
+ export const CANONICAL_ADDRESSES = {
6
+ // --- Sepolia (Chain ID: 11155111) ---
7
+ 11155111: {
8
+ registry: "0x7Ba70C5bFDb3A4d0cBd220534f3BE177fefc1788",
9
+ gToken: "0x9ceDeC089921652D050819ca5BE53765fc05aa9E",
10
+ staking: "0x1118eAf2427a5B9e488e28D35338d22EaCBc37fC",
11
+ sbt: "0x677423f5Dad98D19cAE8661c36F094289cb6171a",
12
+ reputationSystem: "0x4b256541Ff4021f8D8229908C2BEd9c15Fd8afCC",
13
+ superPaymaster: "0x16cE0c7d846f9446bbBeb9C5a84A4D140fAeD94A",
14
+ paymasterFactory: "0xfDE4671581F21C9e54Cafa95FA6Da98678750F4d",
15
+ paymasterV4Impl: "0x0EBEDa248D53678D493f62719b3ce34DDb3CAcFf",
16
+ xPNTsFactory: "0x6EafdA3477F3eec1F848505e1c06dFB5532395b6",
17
+ blsAggregator: "0xe380d443842A8A37F691B9f3EF58e40073759edc",
18
+ blsValidator: "0x04590731005d25d379A55b6c3136B5CD1eaC757F",
19
+ dvtValidator: "0xcB42417Cfb374e923BAF729040d9973FB7676537",
20
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
21
+ aPNTs: "0xDf669834F04988BcEE0E3B6013B6b867Bd38778d",
22
+ priceFeed: "0x694AA1769357215DE4FAC081bf1f309aDC325306",
23
+ simpleAccountFactory: "0x91E60482a2B343004dF29EB205C4F6916E864700"
24
+ },
25
+ // --- OP Sepolia (Chain ID: 11155420) ---
26
+ 11155420: {
27
+ registry: "0xcf6860Ab57de8669756997e414D9c52B6e301972",
28
+ gToken: "0xC341c88453372021d0221834307613c2e99fE718",
29
+ staking: "0x5f57B931C849e8E255F22755506eB2255aB22a7C",
30
+ sbt: "0x2c3Ca1553dC1B8870381E8E56C7b3e3A3ae162f0",
31
+ reputationSystem: "0x891EC0f84D9275839B8dAf74e87B23F2DBd7f9c9",
32
+ superPaymaster: "0x9eC1FE8134A1C05aD34ba2E4e8758dAe0a009B94",
33
+ paymasterFactory: "0x1e3b9d12eAc27867a523d0537902441B0E7D98d8",
34
+ paymasterV4Impl: "0x906123080207F250B1C9F299991512Cb31f35b2f",
35
+ xPNTsFactory: "0x7792a49C9E91e0E9B631B27D885d15e971B7482A",
36
+ blsAggregator: "0x6e06b17b1a4D2D973F7E3e026e24b4393315736c",
37
+ blsValidator: "0x260fa905CcE1f5b29Afe9d627c01fAAE4A66A7F5",
38
+ dvtValidator: "0x0087cA806109E150438116cAA414580BB5fa9195",
39
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
40
+ aPNTs: "0x3BBcA92Ad828b3dD619c980Ba09f929b9d2BC440",
41
+ priceFeed: "0x61Ec26aA57019C486B10502285c5A3D4A4750AD7",
42
+ simpleAccountFactory: "0x91E6060613810449d098b0b5Ec8b51A0FE8c8985"
43
+ }
44
+ };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Contract Addresses (loaded from config.{network}.json)
2
+ * Contract Addresses (Priority: ENV > Local Config > Canonical Defaults)
3
3
  */
4
4
  export declare const CONTRACT_SRC_HASH: any;
5
5
  export declare const REGISTRY_ADDRESS: `0x${string}`;
@@ -15,8 +15,6 @@ export declare const BLS_AGGREGATOR_ADDRESS: `0x${string}`;
15
15
  export declare const BLS_VALIDATOR_ADDRESS: `0x${string}`;
16
16
  export declare const DVT_VALIDATOR_ADDRESS: `0x${string}`;
17
17
  export declare const ENTRY_POINT_ADDRESS: `0x${string}`;
18
- export declare const ENTRY_POINT_0_8_ADDRESS: `0x${string}`;
19
- export declare const ENTRY_POINT_0_9_ADDRESS: `0x${string}`;
20
18
  export declare const APNTS_ADDRESS: `0x${string}`;
21
19
  /**
22
20
  * Common Constants
package/dist/constants.js CHANGED
@@ -1,33 +1,37 @@
1
1
  import { createRequire } from 'module';
2
+ import { CANONICAL_ADDRESSES } from './addresses.js';
2
3
  const require = createRequire(import.meta.url);
3
4
  const network = process.env.NETWORK || 'anvil';
4
5
  let config = {};
6
+ // 1. Try to load local config (for development/monorepo use)
5
7
  try {
6
8
  config = require(`../../../config.${network}.json`);
7
9
  }
8
10
  catch (e) {
9
- console.warn(`Warning: Could not load config.${network}.json. Contract addresses may be undefined.`);
11
+ // console.warn(`Warning: Could not load config.${network}.json. Falling back to code defaults.`);
10
12
  }
13
+ // 2. Identify Chain ID and resolve canonical defaults
14
+ const chainIdStr = process.env.CHAIN_ID || config.chainId;
15
+ const chainId = chainIdStr ? Number(chainIdStr) : (network === 'sepolia' ? 11155111 : (network === 'op-sepolia' ? 11155420 : 0));
16
+ const defaults = CANONICAL_ADDRESSES[chainId] || {};
11
17
  /**
12
- * Contract Addresses (loaded from config.{network}.json)
18
+ * Contract Addresses (Priority: ENV > Local Config > Canonical Defaults)
13
19
  */
14
- export const CONTRACT_SRC_HASH = config.srcHash;
15
- export const REGISTRY_ADDRESS = config.registry;
16
- export const GTOKEN_ADDRESS = config.gToken;
17
- export const GTOKEN_STAKING_ADDRESS = config.staking;
18
- export const SBT_ADDRESS = config.sbt;
19
- export const REPUTATION_SYSTEM_ADDRESS = config.reputationSystem;
20
- export const SUPER_PAYMASTER_ADDRESS = config.superPaymaster;
21
- export const PAYMASTER_FACTORY_ADDRESS = config.paymasterFactory;
22
- export const PAYMASTER_V4_IMPL_ADDRESS = config.paymasterV4Impl;
23
- export const XPNTS_FACTORY_ADDRESS = config.xPNTsFactory;
24
- export const BLS_AGGREGATOR_ADDRESS = config.blsAggregator;
25
- export const BLS_VALIDATOR_ADDRESS = config.blsValidator;
26
- export const DVT_VALIDATOR_ADDRESS = config.dvtValidator;
27
- export const ENTRY_POINT_ADDRESS = config.entryPoint;
28
- export const ENTRY_POINT_0_8_ADDRESS = config.entryPoint08;
29
- export const ENTRY_POINT_0_9_ADDRESS = config.entryPoint09;
30
- export const APNTS_ADDRESS = config.aPNTs;
20
+ export const CONTRACT_SRC_HASH = process.env.SRC_HASH || config.srcHash || defaults.srcHash;
21
+ export const REGISTRY_ADDRESS = (process.env.REGISTRY || config.registry || defaults.registry);
22
+ export const GTOKEN_ADDRESS = (process.env.GTOKEN || config.gToken || defaults.gToken);
23
+ export const GTOKEN_STAKING_ADDRESS = (process.env.STAKING || config.staking || defaults.staking);
24
+ export const SBT_ADDRESS = (process.env.SBT || config.sbt || defaults.sbt);
25
+ export const REPUTATION_SYSTEM_ADDRESS = (process.env.REPUTATION_SYSTEM || config.reputationSystem || defaults.reputationSystem);
26
+ export const SUPER_PAYMASTER_ADDRESS = (process.env.SUPER_PAYMASTER || config.superPaymaster || defaults.superPaymaster);
27
+ export const PAYMASTER_FACTORY_ADDRESS = (process.env.PAYMASTER_FACTORY || config.paymasterFactory || defaults.paymasterFactory);
28
+ export const PAYMASTER_V4_IMPL_ADDRESS = (process.env.PAYMASTER_V4_IMPL || config.paymasterV4Impl || defaults.paymasterV4Impl);
29
+ export const XPNTS_FACTORY_ADDRESS = (process.env.XPNTS_FACTORY || config.xPNTsFactory || defaults.xPNTsFactory);
30
+ export const BLS_AGGREGATOR_ADDRESS = (process.env.BLS_AGGREGATOR || config.blsAggregator || defaults.blsAggregator);
31
+ export const BLS_VALIDATOR_ADDRESS = (process.env.BLS_VALIDATOR || config.blsValidator || defaults.blsValidator);
32
+ export const DVT_VALIDATOR_ADDRESS = (process.env.DVT_VALIDATOR || config.dvtValidator || defaults.dvtValidator);
33
+ export const ENTRY_POINT_ADDRESS = (process.env.ENTRY_POINT || config.entryPoint || defaults.entryPoint);
34
+ export const APNTS_ADDRESS = (process.env.APNTS || config.aPNTs || defaults.aPNTs);
31
35
  /**
32
36
  * Common Constants
33
37
  */
@@ -24,6 +24,28 @@ export declare const NETWORKS: {
24
24
  readonly decimals: 18;
25
25
  };
26
26
  };
27
+ readonly optimism: {
28
+ readonly chainId: 10;
29
+ readonly name: "Optimism";
30
+ readonly rpcUrl: "https://mainnet.optimism.io";
31
+ readonly blockExplorer: "https://optimistic.etherscan.io";
32
+ readonly nativeCurrency: {
33
+ readonly name: "Ether";
34
+ readonly symbol: "ETH";
35
+ readonly decimals: 18;
36
+ };
37
+ };
38
+ readonly 'op-sepolia': {
39
+ readonly chainId: 11155420;
40
+ readonly name: "Optimism Sepolia";
41
+ readonly rpcUrl: "https://sepolia.optimism.io";
42
+ readonly blockExplorer: "https://optimism-sepolia.blockscout.com";
43
+ readonly nativeCurrency: {
44
+ readonly name: "Sepolia Ether";
45
+ readonly symbol: "ETH";
46
+ readonly decimals: 18;
47
+ };
48
+ };
27
49
  };
28
50
  export type SupportedNetwork = keyof typeof NETWORKS;
29
51
  /**
@@ -58,6 +80,26 @@ export declare function getNetwork(network: SupportedNetwork): {
58
80
  readonly symbol: "ETH";
59
81
  readonly decimals: 18;
60
82
  };
83
+ } | {
84
+ readonly chainId: 10;
85
+ readonly name: "Optimism";
86
+ readonly rpcUrl: "https://mainnet.optimism.io";
87
+ readonly blockExplorer: "https://optimistic.etherscan.io";
88
+ readonly nativeCurrency: {
89
+ readonly name: "Ether";
90
+ readonly symbol: "ETH";
91
+ readonly decimals: 18;
92
+ };
93
+ } | {
94
+ readonly chainId: 11155420;
95
+ readonly name: "Optimism Sepolia";
96
+ readonly rpcUrl: "https://sepolia.optimism.io";
97
+ readonly blockExplorer: "https://optimism-sepolia.blockscout.com";
98
+ readonly nativeCurrency: {
99
+ readonly name: "Sepolia Ether";
100
+ readonly symbol: "ETH";
101
+ readonly decimals: 18;
102
+ };
61
103
  };
62
104
  /**
63
105
  * Get RPC URL for a network
@@ -70,7 +112,7 @@ export declare function getNetwork(network: SupportedNetwork): {
70
112
  * const rpcUrl = getRpcUrl('sepolia');
71
113
  * ```
72
114
  */
73
- export declare function getRpcUrl(network: SupportedNetwork): "https://rpc.sepolia.org" | "http://127.0.0.1:8545";
115
+ export declare function getRpcUrl(network: SupportedNetwork): "https://rpc.sepolia.org" | "http://127.0.0.1:8545" | "https://mainnet.optimism.io" | "https://sepolia.optimism.io";
74
116
  /**
75
117
  * Get block explorer URL
76
118
  *
@@ -83,7 +125,7 @@ export declare function getRpcUrl(network: SupportedNetwork): "https://rpc.sepol
83
125
  * // 'https://sepolia.etherscan.io'
84
126
  * ```
85
127
  */
86
- export declare function getBlockExplorer(network: SupportedNetwork): "" | "https://sepolia.etherscan.io";
128
+ export declare function getBlockExplorer(network: SupportedNetwork): "" | "https://sepolia.etherscan.io" | "https://optimistic.etherscan.io" | "https://optimism-sepolia.blockscout.com";
87
129
  /**
88
130
  * Get transaction URL on block explorer
89
131
  *
package/dist/networks.js CHANGED
@@ -24,6 +24,28 @@ export const NETWORKS = {
24
24
  decimals: 18,
25
25
  },
26
26
  },
27
+ optimism: {
28
+ chainId: 10,
29
+ name: 'Optimism',
30
+ rpcUrl: 'https://mainnet.optimism.io',
31
+ blockExplorer: 'https://optimistic.etherscan.io',
32
+ nativeCurrency: {
33
+ name: 'Ether',
34
+ symbol: 'ETH',
35
+ decimals: 18,
36
+ },
37
+ },
38
+ 'op-sepolia': {
39
+ chainId: 11155420,
40
+ name: 'Optimism Sepolia',
41
+ rpcUrl: 'https://sepolia.optimism.io',
42
+ blockExplorer: 'https://optimism-sepolia.blockscout.com',
43
+ nativeCurrency: {
44
+ name: 'Sepolia Ether',
45
+ symbol: 'ETH',
46
+ decimals: 18,
47
+ },
48
+ },
27
49
  };
28
50
  /**
29
51
  * Get network configuration
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@aastar/core",
3
- "version": "0.16.14",
3
+ "version": "0.16.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
+ "license": "MIT",
7
8
  "type": "module",
8
9
  "main": "dist/index.js",
9
10
  "types": "dist/index.d.ts",