-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Check existing issues
- I checked there isn't already an issue for the bug I encountered.
Viem Version
2.46.1
Current Behavior
dataSuffix field is not respected when data field is null.
import { Attribution } from "ox/erc8021";
import { createWalletClient, http, parseUnits, zeroAddress } from "viem";
import { privateKeyToAccount } from "viem/accounts"
import { base } from "viem/chains";
const main = async () => {
const account = privateKeyToAccount("");
const dataSuffix = Attribution.toDataSuffix({
codes: ["my-code"]
});
console.log("dataSuffix: ", dataSuffix);
const wallet = createWalletClient({
account,
transport: http(""),
chain: base,
dataSuffix
});
// below transaction adds dataSuffix to `data` field
const tx = await wallet.sendTransaction({
to: zeroAddress,
value: parseUnits('0', 18),
data: "0x"
});
// below transaction does not respect the dataSuffix field:
// const tx1 = await wallet.sendTransaction({
// to: zeroAddress,
// value: parseUnits('0', 18),
// });
console.log("tx: ", tx);
}
main();
Expected Behavior
dataSuffix field should be appended to transaction's data even when data is undefined or null
Steps To Reproduce
https://gist.github.com/nikhilkumar1612/573f940083a06070adcf5eb370bbdb44
Link to Minimal Reproducible Example
https://gist.github.com/nikhilkumar1612/573f940083a06070adcf5eb370bbdb44
Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels