Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize API v2 specification along with the new requirements #295

Open
kacpersaw opened this issue Jan 2, 2024 · 2 comments
Open

Finalize API v2 specification along with the new requirements #295

kacpersaw opened this issue Jan 2, 2024 · 2 comments
Assignees

Comments

@kacpersaw
Copy link
Contributor

kacpersaw commented Jan 2, 2024

Description

The ask is to prepare new schema for new improved API v2.

List of endpoints required for now (spec is still in progress):

  1. current head layer number and nodeID hash
    • known chain head block/layer
    • current highest layer
    • sync status (in sync, syncing, offline)
  2. detail of given layer by layer number
    • empty layer, or return single canonical block with:
      • block header/block ID
      • list of transactions (effective and ineffective, possibly with option to filter effective only)
  3. account details by address
    • current balance and counter
    • projected balance and counter
  4. broadcast raw, signed tx
    • return txid
  5. tx by txid
    • state (unknown, pending, contextually invalid/malformed, duplicate, ineffective/contextually invalid, in mempool, included in block, passed hare, passed tortoise/verified, reorg'ed out/replaced)
    • gas consumed
    • execution success/failure (receipt)
    • tx type
      • single sig spend
      • multi sig spend
      • single sig spawn
      • multi sig spawn
    • principal
    • parsed contents
      • amount
      • recipient
  6. gas estimation
    • recommended maxGas per tx type
@kacpersaw kacpersaw changed the title Prepare API v2 specification Prepare API v2 specification along with the new requirements Jan 2, 2024
@pigmej pigmej changed the title Prepare API v2 specification along with the new requirements Finalize API v2 specification along with the new requirements Jan 2, 2024
@brusherru
Copy link
Member

Here are the list of APIs required by Wallet application:

Network-specific data

  • Node info: node/nodeinfo
    To get a proper HRP,
    First genesis layer & epoch size for timestamps
  • GenesisTime: mesh/genesistime
    To calculate timestamps
  • LayerDuration: mesh/layerduration
    To calculate timestamps

Node status:

  • Node status: node/status
    To ensure that Node is synced & can publish txs

User data:

  • Balance: globalstate/accountdataquery (can be replaced with globalstate/account)
  • Txs:
    • Tx data: mesh/accountmeshdataquery
    • Tx states: transaction/transactionsstate
  • Rewards: globalstate/accountdataquery

Publishing txs:

  • Gas estimation: transaction/parsetransaction
    Funny thing that it may parse TX without a signature, but then it will estimate the wrong gas amount, like it may be published without a signature. So if you don't have a signature yet — put there 64 zero-bytes and verify: false :)
    This statement is valid for gRPC as well.
  • Submit: transaction/submittransaction

All of them already exist and should work via JSON RPC (I haven't tested all of them yet).
So I'm using them now, and propose to focus on endpoints that consume too much resources or are unsafe.

@kacpersaw kacpersaw linked a pull request Jan 24, 2024 that will close this issue
@kacpersaw
Copy link
Contributor Author

kacpersaw commented Apr 2, 2024

Done

In progress:

Pending

  • Account service
  • Layer and block service
  • Account service
  • Transaction service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants