From 4e7d6568508c9c11f42cda1f8a2480483e8e1536 Mon Sep 17 00:00:00 2001 From: Nick Taras Date: Wed, 11 Oct 2023 14:04:45 +1100 Subject: [PATCH 1/2] updated interface for tkn --- src/client/tokenStore.ts | 1 + src/client/ui.ts | 3 +-- src/client/views/view-interface.ts | 6 +++--- src/index.ts | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/client/tokenStore.ts b/src/client/tokenStore.ts index 9804827f..0adbcef5 100644 --- a/src/client/tokenStore.ts +++ b/src/client/tokenStore.ts @@ -15,6 +15,7 @@ interface TokenLookup { export interface TokenData { tokenId: string | number walletAddress?: string + image?: string // TODO: add more common fields to this interface [key: string]: any } diff --git a/src/client/ui.ts b/src/client/ui.ts index cce414e5..c4215a04 100644 --- a/src/client/ui.ts +++ b/src/client/ui.ts @@ -2,8 +2,7 @@ import { Start } from './views/start' import { logger, requiredParams } from '../utils' import { Client, ClientError } from './index' -import { ViewInterface, ViewComponent, ViewFactory, ViewConstructor } from './views/view-interface' -import { TokenStore } from './tokenStore' +import { ViewInterface, ViewComponent, ViewFactory, ViewConstructor, AbstractView } from './views/view-interface' import { SelectIssuers } from './views/select-issuers' import { SelectWallet } from './views/select-wallet' import { LOCAL_STORAGE_TOKEN_STORE_KEY } from '../constants' diff --git a/src/client/views/view-interface.ts b/src/client/views/view-interface.ts index 64456a30..13e77bea 100644 --- a/src/client/views/view-interface.ts +++ b/src/client/views/view-interface.ts @@ -2,7 +2,7 @@ import { Client } from '../index' import { Ui, UIOptionsInterface } from '../ui' export interface ViewConstructor { - new (client: Client, popup: Ui, viewContainer: any, params: any): T + new(client: Client, popup: Ui, viewContainer: any, params: any): T } export type ViewFactory = (client: Client, popup: Ui, viewContainer: any, params: any) => ViewInterface @@ -16,7 +16,7 @@ export interface ViewInterface { params: IViewParameters render(): void init(): void - update(params: IViewParameters): void + update?(params: IViewParameters): void } export interface IViewParameters { @@ -40,7 +40,7 @@ export abstract class AbstractView implements ViewInterface { } // eslint-disable-next-line @typescript-eslint/no-empty-function - public init(): void {} + public init(): void { } abstract render(): void diff --git a/src/index.ts b/src/index.ts index 0f379180..575e839c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ export { Client } from './client/index' export { AbstractView, type ViewInterface } from './client/views/view-interface' +export { Ui, UIOptionsInterface } from './client/ui' export { Outlet } from './outlet/index' export { Start } from './client/views/start' export { SelectWallet } from './client/views/select-wallet' From 4dbba5ec86de6490fa91eac13671be289381bffe Mon Sep 17 00:00:00 2001 From: Nick Taras Date: Wed, 11 Oct 2023 14:07:01 +1100 Subject: [PATCH 2/2] updated change log to include ts interface bug fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d329b342..de6004c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ Feature release including multi-hook support and improved UX for off chain token ### Bug Fixes -[none] +- TS interface custom views ### Performance Improvements