Skip to content

Nonce API #205

@QYuQianchen

Description

@QYuQianchen

Description

Create a get nonce API endpoint such that blokli returns the nonce for the next pending transaction

There should be a new query API that simply returns next Nonce for a given address, e.g.:

  """
  Retrieve next transaction Nonce for any Ethereum address
  
  This query returns the next Nonce for any address type:
  1. For EOAs (Externally Owned Accounts): Returns the next nonce by inspecting the transaction count and pending txs in the mempool
  2. For Safe contracts: Returns the Safe's internal nonce via nonce() function
  3. For other contracts: Attempts nonce() call, falls back to 1.
  
  The transaction count increments with each transaction confirmed or rejected by the address.
  
  Returns Error with code INVALID_ADDRESS if address format is invalid.
  Returns Error with code QUERY_FAILED if blockchain query fails.
  """
  nextNonce(
    "Address to query (hexadecimal format) - supports EOAs and contracts"
    address: String!
  ): NextNonceResult!

"""Nonce information for any Ethereum address"""
type NextNonce {
  "Address queried (hexadecimal format)"
  address: String!
  "Next nonce for the address"
  count: UInt64!
}

"""Result type for next noce queries"""
union NextNonceResult = NextNonce | InvalidAddressError | QueryFailedError

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions