mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 18:41:05 +00:00
move fetch metadata to a separate crate subxt_utils_fetchmetadata (#1829)
* macros: feature-gate jsonrpsee/fetch metadata url * make CI happy * Update codegen/src/error.rs * extract `fetch-metdata` to separate crate * add missing license headers * introduce subxt-utils crate * add missing files * codegen: remove unused hex crate * fix test build * move subxt_utils -> subxt_utils_fetchmetadata * cargo fmt * runtime-path -> runtime-metadata-path * Update utils/fetch-metadata/src/lib.rs
This commit is contained in:
@@ -12,15 +12,15 @@ use polkadot_sdk::{
|
||||
sp_maybe_compressed_blob::{self, CODE_BLOB_BOMB_LIMIT},
|
||||
sp_state_machine,
|
||||
};
|
||||
use subxt_codegen::{fetch_metadata::fetch_metadata_from_file_blocking, CodegenError, Metadata};
|
||||
use subxt_codegen::{CodegenError, Metadata};
|
||||
|
||||
/// Result type shorthand
|
||||
pub type WasmMetadataResult<A> = Result<A, CodegenError>;
|
||||
|
||||
/// Uses wasm artifact produced by compiling the runtime to generate metadata
|
||||
pub fn from_wasm_file(wasm_file_path: &Path) -> WasmMetadataResult<Metadata> {
|
||||
let wasm_file = fetch_metadata_from_file_blocking(wasm_file_path)
|
||||
.map_err(Into::<CodegenError>::into)
|
||||
let wasm_file = subxt_utils_fetchmetadata::from_file_blocking(wasm_file_path)
|
||||
.map_err(|e| CodegenError::Other(e.to_string()))
|
||||
.and_then(maybe_decompress)?;
|
||||
call_and_decode(wasm_file)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user