Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/xrpl/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr

### Fixed
* Add missing fields (`Sequence`, `DomainID`) to `MPTokenIssuance` ledger type, add missing fields (`VaultID` and `LoanBrokerID`) to `AccountRoot` ledger type and missing fields (`AssetScale`, `MaximumAmount`, `TransferFee`, `MPTokenMetadata`, `LockedAmount`) to `vault_info` response `shares` object. Fix incorrect optionality of `Flags`, `ShareMPTID`, `WithdrawalPolicy`, and `OwnerNode` in `VaultInfoResponse`.
* Reverted [#3331](https://github.com/XRPLF/xrpl.js/pull/3331), which made `Client.getServerInfo()` and `Client.connect()` throw when the `server_info` request failed or the response omitted `network_id`. The SDK must not enforce `network_id` rules more strictly than a rippled node does for custom XRPL networks, so `getServerInfo()` once again logs such failures via `console.error` and leaves `client.networkID` undefined rather than throwing.


## 5.0.0 (2026-06-05)
Expand Down
30 changes: 10 additions & 20 deletions packages/xrpl/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,19 +523,9 @@ class Client extends EventEmitter<EventTypes> {
}

/**
* Get networkID and buildVersion from server_info.
*
* Throws if the underlying `server_info` request fails (e.g. `RippledError`
* for `noNetwork` / `notSynced`, `DisconnectedError`, `TimeoutError`), or if
* the response succeeds but does not include `network_id`. Callers must
* handle these — letting them propagate is intentional, since signing a
* transaction without a known network ID can produce a signature that is
* valid on the wrong network (cross-network replay).
* Get networkID and buildVersion from server_info
*
* @returns void
Comment thread
coderabbitai[bot] marked this conversation as resolved.
* @throws {XrplError} If the `server_info` response does not include a `network_id`.
* @throws {RippledError} If rippled returns an error (e.g. server not synced to network).
* @throws {DisconnectedError | TimeoutError | NotConnectedError} If the request cannot reach the server.
* @example
* ```ts
* const { Client } = require('xrpl')
Expand All @@ -546,15 +536,15 @@ class Client extends EventEmitter<EventTypes> {
* ```
*/
public async getServerInfo(): Promise<void> {
const response = await this.request({
command: 'server_info',
})
this.networkID = response.result.info.network_id ?? undefined
this.buildVersion = response.result.info.build_version
if (this.networkID === undefined) {
throw new XrplError(
'server_info response is missing network_id; cannot safely sign transactions without a known network ID',
)
try {
const response = await this.request({
command: 'server_info',
})
this.networkID = response.result.info.network_id ?? undefined
this.buildVersion = response.result.info.build_version
} catch (error) {
// eslint-disable-next-line no-console -- Print the error to console but allows client to be connected.
console.error(error)
}
}

Expand Down
167 changes: 0 additions & 167 deletions packages/xrpl/test/client/getServerInfo.test.ts

This file was deleted.

Loading