We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6a6eae commit 0c83897Copy full SHA for 0c83897
packages/thirdweb/src/extensions/erc20/write/approve.test.ts
@@ -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