0

I'm new to substrate and follow this tutorial: https://docs.substrate.io/tutorials/v3/kitties/pt1/. I'm facing problem in this line : we'll need to import serde. Add this to your pallet's Cargo.toml file, using the matching version as Substrate upstream. how to import serde and match it to the substrate upstream ?

2
  • 4
    I’m voting to close this question because it’s more of a case specific support question. Apr 3, 2022 at 14:07
  • I edited the title and tags to be more descriptive and general
    – Nuke
    Apr 6, 2022 at 19:25

2 Answers 2

5

Add the following (the lines with the <--- add this comment to the [dependencies] and [features] section of the cargo.toml file:

[dependencies]
serde = { version = "1.0.119" }  //<----- add this


[features]
default = ['std']
std = [
    'serde/std',  //<----- add this
]
1
  • Yes, thanks for pointing it this out. Apr 3, 2022 at 14:06
0

cargo tree | grep serde can be used to get the package specific versions needed for serde. Here you can see what substrate libs need, and match what substrate uses.

Also manually matching what existing in the Cargo.toml of your upstream crates can work too.

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