@aastar/core 0.16.14 → 0.16.18

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" },
@@ -37,4 +37,4 @@ export type AccountFactoryActions = {
37
37
  }) => Promise<Address>;
38
38
  };
39
39
  export declare const accountActions: (address: Address) => (client: PublicClient | WalletClient) => AccountActions;
40
- export declare const accountFactoryActions: (address: Address) => (client: PublicClient | WalletClient) => AccountFactoryActions;
40
+ export declare const accountFactoryActions: (address: Address, abi?: any) => (client: PublicClient | WalletClient) => AccountFactoryActions;
@@ -132,14 +132,14 @@ export const accountActions = (address) => (client) => ({
132
132
  }
133
133
  }
134
134
  });
135
- export const accountFactoryActions = (address) => (client) => ({
135
+ export const accountFactoryActions = (address, abi = SimpleAccountFactoryABI) => (client) => ({
136
136
  async createAccount({ owner, salt, account }) {
137
137
  try {
138
138
  validateAddress(owner, 'owner');
139
139
  validateRequired(salt, 'salt');
140
140
  return await client.writeContract({
141
141
  address,
142
- abi: SimpleAccountFactoryABI,
142
+ abi: abi || SimpleAccountFactoryABI,
143
143
  functionName: 'createAccount',
144
144
  args: [owner, salt],
145
145
  account: account,
@@ -156,7 +156,7 @@ export const accountFactoryActions = (address) => (client) => ({
156
156
  validateRequired(salt, 'salt');
157
157
  return await client.readContract({
158
158
  address,
159
- abi: SimpleAccountFactoryABI,
159
+ abi: abi || SimpleAccountFactoryABI,
160
160
  functionName: 'getAddress',
161
161
  args: [owner, salt]
162
162
  });
@@ -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,88 +1,47 @@
1
1
  /**
2
- * Contract Addresses (loaded from config.{network}.json)
3
- */
4
- export declare const CONTRACT_SRC_HASH: any;
5
- export declare const REGISTRY_ADDRESS: `0x${string}`;
6
- export declare const GTOKEN_ADDRESS: `0x${string}`;
7
- export declare const GTOKEN_STAKING_ADDRESS: `0x${string}`;
8
- export declare const SBT_ADDRESS: `0x${string}`;
9
- export declare const REPUTATION_SYSTEM_ADDRESS: `0x${string}`;
10
- export declare const SUPER_PAYMASTER_ADDRESS: `0x${string}`;
11
- export declare const PAYMASTER_FACTORY_ADDRESS: `0x${string}`;
12
- export declare const PAYMASTER_V4_IMPL_ADDRESS: `0x${string}`;
13
- export declare const XPNTS_FACTORY_ADDRESS: `0x${string}`;
14
- export declare const BLS_AGGREGATOR_ADDRESS: `0x${string}`;
15
- export declare const BLS_VALIDATOR_ADDRESS: `0x${string}`;
16
- export declare const DVT_VALIDATOR_ADDRESS: `0x${string}`;
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
- export declare const APNTS_ADDRESS: `0x${string}`;
2
+ * Contract Addresses (Priority: ENV > Local Config > Canonical Defaults)
3
+ */
4
+ export declare let CONTRACT_SRC_HASH: any;
5
+ export declare let REGISTRY_ADDRESS: `0x${string}`;
6
+ export declare let GTOKEN_ADDRESS: `0x${string}`;
7
+ export declare let GTOKEN_STAKING_ADDRESS: `0x${string}`;
8
+ export declare let SBT_ADDRESS: `0x${string}`;
9
+ export declare let REPUTATION_SYSTEM_ADDRESS: `0x${string}`;
10
+ export declare let SUPER_PAYMASTER_ADDRESS: `0x${string}`;
11
+ export declare let PAYMASTER_FACTORY_ADDRESS: `0x${string}`;
12
+ export declare let PAYMASTER_V4_IMPL_ADDRESS: `0x${string}`;
13
+ export declare let XPNTS_FACTORY_ADDRESS: `0x${string}`;
14
+ export declare let BLS_AGGREGATOR_ADDRESS: `0x${string}`;
15
+ export declare let BLS_VALIDATOR_ADDRESS: `0x${string}`;
16
+ export declare let DVT_VALIDATOR_ADDRESS: `0x${string}`;
17
+ export declare let ENTRY_POINT_ADDRESS: `0x${string}`;
18
+ export declare let APNTS_ADDRESS: `0x${string}`;
19
+ /**
20
+ * Apply external configuration (for Node.js environment)
21
+ */
22
+ export declare function applyConfig(newConfig: any): void;
21
23
  /**
22
24
  * Common Constants
23
25
  */
24
- /**
25
- * Default faucet API URL for testnet token requests
26
- */
27
26
  export declare const FAUCET_API_URL = "https://faucet-aastar.vercel.app";
28
- /**
29
- * Service fee rate in basis points (200 = 2%)
30
- */
31
27
  export declare const SERVICE_FEE_RATE = 200;
32
- /**
33
- * Maximum service fee in basis points (1000 = 10%)
34
- */
35
28
  export declare const MAX_SERVICE_FEE = 1000;
36
- /**
37
- * Basis points denominator (100% = 10000 basis points)
38
- */
39
29
  export declare const BPS_DENOMINATOR = 10000;
40
- /**
41
- * Default amount of gas tokens to mint for testing (in token units)
42
- */
43
30
  export declare const DEFAULT_GAS_TOKEN_MINT_AMOUNT = "100";
44
- /**
45
- * Default amount of USDT to mint for testing (in USDT)
46
- */
47
31
  export declare const DEFAULT_USDT_MINT_AMOUNT = "10";
48
- /**
49
- * Size of test account pool
50
- */
51
32
  export declare const TEST_ACCOUNT_POOL_SIZE = 20;
52
- /**
53
- * Minimum stake amounts for different node types (in sGT)
54
- */
55
33
  export declare const NODE_STAKE_AMOUNTS: {
56
- /** Lite Node: 30 sGT minimum stake */
57
34
  readonly LITE: 30;
58
- /** Standard Node: 100 sGT minimum stake */
59
35
  readonly STANDARD: 100;
60
- /** Super Node: 300 sGT minimum stake */
61
36
  readonly SUPER: 300;
62
- /** Enterprise Node: 1000 sGT minimum stake */
63
37
  readonly ENTERPRISE: 1000;
64
38
  };
65
- /**
66
- * Default aPNTs price in USD (0.02 USD per aPNT)
67
- */
68
39
  export declare const DEFAULT_APNTS_PRICE_USD = "0.02";
69
- /**
70
- * Network Chain IDs
71
- */
72
40
  export declare const CHAIN_SEPOLIA = 11155111;
73
41
  export declare const CHAIN_MAINNET = 1;
74
- /**
75
- * Default Values
76
- */
77
42
  export declare const DEFAULT_TOKEN_SYMBOL = "GT";
78
43
  export declare const DEFAULT_TOKEN_NAME = "Governance Token";
79
- /**
80
- * Gas Limits
81
- */
82
44
  export declare const DEFAULT_VERIFICATION_GAS_LIMIT = 200000n;
83
45
  export declare const DEFAULT_CALL_GAS_LIMIT = 100000n;
84
46
  export declare const DEFAULT_PRE_VERIFICATION_GAS = 50000n;
85
- /**
86
- * Timeouts
87
- */
88
47
  export declare const DEFAULT_TIMEOUT_MS = 30000;
package/dist/constants.js CHANGED
@@ -1,98 +1,89 @@
1
- import { createRequire } from 'module';
2
- const require = createRequire(import.meta.url);
3
- const network = process.env.NETWORK || 'anvil';
4
- let config = {};
5
- try {
6
- config = require(`../../../config.${network}.json`);
1
+ import { CANONICAL_ADDRESSES } from './addresses.js';
2
+ // Browser-safe network detection
3
+ const network = (typeof process !== 'undefined' && process.env && process.env.NETWORK) || 'anvil';
4
+ let internalConfig = {};
5
+ // 2. Identify Chain ID and resolve canonical defaults
6
+ let chainIdStr = (typeof process !== 'undefined' && process.env && process.env.CHAIN_ID) || internalConfig.chainId;
7
+ let chainId = chainIdStr ? Number(chainIdStr) : (network === 'sepolia' ? 11155111 : (network === 'op-sepolia' ? 11155420 : 0));
8
+ let defaults = CANONICAL_ADDRESSES[chainId] || {};
9
+ /**
10
+ * Helper to resolve address
11
+ */
12
+ function resolveAddr(envKey, configKey) {
13
+ const envVal = (typeof process !== 'undefined' && process.env) ? process.env[envKey] : undefined;
14
+ return (envVal || internalConfig[configKey] || defaults[configKey]);
7
15
  }
8
- catch (e) {
9
- console.warn(`Warning: Could not load config.${network}.json. Contract addresses may be undefined.`);
16
+ function resolveVal(envKey, configKey) {
17
+ const envVal = (typeof process !== 'undefined' && process.env) ? process.env[envKey] : undefined;
18
+ return envVal || internalConfig[configKey] || defaults[configKey];
10
19
  }
11
20
  /**
12
- * Contract Addresses (loaded from config.{network}.json)
21
+ * Contract Addresses (Priority: ENV > Local Config > Canonical Defaults)
13
22
  */
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;
23
+ export let CONTRACT_SRC_HASH = resolveVal('SRC_HASH', 'srcHash');
24
+ export let REGISTRY_ADDRESS = resolveAddr('REGISTRY', 'registry');
25
+ export let GTOKEN_ADDRESS = resolveAddr('GTOKEN', 'gToken');
26
+ export let GTOKEN_STAKING_ADDRESS = resolveAddr('STAKING', 'staking');
27
+ export let SBT_ADDRESS = resolveAddr('SBT', 'sbt');
28
+ export let REPUTATION_SYSTEM_ADDRESS = resolveAddr('REPUTATION_SYSTEM', 'reputationSystem');
29
+ export let SUPER_PAYMASTER_ADDRESS = resolveAddr('SUPER_PAYMASTER', 'superPaymaster');
30
+ export let PAYMASTER_FACTORY_ADDRESS = resolveAddr('PAYMASTER_FACTORY', 'paymasterFactory');
31
+ export let PAYMASTER_V4_IMPL_ADDRESS = resolveAddr('PAYMASTER_V4_IMPL', 'paymasterV4Impl');
32
+ export let XPNTS_FACTORY_ADDRESS = resolveAddr('XPNTS_FACTORY', 'xPNTsFactory');
33
+ export let BLS_AGGREGATOR_ADDRESS = resolveAddr('BLS_AGGREGATOR', 'blsAggregator');
34
+ export let BLS_VALIDATOR_ADDRESS = resolveAddr('BLS_VALIDATOR', 'blsValidator');
35
+ export let DVT_VALIDATOR_ADDRESS = resolveAddr('DVT_VALIDATOR', 'dvtValidator');
36
+ export let ENTRY_POINT_ADDRESS = resolveAddr('ENTRY_POINT', 'entryPoint');
37
+ export let APNTS_ADDRESS = resolveAddr('APNTS', 'aPNTs');
31
38
  /**
32
- * Common Constants
39
+ * Apply external configuration (for Node.js environment)
33
40
  */
41
+ export function applyConfig(newConfig) {
42
+ internalConfig = newConfig;
43
+ // Re-calculate derived values
44
+ const envChainId = (typeof process !== 'undefined' && process.env) ? process.env.CHAIN_ID : undefined;
45
+ chainIdStr = envChainId || internalConfig.chainId;
46
+ chainId = chainIdStr ? Number(chainIdStr) : (network === 'sepolia' ? 11155111 : (network === 'op-sepolia' ? 11155420 : 0));
47
+ defaults = CANONICAL_ADDRESSES[chainId] || {};
48
+ // Re-assign exports
49
+ CONTRACT_SRC_HASH = resolveVal('SRC_HASH', 'srcHash');
50
+ REGISTRY_ADDRESS = resolveAddr('REGISTRY', 'registry');
51
+ GTOKEN_ADDRESS = resolveAddr('GTOKEN', 'gToken');
52
+ GTOKEN_STAKING_ADDRESS = resolveAddr('STAKING', 'staking');
53
+ SBT_ADDRESS = resolveAddr('SBT', 'sbt');
54
+ REPUTATION_SYSTEM_ADDRESS = resolveAddr('REPUTATION_SYSTEM', 'reputationSystem');
55
+ SUPER_PAYMASTER_ADDRESS = resolveAddr('SUPER_PAYMASTER', 'superPaymaster');
56
+ PAYMASTER_FACTORY_ADDRESS = resolveAddr('PAYMASTER_FACTORY', 'paymasterFactory');
57
+ PAYMASTER_V4_IMPL_ADDRESS = resolveAddr('PAYMASTER_V4_IMPL', 'paymasterV4Impl');
58
+ XPNTS_FACTORY_ADDRESS = resolveAddr('XPNTS_FACTORY', 'xPNTsFactory');
59
+ BLS_AGGREGATOR_ADDRESS = resolveAddr('BLS_AGGREGATOR', 'blsAggregator');
60
+ BLS_VALIDATOR_ADDRESS = resolveAddr('BLS_VALIDATOR', 'blsValidator');
61
+ DVT_VALIDATOR_ADDRESS = resolveAddr('DVT_VALIDATOR', 'dvtValidator');
62
+ ENTRY_POINT_ADDRESS = resolveAddr('ENTRY_POINT', 'entryPoint');
63
+ APNTS_ADDRESS = resolveAddr('APNTS', 'aPNTs');
64
+ }
34
65
  /**
35
- * Default faucet API URL for testnet token requests
66
+ * Common Constants
36
67
  */
37
68
  export const FAUCET_API_URL = "https://faucet-aastar.vercel.app";
38
- /**
39
- * Service fee rate in basis points (200 = 2%)
40
- */
41
69
  export const SERVICE_FEE_RATE = 200;
42
- /**
43
- * Maximum service fee in basis points (1000 = 10%)
44
- */
45
70
  export const MAX_SERVICE_FEE = 1000;
46
- /**
47
- * Basis points denominator (100% = 10000 basis points)
48
- */
49
71
  export const BPS_DENOMINATOR = 10000;
50
- /**
51
- * Default amount of gas tokens to mint for testing (in token units)
52
- */
53
72
  export const DEFAULT_GAS_TOKEN_MINT_AMOUNT = "100";
54
- /**
55
- * Default amount of USDT to mint for testing (in USDT)
56
- */
57
73
  export const DEFAULT_USDT_MINT_AMOUNT = "10";
58
- /**
59
- * Size of test account pool
60
- */
61
74
  export const TEST_ACCOUNT_POOL_SIZE = 20;
62
- /**
63
- * Minimum stake amounts for different node types (in sGT)
64
- */
65
75
  export const NODE_STAKE_AMOUNTS = {
66
- /** Lite Node: 30 sGT minimum stake */
67
76
  LITE: 30,
68
- /** Standard Node: 100 sGT minimum stake */
69
77
  STANDARD: 100,
70
- /** Super Node: 300 sGT minimum stake */
71
78
  SUPER: 300,
72
- /** Enterprise Node: 1000 sGT minimum stake */
73
79
  ENTERPRISE: 1000,
74
80
  };
75
- /**
76
- * Default aPNTs price in USD (0.02 USD per aPNT)
77
- */
78
81
  export const DEFAULT_APNTS_PRICE_USD = "0.02";
79
- /**
80
- * Network Chain IDs
81
- */
82
82
  export const CHAIN_SEPOLIA = 11155111;
83
83
  export const CHAIN_MAINNET = 1;
84
- /**
85
- * Default Values
86
- */
87
84
  export const DEFAULT_TOKEN_SYMBOL = 'GT';
88
85
  export const DEFAULT_TOKEN_NAME = 'Governance Token';
89
- /**
90
- * Gas Limits
91
- */
92
86
  export const DEFAULT_VERIFICATION_GAS_LIMIT = 200000n;
93
87
  export const DEFAULT_CALL_GAS_LIMIT = 100000n;
94
88
  export const DEFAULT_PRE_VERIFICATION_GAS = 50000n;
95
- /**
96
- * Timeouts
97
- */
98
89
  export const DEFAULT_TIMEOUT_MS = 30000;
@@ -0,0 +1,2 @@
1
+ import './node-init.js';
2
+ export * from './index.js';
@@ -0,0 +1,2 @@
1
+ import './node-init.js';
2
+ export * from './index.js';
@@ -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
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { createRequire } from 'module';
2
+ import { applyConfig } from './constants.js';
3
+ const require = createRequire(import.meta.url);
4
+ const network = process.env.NETWORK || 'anvil';
5
+ try {
6
+ const config = require(`../../../config.${network}.json`);
7
+ applyConfig(config);
8
+ }
9
+ catch (e) {
10
+ // console.warn(`Warning: Could not load config.${network}.json`);
11
+ }
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "@aastar/core",
3
- "version": "0.16.14",
3
+ "version": "0.16.18",
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",
11
+ "exports": {
12
+ ".": {
13
+ "browser": "./dist/index.js",
14
+ "import": "./dist/index.node.js",
15
+ "require": "./dist/index.node.js"
16
+ }
17
+ },
10
18
  "files": [
11
19
  "dist"
12
20
  ],