Skip to content

Commit 6153d57

Browse files
authored
[SDK] Fix: adds ERC20 transfer overrides param (#4804)
1 parent 39aeb14 commit 6153d57

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

packages/thirdweb/src/extensions/erc20/write/transfer.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import type { BaseTransactionOptions } from "../../../transaction/types.js";
1+
import type {
2+
BaseTransactionOptions,
3+
WithOverrides,
4+
} from "../../../transaction/types.js";
25
import type { Prettify } from "../../../utils/type-utils.js";
36
import { toUnits } from "../../../utils/units.js";
47
import { transfer as generatedTransfer } from "../__generated__/IERC20/write/transfer.js";
@@ -8,14 +11,16 @@ import { transfer as generatedTransfer } from "../__generated__/IERC20/write/tra
811
* @extension ERC20
912
*/
1013
export type TransferParams = Prettify<
11-
{ to: string } & (
12-
| {
13-
amount: number | string;
14-
}
15-
| {
16-
amountWei: bigint;
17-
}
18-
)
14+
WithOverrides<
15+
{ to: string } & (
16+
| {
17+
amount: number | string;
18+
}
19+
| {
20+
amountWei: bigint;
21+
}
22+
)
23+
>
1924
>;
2025

2126
/**
@@ -60,6 +65,7 @@ export function transfer(options: BaseTransactionOptions<TransferParams>) {
6065
amountWei: amount,
6166
tokenAddress: options.contract.address,
6267
},
68+
...options.overrides,
6369
},
6470
} as const;
6571
},

packages/thirdweb/src/extensions/erc20/write/transferFrom.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type { Address } from "abitype";
2-
import type { BaseTransactionOptions } from "../../../transaction/types.js";
2+
import type {
3+
BaseTransactionOptions,
4+
WithOverrides,
5+
} from "../../../transaction/types.js";
36
import { toUnits } from "../../../utils/units.js";
47

58
import type { Prettify } from "../../../utils/type-utils.js";
@@ -10,14 +13,16 @@ import { transferFrom as generatedTransferFrom } from "../__generated__/IERC20/w
1013
* @extension ERC20
1114
*/
1215
export type TransferFromParams = Prettify<
13-
{ to: Address; from: Address } & (
14-
| {
15-
amount: number | string;
16-
}
17-
| {
18-
amountWei: bigint;
19-
}
20-
)
16+
WithOverrides<
17+
{ to: Address; from: Address } & (
18+
| {
19+
amount: number | string;
20+
}
21+
| {
22+
amountWei: bigint;
23+
}
24+
)
25+
>
2126
>;
2227

2328
/**
@@ -66,6 +71,7 @@ export function transferFrom(
6671
amountWei: amount,
6772
tokenAddress: options.contract.address,
6873
},
74+
...options.overrides,
6975
},
7076
} as const;
7177
},

0 commit comments

Comments
 (0)