Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tech Debt]: split TokenIF interface into internal and external interfaces #3422

Open
emilydrakesmith opened this issue Feb 22, 2024 · 0 comments · May be fixed by #3424
Open

[Tech Debt]: split TokenIF interface into internal and external interfaces #3422

emilydrakesmith opened this issue Feb 22, 2024 · 0 comments · May be fixed by #3424
Assignees
Labels
med-prio technical debt This issue involves deferred engineering work

Comments

@emilydrakesmith
Copy link
Contributor

What is needed?

Throughout the app we use an interface called TokenIF to describe the shape of token metadata objects. It currently looks like this:

export interface TokenIF {
    name: string;
    address: string;
    symbol: string;
    decimals: number;
    chainId: number;
    logoURI: string;
    fromList?: string;
    listedBy?: string[];
    walletBalance?: string;
    dexBalance?: string;
}

The required properties are part of the industry standard to shape a token data object. The optional properties are additional metadata for internal use and added by in-app middleware. This architecture is used so that one interface can describe data objects in both the raw form received from outside endpoints (as well as the Ambient token list) and decorated data objects consumed in the app.

This is problematic because some decoration values (chiefly fromList) are ubiquitous in the app and should not be treated as optional. We should adopt a new standard that uses two interfaces. The first interface will conform to the industry standard with no decorations. This will be used to describe the shape of raw external data fetched by the app before being decorated. The second interface will extend the first and describe the shape of decorated data. This achieves single source of truth for both interfaces and will improve developer experience by making it easier to use decorations that are omnipresent in the app.

This architectural change should later be applied to other types of data that the app receives from a server, either our own or third party, and the work to resolve this tech debt will be a model for future refactors.

@emilydrakesmith emilydrakesmith added technical debt This issue involves deferred engineering work med-prio labels Feb 22, 2024
@emilydrakesmith emilydrakesmith self-assigned this Feb 22, 2024
@emilydrakesmith emilydrakesmith linked a pull request Feb 22, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
med-prio technical debt This issue involves deferred engineering work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant