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

feat(connext): multi currency support #2043

Merged
merged 31 commits into from Dec 28, 2020
Merged

Conversation

erkarl
Copy link
Collaborator

@erkarl erkarl commented Dec 15, 2020

This PR adds support for withdrawing from on-chain address. In the process, ethers dependency is added to make development flow with the eth provider considerably faster. Previously, we were using the json-rpc API directly.

I'm planning to extract Connext swap client into a separate module so that the dependency will be opt-in (only for those who activate the swap client).

Copy link
Contributor

@michael1011 michael1011 left a comment

Choose a reason for hiding this comment

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

Concept ACK. Just some minor comments form my side

lib/connextclient/ethprovider.ts Outdated Show resolved Hide resolved
lib/connextclient/ethprovider.ts Outdated Show resolved Hide resolved
lib/connextclient/ConnextClient.ts Outdated Show resolved Hide resolved
lib/connextclient/ethprovider.ts Outdated Show resolved Hide resolved
@erkarl erkarl force-pushed the feat/connext-multi-currency branch 2 times, most recently from dcff09a to 720c65f Compare December 15, 2020 17:16
@erkarl erkarl changed the title feat(connext): withdraw from signer address feat(connext): multi currency support Dec 17, 2020
@erkarl
Copy link
Collaborator Author

erkarl commented Dec 17, 2020

This PR has evolved into:

  • adding support for xucli walletwithdraw for ETH/ERC20
  • monitoring channel for ERC20 deposits -> creating a new commitment transaction so that ERC20 tokens show up under channel balance"

Everything in the ethprovider.ts will be converted to a separate module. This in preparation for extracting ConnextClient into a separate module.

The PR is reviewable commit-by-commit so I'm not squashing the commits, yet.

Copy link
Contributor

@michael1011 michael1011 left a comment

Choose a reason for hiding this comment

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

utACK

Fixing those lint warnings would be nice though

jest.config.js Outdated Show resolved Hide resolved
test/jest/Connext.spec.ts Show resolved Hide resolved
@sangaman
Copy link
Collaborator

utACK

Fixing those lint warnings would be nice though

I left those warnings in when working on the eslint rules, they weren't trivial to fix but they also seemed like things that made sense to change (like redeclaring variables, which can be confusing and lead to some hard to find bugs imo), so I figured the warnings would be a good reminder to address later and to prevent new code from violating the rule. I didn't realize how annoying they'd be in the PR code diffs, but I guess that's a good motivator to actually fix these soonish.

That said, it doesn't look like this PR is introducing any new warnings, so I wouldn't let that hold this up.

Copy link
Collaborator

@sangaman sangaman left a comment

Choose a reason for hiding this comment

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

Looks good so far. I'm not familiar with ramda (but I take it it will move out of xud eventually) and only superficially familiar with currying functions so it's not exactly apparent to me what's going on in a few places. I think more comments/method block comments in the ethProvider file would be good to explain what everything is does, so it's more comprehensible in the future for others who might not be so familiar either.

jest.config.js Show resolved Hide resolved
.eslintrc.js Outdated Show resolved Hide resolved
jest.config.js Outdated Show resolved Hide resolved
@sangaman sangaman added the code quality Improving code structure, organization, and clarity label Dec 18, 2020
@erkarl erkarl mentioned this pull request Dec 21, 2020
14 tasks
@sangaman
Copy link
Collaborator

Let me know if/when I should review this again @erkarl .

@erkarl
Copy link
Collaborator Author

erkarl commented Dec 22, 2020

Let me know if/when I should review this again @erkarl .

Will do. I'm waiting for a new Connext release to test that everything is working correctly in this branch.

@erkarl
Copy link
Collaborator Author

erkarl commented Dec 22, 2020

That said, it doesn't look like this PR is introducing any new warnings, so I wouldn't let that hold this up.

Think it's not worth addressing them right now because once we've extracted ConnextClient into a separate module all code from current ConnextClient.ts should be ported over. Provided I don't introduce new warnings - these warning should disappear.

@erkarl
Copy link
Collaborator Author

erkarl commented Dec 22, 2020

I think more comments/method block comments in the ethProvider file would be good to explain what everything is does, so it's more comprehensible in the future for others who might not be so familiar either.

@sangaman I added comments to ethProvider file - hope it is clearer now. Think this is ready for review again. I won't be adding more functionality to this PR.

Copy link
Contributor

@michael1011 michael1011 left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Collaborator

@sangaman sangaman left a comment

Choose a reason for hiding this comment

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

Looks really good and comments are very helpful, thanks.

// This is the main function that has to be called before this package exposes more functions.
// Think of it as a constructor where we create the interal state of the module before
// we export more functionality to the consumer.
const getEthprovider = (host: string, port: number, name: string, chainId: number, seed: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The smallest of nits, I'm seeing mixed casing of Ethprovider and EthProvider. I don't know which one is "correct" but might make sense to stick to one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. Will address this in a follow-up PR.

@erkarl erkarl merged commit 62aad3d into master Dec 28, 2020
@erkarl erkarl deleted the feat/connext-multi-currency branch December 28, 2020 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improving code structure, organization, and clarity connext
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants