Skip to content

Split TokenIF into external and internal interfaces#3424

Draft
emilydrakesmith wants to merge 3 commits into
developfrom
split-TokenIF
Draft

Split TokenIF into external and internal interfaces#3424
emilydrakesmith wants to merge 3 commits into
developfrom
split-TokenIF

Conversation

@emilydrakesmith

Copy link
Copy Markdown
Contributor

Describe your changes

  • Split TokenIF into ServerTokenIF (conforms to industry standard) and TokenIF (internal standard decorate by post-processing middleware).

Link the related issue

Closes #3422

Checklist before requesting a review

  • Is this PR ready for merge? (Please convert to a draft PR otherwise)
  • I have performed a self-review of my code.
  • Did I request feedback from a team member prior to the merge?
  • Does my code following the style guide at docs/CODING-STYLE.md?

Instructions for Reviewers

Functionalities or workflows that should specifically be tested.
Syntactic sugar for dev experience and support only. This PR should not result in any behavioral changes in the app.

Environmental conditions that may result in expected but differential behavior.
none

If relevant, list additional work to complete pre-merge (delete logging, code abstraction, etc)

@emilydrakesmith emilydrakesmith added technical debt This issue involves deferred engineering work low-prio labels Feb 22, 2024
@emilydrakesmith emilydrakesmith self-assigned this Feb 22, 2024
@netlify

netlify Bot commented Feb 22, 2024

Copy link
Copy Markdown

Deploy Preview for ambient-finance ready!

Name Link
🔨 Latest commit be9ac6a
🔍 Latest deploy log https://app.netlify.com/sites/ambient-finance/deploys/65d8239a6df40d000875b95f
😎 Deploy Preview https://deploy-preview-3424--ambient-finance.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@emilydrakesmith

Copy link
Copy Markdown
Contributor Author

Actually splitting the original TokenIF interface is easy and already complete. New structure looks like this in the TokenIF.ts file of this PR:

// this interface conforms to the industry standard token data obj shape
export interface ServerTokenIF {
    name: string;
    address: string;
    symbol: string;
    decimals: number;
    chainId: number;
    logoURI: string;
}

// this interface extends the industry standard with our own internal decorations
export interface TokenIF extends ServerTokenIF {
    fromList?: string;
    listedBy?: string[];
    walletBalance?: string;
    dexBalance?: string;
}

Completion of this project requires a few more steps.

  1. Right now the app still builds because everything is still referencing TokenIF which follows the same shape it as before. We need to find all instances of TokenIF and update any to use ServerTokenIF if they're describing a token data object retrieved from an outside data source with no internal decoration.
  2. The property fromList should be updated from string to a union of all recognized values. These should be derived from the data in tokenListURIs.ts joined with custom internal values. This will help immensely with making the app use consistent identifiers for the source of every data object encountered.
  3. The property fromList on TokenIF should be made non-optional (ie remove the question mark). This will very quickly highlight all the parts of the app we need to refactor for compliance.
  4. Other properties on the new TokenIF interface should remain optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

low-prio technical debt This issue involves deferred engineering work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants