1

my example looks like this :

#[ink(extension = 1111]
fn asset_name(asset_id: u32) -> Result<[u8], PalletAssetErr>

or this

fn asset_name(asset_id: u32) -> Result<[u8], PalletAssetErr> {
        ::ink_env::chain_extension::ChainExtensionMethod::build(1111u32)
            .input::<u32>()
            .output::<[u8]>()
            .handle_error_code::<PalletAssetErr>()
            .call(&asset_id)

and I got this error

Result<[u8], PalletAssetErr> doesn't have a size known at compile-time

because [u8] has unknown size at compile time...

How to get dynamic size data on smart contract side?

0

1 Answer 1

1

As the error suggests, the size has to be known at compilation time. So, either sized arrays, or ink_prelude::vec::Vec is what you need.

Not the answer you're looking for? Browse other questions tagged or ask your own question.