Hi so I am converting my smart contract into a web assembly to integrate into stellar, I ran this command cargo build --target wasm32-unknown-unknown --release. I then receive the error of a "panic_impl", this means i have a duplicate item in my crate. However the dependencies I use is the soroban_sdk and crate-type = ["cdylib"]. Any idea how I can fix this issue?
#panic_impl
21 messages · Page 1 of 1 (latest)
i followed documentation based on, https://soroban.stellar.org/docs/getting-started/hello-world#configure-the-release-profile
that's suspicious; are you just building the example?
I am building my own smart contract but I used a similar variation of the cargo.toml on the docs
can you make sure the example works for you first?
just to be sure there is no issue in your environment
good. then chances are there is something wrong with your build configuration - hard to tell without having an example
should i show an example of my cargo.toml?
yeah, the whole example would be nice (both contract and cargo)
you're missing contractimpl from your contract
(not sure if that should cause your particular error, but you don't have any real contract to build)
also, you have a lot of extra deps, such as stellar sdk, random, etc.
I would recommend stripping all the deps and only adding them when needed
you're also missing contracttype annotations on your types (and that would break your build as well because you can't use arbitrary types as contracttype)
BTW, @indigo spire, this:
pub struct NftInfo {
contract_address: Bytes,
token_id: Bytes,
}
... shouldn't the "right" way be to use Address and not Bytes?
Also, I don't think the chrono crate would work (no_std) and default crate features = alloc + std.
Thank you @indigo spire @karmic crest for the input I will take it into account
@random wadi You need to include #![no_std] at the top of your lib.rs. If you don't, the Rust libstd library will be automatically imported into your project, which will cause a duplicate panic_impl to be loaded. The Soroban SDK ships with its own panic_impl which is more efficient in a WASM runtime like the Soroban environment.