mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 04:31:08 +00:00
Introduce ext_println to contract runtime (#2239)
* Implement `ext_println` in contract runtime * Only allow contracts to import `ext_println` on dev chains * Configure dev chain to allow contracts with `ext_println` * Increment spec version * Docs * Rename config to the more specific enable_println
This commit is contained in:
committed by
Sergei Pepyakin
parent
18df051947
commit
1e0c1d8850
@@ -628,4 +628,15 @@ define_env!(Env, <E: Ext>,
|
||||
|
||||
Ok(())
|
||||
},
|
||||
|
||||
// Prints utf8 encoded string from the data buffer.
|
||||
// Only available on `--dev` chains.
|
||||
// This function may be removed at any time, superseded by a more general contract debugging feature.
|
||||
ext_println(ctx, str_ptr: u32, str_len: u32) => {
|
||||
let data = read_sandbox_memory(ctx, str_ptr, str_len)?;
|
||||
if let Ok(utf8) = core::str::from_utf8(&data) {
|
||||
runtime_io::print(utf8);
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user