mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 13:11:10 +00:00
Split subxt (#102)
* Proc macro improvements. * Use proc-macros. * Update examples. * Fix build. * Run rustfmt. * Fix total issuance test. * Remove gas limit from put code call. * Handle runtime errors. * Fix tests. * Make test more reliable. * Revert "Handle runtime errors." This reverts commit 26f30a9f4cfcfddfb3e49308cded46cfe6468697. * Use expect instead of unwrap. * Parse marker type. * Fetch doesn't fail.
This commit is contained in:
+12
-20
@@ -14,6 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use codec::{
|
||||
Codec,
|
||||
Compact,
|
||||
Decode,
|
||||
Encode,
|
||||
Error as CodecError,
|
||||
Input,
|
||||
Output,
|
||||
};
|
||||
use std::{
|
||||
collections::{
|
||||
HashMap,
|
||||
@@ -25,16 +34,7 @@ use std::{
|
||||
Send,
|
||||
},
|
||||
};
|
||||
|
||||
use codec::{
|
||||
Codec,
|
||||
Compact,
|
||||
Decode,
|
||||
Encode,
|
||||
Error as CodecError,
|
||||
Input,
|
||||
Output,
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{
|
||||
metadata::{
|
||||
@@ -66,7 +66,7 @@ pub struct RawEvent {
|
||||
}
|
||||
|
||||
/// Events error.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum EventsError {
|
||||
/// Codec error.
|
||||
#[error("Scale codec error: {0:?}")]
|
||||
@@ -80,6 +80,7 @@ pub enum EventsError {
|
||||
}
|
||||
|
||||
/// Event decoder.
|
||||
#[derive(Debug)]
|
||||
pub struct EventsDecoder<T> {
|
||||
metadata: Metadata,
|
||||
type_sizes: HashMap<String, usize>,
|
||||
@@ -95,10 +96,6 @@ impl<T: System> TryFrom<Metadata> for EventsDecoder<T> {
|
||||
type_sizes: HashMap::new(),
|
||||
marker: PhantomData,
|
||||
};
|
||||
// REMOVE when https://github.com/paritytech/substrate-subxt/pull/102 is merged
|
||||
// Balance type will be registered by the proc macro.
|
||||
decoder.register_type_size::<u128>("Balance")?;
|
||||
|
||||
// register default event arg type sizes for dynamic decoding of events
|
||||
decoder.register_type_size::<bool>("bool")?;
|
||||
decoder.register_type_size::<u32>("ReferendumIndex")?;
|
||||
@@ -123,11 +120,6 @@ impl<T: System> TryFrom<Metadata> for EventsDecoder<T> {
|
||||
}
|
||||
|
||||
impl<T: System> EventsDecoder<T> {
|
||||
/// Register system types.
|
||||
pub fn with_system(&mut self) -> Result<(), EventsError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Register a type.
|
||||
pub fn register_type_size<U>(&mut self, name: &str) -> Result<usize, EventsError>
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user