File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
packages/thirdweb/src/wallets/smart Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Fix custom paymaster callback not being respected
Original file line number Diff line number Diff line change @@ -225,6 +225,8 @@ async function createSmartAccount(
225225 } ;
226226 } ;
227227 paymasterOverride = options . overrides ?. paymaster || paymasterCallback ;
228+ } else {
229+ paymasterOverride = options . overrides ?. paymaster ;
228230 }
229231 const executeTx = prepareExecute ( {
230232 accountContract,
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ import { setContractURI } from "../../extensions/marketplace/__generated__/IMark
1818import { estimateGasCost } from "../../transaction/actions/estimate-gas-cost.js" ;
1919import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js" ;
2020import { sendBatchTransaction } from "../../transaction/actions/send-batch-transaction.js" ;
21+ import { sendTransaction } from "../../transaction/actions/send-transaction.js" ;
2122import { waitForReceipt } from "../../transaction/actions/wait-for-tx-receipt.js" ;
23+ import { prepareTransaction } from "../../transaction/prepare-transaction.js" ;
2224import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js" ;
2325import { sleep } from "../../utils/sleep.js" ;
2426import type { Account , Wallet } from "../interfaces/wallet.js" ;
@@ -364,5 +366,36 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
364366 } ) ;
365367 expect ( balance ) . toEqual ( 2n ) ;
366368 } ) ;
369+
370+ it ( "can use a different paymaster" , async ( ) => {
371+ const wallet = smartWallet ( {
372+ chain,
373+ factoryAddress : factoryAddress ,
374+ gasless : true ,
375+ overrides : {
376+ paymaster : async ( ) => {
377+ return {
378+ paymaster : "0x" ,
379+ paymasterData : "0x" ,
380+ } ;
381+ } ,
382+ } ,
383+ } ) ;
384+ const newSmartAccount = await wallet . connect ( {
385+ client : TEST_CLIENT ,
386+ personalAccount,
387+ } ) ;
388+ const transaction = prepareTransaction ( {
389+ client : TEST_CLIENT ,
390+ chain,
391+ value : 0n ,
392+ } ) ;
393+ await expect (
394+ sendTransaction ( {
395+ transaction,
396+ account : newSmartAccount ,
397+ } ) ,
398+ ) . rejects . toThrowError ( / A A 2 1 d i d n ' t p a y p r e f u n d / ) ;
399+ } ) ;
367400 } ,
368401) ;
You can’t perform that action at this time.
0 commit comments