diff --git a/packages/xrpl/src/models/transactions/XChainAddAttestation.ts b/packages/xrpl/src/models/transactions/XChainAddAttestation.ts index e6a4f780..fcbccfdb 100644 --- a/packages/xrpl/src/models/transactions/XChainAddAttestation.ts +++ b/packages/xrpl/src/models/transactions/XChainAddAttestation.ts @@ -66,19 +66,28 @@ export function validateXChainAddAttestation( ): void { validateBaseTransaction(tx) - if (tx.XChainBridge == null) { + if (tx.XChainAttestationBatch == null) { throw new ValidationError( - 'XChainAddAttestation: missing field XChainBridge', + 'XChainAddAttestation: missing field XChainAttestationBatch', ) } - if (tx.XChainClaimAttestationBatch == null) { + if (typeof tx.XChainAttestationBatch !== 'object') { + throw new ValidationError( + 'XChainAddAttestation: XChainAttestationBatch must be an object', + ) + } + + /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known to be this */ + const attestationBatch = tx.XChainAttestationBatch as Record + + if (attestationBatch.XChainClaimAttestationBatch == null) { throw new ValidationError( 'XChainAddAttestation: missing field XChainClaimAttestationBatch', ) } - if (tx.XChainCreateAccountAttestationBatch == null) { + if (attestationBatch.XChainCreateAccountAttestationBatch == null) { throw new ValidationError( 'XChainAddAttestation: missing field XChainCreateAccountAttestationBatch', ) diff --git a/packages/xrpl/src/models/transactions/transaction.ts b/packages/xrpl/src/models/transactions/transaction.ts index ca6b4c2e..466aa9b6 100644 --- a/packages/xrpl/src/models/transactions/transaction.ts +++ b/packages/xrpl/src/models/transactions/transaction.ts @@ -249,6 +249,7 @@ export function validate(transaction: Record): void { case 'SidechainXChainAccountCreate': validateSidechainXChainAccountCreate(tx) + break default: throw new ValidationError(