Skip to content

Commit 3a00efc

Browse files
committed
Rename default transaction in eth registrar controller
1 parent 5063ca5 commit 3a00efc

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

Sources/web3swift/Utils/ENS/ETHRegistrarController.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public extension ENS {
2020
return contract!
2121
}()
2222

23-
// FIXME: Rewrite this to CodableTransaction
24-
lazy var defaultOptions: CodableTransaction = {
23+
lazy var defaultTransaction: CodableTransaction = {
2524
return CodableTransaction.emptyTransaction
2625
}()
2726

@@ -59,34 +58,34 @@ public extension ENS {
5958
}
6059

6160
public func sumbitCommitment(from: EthereumAddress, commitment: Data) throws -> WriteOperation {
62-
defaultOptions.from = from
63-
defaultOptions.to = self.address
61+
defaultTransaction.from = from
62+
defaultTransaction.to = self.address
6463
guard let transaction = self.contract.createWriteOperation("commit", parameters: [commitment as AnyObject], extraData: Data()) else {throw Web3Error.transactionSerializationError}
6564
return transaction
6665
}
6766

6867
public func registerName(from: EthereumAddress, name: String, owner: EthereumAddress, duration: UInt, secret: String, price: String) throws -> WriteOperation {
6968
guard let amount = Utilities.parseToBigUInt(price, units: .ether) else {throw Web3Error.inputError(desc: "Wrong price: no way for parsing to ether units")}
70-
defaultOptions.value = amount
71-
defaultOptions.from = from
72-
defaultOptions.to = self.address
69+
defaultTransaction.value = amount
70+
defaultTransaction.from = from
71+
defaultTransaction.to = self.address
7372
guard let transaction = self.contract.createWriteOperation("register", parameters: [name, owner.address, duration, secret] as [AnyObject], extraData: Data()) else {throw Web3Error.transactionSerializationError}
7473
return transaction
7574
}
7675

7776
public func extendNameRegistration(from: EthereumAddress, name: String, duration: UInt32, price: String) throws -> WriteOperation {
7877
guard let amount = Utilities.parseToBigUInt(price, units: .ether) else {throw Web3Error.inputError(desc: "Wrong price: no way for parsing to ether units")}
79-
defaultOptions.value = amount
80-
defaultOptions.from = from
81-
defaultOptions.to = self.address
78+
defaultTransaction.value = amount
79+
defaultTransaction.from = from
80+
defaultTransaction.to = self.address
8281
guard let transaction = self.contract.createWriteOperation("renew", parameters: [name, duration] as [AnyObject], extraData: Data()) else {throw Web3Error.transactionSerializationError}
8382
return transaction
8483
}
8584

8685
@available(*, message: "Available for only owner")
8786
public func withdraw(from: EthereumAddress) throws -> WriteOperation {
88-
defaultOptions.from = from
89-
defaultOptions.to = self.address
87+
defaultTransaction.from = from
88+
defaultTransaction.to = self.address
9089
guard let transaction = self.contract.createWriteOperation("withdraw", parameters: [AnyObject](), extraData: Data()) else {throw Web3Error.transactionSerializationError}
9190
return transaction
9291
}

0 commit comments

Comments
 (0)