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

WIP: feat(typings): brand Secret, PublicKey, AccounId #214

Closed
wants to merge 3 commits into from

Conversation

Akuukis
Copy link
Contributor

@Akuukis Akuukis commented Jul 25, 2019

Work in progress: DO NOT MERGE

See also PR at stellar-sdk: stellar/js-stellar-sdk#384

Closes #185

Copy link
Contributor

@abuiles abuiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, did steps 1 & 2 here #214 and stellar/js-stellar-sdk#384 for Secret, AccountId and PublicKey.
For step 3 please see what makes common sense for you and what's not, so I can have a checklist to describe.

Looking good! For this stage let's move ahead as you suggest with making this an alias only. What I've been thinking is that we can introduce the breaking change with the move to TS for this library too.

What are you thought if we proceed as follows:

  1. Add typings using aliases
  2. Start TS migration (which would require a major bump)
  3. Include brands as part of the TS migration

*
* See also `AccountId`, `PublicKey`.
*/
export type NonExistingAccountId = Brand<string, 'NonExistingAccountId'>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Akuukis do we need to make this assertion here? I think we can only AccountId regardless if they exist in the network or not.

}

interface AccountMerge extends BaseOperation<OperationType.AccountMerge> {
destination: string;
destination: NonExistingAccountId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be AccountId - when you merge the other account exists.


/**
* 56-character long string, starts with G, passes `StrKey.isValidEd25519PublicKey()`
* and account does not exist on the given Network..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Extra . --- Network..

@abuiles
Copy link
Contributor

abuiles commented May 1, 2020

Closing this for now since we should not mess with types which are going to be auto-generated.

If we want to introduce this, we should do it on top of the work done in #342

@abuiles abuiles closed this May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brand string types
2 participants