How to represent tuple struct in a .did file?

Hello Dears!

How to represent tuple struct in a .did file like this:

#[derive(CandidType, Serialize, Deserialize)]
pub struct MyTupleStruct(pub Principal);

or is there any working way to generate a did file from rust code?
I’m asking again because the solutions described in the forum does not work for me

Tuple is a shorthand for record, so record { type1; type2; type3 }.

But the example you give is a newtype, the candid type is just principal.

I did like that, dfx accepted it, just I’m not sure it will work or not. I didn’t try yet

type MyTupleStruct = record {
    0: principal;
};

It’s a newtype, so you need type MyTupleStruct = principal;

pub struct MyTupleStruct(pub Principal, pub Principal); will map to record { principal; principal } instead

1 Like

Yep, I will try that, if my version will not work