Skip to content

Commit

Permalink
wip: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Jun 17, 2024
1 parent de3e31c commit e9a3ebe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/experimental/utils/nonceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type NonceManager = {
/** Get and increment a nonce. */
consume(parameters: FunctionParameters & { client: Client }): Promise<number>
/** Increment a nonce. */
increase(chainId: FunctionParameters): Promise<void>
increment(chainId: FunctionParameters): Promise<void>
/** Get a nonce. */
get(chainId: FunctionParameters & { client: Client }): Promise<number>
/** Reset a nonce. */
Expand Down Expand Up @@ -58,15 +58,15 @@ export function createNonceManager(
const key = getKey({ address, chainId })
const promise = this.get({ address, chainId, client })

await this.increase({ address, chainId })
await this.increment({ address, chainId })
const nonce = await promise

await source.set({ address, chainId }, nonce)
nonceMap.set(key, nonce)

return nonce
},
async increase({ address, chainId }) {
async increment({ address, chainId }) {
const key = getKey({ address, chainId })
const delta = deltaMap.get(key) ?? 0
deltaMap.set(key, delta + 1)
Expand Down

0 comments on commit e9a3ebe

Please sign in to comment.