From b5a30a1165a6b57505a7b5ce278b3c82b16ba655 Mon Sep 17 00:00:00 2001 From: Andrei Kuzmiankov Date: Thu, 21 Jan 2021 15:24:05 -0800 Subject: [PATCH] feat: Added proxy_staker --- proxy_staker.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 proxy_staker.go diff --git a/proxy_staker.go b/proxy_staker.go new file mode 100644 index 000000000..33e010b5b --- /dev/null +++ b/proxy_staker.go @@ -0,0 +1,31 @@ +package hedera + +import ( + "github.com/hashgraph/hedera-sdk-go/v2/proto" +) + +type ProxyStaker struct { + AccountID AccountID + amount Hbar +} + +func newProxyStaker(accountId AccountID, amount int64) ProxyStaker { + return ProxyStaker{ + AccountID: accountId, + amount: HbarFromTinybar(amount), + } +} + +func fromProtobuf(staker *proto.ProxyStaker) ProxyStaker { + return ProxyStaker{ + AccountID: accountIDFromProtobuf(staker.AccountID), + amount: HbarFromTinybar(staker.Amount), + } +} + +func (staker *ProxyStaker) toProtobuf() *proto.ProxyStaker { + return &proto.ProxyStaker{ + AccountID: staker.AccountID.toProtobuf(), + Amount: staker.amount.tinybar, + } +}