Skip to content

Module: framework

Framework APIs

npm install @self.id/framework

Re-exported classes

Re-exported components

Type aliases

ColorType

Ƭ ColorType: string | { dark?: string ; light?: string } | undefined


Colors

Ƭ Colors: Record<string, ColorType>


ConnectNetwork

Ƭ ConnectNetwork: "dev-unstable" | "mainnet" | "testnet-clay"


ConnectOptions

Ƭ ConnectOptions: Object

Type declaration

Name Type
switchAccount? boolean

ConnectedContainerProps

Ƭ ConnectedContainerProps: Object

Type declaration

Name Type
children ReactNode
renderFallback? (connectionState: ConnectionState<ModelTypes>) => null | Element

ConnectionState

Ƭ ConnectionState<ModelTypes>: { status: "disconnected" } | { status: "connecting" } | { selfID: SelfID<ModelTypes> ; status: "connected" } | { error?: Error ; status: "failed" }

Type parameters

Name Type
ModelTypes extends ModelTypeAliases = CoreModelTypes

Dimensions

Ƭ Dimensions: Object

Type declaration

Name Type
height number
width number

ProviderProps

Ƭ ProviderProps<ModelTypes>: ReactProviderProps<ModelTypes> & { auth?: MultiAuthProviderConfig ; ui?: UIProviderProps }

Type parameters

Name Type
ModelTypes extends ModelTypeAliases = CoreModelTypes

PublicRecord

Ƭ PublicRecord<ContentType>: Object

Type parameters

Name
ContentType

Type declaration

Name Type
content? ContentType
error? unknown
isError boolean
isLoading boolean

RequestClientParams

Ƭ RequestClientParams<ModelTypes>: CoreParams<ModelTypes> & { cookie?: string }

Type parameters

Name Type
ModelTypes extends ModelTypeAliases = CoreModelTypes

RequestState

Ƭ RequestState: Object

Type declaration

Name Type
hydrate? DehydratedState
viewerID? string | null

ViewerRecord

Ƭ ViewerRecord<ContentType>: { content?: never ; error?: never ; isError: false ; isLoadable: false ; isLoading: false ; isMutable: false ; isMutating: false ; merge?: never ; set?: never } | { content?: ContentType ; error?: unknown ; isError: boolean ; isLoadable: true ; isLoading: boolean ; isMutable: boolean ; isMutating: boolean ; merge: (content: ContentType) => Promise<void> ; set: (content: ContentType) => Promise<void> }

Type parameters

Name
ContentType

Variables

colors

colors: Colors


theme

theme: ThemeType

Functions

AvatarPlaceholder

AvatarPlaceholder(props): JSX.Element

Parameters

Name Type
props AvatarPlaceholderProps

Returns

JSX.Element


ConnectedContainer

ConnectedContainer(props): JSX.Element | null

Parameters

Name Type
props ConnectedContainerProps

Returns

JSX.Element | null


Provider

Provider<ModelTypes>(props): JSX.Element

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Parameters

Name Type
props ProviderProps<ModelTypes>

Returns

JSX.Element


formatDID

formatDID(did, maxLength?): string

Parameters

Name Type Default value
did string undefined
maxLength number 20

Returns

string


getImageURL

getImageURL(ipfsPrefix, sources, dimensions): string | undefined

Parameters

Name Type
ipfsPrefix string
sources undefined | ImageSources
dimensions Dimensions

Returns

string | undefined


isCAIP10string

isCAIP10string(account): boolean

Parameters

Name Type
account string

Returns

boolean


selectImageSource

selectImageSource(sources, dimensions, mode?): ImageMetadata

Parameters

Name Type
sources ImageSources
dimensions Dimensions
mode? SizeMode

Returns

ImageMetadata


uploadImage

uploadImage(url, file, sizes?): Promise<ImageSources>

Parameters

Name Type
url string
file File
sizes? Dimensions[]

Returns

Promise<ImageSources>


useConnection

useConnection<ModelTypes>(): [ConnectionState<ModelTypes>, (options?: ConnectOptions) => Promise<SelfID<ModelTypes> | null>, () => void]

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Returns

[ConnectionState<ModelTypes>, (options?: ConnectOptions) => Promise<SelfID<ModelTypes> | null>, () => void]


useCore

useCore<ModelTypes>(): Core<ModelTypes>

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Returns

Core<ModelTypes>


usePublicRecord

usePublicRecord<ModelTypes, Alias, ContentType>(alias, id): PublicRecord<ContentType | null>

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes
Alias extends string | number | symbol = keyof ModelTypes["definitions"]
ContentType DefinitionContentType<ModelTypes, Alias>

Parameters

Name Type
alias Alias
id string

Returns

PublicRecord<ContentType | null>


useViewerID

useViewerID<ModelTypes>(): ViewerID<ModelTypes> | null

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes

Returns

ViewerID<ModelTypes> | null


useViewerRecord

useViewerRecord<ModelTypes, Alias, ContentType>(alias): ViewerRecord<ContentType | null>

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>> = ModelTypes
Alias extends string | number | symbol = keyof ModelTypes["definitions"]
ContentType DefinitionContentType<ModelTypes, Alias>

Parameters

Name Type
alias Alias

Returns

ViewerRecord<ContentType | null>