@hirosystems/chainhook-client
Version:
Chainhook TypeScript client
95 lines • 5.05 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StacksPayloadSchema = exports.StacksNonConsensusEventSchema = exports.StacksEventSchema = exports.StacksEventMetadataSchema = exports.StacksTransactionSchema = exports.StacksTransactionMetadataSchema = exports.StacksTransactionPositionSchema = exports.StacksTransactionReceiptSchema = exports.StacksExecutionCostSchema = void 0;
const typebox_1 = require("@sinclair/typebox");
const common_1 = require("../common");
const tx_events_1 = require("./tx_events");
const tx_kind_1 = require("./tx_kind");
const if_this_1 = require("./if_this");
const signers_1 = require("./signers");
exports.StacksExecutionCostSchema = typebox_1.Type.Optional(typebox_1.Type.Object({
read_count: typebox_1.Type.Integer(),
read_length: typebox_1.Type.Integer(),
runtime: typebox_1.Type.Integer(),
write_count: typebox_1.Type.Integer(),
write_length: typebox_1.Type.Integer(),
}));
exports.StacksTransactionReceiptSchema = typebox_1.Type.Object({
contract_calls_stack: typebox_1.Type.Array(typebox_1.Type.String()),
events: typebox_1.Type.Array(tx_events_1.StacksTransactionEventSchema),
mutated_assets_radius: typebox_1.Type.Array(typebox_1.Type.String()),
mutated_contracts_radius: typebox_1.Type.Array(typebox_1.Type.String()),
});
exports.StacksTransactionPositionSchema = typebox_1.Type.Object({
index: typebox_1.Type.Integer(),
micro_block_identifier: typebox_1.Type.Optional(common_1.BlockIdentifierSchema),
});
exports.StacksTransactionMetadataSchema = typebox_1.Type.Object({
description: typebox_1.Type.String(),
execution_cost: exports.StacksExecutionCostSchema,
fee: typebox_1.Type.Integer(),
kind: tx_kind_1.StacksTransactionKindSchema,
nonce: typebox_1.Type.Integer(),
position: exports.StacksTransactionPositionSchema,
proof: (0, common_1.Nullable)(typebox_1.Type.String()),
raw_tx: typebox_1.Type.String(),
receipt: exports.StacksTransactionReceiptSchema,
result: typebox_1.Type.String(),
sender: typebox_1.Type.String(),
sponsor: typebox_1.Type.Optional(typebox_1.Type.String()),
success: typebox_1.Type.Boolean(),
contract_abi: typebox_1.Type.Optional(typebox_1.Type.Any()),
});
exports.StacksTransactionSchema = typebox_1.Type.Object({
transaction_identifier: common_1.TransactionIdentifierSchema,
operations: typebox_1.Type.Array(common_1.RosettaOperationSchema),
metadata: exports.StacksTransactionMetadataSchema,
});
exports.StacksEventMetadataSchema = typebox_1.Type.Object({
bitcoin_anchor_block_identifier: common_1.BlockIdentifierSchema,
confirm_microblock_identifier: (0, common_1.Nullable)(common_1.BlockIdentifierSchema),
pox_cycle_index: typebox_1.Type.Integer(),
pox_cycle_length: typebox_1.Type.Integer(),
pox_cycle_position: typebox_1.Type.Integer(),
stacks_block_hash: typebox_1.Type.String(),
tenure_height: (0, common_1.Nullable)(typebox_1.Type.Integer()),
// Fields included in Nakamoto block headers
block_time: (0, common_1.Nullable)(typebox_1.Type.Integer()),
signer_bitvec: (0, common_1.Nullable)(typebox_1.Type.String()),
signer_signature: (0, common_1.Nullable)(typebox_1.Type.Array(typebox_1.Type.String())),
signer_public_keys: (0, common_1.Nullable)(typebox_1.Type.Array(typebox_1.Type.String())),
// Available starting in epoch3, only included in blocks where the pox cycle rewards are first calculated
cycle_number: (0, common_1.Nullable)(typebox_1.Type.Integer()),
reward_set: (0, common_1.Nullable)(typebox_1.Type.Object({
pox_ustx_threshold: typebox_1.Type.String(),
rewarded_addresses: typebox_1.Type.Array(typebox_1.Type.String()),
signers: (0, common_1.Nullable)(typebox_1.Type.Array(typebox_1.Type.Object({
signing_key: typebox_1.Type.String(),
weight: typebox_1.Type.Integer(),
stacked_amt: typebox_1.Type.String(),
}))),
})),
});
exports.StacksEventSchema = typebox_1.Type.Object({
block_identifier: common_1.BlockIdentifierSchema,
parent_block_identifier: common_1.BlockIdentifierSchema,
timestamp: typebox_1.Type.Integer(),
transactions: typebox_1.Type.Array(exports.StacksTransactionSchema),
metadata: exports.StacksEventMetadataSchema,
});
exports.StacksNonConsensusEventSchema = typebox_1.Type.Object({
payload: typebox_1.Type.Union([signers_1.StacksSignerMessageEventSchema]),
received_at_ms: typebox_1.Type.Integer(),
received_at_block: common_1.BlockIdentifierSchema,
});
exports.StacksPayloadSchema = typebox_1.Type.Object({
apply: typebox_1.Type.Array(exports.StacksEventSchema),
rollback: typebox_1.Type.Array(exports.StacksEventSchema),
events: typebox_1.Type.Array(exports.StacksNonConsensusEventSchema),
chainhook: typebox_1.Type.Object({
uuid: typebox_1.Type.String(),
predicate: if_this_1.StacksIfThisSchema,
is_streaming_blocks: typebox_1.Type.Boolean(),
}),
});
//# sourceMappingURL=payload.js.map