aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-19 19:17:20 +0800
committerGitHub <noreply@github.com>2018-06-19 19:17:20 +0800
commit3002bc0eeec0d72ff01741ab0fe16e17be50dda9 (patch)
tree5a9323c855b675a3d3b840249f673eca58d16645
parent9c747f316084d16c64a49d3f18005a2e54d49a71 (diff)
parentdf50232ed90fd880019eff9c9fe66fb2a4cff4bb (diff)
downloaddexon-sol-tools-3002bc0eeec0d72ff01741ab0fe16e17be50dda9.tar
dexon-sol-tools-3002bc0eeec0d72ff01741ab0fe16e17be50dda9.tar.gz
dexon-sol-tools-3002bc0eeec0d72ff01741ab0fe16e17be50dda9.tar.bz2
dexon-sol-tools-3002bc0eeec0d72ff01741ab0fe16e17be50dda9.tar.lz
dexon-sol-tools-3002bc0eeec0d72ff01741ab0fe16e17be50dda9.tar.xz
dexon-sol-tools-3002bc0eeec0d72ff01741ab0fe16e17be50dda9.tar.zst
dexon-sol-tools-3002bc0eeec0d72ff01741ab0fe16e17be50dda9.zip
Merge pull request #731 from avonian/v2-prototype
Fix sendRawPaylodAsync for improved JSON-RPC compatibility
-rw-r--r--packages/web3-wrapper/src/web3_wrapper.ts9
-rw-r--r--yarn.lock4
2 files changed, 9 insertions, 4 deletions
diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts
index 5d2eedcb3..6ea69883c 100644
--- a/packages/web3-wrapper/src/web3_wrapper.ts
+++ b/packages/web3-wrapper/src/web3_wrapper.ts
@@ -491,8 +491,13 @@ export class Web3Wrapper {
}
private async _sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> {
const sendAsync = this._web3.currentProvider.sendAsync.bind(this._web3.currentProvider);
- payload.id = this._jsonRpcRequestId++;
- const response = await promisify<JSONRPCResponsePayload>(sendAsync)(payload);
+ const payloadWithDefaults = {
+ id: this._jsonRpcRequestId++,
+ params: [],
+ jsonrpc: '2.0',
+ ...payload,
+ };
+ const response = await promisify<JSONRPCResponsePayload>(sendAsync)(payloadWithDefaults);
const result = response.result;
return result;
}
diff --git a/yarn.lock b/yarn.lock
index d6524eff3..cbd8be18d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -438,7 +438,7 @@
"@types/glob" "*"
"@types/node" "*"
-"@types/semver@^5.5.0":
+"@types/semver@5.5.0", "@types/semver@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
@@ -6353,7 +6353,7 @@ isobject@^3.0.0, isobject@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
-isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1:
+isomorphic-fetch@2.2.1, isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
dependencies: