blockbook-client
Version:
Client for interacting with Trezor's blockbook API
67 lines • 2.82 kB
JavaScript
import * as t from 'io-ts';
import { extendCodec, optional } from '@bitaccess/ts-common';
import { NormalizedTxCommonVin, NormalizedTxCommonVout, NormalizedTxCommon, paginated, EthereumSpecific, TokenDetailsTypeERC20, AddressDetailsCommonBasic, BlockInfoCommon, } from './common';
export const NormalizedTxEthereumVin = extendCodec(NormalizedTxCommonVin, {
addresses: t.array(t.string),
}, 'NormalizedTxEthereumVin');
export const NormalizedTxEthereumVout = extendCodec(NormalizedTxCommonVout, {
value: t.string,
}, 'NormalizedTxEthereumVout');
export const NormalizedTxEthereum = extendCodec(NormalizedTxCommon, {
vin: t.array(NormalizedTxEthereumVin),
vout: t.array(NormalizedTxEthereumVout),
fees: t.string,
ethereumSpecific: EthereumSpecific,
}, 'NormalizedTxEthereum');
export const SpecificTxEthereumTx = t.type({
nonce: t.string,
gasPrice: t.string,
gas: t.string,
to: t.string,
value: t.string,
input: t.string,
hash: t.string,
blockNumber: t.string,
blockHash: t.string,
from: t.string,
transactionIndex: t.string,
}, 'SpecificTxEthereumTx');
export const SpecificTxEthereumReceipt = t.type({
gasUsed: t.string,
status: t.string,
logs: t.array(t.any),
}, 'SpecificTxEthereumReceipt');
export const SpecificTxEthereum = t.type({
tx: SpecificTxEthereumTx,
receipt: SpecificTxEthereumReceipt,
}, 'SpecificTxEthereum');
export const TokenDetailsERC20 = t.type({
type: TokenDetailsTypeERC20,
name: t.string,
contract: t.string,
transfers: t.number,
symbol: optional(t.string),
}, 'TokenDetailsERC20');
export const TokenDetailsERC20Balance = extendCodec(TokenDetailsERC20, {
balance: optional(t.string),
}, 'TokenDetailsERC20Balance');
export const AddressDetailsEthereumBasic = extendCodec(AddressDetailsCommonBasic, {
nonTokenTxs: optional(t.number),
nonce: t.string,
}, 'AddressDetailsEthereumBasic');
export const AddressDetailsEthereumTokens = extendCodec(AddressDetailsEthereumBasic, {}, {
tokens: t.array(TokenDetailsERC20),
}, 'AddressDetailsEthereumTokens');
export const AddressDetailsEthereumTokenBalances = extendCodec(AddressDetailsEthereumBasic, {}, {
tokens: t.array(TokenDetailsERC20Balance),
}, 'AddressDetailsEthereumTokenBalances');
export const AddressDetailsEthereumTxids = paginated(extendCodec(AddressDetailsEthereumTokenBalances, {}, {
txids: t.array(t.string),
}, 'AddressDetailsEthereumTxids'));
export const AddressDetailsEthereumTxs = paginated(extendCodec(AddressDetailsEthereumTokenBalances, {}, {
transactions: t.array(NormalizedTxEthereum),
}, 'AddressDetailsEthereumTxs'));
export const BlockInfoEthereum = extendCodec(BlockInfoCommon, {}, {
txs: t.array(NormalizedTxEthereum),
}, 'BlockInfoEthereum');
//# sourceMappingURL=ethereum.js.map