File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ export class Wallet {
342342 if ( call . delegateCall ) {
343343 throw new Error ( 'delegate calls are not allowed in safe mode' )
344344 }
345- if ( Address . isEqual ( call . to , this . address ) ) {
345+ if ( Address . isEqual ( call . to , this . address ) && call . data !== '0x' ) {
346346 throw new Error ( 'calls to the wallet contract itself are not allowed in safe mode' )
347347 }
348348 }
@@ -455,7 +455,7 @@ export class Wallet {
455455 if ( call . delegateCall ) {
456456 throw new Error ( 'delegate calls are not allowed in safe mode' )
457457 }
458- if ( Address . isEqual ( call . to , this . address ) ) {
458+ if ( Address . isEqual ( call . to , this . address ) && call . data !== '0x' ) {
459459 throw new Error ( 'calls to the wallet contract itself are not allowed in safe mode' )
460460 }
461461 }
Original file line number Diff line number Diff line change @@ -481,12 +481,31 @@ describe('Transactions', () => {
481481 const txId1 = manager . transactions . request ( wallet ! , Network . ChainId . ARBITRUM , [
482482 {
483483 to : wallet ! ,
484+ data : '0x1234' ,
484485 } ,
485486 ] )
486487
487488 await expect ( txId1 ) . rejects . toThrow ( )
488489 } )
489490
491+ it ( 'Should allow native token transfer to self in safe mode' , async ( ) => {
492+ const manager = newManager ( )
493+ const wallet = await manager . wallets . signUp ( {
494+ mnemonic : Mnemonic . random ( Mnemonic . english ) ,
495+ kind : 'mnemonic' ,
496+ noGuard : true ,
497+ } )
498+
499+ const txId1 = await manager . transactions . request ( wallet ! , Network . ChainId . ARBITRUM , [
500+ {
501+ to : wallet ! ,
502+ value : 1n ,
503+ } ,
504+ ] )
505+
506+ expect ( txId1 ) . toBeDefined ( )
507+ } )
508+
490509 it ( 'Should allow transactions to self in unsafe mode' , async ( ) => {
491510 const manager = newManager ( )
492511 const wallet = await manager . wallets . signUp ( {
You can’t perform that action at this time.
0 commit comments