The param "returnObject" is not work in functions: getBlockbyHash and getBlockbyNumber
Renewwen opened this issue · 1 comments
Renewwen commented
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 objectsfalse
: the returned block only contains the transaction hashes, by default, it's false.
neeboo commented
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 ***@***.***>, 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.