Skip to content

feat: switch to using JSON-RPC 2.0 by default #70

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

Merged
merged 7 commits into from
May 19, 2025
Merged

Conversation

zivkovicmilos
Copy link
Member

@zivkovicmilos zivkovicmilos commented May 6, 2025

Description

This PR introduces the usage of the JSON-RPC 2.0 standard for faucet responses, which should also be adopted by all middlewares.

To request a faucet drip after this PR, the caller needs to call the method "drip".
The params for the drip are:

  1. the beneficiary (required)
  2. the amount (optional, defaults to max send amount of the faucet)
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "drip",
  "params": [
    "g1e6gxg5tvc55mwsn7t7dymmlasratv7mkv0rap2",
    "1000ugnot"
  ]
}

The responses will also follow the JSON-RPC 2.0 standard:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Successful faucet transfer"
}

Error responses will look like (result is null):

{
  "error": {
    "message": "invalid beneficiary address, invalid separator index -1",
    "code": -32602
  },
  "id": 1,
  "jsonrpc": "2.0"
}

@Kouteki Kouteki moved this from Triage to In Review in 🧙‍♂️gno.land core team May 6, 2025
Copy link
Contributor

@aeddi aeddi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Co-authored-by: Antoine Eddi <5222525+aeddi@users.noreply.github.com>
@zivkovicmilos zivkovicmilos merged commit 683252e into main May 19, 2025
3 checks passed
@zivkovicmilos zivkovicmilos deleted the jsonrpc-2.0 branch May 19, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants