1

I am attempting to use a custom struct in a map which needs to be stored.

#[derive(Encode, Decode, Default, Clone, PartialEq, TypeInfo)]
#[cfg_attr(feature = "std", derive(Debug))]
pub(super) struct Amendment<AccountId> {
        pub statement: Vec<u8>,
        pub owners: Vec<AccountId>,
}

#[pallet::storage]
#[pallet::getter(fn declaration_map)]
pub(super) type Declarations<T: Config> = StorageMap
<
_,
Blake2_128Concat,
<T as Config>::AccountId,
Amendment<<T as pallet::Config>::AccountId>,
ValueQuery
>;

It is giving me this error:

enter image description here

Is there a way to make it public?

1 Answer 1

4

#[pallet::storage] creates a pub fn amendment() -> Amendment<_> { .. } which leaks Amendment<_> which is according to your definition a narrower public scope.

https://github.com/paritytech/substrate/blob/master/frame/support/procedural/src/pallet/expand/storage.rs#L288

pub(super) Amendment must become pub Amendment to resolve this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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