mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 09:31:12 +00:00
xxx: Include DispatchError and use balanace_transfer_with_params
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
+23586
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ use jsonrpsee::client_transport::ws::Uri;
|
||||
use scale::Decode;
|
||||
use std::io::{
|
||||
self,
|
||||
Read,
|
||||
Write,
|
||||
};
|
||||
use subxt_codegen::utils::fetch_metadata_hex;
|
||||
@@ -35,6 +36,15 @@ pub async fn run(opts: Opts) -> color_eyre::Result<()> {
|
||||
match opts.format.as_str() {
|
||||
"json" => {
|
||||
let bytes = hex::decode(hex_data.trim_start_matches("0x"))?;
|
||||
|
||||
// let metadata = <RuntimeMetadataPrefixed as Decode>::decode(&mut &bytes[..])?;
|
||||
// let mut file = std::fs::File::open(
|
||||
// "/home/lexnv/workspace/subxt/artifacts/Balances.scale",
|
||||
// )
|
||||
// .unwrap();
|
||||
// let mut bytes = Vec::new();
|
||||
// file.read_to_end(&mut bytes).unwrap();
|
||||
|
||||
let metadata = <RuntimeMetadataPrefixed as Decode>::decode(&mut &bytes[..])?;
|
||||
let json = serde_json::to_string_pretty(&metadata)?;
|
||||
println!("{json}");
|
||||
|
||||
@@ -24,7 +24,8 @@ use subxt::{
|
||||
OnlineClient,
|
||||
};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")]
|
||||
// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")]
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/Balances.scale")]
|
||||
pub mod polkadot {}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -40,7 +41,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Create a transaction to submit:
|
||||
let tx = polkadot::tx()
|
||||
.balances()
|
||||
.transfer(dest, 123_456_789_012_345);
|
||||
.transfer(dest, 123_456_789_012_345)
|
||||
.unvalidated();
|
||||
|
||||
// Configure the transaction tip and era:
|
||||
let tx_params = Params::new()
|
||||
|
||||
@@ -165,6 +165,16 @@ pub fn keep_pallet<T: AsRef<str>>(
|
||||
|
||||
// Collect type ids from the pallet.
|
||||
let mut type_ids = collect_pallet_types(pallet);
|
||||
for ty in metadata.types.types() {
|
||||
let Some(ident) = ty.ty().path().ident() else {
|
||||
continue
|
||||
};
|
||||
// Collect custom type IDs.
|
||||
if ident == "DispatchError" {
|
||||
type_ids.insert(ty.id());
|
||||
}
|
||||
}
|
||||
// sp_runtime:: DispatchError
|
||||
|
||||
// Collect extrisic type IDs.
|
||||
type_ids.insert(metadata.extrinsic.ty.id());
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -13,4 +13,8 @@
|
||||
#[allow(clippy::all)]
|
||||
mod polkadot;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[allow(clippy::all)]
|
||||
mod balances;
|
||||
|
||||
mod codegen_documentation;
|
||||
|
||||
Reference in New Issue
Block a user