mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-18 11:15:48 +00:00
* add NFTokenBurn and NFTokenMint * add NFTokenCreateOffer * add NFTokenCancelOffer * add NFTokenAcceptOffer * add requests and responses * make a beta 2.1.0 * rename TokenIDs to TokenOffers * add validations and fixup docs * add tests * add missing error codes to binary codec * adds history changes
70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
import { assert } from 'chai'
|
|
import {
|
|
convertStringToHex,
|
|
validate,
|
|
ValidationError,
|
|
NFTokenMintFlags,
|
|
} from 'xrpl-local'
|
|
|
|
/**
|
|
* NFTokenMint Transaction Verification Testing.
|
|
*
|
|
* Providing runtime verification testing for each specific transaction type.
|
|
*/
|
|
describe('NFTokenMint', function () {
|
|
it(`verifies valid NFTokenMint`, function () {
|
|
const validNFTokenMint = {
|
|
TransactionType: 'NFTokenMint',
|
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
Fee: '5000000',
|
|
Sequence: 2470665,
|
|
Flags: NFTokenMintFlags.tfTransferable,
|
|
TokenTaxon: 0,
|
|
Issuer: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
|
TransferFee: 1,
|
|
URI: convertStringToHex('http://xrpl.org'),
|
|
} as any
|
|
|
|
assert.doesNotThrow(() => validate(validNFTokenMint))
|
|
})
|
|
|
|
it(`throws w/ missing TokenTaxon`, function () {
|
|
const invalid = {
|
|
TransactionType: 'NFTokenMint',
|
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
Fee: '5000000',
|
|
Sequence: 2470665,
|
|
Flags: NFTokenMintFlags.tfTransferable,
|
|
Issuer: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
|
|
TransferFee: 1,
|
|
URI: convertStringToHex('http://xrpl.org'),
|
|
} as any
|
|
|
|
assert.throws(
|
|
() => validate(invalid),
|
|
ValidationError,
|
|
'NFTokenMint: missing field TokenTaxon',
|
|
)
|
|
})
|
|
|
|
it(`throws w/ Account === Issuer`, function () {
|
|
const invalid = {
|
|
TransactionType: 'NFTokenMint',
|
|
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
Fee: '5000000',
|
|
Sequence: 2470665,
|
|
Flags: NFTokenMintFlags.tfTransferable,
|
|
Issuer: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
|
|
TransferFee: 1,
|
|
TokenTaxon: 0,
|
|
URI: convertStringToHex('http://xrpl.org'),
|
|
} as any
|
|
|
|
assert.throws(
|
|
() => validate(invalid),
|
|
ValidationError,
|
|
'NFTokenMint: Issuer must not be equal to Account',
|
|
)
|
|
})
|
|
})
|