@@ -20,8 +20,7 @@ public extension ENS {
20
20
return contract!
21
21
} ( )
22
22
23
- // FIXME: Rewrite this to CodableTransaction
24
- lazy var defaultOptions : CodableTransaction = {
23
+ lazy var defaultTransaction : CodableTransaction = {
25
24
return CodableTransaction . emptyTransaction
26
25
} ( )
27
26
@@ -59,34 +58,34 @@ public extension ENS {
59
58
}
60
59
61
60
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
64
63
guard let transaction = self . contract. createWriteOperation ( " commit " , parameters: [ commitment as AnyObject ] , extraData: Data ( ) ) else { throw Web3Error . transactionSerializationError}
65
64
return transaction
66
65
}
67
66
68
67
public func registerName( from: EthereumAddress , name: String , owner: EthereumAddress , duration: UInt , secret: String , price: String ) throws -> WriteOperation {
69
68
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
73
72
guard let transaction = self . contract. createWriteOperation ( " register " , parameters: [ name, owner. address, duration, secret] as [ AnyObject ] , extraData: Data ( ) ) else { throw Web3Error . transactionSerializationError}
74
73
return transaction
75
74
}
76
75
77
76
public func extendNameRegistration( from: EthereumAddress , name: String , duration: UInt32 , price: String ) throws -> WriteOperation {
78
77
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
82
81
guard let transaction = self . contract. createWriteOperation ( " renew " , parameters: [ name, duration] as [ AnyObject ] , extraData: Data ( ) ) else { throw Web3Error . transactionSerializationError}
83
82
return transaction
84
83
}
85
84
86
85
@available ( * , message: " Available for only owner " )
87
86
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
90
89
guard let transaction = self . contract. createWriteOperation ( " withdraw " , parameters: [ AnyObject] ( ) , extraData: Data ( ) ) else { throw Web3Error . transactionSerializationError}
91
90
return transaction
92
91
}
0 commit comments