@@ -132,17 +132,13 @@ extension web3.BrowserFunctions {
132
132
do {
133
133
var transaction = trans
134
134
var options = opts
135
- var gasOptions = TransactionOptions ( )
136
135
guard let _ = options. from else { return ( nil , nil ) }
137
136
let gasPrice = try self . web3. eth. getGasPrice ( )
138
- gasOptions . gasPrice = . manual ( gasPrice)
137
+ transaction . gasPrice = gasPrice
139
138
options. gasPrice = . manual( gasPrice)
140
139
guard let gasEstimate = self . estimateGas ( transaction, transactionOptions: options) else { return ( nil , nil ) }
141
- gasOptions . gasLimit = . limited ( gasEstimate)
140
+ transaction . gasLimit = gasEstimate
142
141
options. gasLimit = . limited( gasEstimate)
143
-
144
- transaction. applyOptions ( gasOptions)
145
-
146
142
print ( transaction)
147
143
return ( transaction, options)
148
144
} catch {
@@ -173,28 +169,26 @@ extension web3.BrowserFunctions {
173
169
public func signTransaction( _ trans: EthereumTransaction , transactionOptions: TransactionOptions , password: String = " web3swift " ) -> String ? {
174
170
do {
175
171
var transaction = trans
176
- var gasOptions = TransactionOptions ( )
177
- guard let from = transactionOptions. from else { return nil }
178
- guard let keystoreManager = self . web3. provider. attachedKeystoreManager else { return nil }
179
- guard let gasPricePolicy = transactionOptions. gasPrice else { return nil }
180
- guard let gasLimitPolicy = transactionOptions. gasLimit else { return nil }
181
- guard let noncePolicy = transactionOptions. nonce else { return nil }
172
+ guard let from = transactionOptions. from else { return nil }
173
+ guard let keystoreManager = self . web3. provider. attachedKeystoreManager else { return nil }
174
+ guard let gasPricePolicy = transactionOptions. gasPrice else { return nil }
175
+ guard let gasLimitPolicy = transactionOptions. gasLimit else { return nil }
176
+ guard let noncePolicy = transactionOptions. nonce else { return nil }
182
177
switch gasPricePolicy {
183
178
case . manual( let gasPrice) :
184
- gasOptions . gasPrice = . manual ( gasPrice)
179
+ transaction . gasPrice = gasPrice
185
180
default :
186
181
let gasPrice = try self . web3. eth. getGasPrice ( )
187
- gasOptions . gasPrice = . manual ( gasPrice)
182
+ transaction . gasPrice = gasPrice
188
183
}
189
184
190
185
switch gasLimitPolicy {
191
186
case . manual( let gasLimit) :
192
- gasOptions . gasLimit = . manual ( gasLimit)
187
+ transaction . gasLimit = gasLimit
193
188
default :
194
189
let gasLimit = try self . web3. eth. estimateGas ( transaction, transactionOptions: transactionOptions)
195
- gasOptions . gasLimit = . manual ( gasLimit)
190
+ transaction . gasLimit = gasLimit
196
191
}
197
- transaction. applyOptions ( gasOptions)
198
192
199
193
switch noncePolicy {
200
194
case . manual( let nonce) :
@@ -211,7 +205,7 @@ extension web3.BrowserFunctions {
211
205
guard let keystore = keystoreManager. walletForAddress ( from) else { return nil }
212
206
try Web3Signer . signTX ( transaction: & transaction, keystore: keystore, account: from, password: password)
213
207
print ( transaction)
214
- let signedData = transaction. encode ( ) ? . toHexString ( ) . addHexPrefix ( )
208
+ let signedData = transaction. encode ( forSignature : false , chainID : nil ) ? . toHexString ( ) . addHexPrefix ( )
215
209
return signedData
216
210
} catch {
217
211
return nil
0 commit comments