| 254 | } |
| 255 | |
| 256 | string Eth::eth_sendTransaction(Json::Value const& _json) |
| 257 | { |
| 258 | try |
| 259 | { |
| 260 | TransactionSkeleton t = toTransactionSkeleton(_json); |
| 261 | setTransactionDefaults(t); |
| 262 | TransactionNotification n = m_ethAccounts.authenticate(t); |
| 263 | switch (n.r) |
| 264 | { |
| 265 | case TransactionRepercussion::Success: |
| 266 | return toJS(n.hash); |
| 267 | case TransactionRepercussion::ProxySuccess: |
| 268 | return toJS(n.hash);// TODO: give back something more useful than an empty hash. |
| 269 | case TransactionRepercussion::UnknownAccount: |
| 270 | BOOST_THROW_EXCEPTION(JsonRpcException("Account unknown.")); |
| 271 | case TransactionRepercussion::Locked: |
| 272 | BOOST_THROW_EXCEPTION(JsonRpcException("Account is locked.")); |
| 273 | case TransactionRepercussion::Refused: |
| 274 | BOOST_THROW_EXCEPTION(JsonRpcException("Transaction rejected by user.")); |
| 275 | case TransactionRepercussion::Unknown: |
| 276 | BOOST_THROW_EXCEPTION(JsonRpcException("Unknown reason.")); |
| 277 | } |
| 278 | } |
| 279 | catch (JsonRpcException&) |
| 280 | { |
| 281 | throw; |
| 282 | } |
| 283 | catch (...) |
| 284 | { |
| 285 | BOOST_THROW_EXCEPTION(JsonRpcException(Errors::ERROR_RPC_INVALID_PARAMS)); |
| 286 | } |
| 287 | BOOST_THROW_EXCEPTION(JsonRpcException(Errors::ERROR_RPC_INVALID_PARAMS)); |
| 288 | return string(); |
| 289 | } |
| 290 | |
| 291 | string Eth::eth_signTransaction(Json::Value const& _json) |
| 292 | { |
no test coverage detected