build: rename ripple-lib to xrpl.js (#1608)

* build: rename ripple-lib to xrpl.js
This commit is contained in:
Nathan Nichols
2021-09-10 09:53:31 -07:00
committed by Mayukha Vadari
parent af7b187dc7
commit 33f83947f1
7 changed files with 64 additions and 66 deletions

View File

@@ -1,6 +1,6 @@
# Applications using ripple-lib (RippleAPI) # Applications using xrpl.js
A curated list of some of the projects and apps that leverage `ripple-lib` in some way. A curated list of some of the projects and apps that leverage `xrpl.js` in some way.
**Have one to add?** Please edit this file and open a PR! **Have one to add?** Please edit this file and open a PR!
@@ -53,7 +53,7 @@ Warning: Use at your own risk.
- **[XRP Scan - XRP Ledger explorer](https://xrpscan.com)** - **[XRP Scan - XRP Ledger explorer](https://xrpscan.com)**
XRP Ledger explorer, metrics and analytics. XRP Ledger explorer, metrics and analytics.
- **[xrplorer](https://xrplorer.com)** - **[xrplorer](https://xrplorer.com)**
XRP Ledger explorer, API, metrics, and analytics using a graph database that is synchronized live with the XRPL. XRP Ledger explorer, API, metrics, and analytics using a graph database that is synchronized live with the XRPL.
@@ -132,7 +132,7 @@ Warning: Use at your own risk.
- **[XRP Faucets for Testnet and Devnet](https://xrpl.org/xrp-testnet-faucet.html)** - **[XRP Faucets for Testnet and Devnet](https://xrpl.org/xrp-testnet-faucet.html)**
Get some test funds for development on the test network. The faucet uses `ripple-lib`. Get some test funds for development on the test network. The faucet uses `xrpl.js`.
## Code samples and libraries ## Code samples and libraries
@@ -156,7 +156,7 @@ Warning: Use at your own risk.
For about $30 in parts (Raspberry Pi, 3.3V Relay board and a few wires) you can build your own power switch that will switch on if a streaming ILP payment comes in. When the payment stream stops, the power turns off. For about $30 in parts (Raspberry Pi, 3.3V Relay board and a few wires) you can build your own power switch that will switch on if a streaming ILP payment comes in. When the payment stream stops, the power turns off.
## Related apps that do not appear to use ripple-lib ## Related apps that do not appear to use xrpl.js
- **[XRP Stats](https://ledger.exposed/)** (ledger.exposed) - **[XRP Stats](https://ledger.exposed/)** (ledger.exposed)

View File

@@ -1,8 +1,8 @@
# ripple-lib (RippleAPI) # xrpl.js
A JavaScript/TypeScript API for interacting with the XRP Ledger A JavaScript/TypeScript library for interacting with the XRP Ledger
[![NPM](https://nodei.co/npm/ripple-lib.png)](https://www.npmjs.org/package/ripple-lib) [![NPM](https://nodei.co/npm/xrpl.png)](https://www.npmjs.org/package/xrpl)
This is the recommended library for integrating a JavaScript/TypeScript app with the XRP Ledger, especially if you intend to use advanced functionality such as IOUs, payment paths, the decentralized exchange, account settings, payment channels, escrows, multi-signing, and more. This is the recommended library for integrating a JavaScript/TypeScript app with the XRP Ledger, especially if you intend to use advanced functionality such as IOUs, payment paths, the decentralized exchange, account settings, payment channels, escrows, multi-signing, and more.
@@ -12,7 +12,7 @@ See the full reference documentation on the XRP Ledger Dev Portal.
## [➡️ Applications and Projects](APPLICATIONS.md) ## [➡️ Applications and Projects](APPLICATIONS.md)
What is ripple-lib used for? The applications on the list linked above use `ripple-lib`. Open a PR to add your app or project to the list! What is xrpl.js used for? The applications on the list linked above use `xrpl.js`. Open a PR to add your app or project to the list!
### Features ### Features
@@ -31,22 +31,22 @@ What is ripple-lib used for? The applications on the list linked above use `ripp
See also: [RippleAPI Beginners Guide](https://xrpl.org/get-started-with-rippleapi-for-javascript.html) See also: [RippleAPI Beginners Guide](https://xrpl.org/get-started-with-rippleapi-for-javascript.html)
In an existing project (with `package.json`), install `ripple-lib`: In an existing project (with `package.json`), install `xrpl.js`:
``` ```
$ npm install ripple-lib $ npm install xrpl
``` ```
Then see the [documentation](#documentation). Then see the [documentation](#documentation).
### Using ripple-lib with React Native ### Using xrpl.js with React Native
If you want to use `ripple-lib` with React Native you will need to have some of the NodeJS modules available. To help with this you can use a module like [rn-nodeify](https://github.com/tradle/rn-nodeify). If you want to use `xrpl.js` with React Native you will need to have some of the NodeJS modules available. To help with this you can use a module like [rn-nodeify](https://github.com/tradle/rn-nodeify).
1. Install dependencies (you can use `npm` as well): 1. Install dependencies (you can use `npm` as well):
```shell ```shell
npm install react-native-crypto npm install react-native-crypto
npm install ripple-lib npm install xrpl
# install peer deps # install peer deps
npm install react-native-randombytes npm install react-native-randombytes
# install latest rn-nodeify # install latest rn-nodeify
@@ -79,15 +79,15 @@ If you want to use `ripple-lib` with React Native you will need to have some of
... ...
``` ```
### Using ripple-lib with Deno ### Using xrpl.js with Deno
Until official support for [Deno](https://deno.land) is added, you can use the following work-around to use `ripple-lib` with Deno: Until official support for [Deno](https://deno.land) is added, you can use the following work-around to use `xrpl.js` with Deno:
```javascript ```javascript
import ripple from 'https://dev.jspm.io/npm:ripple-lib'; import xrpl from 'https://dev.jspm.io/npm:xrpl';
(async () => { (async () => {
const api = new (ripple as any).RippleAPI({ server: 'wss://s.altnet.rippletest.net:51233' }); const api = new (xrpl as any).RippleAPI({ server: 'wss://s.altnet.rippletest.net:51233' });
const address = 'rH8NxV12EuV...khfJ5uw9kT'; const address = 'rH8NxV12EuV...khfJ5uw9kT';
api.connect().then(() => { api.connect().then(() => {
@@ -106,7 +106,7 @@ import ripple from 'https://dev.jspm.io/npm:ripple-lib';
### Mailing Lists ### Mailing Lists
We have a low-traffic mailing list for announcements of new ripple-lib releases. (About 1 email per week) We have a low-traffic mailing list for announcements of new xrpl.js releases. (About 1 email per week)
+ [Subscribe to ripple-lib-announce](https://groups.google.com/forum/#!forum/ripple-lib-announce) + [Subscribe to ripple-lib-announce](https://groups.google.com/forum/#!forum/ripple-lib-announce)
@@ -141,16 +141,10 @@ Run `npm run lint` to lint the code with `eslint`.
## Generating Documentation ## Generating Documentation
Do not edit `./docs/index.md` directly because it is a generated file. Update the documentation by running `npm run docgen`.
Instead, edit the appropriate `.md.ejs` files in `./docs/src/`.
If you make changes to the JSON schemas, fixtures, or documentation sources, update the documentation by running `npm run docgen`.
## More Information ## More Information
+ [ripple-lib-announce mailing list](https://groups.google.com/forum/#!forum/ripple-lib-announce) - subscribe for release announcements + [ripple-lib-announce mailing list](https://groups.google.com/forum/#!forum/ripple-lib-announce) - subscribe for release announcements
+ [RippleAPI Reference](https://xrpl.org/rippleapi-reference.html) - XRP Ledger Dev Portal + [RippleAPI Reference](https://xrpl.org/rippleapi-reference.html) - XRP Ledger Dev Portal
+ [XRP Ledger Dev Portal](https://xrpl.org/) + [XRP Ledger Dev Portal](https://xrpl.org/)
[![Build Status](https://travis-ci.org/ripple/ripple-lib.svg?branch=master)](https://travis-ci.org/ripple/ripple-lib)

View File

@@ -2,7 +2,7 @@
## Supported Versions ## Supported Versions
This table shows which versions of ripple-lib are currently supported with security updates: This table shows which versions of xrpl.js are currently supported with security updates:
| Version | Supported | | Version | Supported |
| ------- | ---------------------- | | ------- | ---------------------- |

3
package-lock.json generated
View File

@@ -1,10 +1,11 @@
{ {
"name": "ripple-lib", "name": "xrpl",
"version": "1.10.0", "version": "1.10.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "xrpl",
"version": "1.10.0", "version": "1.10.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {

View File

@@ -28,7 +28,7 @@
// * - https://xrpl.org/monitor-incoming-payments-with-websocket.html. // * - https://xrpl.org/monitor-incoming-payments-with-websocket.html.
// * // *
// * For the implementation in this example, we have made the following decisions: // * For the implementation in this example, we have made the following decisions:
// * 1) The script will choose the account sequence and LastLedgerSequence numbers automatically. We allow ripple-lib to choose the fee. // * 1) The script will choose the account sequence and LastLedgerSequence numbers automatically. We allow xrpl.js to choose the fee.
// * Payments are defined upfront, and idempotency is not needed. If the script is run a second time, duplicate payments will result. // * Payments are defined upfront, and idempotency is not needed. If the script is run a second time, duplicate payments will result.
// * 2) We will listen for notification that a new validated ledger has been found, and poll for transaction status at that time. // * 2) We will listen for notification that a new validated ledger has been found, and poll for transaction status at that time.
// * Futhermore, as a precaution, we will wait until the server is 3 ledgers past the transaction's LastLedgerSequence // * Futhermore, as a precaution, we will wait until the server is 3 ledgers past the transaction's LastLedgerSequence

View File

@@ -9,14 +9,14 @@
<div id="mocha"></div> <div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script> <script src="../node_modules/mocha/mocha.js"></script>
<script src="hacks/phantomhacks.js"></script> <script src="hacks/phantomhacks.js"></script>
<script src="../build/ripple-latest.js"></script> <script src="../build/xrpl-latest.js"></script>
<script> <script>
if (window.initMochaPhantomJS) { if (window.initMochaPhantomJS) {
window.initMochaPhantomJS(); window.initMochaPhantomJS();
} }
mocha.ui('bdd') mocha.ui('bdd')
</script> </script>
<script src="../testCompiledForWeb/integration.js"></script> <script src="../testCompiledForWeb/integration.js"></script>
<script> <script>

View File

@@ -2,36 +2,39 @@
const path = require('path') const path = require('path')
const webpack = require('webpack') const webpack = require('webpack')
const assert = require('assert') const assert = require('assert')
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer') const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
function getDefaultConfiguration() { function getDefaultConfiguration() {
return { return {
cache: true, cache: true,
performance: {hints: false}, performance: { hints: false },
stats: 'errors-only', stats: 'errors-only',
entry: './dist/npm/index.js', entry: './dist/npm/index.js',
output: { output: {
library: 'ripple', library: 'ripple',
path: path.join(__dirname, 'build/'), path: path.join(__dirname, 'build/'),
filename: `ripple-lib.default.js` filename: `xrpl.default.js`,
}, },
plugins: [ plugins: [
new webpack.NormalModuleReplacementPlugin(/^ws$/, './wsWrapper'), new webpack.NormalModuleReplacementPlugin(/^ws$/, './wsWrapper'),
new webpack.NormalModuleReplacementPlugin(/^\.\/wallet\/index$/, './wallet-web'), new webpack.NormalModuleReplacementPlugin(
/^\.\/wallet\/index$/,
'./wallet-web',
),
new webpack.NormalModuleReplacementPlugin( new webpack.NormalModuleReplacementPlugin(
/^.*setup-api$/, /^.*setup-api$/,
'./setup-api-web' './setup-api-web',
), ),
new webpack.ProvidePlugin({process: 'process/browser'}), new webpack.ProvidePlugin({ process: 'process/browser' }),
new webpack.ProvidePlugin({Buffer: ['buffer', 'Buffer']}) new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
], ],
module: { module: {
rules: [] rules: [],
}, },
resolve: { resolve: {
alias: { alias: {
'ws': './dist/npm/client/wsWrapper.js', ws: './dist/npm/client/wsWrapper.js',
'https-proxy-agent': false 'https-proxy-agent': false,
}, },
extensions: ['.js', '.json'], extensions: ['.js', '.json'],
fallback: { fallback: {
@@ -41,9 +44,9 @@ function getDefaultConfiguration() {
stream: require.resolve('stream-browserify'), stream: require.resolve('stream-browserify'),
crypto: require.resolve('crypto-browserify'), crypto: require.resolve('crypto-browserify'),
https: require.resolve('https-browserify'), https: require.resolve('https-browserify'),
http: require.resolve('stream-http') http: require.resolve('stream-http'),
} },
} },
} }
} }
@@ -58,24 +61,24 @@ function webpackForTest(testFileName) {
externals: [ externals: [
{ {
'xrpl-local': 'ripple', 'xrpl-local': 'ripple',
'net': 'null' net: 'null',
} },
], ],
entry: testFileName, entry: testFileName,
output: { output: {
library: match[1].replace(/-/g, '_'), library: match[1].replace(/-/g, '_'),
path: path.join(__dirname, './testCompiledForWeb/'), path: path.join(__dirname, './testCompiledForWeb/'),
filename: match[1] + '.js' filename: match[1] + '.js',
}, },
plugins: [ plugins: [
new webpack.ProvidePlugin({process: 'process/browser'}), new webpack.ProvidePlugin({ process: 'process/browser' }),
new webpack.ProvidePlugin({Buffer: ['buffer', 'Buffer']}) new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
], ],
module: { module: {
rules: [ rules: [
{ {
test: /jayson/, test: /jayson/,
use: 'null' use: 'null',
}, },
{ {
test: /\.ts$/, test: /\.ts$/,
@@ -86,23 +89,23 @@ function webpackForTest(testFileName) {
compilerOptions: { compilerOptions: {
composite: false, composite: false,
declaration: false, declaration: false,
declarationMap: false declarationMap: false,
} },
} },
} },
] ],
} },
] ],
}, },
node: { node: {
global: true, global: true,
__filename: false, __filename: false,
__dirname: true __dirname: true,
}, },
resolve: { resolve: {
alias: { alias: {
'ws': './dist/npm/client/wsWrapper.js', ws: './dist/npm/client/wsWrapper.js',
'https-proxy-agent': false 'https-proxy-agent': false,
}, },
extensions: ['.ts', '.js', '.json'], extensions: ['.ts', '.js', '.json'],
fallback: { fallback: {
@@ -112,9 +115,9 @@ function webpackForTest(testFileName) {
stream: require.resolve('stream-browserify'), stream: require.resolve('stream-browserify'),
crypto: require.resolve('crypto-browserify'), crypto: require.resolve('crypto-browserify'),
path: require.resolve('path-browserify'), path: require.resolve('path-browserify'),
http: require.resolve('stream-http') http: require.resolve('stream-http'),
} },
} },
} }
return Object.assign({}, getDefaultConfiguration(), test) return Object.assign({}, getDefaultConfiguration(), test)
} }
@@ -123,17 +126,17 @@ module.exports = [
(env, argv) => { (env, argv) => {
const config = getDefaultConfiguration() const config = getDefaultConfiguration()
config.mode = 'development' config.mode = 'development'
config.output.filename = `ripple-latest.js` config.output.filename = `xrpl-latest.js`
return config return config
}, },
(env, argv) => { (env, argv) => {
const config = getDefaultConfiguration() const config = getDefaultConfiguration()
config.mode = 'production' config.mode = 'production'
config.output.filename = `ripple-latest-min.js` config.output.filename = `xrpl-latest-min.js`
if (process.argv.includes('--analyze')) { if (process.argv.includes('--analyze')) {
config.plugins.push(new BundleAnalyzerPlugin()) config.plugins.push(new BundleAnalyzerPlugin())
} }
return config return config
}, },
(env, argv) => webpackForTest('./test/integration/integration.ts') (env, argv) => webpackForTest('./test/integration/integration.ts'),
] ]