@@ -220,53 +220,44 @@ return
220
220
wethioKeystoreManager = manager
221
221
guard let urlStr = URL(string: "Your rpc url here") else { return }
222
222
guard let kManager = yourKeystoreManager else { return }
223
- /*
224
- Create Web3Provider Instance with key manager
225
- */
223
+
224
+ //Create Web3Provider Instance with key manager
226
225
web3ProvideInstance = Web3HttpProvider(urlStr, keystoreManager: kManager)
227
226
guard let wProvier = self.web3ProvideInstance else {return}
228
227
self.web3Instance = Web3(provider: wProvier) //Set provide instance with web3
229
228
guard let wInstance = self.web3Instance else {return}
230
229
self.receiverAddressString = self.walletAddressTF.text //get receiver address string
231
230
print("Receiver address is : ", self.receiverAddressString ?? " ")
232
231
self.etheriumAccountAddress = self.wethioKeystoreManager?.addresses.first?.address //get sender address in string
233
- /*
234
- convert address string into etherium addresss
235
- */
232
+
233
+
234
+ //convert address string into etherium addresss
236
235
let senderEthAddress = EthereumAddress(self.etheriumAccountAddress ?? "")
237
236
DispatchQueue.global(qos: .background).async {
238
237
do {
239
- /*
240
- Convert receiver address in to etherium address
241
- */
238
+ //Convert receiver address in to etherium address
242
239
let toaddress = EthereumAddress(self.receiverAddressString ?? "")
243
- /*
244
- Create web3 options
245
- */
240
+
241
+ //Create web3 options
246
242
var options = Web3Options.defaultOptions()
247
- /*
248
- Convert amount into BIGINT
249
- */
243
+
244
+ //Convert amount into BIGINT
250
245
let amountDouble = BigInt((Double(yourCoin) ?? 0.1)*pow(10, 18))
251
- /*
252
- Here i am using 0.1 as an default value please use validation for amount (coin or token)
253
- */
246
+
247
+ //Here i am using 0.1 as an default value please use validation for amount (coin or token)
254
248
print("Total amount in double value : ", amountDouble)
255
- /*
256
- Convert amount in BIG UI iNt
257
- */
249
+
250
+ //Convert amount in BIG UI iNt
258
251
var amount = BigUInt.init(amountDouble)
259
- /*
260
- get gas price
261
- */
252
+
253
+ //get gas price
262
254
let estimateGasPrice = try wInstance.eth.getGasPrice()
263
255
guard let eGasReult = self.estimatedGasResult else {
264
256
print("Unable to find gas price")
265
257
return
266
258
}
267
- /*
268
- Get nonce
269
- */
259
+
260
+ //Get nonce
270
261
let nonce = try wInstance.eth.getTransactionCount(address: senderEthAddress)
271
262
print("Is the Transaction count", nonce)
272
263
let fee = estimateGasPrice * eGasReult
0 commit comments