From 8d66a08767dbe7fa39d71788bdeac5739c229f23 Mon Sep 17 00:00:00 2001 From: tequ Date: Tue, 24 Mar 2026 10:30:45 +0900 Subject: [PATCH 1/9] feat: add specific response types for ledger_entry request variants --- .../xrpl/src/models/ledger/LedgerEntry.ts | 2 + packages/xrpl/src/models/methods/index.ts | 105 +++++++++++++++++- .../xrpl/src/models/methods/ledgerEntry.ts | 82 ++++++++++++++ .../integration/transactions/clawback.test.ts | 15 ++- .../transactions/delegateSet.test.ts | 17 ++- .../transactions/permissionedDEX.test.ts | 4 +- 6 files changed, 205 insertions(+), 20 deletions(-) diff --git a/packages/xrpl/src/models/ledger/LedgerEntry.ts b/packages/xrpl/src/models/ledger/LedgerEntry.ts index abaa50ad07..f98d8eafdd 100644 --- a/packages/xrpl/src/models/ledger/LedgerEntry.ts +++ b/packages/xrpl/src/models/ledger/LedgerEntry.ts @@ -6,6 +6,7 @@ import Check from './Check' import Credential from './Credential' import Delegate from './Delegate' import DepositPreauth from './DepositPreauth' +import DID from './DID' import DirectoryNode from './DirectoryNode' import Escrow from './Escrow' import FeeSettings from './FeeSettings' @@ -33,6 +34,7 @@ type LedgerEntry = | Credential | Delegate | DepositPreauth + | DID | DirectoryNode | Escrow | FeeSettings diff --git a/packages/xrpl/src/models/methods/index.ts b/packages/xrpl/src/models/methods/index.ts index 5332c8c52a..602f211aaa 100644 --- a/packages/xrpl/src/models/methods/index.ts +++ b/packages/xrpl/src/models/methods/index.ts @@ -2,6 +2,27 @@ /* eslint-disable max-lines -- There is a lot to export */ /* eslint-disable prettier/prettier -- Required here to keep formatting in line */ import type { APIVersion, DEFAULT_API_VERSION } from '../common' +import type { + AccountRoot, + AMM, + Bridge, + Check, + Credential, + Delegate, + DepositPreauth, + DID, + DirectoryNode, + Escrow, + MPToken, + MPTokenIssuance, + NFTokenPage, + Offer, + PayChannel, + RippleState, + Ticket, + XChainOwnedClaimID, + XChainOwnedCreateAccountClaimID, +} from '../ledger' import { AccountChannelsRequest, @@ -108,7 +129,30 @@ import { LedgerDataRequest, LedgerDataResponse, } from './ledgerData' -import { LedgerEntryRequest, LedgerEntryResponse } from './ledgerEntry' +import { + LedgerEntryRequest, + LedgerEntryResponse, + LedgerEntryAccountRootRequest, + LedgerEntryAMMRequest, + LedgerEntryBridgeAccountRequest, + LedgerEntryBridgeRequest, + LedgerEntryCheckRequest, + LedgerEntryCredentialRequest, + LedgerEntryDelegateRequest, + LedgerEntryDepositPreauthRequest, + LedgerEntryDIDRequest, + LedgerEntryDirectoryRequest, + LedgerEntryEscrowRequest, + LedgerEntryMPTokenIssuanceRequest, + LedgerEntryMPTokenRequest, + LedgerEntryNFTokenPageRequest, + LedgerEntryOfferRequest, + LedgerEntryPayChannelRequest, + LedgerEntryRippleStateRequest, + LedgerEntryTicketRequest, + LedgerEntryXChainOwnedClaimIDRequest, + LedgerEntryXChainOwnedCreateAccountClaimIDRequest, +} from './ledgerEntry' import { ManifestRequest, ManifestResponse } from './manifest' import { NFTBuyOffersRequest, NFTBuyOffersResponse } from './nftBuyOffers' import { @@ -412,6 +456,46 @@ export type RequestResponseMap< ? LedgerCurrentResponse : T extends LedgerDataRequest ? LedgerDataResponse + : T extends LedgerEntryAccountRootRequest + ? LedgerEntryResponse + : T extends LedgerEntryAMMRequest + ? LedgerEntryResponse + : T extends LedgerEntryBridgeAccountRequest + ? LedgerEntryResponse + : T extends LedgerEntryBridgeRequest + ? LedgerEntryResponse + : T extends LedgerEntryCheckRequest + ? LedgerEntryResponse + : T extends LedgerEntryCredentialRequest + ? LedgerEntryResponse + : T extends LedgerEntryDelegateRequest + ? LedgerEntryResponse + : T extends LedgerEntryDepositPreauthRequest + ? LedgerEntryResponse + : T extends LedgerEntryDIDRequest + ? LedgerEntryResponse + : T extends LedgerEntryDirectoryRequest + ? LedgerEntryResponse + : T extends LedgerEntryEscrowRequest + ? LedgerEntryResponse + : T extends LedgerEntryMPTokenIssuanceRequest + ? LedgerEntryResponse + : T extends LedgerEntryMPTokenRequest + ? LedgerEntryResponse + : T extends LedgerEntryNFTokenPageRequest + ? LedgerEntryResponse + : T extends LedgerEntryOfferRequest + ? LedgerEntryResponse + : T extends LedgerEntryPayChannelRequest + ? LedgerEntryResponse + : T extends LedgerEntryRippleStateRequest + ? LedgerEntryResponse + : T extends LedgerEntryTicketRequest + ? LedgerEntryResponse + : T extends LedgerEntryXChainOwnedClaimIDRequest + ? LedgerEntryResponse + : T extends LedgerEntryXChainOwnedCreateAccountClaimIDRequest + ? LedgerEntryResponse : T extends LedgerEntryRequest ? LedgerEntryResponse : T extends SimulateBinaryRequest @@ -567,6 +651,25 @@ export { LedgerDataLedgerState, LedgerEntryRequest, LedgerEntryResponse, + LedgerEntryAccountRootRequest, + LedgerEntryAMMRequest, + LedgerEntryBridgeRequest, + LedgerEntryCheckRequest, + LedgerEntryCredentialRequest, + LedgerEntryDelegateRequest, + LedgerEntryDepositPreauthRequest, + LedgerEntryDIDRequest, + LedgerEntryDirectoryRequest, + LedgerEntryEscrowRequest, + LedgerEntryMPTokenIssuanceRequest, + LedgerEntryMPTokenRequest, + LedgerEntryNFTokenPageRequest, + LedgerEntryOfferRequest, + LedgerEntryPayChannelRequest, + LedgerEntryRippleStateRequest, + LedgerEntryTicketRequest, + LedgerEntryXChainOwnedClaimIDRequest, + LedgerEntryXChainOwnedCreateAccountClaimIDRequest, // transaction methods with types SimulateRequest, SimulateResponse, diff --git a/packages/xrpl/src/models/methods/ledgerEntry.ts b/packages/xrpl/src/models/methods/ledgerEntry.ts index cabdba90a5..e0f3e8c0e9 100644 --- a/packages/xrpl/src/models/methods/ledgerEntry.ts +++ b/packages/xrpl/src/models/methods/ledgerEntry.ts @@ -230,6 +230,88 @@ export interface LedgerEntryRequest extends BaseRequest, LookupByLedgerRequest { } } +export interface LedgerEntryAccountRootRequest extends LedgerEntryRequest { + account_root: Required['account_root'] +} + +export interface LedgerEntryAMMRequest extends LedgerEntryRequest { + amm: Required['amm'] +} + +export interface LedgerEntryBridgeAccountRequest extends LedgerEntryRequest { + bridge_account: Required['bridge_account'] +} + +export interface LedgerEntryBridgeRequest extends LedgerEntryRequest { + bridge: Required['bridge'] +} + +export interface LedgerEntryCheckRequest extends LedgerEntryRequest { + check: Required['check'] +} + +export interface LedgerEntryCredentialRequest extends LedgerEntryRequest { + credential: Required['credential'] +} + +export interface LedgerEntryDelegateRequest extends LedgerEntryRequest { + delegate: Required['delegate'] +} + +export interface LedgerEntryDepositPreauthRequest extends LedgerEntryRequest { + deposit_preauth: Required['deposit_preauth'] +} + +export interface LedgerEntryDIDRequest extends LedgerEntryRequest { + did: Required['did'] +} + +export interface LedgerEntryDirectoryRequest extends LedgerEntryRequest { + directory: Required['directory'] +} + +export interface LedgerEntryEscrowRequest extends LedgerEntryRequest { + escrow: Required['escrow'] +} + +export interface LedgerEntryMPTokenIssuanceRequest extends LedgerEntryRequest { + mpt_issuance: Required['mpt_issuance'] +} + +export interface LedgerEntryMPTokenRequest extends LedgerEntryRequest { + mptoken: Required['mptoken'] +} + +export interface LedgerEntryNFTokenPageRequest extends LedgerEntryRequest { + nft_page: Required['nft_page'] +} + +export interface LedgerEntryOfferRequest extends LedgerEntryRequest { + offer: Required['offer'] +} + +export interface LedgerEntryPayChannelRequest extends LedgerEntryRequest { + payment_channel: Required['payment_channel'] +} + +export interface LedgerEntryRippleStateRequest extends LedgerEntryRequest { + ripple_state: Required['ripple_state'] +} + +export interface LedgerEntryTicketRequest extends LedgerEntryRequest { + ticket: Required['ticket'] +} + +// eslint-disable-next-line max-len -- Disable for interface declaration. +export interface LedgerEntryXChainOwnedClaimIDRequest extends LedgerEntryRequest { + xchain_owned_claim_id: Required['xchain_owned_claim_id'] +} + +// eslint-disable-next-line max-len -- Disable for interface declaration. +export interface LedgerEntryXChainOwnedCreateAccountClaimIDRequest extends LedgerEntryRequest { + xchain_owned_create_account_claim_id: Required['xchain_owned_create_account_claim_id'] +} + /** * Response expected from a {@link LedgerEntryRequest}. * diff --git a/packages/xrpl/test/integration/transactions/clawback.test.ts b/packages/xrpl/test/integration/transactions/clawback.test.ts index 58935a2782..ce7be1604f 100644 --- a/packages/xrpl/test/integration/transactions/clawback.test.ts +++ b/packages/xrpl/test/integration/transactions/clawback.test.ts @@ -162,14 +162,13 @@ describe('Clawback', function () { await testTransaction(testContext.client, paymentTx, testContext.wallet) - let ledgerEntryResponse: LedgerEntryResponse = - await testContext.client.request({ - command: 'ledger_entry', - mptoken: { - mpt_issuance_id: mptID!, - account: wallet2.classicAddress, - }, - }) + let ledgerEntryResponse = await testContext.client.request({ + command: 'ledger_entry', + mptoken: { + mpt_issuance_id: mptID!, + account: wallet2.classicAddress, + }, + }) assert.equal( // @ts-expect-error: Known issue with unknown object type diff --git a/packages/xrpl/test/integration/transactions/delegateSet.test.ts b/packages/xrpl/test/integration/transactions/delegateSet.test.ts index 961627b2f1..bf810325c6 100644 --- a/packages/xrpl/test/integration/transactions/delegateSet.test.ts +++ b/packages/xrpl/test/integration/transactions/delegateSet.test.ts @@ -51,15 +51,14 @@ describe('DelegateSet', function () { await testTransaction(testContext.client, delegateTx, alice) // Verify Delegate ledger entry - const ledgerEntryRes: LedgerEntryResponse = - await testContext.client.request({ - command: 'ledger_entry', - delegate: { - account: alice.address, - authorize: bob.address, - }, - }) - const delegateLedgerEntry = ledgerEntryRes.result.node as Delegate + const ledgerEntryRes = await testContext.client.request({ + command: 'ledger_entry', + delegate: { + account: alice.address, + authorize: bob.address, + }, + }) + const delegateLedgerEntry = ledgerEntryRes.result.node! assert.equal(delegateLedgerEntry.LedgerEntryType, 'Delegate') assert.equal(delegateLedgerEntry.Account, alice.address) assert.equal(delegateLedgerEntry.Authorize, bob.address) diff --git a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts index 7c90b405ac..ece2fe19d7 100644 --- a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts +++ b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts @@ -232,7 +232,7 @@ describe('PermissionedDEX', function () { seq: offerCreateTxResponse.result.tx_json.Sequence as number, }, }) - ).result.node as Offer + ).result.node! assert.equal(offerLedgerObject.LedgerEntryType, 'Offer') assert.equal(offerLedgerObject.DomainID, permDomainLedgerObject.index) @@ -259,7 +259,7 @@ describe('PermissionedDEX', function () { }) assert.equal( - (ledgerEntryResponse.result.node as DirectoryNode).index, + ledgerEntryResponse.result.node?.index, offerLedgerObject.BookDirectory, ) assert.equal( From 69e59c819291e5ace56132112a7b5a060d59d14e Mon Sep 17 00:00:00 2001 From: tequ Date: Tue, 24 Mar 2026 11:06:30 +0900 Subject: [PATCH 2/9] remove unused import --- packages/xrpl/test/integration/transactions/clawback.test.ts | 1 - packages/xrpl/test/integration/transactions/delegateSet.test.ts | 2 -- 2 files changed, 3 deletions(-) diff --git a/packages/xrpl/test/integration/transactions/clawback.test.ts b/packages/xrpl/test/integration/transactions/clawback.test.ts index ce7be1604f..03a310bc04 100644 --- a/packages/xrpl/test/integration/transactions/clawback.test.ts +++ b/packages/xrpl/test/integration/transactions/clawback.test.ts @@ -10,7 +10,6 @@ import { MPTokenIssuanceCreateFlags, MPTokenAuthorize, TransactionMetadata, - LedgerEntryResponse, } from '../../../src' import serverUrl from '../serverUrl' import { diff --git a/packages/xrpl/test/integration/transactions/delegateSet.test.ts b/packages/xrpl/test/integration/transactions/delegateSet.test.ts index bf810325c6..87d12d5691 100644 --- a/packages/xrpl/test/integration/transactions/delegateSet.test.ts +++ b/packages/xrpl/test/integration/transactions/delegateSet.test.ts @@ -3,12 +3,10 @@ import { assert } from 'chai' import { AccountSet, DelegateSet, - LedgerEntryResponse, Payment, Wallet, xrpToDrops, } from '../../../src' -import { Delegate } from '../../../src/models/ledger' import serverUrl from '../serverUrl' import { setupClient, From 9502b35d93e4214cfd2103dd0d806f8756b07905 Mon Sep 17 00:00:00 2001 From: tequ Date: Tue, 24 Mar 2026 11:11:09 +0900 Subject: [PATCH 3/9] fix to MPTAmount.value --- packages/xrpl/test/integration/transactions/clawback.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/xrpl/test/integration/transactions/clawback.test.ts b/packages/xrpl/test/integration/transactions/clawback.test.ts index 03a310bc04..38d7f45962 100644 --- a/packages/xrpl/test/integration/transactions/clawback.test.ts +++ b/packages/xrpl/test/integration/transactions/clawback.test.ts @@ -171,7 +171,7 @@ describe('Clawback', function () { assert.equal( // @ts-expect-error: Known issue with unknown object type - ledgerEntryResponse.result.node.MPTAmount, + ledgerEntryResponse.result.node.MPTAmount.value, '9223372036854775807', ) @@ -197,7 +197,7 @@ describe('Clawback', function () { assert.equal( // @ts-expect-error: Known issue with unknown object type - ledgerEntryResponse.result.node.MPTAmount, + ledgerEntryResponse.result.node.MPTAmount.value, '9223372036854775307', ) }, From bdd5d7de3ddec852da3b44f9bcca077fbff84d11 Mon Sep 17 00:00:00 2001 From: tequ Date: Tue, 24 Mar 2026 11:20:02 +0900 Subject: [PATCH 4/9] MPTAmount -> type string --- .../xrpl/test/integration/transactions/clawback.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/xrpl/test/integration/transactions/clawback.test.ts b/packages/xrpl/test/integration/transactions/clawback.test.ts index 38d7f45962..8c5dd6d91c 100644 --- a/packages/xrpl/test/integration/transactions/clawback.test.ts +++ b/packages/xrpl/test/integration/transactions/clawback.test.ts @@ -170,8 +170,8 @@ describe('Clawback', function () { }) assert.equal( - // @ts-expect-error: Known issue with unknown object type - ledgerEntryResponse.result.node.MPTAmount.value, + // @ts-expect-error: string type assertion to MPTAmount field + ledgerEntryResponse.result.node.MPTAmount as string, '9223372036854775807', ) @@ -196,8 +196,8 @@ describe('Clawback', function () { }) assert.equal( - // @ts-expect-error: Known issue with unknown object type - ledgerEntryResponse.result.node.MPTAmount.value, + // @ts-expect-error: string type assertion to MPTAmount field + ledgerEntryResponse.result.node.MPTAmount as string, '9223372036854775307', ) }, From 73283c793cc9e558659f300b831db3d8a304800b Mon Sep 17 00:00:00 2001 From: tequ Date: Thu, 2 Apr 2026 21:57:36 +0900 Subject: [PATCH 5/9] export LedgerEntryBridgeAccountRequest --- packages/xrpl/src/models/methods/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/xrpl/src/models/methods/index.ts b/packages/xrpl/src/models/methods/index.ts index 602f211aaa..6d8d9e3427 100644 --- a/packages/xrpl/src/models/methods/index.ts +++ b/packages/xrpl/src/models/methods/index.ts @@ -654,6 +654,7 @@ export { LedgerEntryAccountRootRequest, LedgerEntryAMMRequest, LedgerEntryBridgeRequest, + LedgerEntryBridgeAccountRequest, LedgerEntryCheckRequest, LedgerEntryCredentialRequest, LedgerEntryDelegateRequest, From 0419a05b538242626aaedaa25ede03905ba741e5 Mon Sep 17 00:00:00 2001 From: tequ Date: Fri, 3 Apr 2026 12:11:15 +0900 Subject: [PATCH 6/9] fix --- .../test/integration/transactions/permissionedDEX.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts index ece2fe19d7..00d2d8ea1e 100644 --- a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts +++ b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts @@ -258,16 +258,17 @@ describe('PermissionedDEX', function () { directory: offerLedgerObject.BookDirectory, }) + assert.ok(ledgerEntryResponse.result.node, 'node should be present') assert.equal( - ledgerEntryResponse.result.node?.index, + ledgerEntryResponse.result.node.index, offerLedgerObject.BookDirectory, ) assert.equal( - (ledgerEntryResponse.result.node as DirectoryNode).LedgerEntryType, + ledgerEntryResponse.result.node.LedgerEntryType, 'DirectoryNode', ) assert.equal( - (ledgerEntryResponse.result.node as DirectoryNode).DomainID, + ledgerEntryResponse.result.node.DomainID, permDomainLedgerObject.index, ) From 1d0005deb488e034e7950936b8fdc529facbf4cb Mon Sep 17 00:00:00 2001 From: tequ Date: Fri, 3 Apr 2026 12:20:35 +0900 Subject: [PATCH 7/9] remove DirectoryNode import --- .../xrpl/test/integration/transactions/permissionedDEX.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts index 00d2d8ea1e..d825ef3a57 100644 --- a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts +++ b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts @@ -8,7 +8,6 @@ import { IssuedCurrencyAmount, AccountSetAsfFlags, } from '../../../src' -import DirectoryNode from '../../../src/models/ledger/DirectoryNode' import Offer from '../../../src/models/ledger/Offer' import PermissionedDomain from '../../../src/models/ledger/PermissionedDomain' import { From 0b371351b141ad4ec0a1752764e2247d80ffafb6 Mon Sep 17 00:00:00 2001 From: tequ Date: Fri, 24 Apr 2026 20:15:00 +0900 Subject: [PATCH 8/9] narrow ledger_entry response types to Json and Binary --- packages/xrpl/src/client/index.ts | 11 +++ packages/xrpl/src/models/methods/index.ts | 72 +++++++++++++------ .../integration/requests/ledgerEntry.test.ts | 6 ++ 3 files changed, 67 insertions(+), 22 deletions(-) diff --git a/packages/xrpl/src/client/index.ts b/packages/xrpl/src/client/index.ts index dec5fe98d6..0ede846e1b 100644 --- a/packages/xrpl/src/client/index.ts +++ b/packages/xrpl/src/client/index.ts @@ -352,6 +352,17 @@ class Client extends EventEmitter { * console.log(response) * ``` */ + // public async request< + // R extends Request, + // V extends APIVersion = typeof DEFAULT_API_VERSION, + // >(req: R): Promise> + + // public async request< + // R extends Request, + // V extends APIVersion = typeof DEFAULT_API_VERSION, + // T = RequestResponseMap, + // >(req: R): Promise + public async request< R extends Request, V extends APIVersion = typeof DEFAULT_API_VERSION, diff --git a/packages/xrpl/src/models/methods/index.ts b/packages/xrpl/src/models/methods/index.ts index 61b54ca278..0121278e09 100644 --- a/packages/xrpl/src/models/methods/index.ts +++ b/packages/xrpl/src/models/methods/index.ts @@ -239,6 +239,12 @@ import { UnsubscribeResponse, } from './unsubscribe' import { VaultInfoRequest, VaultInfoResponse } from './vaultInfo' + +type LedgerEntryLookupResponse = + T extends LedgerEntryJsonRequest + ? LedgerEntryJsonResponse + : LedgerEntryResponse + /** * @category Requests */ @@ -259,6 +265,28 @@ type Request = | LedgerClosedRequest | LedgerCurrentRequest | LedgerDataRequest + | LedgerEntryBinaryRequest + | LedgerEntryJsonRequest + | LedgerEntryAccountRootRequest + | LedgerEntryAMMRequest + | LedgerEntryBridgeAccountRequest + | LedgerEntryBridgeRequest + | LedgerEntryCheckRequest + | LedgerEntryCredentialRequest + | LedgerEntryDelegateRequest + | LedgerEntryDepositPreauthRequest + | LedgerEntryDIDRequest + | LedgerEntryDirectoryRequest + | LedgerEntryEscrowRequest + | LedgerEntryMPTokenIssuanceRequest + | LedgerEntryMPTokenRequest + | LedgerEntryNFTokenPageRequest + | LedgerEntryOfferRequest + | LedgerEntryPayChannelRequest + | LedgerEntryRippleStateRequest + | LedgerEntryTicketRequest + | LedgerEntryXChainOwnedClaimIDRequest + | LedgerEntryXChainOwnedCreateAccountClaimIDRequest | LedgerEntryRequest // transaction methods | SimulateRequest @@ -460,48 +488,48 @@ export type RequestResponseMap< ? LedgerCurrentResponse : T extends LedgerDataRequest ? LedgerDataResponse + : T extends LedgerEntryBinaryRequest + ? LedgerEntryBinaryResponse : T extends LedgerEntryAccountRootRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryAMMRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryBridgeAccountRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryBridgeRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryCheckRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryCredentialRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryDelegateRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryDepositPreauthRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryDIDRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryDirectoryRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryEscrowRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryMPTokenIssuanceRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryMPTokenRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryNFTokenPageRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryOfferRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryPayChannelRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryRippleStateRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryTicketRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryXChainOwnedClaimIDRequest - ? LedgerEntryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryXChainOwnedCreateAccountClaimIDRequest - ? LedgerEntryResponse - : T extends LedgerEntryBinaryRequest - ? LedgerEntryBinaryResponse + ? LedgerEntryLookupResponse : T extends LedgerEntryJsonRequest ? LedgerEntryJsonResponse : T extends LedgerEntryRequest diff --git a/packages/xrpl/test/integration/requests/ledgerEntry.test.ts b/packages/xrpl/test/integration/requests/ledgerEntry.test.ts index 82d2366f66..4f3cbc63c6 100644 --- a/packages/xrpl/test/integration/requests/ledgerEntry.test.ts +++ b/packages/xrpl/test/integration/requests/ledgerEntry.test.ts @@ -68,6 +68,9 @@ describe('ledger_entry', function () { }) assert.isDefined(ledgerEntryResponse.result.node) + assert.isDefined(ledgerEntryResponse.result.node.OwnerCount) + // @ts-expect-error - Owner is not present in the AccountRoot response + assert.isUndefined(ledgerEntryResponse.result.node.Owner) // @ts-expect-error - node_binary is not present in the response assert.isUndefined(ledgerEntryResponse.result.node_binary) }, @@ -86,6 +89,9 @@ describe('ledger_entry', function () { }) assert.isDefined(ledgerEntryResponse.result.node) + assert.isDefined(ledgerEntryResponse.result.node.OwnerCount) + // @ts-expect-error - Owner is not present in the AccountRoot response + assert.isUndefined(ledgerEntryResponse.result.node.Owner) // @ts-expect-error - node_binary is not present in the response assert.isUndefined(ledgerEntryResponse.result.node_binary) }, From 914075e4823fe115e6f8a6a08b6feb095aec4f19 Mon Sep 17 00:00:00 2001 From: tequ Date: Fri, 24 Apr 2026 20:35:28 +0900 Subject: [PATCH 9/9] Clean up ledger entry assertions --- .../xrpl/test/integration/transactions/clawback.test.ts | 6 ++---- .../xrpl/test/integration/transactions/delegateSet.test.ts | 2 +- .../test/integration/transactions/permissionedDEX.test.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/xrpl/test/integration/transactions/clawback.test.ts b/packages/xrpl/test/integration/transactions/clawback.test.ts index 8c5dd6d91c..c842b7e6e0 100644 --- a/packages/xrpl/test/integration/transactions/clawback.test.ts +++ b/packages/xrpl/test/integration/transactions/clawback.test.ts @@ -170,8 +170,7 @@ describe('Clawback', function () { }) assert.equal( - // @ts-expect-error: string type assertion to MPTAmount field - ledgerEntryResponse.result.node.MPTAmount as string, + ledgerEntryResponse.result.node.MPTAmount, '9223372036854775807', ) @@ -196,8 +195,7 @@ describe('Clawback', function () { }) assert.equal( - // @ts-expect-error: string type assertion to MPTAmount field - ledgerEntryResponse.result.node.MPTAmount as string, + ledgerEntryResponse.result.node.MPTAmount, '9223372036854775307', ) }, diff --git a/packages/xrpl/test/integration/transactions/delegateSet.test.ts b/packages/xrpl/test/integration/transactions/delegateSet.test.ts index 87d12d5691..8c94d7bf25 100644 --- a/packages/xrpl/test/integration/transactions/delegateSet.test.ts +++ b/packages/xrpl/test/integration/transactions/delegateSet.test.ts @@ -56,7 +56,7 @@ describe('DelegateSet', function () { authorize: bob.address, }, }) - const delegateLedgerEntry = ledgerEntryRes.result.node! + const delegateLedgerEntry = ledgerEntryRes.result.node assert.equal(delegateLedgerEntry.LedgerEntryType, 'Delegate') assert.equal(delegateLedgerEntry.Account, alice.address) assert.equal(delegateLedgerEntry.Authorize, bob.address) diff --git a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts index d825ef3a57..6b5247f911 100644 --- a/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts +++ b/packages/xrpl/test/integration/transactions/permissionedDEX.test.ts @@ -231,7 +231,7 @@ describe('PermissionedDEX', function () { seq: offerCreateTxResponse.result.tx_json.Sequence as number, }, }) - ).result.node! + ).result.node assert.equal(offerLedgerObject.LedgerEntryType, 'Offer') assert.equal(offerLedgerObject.DomainID, permDomainLedgerObject.index)