Closed 0zAND1z closed 4 years ago
@fckt I'm facing same issue. How to solve this problem?
The problem is that the String
type is not supported by the pwasm-abi
. Try to use &[u8]
Thanks for reverting.
As per my knowledge the type u8
and its byte slice &[u8]
will convert from String to integer type. (Sorry if I'm wrong)
How Can I use &[u8]
without using String type but String is not supported by pwasm-abi?
have you tried to convert String to &[u8]
?
I tried by changing String type to &[u8]
as mentioned above. But getting an error
error: custom attribute panicked
--> src/lib.rs:21:5
|
21 | #[eth_abi(HelloEndpoint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: message: Unable to handle param of type Rptr(None, MutTy { ty: Slice(Path(None, Path { global: false, segments: [PathSegment { ident: Ident("u8"), parameters: AngleBracketed(AngleBracketedParameterData { lifetimes: [], types: [], bindings: [] }) }] })), mutability: Immutable }): not supported by abi
error: aborting due to previous error
error: Could not compile `pwasm-tutorial-contract`.
To learn more, run the command again with --verbose.
so, haven't you tried Vec<u8>
?
@fckt Writing a #![no_std]
crate disables the standard library, including vec!
and Vec
But pwasm-std
itself compiled with no_std. Removing #![no_std]
gives following error
error: duplicate lang item in crate `pwasm_std`: `panic_impl`.
|
= note: first defined in crate `std`.
error: duplicate lang item in crate `pwasm_std`: `oom`.
|
= note: first defined in crate `std`.
error: aborting due to 2 previous errors
how can use both pwasm-std
and Vec
use pwasm_abi::types::*;
imports Vec
as well. Take a look here for more examples
I have used use pwasm_abi ::types :: *;
already.
@fckt Is Vec<u8>
is compatible with web3provider?
Im getting an error ‘Transaction Error. Exception thrown in contract code.’
while testing
If I use Vec<u8>
to convert my string is it gives me array of characters ? or How it look like?
Here's my code
fn sayHello(&mut self) -> Vec<u8> {
use pwasm_std :: String;
let s = String::from("this is a string");
let v = Vec::from(s);
v
}
Stale thread.
Here's the code:
The log while running
./build.sh
: