-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9849aed
commit a845225
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package hedera | ||
|
||
import ( | ||
"github.com/hashgraph/hedera-sdk-go/proto" | ||
"time" | ||
) | ||
|
||
type FreezeTransaction struct { | ||
TransactionBuilder | ||
pb *proto.FreezeTransactionBody | ||
} | ||
|
||
func NewFreezeTransaction() FreezeTransaction { | ||
pb := &proto.FreezeTransactionBody{} | ||
|
||
inner := newTransactionBuilder() | ||
inner.pb.Data = &proto.TransactionBody_Freeze{pb} | ||
|
||
builder := FreezeTransaction{inner, pb} | ||
|
||
return builder | ||
} | ||
|
||
func (builder FreezeTransaction) SetStartTime(start time.Time) FreezeTransaction { | ||
builder.pb.StartHour = int32(start.Hour()) | ||
builder.pb.StartMin = int32(start.Minute()) | ||
return builder | ||
} | ||
|
||
func (builder FreezeTransaction) SetEndTime(end time.Time) FreezeTransaction { | ||
builder.pb.EndHour = int32(end.Hour()) | ||
builder.pb.EndMin = int32(end.Minute()) | ||
return builder | ||
} | ||
|
||
func (builder FreezeTransaction) Build(client *Client) Transaction { | ||
return builder.TransactionBuilder.Build(client) | ||
} | ||
|
||
// | ||
// The following _5_ must be copy-pasted at the bottom of **every** _transaction.go file | ||
// We override the embedded fluent setter methods to return the outer type | ||
// | ||
|
||
func (builder FreezeTransaction) SetMaxTransactionFee(maxTransactionFee uint64) FreezeTransaction { | ||
return FreezeTransaction{builder.TransactionBuilder.SetMaxTransactionFee(maxTransactionFee), builder.pb} | ||
} | ||
|
||
func (builder FreezeTransaction) SetMemo(memo string) FreezeTransaction { | ||
return FreezeTransaction{builder.TransactionBuilder.SetMemo(memo), builder.pb} | ||
} | ||
|
||
func (builder FreezeTransaction) SetTransactionValidDuration(validDuration time.Duration) FreezeTransaction { | ||
return FreezeTransaction{builder.TransactionBuilder.SetTransactionValidDuration(validDuration), builder.pb} | ||
} | ||
|
||
func (builder FreezeTransaction) SetTransactionID(transactionID TransactionID) FreezeTransaction { | ||
return FreezeTransaction{builder.TransactionBuilder.SetTransactionID(transactionID), builder.pb} | ||
} | ||
|
||
func (builder FreezeTransaction) SetNodeAccountID(nodeAccountID AccountID) FreezeTransaction { | ||
return FreezeTransaction{builder.TransactionBuilder.SetNodeAccountID(nodeAccountID), builder.pb} | ||
} |