Changeset View
Changeset View
Standalone View
Standalone View
modules/chronik-client/test/integration/token_slp_nft1.ts
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | it('Gets an SLP NFT1 genesis tx from the mempool', async () => { | ||||
}, | }, | ||||
]); | ]); | ||||
// The token did not fail parsings | // The token did not fail parsings | ||||
expect(slpGenesis.tokenFailedParsings).to.deep.equal([]); | expect(slpGenesis.tokenFailedParsings).to.deep.equal([]); | ||||
// Normal status | // Normal status | ||||
expect(slpGenesis.tokenStatus).to.eql('TOKEN_STATUS_NORMAL'); | expect(slpGenesis.tokenStatus).to.eql('TOKEN_STATUS_NORMAL'); | ||||
// We can get token info of an slp nft1 from the mempool | |||||
const slpGenesisMempoolInfo = await chronik.token(slpGenesisTxid); | |||||
// We do not get mintVaultScripthash for non-SLP_MINT_VAULT | |||||
// We do not get data or authPubkey keys in GenesisInfo for non-ALP | |||||
expect(slpGenesisMempoolInfo).to.deep.equal({ | |||||
tokenId: slpGenesisTxid, | |||||
timeFirstSeen: '1300000000', | |||||
tokenType: { | |||||
protocol: 'SLP', | |||||
type: 'SLP_TOKEN_TYPE_NFT1_GROUP', | |||||
number: 129, | |||||
}, | |||||
genesisInfo: { | |||||
tokenTicker: 'SLP NFT GROUP', | |||||
tokenName: 'Slp NFT GROUP token', | |||||
url: 'http://slp.nft', | |||||
hash: '7878787878787878787878787878787878787878787878787878787878787878', | |||||
decimals: 4, | |||||
}, | |||||
}); | |||||
}); | }); | ||||
it('Gets an SLP NFT1 mint tx from the mempool', async () => { | it('Gets an SLP NFT1 mint tx from the mempool', async () => { | ||||
const chronikUrl = await chronik_url; | const chronikUrl = await chronik_url; | ||||
const chronik = new ChronikClientNode(chronikUrl); | const chronik = new ChronikClientNode(chronikUrl); | ||||
slpMintTxid = await get_slp_nft1_mint_txid; | slpMintTxid = await get_slp_nft1_mint_txid; | ||||
slpMint = await chronik.tx(slpMintTxid); | slpMint = await chronik.tx(slpMintTxid); | ||||
▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | it('Gets an SLP NFT1 send tx from the mempool', async () => { | ||||
expect(slpSend.tokenStatus).to.eql('TOKEN_STATUS_NORMAL'); | expect(slpSend.tokenStatus).to.eql('TOKEN_STATUS_NORMAL'); | ||||
}); | }); | ||||
it('Gets an SLP NFT1 child genesis tx from the mempool', async () => { | it('Gets an SLP NFT1 child genesis tx from the mempool', async () => { | ||||
const chronikUrl = await chronik_url; | const chronikUrl = await chronik_url; | ||||
const chronik = new ChronikClientNode(chronikUrl); | const chronik = new ChronikClientNode(chronikUrl); | ||||
slpChildGenesisTxid = await get_slp_nft1_child_genesis1_txid; | slpChildGenesisTxid = await get_slp_nft1_child_genesis1_txid; | ||||
// We can get token info of an slp nft1 child genesis | |||||
const slpChildGenesisMempoolInfo = await chronik.token( | |||||
slpChildGenesisTxid, | |||||
); | |||||
// We do not get mintVaultScripthash, data, or authPubkey keys in GenesisInfo for SLP NFT1 | |||||
expect(slpChildGenesisMempoolInfo).to.deep.equal({ | |||||
tokenId: slpChildGenesisTxid, | |||||
timeFirstSeen: '1300000000', | |||||
tokenType: { | |||||
protocol: 'SLP', | |||||
type: 'SLP_TOKEN_TYPE_NFT1_CHILD', | |||||
number: 65, | |||||
}, | |||||
genesisInfo: { | |||||
tokenTicker: 'SLP NFT CHILD', | |||||
tokenName: 'Slp NFT CHILD token', | |||||
url: '', | |||||
// We get hash even if blank because SLP tokens can have this field | |||||
hash: '', | |||||
decimals: 0, | |||||
}, | |||||
}); | |||||
slpChildGenesis = await chronik.tx(slpChildGenesisTxid); | slpChildGenesis = await chronik.tx(slpChildGenesisTxid); | ||||
// We get expected inputs including expected Token data | // We get expected inputs including expected Token data | ||||
expect(slpChildGenesis.inputs).to.deep.equal([ | expect(slpChildGenesis.inputs).to.deep.equal([ | ||||
{ | { | ||||
...BASE_TX_INPUT, | ...BASE_TX_INPUT, | ||||
prevOut: { | prevOut: { | ||||
txid: '2c6258bee9033399108e845b3c69e60746b89624b3ec18c5d5cc4b2e88c6ccab', | txid: '2c6258bee9033399108e845b3c69e60746b89624b3ec18c5d5cc4b2e88c6ccab', | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | it('Gets an SLP NFT1 child genesis tx from the mempool', async () => { | ||||
expect(slpChildGenesis.tokenStatus).to.eql('TOKEN_STATUS_NORMAL'); | expect(slpChildGenesis.tokenStatus).to.eql('TOKEN_STATUS_NORMAL'); | ||||
}); | }); | ||||
it('Can get all of the above txs from the blockTxs endpoint after they are mined in a block', async () => { | it('Can get all of the above txs from the blockTxs endpoint after they are mined in a block', async () => { | ||||
const chronikUrl = await chronik_url; | const chronikUrl = await chronik_url; | ||||
const chronik = new ChronikClientNode(chronikUrl); | const chronik = new ChronikClientNode(chronikUrl); | ||||
const blockTxs = await chronik.blockTxs(CHAIN_INIT_HEIGHT + 2); | const blockTxs = await chronik.blockTxs(CHAIN_INIT_HEIGHT + 2); | ||||
// Now that we have a block, we get a block key from token info | |||||
const slpGenesisConfirmedInfo = await chronik.token(slpGenesisTxid); | |||||
expect(typeof slpGenesisConfirmedInfo.block !== 'undefined').to.eql( | |||||
true, | |||||
); | |||||
const slpChildGenesisConfirmedInfo = await chronik.token( | |||||
slpChildGenesisTxid, | |||||
); | |||||
expect( | |||||
typeof slpChildGenesisConfirmedInfo.block !== 'undefined', | |||||
).to.eql(true); | |||||
// Clone as we will use blockTxs.txs later | // Clone as we will use blockTxs.txs later | ||||
const txsFromBlock = JSON.parse(JSON.stringify(blockTxs.txs)); | const txsFromBlock = JSON.parse(JSON.stringify(blockTxs.txs)); | ||||
// The first tx is the coinbase tx, which is not a token | // The first tx is the coinbase tx, which is not a token | ||||
const coinbaseTx = txsFromBlock.shift()!; | const coinbaseTx = txsFromBlock.shift()!; | ||||
expect(coinbaseTx.tokenEntries).to.deep.equal([]); | expect(coinbaseTx.tokenEntries).to.deep.equal([]); | ||||
expect(coinbaseTx.tokenFailedParsings).to.deep.equal([]); | expect(coinbaseTx.tokenFailedParsings).to.deep.equal([]); | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |