- 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>
refactor: type Transaction to include all tx
BREAKING CHANGE: `Transaction` type has been redefined to include all
transactions and `SubmittableTransaction` was created to define the old
value. The following functions which only handle transactions to be
submitted now use `SubmittableTransaction`:
* `Client.autofill`
* `Client.submit`
* `Client.submitAndWait`
* `Client.prepareTransaction`
* `getSignedTx`
* `isAccountDelete`
Reduces filesize by 3kb minified and gzipped or 2.8% and reduces bundler
config steps.
- Move `WSWrapper` to `@xrpl/isomorphic` to remove the need to add
mapping of `ws` to `WSWrapper` file in bundler configs
- Switch to `eventemitter3` which is smaller than `events` by almost
1kb and will not require a mapping to node's `events` in `vite`
bundling. `webpack` always automatically maps it.
- max listeners is not a thing for `eventemitter3` so we do not
need to set it to `Infinity`. `ws` uses the native event emitter which
does still need that to be set.
- Remove `eventemitter2` which was only used in tests and was replaced
with `eventemitter3`
BREAKING CHANGE: Config for frontend bundlers has changed for `ws`.
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 type for metadata for specific transactions(`Payment`, `NFTokenMint`, `NFTokenCreateOffer`, `NFTokenAcceptOffer`, `NFTokenCancelOffer`)
Closes#2316
- 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.
Fields that were encoded as STAccounts were turning '' into rrrrrrrrrrrrrrrrrrrrrhoLvTp the ACCOUNT_ZERO account. They will now throw a ValidationError.
Invalid addresses on a transaction now throws a ValidationError when submitting a transaction instead of Error('checksum_invalid').
This change updates some error messages for fields a few fields that aren't accounts, DestinationTag or NFTokenID. They will still be of type ValidationError.
Fixes: #2517 and #2475
---------
Co-authored-by: Elliot Lee <github.public@intelliot.com>
- Add missing `type` param
- Clean up typing of `type` param and the response property
`account_objects` of the `account_objects` request
- Create interfaces `HasPreviousTxnID` and `MissingPreviousTxnID`. This
helps clean up type checking with regard to the presence of
`PreviousTxnID` and `MissingPreviousTxnID`
Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
Co-authored-by: Caleb Kniffen <ckniffen@ripple.com>
* Add pseudo transactions as types returned by `tx` and `ledger`
* Make` LedgerEntryResponse` generic to allow custom ledger entries
* Update UNLModify to extend BaseTransaction
* Create type `PseudoTransaction`
Co-authored-by: Caleb Kniffen <ckniffen@ripple.com>
You can now `NFTokenMint` and `NFTokenCreateOffer` transactions with
`Flags` set to a map like other transactions with flags do.
ex. `{ tfSellNFToken: true }`
Expose most of the types in the `xrpl` package. Some renames will only
affect you if you were deep importing these types previously.
Renames of deep importable types:
- `methods/bookOffers`: `TakerAmount` -> `BookOfferCurrency`
- `methods/accountLines`: `Trustline` -> `AccountLinesTrustline`
- Add `ledger_hash` and `ledger_index` to `account_nfts`,
`nft_buy_offers`, and `nft_sell_offers` requests.
- Add `nft_page` to `ledger_entry` request.
- Create `LookupByLedgerRequest` to clean up `ledger_hash` and
`ledger_index` which are optional on most request objects.
Closes#2135
* Update NFTokenMint test
* Ensure the binary version works as well
* Remove meta being undefined in txResponse
* Remove error test
* Re-add test, error, and lint
* Add meta to test, and add string to allowed type
* Re-add meta being undefined with proper docs