Skip to content
This repository has been archived by the owner on Feb 11, 2025. It is now read-only.

Question: session.call with parameter is a struct. #127

Open
chungquantin opened this issue Nov 21, 2024 · 1 comment
Open

Question: session.call with parameter is a struct. #127

chungquantin opened this issue Nov 21, 2024 · 1 comment

Comments

@chungquantin
Copy link

How can I pass a struct to a session.call method? For example, I want to pass this below struct:

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Deserialize, Serialize))]
#[ink::scale_derive(Encode, Decode, TypeInfo)]
pub struct CollectionConfig {
	/// Collection's settings.
	pub settings: CollectionSettings,
	/// Collection's max supply.
	pub max_supply: Option<u32>,
	/// Default settings each item will get during the mint.
	pub mint_settings: MintSettings,
}

Is using serde_json to convert this struct to JSON string is the right way to do?

@chungquantin chungquantin changed the title bug: session.call with parameter is a struct. Question: session.call with parameter is a struct. Nov 21, 2024
@pmikolajczyk41
Copy link
Member

as far as I remember, you should use SCALE encoding instead of JSON serializing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants