Use Bytes for contract rpc input_data (#3841)

* Use Bytes for contract input_data

* Update srml/contracts/rpc/src/lib.rs
This commit is contained in:
kwingram25
2019-10-18 09:28:48 +02:00
committed by Bastian Köcher
parent 5b9952ef1c
commit fddfcbacea
3 changed files with 5 additions and 3 deletions
+1
View File
@@ -4052,6 +4052,7 @@ dependencies = [
"sr-primitives 2.0.0",
"srml-contracts-rpc-runtime-api 2.0.0",
"substrate-client 2.0.0",
"substrate-primitives 2.0.0",
"substrate-rpc-primitives 2.0.0",
]
+1 -1
View File
@@ -10,8 +10,8 @@ codec = { package = "parity-scale-codec", version = "1.0.0" }
jsonrpc-core = "13.2.0"
jsonrpc-core-client = "13.2.0"
jsonrpc-derive = "13.2.0"
primitives = { package = "substrate-primitives", path = "../../../core/primitives" }
rpc-primitives = { package = "substrate-rpc-primitives", path = "../../../core/rpc/primitives" }
serde = { version = "1.0.101", features = ["derive"] }
sr-primitives = { path = "../../../core/sr-primitives" }
srml-contracts-rpc-runtime-api = { path = "./runtime-api" }
+3 -2
View File
@@ -23,6 +23,7 @@ use client::blockchain::HeaderBackend;
use codec::Codec;
use jsonrpc_core::{Error, ErrorCode, Result};
use jsonrpc_derive::rpc;
use primitives::Bytes;
use sr_primitives::{
generic::BlockId,
traits::{Block as BlockT, ProvideRuntimeApi},
@@ -41,7 +42,7 @@ pub struct CallRequest<AccountId, Balance> {
dest: AccountId,
value: Balance,
gas_limit: number::NumberOrHex<u64>,
input_data: Vec<u8>,
input_data: Bytes,
}
/// Contracts RPC methods.
@@ -111,7 +112,7 @@ where
})?;
let exec_result = api
.call(&at, origin, dest, value, gas_limit, input_data)
.call(&at, origin, dest, value, gas_limit, input_data.to_vec())
.map_err(|e| Error {
code: ErrorCode::ServerError(RUNTIME_ERROR),
message: "Runtime trapped while executing a contract.".into(),