diff --git a/packages/stateful/hooks/useCfWorkerAuthPostRequest.ts b/packages/stateful/hooks/useCfWorkerAuthPostRequest.ts index 4e72f6ee88..2a41c48ff8 100644 --- a/packages/stateful/hooks/useCfWorkerAuthPostRequest.ts +++ b/packages/stateful/hooks/useCfWorkerAuthPostRequest.ts @@ -9,7 +9,7 @@ import { useWallet } from './useWallet' // Cloudflare KV is slow to update, so keep track of the last successful nonce // that worked so we don't have to wait for the nonce query to update. Make this // a global variable so it persists across all hook uses. -const lastSuccessfulNonceForType: Record = {} +const lastSuccessfulNonceForApi: Record = {} export const useCfWorkerAuthPostRequest = ( apiBase: string, @@ -57,8 +57,7 @@ export const useCfWorkerAuthPostRequest = ( // If nonce was already used, manually increment. let nonce = nonceResponse.nonce - const lastSuccessfulNonce = - lastSuccessfulNonceForType[signatureType] ?? -1 + const lastSuccessfulNonce = lastSuccessfulNonceForApi[apiBase] ?? -1 if (nonce <= lastSuccessfulNonce) { nonce = lastSuccessfulNonce + 1 } @@ -134,7 +133,7 @@ export const useCfWorkerAuthPostRequest = ( } // If succeeded, store nonce. - lastSuccessfulNonceForType[signatureType] = nonce + lastSuccessfulNonceForApi[apiBase] = nonce // If response OK, return response body. return await response.json()