feat: add support for private key authentication in environment configuration

This commit is contained in:
2026-05-29 17:48:49 -03:00
parent 9cc62efb8a
commit c4db98ae00
3 changed files with 15 additions and 6 deletions

View File

@@ -19,6 +19,8 @@ const mnemonic: string =
process.env.MNEMONIC ?? DEFAULT_MNEMONIC;
const alchemyApiKey: string | undefined =
process.env.ALCHEMY_API_KEY;
const privateKey: string | undefined =
process.env.PRIVATE_KEY;
const chainIds = {
// "{INSERT_NAME}": {INSERT_ID},
@@ -43,11 +45,13 @@ function getChainConfig(
const jsonRpcUrl =
"https://" + chain + ".g.alchemy.com/v2/" + alchemyApiKey;
return {
accounts: {
count: 10,
mnemonic,
path: "m/44'/60'/0'/0",
},
accounts: privateKey
? [privateKey]
: {
count: 10,
mnemonic,
path: "m/44'/60'/0'/0",
},
chainId: chainIds[chain],
url: jsonRpcUrl,
};