Skip to content

Commit

Permalink
export type that will be used by the client for user lookup (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
tak-hntlabs authored Jun 7, 2024
1 parent d45051a commit 6d3e39b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions packages/sdk/src/streamStateView_UserMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ import { bin_toHexString } from '@river-build/dlog'
import { userMetadata_EnsAddresses } from './userMetadata_EnsAddresses'
import { userMetadata_Nft } from './userMetadata_Nft'

export type UserInfo = {
username: string
usernameConfirmed: boolean
usernameEncrypted: boolean
displayName: string
displayNameEncrypted: boolean
ensAddress?: string
nft?: {
chainId: number
tokenId: string
contractAddress: string
}
}

export class StreamStateView_UserMetadata {
readonly usernames: UserMetadata_Usernames
readonly displayNames: UserMetadata_DisplayNames
Expand Down Expand Up @@ -163,19 +177,7 @@ export class StreamStateView_UserMetadata {
this.usernames.onDecryptedContent(eventId, content, emitter)
}

userInfo(userId: string): {
username: string
usernameConfirmed: boolean
usernameEncrypted: boolean
displayName: string
displayNameEncrypted: boolean
ensAddress?: string
nft?: {
chainId: number
tokenId: string
contractAddress: string
}
} {
userInfo(userId: string): UserInfo {
const usernameInfo = this.usernames.info(userId)
const displayNameInfo = this.displayNames.info(userId)
const ensAddress = this.ensAddresses.info(userId)
Expand Down

0 comments on commit 6d3e39b

Please sign in to comment.