Skip to content

Commit 0c83897

Browse files
authored
test: add erc20 approve test (#2596)
1 parent b6a6eae commit 0c83897

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { it, expect } from "vitest";
2+
import { approve } from "./approve.js";
3+
import { USDC_CONTRACT } from "~test/test-contracts.js";
4+
import { VITALIK_WALLET } from "~test/addresses.js";
5+
import { estimateGas } from "../../../transaction/actions/estimate-gas.js";
6+
7+
it.runIf(process.env.TW_SECRET_KEY)(
8+
"estimates erc20 approval gas correctly",
9+
async () => {
10+
const transaction = approve({
11+
contract: USDC_CONTRACT,
12+
amount: 100,
13+
spender: VITALIK_WALLET,
14+
});
15+
const result = await estimateGas({
16+
transaction,
17+
from: VITALIK_WALLET,
18+
});
19+
expect(result).toMatchInlineSnapshot(`55937n`);
20+
},
21+
);

0 commit comments

Comments
 (0)