feat(blockchain):update call

dev
neeboo 5 years ago
parent d3302931cc
commit a60a5f8a92
  1. 21
      README.md
  2. 2
      package.json
  3. 21
      packages/harmony-core/src/blockchain.ts

@ -27,6 +27,15 @@ yarn add tslib
* [harmony-sdk-examples](https://github.com/FireStack-Lab/harmony-sdk-examples)
# Packages
1. [@harmony-js/core](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-core)
2. [@harmony-js/account](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-account)
3. [@harmony-js/crypto](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-crypto)
4. [@harmony-js/network](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-network)
5. [@harmony-js/utils](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-utils)
6. [@harmony-js/transaction](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-transaction)
7. [@harmony-js/contract](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-contract)
# Hacking from source files
@ -48,18 +57,6 @@ yarn watch
- [E2E Tests](#E2E-tests)
# Packages
1. [@harmony-js/core](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-core)
2. [@harmony-js/account](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-account)
3. [@harmony-js/crypto](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-crypto)
4. [@harmony-js/network](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-network)
5. [@harmony-js/utils](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-utils)
6. [@harmony-js/transaction](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-transaction)
7. [@harmony-js/contract](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-contract)
# Manually Build/bundle
## Build

@ -7,7 +7,7 @@
"scripts": {
"bootstrap": "lerna bootstrap && yarn build:ts",
"watch":"yarn build:ts -w",
"build": "gulp cleanServer && gulp cleanUnexpected && yarn build:ts",
"build": "yarn packages:clean && yarn build:ts",
"build:ts": "tsc -b tsconfig.json",
"build:test":"tsc -b tsconfig.test.json",
"build:e2e":"tsc -b tsconfig.e2e.json",

@ -127,11 +127,7 @@ class Blockchain extends HarmonyCore {
@assertObject({
blockNumber: ['isBlockNumber', AssertType.required],
})
async getBlockTransactionCountByNumber({
blockNumber,
}: {
blockNumber: string;
}) {
async getBlockTransactionCountByNumber({blockNumber}: {blockNumber: string}) {
const result = await this.messenger.send(
RPCMethod.GetBlockTransactionCountByNumber,
[blockNumber],
@ -349,6 +345,21 @@ class Blockchain extends HarmonyCore {
return this.getRpcResult(result);
}
async call({
payload,
blockNumber = DefaultBlockParams.latest,
}: {
payload: any;
blockNumber?: string;
}) {
const result = await this.messenger.send(
RPCMethod.Call,
[payload, blockNumber],
this.chainPrefix,
);
return this.getRpcResult(result);
}
newPendingTransactions() {
if (this.messenger.provider instanceof WSProvider) {
return new NewPendingTransactions(this.messenger);

Loading…
Cancel
Save