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

Clarify refund address input docs #684

Closed
wants to merge 3 commits into from

Conversation

danielgranhao
Copy link
Contributor

@danielgranhao danielgranhao commented Jan 21, 2025

This adds documentation suggesting that integrators provide a refund address as parsed by the parse method.

Also, it fixes some warnings from cargo doc.

Copy link
Collaborator

@dangeross dangeross left a comment

Choose a reason for hiding this comment

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

Isn't it better for the SDK to validate the address? we have a fn for it validate_bitcoin_address()

@danielgranhao
Copy link
Contributor Author

Isn't it better for the SDK to validate the address? we have a fn for it validate_bitcoin_address()

We can (and maybe should) do that, but IMO it's still a good practice for integrators to use the output of parse. We can even go a step further and switch the refund_address type from String to BitcoinAddressData, which would further motivate the use of parse. Wdyt?

@danielgranhao danielgranhao marked this pull request as draft January 21, 2025 16:14
@dangeross
Copy link
Collaborator

We can (and maybe should) do that, but IMO it's still a good practice for integrators to use the output of parse. We can even go a step further and switch the refund_address type from String to BitcoinAddressData, which would further motivate the use of parse. Wdyt?

I prefer the string inputs and let the SDK validate it. It also is the approach for PayOnchainRequest / pay_onchain. Otherwise we have to start thinking about maybe changing send_payment to also take an InputType that is already parsed. Maybe it's a separate PR if it's agreed with @roeierez

@roeierez
Copy link
Member

Leaving as string and validating sounds good to me. I agree with the documentation mentioning it should be a valid bitcoin address but not sure we should direct the user to validate it, it is better that we do it.

@danielgranhao
Copy link
Contributor Author

Closed in favor of validating the input (#687)

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.

3 participants