Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Updated the account from the 0.0.2 account to an account from th… #2690

Merged
merged 11 commits into from
Jul 23, 2024
Merged
17 changes: 16 additions & 1 deletion packages/server/tests/clients/servicesClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class ServicesClient {
this.network = network;

if (!network) network = '{}';
const opPrivateKey = PrivateKey.fromString(key);
const opPrivateKey = this.createPrivateKeyBasedOnFormat(key);
if (supportedEnvs.includes(network.toLowerCase())) {
this.client = Client.forName(network);
} else {
Expand All @@ -84,6 +84,21 @@ export default class ServicesClient {
this.client.setOperator(AccountId.fromString(accountId), opPrivateKey);
}

createPrivateKeyBasedOnFormat(operatorMainKey: string): PrivateKey {
ebadiere marked this conversation as resolved.
Show resolved Hide resolved
switch (process.env.OPERATOR_KEY_FORMAT) {
case 'DER':
case undefined:
case null:
return PrivateKey.fromStringDer(operatorMainKey);
case 'HEX_ED25519':
return PrivateKey.fromStringED25519(operatorMainKey);
case 'HEX_ECDSA':
return PrivateKey.fromStringECDSA(operatorMainKey);
default:
throw new Error(`Invalid OPERATOR_KEY_FORMAT provided: ${process.env.OPERATOR_KEY_FORMAT}`);
}
}

getLogger(): Logger {
return this.logger;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/server/tests/localAcceptance.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
HEDERA_NETWORK={"127.0.0.1:50211":"0.0.3"}

#This is a static acount created at startup in the local node
OPERATOR_ID_MAIN=0.0.1022
OPERATOR_KEY_MAIN=302e020100300506032b657004220420a608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4
# Account from local node. This is the account that will be used to pay for transactions.
OPERATOR_ID_MAIN=0.0.1002
OPERATOR_KEY_MAIN=0x7f109a9e3b0d8ecfba9cc23a3614433ce0fa7ddcc80f2a8f10b222179a5a80d6
OPERATOR_KEY_FORMAT=HEX_ECDSA
CHAIN_ID=0x12a
MIRROR_NODE_URL_WEB3=http://127.0.0.1:8545
REDIS_ENABLED=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('@web-socket-batch-2 eth_sendRawTransaction', async function () {
value: (10 * 10 ** 18).toString(), // 10hbar - the gasPrice to deploy deterministic proxy contract
to: constants.DETERMINISTIC_DEPLOYMENT_SIGNER,
gasPrice: await global.relay.gasPrice(),
gasLimit: numberTo0x(5000000),
gasLimit: constants.TX_HOLLOW_ACCOUNT_CREATION_GAS,
};
});

Expand Down
Loading