-
Notifications
You must be signed in to change notification settings - Fork 525
/
Copy pathNFTokenCancelOffer.ts
45 lines (40 loc) · 1.55 KB
/
NFTokenCancelOffer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { ValidationError } from '../../errors'
import { BaseTransaction, validateBaseTransaction } from './common'
/**
* The NFTokenCancelOffer transaction deletes existing NFTokenOffer objects.
* It is useful if you want to free up space on your account to lower your
* reserve requirement.
*
* The transaction can be executed by the account that originally created
* the NFTokenOffer, the account in the `Recipient` field of the NFTokenOffer
* (if present), or any account if the NFTokenOffer has an `Expiration` and
* the NFTokenOffer has already expired.
*/
export interface NFTokenCancelOffer extends BaseTransaction {
TransactionType: 'NFTokenCancelOffer'
/**
* An array of identifiers of NFTokenOffer objects that should be cancelled
* by this transaction.
*
* It is an error if an entry in this list points to an
* object that is not an NFTokenOffer object. It is not an
* error if an entry in this list points to an object that
* does not exist. This field is required.
*/
NFTokenOffers: string[]
}
/**
* Verify the form and type of an NFTokenCancelOffer at runtime.
*
* @param tx - An NFTokenCancelOffer Transaction.
* @throws When the NFTokenCancelOffer is Malformed.
*/
export function validateNFTokenCancelOffer(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (!Array.isArray(tx.NFTokenOffers)) {
throw new ValidationError('NFTokenCancelOffer: missing field NFTokenOffers')
}
if (tx.NFTokenOffers.length < 1) {
throw new ValidationError('NFTokenCancelOffer: empty field NFTokenOffers')
}
}