mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
add XChainCreateClaimID tx
This commit is contained in:
44
packages/xrpl/src/models/transactions/XChainCreateClaimID.ts
Normal file
44
packages/xrpl/src/models/transactions/XChainCreateClaimID.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { ValidationError } from '../../errors'
|
||||
import { Amount, Bridge } from '../common'
|
||||
|
||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||
|
||||
/**
|
||||
*
|
||||
* @category Transaction Models
|
||||
*/
|
||||
export interface XChainCreateClaimID extends BaseTransaction {
|
||||
TransactionType: 'XChainCreateClaimID'
|
||||
|
||||
Bridge: Bridge
|
||||
|
||||
SignatureReward: Amount
|
||||
|
||||
OtherChainAccount: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the form and type of a XChainCreateClaimID at runtime.
|
||||
*
|
||||
* @param tx - A XChainCreateClaimID Transaction.
|
||||
* @throws When the XChainCreateClaimID is malformed.
|
||||
*/
|
||||
export function validateXChainCreateClaimID(tx: Record<string, unknown>): void {
|
||||
validateBaseTransaction(tx)
|
||||
|
||||
if (tx.Bridge == null) {
|
||||
throw new ValidationError('XChainCreateClaimID: missing field Bridge')
|
||||
}
|
||||
|
||||
if (tx.SignatureReward == null) {
|
||||
throw new ValidationError(
|
||||
'XChainCreateClaimID: missing field SignatureReward',
|
||||
)
|
||||
}
|
||||
|
||||
if (tx.OtherChainAccount == null) {
|
||||
throw new ValidationError(
|
||||
'XChainCreateClaimID: missing field OtherChainAccount',
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -48,3 +48,4 @@ export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
|
||||
export { XChainClaim } from './XChainClaim'
|
||||
export { XChainCommit } from './XChainCommit'
|
||||
export { XChainCreateBridge } from './XChainCreateBridge'
|
||||
export { XChainCreateClaimID } from './XChainCreateClaimID'
|
||||
|
||||
@@ -56,6 +56,10 @@ import {
|
||||
XChainCreateBridge,
|
||||
validateXChainCreateBridge,
|
||||
} from './XChainCreateBridge'
|
||||
import {
|
||||
XChainCreateClaimID,
|
||||
validateXChainCreateClaimID,
|
||||
} from './XChainCreateClaimID'
|
||||
|
||||
/**
|
||||
* @category Transaction Models
|
||||
@@ -88,6 +92,7 @@ export type Transaction =
|
||||
| XChainClaim
|
||||
| XChainCommit
|
||||
| XChainCreateBridge
|
||||
| XChainCreateClaimID
|
||||
|
||||
/**
|
||||
* @category Transaction Models
|
||||
@@ -224,6 +229,10 @@ export function validate(transaction: Record<string, unknown>): void {
|
||||
validateXChainCreateBridge(tx)
|
||||
break
|
||||
|
||||
case 'XChainCreateClaimID':
|
||||
validateXChainCreateClaimID(tx)
|
||||
break
|
||||
|
||||
default:
|
||||
throw new ValidationError(
|
||||
`Invalid field TransactionType: ${tx.TransactionType}`,
|
||||
|
||||
Reference in New Issue
Block a user