#3 add sell() to convert ZLD to BTC#64
Open
edmoffo wants to merge 1 commit into
Open
Conversation
Wire Zold::WTS#sell to POST /do-zld-to-btc on wts.zold.io with keygap, btc, and amount, returning the job id from the X-Zold-Job header so callers can pass it to wait(). Mirror the method on Zold::WTS::Fake for tests, and stub the endpoint with webmock to keep the suite offline. Closes zold-io#3
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue #3 asks for a
sell()method on the WTS gateway so callers of the SDK can convert their ZLD balance to BTC without driving the website. The repository already exposes the symmetricpay()method againsthttps://wts.zold.io/do-payand the WTS server defines the corresponding sell endpoint atPOST /do-zld-to-btctakingkeygap,btc, andamountand returning the job id through theX-Zold-Jobheader (seefront/front_btc.rbinzold-io/wts.zold.io).This change adds
Zold::WTS#sell(keygap, btc, amount)mirroringpay()end to end: it posts the three parameters to/do-zld-to-btc, runs the response through the samecleanandjob_ofhelpers, and returns the job id so the caller can pass it towait(). A matching no-opZold::WTS::Fake#sell(_keygap, _btc, _amount)keeps the fake gateway usable in downstream tests. Two new minitest cases stub the endpoint withwebmockand exercise both the real and the fake implementations offline.Locally on Ruby 3.3 with the gem
Gemfile.lock:bundle exec rake testruns 10 tests with 0 failures, 0 errors, and 90.72% line coverage.bundle exec rubocop lib/zold/wts.rb test/zold/test_wts.rbreports the same pre-existing offences master carries minus one I autocorrected in the new hunk. The CI checksmarkdown-lint,typos,yamllint, and therubocopstep oftestare red on master at7c79029for reasons unrelated to this diff (README badges,criteriastypo inlib/zold/wts.rb:140, yamllint config,rubocop-rspec_rails inject_defaults!), so this branch does not introduce new red checks.Closes #3