mirror of
				https://github.com/Xahau/xahau.js.git
				synced 2025-11-04 04:55:48 +00:00 
			
		
		
		
	xahau-patch
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
const xrpl = require("xrpl");
 | 
			
		||||
const xahau = require("xahau");
 | 
			
		||||
const fs = require("fs");
 | 
			
		||||
const path = require("path");
 | 
			
		||||
 | 
			
		||||
@@ -12,7 +12,7 @@ const amendmentsToIgnore = [
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
async function main() {
 | 
			
		||||
  const client = new xrpl.Client(networkToEmulate);
 | 
			
		||||
  const client = new xahau.Client(networkToEmulate);
 | 
			
		||||
  await client.connect();
 | 
			
		||||
 | 
			
		||||
  // Looks up what amendments have been enabled via their hash
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ r.ripple.com 51235
 | 
			
		||||
# 3. Click on each amendment to get their Amendment ID and name to add to this list manually.
 | 
			
		||||
#    You will likely update the list with all amendments from a new release of rippled all at once.
 | 
			
		||||
 | 
			
		||||
# To get the list of amendments on a network (e.g. devnet) follow the steps in xrpl.js's CONTRIBUTING.md for "Updating the Docker container".
 | 
			
		||||
# To get the list of amendments on a network (e.g. devnet) follow the steps in xahau.js's CONTRIBUTING.md for "Updating the Docker container".
 | 
			
		||||
# https://github.com/Xahau/xahau.js/blob/main/CONTRIBUTING.md
 | 
			
		||||
# (Running the script `getNewAmendments.js` should help you identify any new amendments that should be added.)
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@xrplf/isomorphic",
 | 
			
		||||
  "version": "1.0.1",
 | 
			
		||||
  "description": "A collection of isomorphic and tree-shakeable crypto hashes and utils for xrpl.js",
 | 
			
		||||
  "description": "A collection of isomorphic and tree-shakeable crypto hashes and utils for xahau.js",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "crypto",
 | 
			
		||||
    "isomorphic",
 | 
			
		||||
 
 | 
			
		||||
@@ -91,7 +91,7 @@ class XrplDefinitionsBase {
 | 
			
		||||
   * Associates each Field to a corresponding class that TypeScript can recognize.
 | 
			
		||||
   *
 | 
			
		||||
   * @param types a list of type objects with the same name as the fields defined.
 | 
			
		||||
   *              Defaults to xrpl.js's core type definitions.
 | 
			
		||||
   *              Defaults to xahau.js's core type definitions.
 | 
			
		||||
   */
 | 
			
		||||
  public associateTypes(types: Record<string, typeof SerializedType>): void {
 | 
			
		||||
    // Overwrite any existing type definitions with the given types
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ module.exports = function (config) {
 | 
			
		||||
    webpack: webpackConfig,
 | 
			
		||||
 | 
			
		||||
    // list of files / patterns to load in the browser
 | 
			
		||||
    files: ['build/xrpl-latest.js', 'test/integration/**/*.test.ts'],
 | 
			
		||||
    files: ['build/xahau-latest.js', 'test/integration/**/*.test.ts'],
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  baseKarmaConfig(config)
 | 
			
		||||
 
 | 
			
		||||
@@ -4,16 +4,16 @@
 | 
			
		||||
  "license": "ISC",
 | 
			
		||||
  "description": "A TypeScript/JavaScript API for interacting with the XAH Ledger in Node.js and the browser",
 | 
			
		||||
  "files": [
 | 
			
		||||
    "build/xrpl-latest-min.js",
 | 
			
		||||
    "build/xrpl-latest-min.js.map",
 | 
			
		||||
    "build/xrpl-latest.js",
 | 
			
		||||
    "build/xrpl-latest.js.map",
 | 
			
		||||
    "build/xahau-latest-min.js",
 | 
			
		||||
    "build/xahau-latest-min.js.map",
 | 
			
		||||
    "build/xahau-latest.js",
 | 
			
		||||
    "build/xahau-latest.js.map",
 | 
			
		||||
    "dist/npm/*",
 | 
			
		||||
    "src/*"
 | 
			
		||||
  ],
 | 
			
		||||
  "main": "dist/npm/",
 | 
			
		||||
  "unpkg": "build/xrpl-latest-min.js",
 | 
			
		||||
  "jsdelivr": "build/xrpl-latest-min.js",
 | 
			
		||||
  "unpkg": "build/xahau-latest-min.js",
 | 
			
		||||
  "jsdelivr": "build/xahau-latest-min.js",
 | 
			
		||||
  "types": "dist/npm/index.d.ts",
 | 
			
		||||
  "directories": {
 | 
			
		||||
    "test": "test"
 | 
			
		||||
@@ -57,8 +57,8 @@
 | 
			
		||||
    "analyze": "webpack --analyze",
 | 
			
		||||
    "watch": "run-s build:lib --watch",
 | 
			
		||||
    "clean": "rm -rf ./dist ./coverage ./test/testCompiledForWeb tsconfig.build.tsbuildinfo",
 | 
			
		||||
    "docgen": "tsc --build tsconfig.docs.json && typedoc && echo js.xrpl.org >> ../../docs/CNAME",
 | 
			
		||||
    "prepare": "copyfiles ../../README.md xrpl/README.md",
 | 
			
		||||
    "docgen": "tsc --build tsconfig.docs.json && typedoc && echo js.xahau.org >> ../../docs/CNAME",
 | 
			
		||||
    "prepare": "copyfiles ../../README.md xahau/README.md",
 | 
			
		||||
    "prepublish": "run-s clean build",
 | 
			
		||||
    "test": "jest --config=jest.config.unit.js --verbose false --silent=false",
 | 
			
		||||
    "test:integration": "TS_NODE_PROJECT=tsconfig.build.json jest --config=jest.config.integration.js --verbose false --silent=false --runInBand",
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ export interface FaucetRequestBody {
 | 
			
		||||
  usageContext?: string
 | 
			
		||||
  /**
 | 
			
		||||
   * Information about the context of where the faucet is being called from.
 | 
			
		||||
   * Ex: xrpl.js or xrpl-py
 | 
			
		||||
   * Ex: xahau.js or xahau-py
 | 
			
		||||
   */
 | 
			
		||||
  userAgent: string
 | 
			
		||||
}
 | 
			
		||||
@@ -110,7 +110,7 @@ export interface FundWalletOptions {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * Helper function to request funding from a faucet. Should not be called directly from outside the xrpl.js library.
 | 
			
		||||
 * Helper function to request funding from a faucet. Should not be called directly from outside the xahau.js library.
 | 
			
		||||
 *
 | 
			
		||||
 * @param options - See below
 | 
			
		||||
 * @param options.faucetHost - A custom host for a faucet server. On devnet,
 | 
			
		||||
 
 | 
			
		||||
@@ -135,7 +135,7 @@ export class Wallet {
 | 
			
		||||
   *
 | 
			
		||||
   * @example
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Wallet } = require('xah')
 | 
			
		||||
   * const { Wallet } = require('xahau')
 | 
			
		||||
   * const wallet = Wallet.generate()
 | 
			
		||||
   * ```
 | 
			
		||||
   *
 | 
			
		||||
@@ -320,7 +320,7 @@ export class Wallet {
 | 
			
		||||
   * @example
 | 
			
		||||
   *
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client, Wallet } = require('xah')
 | 
			
		||||
   * const { Client, Wallet } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   *
 | 
			
		||||
   * async function signTransaction() {
 | 
			
		||||
 
 | 
			
		||||
@@ -505,7 +505,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * @returns void
 | 
			
		||||
   * @example
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.getServerInfo()
 | 
			
		||||
   * console.log(client.networkID)
 | 
			
		||||
@@ -533,7 +533,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * Client.connect() establishes a connection between a Client object and the server.
 | 
			
		||||
   *
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
   * // do something with the client
 | 
			
		||||
@@ -546,7 +546,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   *
 | 
			
		||||
   * @example
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
   * // do something with the client
 | 
			
		||||
@@ -570,7 +570,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * To use the disconnect() method, you first need to create a new Client object and connect it to a server:
 | 
			
		||||
   *
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
   * // do something with the client
 | 
			
		||||
@@ -595,7 +595,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * @category Network
 | 
			
		||||
   * @example
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
   * console.log(client.isConnected())
 | 
			
		||||
@@ -620,7 +620,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * @example
 | 
			
		||||
   *
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   *
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   *
 | 
			
		||||
@@ -705,7 +705,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   *
 | 
			
		||||
   * @example
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client, Wallet } = require('xah')
 | 
			
		||||
   * const { Client, Wallet } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
   * const wallet = Wallet.generate()
 | 
			
		||||
@@ -744,7 +744,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * @example
 | 
			
		||||
   *
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client, Wallet } = require('xah')
 | 
			
		||||
   * const { Client, Wallet } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   *
 | 
			
		||||
   * async function submitTransaction() {
 | 
			
		||||
@@ -884,7 +884,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   *
 | 
			
		||||
   * @example
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
   *
 | 
			
		||||
@@ -895,7 +895,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   *       limit: 10
 | 
			
		||||
   *     };
 | 
			
		||||
   *
 | 
			
		||||
   *     const balances = await xrplClient.getBalances(address, options);
 | 
			
		||||
   *     const balances = await xahauClient.getBalances(address, options);
 | 
			
		||||
   *
 | 
			
		||||
   *     console.log('Account Balances:');
 | 
			
		||||
   *     balances.forEach((balance) => {
 | 
			
		||||
@@ -1045,7 +1045,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   *
 | 
			
		||||
   * @example
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const { Client } = require('xah')
 | 
			
		||||
   * const { Client } = require('xahau')
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
   * const ledgerIndex = await client.getLedgerIndex()
 | 
			
		||||
@@ -1070,7 +1070,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * @example
 | 
			
		||||
   *
 | 
			
		||||
   * Example 1: Fund a randomly generated wallet
 | 
			
		||||
   * const { Client, Wallet } = require('xah')
 | 
			
		||||
   * const { Client, Wallet } = require('xahau')
 | 
			
		||||
   *
 | 
			
		||||
   * const client = new Client('wss://xahau-test.net')
 | 
			
		||||
   * await client.connect()
 | 
			
		||||
@@ -1081,7 +1081,7 @@ class Client extends EventEmitter<EventTypes> {
 | 
			
		||||
   * Along with the Wallet object to track the keys for that account. If you'd like, you can also re-fill an existing
 | 
			
		||||
   * Account by passing in a Wallet you already have.
 | 
			
		||||
   * ```ts
 | 
			
		||||
   * const api = new xrpl.Client("wss://xahau-test.net")
 | 
			
		||||
   * const api = new xahau.Client("wss://xahau-test.net")
 | 
			
		||||
   * await api.connect()
 | 
			
		||||
   * const { wallet, balance } = await api.fundWallet()
 | 
			
		||||
   * ```
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* eslint-disable max-classes-per-file -- Errors can be defined in the same file */
 | 
			
		||||
/**
 | 
			
		||||
 * Base Error class for xrpl.js. All Errors thrown by xrpl.js should throw
 | 
			
		||||
 * Base Error class for xahau.js. All Errors thrown by xahau.js should throw
 | 
			
		||||
 * XahlErrors.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
@@ -62,28 +62,28 @@ class XahlError extends Error {
 | 
			
		||||
class XahaudError extends XahlError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js cannot specify error type.
 | 
			
		||||
 * Error thrown when xahau.js cannot specify error type.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 */
 | 
			
		||||
class UnexpectedError extends XahlError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js has an error with connection to xahaud.
 | 
			
		||||
 * Error thrown when xahau.js has an error with connection to xahaud.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 */
 | 
			
		||||
class ConnectionError extends XahlError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js is not connected to xahaud server.
 | 
			
		||||
 * Error thrown when xahau.js is not connected to xahaud server.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 */
 | 
			
		||||
class NotConnectedError extends ConnectionError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js has disconnected from xahaud server.
 | 
			
		||||
 * Error thrown when xahau.js has disconnected from xahaud server.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 */
 | 
			
		||||
@@ -97,21 +97,21 @@ class DisconnectedError extends ConnectionError {}
 | 
			
		||||
class XahaudNotInitializedError extends ConnectionError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js times out.
 | 
			
		||||
 * Error thrown when xahau.js times out.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 */
 | 
			
		||||
class TimeoutError extends ConnectionError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js sees a response in the wrong format.
 | 
			
		||||
 * Error thrown when xahau.js sees a response in the wrong format.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 */
 | 
			
		||||
class ResponseFormatError extends ConnectionError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js sees a malformed transaction.
 | 
			
		||||
 * Error thrown when xahau.js sees a malformed transaction.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 */
 | 
			
		||||
@@ -127,7 +127,7 @@ class ValidationError extends XahlError {}
 | 
			
		||||
class XRPLFaucetError extends XahlError {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Error thrown when xrpl.js cannot retrieve a transaction, ledger, account, etc.
 | 
			
		||||
 * Error thrown when xahau.js cannot retrieve a transaction, ledger, account, etc.
 | 
			
		||||
 * From xahaud.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Errors
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ export interface BaseResponse {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The shape of an error response from xahaud. xrpl.js handles rejections by
 | 
			
		||||
 * The shape of an error response from xahaud. xahau.js handles rejections by
 | 
			
		||||
 * throwing, and allowing the user to handle in the catch block of a promise.
 | 
			
		||||
 *
 | 
			
		||||
 * @category Responses
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
To run integration tests:
 | 
			
		||||
1. Run rippled in standalone node, either in a docker container (preferred) or by installing rippled.
 | 
			
		||||
  * Go to the top-level of the `xrpl.js` repo, just above the `packages` folder.
 | 
			
		||||
  * Go to the top-level of the `xahau.js` repo, just above the `packages` folder.
 | 
			
		||||
  * With docker, run `docker run -p 6006:6006 --interactive -t --volume $PWD/.ci-config:/opt/ripple/etc/ --platform linux/amd64 rippleci/rippled:2.2.0-b3 /opt/ripple/bin/rippled -a --conf /opt/ripple/etc/rippled.cfg`
 | 
			
		||||
  * Or [download and build rippled](https://xrpl.org/install-rippled.html) and run `./rippled -a --start`
 | 
			
		||||
    * If you'd like to use the latest rippled amendments, you should modify your `rippled.cfg` file to enable amendments in the `[amendments]` section. You can view `.ci-config/rippled.cfg` in the top level folder as an example of this.
 | 
			
		||||
 
 | 
			
		||||
@@ -221,7 +221,7 @@ export async function verifySubmittedTransaction(
 | 
			
		||||
 * @param client - The XAHL client
 | 
			
		||||
 * @param transaction - The transaction object to send.
 | 
			
		||||
 * @param wallet - The wallet to send the transaction from.
 | 
			
		||||
 * @param retry - As of Sep 2022, xrpl.js does not track requests sent in parallel. Our sequence numbers can get off from
 | 
			
		||||
 * @param retry - As of Sep 2022, xahau.js does not track requests sent in parallel. Our sequence numbers can get off from
 | 
			
		||||
 *               the server's sequence numbers. This is a fix to retry the transaction if it fails due to tefPAST_SEQ.
 | 
			
		||||
 * @param retry.count - How many times the request should be retried.
 | 
			
		||||
 * @param retry.delayMs - How long to wait between retries.
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,8 @@ module.exports = merge(getDefaultConfiguration(), {
 | 
			
		||||
  entry: './dist/npm/index.js',
 | 
			
		||||
  // overriding the output path and filename
 | 
			
		||||
  output: {
 | 
			
		||||
    library: 'xah',
 | 
			
		||||
    library: 'xahau',
 | 
			
		||||
    path: path.join(__dirname, 'build/'),
 | 
			
		||||
    filename: `xrpl.default.js`,
 | 
			
		||||
  }
 | 
			
		||||
    filename: `xahau.default.js`,
 | 
			
		||||
  },
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,6 @@ const { merge } = require('webpack-merge')
 | 
			
		||||
const { getDefaultConfiguration, wrapForEnv } = require('../../webpack.config')
 | 
			
		||||
 | 
			
		||||
module.exports = wrapForEnv(
 | 
			
		||||
  'xah',
 | 
			
		||||
  'xahau',
 | 
			
		||||
  merge(getDefaultConfiguration(), require('./webpack.base.config')),
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user