- Removes need for bundlers to polyfill the `Buffer` class. `UInt8Array` are used instead which are native to the browser and node.
- Reduces bundle size 7.1kb gzipped and eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
BREAKING CHANGE: All methods that previously took a `Buffer` now accept a `UInt8Array`.
---------
Co-authored-by: Jackson Mills <jmills@ripple.com>
Switch to using `@noble/hashes`, `@noble/curves`, `@scure/base`,
`@scure/bip32`, and `@scure/bip39`. This replaces `crypto` polyfills
(such as `crypto-browserify`), `create-hash`, `elliptic`, `hash.js`,
`bn.js` (both versions), and their many dependencies. This also means
there are 33 less dependencies downloaded when running a fresh
`npm install` and will make the project much easier to maintain.
This reduces the bundle size by 44% (82kb minified and gzipped) over
the current 3.0 branch as well as reducing the amount of configuration
required to bundle.
Closes#1814, #1817, #2272, and #2306
Co-authored-by: Caleb Kniffen <ckniffen@ripple.com>
- Add `xrpl-secret-numbers` by @WietseWind to the mono repo.
- `unpkg` and `jsdelivr` support was simplified by adding fields to package.json.
- Unit tests run in a browser and node.
BREAKING CHANGES:
- `xrpl-secret-numbers` is now `@xrplf/secret-numbers`.
- Changed the bundled file produced changed from `dist/browerified.js` to `build/xrplf-secret-numbers-latest.js`.
- Bundle variable is `xrplf_secret_numbers` instead of using browserify's loader.
- If using CDN instructions in README will need to update to `https://cdn.jsdelivr.net/npm/@xrplf/secret-numbers`
Making this library part of the monorepo was discussed in #1788. This solves several problems with the upcoming `xrpl.js@3.0`.
`xrpl-secret-numbers` has a dependency of `ripple-keypairs` and `xrpl` has a depenendecy on `xrpl-secret-numbers`. This means that any change would require a separate release of `ripple-keypairs`, then a release of `xrpl-secret-numbers`, followed by `xrpl`. Now they can be released all at once
In 3.0 we eliminated the need for many polyfills like `util`, `assert`, and soon to be `buffer` (after noble libs PR is merged). `xrpl-secret-numbers` still needs those. This will also eliminate them and anytime similar changes in the future will be much easier. This further reduces the bundle size of 3.0 branch by over 10% as well as reducing bundler setup.
* stop webpacking bn multiple times
* add to test webpacking
* fix webpacking issues, make sure tests work
* remove debugging leftovers
* add link to github issue
* revert package-lock changes
* uncomment dev mode webpacking
* increase browser test timeout
* add Wallet.generate() and
* return Wallet in generateFaucetWallet
* refactor Wallet tests
* rename wallet-generation.ts to generateFaucetWallet.ts
* rename and move Wallet.ts to src/wallet/index.ts and update webpack config
* sets up linting config and runs `yarn lint --fix` once, so that all changes will show up correctly in future PRs.
* Note that there are still a lot of linter errors.
* generate faucet wallet
* updated comments
* added example in documentation
* updated documentation
* Added xprl.org link in docs
* updated code snippet
* Made changes from comments
* new changes from comments
* yarn.lock
* removed axios and use https.request
* updated webpack to include http and https fallback
* fixed files formatting
* small fixes
* Fix typo for Testnet
Co-authored-by: Elliot Lee <github.public@intelliot.com>
Co-authored-by: Elliot Lee <github.public@intelliot.com>