use-ink / contracts-ui

Web application for deploying wasm smart contracts on Substrate chains that include the FRAME contracts pallet
https://contracts-ui.substrate.io/
GNU General Public License v3.0
61 stars 45 forks source link

Broken UI for messages with vector arguments #431

Closed xermicus closed 1 year ago

xermicus commented 1 year ago

Describe the bug Messages with vector arguments seem to be broken in some cases.

  1. When the elements are structs, I can't enter any data in the UI.
  2. When the elements are u8 (bytes), I can input any text, and it will use the ASCII byte representation of my input. This is not what I want.

To Reproduce

For the first problem, given I have the following ink message:

#[derive(scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(::scale_info::TypeInfo))]
pub struct S {
    a: AccountId,
    b: ink::prelude::vec::Vec<u8>,
}
#[ink(message)]
pub fn get(&self, s: ink::prelude::vec::Vec<S>)  {}

Or the equivalent in solidity:

struct Call { address target; bytes callData; }
function tryAggregate(bool requireSuccess, Call[] calldata calls) public {}

Reproducer for the second problem:

#[ink(message)]
pub fn get(&self, vec: ink::prelude::vec::Vec<u8>) {}

Expected behavior

  1. The struct fields type info is in the metadata, so ideally the UI would allow to conveniently craft the struct in the browser.
  2. I'd expect the UI to ask for decimal digits instead of ASCII data

Screenshots

First problem with the struct:

image

Second problem with a bytes vector:

image

Desktop (please complete the following information):