Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants