Kagome
Polkadot Runtime Engine in C++17
kagome::api::AuthorApiImpl Class Reference

#include <author_api_impl.hpp>

Inheritance diagram for kagome::api::AuthorApiImpl:
Collaboration diagram for kagome::api::AuthorApiImpl:

Public Member Functions

 AuthorApiImpl (sptr< runtime::SessionKeysApi > key_api, sptr< transaction_pool::TransactionPool > pool, sptr< crypto::CryptoStore > store, sptr< crypto::SessionKeys > keys, sptr< crypto::KeyFileStorage > key_store, sptr< blockchain::BlockTree > block_tree)
 
 ~AuthorApiImpl () override=default
 
void setApiService (sptr< api::ApiService > const &api_service) override
 
outcome::result< common::Hash256submitExtrinsic (TransactionSource source, const primitives::Extrinsic &extrinsic) override
 validates and sends extrinsic to transaction pool More...
 
outcome::result< void > insertKey (crypto::KeyTypeId key_type, const gsl::span< const uint8_t > &seed, const gsl::span< const uint8_t > &public_key) override
 insert an anonimous key pair into the keystore More...
 
outcome::result< common::BufferrotateKeys () override
 Generate new session keys and returns the corresponding public keys. More...
 
outcome::result< bool > hasSessionKeys (const gsl::span< const uint8_t > &keys) override
 checks if the keystore has private keys for the given session public keys More...
 
outcome::result< bool > hasKey (const gsl::span< const uint8_t > &public_key, crypto::KeyTypeId key_type) override
 checks if the keystore has private keys for the given public key and key type More...
 
outcome::result< std::vector< primitives::Extrinsic > > pendingExtrinsics () override
 
outcome::result< std::vector< primitives::Extrinsic > > removeExtrinsic (const std::vector< primitives::ExtrinsicKey > &keys) override
 
outcome::result< SubscriptionIdsubmitAndWatchExtrinsic (Extrinsic extrinsic) override
 
outcome::result< bool > unwatchExtrinsic (SubscriptionId subscription_id) override
 
- Public Member Functions inherited from kagome::api::AuthorApi
virtual ~AuthorApi ()=default
 
virtual void setApiService (std::shared_ptr< api::ApiService > const &api_service)=0
 

Private Types

template<class T >
using sptr = std::shared_ptr< T >
 
template<class T >
using uptr = std::unique_ptr< T >
 

Private Attributes

sptr< runtime::SessionKeysApikeys_api_
 
sptr< transaction_pool::TransactionPoolpool_
 
sptr< crypto::CryptoStorestore_
 
sptr< crypto::SessionKeyskeys_
 
sptr< crypto::KeyFileStoragekey_store_
 
std::weak_ptr< api::ApiServiceapi_service_
 
sptr< blockchain::BlockTreeblock_tree_
 
log::Logger logger_
 

Additional Inherited Members

- Protected Types inherited from kagome::api::AuthorApi
using Hash256 = common::Hash256
 
using Buffer = common::Buffer
 
using Extrinsic = primitives::Extrinsic
 
using Metadata = primitives::Metadata
 
using SubscriptionId = primitives::SubscriptionId
 
using ExtrinsicKey = primitives::ExtrinsicKey
 
using TransactionSource = primitives::TransactionSource
 

Detailed Description

Definition at line 56 of file author_api_impl.hpp.

Member Typedef Documentation

template<class T >
using kagome::api::AuthorApiImpl::sptr = std::shared_ptr<T>
private

Definition at line 58 of file author_api_impl.hpp.

template<class T >
using kagome::api::AuthorApiImpl::uptr = std::unique_ptr<T>
private

Definition at line 60 of file author_api_impl.hpp.

Constructor & Destructor Documentation

kagome::api::AuthorApiImpl::AuthorApiImpl ( sptr< runtime::SessionKeysApi key_api,
sptr< transaction_pool::TransactionPool pool,
sptr< crypto::CryptoStore store,
sptr< crypto::SessionKeys keys,
sptr< crypto::KeyFileStorage key_store,
sptr< blockchain::BlockTree block_tree 
)
Parameters
apittq instance shared ptr
pooltransaction pool instance shared ptr
hasherhasher instance shared ptr
block_treeblock tree instance shared ptr

Definition at line 34 of file author_api_impl.cpp.

kagome::api::AuthorApiImpl::~AuthorApiImpl ( )
overridedefault

Member Function Documentation

outcome::result< bool > kagome::api::AuthorApiImpl::hasKey ( const gsl::span< const uint8_t > &  public_key,
crypto::KeyTypeId  key_type 
)
overridevirtual

checks if the keystore has private keys for the given public key and key type

Parameters
public_keyThe public key in binary
key_typeThe key type

Implements kagome::api::AuthorApi.

Definition at line 165 of file author_api_impl.cpp.

outcome::result< bool > kagome::api::AuthorApiImpl::hasSessionKeys ( const gsl::span< const uint8_t > &  keys)
overridevirtual

checks if the keystore has private keys for the given session public keys

Parameters
keysSCALE encoded concatenated keys
Returns
returns true if all private keys could be found, false if otherwise

Implements kagome::api::AuthorApi.

Definition at line 136 of file author_api_impl.cpp.

outcome::result< void > kagome::api::AuthorApiImpl::insertKey ( crypto::KeyTypeId  key_type,
const gsl::span< const uint8_t > &  seed,
const gsl::span< const uint8_t > &  public_key 
)
overridevirtual

insert an anonimous key pair into the keystore

Parameters
key_typeKey type
seedThe seed (suri) in binary
public_keyThe public key in binary

Implements kagome::api::AuthorApi.

Definition at line 68 of file author_api_impl.cpp.

outcome::result< std::vector< primitives::Extrinsic > > kagome::api::AuthorApiImpl::pendingExtrinsics ( )
overridevirtual
Returns
collection of pending extrinsics

Implements kagome::api::AuthorApi.

Definition at line 175 of file author_api_impl.cpp.

outcome::result< std::vector< primitives::Extrinsic > > kagome::api::AuthorApiImpl::removeExtrinsic ( const std::vector< primitives::ExtrinsicKey > &  keys)
overridevirtual

Remove given extrinsic from the pool and temporarily ban it to prevent reimporting.

Implements kagome::api::AuthorApi.

Definition at line 190 of file author_api_impl.cpp.

outcome::result< common::Buffer > kagome::api::AuthorApiImpl::rotateKeys ( )
overridevirtual

Generate new session keys and returns the corresponding public keys.

Returns
The SCALE encoded, concatenated keys

Implements kagome::api::AuthorApi.

Definition at line 126 of file author_api_impl.cpp.

void kagome::api::AuthorApiImpl::setApiService ( sptr< api::ApiService > const &  api_service)
override

Definition at line 56 of file author_api_impl.cpp.

outcome::result< AuthorApi::SubscriptionId > kagome::api::AuthorApiImpl::submitAndWatchExtrinsic ( Extrinsic  extrinsic)
overridevirtual

Submit an extrinsic and watch.

Implements kagome::api::AuthorApi.

Definition at line 197 of file author_api_impl.cpp.

outcome::result< common::Hash256 > kagome::api::AuthorApiImpl::submitExtrinsic ( TransactionSource  source,
const primitives::Extrinsic extrinsic 
)
overridevirtual

validates and sends extrinsic to transaction pool

Parameters
sourcehow extrinsic was received (for example external or submitted through offchain worker)
extrinsicset of bytes representing either transaction or inherent
Returns
hash of successfully validated extrinsic or error if state is invalid or unknown

Implements kagome::api::AuthorApi.

Definition at line 62 of file author_api_impl.cpp.

outcome::result< bool > kagome::api::AuthorApiImpl::unwatchExtrinsic ( SubscriptionId  sub_id)
overridevirtual

Unsubscribe from extrinsic watching.

See also
AuthorApi::submitAndWatchExtrinsic
Returns
true if the subscriber was unsubscribed, false if there was no subscriber.

Implements kagome::api::AuthorApi.

Definition at line 220 of file author_api_impl.cpp.

Member Data Documentation

std::weak_ptr<api::ApiService> kagome::api::AuthorApiImpl::api_service_
private

Definition at line 116 of file author_api_impl.hpp.

sptr<blockchain::BlockTree> kagome::api::AuthorApiImpl::block_tree_
private

Definition at line 117 of file author_api_impl.hpp.

sptr<crypto::KeyFileStorage> kagome::api::AuthorApiImpl::key_store_
private

Definition at line 115 of file author_api_impl.hpp.

sptr<crypto::SessionKeys> kagome::api::AuthorApiImpl::keys_
private

Definition at line 114 of file author_api_impl.hpp.

sptr<runtime::SessionKeysApi> kagome::api::AuthorApiImpl::keys_api_
private

Definition at line 111 of file author_api_impl.hpp.

log::Logger kagome::api::AuthorApiImpl::logger_
private

Definition at line 119 of file author_api_impl.hpp.

sptr<transaction_pool::TransactionPool> kagome::api::AuthorApiImpl::pool_
private

Definition at line 112 of file author_api_impl.hpp.

sptr<crypto::CryptoStore> kagome::api::AuthorApiImpl::store_
private

Definition at line 113 of file author_api_impl.hpp.


The documentation for this class was generated from the following files: