mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 00:37:57 +00:00
no_std compatibility for subxt-signer (#1477)
* subxt-signer no-std * impl error * address james comments * fix signer wasm tests * error impl for secret uri error
This commit is contained in:
@@ -34,14 +34,27 @@ extern crate alloc;
|
||||
/// Including code here makes sure it is not pruned.
|
||||
/// We want all code included to compile fine for the `thumbv7em-none-eabi` target.
|
||||
fn compile_test() {
|
||||
subxt_metadata_compiles();
|
||||
}
|
||||
|
||||
fn subxt_metadata_compiles() {
|
||||
// Subxt Metadata compiles:
|
||||
use codec::Decode;
|
||||
let bytes: alloc::vec::Vec<u8> = alloc::vec![0, 1, 2, 3, 4];
|
||||
subxt_metadata::Metadata::decode(&mut &bytes[..]).expect_err("invalid byte sequence");
|
||||
|
||||
const METADATA: &[u8] = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
|
||||
subxt_metadata::Metadata::decode(&mut &METADATA[..]).expect("should be valid metadata");
|
||||
|
||||
// Subxt Signer compiles:
|
||||
use subxt_signer::sr25519;
|
||||
let keypair = sr25519::dev::alice();
|
||||
let message = b"Hello!";
|
||||
let _signature = keypair.sign(message);
|
||||
let _public_key = keypair.public_key();
|
||||
|
||||
// Note: `ecdsa` is not compiling for the `thumbv7em-none-eabi` target.
|
||||
//
|
||||
// use subxt_signer::ecdsa;
|
||||
// let keypair = ecdsa::dev::alice();
|
||||
// let message = b"Hello!";
|
||||
// let _signature = keypair.sign(message);
|
||||
// let _public_key = keypair.public_key();
|
||||
//
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user