scs / substrate-api-client

Library for connecting to substrate API over WebSockets
Apache License 2.0
260 stars 124 forks source link

Error while subscribing transfer event #761

Closed shanithkk closed 2 months ago

shanithkk commented 7 months ago

Description

When trying to subscribe the transfer events from rococo local chain, getting deserialise error

Codec(Error { cause: Some(Error { cause: None, desc: "Could not decode `RuntimeEvent`, variant doesn't exist" }), desc: "Could not decode `EventRecord::event`" })

Code Examle

 let event_records = subscription
            .next_events::<RuntimeEvent, Hash>()
            .await
            .unwrap()
            .unwrap();
        for event_record in &event_records {
            println!("decoded: {:?} {:?}", event_record.phase, event_record.event);
            match &event_record.event {
                RuntimeEvent::Balances(balances_event) => {
                    println!(">>>>>>>>>> balances event: {:?}", balances_event);
                    match &balances_event {
                        pallet_balances::Event::Transfer { from, to, amount } => {
                            println!("Transactor: {:?}", from);
                            println!("Destination: {:?}", to);
                            println!("Value: {:?}", amount);
                            // return;
                        }
                        _ => {
                            debug!("ignoring unsupported balances event");
                        }
                    }
                }
                RuntimeEvent::System(system_event) => {
                    println!(">>>>>>>>>> system event: {:?}", system_event);
                    match &system_event {
                        frame_system::Event::ExtrinsicSuccess { dispatch_info } => {
                            println!("DispatchInfo: {:?}", dispatch_info);
                            // return;
                        }
                        _ => {
                            debug!("ignoring unsupported system event");
                        }
                    }
                }
                _ => debug!(
                    "ignoring unsupported module event: {:?}",
                    event_record.event
                ),
            }
        }

Running chain

docker run -p 9944:9944 parity/polkadot:latest --dev  --rpc-external
Niederb commented 7 months ago

I tried to reproduce your issue, but so far without success. Can you try the following:

shanithkk commented 7 months ago

@Niederb sure, i will try these images, i tried latest version of polkadot image. i will update and try it again and get back to you, Thank you

Niederb commented 6 months ago

@shanithkk Does it work with the other images? Then I would close this issue

shanithkk commented 6 months ago

@Niederb still i'm getting error while using parity/polkadot latest image

image
shanithkk commented 6 months ago

@Niederb tested with provided image "paritypr/substrate:latest". works fine for me but parity/polkadot image is not working as expected

Niederb commented 6 months ago

Glad to hear that it works with paritypr/substrate:latest. Do you know what kind of event causes the crash?

Niederb commented 2 months ago

@shanithkk Is this still a problem for you? Otherwise I will close this issue

Niederb commented 2 months ago

This issue should be fixed with #802, therefore I close this