|
8 | 8 |
|
9 | 9 | import Foundation |
10 | 10 | import BigInt |
11 | | -//import EthereumAddress |
12 | 11 |
|
13 | 12 | public extension ENS { |
14 | 13 | class ETHRegistrarController { |
@@ -51,26 +50,26 @@ public extension ENS { |
51 | 50 | return available |
52 | 51 | } |
53 | 52 |
|
54 | | - public func calculateCommitmentHash(name: String, owner: EthereumAddress, secret: [UInt32]) throws -> [UInt32] { |
55 | | - guard let transaction = self.contract.read("makeCommitment", parameters: [name, owner, secret] as [AnyObject], extraData: Data(), transactionOptions: defaultOptions) else {throw Web3Error.transactionSerializationError} |
| 53 | + public func calculateCommitmentHash(name: String, owner: EthereumAddress, secret: String) throws -> Data { |
| 54 | + guard let transaction = self.contract.read("makeCommitment", parameters: [name, owner.address, secret] as [AnyObject], extraData: Data(), transactionOptions: defaultOptions) else {throw Web3Error.transactionSerializationError} |
56 | 55 | guard let result = try? transaction.call(transactionOptions: defaultOptions) else {throw Web3Error.processingError(desc: "Can't call transaction")} |
57 | | - guard let hash = result["0"] as? [UInt32] else {throw Web3Error.processingError(desc: "Can't get answer")} |
| 56 | + guard let hash = result["0"] as? Data else {throw Web3Error.processingError(desc: "Can't get answer")} |
58 | 57 | return hash |
59 | 58 | } |
60 | 59 |
|
61 | | - public func sumbitCommitment(from: EthereumAddress, commitment: [UInt32]) throws -> WriteTransaction { |
| 60 | + public func sumbitCommitment(from: EthereumAddress, commitment: Data) throws -> WriteTransaction { |
62 | 61 | defaultOptions.from = from |
63 | 62 | defaultOptions.to = self.address |
64 | 63 | guard let transaction = self.contract.write("commit", parameters: [commitment as AnyObject], extraData: Data(), transactionOptions: defaultOptions) else {throw Web3Error.transactionSerializationError} |
65 | 64 | return transaction |
66 | 65 | } |
67 | 66 |
|
68 | | - public func registerName(from: EthereumAddress, name: String, owner: EthereumAddress, duration: UInt32, secret: [UInt32], price: String) throws -> WriteTransaction { |
| 67 | + public func registerName(from: EthereumAddress, name: String, owner: EthereumAddress, duration: UInt, secret: String, price: String) throws -> WriteTransaction { |
69 | 68 | guard let amount = Web3.Utils.parseToBigUInt(price, units: .eth) else {throw Web3Error.inputError(desc: "Wrong price: no way for parsing to ether units")} |
70 | 69 | defaultOptions.value = amount |
71 | 70 | defaultOptions.from = from |
72 | 71 | defaultOptions.to = self.address |
73 | | - guard let transaction = self.contract.write("register", parameters: [name, owner, duration, secret] as [AnyObject], extraData: Data(), transactionOptions: defaultOptions) else {throw Web3Error.transactionSerializationError} |
| 72 | + guard let transaction = self.contract.write("register", parameters: [name, owner.address, duration, secret] as [AnyObject], extraData: Data(), transactionOptions: defaultOptions) else {throw Web3Error.transactionSerializationError} |
74 | 73 | return transaction |
75 | 74 | } |
76 | 75 |
|
|
0 commit comments