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

feat: bridge_getClaims endpoint #210

Merged
merged 13 commits into from
Feb 21, 2025
Merged

feat: bridge_getClaims endpoint #210

merged 13 commits into from
Feb 21, 2025

Conversation

rachit77
Copy link
Contributor

@rachit77 rachit77 commented Feb 14, 2025

Description

This PR exposes a JSON-RPC endpoint to fetch bridge claims. It returns all claimed transactions on the network, sorted in descending order by globalIndex, with support for pagination.

Fixes #228

@rachit77 rachit77 self-assigned this Feb 14, 2025
@temaniarpit27 temaniarpit27 changed the base branch from develop to arpit/192 February 18, 2025 12:36
@temaniarpit27 temaniarpit27 changed the base branch from arpit/192 to arpit/186 February 18, 2025 12:36
@temaniarpit27 temaniarpit27 force-pushed the arpit/186 branch 7 times, most recently from 174228c to 66ab135 Compare February 20, 2025 08:43
Base automatically changed from arpit/186 to feat/new-bridge-service February 20, 2025 09:25
@rachit77 rachit77 marked this pull request as ready for review February 21, 2025 07:22
Copy link
Contributor

@Stefan-Ethernal Stefan-Ethernal left a comment

Choose a reason for hiding this comment

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

The ordering by descending GlobalIndex seems not to be working properly.

cast rpc --rpc-url http://127.0.0.1:32793 bridge_getClaims 1 | jq

Note that the first entry is the one with the lower GlobalIndex:

{
  "claims": [
    {
      "GlobalIndex": 18446744073709551617,
      "DestinationNetwork": 1,
      "TxHash": "0x02152c9059502b05d5fa68cb796be72eba32c9b2504c004a775a80008cbc0766",
      "Amount": 100000000000000000,
      "BlockNum": 66,
      "FromAddress": "0x83f138b325164b162b320f797b57f6f7e235abac",
      "DestinationAddress": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
      "OriginAddress": "0xb26f25ed6bcb8dd7c1c7266e12fa4aaff48fc892",
      "OriginNetwork": 0,
      "BlockTimestamp": 1740130523
    },
    {
      "GlobalIndex": 18446744073709551618,
      "DestinationNetwork": 1,
      "TxHash": "0x58358644bb5ca46b0d4f3e21bfc2ff85a536eddfdd21f3441a7784c9139aa734",
      "Amount": 100000000000000000,
      "BlockNum": 110,
      "FromAddress": "0x83f138b325164b162b320f797b57f6f7e235abac",
      "DestinationAddress": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
      "OriginAddress": "0x62bf798edae1b7fde524276864757cc424a5c3dd",
      "OriginNetwork": 0,
      "BlockTimestamp": 1740130656
    }
  ],
  "count": 2
}

Since the global index is a composite key, let's discuss with the apps team, if would it make more sense to split it into the following fields using the function

For example, this is the response for the claims endpoint of the legacy bridge service

{
  "claims": [
    {
      "index": 2,
      "orig_net": 0,
      "orig_addr": "0x62bf798EdaE1B7FDe524276864757cc424A5c3dD",
      "amount": "100000000000000000",
      "network_id": 1,
      "dest_addr": "0x85dA99c8a7C2C95964c8EfD687E95E632Fc533D6",
      "block_num": "0",
      "tx_hash": "0x58358644bb5ca46b0d4f3e21bfc2ff85a536eddfdd21f3441a7784c9139aa734",
      "rollup_index": 0,
      "mainnet_flag": true
    },
    {
      "index": 1,
      "orig_net": 0,
      "orig_addr": "0xb26F25eD6bcb8dd7C1c7266E12FA4aaFF48fc892",
      "amount": "100000000000000000",
      "network_id": 1,
      "dest_addr": "0x85dA99c8a7C2C95964c8EfD687E95E632Fc533D6",
      "block_num": "0",
      "tx_hash": "0x02152c9059502b05d5fa68cb796be72eba32c9b2504c004a775a80008cbc0766",
      "rollup_index": 0,
      "mainnet_flag": true
    }
  ],
  "total_cnt": "2"
}

Copy link
Contributor

@vcastellm vcastellm left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@rachit77 rachit77 merged commit 508926e into feat/new-bridge-service Feb 21, 2025
11 checks passed
@rachit77 rachit77 deleted the claim-api branch February 21, 2025 13:55
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 this pull request may close these issues.

5 participants