algorand / go-algorand-sdk

Algorand Golang SDK

Home Page:https://pkg.go.dev/github.com/algorand/go-algorand-sdk/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add missing EncodeAddress

barnjamin opened this issue · comments

Problem

At the moment we provide DecodeAddress and you can get EncodeAddress behavior by taking a slice and copying it into the type of Address (32 byte array) then calling .String() on it but it is less than obvious.

Solution

Implement EncodeAddress that does this for you and matches APIs of other SDKs

Right, otherwise you have to play games like this:

var addr types.Address
copy(addr[:], pkVal[:])

which will not be obvious to many users and should be a 'conversion constructor' equivalent as part of types.Address methods.