0
  1. I want to use "AccountId" type to a member of my own struct.
  2. So I need to initialize Account Id variable.
  3. But how to initialize on this case does not found in the internet.

Example struct is as following...

pub struct ExampleStruct {
    id: u128,
    name: String,
    accountid: AcccountId,
}
s.Takahashi
  • 469
  • 4
  • 15

1 Answers1

0

This example is I initialize "AccountId" type variable by well-known address.

    let account32: AccountId32 = hex!["d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"].into();
    let mut init_account32 = AccountId32::as_ref(&account32);
    let init_account : AccountId = AccountId::decode(&mut init_account32).unwrap_or_default();
s.Takahashi
  • 469
  • 4
  • 15