lotus/chain/types/voucher.go

23 lines
428 B
Go
Raw Normal View History

package types
2020-02-28 18:06:59 +00:00
import (
"encoding/base64"
2020-02-12 23:52:36 +00:00
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
cbor "github.com/ipfs/go-ipld-cbor"
)
2020-02-25 21:09:22 +00:00
func DecodeSignedVoucher(s string) (*paych.SignedVoucher, error) {
data, err := base64.RawURLEncoding.DecodeString(s)
if err != nil {
return nil, err
}
2020-02-25 21:09:22 +00:00
var sv paych.SignedVoucher
if err := cbor.DecodeInto(data, &sv); err != nil {
return nil, err
}
return &sv, nil
}