feat: Upgrade to Node 18 and remove cross-fetch (#2678) (#2737)

* feat: Upgrade to Node 18 and remove cross-fetch (#2678)

BREAKING CHANGE: fetch now relies on the native javascript environment in browsers and node.js

Co-authored-by: justinr1234 <justinr1234@gmail.com>
This commit is contained in:
Chenna Keshava B S
2024-07-16 11:04:47 -07:00
committed by GitHub
parent c9ef96e0a2
commit 3bc3c2029b
12 changed files with 1559 additions and 14677 deletions

View File

@@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
steps:
- uses: actions/checkout@v3
@@ -60,7 +60,7 @@ jobs:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
@@ -101,7 +101,7 @@ jobs:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
@@ -153,7 +153,7 @@ jobs:
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
steps:
- uses: actions/checkout@v3
@@ -205,7 +205,7 @@ jobs:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3

View File

@@ -12,7 +12,7 @@
### Requirements
We use Node v16 for development - that is the version that our linters require.
We use Node v18 for development - that is the version that our linters require.
You must also use `npm` v7. You can check your `npm` version with:
```bash
@@ -104,6 +104,8 @@ The 4 packages currently here are:
2. ripple-binary-codec - A library for serializing and deserializing transactions for the ledger.
3. ripple-keypairs - A library for generating and using cryptographic keypairs.
4. ripple-address-codec - A library for encoding and decoding XRP Ledger addresses and seeds.
5. isomorphic - A collection of isomorphic implementations of crypto and utility functions.
6. secret-numbers - Generate XRPL Accounts with a number-based secret: 8 chunks of 6 digits.
Each package has it's own README which dives deeper into what it's main purpose is, and the core functionality it offers.
They also run tests independently as they were originally in separate repositories.

View File

@@ -19,13 +19,13 @@ See the full reference documentation for all classes, methods, and utilities.
4. Subscribing to changes in the ledger ([Ex. ledger, transactions, & more...](https://xrpl.org/subscribe.html))
5. Parsing ledger data into more convenient formats ([`xrpToDrops`](https://js.xrpl.org/functions/xrpToDrops.html) and [`rippleTimeToISOTime`](https://js.xrpl.org/functions/rippleTimeToISOTime.html))
All of which works in Node.js (tested for v16+) & web browsers (tested for Chrome).
All of which works in Node.js (tested for v18+) & web browsers (tested for Chrome).
# Quickstart
### Requirements
+ **[Node.js v16](https://nodejs.org/)** is recommended. We also support v18 and v20. Other versions may work but are not frequently tested.
+ **[Node.js v18](https://nodejs.org/)** is recommended. We also support v20. Other versions may work but are not frequently tested.
### Installing xrpl.js
@@ -56,7 +56,7 @@ async function main() {
});
console.log(response);
client.disconnect();
await client.disconnect();
}
main();
```

16194
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@
"@types/chai": "^4.2.21",
"@types/jest": "^29.2.2",
"@types/lodash": "^4.14.136",
"@types/node": "^16.18.38",
"@types/node": "^18.19.29",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
@@ -64,7 +64,7 @@
"./packages/*"
],
"engines": {
"node": ">=16.0.0",
"node": ">=18.0.0",
"npm": ">=7.10.0 < 10.0.0"
}
}

View File

@@ -33,7 +33,7 @@
"ws": "^8.13.0"
},
"devDependencies": {
"@types/node": "^16.18.38",
"@types/node": "^18.18.38",
"@types/ws": "^8.5.6"
},
"repository": {
@@ -43,6 +43,6 @@
"license": "ISC",
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
}
}

View File

@@ -34,6 +34,6 @@
},
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">= 16"
"node": ">= 18"
}
}

View File

@@ -41,6 +41,6 @@
"readmeFilename": "README.md",
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">= 16"
"node": ">= 18"
}
}

View File

@@ -36,6 +36,6 @@
"license": "ISC",
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">= 16"
"node": ">= 18"
}
}

View File

@@ -18,6 +18,8 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
### BREAKING CHANGES
* Small fix in the API to use a new flag name `tfNoDirectRipple` instead of the existing flag name `tfNoRippleDirect`
* Node.js has been upgraded to a minimum version of 18
* `fetch` now relies on the native javascript environment in browsers and Node.js
### Added
* Support for the Price Oracles amendment (XLS-47).

View File

@@ -27,14 +27,13 @@
"@xrplf/isomorphic": "^1.0.1",
"@xrplf/secret-numbers": "^1.0.0",
"bignumber.js": "^9.0.0",
"cross-fetch": "^4.0.0",
"eventemitter3": "^5.0.1",
"ripple-address-codec": "^5.0.0",
"ripple-binary-codec": "^2.1.0",
"ripple-keypairs": "^2.0.0"
},
"devDependencies": {
"@types/node": "^16.18.38",
"@types/node": "^18.18.38",
"eventemitter3": "^5.0.1",
"https-proxy-agent": "^7.0.1",
"karma": "^6.4.1",
@@ -87,6 +86,6 @@
"xrpl"
],
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
}
}

View File

@@ -1,4 +1,3 @@
import fetch from 'cross-fetch'
import { isValidClassicAddress } from 'ripple-address-codec'
import type { Client } from '../client'