Changeset View
Changeset View
Standalone View
Standalone View
modules/chronik-client/src/ChronikClientNode.ts
Show First 20 Lines • Show All 949 Lines • ▼ Show 20 Lines | function convertToTokenInfo(tokenInfo: proto.TokenInfo): TokenInfo { | ||||
} | } | ||||
// We use tokenType to get the correct shape of genesisInfo | // We use tokenType to get the correct shape of genesisInfo | ||||
const tokenType = convertToTokenType(tokenInfo.tokenType); | const tokenType = convertToTokenType(tokenInfo.tokenType); | ||||
const returnedTokenInfo: TokenInfo = { | const returnedTokenInfo: TokenInfo = { | ||||
tokenId: tokenInfo.tokenId, | tokenId: tokenInfo.tokenId, | ||||
tokenType, | tokenType, | ||||
timeFirstSeen: tokenInfo.timeFirstSeen, | timeFirstSeen: parseInt(tokenInfo.timeFirstSeen), | ||||
genesisInfo: convertToGenesisInfo(tokenInfo.genesisInfo, tokenType), | genesisInfo: convertToGenesisInfo(tokenInfo.genesisInfo, tokenType), | ||||
}; | }; | ||||
if (typeof tokenInfo.block !== 'undefined') { | if (typeof tokenInfo.block !== 'undefined') { | ||||
// Only include block if the tx is in a block | // Only include block if the tx is in a block | ||||
returnedTokenInfo.block = convertToBlockMeta(tokenInfo.block); | returnedTokenInfo.block = convertToBlockMeta(tokenInfo.block); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 504 Lines • ▼ Show 20 Lines | export interface TokenInfo { | ||||
tokenId: string; | tokenId: string; | ||||
/** Token type of the token */ | /** Token type of the token */ | ||||
tokenType: TokenType; | tokenType: TokenType; | ||||
/** Info found in the token's GENESIS tx */ | /** Info found in the token's GENESIS tx */ | ||||
genesisInfo: GenesisInfo; | genesisInfo: GenesisInfo; | ||||
/** Block of the GENESIS tx, if it's mined already */ | /** Block of the GENESIS tx, if it's mined already */ | ||||
block?: BlockMetadata_InNode; | block?: BlockMetadata_InNode; | ||||
/** Time the GENESIS tx has first been seen by the indexer */ | /** Time the GENESIS tx has first been seen by the indexer */ | ||||
timeFirstSeen: string; | timeFirstSeen: number; | ||||
} | } | ||||
/** Genesis info found in GENESIS txs of tokens */ | /** Genesis info found in GENESIS txs of tokens */ | ||||
export interface GenesisInfo { | export interface GenesisInfo { | ||||
/** token_ticker of the token */ | /** token_ticker of the token */ | ||||
tokenTicker: string; | tokenTicker: string; | ||||
/** token_name of the token */ | /** token_name of the token */ | ||||
tokenName: string; | tokenName: string; | ||||
Show All 22 Lines |