@@ -220,53 +220,44 @@ return
220220wethioKeystoreManager = manager
221221guard let urlStr = URL(string: "Your rpc url here") else { return }
222222guard let kManager = yourKeystoreManager else { return }
223- /*
224- Create Web3Provider Instance with key manager
225- */
223+
224+ //Create Web3Provider Instance with key manager
226225web3ProvideInstance = Web3HttpProvider(urlStr, keystoreManager: kManager)
227226guard let wProvier = self.web3ProvideInstance else {return}
228227self.web3Instance = Web3(provider: wProvier) //Set provide instance with web3
229228guard let wInstance = self.web3Instance else {return}
230229self.receiverAddressString = self.walletAddressTF.text //get receiver address string
231230print("Receiver address is : ", self.receiverAddressString ?? " ")
232231self.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
236235let senderEthAddress = EthereumAddress(self.etheriumAccountAddress ?? "")
237236DispatchQueue.global(qos: .background).async {
238237do {
239- /*
240- Convert receiver address in to etherium address
241- */
238+ //Convert receiver address in to etherium address
242239let toaddress = EthereumAddress(self.receiverAddressString ?? "")
243- /*
244- Create web3 options
245- */
240+
241+ //Create web3 options
246242var options = Web3Options.defaultOptions()
247- /*
248- Convert amount into BIGINT
249- */
243+
244+ //Convert amount into BIGINT
250245let 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)
254248print("Total amount in double value : ", amountDouble)
255- /*
256- Convert amount in BIG UI iNt
257- */
249+
250+ //Convert amount in BIG UI iNt
258251var amount = BigUInt.init(amountDouble)
259- /*
260- get gas price
261- */
252+
253+ //get gas price
262254let estimateGasPrice = try wInstance.eth.getGasPrice()
263255guard let eGasReult = self.estimatedGasResult else {
264256print("Unable to find gas price")
265257return
266258}
267- /*
268- Get nonce
269- */
259+
260+ //Get nonce
270261let nonce = try wInstance.eth.getTransactionCount(address: senderEthAddress)
271262print("Is the Transaction count", nonce)
272263let fee = estimateGasPrice * eGasReult
0 commit comments