Skip to content

Commit

Permalink
feat: Added proxy_staker
Browse files Browse the repository at this point in the history
  • Loading branch information
andrix10 authored and janaakhterov committed Jan 22, 2021
1 parent fae2818 commit b5a30a1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions proxy_staker.go
Original file line number Diff line number Diff line change
@@ -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,
}
}

0 comments on commit b5a30a1

Please sign in to comment.