-
Notifications
You must be signed in to change notification settings - Fork 12
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
Generate address from output script #202
base: master
Are you sure you want to change the base?
Conversation
@@ -373,3 +373,89 @@ func buildScript(hash []byte, scriptType string) []byte { | |||
script, _ := builder.Script() | |||
return script | |||
} | |||
|
|||
func FromOutputScript( |
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.
This method should stay in address
package and should not make use of the payment one, like a "raw" address builder.
The idea is to allow the user to retrieve and address from an output script with either address
or payment
. The former lacks such API, while the latter already provides the necessary ones.
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.
yeah, thing is that if adding it to address pkg can use payment cause of cyclic import.
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.
I was trying to say that this function should be moved to address
and its implementation must change so that it doesn't make use of payment
's types/functions.
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.
I suggest you don't look at the liquidjs-lib implementation, rather this function should analyze the incoming script to understand its type and encode it to an address using the proper format (base58, bech32...).
I would remove also the blinding key argument and return always an unconfidential address from an output script to keep it simple. The user can translate it to confidential with existing types and functions of the address
package if needed.
This adds FromOutputScript func to the payment pkg which is supposed to create address from provided output script.
@tiero @altafan please review.