Skip to content

Commit 6e22077

Browse files
authored
Merge pull request #314 from hashgraph/sr/clear-take2
fix(ContractUpdateTransaction): clear functions should reset the value
2 parents def0bbd + 033fe77 commit 6e22077

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

sdk/swift/Sources/Hedera/Contract/ContractUpdateTransaction.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class ContractUpdateTransaction: Transaction {
3232
maxAutomaticTokenAssociations: UInt32? = nil,
3333
autoRenewAccountId: AccountId? = nil,
3434
stakedAccountId: AccountId? = nil,
35-
stakedNodeId: UInt64? = nil,
35+
stakedNodeId: Int64? = nil,
3636
declineStakingReward: Bool? = nil
3737
) {
3838
self.contractId = contractId
@@ -128,7 +128,7 @@ public final class ContractUpdateTransaction: Transaction {
128128
/// life of the contract.
129129
@discardableResult
130130
public func autoRenewAccountId(_ autoRenewAccountId: AccountId?) -> Self {
131-
self.autoRenewAccountId = autoRenewAccountId
131+
self.autoRenewAccountId = 0
132132

133133
return self
134134
}
@@ -149,33 +149,37 @@ public final class ContractUpdateTransaction: Transaction {
149149
@discardableResult
150150
public func stakedAccountId(_ stakedAccountId: AccountId?) -> Self {
151151
self.stakedAccountId = stakedAccountId
152+
stakedNodeId = nil
152153

153154
return self
154155
}
155156

156157
@discardableResult
157158
public func clearStakedAccountId() -> Self {
158-
stakedAccountId = nil
159+
stakedAccountId = 0
160+
stakedNodeId = nil
159161

160162
return self
161163
}
162164

163165
/// The ID of the node to which this contract is staking.
164166
/// This is mutually exclusive with `staked_account_id`.
165-
public var stakedNodeId: UInt64?
167+
public var stakedNodeId: Int64?
166168

167169
/// Set the ID of the node to which this contract is staking.
168170
/// This is mutually exclusive with `staked_account_id`.
169171
@discardableResult
170-
public func stakedNodeId(_ stakedNodeId: UInt64?) -> Self {
172+
public func stakedNodeId(_ stakedNodeId: Int64?) -> Self {
171173
self.stakedNodeId = stakedNodeId
174+
stakedAccountId = nil
172175

173176
return self
174177
}
175178

176179
@discardableResult
177180
public func clearStakedNodeId() -> Self {
178-
stakedNodeId = nil
181+
stakedNodeId = -1
182+
stakedAccountId = nil
179183

180184
return self
181185
}

0 commit comments

Comments
 (0)