@@ -71,20 +71,7 @@ extension web3.BrowserFunctions {
71
71
guard let publicKey = SECP256K1 . recoverPublicKey ( hash: hash, signature: signatureData) else { return nil }
72
72
return Web3 . Utils. publicToAddressString ( publicKey)
73
73
}
74
-
75
-
76
- public func sendTransaction( _ transactionJSON: [ String : Any ] , password: String = " web3swift " ) -> [ String : Any ] ? {
77
- guard let transaction = EthereumTransaction . fromJSON ( transactionJSON) else { return nil }
78
- guard let options = TransactionOptions . fromJSON ( transactionJSON) else { return nil }
79
- var transactionOptions = TransactionOptions ( )
80
- transactionOptions. from = options. from
81
- transactionOptions. to = options. to
82
- transactionOptions. value = options. value != nil ? options. value! : BigUInt ( 0 )
83
- transactionOptions. gasLimit = options. gasLimit != nil ? options. gasLimit! : . automatic
84
- transactionOptions. gasPrice = options. gasPrice != nil ? options. gasPrice! : . automatic
85
- return self . sendTransaction ( transaction, transactionOptions: transactionOptions, password: password)
86
- }
87
-
74
+
88
75
public func sendTransaction( _ transaction: EthereumTransaction , transactionOptions: TransactionOptions , password: String = " web3swift " ) -> [ String : Any ] ? {
89
76
do {
90
77
let result = try self . web3. eth. sendTransaction ( transaction, transactionOptions: transactionOptions, password: password)
@@ -93,19 +80,7 @@ extension web3.BrowserFunctions {
93
80
return nil
94
81
}
95
82
}
96
-
97
- public func estimateGas( _ transactionJSON: [ String : Any ] ) -> BigUInt ? {
98
- guard let transaction = EthereumTransaction . fromJSON ( transactionJSON) else { return nil }
99
- guard let options = TransactionOptions . fromJSON ( transactionJSON) else { return nil }
100
- var transactionOptions = TransactionOptions ( )
101
- transactionOptions. from = options. from
102
- transactionOptions. to = options. to
103
- transactionOptions. value = options. value != nil ? options. value! : BigUInt ( 0 )
104
- transactionOptions. gasLimit = . automatic
105
- transactionOptions. gasPrice = options. gasPrice != nil ? options. gasPrice! : . automatic
106
- return self . estimateGas ( transaction, transactionOptions: transactionOptions)
107
- }
108
-
83
+
109
84
public func estimateGas( _ transaction: EthereumTransaction , transactionOptions: TransactionOptions ) -> BigUInt ? {
110
85
do {
111
86
let result = try self . web3. eth. estimateGas ( transaction, transactionOptions: transactionOptions)
@@ -114,16 +89,6 @@ extension web3.BrowserFunctions {
114
89
return nil
115
90
}
116
91
}
117
-
118
- public func prepareTxForApproval( _ transactionJSON: [ String : Any ] ) -> ( transaction: EthereumTransaction ? , options: TransactionOptions ? ) {
119
- guard let transaction = EthereumTransaction . fromJSON ( transactionJSON) else { return ( nil , nil ) }
120
- guard let options = TransactionOptions . fromJSON ( transactionJSON) else { return ( nil , nil ) }
121
- do {
122
- return try self . prepareTxForApproval ( transaction, options: options)
123
- } catch {
124
- return ( nil , nil )
125
- }
126
- }
127
92
128
93
public func prepareTxForApproval( _ trans: EthereumTransaction , options opts: TransactionOptions ) throws -> ( transaction: EthereumTransaction ? , options: TransactionOptions ? ) {
129
94
do {
@@ -142,24 +107,7 @@ extension web3.BrowserFunctions {
142
107
return ( nil , nil )
143
108
}
144
109
}
145
-
146
- public func signTransaction( _ transactionJSON: [ String : Any ] , password: String = " web3swift " ) -> String ? {
147
- guard let transaction = EthereumTransaction . fromJSON ( transactionJSON) else { return nil }
148
- guard let options = TransactionOptions . fromJSON ( transactionJSON) else { return nil }
149
- var transactionOptions = TransactionOptions ( )
150
- transactionOptions. from = options. from
151
- transactionOptions. to = options. to
152
- transactionOptions. value = options. value != nil ? options. value! : BigUInt ( 0 )
153
- transactionOptions. gasLimit = options. gasLimit != nil ? options. gasLimit! : . automatic
154
- transactionOptions. gasPrice = options. gasPrice != nil ? options. gasPrice! : . automatic
155
- if let nonceString = transactionJSON [ " nonce " ] as? String , let nonce = BigUInt ( nonceString. stripHexPrefix ( ) , radix: 16 ) {
156
- transactionOptions. nonce = . manual( nonce)
157
- } else {
158
- transactionOptions. nonce = . pending
159
- }
160
- return self . signTransaction ( transaction, transactionOptions: transactionOptions, password: password)
161
- }
162
-
110
+
163
111
public func signTransaction( _ trans: EthereumTransaction , transactionOptions: TransactionOptions , password: String = " web3swift " ) -> String ? {
164
112
do {
165
113
var transaction = trans
0 commit comments