mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-06-05 01:36:47 +00:00
fix bugs
This commit is contained in:
@@ -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<string, unknown>
|
||||
|
||||
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',
|
||||
)
|
||||
|
||||
@@ -249,6 +249,7 @@ export function validate(transaction: Record<string, unknown>): void {
|
||||
|
||||
case 'SidechainXChainAccountCreate':
|
||||
validateSidechainXChainAccountCreate(tx)
|
||||
break
|
||||
|
||||
default:
|
||||
throw new ValidationError(
|
||||
|
||||
Reference in New Issue
Block a user