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

188 paginate get address history #189

Merged
merged 14 commits into from
Jun 6, 2022
Merged

188 paginate get address history #189

merged 14 commits into from
Jun 6, 2022

Conversation

0xp3gasus
Copy link
Collaborator

@0xp3gasus 0xp3gasus commented Jun 1, 2022

Description

Features:

  • Pagination for GetAddressHistory methods.
    New parameters in request payload:
    • page: Number of page to return. 0 by default
    • pageSize: Number of elements per page. 50 by default and 50 is the maximum.
    • order: Criteria sorting. It accepts the following values:
      • asc: New transactions first. Default value
      • desc: Old transactions first
        New parameters in response payload:
    • maxPage: maximum page to return with page and pageSize values

Fixes #188

Dependencies (if any)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

curl --location --request POST 'http://localhost:80/eth/testnet/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 1654281956,
    "method": "getAddressHistory",
    "params": {
        "address": "0xcFe95817aC44C3f8CE75F1EE6EC1431F586AB5A3",
        "page": 0,
        "pageSize": 50
    },
    "jsonrpc": "2.0"
}'
{
    "id": 1654281915,
    "jsonrpc": "2.0",
    "result": {
        "address": "0xcFe95817aC44C3f8CE75F1EE6EC1431F586AB5A3",
        "txHashes": [
            "0x2a61fabb54bd4bef3afe831fd04d21fd0482162c1b53f71e434b232ec03a8134",
            "0x7070d7d453c73a04ef0e8a5ae32318055fac85e75cb933538350af16d55d2e6d",
            "0x90518943233a34776bc1bfb46f5b3419b6f1b20348a5af238361f04d1b87aae3",
            "0x522d068281b889ef32fb8a57d5376e49a3667c997a2d704854c15c5a5e1d92da",
            "0xb9aa5fa74627339448e4ae3e5a0db3a16dcaa81a5826d1f88a80b96e70e398cd",
            "0x6e31d6c3feb43a478e6b718bd2f18c435e827a446daf2f33226b3f1e8a2c17e8",
            "0x15f35205e06c30bc3cd1f7ae323924dcd704f7c0afe0342d1d31ec6c69b13f5f",
            "0xb172958ec3e9ffd17db08687f5d1bc23be4ec1e5737a941f417b8a2aa50a9954",
            "0xa365d09fa9a278c380bdd60420bcb24ac8e931139d6ee0edf0b5b50df50a7300",
            "0x6d7aae65ccf43d1627fc0c18e840a619e405b965dcedd14203d668acc16f2509",
            "0xf2a66ff743f3c4d066bd560b7f29e1083016b8e9d2f5c5f7f6808d3614c5c677",
            "0x8b3d792186037fdc65dc29a97c6f580fae3aff212567b57b10ebf43260851ac9",
            "0x47b878e75eef8f5a85d2607fbbd29b025855cd5df7158207f5a7b2ffc8467a15",
            "0x79e9fa76ced84d9bd2e12060233bf565c24da184966d9733e2fb80feb64d45fd",
            "0x253e0f59f33a6bf3b280d2af5fe9087a159fe79c06f06552b10acf41966495d1",
            "0x318d23ed298e328f499e0cc456d8c36caa30375374c9d96753bde49b6221343f",
            "0xd5beaf4159bac21acbcaa75a75f5437d11903e8c22ec25699e6957db67fc040b",
            "0x3d0aaa5a132a6800f6b7efc7f16de0293c01fa2b07abbda15a36b74ca44fdfd7",
            "0xeb5c040d25c25ac62055a9fc4bf5f0dd069f16a818230141ad0d18289df632a0",
            "0x70314a6930d053612d1b8dd8cda5d825700c1c3d628303692e232e6bd4a0b3ba",
            "0xf7daf62b021e1a2ea1de2ee8735f9342a05249944613583665222a2fc5ab02af",
            "0xa3bac7c6fbcd3d7a5688a4f9be997244a31d4f17a2067acfe2c8a47131fa71c8",
            "0xaa5bd218e77e1ba5dc19922f97424037ecff2367368a8544b42b0ded026c8927",
            "0x60a29afc9d7874dec6620fa2a272b01efc9e172d14a19190a2b42c6a324847ab",
            "0x4c317838e9c083bbe63e6c0293d34061e704af4deb9f5f3943a8eb160b012bee",
            "0x7e5f4be380fa4f91eda43ed6ed37e95a2b829166323351fd843375d1a40e3fa1",
            "0x7782ee10805fe88d8439bea869bb06eb98cb55c5c1c1be89c12354977f314780",
            "0xa980c9ed3cf86b80fd3d5cc9ffd522daed971c1c0356dd06c5e43ae013541c5c",
            "0x1ac8cd436258dcf894d0e3e05b1d6b993b290bd6e2fc05ea96aab2ca8b020042",
            "0xcc07aec082f98089910f785dd60048887c129ac696eddd680a4de5c3430487e4",
            "0x9b4121b9a39a8371dfdfe9836efa970997b63978c0620214b2770cf32a714b90",
            "0x341f604fd43dea0d53970eb54b28b3c953017b1b5b57b09fd6ee20cd0f4a64ff",
            "0x9b2f59fcf017dacf9c388efeab4a28e4264f459008b6a2d55f3ed78e99463bc8",
            "0x127604c2bd645eed6483d5081badddd5b113514c95a0a3b1744022aaa60d5ee0",
            "0x536a9b4675fbf2c157b9244c0deb033357309f9ad7c31a845688452f4823abd1",
            "0x7517cd8101531324e5e8893aba5931d98b07e3d986b576a6136cb3d7437b4074",
            "0xbfeea56e365e58283b5f794d8de312123162ed9ae81da2c32df5c1f1514be7fb",
            "0x6836ae2cd6272c2c4a5a73006028af74c5976b6247cf971eb4be7b6c7dbf88b6",
            "0xb09a4d8260ae554baf259cd82f5ff5210161462fd66b20f0928fd90c5e44eaca",
            "0x5f7c7cc455dedab2d8d70ee17c090f0ea5b5e86bda0aae196d55b0fdc6657d57",
            "0x7df8fa8d94a12b401810b349e34254755ff8055065987eb2dec02bef84c841ea",
            "0x27beb39f4763195fb075552bf3e411b7f5dab6f4f642c78154baa076699d9426",
            "0x86bbf1afb1b80485322cac47e2bad7518510b707440eed968a8664aa312cf76c",
            "0x3da04c72557c0ba3789fbdb01ce4b79433d6c6ec95a2731616236d0a42947ea3",
            "0x7ab22fd444f077d55a52bbd4c0c3a2aeb89316f6b360a5f009bef1bf33e0ae07",
            "0x5798c1af3b8173dbb9c7384936d7bb1616429d8df2cabd1b63c6100422f27b23",
            "0x512b597469baabb0152c0be6f3e2fc862041aea06d3fafc55c76444ec4bb7377",
            "0x02b9064c722210b3161773c4850cbfd6fc89fd17ad4cf1c64cf8bd151ff116d1",
            "0x4137413827a4f87bb5c4fbda9a8b513070099b396ebf20bf1863273221538231",
            "0xb65253604f0e50af79494e89632e010fde07240b6801293462d5d7f36b348ae9"
        ],
        "maxPage": 14
    }
}

Test Configuration:

  • Operating system (output of cat /etc/os-release): macOS 12.4
  • Kernel version (output of uname -sr): Darwin 21.5.0
  • Architecture (output of uname -m): x86_64

Related PR or Docs PR

Docs PR related #
Other PR related #

Good practices to consider

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@0xp3gasus 0xp3gasus marked this pull request as ready for review June 3, 2022 18:54
@phoenix-web3 phoenix-web3 merged commit f3501da into swapper-org:staging Jun 6, 2022
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.

Paginate GetAddressHistory response
2 participants