qvtx-developer-kit 1.0.0 → 1.2.0

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 (49) hide show
  1. package/.env.example +108 -0
  2. package/README.md +0 -0
  3. package/abis/QVTXBridge.json +273 -0
  4. package/abis/QVTXDirectPurchase.json +621 -0
  5. package/abis/QVTXGovernance.json +267 -0
  6. package/abis/QVTXNFT.json +370 -0
  7. package/abis/QVTXRewards.json +155 -0
  8. package/abis/QVTXToken.json +311 -0
  9. package/abis/QVTXVesting.json +216 -0
  10. package/abis/index.js +16 -0
  11. package/bin/qvtx-developer-cli.js +99 -0
  12. package/config/index.js +108 -0
  13. package/config/networks.js +247 -0
  14. package/examples/basic-usage.js +39 -0
  15. package/examples/bridge-example.js +123 -0
  16. package/examples/direct-purchase.js +300 -0
  17. package/examples/governance-example.js +140 -0
  18. package/examples/nft-example.js +141 -0
  19. package/examples/staking-example.js +96 -0
  20. package/index.js +145 -0
  21. package/languages/blockchain_ai_sdk.js +0 -0
  22. package/languages/node_sdk.js +0 -0
  23. package/languages/solana_sdk.js +383 -0
  24. package/package.json +30 -3
  25. package/purchase/index.js +567 -0
  26. package/rewards/index.js +71 -0
  27. package/smart-contracts/QVTXBridge.sol +305 -0
  28. package/smart-contracts/QVTXDirectPurchase.sol +543 -0
  29. package/smart-contracts/QVTXGovernance.sol +325 -0
  30. package/smart-contracts/QVTXNFT.sol +338 -0
  31. package/smart-contracts/QVTXRewards.sol +102 -0
  32. package/smart-contracts/QVTXToken.sol +227 -0
  33. package/smart-contracts/QVTXVesting.sol +411 -0
  34. package/smart-contracts/interfaces/IERC20.sol +14 -0
  35. package/smart-contracts/interfaces/IERC20Metadata.sol +8 -0
  36. package/smart-contracts/interfaces/IERC721.sol +18 -0
  37. package/smart-contracts/interfaces/IERC721Metadata.sol +8 -0
  38. package/smart-contracts/interfaces/IERC721Receiver.sol +11 -0
  39. package/storage/index.js +112 -0
  40. package/templates/contract/ERC20Token.sol +116 -0
  41. package/templates/dapp/index.html +93 -0
  42. package/test/index.js +182 -0
  43. package/tools/build-tool.js +63 -0
  44. package/tools/create-template.js +116 -0
  45. package/tools/deploy-tool.js +55 -0
  46. package/tools/generate-docs.js +149 -0
  47. package/tools/init-project.js +138 -0
  48. package/tools/run-tests.js +64 -0
  49. package/types/index.d.ts +386 -0
