| 30 | } |
| 31 | |
| 32 | export function fetchConfig(): Config { |
| 33 | const environmentConfiguration = EnvironmentConfigurationSchema.parse( |
| 34 | process.env |
| 35 | ); |
| 36 | |
| 37 | return { |
| 38 | zeroexApiKey: environmentConfiguration.ZEROEX_API_KEY, |
| 39 | connection: new Connection(environmentConfiguration.RPC_URL), |
| 40 | dryRun: environmentConfiguration.DRY_RUN, |
| 41 | keypairConfig: { |
| 42 | keypair: environmentConfiguration.PRIVATE_KEY |
| 43 | ? Keypair.fromSecretKey( |
| 44 | bs58.decode(environmentConfiguration.PRIVATE_KEY) |
| 45 | ) |
| 46 | : Keypair.generate(), |
| 47 | isUserProvided: !!environmentConfiguration.PRIVATE_KEY, |
| 48 | }, |
| 49 | }; |
| 50 | } |