Skip to content

CT-403: Add type information to xlm#390

Merged
tylerlevine merged 3 commits into
masterfrom
CT-403-xlm-types
Jun 27, 2019
Merged

CT-403: Add type information to xlm#390
tylerlevine merged 3 commits into
masterfrom
CT-403-xlm-types

Conversation

@tylerlevine

Copy link
Copy Markdown
Contributor

No description provided.

@codecov

codecov Bot commented Jun 21, 2019

Copy link
Copy Markdown

Codecov Report

Merging #390 into master will increase coverage by 22.35%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #390       +/-   ##
===========================================
+ Coverage   38.47%   60.82%   +22.35%     
===========================================
  Files          73       74        +1     
  Lines        9805     9837       +32     
  Branches     2138     2144        +6     
===========================================
+ Hits         3772     5983     +2211     
+ Misses       5392     2917     -2475     
- Partials      641      937      +296
Flag Coverage Δ
#integration 38.75% <ø> (+0.28%) ⬆️
#unit 54.7% <ø> (?)
Impacted Files Coverage Δ
src/v2/trading/trade.ts 100% <0%> (ø)
src/v2/coins/bsv.ts 35.06% <0%> (+1.29%) ⬆️
src/keychains.ts 34% <0%> (+1.33%) ⬆️
src/util.ts 64.78% <0%> (+1.4%) ⬆️
src/v2/coinFactory.ts 94.84% <0%> (+2.06%) ⬆️
src/v2/coins/token.ts 71.52% <0%> (+2.64%) ⬆️
src/v2/coins/tbch.ts 78.57% <0%> (+3.57%) ⬆️
src/v2/coins/txlm.ts 78.57% <0%> (+3.57%) ⬆️
src/index.ts 96% <0%> (+4%) ⬆️
src/v2/coins/txrp.ts 76% <0%> (+4%) ⬆️
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f07cbc...6989d13. Read the comment docs.

@tylerlevine tylerlevine changed the base branch from CT-364-typescriptify-wallets to master June 21, 2019 17:20
Comment thread modules/core/src/v2/coins/xlm.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'm not sure either

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'm not sure either

I have a feeling we don't need it, but maybe I'm missing something? @CapnMigraine any ideas? Probably a good idea to have you review this change anyway.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No reason, we don't need it. Please remove it.

dannydeezy
dannydeezy previously approved these changes Jun 21, 2019
@tylerlevine tylerlevine requested a review from CapnMigraine June 21, 2019 21:10
@tylerlevine tylerlevine force-pushed the CT-403-xlm-types branch 2 times, most recently from d00301f to c95bf71 Compare June 21, 2019 21:22

@CapnMigraine CapnMigraine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for doing this, it's looking much better!
Are we encouraging the use of trailing commas in the SDK? I ask because there are a few missing here, maybe it's a low-hanging fruit for this PR.

Comment thread modules/core/src/v2/coins/xlm.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is this type? I think it should be string

@tylerlevine tylerlevine Jun 26, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a type exported by the stellar sdk.

Here's the definition:

enum MemoType
{
    MEMO_NONE = 0,
    MEMO_TEXT = 1,
    MEMO_ID = 2,
    MEMO_HASH = 3,
    MEMO_RETURN = 4
};

Do you think it makes sense to expose this stellar SDK type as a type in bitgojs? Or should we redefine or rename it? Or just make the type string and leave it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, in the end they're all strings. I think we can simplify it for readability.
https://stellar.github.io/js-stellar-sdk/Memo.html

Comment thread modules/core/src/v2/coins/xlm.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No reason, we don't need it. Please remove it.

Comment thread modules/core/src/v2/coins/xlm.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this list doesn't have a type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There won't ever be any elements of this array, so the type is actually a correct empty array literal. Here's more info if you are curious, since I haven't seen this sort of feature in other languages: https://basarat.gitbooks.io/typescript/docs/types/literal-types.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok, thanks for clarifying

Comment thread modules/core/src/v2/coins/xlm.ts Outdated
Comment thread modules/core/src/v2/coins/xlm.ts Outdated
@tylerlevine

Copy link
Copy Markdown
Contributor Author

Are we encouraging the use of trailing commas in the SDK? I ask because there are a few missing here, maybe it's a low-hanging fruit for this PR.

Yes, I prefer trailing commas where allowed in es5, but this isn't enforced currently unless prettier is configured for the file in question. I'll add them to this PR as I come across them

@CapnMigraine CapnMigraine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.
The MemoType is a non-issue. I'll re-approve if you decide to change it.

Comment thread modules/core/src/v2/coins/xlm.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, in the end they're all strings. I think we can simplify it for readability.
https://stellar.github.io/js-stellar-sdk/Memo.html

Comment thread modules/core/src/v2/coins/xlm.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok, thanks for clarifying

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants