@greymass/eosio
Advanced tools
Comparing version 0.6.11 to 0.7.0
{ | ||
"name": "@greymass/eosio", | ||
"description": "Library for working with EOSIO blockchains", | ||
"version": "0.6.11", | ||
"version": "0.7.0", | ||
"homepage": "https://github.com/greymass/eosio-core", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause-No-Military-License", |
import {APIClient} from '../client' | ||
import { | ||
BlockIdType, | ||
Bytes, | ||
@@ -84,3 +85,3 @@ Checksum160, | ||
async get_block(block_num_or_id: Checksum256Type | UInt32Type) { | ||
async get_block(block_num_or_id: BlockIdType | UInt32Type) { | ||
return this.client.call({ | ||
@@ -93,3 +94,3 @@ path: '/v1/chain/get_block', | ||
async get_block_header_state(block_num_or_id: Checksum256Type | UInt32Type) { | ||
async get_block_header_state(block_num_or_id: BlockIdType | UInt32Type) { | ||
return this.client.call({ | ||
@@ -96,0 +97,0 @@ path: '/v1/chain/get_block_header_state', |
@@ -6,2 +6,3 @@ import { | ||
Authority, | ||
BlockId, | ||
BlockTimestamp, | ||
@@ -256,3 +257,3 @@ Bytes, | ||
@Struct.field('uint16') declare confirmed: UInt16 | ||
@Struct.field('checksum256') declare previous: Checksum256 | ||
@Struct.field(BlockId) declare previous: BlockId | ||
@Struct.field('checksum256') declare transaction_mroot: Checksum256 | ||
@@ -268,3 +269,3 @@ @Struct.field('checksum256') declare action_mroot: Checksum256 | ||
@Struct.field('block_extension', {optional: true}) declare block_extensions: BlockExtension[] | ||
@Struct.field('checksum256') declare id: Checksum256 | ||
@Struct.field(BlockId) declare id: BlockId | ||
@Struct.field('uint32') declare block_num: UInt32 | ||
@@ -298,3 +299,3 @@ @Struct.field('uint32') declare ref_block_prefix: UInt32 | ||
@Struct.field('uint16') declare confirmed: UInt16 | ||
@Struct.field('checksum256') declare previous: Checksum256 | ||
@Struct.field(BlockId) declare previous: BlockId | ||
@Struct.field('checksum256') declare transaction_mroot: Checksum256 | ||
@@ -313,3 +314,3 @@ @Struct.field('checksum256') declare action_mroot: Checksum256 | ||
@Struct.field('uint32') declare dpos_irreversible_blocknum: UInt32 | ||
@Struct.field('checksum256') declare id: Checksum256 | ||
@Struct.field(BlockId) declare id: BlockId | ||
@Struct.field(BlockStateHeader) declare header: BlockStateHeader | ||
@@ -339,5 +340,5 @@ /** Unstructured any fields specific to header state calls */ | ||
/** Highest block ID on the chain that has been irreversibly applied to state. */ | ||
@Struct.field('checksum256') declare last_irreversible_block_id: Checksum256 | ||
@Struct.field(BlockId) declare last_irreversible_block_id: BlockId | ||
/** Highest block ID on the chain. */ | ||
@Struct.field('checksum256') declare head_block_id: Checksum256 | ||
@Struct.field(BlockId) declare head_block_id: BlockId | ||
/** Highest block unix timestamp. */ | ||
@@ -360,3 +361,3 @@ @Struct.field('time_point') declare head_block_time: TimePoint | ||
/** Hash representing the best known head in the fork database tree. */ | ||
@Struct.field('checksum256?') fork_db_head_block_id?: Checksum256 | ||
@Struct.field('block_id_type?') fork_db_head_block_id?: BlockId | ||
@@ -610,8 +611,8 @@ getTransactionHeader(secondsAhead = 120): TransactionHeader { | ||
@Struct.field('uint32') declare head_number: UInt32 | ||
@Struct.field('checksum256') declare head_id: Checksum256 | ||
@Struct.field(BlockId) declare head_id: BlockId | ||
@Struct.field('time_point') declare head_timestamp: TimePoint | ||
@Struct.field('uint32') declare irreversible_number: UInt32 | ||
@Struct.field('checksum256') declare irreversible_id: Checksum256 | ||
@Struct.field(BlockId) declare irreversible_id: BlockId | ||
@Struct.field('time_point') declare irreversible_timestamp: TimePoint | ||
@Struct.field('checksum256') declare earliest_tracked_block_id: Checksum256 | ||
@Struct.field(BlockId) declare earliest_tracked_block_id: BlockId | ||
@Struct.field('uint32') declare earliest_tracked_block_number: UInt32 | ||
@@ -618,0 +619,0 @@ } |
@@ -23,1 +23,2 @@ // types with no inter-dependencies | ||
export * from './authority' | ||
export * from './block-id' |
import { | ||
BlockId, | ||
Bytes, | ||
@@ -31,5 +32,5 @@ Checksum256, | ||
@Struct.field('uint32') declare lastIrreversibleBlockNumber: UInt32 | ||
@Struct.field('checksum256') declare lastIrreversibleBlockId: Checksum256 | ||
@Struct.field(BlockId) declare lastIrreversibleBlockId: BlockId | ||
@Struct.field('uint32') declare headNum: UInt32 | ||
@Struct.field('checksum256') declare headId: Checksum256 | ||
@Struct.field(BlockId) declare headId: BlockId | ||
@Struct.field('string') declare os: string | ||
@@ -43,5 +44,5 @@ @Struct.field('string') declare agent: string | ||
@Struct.field('uint32') declare lastIrreversibleBlockNumber: UInt32 | ||
@Struct.field('checksum256') declare lastIrreversibleBlockId: Checksum256 | ||
@Struct.field(BlockId) declare lastIrreversibleBlockId: BlockId | ||
@Struct.field('uint32') declare headNum: UInt32 | ||
@Struct.field('checksum256') declare headId: Checksum256 | ||
@Struct.field(BlockId) declare headId: BlockId | ||
} | ||
@@ -66,3 +67,3 @@ | ||
@Struct.field('checksum256', {array: true}) declare knownTrx: Checksum256[] | ||
@Struct.field('checksum256', {array: true}) declare knownBlocks: Checksum256[] | ||
@Struct.field(BlockId, {array: true}) declare knownBlocks: BlockId[] | ||
} | ||
@@ -73,3 +74,3 @@ | ||
@Struct.field('checksum256', {array: true}) declare reqTrx: Checksum256[] | ||
@Struct.field('checksum256', {array: true}) declare reqBlocks: Checksum256[] | ||
@Struct.field(BlockId, {array: true}) declare reqBlocks: BlockId[] | ||
} | ||
@@ -125,5 +126,5 @@ | ||
@Struct.field('uint16') declare confirmed: UInt16 | ||
@Struct.field('checksum256') declare previous: Checksum256 | ||
@Struct.field('checksum256') declare transaction_mroot: Checksum256 | ||
@Struct.field('checksum256') declare action_mroot: Checksum256 | ||
@Struct.field(BlockId) declare previous: BlockId | ||
@Struct.field(BlockId) declare transaction_mroot: BlockId | ||
@Struct.field(BlockId) declare action_mroot: BlockId | ||
@Struct.field('uint32') declare schedule_version: UInt32 | ||
@@ -133,20 +134,9 @@ @Struct.field(NewProducers, {optional: true}) new_producers?: NewProducers | ||
get blockNum(): number { | ||
const bytes = this.previous.array.slice(0, 4) | ||
let num = 0 | ||
for (let i = 0; i < 4; i++) { | ||
num = (num << 8) + bytes[i] | ||
} | ||
return num + 1 | ||
get blockNum(): UInt32 { | ||
return this.previous.blockNum.adding(1) | ||
} | ||
get id(): Checksum256 { | ||
get id(): BlockId { | ||
const id = Checksum256.hash(Serializer.encode({object: this, type: BlockHeader})) | ||
const numBuffer = new Uint8Array(4) | ||
numBuffer[0] = (this.blockNum >> 24) & 0xff | ||
numBuffer[1] = (this.blockNum >> 16) & 0xff | ||
numBuffer[2] = (this.blockNum >> 8) & 0xff | ||
numBuffer[3] = this.blockNum & 0xff | ||
id.array.set(numBuffer, 0) | ||
return id | ||
return BlockId.fromBlockChecksum(id, this.blockNum) | ||
} | ||
@@ -153,0 +143,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1510649
126
26481