Skip to content

Commit

Permalink
use same private key
Browse files Browse the repository at this point in the history
  • Loading branch information
shunjizhan committed Aug 4, 2023
1 parent 3beec19 commit d9d35cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
### testnet urls
# relayer addr: 0xe3234f433914d4cfcf846491ec5a7831ab9f0bb3
# relayer substrate addr: qynM4ZsTJ2zPiADvihbNsjtVXo1eiT8wpkc3XGkpBFQYNpC
# relayer substrate addr: 5C82pcyrgW1gCm3jS8yBjo9AEp9HCUXiUkuKA1zWWiACgw1C

KARURA_ETH_RPC=https://eth-rpc-karura-testnet.aca-staging.network
KARURA_NODE_URL=wss://karura-testnet.aca-staging.network/rpc/karura/ws
KARURA_PRIVATE_KEY=efb03e3f4fd8b3d7f9b14de6c6fb95044e2321d6bcb9dfe287ba987920254044
KARURA_MNEMONIC='fox sight canyon orphan hotel grow hedgehog build bless august weather swarm'

ACALA_ETH_RPC=https://eth-rpc-acala-testnet.aca-staging.network
ACALA_NODE_URL=wss://acala-dev.aca-dev.network/rpc/ws
ACALA_PRIVATE_KEY=efb03e3f4fd8b3d7f9b14de6c6fb95044e2321d6bcb9dfe287ba987920254044
ACALA_MNEMONIC='fox sight canyon orphan hotel grow hedgehog build bless august weather swarm'

PORT=3111
TESTNET_MODE=1
5 changes: 0 additions & 5 deletions src/utils/configureEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type ChainConfig = {
ethRpc: string;
nodeUrl: string;
walletPrivateKey: string;
walletMnemonic: string;
tokenBridgeAddr: string;
feeAddr: string;
factoryAddr: string;
Expand All @@ -36,7 +35,6 @@ function configKarura(): ChainConfig {
const requiredEnvVars = [
'KARURA_ETH_RPC',
'KARURA_PRIVATE_KEY',
'KARURA_MNEMONIC',
'KARURA_NODE_URL',
];

Expand All @@ -56,7 +54,6 @@ function configKarura(): ChainConfig {
ethRpc: process.env.KARURA_ETH_RPC!,
nodeUrl: process.env.KARURA_NODE_URL!,
walletPrivateKey: process.env.KARURA_PRIVATE_KEY!,
walletMnemonic: process.env.KARURA_MNEMONIC!,
isTestnet,
...addresses,
};
Expand All @@ -66,7 +63,6 @@ function configAcala(): ChainConfig {
const requiredEnvVars = [
'ACALA_ETH_RPC',
'ACALA_PRIVATE_KEY',
'ACALA_MNEMONIC',
'ACALA_NODE_URL',
];

Expand All @@ -86,7 +82,6 @@ function configAcala(): ChainConfig {
ethRpc: process.env.ACALA_ETH_RPC!,
nodeUrl: process.env.ACALA_NODE_URL!,
walletPrivateKey: process.env.ACALA_PRIVATE_KEY!,
walletMnemonic: process.env.ACALA_MNEMONIC!,
isTestnet,
...addresses,
};
Expand Down
4 changes: 2 additions & 2 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AcalaJsonRpcProvider } from '@acala-network/eth-providers';
import { ApiPromise, Keyring, WsProvider } from '@polkadot/api';
import { BigNumber, Contract, PopulatedTransaction, Signer, Wallet, ethers } from 'ethers';
import { CHAIN_ID_ACALA, CHAIN_ID_AVAX, CHAIN_ID_KARURA, CONTRACTS } from '@certusone/wormhole-sdk';
import { CHAIN_ID_ACALA, CHAIN_ID_AVAX, CHAIN_ID_KARURA, CONTRACTS, hexToUint8Array } from '@certusone/wormhole-sdk';
import { ISubmittableResult } from '@polkadot/types/types';
import { JsonRpcProvider } from '@ethersproject/providers';
import { SubstrateSigner } from '@acala-network/bodhi';
Expand All @@ -23,7 +23,7 @@ export const getSigner = async (config: ChainConfig): Promise<Signer> => {
// TODO: reuse api
export const getApi = async (config: ChainConfig) => {
const keyring = new Keyring({ type: 'sr25519' });
const keyPair = keyring.addFromUri(config.walletMnemonic);
const keyPair = keyring.addFromSeed(hexToUint8Array(config.walletPrivateKey));
const addr = keyPair.address;

const api = await ApiPromise.create(options({
Expand Down

0 comments on commit d9d35cc

Please sign in to comment.