mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
29 lines
823 B
TypeScript
29 lines
823 B
TypeScript
import { ValidationError } from '../../errors'
|
|
|
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
|
|
|
/**
|
|
* ClaimReward is a transaction model that allows an account to claim rewards.
|
|
*
|
|
* @category Transaction Models
|
|
*/
|
|
export interface ClaimReward extends BaseTransaction {
|
|
TransactionType: 'ClaimReward'
|
|
/** The unique address of the issuer where the reward.c hook is installed. */
|
|
Issuer?: string
|
|
}
|
|
|
|
/**
|
|
* Verify the form and type of an ClaimReward at runtime.
|
|
*
|
|
* @param tx - An ClaimReward Transaction.
|
|
* @throws When the ClaimReward is Malformed.
|
|
*/
|
|
export function validateClaimReward(tx: Record<string, unknown>): void {
|
|
validateBaseTransaction(tx)
|
|
|
|
if (tx.Issuer !== undefined && typeof tx.Issuer !== 'string') {
|
|
throw new ValidationError('ClaimReward: invalid Issuer')
|
|
}
|
|
}
|