mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
add invoke tx
This commit is contained in:
@@ -14,6 +14,7 @@ export { DepositPreauth } from './depositPreauth'
|
|||||||
export { EscrowCancel } from './escrowCancel'
|
export { EscrowCancel } from './escrowCancel'
|
||||||
export { EscrowCreate } from './escrowCreate'
|
export { EscrowCreate } from './escrowCreate'
|
||||||
export { EscrowFinish } from './escrowFinish'
|
export { EscrowFinish } from './escrowFinish'
|
||||||
|
export { Invoke } from './invoke'
|
||||||
export { NFTokenAcceptOffer } from './NFTokenAcceptOffer'
|
export { NFTokenAcceptOffer } from './NFTokenAcceptOffer'
|
||||||
export { NFTokenBurn } from './NFTokenBurn'
|
export { NFTokenBurn } from './NFTokenBurn'
|
||||||
export { NFTokenCancelOffer } from './NFTokenCancelOffer'
|
export { NFTokenCancelOffer } from './NFTokenCancelOffer'
|
||||||
|
|||||||
32
packages/xrpl/src/models/transactions/invoke.ts
Normal file
32
packages/xrpl/src/models/transactions/invoke.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { ValidationError } from '../../errors'
|
||||||
|
|
||||||
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @category Transaction Models
|
||||||
|
*/
|
||||||
|
export interface Invoke extends BaseTransaction {
|
||||||
|
TransactionType: 'Invoke'
|
||||||
|
/**
|
||||||
|
* If present, invokes the Hook on the Destination account.
|
||||||
|
*/
|
||||||
|
Destination?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify the form and type of an Invoke at runtime.
|
||||||
|
*
|
||||||
|
* @param tx - An Invoke Transaction.
|
||||||
|
* @throws When the Invoke is Malformed.
|
||||||
|
*/
|
||||||
|
export function validateInvoke(tx: Record<string, unknown>): void {
|
||||||
|
validateBaseTransaction(tx)
|
||||||
|
|
||||||
|
if (tx.Account === tx.Destination) {
|
||||||
|
throw new ValidationError(
|
||||||
|
'Invoke: Destination and Account must not be equal',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user