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

Implement Glueby::Wallet#tokens #196

Merged
merged 10 commits into from
Dec 5, 2023
Merged

Implement Glueby::Wallet#tokens #196

merged 10 commits into from
Dec 5, 2023

Conversation

Yamaguchi
Copy link
Contributor

This PR implements Glueby::Wallet#tokens to get token out_point(txid, index) and value.

@Yamaguchi
Copy link
Contributor Author

@Yamaguchi Yamaguchi requested a review from rantan November 3, 2023 11:42
lib/glueby/internal/wallet.rb Outdated Show resolved Hide resolved
lib/glueby/wallet.rb Outdated Show resolved Hide resolved
lib/glueby/contract/tx_builder.rb Outdated Show resolved Hide resolved
lib/glueby/internal/wallet/active_record/wallet.rb Outdated Show resolved Hide resolved
lib/glueby/internal/wallet/active_record_wallet_adapter.rb Outdated Show resolved Hide resolved
lib/glueby/internal/wallet.rb Outdated Show resolved Hide resolved
lib/glueby/internal/wallet/abstract_wallet_adapter.rb Outdated Show resolved Hide resolved

before do
allow(internal_wallet).to receive(:list_unspent).with(color_id, true)
.and_return(unspents.select { |utxo| utxo[:color_id] == 'c150ad685ec8638543b2356cb1071cf834fb1c84f5fa3a71699c3ed7167dfcdbb3' })
Copy link
Contributor

Choose a reason for hiding this comment

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

メモ

このテストでは、もともと list_unspent はスタブしていたが、今回のへ変更で list_unspent に color_id を指定することで、特定のcolor id の utxo だけを返すようにできるので、それを使用する想定でスタブの記述を上書きしたという事ですね。

少し理解に時間がかかったので他のレビュアーのためにメモとして残します。

spec/glueby/contract/tx_builder_spec.rb Outdated Show resolved Hide resolved
@@ -261,7 +266,7 @@ def fill_uncolored_inputs(
while current_amount - fee < target_amount
sum, utxos = collect_uncolored_outputs(
fee + target_amount - current_amount,
nil, nil, true, true,
nil, false, true, true,
Copy link
Contributor

Choose a reason for hiding this comment

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

only_finalized が nil になってたんですね、、nil でも false でも挙動は変わりませんが、boolean を想定している引数だと思うので、nil は変ですね。

@rantan rantan merged commit 4b307b2 into master Dec 5, 2023
5 checks passed
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.

2 participants