Changeset View
Changeset View
Standalone View
Standalone View
modules/chronik-client/test/integration/token_slp_fungible.ts
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | it('Gets an SLP 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 token from the mempool | |||||
const slpGenesisMempoolInfo = await chronik.token(slpGenesisTxid); | |||||
expect(slpGenesisMempoolInfo).to.deep.equal({ | |||||
tokenId: slpGenesisTxid, | |||||
timeFirstSeen: '1300000000', | |||||
tokenType: { | |||||
protocol: 'SLP', | |||||
type: 'SLP_TOKEN_TYPE_FUNGIBLE', | |||||
number: 1, | |||||
}, | |||||
// We get hash in GenesisInfo for SLP | |||||
// We do not get mintVaultScripthash for non-SLP_MINT_VAULT | |||||
// We do not get data or authPubkey keys in GenesisInfo for non-ALP | |||||
genesisInfo: { | |||||
tokenTicker: 'SLPTEST', | |||||
tokenName: 'Test SLP Token 3', | |||||
url: 'http://example/slp', | |||||
hash: '7878787878787878787878787878787878787878787878787878787878787878', | |||||
decimals: 4, | |||||
}, | |||||
}); | |||||
}); | }); | ||||
it('Gets an SLP fungible mint tx from the mempool', async () => { | it('Gets an SLP fungible 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_fungible_mint_txid; | slpMintTxid = await get_slp_fungible_mint_txid; | ||||
slpMint = await chronik.tx(slpMintTxid); | slpMint = await chronik.tx(slpMintTxid); | ||||
▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | it('Gets an SLP fungible empty genesis tx from the mempool', async () => { | ||||
// Normal status | // Normal status | ||||
expect(slpEmptyGenesis.tokenStatus).to.eql('TOKEN_STATUS_NORMAL'); | expect(slpEmptyGenesis.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); | ||||
// 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 blockTxs = await chronik.blockTxs(CHAIN_INIT_HEIGHT + 2); | const blockTxs = await chronik.blockTxs(CHAIN_INIT_HEIGHT + 2); | ||||
// 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()!; | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |