Guest User

Untitled

a guest
Aug 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public async fetchUser(userAccount: string) {
  2. const result = await this._contractInstance.getUser(userAccount, {
  3. from: userAccount,
  4. });
  5. const newUser: User = {
  6. userAddress: userAccount,
  7. userName: result[getUserResultIndex.userName],
  8. };
  9. return newUser;
  10. }
  11.  
  12. public async fetchUsers() {
  13. const userAddressList: string = await this._contractInstance.getUserAddressList();
  14. const users: User[] = [];
  15. for (let i = 0; i < userAddressList.length; i++) {
  16. const newUser = await this.fetchUser(userAddressList[i]);
  17. users.push(newUser);
  18. }
  19. return users;
  20. }
Add Comment
Please, Sign In to add comment