XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.19k stars 507 forks source link

feat: add rippled API v2 support and use as default #2656

Closed khancode closed 1 week ago

khancode commented 4 months ago

High Level Overview of Change

Add rippled api_version support for v2 and use as default while maintaining support for v1.

Context of Change

Type of Change

Did you update HISTORY.md?

Test Plan

Updated existing unit/integ tests and added new ones.

khancode commented 2 months ago

api_version 2 is supported by 100% of rippled servers now that numerous v2 amendments have activated. (as of April 8, 2024.) Therefore, we decided to drop type support for API v1 and just default to use v2 - https://github.com/XRPLF/xrpl.js/pull/2687

khancode commented 2 months ago

Reopening since we decided it's best to continue TS type support of v1 and only deprecate features/versions when rippled does.

khancode commented 1 week ago
  • [ ] For all your tests, shouldn't we be keeping v1 tests? I know you added some v1 tests, but you changed a lot of tests to use tx_json but I didn't see tests for making sure v1 still works
  • [ ] I think we should add a warning to people when they're trying to access v1 data but the library is defaulting to v2 -- Likely we can use a class getter than throws an error when they try to access the wrong tx or tx_json
  1. I only kept v1 tests specifically for the RPC responses that changed. I thought it would be repetitive to test for v1 in all other tests that indirectly use these RPC responses. So the v1 response tests are still covered.
  2. I don't think we shouldn't add this complexity since that's what the updated/different TS models are for and virtually all validators run v2 now.