Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
feat: allow funding an address
Browse files Browse the repository at this point in the history
- closes #5
  • Loading branch information
sakulstra committed Sep 20, 2022
1 parent ea8f52b commit ec22019
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
12 changes: 12 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ChainId } from "@aave/contract-helpers";
import {
createFork,
forkIdToForkParams,
fundAccount,
getForkParameters,
} from "./src/tenderly";
import {
Expand Down Expand Up @@ -47,6 +48,7 @@ type CommonOptions = {
//
pool?: string;
aclManagerAddress?: string;
userAddress?: string;
keepAlive?: boolean | string;
};

Expand Down Expand Up @@ -221,6 +223,12 @@ const questions: { [key: string]: InquirerQuestion | YargsQuestion } = {
Number(args.networkId) !== ChainId.mainnet
),
},
userAddress: {
message:
"Enter an address you want to fund with 1000 native currency on the fork?",
describe: "Address to fund with 1000 of native currency",
type: "string",
},
keepAlive: {
message: "Should the fork be kept alive after terminal is closed?",
describe: "Keep the fork alive after this session",
Expand Down Expand Up @@ -385,6 +393,10 @@ function getName(options: Options) {
argv = { ...argv, ...params };
}
if (argv.userAddress) {
await fundAccount(forkId, argv.userAddress);
}
console.log(`To use this fork on the aave interface you need to do the following things.

1. Open the browser console on app.aave.com (or a local instance) and enter
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bgd-labs/aave-tenderly-cli",
"version": "0.0.6",
"version": "0.0.7",
"description": "",
"main": "main.ts",
"private": false,
Expand All @@ -10,7 +10,7 @@
"scripts": {
"start": "npm run build && node dist/index.js",
"build": "ncc build ./main.ts -o dist --minify",
"publish:local": "npm run build && npm pack && npm i -g bgd-labs-aave-tenderly-cli-0.0.6.tgz && rm bgd-labs-aave-tenderly-cli-0.0.6.tgz"
"publish:local": "npm run build && npm pack && npm i -g bgd-labs-aave-tenderly-cli-0.0.7.tgz && rm bgd-labs-aave-tenderly-cli-0.0.7.tgz"
},
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions src/tenderly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,12 @@ export async function deleteFork(forkId: string) {
const { axiosOnTenderly, projectUrl } = getTenderlyClient();
await axiosOnTenderly.delete(`${projectUrl}/fork/${forkId}`);
}

export async function fundAccount(forkId: string, address: string) {
const { axiosOnTenderly, projectUrl } = getTenderlyClient();

await axiosOnTenderly.post(`${projectUrl}/fork/${forkId}/balance`, {
accounts: [address],
amount: 1000,
});
}

0 comments on commit ec22019

Please sign in to comment.