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

Replace bcoin with bitcoinjs-lib for deposits #702

Merged
merged 17 commits into from
Oct 3, 2023

Conversation

tomaszslabon
Copy link
Contributor

@tomaszslabon tomaszslabon commented Sep 26, 2023

Refs: #695.
This PR replaces the bcoin library with bitcoinjs-lib for deposits. The functions generally works in the same way as before the change.

One difference is that UTXOs for funding the transaction and the value of fee are passed into the function as arguments.
In the future, we could consider using coinselect for calculating fee and selecting UTXOs.

Another difference is that only one type of funding UTXO is allowed (P2WPKH). Other types should be added along with unit tests.

@tomaszslabon tomaszslabon self-assigned this Sep 26, 2023
@tomaszslabon tomaszslabon added the 🔌 typescript TypeScript library label Sep 26, 2023
@tomaszslabon tomaszslabon changed the base branch from main to deposit-sweep-use-bitcoinjs-lib September 26, 2023 15:53
Base automatically changed from deposit-sweep-use-bitcoinjs-lib to main September 28, 2023 07:27
@tomaszslabon tomaszslabon marked this pull request as ready for review September 29, 2023 17:18
Copy link
Member

@lukasz-zimnoch lukasz-zimnoch left a comment

Choose a reason for hiding this comment

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

Awesome work! Some comments and questions:

typescript/src/deposit.ts Outdated Show resolved Hide resolved
typescript/src/deposit.ts Outdated Show resolved Hide resolved
typescript/src/deposit.ts Outdated Show resolved Hide resolved
typescript/src/deposit.ts Outdated Show resolved Hide resolved
typescript/src/deposit.ts Outdated Show resolved Hide resolved
Comment on lines +239 to +240
// TODO: Add support for other utxo types along with unit tests for the
// given type.
Copy link
Member

Choose a reason for hiding this comment

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

Do we plan to do this work as part of #695 or separately? If this is something quick I'd vote for the first option. Otherwise, we can postpone it now and return here after the release of the reworked API. On a high level, our work plan is remove bcoin -> bump node -> release v1.4.0 -> API changes -> release v2.0.0 -> improvements so we can return here during improvements phase. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's postpone it, as supporting more types require adding unit tests.

typescript/src/deposit.ts Show resolved Hide resolved
typescript/src/deposit.ts Show resolved Hide resolved
typescript/src/deposit.ts Outdated Show resolved Hide resolved
typescript/src/deposit.ts Show resolved Hide resolved
@lukasz-zimnoch lukasz-zimnoch merged commit 2916e36 into main Oct 3, 2023
38 checks passed
@lukasz-zimnoch lukasz-zimnoch deleted the deposit-use-bitcoinjs-lib branch October 3, 2023 14:17
michalsmiarowski added a commit to threshold-network/token-dashboard that referenced this pull request Oct 4, 2023
There was a change in keep-network/tbtc-v2#702 in which
we've added additional arguments to `assembleDepositTransaction` function. The
order of the arguments was also changed. Because of that we couldn't build the
project because we use that function in our dApp mock of the bitcoin client.

We are fixing this by passing two additional arguments to the
`assembleDepositTransaction` function - `network` and `fee`. We are also making
sure that we pass the arguments in the correct order.
lukasz-zimnoch added a commit that referenced this pull request Oct 10, 2023
lukasz-zimnoch added a commit that referenced this pull request Oct 10, 2023
theref pushed a commit to theref/token-dashboard that referenced this pull request Oct 11, 2023
There was a change in keep-network/tbtc-v2#702 in which
we've added additional arguments to `assembleDepositTransaction` function. The
order of the arguments was also changed. Because of that we couldn't build the
project because we use that function in our dApp mock of the bitcoin client.

We are fixing this by passing two additional arguments to the
`assembleDepositTransaction` function - `network` and `fee`. We are also making
sure that we pass the arguments in the correct order.
@lukasz-zimnoch lukasz-zimnoch added this to the typescript/v1.4.0 milestone Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔌 typescript TypeScript library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants