difftreelog
style retab runtime apis
in: master
1 file changed
runtime/common/runtime_apis.rsdiffbeforeafterboth60 config::ethereum::CrossAccountId,60 config::ethereum::CrossAccountId,61 };61 };62 use up_data_structs::*;62 use up_data_structs::*;6363 use crate::Block;646465 impl_runtime_apis! {65 impl_runtime_apis! {66 $($($custom_apis)+)?66 $($($custom_apis)+)?284 }284 }285285286 // fn random_seed() -> <Block as BlockT>::Hash {286 // fn random_seed() -> <Block as BlockT>::Hash {287 // RandomnessCollectiveFlip::random_seed().0287 // RandomnessCollectiveFlip::random_seed().0288 // }288 // }289 }289 }290290472 }472 }473 }473 }474475 impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {476 fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {477 UncheckedExtrinsic::new_unsigned(478 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),479 )480 }481 }482474483 impl sp_session::SessionKeys<Block> for Runtime {475 impl sp_session::SessionKeys<Block> for Runtime {484 fn decode_session_keys(476 fn decode_session_keys(508 }500 }509 }501 }510502511 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {503 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {512 fn account_nonce(account: AccountId) -> Index {504 fn account_nonce(account: AccountId) -> Nonce {513 System::account_nonce(account)505 System::account_nonce(account)514 }506 }515 }507 }529 }521 }530 }522 }531532 /*533 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>534 for Runtime535 {536 fn call(537 origin: AccountId,538 dest: AccountId,539 value: Balance,540 gas_limit: u64,541 input_data: Vec<u8>,542 ) -> pallet_contracts_primitives::ContractExecResult {543 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)544 }545546 fn instantiate(547 origin: AccountId,548 endowment: Balance,549 gas_limit: u64,550 code: pallet_contracts_primitives::Code<Hash>,551 data: Vec<u8>,552 salt: Vec<u8>,553 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>554 {555 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)556 }557558 fn get_storage(559 address: AccountId,560 key: [u8; 32],561 ) -> pallet_contracts_primitives::GetStorageResult {562 Contracts::get_storage(address, key)563 }564565 fn rent_projection(566 address: AccountId,567 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {568 Contracts::rent_projection(address)569 }570 }571 */572523573 #[cfg(feature = "runtime-benchmarks")]524 #[cfg(feature = "runtime-benchmarks")]574 impl frame_benchmarking::Benchmark<Block> for Runtime {525 impl frame_benchmarking::Benchmark<Block> for Runtime {690 fn pov_estimate(uxt: Vec<u8>) -> ApplyExtrinsicResult {641 fn pov_estimate(uxt: Vec<u8>) -> ApplyExtrinsicResult {691 #[cfg(feature = "pov-estimate")]642 #[cfg(feature = "pov-estimate")]692 {643 {693 use codec::Decode;644 use parity_scale_codec::Decode;694645695 let uxt_decode = <<Block as BlockT>::Extrinsic as Decode>::decode(&mut &*uxt)646 let uxt_decode = <<Block as BlockT>::Extrinsic as Decode>::decode(&mut &*uxt)696 .map_err(|_| DispatchError::Other("failed to decode the extrinsic"));647 .map_err(|_| DispatchError::Other("failed to decode the extrinsic"));734 }685 }735 }686 }687688 /// Should never be used, yet still required because of https://github.com/paritytech/polkadot-sdk/issues/27689 /// Not allowed to panic, because rpc may be called using native runtime, thus causing thread panic.690 impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {691 fn convert_transaction(692 transaction: pallet_ethereum::Transaction693 ) -> <Block as BlockT>::Extrinsic {694 UncheckedExtrinsic::new_unsigned(695 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),696 )697 }698 }736 }699 }737 }700 }738}701}