Search code examples
nearprotocol

Can we return an array of `AccountID` in NEAR?


Suppose I have a struct

pub struct Test {
    pub participant: Set<AccountId>
}

And I created a new account and inserted to participant using the insert function, I can get len of participant using len() method. How can I get the address?

pub fn get_address(&self) -> Vec<AccountId> {
    self.participient.contains() // can't get data
}

Solution

  • You can do

    self.participant.to_vec()