func FromKey(k AddrKey) Address {
	a, err := DecodeAddress(strings.NewReader(string(k)))
	if err != nil {
		panic("Could not decode address in FromKey")
	}
	return a
}
FromKey returns the `Address` corresponding to the passed `AddrKey`
created by `Key`.
Panics when the `Address` can't be decoded.
package wallet
import (
	"fmt"
	stdio "io"
	"strings"
	"github.com/pkg/errors"
	"perun.network/go-perun/pkg/io"
)
type Address interface {
	io.Encoder
	Bytes() []byte
	fmt.Stringer
	Equals(Address) bool
	Cmp(Address) int
}
func IndexOfAddr(addrs []Address, addr Address) int {
	for i, a := range addrs {
		if addr.Equals(a) {
			return i
		}
	}
	return -1
}
type AddressPredicate = func(Address) bool
type Addresses []Address
type AddressesWithLen []Address
type addressSliceLen = uint16
type AddressDec struct {
	Addr *Address
}
type AddrKey string
func (a Addresses) Encode(w stdio.Writer) error {
	for i, addr := range a {
		if err := addr.Encode(w); err != nil {
			return errors.WithMessagef(err, "encoding %d-th address", i)
		}
	}
	return nil
}
func (a AddressesWithLen) Encode(w stdio.Writer) error {
	return io.Encode(w,
		addressSliceLen(len(a)),
		(Addresses)(a))
}
func (a Addresses) Decode(r stdio.Reader) (err error) {
	for i := range a {
		a[i], err = DecodeAddress(r)
		if err != nil {
			return errors.WithMessagef(err, "decoding %d-th address", i)
		}
	}
	return nil
}
func (a *AddressesWithLen) Decode(r stdio.Reader) (err error) {
	var parts addressSliceLen
	if err = io.Decode(r, &parts); err != nil {
		return errors.WithMessage(err, "decoding count")
	}
	*a = make(AddressesWithLen, parts)
	return (*Addresses)(a).Decode(r)
}
func (a AddressDec) Decode(r stdio.Reader) (err error) {
	*a.Addr, err = DecodeAddress(r)
	return err
}
func Key(a Address) AddrKey {
	var buff strings.Builder
	if err := a.Encode(&buff); err != nil {
		panic("Could not encode address in AddrKey")
	}
	return AddrKey(buff.String())
}