File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -560,7 +560,7 @@ export function webAuthn(options: webAuthn.Parameters) {
560560
561561 const targetChain = defineChain ( {
562562 ...chain ,
563- async prepareTransactionRequest ( args ) {
563+ async prepareTransactionRequest ( args , { phase } ) {
564564 const keyAuthorization = await ( async ( ) => {
565565 {
566566 const keyAuthorization = (
@@ -581,8 +581,24 @@ export function webAuthn(options: webAuthn.Parameters) {
581581 )
582582 return keyAuthorization
583583 } ) ( )
584+
585+ const [ prepareTransactionRequestFn , options ] = ( ( ) => {
586+ if ( ! chain . prepareTransactionRequest ) return [ undefined , undefined ]
587+ if ( typeof chain . prepareTransactionRequest === 'function' )
588+ return [ chain . prepareTransactionRequest , undefined ]
589+ return chain . prepareTransactionRequest
590+ } ) ( )
591+
592+ const request = await ( async ( ) => {
593+ if ( ! prepareTransactionRequestFn ) return { }
594+ if ( ! options || options ?. runAt ?. includes ( phase ) )
595+ return await prepareTransactionRequestFn ( args , { phase } )
596+ return { }
597+ } ) ( )
598+
584599 return {
585600 ...args ,
601+ ...request ,
586602 keyAuthorization,
587603 }
588604 } ,
You can’t perform that action at this time.
0 commit comments