feat: add support for blockTime on confirmed block (#15968)

This commit is contained in:
Josh 2021-03-18 07:10:48 -07:00 committed by GitHub
parent 689e03d341
commit 0988c2f1d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -602,6 +602,7 @@ export type ParsedConfirmedTransaction = {
* @property {number} parentSlot Slot index of this block's parent * @property {number} parentSlot Slot index of this block's parent
* @property {Array<object>} transactions Vector of transactions and status metas * @property {Array<object>} transactions Vector of transactions and status metas
* @property {Array<object>} rewards Vector of block rewards * @property {Array<object>} rewards Vector of block rewards
* @property {number|null} blockTime The unix timestamp of when the block was processed
*/ */
export type ConfirmedBlock = { export type ConfirmedBlock = {
blockhash: Blockhash; blockhash: Blockhash;
@ -617,6 +618,7 @@ export type ConfirmedBlock = {
postBalance: number | null; postBalance: number | null;
rewardType: string | null; rewardType: string | null;
}>; }>;
blockTime: number | null;
}; };
/** /**
@ -1247,6 +1249,7 @@ export const GetConfirmedBlockRpcResult = jsonRpcResult(
}), }),
), ),
), ),
blockTime: nullable(number()),
}), }),
), ),
); );

View File

@ -528,6 +528,7 @@ describe('Connection', () => {
method: 'getConfirmedBlock', method: 'getConfirmedBlock',
params: [1], params: [1],
value: { value: {
blockTime: 1614281964,
blockhash: '57zQNBZBEiHsCZFqsaY6h176ioXy5MsSLmcvHkEyaLGy', blockhash: '57zQNBZBEiHsCZFqsaY6h176ioXy5MsSLmcvHkEyaLGy',
previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo', previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo',
parentSlot: 0, parentSlot: 0,
@ -663,6 +664,7 @@ describe('Connection', () => {
method: 'getConfirmedBlock', method: 'getConfirmedBlock',
params: [1], params: [1],
value: { value: {
blockTime: 1614281964,
blockhash: '57zQNBZBEiHsCZFqsaY6h176ioXy5MsSLmcvHkEyaLGy', blockhash: '57zQNBZBEiHsCZFqsaY6h176ioXy5MsSLmcvHkEyaLGy',
previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo', previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo',
parentSlot: 0, parentSlot: 0,
@ -917,6 +919,7 @@ describe('Connection', () => {
method: 'getConfirmedBlock', method: 'getConfirmedBlock',
params: [0], params: [0],
value: { value: {
blockTime: 1614281964,
blockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo', blockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo',
previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo', previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo',
parentSlot: 0, parentSlot: 0,
@ -936,6 +939,7 @@ describe('Connection', () => {
method: 'getConfirmedBlock', method: 'getConfirmedBlock',
params: [1], params: [1],
value: { value: {
blockTime: 1614281964,
blockhash: '57zQNBZBEiHsCZFqsaY6h176ioXy5MsSLmcvHkEyaLGy', blockhash: '57zQNBZBEiHsCZFqsaY6h176ioXy5MsSLmcvHkEyaLGy',
previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo', previousBlockhash: 'H5nJ91eGag3B5ZSRHZ7zG5ZwXJ6ywCt2hyR8xCsV7xMo',
parentSlot: 0, parentSlot: 0,