forked from hiero-ledger/hiero-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
contract_delete_transaction.go
72 lines (55 loc) · 2.72 KB
/
contract_delete_transaction.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package hedera
import (
"github.com/hashgraph/hedera-sdk-go/proto"
"time"
)
type ContractDeleteTransaction struct {
TransactionBuilder
pb *proto.ContractDeleteTransactionBody
}
// NewContractDeleteTransaction creates a Contract Delete Transaction builder which can be used to construct and execute
// a Contract Delete Transaction.
func NewContractDeleteTransaction() ContractDeleteTransaction {
pb := &proto.ContractDeleteTransactionBody{}
inner := newTransactionBuilder()
inner.pb.Data = &proto.TransactionBody_ContractDeleteInstance{ContractDeleteInstance: pb}
builder := ContractDeleteTransaction{inner, pb}
return builder
}
// SetContractID sets the Contract ID of the Contract to be deleted by the Contract Delete Transaction
func (builder ContractDeleteTransaction) SetContractID(id ContractID) ContractDeleteTransaction {
builder.pb.ContractID = id.toProto()
return builder
}
// SetTransferAccountID sets the Account ID which will receive remaining hbar tied to the Contract
func (builder ContractDeleteTransaction) SetTransferAccountID(id AccountID) ContractDeleteTransaction {
builder.pb.Obtainers = &proto.ContractDeleteTransactionBody_TransferAccountID{
TransferAccountID: id.toProto(),
}
return builder
}
func (builder ContractDeleteTransaction) SetTransferContractID(id ContractID) ContractDeleteTransaction {
builder.pb.Obtainers = &proto.ContractDeleteTransactionBody_TransferContractID{
TransferContractID: id.toProto(),
}
return builder
}
//
// 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 ContractDeleteTransaction) SetMaxTransactionFee(maxTransactionFee Hbar) ContractDeleteTransaction {
return ContractDeleteTransaction{builder.TransactionBuilder.SetMaxTransactionFee(maxTransactionFee), builder.pb}
}
func (builder ContractDeleteTransaction) SetTransactionMemo(memo string) ContractDeleteTransaction {
return ContractDeleteTransaction{builder.TransactionBuilder.SetTransactionMemo(memo), builder.pb}
}
func (builder ContractDeleteTransaction) SetTransactionValidDuration(validDuration time.Duration) ContractDeleteTransaction {
return ContractDeleteTransaction{builder.TransactionBuilder.SetTransactionValidDuration(validDuration), builder.pb}
}
func (builder ContractDeleteTransaction) SetTransactionID(transactionID TransactionID) ContractDeleteTransaction {
return ContractDeleteTransaction{builder.TransactionBuilder.SetTransactionID(transactionID), builder.pb}
}
func (builder ContractDeleteTransaction) SetNodeAccountID(nodeAccountID AccountID) ContractDeleteTransaction {
return ContractDeleteTransaction{builder.TransactionBuilder.SetNodeAccountID(nodeAccountID), builder.pb}
}