-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify examples to work with latest substrate changes #440
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
runtime_metadata_path = "examples/polkadot_metadata.scale", | ||
// We can add (certain) custom derives to the generated types by providing | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious: do you happen to know what this "(certain)" means? Do we know which ones work and which don't? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't actually dug into this; I suspect we are limited by the derives on various types that are pointed at by the codegen types (eg There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Also |
||
// a comma separated list to the below attribute. Most useful for adding `Clone`: | ||
generated_type_derives = "Clone, Hash" | ||
generated_type_derives = "Clone" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting; did |
||
)] | ||
pub mod polkadot {} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -70,7 +70,7 @@ async fn simple_transfer() -> Result<(), Box<dyn std::error::Error>> { | |||||
balance_transfer.find_first_event::<polkadot::balances::events::Transfer>()?; | ||||||
|
||||||
if let Some(event) = transfer_event { | ||||||
println!("Balance transfer success: value: {:?}", event.2); | ||||||
println!("Balance transfer success: value: {:?}", event); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
…but is it a "value" or an "event"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mmm, it was a value but if we are printing out the entire event now by the looks of it, it's now just the Transfer event. |
||||||
} else { | ||||||
println!("Failed to find Balances::Transfer Event"); | ||||||
} | ||||||
|
@@ -119,7 +119,7 @@ async fn simple_transfer_separate_events() -> Result<(), Box<dyn std::error::Err | |||||
let transfer_event = | ||||||
events.find_first_event::<polkadot::balances::events::Transfer>()?; | ||||||
if let Some(event) = transfer_event { | ||||||
println!("Balance transfer success: value: {:?}", event.2); | ||||||
println!("Balance transfer success: value: {:?}", event); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||||||
} else { | ||||||
println!("Failed to find Balances::Transfer Event"); | ||||||
} | ||||||
|
@@ -166,7 +166,7 @@ async fn handle_transfer_events() -> Result<(), Box<dyn std::error::Error>> { | |||||
if let Some(event) = transfer_event { | ||||||
println!( | ||||||
"Balance transfer is now in block (but not finalized): value: {:?}", | ||||||
event.2 | ||||||
event | ||||||
); | ||||||
} else { | ||||||
println!("Failed to find Balances::Transfer Event"); | ||||||
|
@@ -185,7 +185,7 @@ async fn handle_transfer_events() -> Result<(), Box<dyn std::error::Error>> { | |||||
events.find_first_event::<polkadot::balances::events::Transfer>()?; | ||||||
|
||||||
if let Some(event) = transfer_event { | ||||||
println!("Balance transfer success: value: {:?}", event.2); | ||||||
println!("Balance transfer success: value: {:?}", event); | ||||||
} else { | ||||||
println!("Failed to find Balances::Transfer Event"); | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
/// Generate by: | ||
/// | ||
/// - run `polkadot --dev --tmp` node locally | ||
/// - `cargo run --release -p subxt-cli -- codegen | rustfmt --edition=2018 --emit=stdout > tests/integration/codegen/polkadot.rs` | ||
/// - `cargo run --release -p subxt-cli -- codegen | rustfmt --edition=2018 --emit=stdout > subxt/tests/integration/codegen/polkadot.rs` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're on edition 2021 I think. But also: do we really need that? I suspect just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree; I don't think either of the flags are needed actually (I always just |
||
#[rustfmt::skip] | ||
#[allow(clippy::all)] | ||
mod polkadot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Will open a new PR, examples are working on master