Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smart-donkeys-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Fix custom paymaster callback not being respected
2 changes: 2 additions & 0 deletions packages/thirdweb/src/wallets/smart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ async function createSmartAccount(
};
};
paymasterOverride = options.overrides?.paymaster || paymasterCallback;
} else {
paymasterOverride = options.overrides?.paymaster;
}
const executeTx = prepareExecute({
accountContract,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import { setContractURI } from "../../extensions/marketplace/__generated__/IMark
import { estimateGasCost } from "../../transaction/actions/estimate-gas-cost.js";
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
import { sendBatchTransaction } from "../../transaction/actions/send-batch-transaction.js";
import { sendTransaction } from "../../transaction/actions/send-transaction.js";
import { waitForReceipt } from "../../transaction/actions/wait-for-tx-receipt.js";
import { prepareTransaction } from "../../transaction/prepare-transaction.js";
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
import { sleep } from "../../utils/sleep.js";
import type { Account, Wallet } from "../interfaces/wallet.js";
Expand Down Expand Up @@ -364,5 +366,36 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
});
expect(balance).toEqual(2n);
});

it("can use a different paymaster", async () => {
const wallet = smartWallet({
chain,
factoryAddress: factoryAddress,
gasless: true,
overrides: {
paymaster: async () => {
return {
paymaster: "0x",
paymasterData: "0x",
};
},
},
});
const newSmartAccount = await wallet.connect({
client: TEST_CLIENT,
personalAccount,
});
const transaction = prepareTransaction({
client: TEST_CLIENT,
chain,
value: 0n,
});
await expect(
sendTransaction({
transaction,
account: newSmartAccount,
}),
).rejects.toThrowError(/AA21 didn't pay prefund/);
});
},
);