Skip to content

Commit

Permalink
use tenderly setBalance for eth balance
Browse files Browse the repository at this point in the history
  • Loading branch information
GrandSchtroumpf committed Jan 20, 2025
1 parent cab2253 commit 88045e0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/utils/tenderly.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { hexValue } from '@ethersproject/bytes';
import { parseUnits } from '@ethersproject/units';
import { StaticJsonRpcProvider } from '@ethersproject/providers';
import { Token__factory } from 'abis/types/factories/Token__factory';
import config from 'config';
Expand All @@ -16,18 +18,16 @@ export const tenderlyRpc = lsService.getItem('tenderlyRpc');
export const getUncheckedSigner = (user: string, rpcUrl = tenderlyRpc) =>
new StaticJsonRpcProvider(rpcUrl).getUncheckedSigner(user);

const NATIVE_TOKEN_DONOR_ACCOUNT = config.tenderly.nativeTokenDonorAccount;

export const FAUCET_TOKENS: FaucetToken[] = config.tenderly.faucetTokens;

const FAUCET_AMOUNT = config.tenderly.faucetAmount;

export const tenderlyFaucetTransferNativeToken = async (user: string) => {
const ethSigner = getUncheckedSigner(NATIVE_TOKEN_DONOR_ACCOUNT);
await ethSigner.sendTransaction({
to: user,
value: expandToken(FAUCET_AMOUNT, 18),
});
const provider = new StaticJsonRpcProvider(tenderlyRpc);
await provider.send('tenderly_setBalance', [
[user],
hexValue(parseUnits('1000', 'ether').toHexString()),
]);
};

export const tenderlyFaucetTransferTKN = async (
Expand Down

0 comments on commit 88045e0

Please sign in to comment.