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:
Tadeo Hepperle
2024-03-14 11:04:27 +01:00
committed by GitHub
parent 8bdd276d2f
commit 4831f816f2
18 changed files with 353 additions and 196 deletions
+17 -4
View File
@@ -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();
//
}