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(
225
225
} ;
226
226
} ;
227
227
paymasterOverride = options . overrides ?. paymaster || paymasterCallback ;
228
+ } else {
229
+ paymasterOverride = options . overrides ?. paymaster ;
228
230
}
229
231
const executeTx = prepareExecute ( {
230
232
accountContract,
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ import { setContractURI } from "../../extensions/marketplace/__generated__/IMark
18
18
import { estimateGasCost } from "../../transaction/actions/estimate-gas-cost.js" ;
19
19
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js" ;
20
20
import { sendBatchTransaction } from "../../transaction/actions/send-batch-transaction.js" ;
21
+ import { sendTransaction } from "../../transaction/actions/send-transaction.js" ;
21
22
import { waitForReceipt } from "../../transaction/actions/wait-for-tx-receipt.js" ;
23
+ import { prepareTransaction } from "../../transaction/prepare-transaction.js" ;
22
24
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js" ;
23
25
import { sleep } from "../../utils/sleep.js" ;
24
26
import type { Account , Wallet } from "../interfaces/wallet.js" ;
@@ -364,5 +366,36 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
364
366
} ) ;
365
367
expect ( balance ) . toEqual ( 2n ) ;
366
368
} ) ;
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
+ } ) ;
367
400
} ,
368
401
) ;
You can’t perform that action at this time.
0 commit comments