@luxexchange/config 1.0.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.
package/src/chains.ts ADDED
@@ -0,0 +1,224 @@
1
+ import { defineChain } from 'viem'
2
+
3
+ /**
4
+ * Lux Mainnet Chain Definition
5
+ */
6
+ export const luxMainnet = defineChain({
7
+ id: 96369,
8
+ name: 'Lux Mainnet',
9
+ nativeCurrency: {
10
+ name: 'LUX',
11
+ symbol: 'LUX',
12
+ decimals: 18,
13
+ },
14
+ rpcUrls: {
15
+ default: { http: ['https://api.lux.network/mainnet/ext/bc/C/rpc'] },
16
+ public: { http: ['https://api.lux.network/mainnet/ext/bc/C/rpc'] },
17
+ },
18
+ blockExplorers: {
19
+ default: { name: 'Lux Explorer', url: 'https://explore.lux.network' },
20
+ },
21
+ contracts: {
22
+ multicall3: {
23
+ address: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F',
24
+ },
25
+ },
26
+ })
27
+
28
+ /**
29
+ * Lux Testnet Chain Definition
30
+ */
31
+ export const luxTestnet = defineChain({
32
+ id: 96368,
33
+ name: 'Lux Testnet',
34
+ nativeCurrency: {
35
+ name: 'LUX',
36
+ symbol: 'LUX',
37
+ decimals: 18,
38
+ },
39
+ rpcUrls: {
40
+ default: { http: ['https://api.lux.network/testnet/ext/bc/C/rpc'] },
41
+ public: { http: ['https://api.lux.network/testnet/ext/bc/C/rpc'] },
42
+ },
43
+ blockExplorers: {
44
+ default: { name: 'Lux Testnet Explorer', url: 'https://explore.lux-test.network' },
45
+ },
46
+ contracts: {
47
+ multicall3: {
48
+ address: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F',
49
+ },
50
+ },
51
+ testnet: true,
52
+ })
53
+
54
+ /**
55
+ * Zoo Mainnet Chain Definition
56
+ */
57
+ export const zooMainnet = defineChain({
58
+ id: 200200,
59
+ name: 'Zoo Network',
60
+ nativeCurrency: {
61
+ name: 'ZOO',
62
+ symbol: 'ZOO',
63
+ decimals: 18,
64
+ },
65
+ rpcUrls: {
66
+ default: { http: ['https://api.zoo.network/rpc'] },
67
+ public: { http: ['https://api.zoo.network/rpc'] },
68
+ },
69
+ blockExplorers: {
70
+ default: { name: 'Zoo Explorer', url: 'https://explore.zoo.network' },
71
+ },
72
+ })
73
+
74
+ /**
75
+ * Zoo Testnet Chain Definition
76
+ */
77
+ export const zooTestnet = defineChain({
78
+ id: 200201,
79
+ name: 'Zoo Testnet',
80
+ nativeCurrency: {
81
+ name: 'ZOO',
82
+ symbol: 'ZOO',
83
+ decimals: 18,
84
+ },
85
+ rpcUrls: {
86
+ default: { http: ['https://api.zoo-test.network/rpc'] },
87
+ public: { http: ['https://api.zoo-test.network/rpc'] },
88
+ },
89
+ blockExplorers: {
90
+ default: { name: 'Zoo Testnet Explorer', url: 'https://explore.zoo-test.network' },
91
+ },
92
+ testnet: true,
93
+ })
94
+
95
+ /**
96
+ * Hanzo Network (AI Coin) Chain Definition
97
+ */
98
+ export const hanzoMainnet = defineChain({
99
+ id: 36963,
100
+ name: 'Hanzo Network',
101
+ nativeCurrency: {
102
+ name: 'HANZO',
103
+ symbol: 'HANZO',
104
+ decimals: 18,
105
+ },
106
+ rpcUrls: {
107
+ default: { http: ['https://api.lux.network/mainnet/ext/bc/2GiQb73CeJESjc4omFv2YtQHZrRgJf25NXPzAr5J6UNHRcDV2F/rpc'] },
108
+ public: { http: ['https://api.lux.network/mainnet/ext/bc/2GiQb73CeJESjc4omFv2YtQHZrRgJf25NXPzAr5J6UNHRcDV2F/rpc'] },
109
+ },
110
+ blockExplorers: {
111
+ default: { name: 'Hanzo Explorer', url: 'https://explore-hanzo.lux.network' },
112
+ },
113
+ })
114
+
115
+ /**
116
+ * SPC Network Chain Definition
117
+ */
118
+ export const spcMainnet = defineChain({
119
+ id: 36911,
120
+ name: 'SPC Network',
121
+ nativeCurrency: {
122
+ name: 'SPC',
123
+ symbol: 'SPC',
124
+ decimals: 18,
125
+ },
126
+ rpcUrls: {
127
+ default: { http: ['https://api.lux.network/mainnet/ext/bc/rtjwvtE1tEvrokmpeYdTq7b2zqZgmybKwR5MLjKMGAR1W78dQ/rpc'] },
128
+ public: { http: ['https://api.lux.network/mainnet/ext/bc/rtjwvtE1tEvrokmpeYdTq7b2zqZgmybKwR5MLjKMGAR1W78dQ/rpc'] },
129
+ },
130
+ blockExplorers: {
131
+ default: { name: 'SPC Explorer', url: 'https://explore-spc.lux.network' },
132
+ },
133
+ })
134
+
135
+ /**
136
+ * Pars Network Chain Definition
137
+ */
138
+ export const parsMainnet = defineChain({
139
+ id: 494949,
140
+ name: 'Pars Network',
141
+ nativeCurrency: {
142
+ name: 'PARS',
143
+ symbol: 'PARS',
144
+ decimals: 18,
145
+ },
146
+ rpcUrls: {
147
+ default: { http: ['https://api.lux.network/mainnet/ext/bc/2pUskxqaL5Bpx7uRUGG1fDjPckjxQ4UKX4sLKeaS1NdSVBJd3F/rpc'] },
148
+ public: { http: ['https://api.lux.network/mainnet/ext/bc/2pUskxqaL5Bpx7uRUGG1fDjPckjxQ4UKX4sLKeaS1NdSVBJd3F/rpc'] },
149
+ },
150
+ blockExplorers: {
151
+ default: { name: 'Pars Explorer', url: 'https://explore-pars.lux.network' },
152
+ },
153
+ })
154
+
155
+ /**
156
+ * Liquid EVM (Liquidity Network) Chain Definition
157
+ */
158
+ export const liquidEvm = defineChain({
159
+ id: 8675311,
160
+ name: 'Liquid Network',
161
+ nativeCurrency: {
162
+ name: 'LQDTY',
163
+ symbol: 'LQDTY',
164
+ decimals: 18,
165
+ },
166
+ rpcUrls: {
167
+ default: { http: ['https://rpc.next.satschel.com'] },
168
+ public: { http: ['https://rpc.next.satschel.com'] },
169
+ },
170
+ blockExplorers: {
171
+ default: { name: 'Liquid Explorer', url: 'https://explore.next.satschel.com' },
172
+ },
173
+ })
174
+
175
+ /**
176
+ * Dev Chain Definition (for running local node with --dev)
177
+ */
178
+ export const luxDev = defineChain({
179
+ id: 1337,
180
+ name: 'Lux Dev',
181
+ nativeCurrency: {
182
+ name: 'LUX',
183
+ symbol: 'LUX',
184
+ decimals: 18,
185
+ },
186
+ rpcUrls: {
187
+ default: { http: ['http://localhost:8545/ext/bc/C/rpc'] },
188
+ public: { http: ['http://localhost:8545/ext/bc/C/rpc'] },
189
+ },
190
+ blockExplorers: {
191
+ default: { name: 'Dev', url: 'http://localhost:8545' },
192
+ },
193
+ testnet: false,
194
+ })
195
+
196
+ /**
197
+ * Chain IDs
198
+ */
199
+ export const LUX_MAINNET_ID = 96369
200
+ export const LUX_TESTNET_ID = 96368
201
+ export const ZOO_MAINNET_ID = 200200
202
+ export const ZOO_TESTNET_ID = 200201
203
+ export const HANZO_MAINNET_ID = 36963
204
+ export const SPC_MAINNET_ID = 36911
205
+ export const PARS_MAINNET_ID = 494949
206
+ export const LIQUID_EVM_ID = 8675311
207
+ export const LUX_DEV_ID = 1337
208
+
209
+ /**
210
+ * All supported chains
211
+ */
212
+ export const supportedChains = [
213
+ luxMainnet,
214
+ luxTestnet,
215
+ zooMainnet,
216
+ zooTestnet,
217
+ hanzoMainnet,
218
+ spcMainnet,
219
+ parsMainnet,
220
+ liquidEvm,
221
+ luxDev,
222
+ ] as const
223
+
224
+ export type SupportedChainId = typeof supportedChains[number]['id']
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Naming requirements for different environments:
3
+ * - Web ENV vars: must have process.env.REACT_APP_<var_name>
4
+ * - Extension ENV vars: must have process.env.<var_name>
5
+ * - Mobile ENV vars: must have BOTH process.env.<var_name> and <var_name>
6
+ *
7
+ * The CI requires web vars to have the required 'REACT_APP_' prefix. The react-dot-env library doesnt integrate with CI correctly,
8
+ * so we pull from github secrets directly with process.env.<var_name> for both extension and mobile. <var_name> is used for local mobile builds.
9
+ */
10
+
11
+ export interface Config {
12
+ alchemyApiKey: string
13
+ amplitudeProxyUrlOverride: string
14
+ apiBaseUrlOverride: string
15
+ apiBaseUrlV2Override: string
16
+ appsflyerApiKey: string
17
+ appsflyerAppId: string
18
+ blockaidProxyUrl: string
19
+ datadogClientToken: string
20
+ datadogProjectId: string
21
+ isE2ETest: boolean
22
+ forApiUrlOverride: string
23
+ graphqlUrlOverride: string
24
+ gChainGraphqlUrl: string
25
+ includePrototypeFeatures: string
26
+ infuraKey: string
27
+ isVercelEnvironment: boolean
28
+ jupiterProxyUrl: string
29
+ onesignalAppId: string
30
+ quicknodeEndpointName: string
31
+ quicknodeEndpointToken: string
32
+ scantasticApiUrlOverride: string
33
+ statsigProxyUrlOverride: string
34
+ statsigApiKey: string
35
+ tradingApiKey: string
36
+ tradingApiUrlOverride: string
37
+ tradingApiWebTestEnv: string
38
+ liquidityServiceUrlOverride: string
39
+ luxApiKey: string
40
+ unitagsApiUrlOverride: string
41
+ luxNotifApiBaseUrlOverride: string
42
+ entryGatewayApiUrlOverride: string
43
+ luxGatewayUrlOverride: string
44
+ walletConnectProjectId: string
45
+ walletConnectProjectIdBeta: string
46
+ walletConnectProjectIdDev: string
47
+ enableSessionService: boolean
48
+ enableSessionUpgradeAuto: boolean
49
+ enableEntryGatewayProxy: boolean
50
+ }
@@ -0,0 +1,193 @@
1
+ import type { Address } from 'viem'
2
+
3
+ /**
4
+ * Contract addresses for Lux Mainnet (96369)
5
+ */
6
+ export const LUX_MAINNET_CONTRACTS = {
7
+ // Core — verified on-chain 2026-03-05 (149M supply)
8
+ WLUX: '0x4888e4a2ee0f03051c72d2bd3acf755ed3498b3e' as Address,
9
+ MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F' as Address,
10
+
11
+ // Bridge tokens — verified on-chain via V3 pools and bridge MPC
12
+ LETH: '0x60E0a8167FC13dE89348978860466C9ceC24B9ba' as Address,
13
+ LBTC: '0x1E48D32a4F5e9f08DB9aE4959163300FaF8A6C8e' as Address,
14
+ LUSD: '0x848Cff46eb323f323b6Bbe1Df274E40793d7f2c2' as Address,
15
+ LSOL: '0x26B40f650156C7EbF9e087Dd0dca181Fe87625B7' as Address,
16
+ LTON: '0x3141b94b89691009b950c96e97Bff48e0C543E3C' as Address,
17
+ LAVAX: '0x0e4bD0DD67c15dECfBBBdbbE07FC9d51D737693D' as Address,
18
+
19
+ // AMM V2 (CREATE2) — 1 pair on-chain
20
+ V2_FACTORY: '0xD173926A10A0C4eCd3A51B1422270b65Df0551c1' as Address,
21
+ V2_ROUTER: '0xAe2cf1E403aAFE6C05A5b8Ef63EB19ba591d8511' as Address,
22
+
23
+ // AMM V3 (CREATE2) — 8+ pools, active trading, verified on-chain
24
+ V3_FACTORY: '0x80bBc7C4C7a59C899D1B37BC14539A22D5830a84' as Address,
25
+ V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58' as Address,
26
+ V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E' as Address,
27
+ V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275' as Address,
28
+ V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c' as Address,
29
+ V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28' as Address,
30
+
31
+ // Governance
32
+ STAKED_LUX: '0xc606302cd0722DD42c460B09930477d09993F913' as Address,
33
+ VLUX: '0x55833074AD22E2aAE81ad377A600340eC0bc7cbd' as Address,
34
+ KARMA: '0xc3d1efb6Eaedd048dDfE7066F1c719C7B6Ca43ad' as Address,
35
+ DLUX: '0xAAbD65c4Fe3d3f9d54A7C3C7B95B9eD359CC52A8' as Address,
36
+
37
+ // DeFi
38
+ MARKETS: '0x308EBD39eB5E27980944630A0af6F8B0d19e31C6' as Address,
39
+ PERP: '0x82312E295533Ab5167B306d5aBF7F3eB2C0D95fD' as Address,
40
+ } as const
41
+
42
+ /**
43
+ * Contract addresses for Lux Testnet (96368)
44
+ */
45
+ export const LUX_TESTNET_CONTRACTS = {
46
+ // Core — deployed via DeployMultiNetwork.s.sol 2026-02-27
47
+ WLUX: '0xDe5310d0Eccc04C8987cB66Ff6b89Ee793442C91' as Address,
48
+ MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F' as Address,
49
+
50
+ // Bridge tokens — deployed via DeployMultiNetwork.s.sol 2026-02-27
51
+ LETH: '0xA695a8A66fbe3E32d15a531db04185313595771A' as Address,
52
+ LBTC: '0x5a88986958ea76Dd043f834542724F081cA1443B' as Address,
53
+ LUSDC: '0x8a3fad1c7FB94461621351aa6A983B6f814F039c' as Address,
54
+
55
+ // AMM V2 — deployed via DeployMultiNetwork.s.sol 2026-02-27
56
+ V2_FACTORY: '0x1DD4e6cbC6B8FD032fCAD5A3B0a45e446A014637' as Address,
57
+ V2_ROUTER: '0xb06B31521Afc434F87Fe4852c98FC15A26c92aE8' as Address,
58
+ } as const
59
+
60
+ /**
61
+ * DEX Precompile addresses (native AMM - Lux v4 style singleton PoolManager)
62
+ * These provide sub-microsecond execution via native Go implementation
63
+ *
64
+ * Address format: 0x0000...00LPNUMBER (addresses end with LP number)
65
+ * LP-9010: DEX Precompile - Native HFT Order Book (PoolManager)
66
+ * LP-9011: Oracle Precompile - Multi-Source Price Aggregation
67
+ *
68
+ * @see ~/work/lux/precompile/registry/registry.go for the full address scheme
69
+ * @see ~/work/lux/dex/pkg/gateway/lux/provider.go for gateway implementation
70
+ */
71
+ export const DEX_PRECOMPILES = {
72
+ // Core DEX (LP-9010 series - Lux v4 style)
73
+ POOL_MANAGER: '0x0000000000000000000000000000000000009010' as Address, // LP-9010
74
+ SWAP_ROUTER: '0x0000000000000000000000000000000000009012' as Address, // LP-9012
75
+ HOOKS_REGISTRY: '0x0000000000000000000000000000000000009013' as Address, // LP-9013
76
+ FLASH_LOAN: '0x0000000000000000000000000000000000009014' as Address, // LP-9014
77
+
78
+ // DeFi Extensions
79
+ ORACLE_HUB: '0x0000000000000000000000000000000000009011' as Address, // LP-9011
80
+ CLOB: '0x0000000000000000000000000000000000009020' as Address, // LP-9020
81
+ VAULT: '0x0000000000000000000000000000000000009030' as Address, // LP-9030
82
+
83
+ // Bridges (LP-6xxx)
84
+ TELEPORT: '0x0000000000000000000000000000000000006010' as Address, // LP-6010
85
+ } as const
86
+
87
+ /**
88
+ * Contract addresses for Zoo Mainnet (200200)
89
+ */
90
+ export const ZOO_MAINNET_CONTRACTS = {
91
+ // Core — deployed via DeployMultiNetwork.s.sol 2026-03-04
92
+ WLUX: '0x5491216406daB99b7032b83765F36790E27F8A61' as Address,
93
+ LETH: '0x4870621EA8be7a383eFCfdA225249d35888bD9f2' as Address,
94
+ LBTC: '0x6fc44509a32E513bE1aa00d27bb298e63830C6A8' as Address,
95
+ LUSDC: '0xb2ee1CE7b84853b83AA08702aD0aD4D79711882D' as Address,
96
+ V2_FACTORY: '0xF034942c1140125b5c278aE9cEE1B488e915B2FE' as Address,
97
+ V2_ROUTER: '0x2cd306913e6546C59249b48d7c786A6D1d7ebE08' as Address,
98
+ MARKETS: '0x6B7D3c38A3e030B95E101927Ee6ff9913ef626d4' as Address,
99
+ } as const
100
+
101
+ /**
102
+ * Contract addresses for Hanzo Mainnet (36963)
103
+ * Shared subnet deployment addresses (nonce 0)
104
+ */
105
+ export const HANZO_MAINNET_CONTRACTS = {
106
+ // Deployed via DeployMultiNetwork.s.sol 2026-03-04
107
+ WLUX: '0xc65ea8882020Af7CDa7854d590C6Fcd34BF364ec' as Address,
108
+ LETH: '0x9378b62fC172d2A4f715d7ecF49DE0362f1BB702' as Address,
109
+ LBTC: '0x7fC4f8a926E47Fa3587C0d7658C00E7489e67916' as Address,
110
+ LUSDC: '0x51c3408B9A6a0B2446CCB78c72C846CEB76201FA' as Address,
111
+ V2_FACTORY: '0xDc384E006BAec602b0b2B2fe6f2712646EFb1e9D' as Address,
112
+ V2_ROUTER: '0x191067f88d61f9506555E88CEab9CF71deeD61A9' as Address,
113
+ MARKETS: '0x9BC44B0De1aBe2e436C8fA5Cd5cA519026b9D8fD' as Address,
114
+ } as const
115
+
116
+ /**
117
+ * Contract addresses for SPC Mainnet (36911)
118
+ * Shared subnet deployment addresses (nonce 0)
119
+ */
120
+ export const SPC_MAINNET_CONTRACTS = {
121
+ // NOT DEPLOYED — genesis key unknown, deployment blocked
122
+ WLUX: '0x0000000000000000000000000000000000000000' as Address,
123
+ LETH: '0x0000000000000000000000000000000000000000' as Address,
124
+ LBTC: '0x0000000000000000000000000000000000000000' as Address,
125
+ LUSDC: '0x0000000000000000000000000000000000000000' as Address,
126
+ V2_FACTORY: '0x0000000000000000000000000000000000000000' as Address,
127
+ V2_ROUTER: '0x0000000000000000000000000000000000000000' as Address,
128
+ MARKETS: '0x0000000000000000000000000000000000000000' as Address,
129
+ } as const
130
+
131
+ /**
132
+ * Contract addresses for Pars Mainnet (494949)
133
+ * Shared subnet deployment addresses (nonce 0)
134
+ */
135
+ export const PARS_MAINNET_CONTRACTS = {
136
+ // Deployed via DeployMultiNetwork.s.sol 2026-03-04
137
+ WLUX: '0x548F54Dfb32ea6cE4fa3515236696CF3d1b7D26a' as Address,
138
+ LETH: '0xe0f7E9A0cB1688ccA453995fd6e19AE4fbD9cBfd' as Address,
139
+ LBTC: '0x7d7cC8D05BB0F38D80b5Ce44b4b069A6FB769468' as Address,
140
+ LUSDC: '0xC5e4A6f54Be469551a342872C1aB83AB46f61b22' as Address,
141
+ V2_FACTORY: '0x84CF0A13db1be8e1F0676405cfcBC8b09692FD1C' as Address,
142
+ V2_ROUTER: '0x2382F7A49FA48E1F91Bec466c32e1D7F13ec8206' as Address,
143
+ MARKETS: '0x3589fd09e7dfF3f7653fc4965B7CE1b8d8fdA9Bd' as Address,
144
+ } as const
145
+
146
+ /**
147
+ * Contract addresses for Lux Dev (1337)
148
+ * Deterministic CREATE addresses from DeployFullStack.s.sol deployed by anvil account 0
149
+ * Account 0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
150
+ */
151
+ export const LUX_DEV_CONTRACTS = {
152
+ // Core - Nonce 0
153
+ WLUX: '0x5FbDB2315678afecb367f032d93F642f64180aa3' as Address,
154
+ MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F' as Address,
155
+
156
+ // Bridged tokens (deterministic deployment nonces 1-3)
157
+ LETH: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512' as Address, // Nonce 1
158
+ LBTC: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0' as Address, // Nonce 2
159
+ LUSD: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9' as Address, // Nonce 3
160
+
161
+ // AMM V2
162
+ V2_FACTORY: '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1' as Address,
163
+ V2_ROUTER: '0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE' as Address,
164
+
165
+ // Staking
166
+ STAKED_LUX: '0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0' as Address,
167
+ } as const
168
+
169
+ /**
170
+ * Get contracts for a specific chain
171
+ */
172
+ export function getContracts(chainId: number) {
173
+ switch (chainId) {
174
+ case 96369:
175
+ return LUX_MAINNET_CONTRACTS
176
+ case 96368:
177
+ return LUX_TESTNET_CONTRACTS
178
+ case 200200:
179
+ return ZOO_MAINNET_CONTRACTS
180
+ case 36963:
181
+ return HANZO_MAINNET_CONTRACTS
182
+ case 36911:
183
+ return SPC_MAINNET_CONTRACTS
184
+ case 494949:
185
+ return PARS_MAINNET_CONTRACTS
186
+ case 1337:
187
+ return LUX_DEV_CONTRACTS
188
+ default:
189
+ return LUX_MAINNET_CONTRACTS
190
+ }
191
+ }
192
+
193
+ export type ContractAddresses = typeof LUX_MAINNET_CONTRACTS
package/src/env.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Environment configuration
3
+ */
4
+
5
+ export const ENV = {
6
+ // Chain IDs
7
+ DEFAULT_CHAIN_ID: parseInt(process.env['NEXT_PUBLIC_DEFAULT_CHAIN_ID'] || '96369'),
8
+
9
+ // API URLs
10
+ API_URL: process.env['NEXT_PUBLIC_API_URL'] || 'https://api.lux.exchange',
11
+
12
+ // RPC URLs
13
+ LUX_MAINNET_RPC: process.env['NEXT_PUBLIC_LUX_MAINNET_RPC'] || 'https://api.lux.network/rpc',
14
+ LUX_TESTNET_RPC: process.env['NEXT_PUBLIC_LUX_TESTNET_RPC'] || 'https://api.lux-test.network/rpc',
15
+ ZOO_MAINNET_RPC: process.env['NEXT_PUBLIC_ZOO_MAINNET_RPC'] || 'https://api.zoo.network/rpc',
16
+ ZOO_TESTNET_RPC: process.env['NEXT_PUBLIC_ZOO_TESTNET_RPC'] || 'https://api.zoo-test.network/rpc',
17
+
18
+ // Feature flags
19
+ ENABLE_TESTNET: process.env['NEXT_PUBLIC_ENABLE_TESTNET'] === 'true',
20
+ ENABLE_DEX_PRECOMPILES: process.env['NEXT_PUBLIC_ENABLE_DEX_PRECOMPILES'] === 'true',
21
+ ENABLE_CROSS_CHAIN: process.env['NEXT_PUBLIC_ENABLE_CROSS_CHAIN'] === 'true',
22
+
23
+ // WalletConnect
24
+ WALLETCONNECT_PROJECT_ID: process.env['NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID'] || '',
25
+ } as const
26
+
27
+ export type Env = typeof ENV
@@ -0,0 +1,130 @@
1
+ import type { Config } from '@luxfi/config/src/config-types'
2
+ import {
3
+ ALCHEMY_API_KEY,
4
+ AMPLITUDE_PROXY_URL_OVERRIDE,
5
+ API_BASE_URL_OVERRIDE,
6
+ API_BASE_URL_V2_OVERRIDE,
7
+ APPSFLYER_API_KEY,
8
+ APPSFLYER_APP_ID,
9
+ BLOCKAID_PROXY_URL,
10
+ DATADOG_CLIENT_TOKEN,
11
+ DATADOG_PROJECT_ID,
12
+ ENABLE_ENTRY_GATEWAY_PROXY,
13
+ ENABLE_SESSION_SERVICE,
14
+ ENABLE_SESSION_UPGRADE_AUTO,
15
+ ENTRY_GATEWAY_API_URL_OVERRIDE,
16
+ LUX_GATEWAY_URL,
17
+ FOR_API_URL_OVERRIDE,
18
+ GRAPHQL_URL_OVERRIDE,
19
+ INCLUDE_PROTOTYPE_FEATURES,
20
+ INFURA_KEY,
21
+ IS_E2E_TEST,
22
+ JUPITER_PROXY_URL,
23
+ LIQUIDITY_SERVICE_URL_OVERRIDE,
24
+ ONESIGNAL_APP_ID,
25
+ QUICKNODE_ENDPOINT_NAME,
26
+ QUICKNODE_ENDPOINT_TOKEN,
27
+ SCANTASTIC_API_URL_OVERRIDE,
28
+ STATSIG_API_KEY,
29
+ STATSIG_PROXY_URL_OVERRIDE,
30
+ TRADING_API_KEY,
31
+ TRADING_API_URL_OVERRIDE,
32
+ LUX_API_KEY,
33
+ LUX_NOTIF_API_BASE_URL_OVERRIDE,
34
+ UNITAGS_API_URL_OVERRIDE,
35
+ WALLETCONNECT_PROJECT_ID,
36
+ WALLETCONNECT_PROJECT_ID_BETA,
37
+ WALLETCONNECT_PROJECT_ID_DEV,
38
+ } from 'react-native-dotenv'
39
+ import { isNonTestDev } from '@luxfi/utilities/src/environment/constants'
40
+
41
+ // Module-level cache for config to avoid recomputing on every call
42
+ let cachedConfig: Config | undefined
43
+
44
+ // eslint-disable-next-line complexity
45
+ export const getConfig = (): Config => {
46
+ // Return cached config if already computed
47
+ if (cachedConfig !== undefined) {
48
+ return cachedConfig
49
+ }
50
+
51
+ /**
52
+ * Naming requirements for different environments:
53
+ * - Web ENV vars: must have process.env.REACT_APP_<var_name>
54
+ * - Extension ENV vars: must have process.env.<var_name>
55
+ * - Mobile ENV vars: must have BOTH process.env.<var_name> and <var_name>
56
+ *
57
+ * The CI requires web vars to have the required 'REACT_APP_' prefix. The react-dot-env library doesnt integrate with CI correctly,
58
+ * so we pull from github secrets directly with process.env.<var_name> for both extension and mobile. <var_name> is used for local mobile builds.
59
+ */
60
+
61
+ const config: Config = {
62
+ alchemyApiKey: process.env.REACT_APP_ALCHEMY_API_KEY || process.env.ALCHEMY_API_KEY || ALCHEMY_API_KEY,
63
+ amplitudeProxyUrlOverride: process.env.AMPLITUDE_PROXY_URL_OVERRIDE || AMPLITUDE_PROXY_URL_OVERRIDE,
64
+ apiBaseUrlOverride: process.env.API_BASE_URL_OVERRIDE || API_BASE_URL_OVERRIDE,
65
+ apiBaseUrlV2Override: process.env.API_BASE_URL_V2_OVERRIDE || API_BASE_URL_V2_OVERRIDE,
66
+ appsflyerApiKey: process.env.APPSFLYER_API_KEY || APPSFLYER_API_KEY,
67
+ appsflyerAppId: process.env.APPSFLYER_APP_ID || APPSFLYER_APP_ID,
68
+ blockaidProxyUrl: process.env.BLOCKAID_PROXY_URL || BLOCKAID_PROXY_URL,
69
+ datadogClientToken:
70
+ process.env.REACT_APP_DATADOG_CLIENT_TOKEN || process.env.DATADOG_CLIENT_TOKEN || DATADOG_CLIENT_TOKEN,
71
+ datadogProjectId: process.env.REACT_APP_DATADOG_PROJECT_ID || process.env.DATADOG_PROJECT_ID || DATADOG_PROJECT_ID,
72
+ enableEntryGatewayProxy: process.env.ENABLE_ENTRY_GATEWAY_PROXY === 'true' || ENABLE_ENTRY_GATEWAY_PROXY === 'true',
73
+ enableSessionService: process.env.ENABLE_SESSION_SERVICE === 'true' || ENABLE_SESSION_SERVICE === 'true',
74
+ enableSessionUpgradeAuto:
75
+ process.env.ENABLE_SESSION_UPGRADE_AUTO === 'true' || ENABLE_SESSION_UPGRADE_AUTO === 'true',
76
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
77
+ isE2ETest: process.env.IS_E2E_TEST?.toLowerCase() === 'true' || IS_E2E_TEST?.toLowerCase() === 'true',
78
+ forApiUrlOverride: process.env.FOR_API_URL_OVERRIDE || FOR_API_URL_OVERRIDE,
79
+ graphqlUrlOverride: process.env.GRAPHQL_URL_OVERRIDE || GRAPHQL_URL_OVERRIDE,
80
+ // G-Chain GraphQL: testnet=9650, mainnet=9630
81
+ gChainGraphqlUrl:
82
+ process.env['GCHAIN_GRAPHQL_URL'] ||
83
+ (isNonTestDev ? 'http://localhost:9650/ext/bc/G/graphql' : 'http://localhost:9630/ext/bc/G/graphql'),
84
+ infuraKey: process.env.REACT_APP_INFURA_KEY || INFURA_KEY,
85
+ includePrototypeFeatures: process.env.INCLUDE_PROTOTYPE_FEATURES || INCLUDE_PROTOTYPE_FEATURES,
86
+ isVercelEnvironment: false, // never set to true for native
87
+ jupiterProxyUrl: process.env.JUPITER_PROXY_URL || JUPITER_PROXY_URL,
88
+ onesignalAppId: process.env.ONESIGNAL_APP_ID || ONESIGNAL_APP_ID,
89
+ quicknodeEndpointName:
90
+ process.env.REACT_APP_QUICKNODE_ENDPOINT_NAME || process.env.QUICKNODE_ENDPOINT_NAME || QUICKNODE_ENDPOINT_NAME,
91
+ quicknodeEndpointToken:
92
+ process.env.REACT_APP_QUICKNODE_ENDPOINT_TOKEN ||
93
+ process.env.QUICKNODE_ENDPOINT_TOKEN ||
94
+ QUICKNODE_ENDPOINT_TOKEN,
95
+ scantasticApiUrlOverride: process.env.SCANTASTIC_API_URL_OVERRIDE || SCANTASTIC_API_URL_OVERRIDE,
96
+ statsigApiKey: process.env.REACT_APP_STATSIG_API_KEY || process.env.STATSIG_API_KEY || STATSIG_API_KEY,
97
+ statsigProxyUrlOverride: process.env.STATSIG_PROXY_URL_OVERRIDE || STATSIG_PROXY_URL_OVERRIDE,
98
+ tradingApiKey: process.env.REACT_APP_TRADING_API_KEY || process.env.TRADING_API_KEY || TRADING_API_KEY,
99
+ tradingApiUrlOverride:
100
+ process.env.REACT_APP_TRADING_API_URL_OVERRIDE ||
101
+ process.env.TRADING_API_URL_OVERRIDE ||
102
+ TRADING_API_URL_OVERRIDE,
103
+ tradingApiWebTestEnv: process.env.REACT_APP_TRADING_API_TEST_ENV || '',
104
+ liquidityServiceUrlOverride:
105
+ process.env.REACT_APP_LIQUIDITY_SERVICE_URL_OVERRIDE ||
106
+ process.env.LIQUIDITY_SERVICE_URL_OVERRIDE ||
107
+ LIQUIDITY_SERVICE_URL_OVERRIDE,
108
+ luxApiKey: process.env.LUX_API_KEY || LUX_API_KEY,
109
+ unitagsApiUrlOverride: process.env.UNITAGS_API_URL_OVERRIDE || UNITAGS_API_URL_OVERRIDE,
110
+ luxNotifApiBaseUrlOverride:
111
+ process.env.LUX_NOTIF_API_BASE_URL_OVERRIDE || LUX_NOTIF_API_BASE_URL_OVERRIDE,
112
+ entryGatewayApiUrlOverride: process.env.ENTRY_GATEWAY_API_URL_OVERRIDE || ENTRY_GATEWAY_API_URL_OVERRIDE,
113
+ luxGatewayUrlOverride: process.env['LUX_GATEWAY_URL'] || LUX_GATEWAY_URL || '',
114
+ walletConnectProjectId:
115
+ process.env.REACT_APP_WALLET_CONNECT_PROJECT_ID ||
116
+ process.env.WALLETCONNECT_PROJECT_ID ||
117
+ WALLETCONNECT_PROJECT_ID,
118
+ walletConnectProjectIdBeta: process.env.WALLETCONNECT_PROJECT_ID_BETA || WALLETCONNECT_PROJECT_ID_BETA,
119
+ walletConnectProjectIdDev: process.env.WALLETCONNECT_PROJECT_ID_DEV || WALLETCONNECT_PROJECT_ID_DEV,
120
+ }
121
+
122
+ if (isNonTestDev) {
123
+ // biome-ignore lint/suspicious/noConsole: Cannot use logger here, causes error from circular dep
124
+ console.debug('Using app config:', config)
125
+ }
126
+
127
+ // Cache and return frozen config
128
+ cachedConfig = Object.freeze(config)
129
+ return cachedConfig
130
+ }
@@ -0,0 +1,6 @@
1
+ import { Config } from '@luxfi/config/src/config-types'
2
+ import { PlatformSplitStubError } from '@luxfi/utilities/src/errors'
3
+
4
+ export function getConfig(): Config {
5
+ throw new PlatformSplitStubError('Use the correct getConfig for your platform')
6
+ }