Skip to content
Snippets Groups Projects
Select Git revision
  • c4bdceaf4f9d2f044e09c4fa91e5120683b55715
  • master default protected
  • WIP-buggy-mywallets-riverpod
  • polkadart-stuff
  • provider-to-riverpod
  • implementLightnode
  • hugo_RML16
  • refactorOnboardingSlideshow
  • duniterV1Latest
  • scanNetwork
  • dubp_rs
  • v0.2.18+141
  • v0.2.17+140
  • v0.2.16+139
  • v0.2.16+138
  • v0.2.15+137
  • v0.2.14+134
  • v0.2.13+133
  • v0.2.13+132
  • v0.2.12+131
  • v0.2.11+130
  • v0.2.10+129
  • v0.2.9+128
  • v0.2.8+127
  • v0.2.7+125
  • v0.2.6+124
  • v0.2.5+123
  • v0.2.4+122
  • v0.2.3+119
  • v0.2.2+118
  • v0.2.1+113
31 results

payment_popup.dart

Blame
  • rpc.rs 3.30 KiB
    // Copyright 2021 Axiom-Team
    //
    // This file is part of Duniter-v2S.
    //
    // Duniter-v2S is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as published by
    // the Free Software Foundation, version 3 of the License.
    //
    // Duniter-v2S is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
    
    //! A collection of node-specific RPC methods.
    //! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
    //! used by Substrate nodes. This file extends those RPC definitions with
    //! capabilities that are specific to this project's runtime configuration.
    
    #![warn(missing_docs)]
    
    pub use sc_rpc_api::DenyUnsafe;
    
    use common_runtime::Block;
    use common_runtime::{AccountId, Balance, Index};
    use jsonrpsee::RpcModule;
    use sc_transaction_pool_api::TransactionPool;
    use sp_api::ProvideRuntimeApi;
    use sp_block_builder::BlockBuilder;
    use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
    use std::sync::Arc;
    
    /// Full client dependencies.
    pub struct FullDeps<C, P> {
        /// The client instance to use.
        pub client: Arc<C>,
        /// Transaction pool instance.
        pub pool: Arc<P>,
        /// Whether to deny unsafe calls
        pub deny_unsafe: DenyUnsafe,
        /// Manual seal command sink
        pub command_sink_opt:
            Option<futures::channel::mpsc::Sender<manual_seal::EngineCommand<sp_core::H256>>>,
    }
    
    /// Instantiate all full RPC extensions.
    pub fn create_full<C, P>(
        deps: FullDeps<C, P>,
    ) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
    where
        C: ProvideRuntimeApi<Block>,
        C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,
        C: Send + Sync + 'static,
        C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
        C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
        C::Api: BlockBuilder<Block>,
        P: TransactionPool + 'static,
    {
        use manual_seal::rpc::{ManualSeal, ManualSealApiServer};
        use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
        use substrate_frame_rpc_system::{System, SystemApiServer};
    
        let mut module = RpcModule::new(());
        let FullDeps {
            client,
            pool,
            deny_unsafe,
            command_sink_opt,
        } = deps;
    
        module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
        module.merge(TransactionPayment::new(client).into_rpc())?;
    
        if let Some(command_sink) = command_sink_opt {
            // We provide the rpc handler with the sending end of the channel to allow the rpc
            // send EngineCommands to the background block authorship task.
            module.merge(ManualSeal::new(command_sink).into_rpc())?;
        };
    
        // Extend this RPC with a custom API by using the following syntax.
        // `YourRpcStruct` should have a reference to a client, which is needed
        // to call into the runtime.
        // `module.merge(YourRpcTrait::into_rpc(YourRpcStruct::new(ReferenceToClient, ...)))?;`
    
        Ok(module)
    }