-
Notifications
You must be signed in to change notification settings - Fork 10
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
59aafc8
Add #tokens method to Wallet
Yamaguchi e63b484
Add paging parameter(page, per)
Yamaguchi b5d8641
Add status to Wallet#tokens
Yamaguchi 8c01bba
Add color_id paramter to Glueby::Internal::Wallet#list_unspent
Yamaguchi 74b74f4
Fix method comment
Yamaguchi 6056b0f
Rename method name
Yamaguchi d01e3fc
Remove method Glueby::Internal::Wallet::AR::Wallet#token_utxos
Yamaguchi aff6091
Remove unneccessary code in TxBuilder#collect_colored_outputs
Yamaguchi 213e661
Rename method name token_utxos -> list_unspent_with_count
Yamaguchi 555608c
Fix for review comments
Yamaguchi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -385,7 +385,11 @@ class TxBuilderMock | |
let(:receiver_address) { wallet.internal_wallet.receive_address } | ||
let(:script_pubkey) { Tapyrus::Script.parse_from_addr(receiver_address).add_color(color_id).to_hex } | ||
let(:amount) { 100_001 } | ||
|
||
|
||
before do | ||
allow(internal_wallet).to receive(:list_unspent).with(true, color_id: color_id) | ||
.and_return(unspents.select { |utxo| utxo[:color_id] == 'c150ad685ec8638543b2356cb1071cf834fb1c84f5fa3a71699c3ed7167dfcdbb3' }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. メモ このテストでは、もともと list_unspent はスタブしていたが、今回のへ変更で list_unspent に color_id を指定することで、特定のcolor id の utxo だけを返すようにできるので、それを使用する想定でスタブの記述を上書きしたという事ですね。 少し理解に時間がかかったので他のレビュアーのためにメモとして残します。 |
||
end | ||
it { expect(subject.inputs.size).to eq 3 } | ||
it { expect(subject.inputs[0].out_point.txid).to eq '100c4dc65ea4af8abb9e345b3d4cdcc548bb5e1cdb1cb3042c840e147da72fa2' } | ||
it { expect(subject.inputs[0].out_point.index).to eq 0 } | ||
|
@@ -423,6 +427,11 @@ class TxBuilderMock | |
] | ||
end | ||
|
||
before do | ||
allow(internal_wallet).to receive(:list_unspent).with(true, color_id: color_id) | ||
.and_return(unspents.select { |utxo| utxo[:color_id] == 'c150ad685ec8638543b2356cb1071cf834fb1c84f5fa3a71699c3ed7167dfcdbb3' }) | ||
end | ||
|
||
it { expect(subject.inputs.size).to eq 3 } | ||
it { expect(subject.inputs[0].out_point.txid).to eq '100c4dc65ea4af8abb9e345b3d4cdcc548bb5e1cdb1cb3042c840e147da72fa2' } | ||
it { expect(subject.inputs[0].out_point.index).to eq 0 } | ||
|
@@ -479,6 +488,12 @@ class TxBuilderMock | |
let(:amount) { 50_000 } | ||
let(:fee_estimator) { Glueby::Contract::FeeEstimator::Fixed.new } | ||
|
||
|
||
before do | ||
allow(internal_wallet).to receive(:list_unspent).with(true, color_id: color_id) | ||
.and_return(unspents.select { |utxo| utxo[:color_id] == 'c150ad685ec8638543b2356cb1071cf834fb1c84f5fa3a71699c3ed7167dfcdbb3' }) | ||
end | ||
|
||
it { expect(subject.inputs.size).to eq 2 } | ||
it { expect(subject.inputs[0].out_point.txid).to eq '100c4dc65ea4af8abb9e345b3d4cdcc548bb5e1cdb1cb3042c840e147da72fa2' } | ||
it { expect(subject.inputs[0].out_point.index).to eq 0 } | ||
|
@@ -641,11 +656,10 @@ class TxBuilderMock | |
end | ||
|
||
describe '#collect_colored_outputs' do | ||
subject { mock.collect_colored_outputs(results, color_id, amount) } | ||
subject { mock.collect_colored_outputs(results, amount) } | ||
|
||
let(:results) { unspents } | ||
let(:results) { unspents.select { |utxo| utxo[:color_id] == 'c150ad685ec8638543b2356cb1071cf834fb1c84f5fa3a71699c3ed7167dfcdbb3' } } | ||
let(:amount) { 50_000 } | ||
let(:color_id) { Tapyrus::Color::ColorIdentifier.parse_from_payload('c150ad685ec8638543b2356cb1071cf834fb1c84f5fa3a71699c3ed7167dfcdbb3'.htb) } | ||
|
||
it { expect(subject[0]).to eq 100_000 } | ||
it { expect(subject[1].size).to eq 1 } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 は変ですね。