Open Renewwen opened 4 years ago
These option came from Geth, the sdk is designed to adapt from ethereum to Harmony.
Michael So
neeboo@FireStack
Team Github: https://github.com/FireStack-Lab
Team WebSite: https://firestack.one/
On Feb 7, 2020, 7:02 AM +0800, Wayne Zhang notifications@github.com, wrote:
Position harmony-core/src/blockchain.ts Questions For two functions in blockchain.ts, getBlockByHash and getBlockByNumber, There are three params: blockNumber/blockHahs, returnObject, shardID The param returnObject dose nothing. Functions:
// getBlockByHash @assertObject({ blockHash: ['isHash', AssertType.required], returnObject: ['isBoolean', AssertType.optional], shardID: ['isNumber', AssertType.optional], }) async getBlockByHash({ blockHash, returnObject = true, shardID = this.messenger.currentShard, }: { blockHash: string; returnObject?: boolean; shardID?: number; }) { const result = await this.messenger.send( RPCMethod.GetBlockByHash, [blockHash, returnObject], this.messenger.chainPrefix, shardID, ); return this.getRpcResult(result); }
//getBlockByNumber @assertObject({ blockNumber: ['isBlockNumber', AssertType.optional], returnObject: ['isBoolean', AssertType.optional], shardID: ['isNumber', AssertType.optional], }) async getBlockByNumber({ blockNumber = DefaultBlockParams.latest, returnObject = true, shardID = this.messenger.currentShard, }: { blockNumber?: string; returnObject?: boolean; shardID?: number; }) { const result = await this.messenger.send( RPCMethod.GetBlockByNumber, [blockNumber, returnObject], this.messenger.chainPrefix, shardID, ); return this.getRpcResult(result); } Expectation The typereturnObject is boolean:
• true: the returned block will contain all transactions as objects • false: the returned block only contains the transaction hashes, by default, it's false.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Position
harmony-core/src/blockchain.ts
Questions
For two functions in
blockchain.ts
,getBlockByHash
andgetBlockByNumber
,There are three params:
blockNumber/blockHahs
,returnObject
,shardID
The param
returnObject
dose nothing.Functions:
Expectation
The type
returnObject
isboolean
:true
: the returned block will contain all transactions as objectsfalse
: the returned block only contains the transaction hashes, by default, it's false.