Skip to content

Commit 65fdb40

Browse files
committed
chore: up connector
1 parent c17b66c commit 65fdb40

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/wagmi/Connector.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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
},

0 commit comments

Comments
 (0)