@@ -0,0 +1,216 @@
1
+ {
2
+ "contractName": "QVTXVesting",
3
+ "abi": [
4
+ {
5
+ "inputs": [{"internalType": "address", "name": "_qvtxToken", "type": "address"}],
6
+ "stateMutability": "nonpayable",
7
+ "type": "constructor"
8
+ },
9
+ {
10
+ "anonymous": false,
11
+ "inputs": [
12
+ {"indexed": true, "internalType": "address", "name": "previousOwner", "type": "address"},
13
+ {"indexed": true, "internalType": "address", "name": "newOwner", "type": "address"}
14
+ ],
15
+ "name": "OwnershipTransferred",
16
+ "type": "event"
17
+ },
18
+ {
19
+ "anonymous": false,
20
+ "inputs": [
21
+ {"indexed": true, "internalType": "uint256", "name": "scheduleId", "type": "uint256"},
22
+ {"indexed": true, "internalType": "address", "name": "beneficiary", "type": "address"},
23
+ {"indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256"}
24
+ ],
25
+ "name": "TokensReleased",
26
+ "type": "event"
27
+ },
28
+ {
29
+ "anonymous": false,
30
+ "inputs": [
31
+ {"indexed": true, "internalType": "uint256", "name": "scheduleId", "type": "uint256"},
32
+ {"indexed": false, "internalType": "uint256", "name": "refundAmount", "type": "uint256"}
33
+ ],
34
+ "name": "VestingRevoked",
35
+ "type": "event"
36
+ },
37
+ {
38
+ "anonymous": false,
39
+ "inputs": [
40
+ {"indexed": true, "internalType": "uint256", "name": "scheduleId", "type": "uint256"},
41
+ {"indexed": true, "internalType": "address", "name": "beneficiary", "type": "address"},
42
+ {"indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256"},
43
+ {"indexed": false, "internalType": "uint8", "name": "vestingType", "type": "uint8"}
44
+ ],
45
+ "name": "VestingScheduleCreated",
46
+ "type": "event"
47
+ },
48
+ {
49
+ "inputs": [
50
+ {"internalType": "address[]", "name": "beneficiaries", "type": "address[]"},
51
+ {"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"},
52
+ {"internalType": "uint8", "name": "vestingType", "type": "uint8"}
53
+ ],
54
+ "name": "batchCreateVestingSchedules",
55
+ "outputs": [{"internalType": "uint256[]", "name": "", "type": "uint256[]"}],
56
+ "stateMutability": "nonpayable",
57
+ "type": "function"
58
+ },
59
+ {
60
+ "inputs": [
61
+ {"internalType": "address", "name": "beneficiary", "type": "address"},
62
+ {"internalType": "uint256", "name": "amount", "type": "uint256"},
63
+ {"internalType": "uint256", "name": "startTime", "type": "uint256"},
64
+ {"internalType": "uint256", "name": "cliffDuration", "type": "uint256"},
65
+ {"internalType": "uint256", "name": "vestingDuration", "type": "uint256"},
66
+ {"internalType": "uint256", "name": "slicePeriod", "type": "uint256"},
67
+ {"internalType": "bool", "name": "revocable", "type": "bool"}
68
+ ],
69
+ "name": "createCustomVestingSchedule",
70
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
71
+ "stateMutability": "nonpayable",
72
+ "type": "function"
73
+ },
74
+ {
75
+ "inputs": [
76
+ {"internalType": "address", "name": "beneficiary", "type": "address"},
77
+ {"internalType": "uint256", "name": "amount", "type": "uint256"},
78
+ {"internalType": "uint8", "name": "vestingType", "type": "uint8"}
79
+ ],
80
+ "name": "createVestingSchedule",
81
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
82
+ "stateMutability": "nonpayable",
83
+ "type": "function"
84
+ },
85
+ {
86
+ "inputs": [],
87
+ "name": "emergencyWithdraw",
88
+ "outputs": [],
89
+ "stateMutability": "nonpayable",
90
+ "type": "function"
91
+ },
92
+ {
93
+ "inputs": [{"internalType": "address", "name": "beneficiary", "type": "address"}],
94
+ "name": "getBeneficiarySchedules",
95
+ "outputs": [{"internalType": "uint256[]", "name": "", "type": "uint256[]"}],
96
+ "stateMutability": "view",
97
+ "type": "function"
98
+ },
99
+ {
100
+ "inputs": [{"internalType": "uint256", "name": "scheduleId", "type": "uint256"}],
101
+ "name": "getReleasableAmount",
102
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
103
+ "stateMutability": "view",
104
+ "type": "function"
105
+ },
106
+ {
107
+ "inputs": [{"internalType": "address", "name": "beneficiary", "type": "address"}],
108
+ "name": "getTotalReleasable",
109
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
110
+ "stateMutability": "view",
111
+ "type": "function"
112
+ },
113
+ {
114
+ "inputs": [{"internalType": "uint256", "name": "scheduleId", "type": "uint256"}],
115
+ "name": "getVestedAmount",
116
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
117
+ "stateMutability": "view",
118
+ "type": "function"
119
+ },
120
+ {
121
+ "inputs": [{"internalType": "uint256", "name": "scheduleId", "type": "uint256"}],
122
+ "name": "getVestingSchedule",
123
+ "outputs": [
124
+ {
125
+ "components": [
126
+ {"internalType": "uint256", "name": "id", "type": "uint256"},
127
+ {"internalType": "address", "name": "beneficiary", "type": "address"},
128
+ {"internalType": "uint256", "name": "totalAmount", "type": "uint256"},
129
+ {"internalType": "uint256", "name": "releasedAmount", "type": "uint256"},
130
+ {"internalType": "uint256", "name": "startTime", "type": "uint256"},
131
+ {"internalType": "uint256", "name": "cliffDuration", "type": "uint256"},
132
+ {"internalType": "uint256", "name": "vestingDuration", "type": "uint256"},
133
+ {"internalType": "uint256", "name": "slicePeriod", "type": "uint256"},
134
+ {"internalType": "bool", "name": "revocable", "type": "bool"},
135
+ {"internalType": "bool", "name": "revoked", "type": "bool"},
136
+ {"internalType": "uint8", "name": "vestingType", "type": "uint8"}
137
+ ],
138
+ "internalType": "struct QVTXVesting.VestingSchedule",
139
+ "name": "",
140
+ "type": "tuple"
141
+ }
142
+ ],
143
+ "stateMutability": "view",
144
+ "type": "function"
145
+ },
146
+ {
147
+ "inputs": [],
148
+ "name": "owner",
149
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
150
+ "stateMutability": "view",
151
+ "type": "function"
152
+ },
153
+ {
154
+ "inputs": [{"internalType": "uint256", "name": "scheduleId", "type": "uint256"}],
155
+ "name": "release",
156
+ "outputs": [],
157
+ "stateMutability": "nonpayable",
158
+ "type": "function"
159
+ },
160
+ {
161
+ "inputs": [],
162
+ "name": "releaseAll",
163
+ "outputs": [],
164
+ "stateMutability": "nonpayable",
165
+ "type": "function"
166
+ },
167
+ {
168
+ "inputs": [{"internalType": "uint256", "name": "scheduleId", "type": "uint256"}],
169
+ "name": "revoke",
170
+ "outputs": [],
171
+ "stateMutability": "nonpayable",
172
+ "type": "function"
173
+ },
174
+ {
175
+ "inputs": [],
176
+ "name": "scheduleCount",
177
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
178
+ "stateMutability": "view",
179
+ "type": "function"
180
+ },
181
+ {
182
+ "inputs": [],
183
+ "name": "totalReleased",
184
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
185
+ "stateMutability": "view",
186
+ "type": "function"
187
+ },
188
+ {
189
+ "inputs": [],
190
+ "name": "totalVested",
191
+ "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
192
+ "stateMutability": "view",
193
+ "type": "function"
194
+ },
195
+ {
196
+ "inputs": [{"internalType": "address", "name": "newOwner", "type": "address"}],
197
+ "name": "transferOwnership",
198
+ "outputs": [],
199
+ "stateMutability": "nonpayable",
200
+ "type": "function"
201
+ },
202
+ {
203
+ "inputs": [
204
+ {"internalType": "uint8", "name": "vestingType", "type": "uint8"},
205
+ {"internalType": "uint256", "name": "cliffDuration", "type": "uint256"},
206
+ {"internalType": "uint256", "name": "vestingDuration", "type": "uint256"},
207
+ {"internalType": "uint256", "name": "slicePeriod", "type": "uint256"},
208
+ {"internalType": "bool", "name": "revocable", "type": "bool"}
209
+ ],
210
+ "name": "updatePresetConfig",
211
+ "outputs": [],
212
+ "stateMutability": "nonpayable",
213
+ "type": "function"
214
+ }
215
+ ]
216
+ }
package/abis/index.js ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * QVTX Contract ABIs
5
+ * Export all contract ABIs for easy importing
6
+ */
7
+
8
+ module.exports = {
9
+ QVTXToken: require('./QVTXToken.json'),
10
+ QVTXGovernance: require('./QVTXGovernance.json'),
11
+ QVTXBridge: require('./QVTXBridge.json'),
12
+ QVTXNFT: require('./QVTXNFT.json'),
13
+ QVTXVesting: require('./QVTXVesting.json'),
14
+ QVTXRewards: require('./QVTXRewards.json'),
15
+ QVTXDirectPurchase: require('./QVTXDirectPurchase.json')
16
+ };
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { Command } = require('commander');
5
+ const path = require('path');
6
+ const fs = require('fs');
7
+
8
+ const program = new Command();
9
+
10
+ program
11
+ .name('qvtx')
12
+ .description('QVTX Developer Kit CLI - Build infinite throughput blockchain applications')
13
+ .version('1.0.0');
14
+
15
+ program
16
+ .command('init [project-name]')
17
+ .description('Initialize a new QVTX project')
18
+ .option('-t, --template <type>', 'Project template (dapp, contract, full)', 'dapp')
19
+ .action(async (projectName, options) => {
20
+ const initScript = require('../tools/init-project');
21
+ await initScript.run(projectName, options);
22
+ });
23
+
24
+ program
25
+ .command('create <type> [name]')
26
+ .description('Create a new component (dapp, contract)')
27
+ .action(async (type, name) => {
28
+ const createScript = require('../tools/create-template');
29
+ await createScript.run(type, name);
30
+ });
31
+
32
+ program
33
+ .command('deploy [contract]')
34
+ .description('Deploy smart contract')
35
+ .option('-n, --network <network>', 'Target network', 'ethereum')
36
+ .option('-e, --env <environment>', 'Environment (mainnet, testnet)', 'testnet')
37
+ .action(async (contract, options) => {
38
+ const deployScript = require('../tools/deploy-tool');
39
+ await deployScript.run(contract, options);
40
+ });
41
+
42
+ program
43
+ .command('test [pattern]')
44
+ .description('Run tests')
45
+ .option('-v, --verbose', 'Verbose output')
46
+ .action(async (pattern, options) => {
47
+ const testScript = require('../tools/run-tests');
48
+ await testScript.run(pattern, options);
49
+ });
50
+
51
+ program
52
+ .command('build')
53
+ .description('Build the project')
54
+ .option('-p, --production', 'Production build')
55
+ .action(async (options) => {
56
+ const buildScript = require('../tools/build-tool');
57
+ await buildScript.run(options);
58
+ });
59
+
60
+ program
61
+ .command('docs')
62
+ .description('Generate documentation')
63
+ .action(async () => {
64
+ const docsScript = require('../tools/generate-docs');
65
+ await docsScript.run();
66
+ });
67
+
68
+ program
69
+ .command('networks')
70
+ .description('List supported networks')
71
+ .action(() => {
72
+ const QVTX = require('../index');
73
+ const kit = new QVTX();
74
+ console.log('\nSupported Networks:\n');
75
+ const networks = kit.getNetworks();
76
+ Object.entries(networks).forEach(([name, envs]) => {
77
+ console.log(` ${name}:`);
78
+ Object.keys(envs).forEach(env => {
79
+ console.log(` - ${env}`);
80
+ });
81
+ });
82
+ console.log('');
83
+ });
84
+
85
+ program
86
+ .command('info')
87
+ .description('Show QVTX token info')
88
+ .action(() => {
89
+ const QVTX = require('../index');
90
+ const kit = new QVTX();
91
+ const info = kit.getTokenInfo();
92
+ console.log('\nQVTX Token Info:\n');
93
+ console.log(` Name: ${info.name}`);
94
+ console.log(` Symbol: ${info.symbol}`);
95
+ console.log(` Decimals: ${info.decimals}`);
96
+ console.log(` Total Supply: 1,000,000,000 QVTX\n`);
97
+ });
98
+
99
+ program.parse();
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * QVTX Configuration Module
5
+ * Central configuration management
6
+ */
7
+
8
+ const networks = require('./networks');
9
+ const path = require('path');
10
+ const fs = require('fs');
11
+
12
+ // Load environment variables from .env if exists
13
+ function loadEnv(envPath) {
14
+ const dotenvPath = envPath || path.join(process.cwd(), '.env');
15
+
16
+ if (fs.existsSync(dotenvPath)) {
17
+ const content = fs.readFileSync(dotenvPath, 'utf8');
18
+ const lines = content.split('\n');
19
+
20
+ for (const line of lines) {
21
+ const trimmed = line.trim();
22
+ if (trimmed && !trimmed.startsWith('#')) {
23
+ const [key, ...valueParts] = trimmed.split('=');
24
+ const value = valueParts.join('=').trim();
25
+ if (key && !process.env[key]) {
26
+ process.env[key] = value;
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ // Default configuration
34
+ const DEFAULT_CONFIG = {
35
+ network: 'ethereum',
36
+ environment: 'mainnet',
37
+ debug: false,
38
+ timeout: 30000,
39
+ retries: 3,
40
+ gasMultiplier: 1.2
41
+ };
42
+
43
+ // Get configuration value
44
+ function get(key, defaultValue) {
45
+ const envKey = `QVTX_${key.toUpperCase()}`;
46
+ return process.env[envKey] || defaultValue;
47
+ }
48
+
49
+ // Get private key (with validation)
50
+ function getPrivateKey() {
51
+ const key = process.env.PRIVATE_KEY;
52
+ if (!key) {
53
+ throw new Error('PRIVATE_KEY environment variable not set');
54
+ }
55
+ if (!key.startsWith('0x')) {
56
+ return '0x' + key;
57
+ }
58
+ return key;
59
+ }
60
+
61
+ // Get RPC URL for network
62
+ function getRpcUrl(network, environment) {
63
+ const envKey = `${network.toUpperCase()}_RPC`;
64
+ if (process.env[envKey]) {
65
+ return process.env[envKey];
66
+ }
67
+
68
+ const networkConfig = networks.getNetwork(network, environment);
69
+ let rpc = networkConfig.rpc;
70
+
71
+ // Replace API key placeholders
72
+ if (rpc.includes('${INFURA_API_KEY}') && process.env.INFURA_API_KEY) {
73
+ rpc = rpc.replace('${INFURA_API_KEY}', process.env.INFURA_API_KEY);
74
+ }
75
+ if (rpc.includes('${ALCHEMY_API_KEY}') && process.env.ALCHEMY_API_KEY) {
76
+ rpc = rpc.replace('${ALCHEMY_API_KEY}', process.env.ALCHEMY_API_KEY);
77
+ }
78
+
79
+ return rpc;
80
+ }
81
+
82
+ // Get contract address
83
+ function getContractAddress(contractName, network = 'ethereum') {
84
+ const envKey = `QVTX_${contractName.toUpperCase()}_${network.toUpperCase()}`;
85
+ return process.env[envKey] || null;
86
+ }
87
+
88
+ // Create configuration object
89
+ function createConfig(options = {}) {
90
+ return {
91
+ ...DEFAULT_CONFIG,
92
+ ...options,
93
+ getPrivateKey,
94
+ getRpcUrl: (net, env) => getRpcUrl(net || options.network, env || options.environment),
95
+ getContractAddress
96
+ };
97
+ }
98
+
99
+ module.exports = {
100
+ loadEnv,
101
+ get,
102
+ getPrivateKey,
103
+ getRpcUrl,
104
+ getContractAddress,
105
+ createConfig,
106
+ DEFAULT_CONFIG,
107
+ ...networks
108
+ };
@@ -0,0 +1,247 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * QVTX Network Configurations
5
+ * Supported blockchain networks and their settings
6
+ */
7
+
8
+ const NETWORKS = {
9
+ // Ethereum
10
+ ethereum: {
11
+ mainnet: {
12
+ chainId: 1,
13
+ name: 'Ethereum Mainnet',
14
+ rpc: 'https://eth.llamarpc.com',
15
+ rpcAlternatives: [
16
+ 'https://mainnet.infura.io/v3/${INFURA_API_KEY}',
17
+ 'https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}',
18
+ 'https://cloudflare-eth.com'
19
+ ],
20
+ nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
21
+ blockExplorer: 'https://etherscan.io',
22
+ avgBlockTime: 12
23
+ },
24
+ goerli: {
25
+ chainId: 5,
26
+ name: 'Goerli Testnet',
27
+ rpc: 'https://goerli.infura.io/v3/${INFURA_API_KEY}',
28
+ nativeCurrency: { name: 'Goerli Ether', symbol: 'ETH', decimals: 18 },
29
+ blockExplorer: 'https://goerli.etherscan.io',
30
+ faucet: 'https://goerlifaucet.com',
31
+ avgBlockTime: 12
32
+ },
33
+ sepolia: {
34
+ chainId: 11155111,
35
+ name: 'Sepolia Testnet',
36
+ rpc: 'https://sepolia.infura.io/v3/${INFURA_API_KEY}',
37
+ nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
38
+ blockExplorer: 'https://sepolia.etherscan.io',
39
+ faucet: 'https://sepoliafaucet.com',
40
+ avgBlockTime: 12
41
+ }
42
+ },
43
+
44
+ // BNB Smart Chain
45
+ bsc: {
46
+ mainnet: {
47
+ chainId: 56,
48
+ name: 'BNB Smart Chain',
49
+ rpc: 'https://bsc-dataseed.binance.org/',
50
+ rpcAlternatives: [
51
+ 'https://bsc-dataseed1.defibit.io/',
52
+ 'https://bsc-dataseed1.ninicoin.io/'
53
+ ],
54
+ nativeCurrency: { name: 'BNB', symbol: 'BNB', decimals: 18 },
55
+ blockExplorer: 'https://bscscan.com',
56
+ avgBlockTime: 3
57
+ },
58
+ testnet: {
59
+ chainId: 97,
60
+ name: 'BSC Testnet',
61
+ rpc: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
62
+ nativeCurrency: { name: 'Test BNB', symbol: 'tBNB', decimals: 18 },
63
+ blockExplorer: 'https://testnet.bscscan.com',
64
+ faucet: 'https://testnet.binance.org/faucet-smart',
65
+ avgBlockTime: 3
66
+ }
67
+ },
68
+
69
+ // Polygon
70
+ polygon: {
71
+ mainnet: {
72
+ chainId: 137,
73
+ name: 'Polygon Mainnet',
74
+ rpc: 'https://polygon-rpc.com/',
75
+ rpcAlternatives: [
76
+ 'https://rpc-mainnet.maticvigil.com/',
77
+ 'https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}'
78
+ ],
79
+ nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 },
80
+ blockExplorer: 'https://polygonscan.com',
81
+ avgBlockTime: 2
82
+ },
83
+ mumbai: {
84
+ chainId: 80001,
85
+ name: 'Mumbai Testnet',
86
+ rpc: 'https://rpc-mumbai.maticvigil.com/',
87
+ nativeCurrency: { name: 'Test MATIC', symbol: 'MATIC', decimals: 18 },
88
+ blockExplorer: 'https://mumbai.polygonscan.com',
89
+ faucet: 'https://faucet.polygon.technology/',
90
+ avgBlockTime: 2
91
+ }
92
+ },
93
+
94
+ // Arbitrum
95
+ arbitrum: {
96
+ mainnet: {
97
+ chainId: 42161,
98
+ name: 'Arbitrum One',
99
+ rpc: 'https://arb1.arbitrum.io/rpc',
100
+ rpcAlternatives: [
101
+ 'https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}'
102
+ ],
103
+ nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
104
+ blockExplorer: 'https://arbiscan.io',
105
+ avgBlockTime: 0.25
106
+ },
107
+ goerli: {
108
+ chainId: 421613,
109
+ name: 'Arbitrum Goerli',
110
+ rpc: 'https://goerli-rollup.arbitrum.io/rpc',
111
+ nativeCurrency: { name: 'Goerli Ether', symbol: 'ETH', decimals: 18 },
112
+ blockExplorer: 'https://goerli.arbiscan.io',
113
+ faucet: 'https://faucet.arbitrum.io/',
114
+ avgBlockTime: 0.25
115
+ }
116
+ },
117
+
118
+ // Avalanche
119
+ avalanche: {
120
+ mainnet: {
121
+ chainId: 43114,
122
+ name: 'Avalanche C-Chain',
123
+ rpc: 'https://api.avax.network/ext/bc/C/rpc',
124
+ rpcAlternatives: [
125
+ 'https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}'
126
+ ],
127
+ nativeCurrency: { name: 'AVAX', symbol: 'AVAX', decimals: 18 },
128
+ blockExplorer: 'https://snowtrace.io',
129
+ avgBlockTime: 2
130
+ },
131
+ fuji: {
132
+ chainId: 43113,
133
+ name: 'Avalanche Fuji',
134
+ rpc: 'https://api.avax-test.network/ext/bc/C/rpc',
135
+ nativeCurrency: { name: 'Test AVAX', symbol: 'AVAX', decimals: 18 },
136
+ blockExplorer: 'https://testnet.snowtrace.io',
137
+ faucet: 'https://faucet.avax.network/',
138
+ avgBlockTime: 2
139
+ }
140
+ },
141
+
142
+ // Optimism
143
+ optimism: {
144
+ mainnet: {
145
+ chainId: 10,
146
+ name: 'Optimism',
147
+ rpc: 'https://mainnet.optimism.io',
148
+ rpcAlternatives: [
149
+ 'https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}'
150
+ ],
151
+ nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
152
+ blockExplorer: 'https://optimistic.etherscan.io',
153
+ avgBlockTime: 2
154
+ },
155
+ goerli: {
156
+ chainId: 420,
157
+ name: 'Optimism Goerli',
158
+ rpc: 'https://goerli.optimism.io',
159
+ nativeCurrency: { name: 'Goerli Ether', symbol: 'ETH', decimals: 18 },
160
+ blockExplorer: 'https://goerli-optimism.etherscan.io',
161
+ avgBlockTime: 2
162
+ }
163
+ },
164
+
165
+ // Solana (different structure)
166
+ solana: {
167
+ 'mainnet-beta': {
168
+ name: 'Solana Mainnet',
169
+ rpc: 'https://api.mainnet-beta.solana.com',
170
+ rpcAlternatives: [
171
+ 'https://solana-api.projectserum.com'
172
+ ],
173
+ blockExplorer: 'https://explorer.solana.com'
174
+ },
175
+ devnet: {
176
+ name: 'Solana Devnet',
177
+ rpc: 'https://api.devnet.solana.com',
178
+ blockExplorer: 'https://explorer.solana.com?cluster=devnet',
179
+ faucet: 'https://solfaucet.com/'
180
+ },
181
+ testnet: {
182
+ name: 'Solana Testnet',
183
+ rpc: 'https://api.testnet.solana.com',
184
+ blockExplorer: 'https://explorer.solana.com?cluster=testnet'
185
+ }
186
+ }
187
+ };
188
+
189
+ // Helper functions
190
+ function getNetwork(name, environment = 'mainnet') {
191
+ const network = NETWORKS[name.toLowerCase()];
192
+ if (!network) {
193
+ throw new Error(`Unknown network: ${name}`);
194
+ }
195
+ const env = network[environment];
196
+ if (!env) {
197
+ throw new Error(`Unknown environment: ${environment} for network ${name}`);
198
+ }
199
+ return env;
200
+ }
201
+
202
+ function getChainById(chainId) {
203
+ for (const [networkName, envs] of Object.entries(NETWORKS)) {
204
+ for (const [envName, config] of Object.entries(envs)) {
205
+ if (config.chainId === chainId) {
206
+ return { network: networkName, environment: envName, ...config };
207
+ }
208
+ }
209
+ }
210
+ return null;
211
+ }
212
+
213
+ function getAllNetworks() {
214
+ return NETWORKS;
215
+ }
216
+
217
+ function getMainnets() {
218
+ const mainnets = {};
219
+ for (const [name, envs] of Object.entries(NETWORKS)) {
220
+ if (envs.mainnet || envs['mainnet-beta']) {
221
+ mainnets[name] = envs.mainnet || envs['mainnet-beta'];
222
+ }
223
+ }
224
+ return mainnets;
225
+ }
226
+
227
+ function getTestnets() {
228
+ const testnets = {};
229
+ for (const [name, envs] of Object.entries(NETWORKS)) {
230
+ for (const [envName, config] of Object.entries(envs)) {
231
+ if (envName !== 'mainnet' && envName !== 'mainnet-beta') {
232
+ if (!testnets[name]) testnets[name] = {};
233
+ testnets[name][envName] = config;
234
+ }
235
+ }
236
+ }
237
+ return testnets;
238
+ }
239
+
240
+ module.exports = {
241
+ NETWORKS,
242
+ getNetwork,
243
+ getChainById,
244
+ getAllNetworks,
245
+ getMainnets,
246
+ getTestnets
247
+ };