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

Use hex on ledger_getSoftConfirmationStatus #1530

Closed
otaliptus opened this issue Nov 28, 2024 · 4 comments · Fixed by #1535
Closed

Use hex on ledger_getSoftConfirmationStatus #1530

otaliptus opened this issue Nov 28, 2024 · 4 comments · Fixed by #1535
Assignees
Labels
P-low Low priority

Comments

@otaliptus
Copy link
Member

otaliptus commented Nov 28, 2024

Is your feature request related to a problem? Please describe.

To check if transaction is finalized, one must
a) Get the block number of the transaction from the RPC
b) Use ledger_getSoftConfirmationStatus endpoint to check if the corresponding block is finalized

A tiny problem here is that option a) returns block number in hex, while option b) accepts decimals.
While it's easy to do the conversion, we can unify such usage - or can decide on all endpoints how the usage should be for final.

Describe the solution you'd like
I'd probably make this hex or allowing both strings and numbers and then auto-deciding which data type is used

Describe alternatives you've considered
None, it's not something super important.

@otaliptus otaliptus added the P-low Low priority label Nov 28, 2024
@eyusufatik eyusufatik added this to the Mainnet Should milestone Nov 28, 2024
@jfldde
Copy link
Contributor

jfldde commented Nov 28, 2024

Which RPC are you using for a ?

@otaliptus
Copy link
Member Author

I useeth_getTransactionByHash or eth_getTransactionReceipt- any better alternatives?

@otaliptus
Copy link
Member Author

Sample Request a)

╰─ curl --request POST \                                                         
     --url https://rpc.testnet.citrea.xyz \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByHash",
  "params": [
    "0xb6c8d3b01b63f20860f988cfa7bca943f2a48abad466a7495f8198dfb9f10761"
  ]
}' | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   888  100   722  100   166   6778   1558 --:--:-- --:--:-- --:--:--  8377
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "hash": "0xb6c8d3b01b63f20860f988cfa7bca943f2a48abad466a7495f8198dfb9f10761",
    "nonce": "0xab6c6",
    "blockHash": "0x957183ec3c23c0a43fbf11ccc915ee3d367cd681ec0194320e680bb1b64ca9da",
    "blockNumber": "0x2f0a03",
    "transactionIndex": "0x0",
    "from": "0x60e2fcedd1902f5db21889f0af7f36b7ecf6e53c",
    "to": "0x7d1c08046077db652d92f90cfdfd5f35f334983f",
    "value": "0x11c37937e08000",
    "gasPrice": "0x4c4b400",
    "gas": "0xddae",
    "maxFeePerGas": "0x55d4a80",
    "maxPriorityFeePerGas": "0x42c1d80",
    "input": "0x",
    "r": "0x863f56adb53c560c6cc1892aa8321e80418b339ec2c53c489b4b6ec7c11ca969",
    "s": "0x17e7c65e9f596778907965d68eddd8c9fb73e1d7feef23fcd8f72024d088312b",
    "v": "0x1",
    "yParity": "0x1",
    "chainId": "0x13fb",
    "accessList": [],
    "type": "0x2"
  }
}

Sample Request b)

╰─ curl --request POST \                                                            
     --url https://rpc.testnet.citrea.xyz \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "ledger_getSoftConfirmationStatus",
  "params": [5]
}' | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   144  100    45  100    99    709   1560 --:--:-- --:--:-- --:--:--  2285
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "finalized"
}

@jfldde
Copy link
Contributor

jfldde commented Nov 28, 2024

That's a natural flow and should work with hex in line with eth_getBlockByNumber

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

Successfully merging a pull request may close this issue.

3 participants