mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 00:25:48 +00:00
refactor: define typescript types for OfferCancel Transaction Model (#1512)
* define typescript types for OfferCancel Transaction Model
This commit is contained in:
committed by
Mayukha Vadari
parent
1cc23c6ba9
commit
b2d03363a6
@@ -1,5 +1,6 @@
|
||||
export * from './transaction'
|
||||
export * from './offerCreate'
|
||||
export * from './offerCancel'
|
||||
export * from './checkCreate'
|
||||
export * from './checkCash'
|
||||
export * from './checkCancel'
|
||||
|
||||
24
src/models/transactions/offerCancel.ts
Normal file
24
src/models/transactions/offerCancel.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ValidationError } from "../../common/errors"
|
||||
import { BaseTransaction, verifyBaseTransaction } from "./common"
|
||||
|
||||
export interface OfferCancel extends BaseTransaction {
|
||||
TransactionType: "OfferCancel"
|
||||
OfferSequence: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the form and type of an OfferCancel at runtime.
|
||||
*
|
||||
* @param tx - An OfferCancel Transaction
|
||||
* @returns - Void.
|
||||
* @throws - When the OfferCancel is Malformed.
|
||||
*/
|
||||
export function verifyOfferCancel(tx: OfferCancel): void {
|
||||
verifyBaseTransaction(tx)
|
||||
|
||||
if (tx.OfferSequence === undefined)
|
||||
throw new ValidationError("OfferCancel: missing field OfferSequence")
|
||||
|
||||
if (typeof tx.OfferSequence !== 'number')
|
||||
throw new ValidationError("OfferCancel: invalid OfferSequence")
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
import Metadata from "../common/metadata";
|
||||
import { OfferCreate } from "./offerCreate";
|
||||
import { CheckCash } from "./checkCash";
|
||||
import { CheckCancel } from "./checkCancel";
|
||||
import { CheckCreate } from "./checkCreate";
|
||||
import { SignerListSet } from "./signerListSet";
|
||||
import Metadata from "../common/metadata"
|
||||
import { OfferCreate } from "./offerCreate"
|
||||
import { OfferCancel } from "./offerCancel"
|
||||
import { CheckCash } from "./checkCash"
|
||||
import { CheckCancel } from "./checkCancel"
|
||||
import { CheckCreate } from "./checkCreate"
|
||||
import { SignerListSet } from "./signerListSet"
|
||||
|
||||
export type Transaction =
|
||||
// AccountSet
|
||||
// | AccountDelete
|
||||
// | CheckCancel
|
||||
// | CheckCash
|
||||
// | CheckCreate
|
||||
CheckCancel
|
||||
| CheckCash
|
||||
| CheckCreate
|
||||
@@ -15,6 +19,7 @@ export type Transaction =
|
||||
// | EscrowCancel
|
||||
// | EscrowCreate
|
||||
// | EscrowFinish
|
||||
| OfferCancel
|
||||
// | OfferCancel
|
||||
| OfferCreate
|
||||
// | PaymentTransaction
|
||||
|
||||
Reference in New Issue
Block a user