fix broken client from json
@@ -2,6 +2,7 @@ package hedera
import (
"fmt"
+ "strings"
"github.com/hashgraph/hedera-sdk-go/proto"
)
@@ -54,6 +55,19 @@ func (id AccountID) toProto() *proto.AccountID {
}
}
+func (id *AccountID) UnmarshalJSON(data []byte) error {
+ accountId, err := AccountIDFromString(strings.Replace(string(data), "\"", "", 2))
+
+ if err != nil {
+ println("error was not nil")
+ return err
+ }
+
+ id = &accountId
+
+ return nil
+}
+
func accountIDFromProto(pb *proto.AccountID) AccountID {
return AccountID{
Shard: uint64(pb.ShardNum),
