Skip to content

Commit

Permalink
fix tx 0x00 (#233)
Browse files Browse the repository at this point in the history
* fix(signTransaction): force undefined data to 0x so it isn't serialized to 0x00

* changeset

* update test

* update tests
  • Loading branch information
coffeexcoin authored Feb 5, 2025
1 parent fbb7e6e commit 30647bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-items-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@abstract-foundation/agw-client': patch
---

Fix undefined data in transaction so it doesn't serialize to 0x00
6 changes: 6 additions & 0 deletions packages/agw-client/src/actions/signTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ export async function signEip712TransactionInternal<
customPaymasterHandler,
);

if (transactionWithPaymaster.data === undefined) {
// serializer turns undefined into 0x00 which causes issues sending
// eth to contracts that don't have a fallback function
transactionWithPaymaster.data = '0x';
}

const eip712Domain = chain?.custom.getEip712Domain({
...transactionWithPaymaster,
type: 'eip712',
Expand Down
2 changes: 2 additions & 0 deletions packages/agw-client/test/src/actions/signTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ test('with useSignerAddress false', async () => {
{
chainId: anvilAbstractTestnet.chain.id,
...transaction,
data: '0x',
from: address.smartAccountAddress,
customSignature: signature,
type: 'eip712' as any,
Expand Down Expand Up @@ -130,6 +131,7 @@ test('with useSignerAddress true', async () => {
{
chainId: anvilAbstractTestnet.chain.id,
...transaction,
data: '0x',
from: address.signerAddress,
customSignature: signature,
type: 'eip712' as any,
Expand Down

0 comments on commit 30647bd

Please sign in to comment.