How to create raw transaction using web3swift?

0 votes
I need to create a raw transaction using web3swift for my project. I dont know how to do that. Can someone tell me how to do it?
Sep 17, 2018 in Blockchain by digger
• 27,620 points
26 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
var options = Web3Options.defaultOptions()

options.gasLimit = BigUInt(21000)

options.from = self.bip32keystore?.addresses?.first!

let amountDouble = Int((Double(amount) ?? 0.0)*pow(10, 18))

let am = BigUInt.init(amountDouble)

options.value = am

let estimatedGasResult =   self.web3Rinkeby?.contract(Web3.Utils.coldWalletABI, at: toaddress)!.method(options: options)!.estimateGas(options: nil)

guard case .success(let estimatedGas)? = estimatedGasResult else {return}

options.gasLimit = estimatedGas

var intermediateSend = self.web3Rinkeby?.contract(Web3.Utils.coldWalletABI, at: toaddress, abiVersion: 2)!.method(options: options)!

intermediateSend = self.web3Rinkeby?.contract(Web3.Utils.coldWalletABI, at: toaddress, abiVersion: 2)!.method(options: options)!

let sendResult = intermediateSend?.send(password: pass)

switch sendResult {

    case .success(let r)?:

    print("Sucess",r)

  case .failure(let err)?:

  print("Eroor",err)

 case .none:

 print("sendResultBip32",sendResult)

 }     
answered Sep 17, 2018 by slayer
• 29,040 points

Related Questions In Blockchain

0 votes
1 answer

Using web3swift to create raw transaction.

Here you go: var options = Web3Options.defaultOptions() options.gasLimit = ...READ MORE

answered Jul 31, 2018 in Blockchain by digger
• 27,620 points
54 views
0 votes
1 answer

How to create a cryptocurrency based reward system using Ethereum?

I doubt that you'd need a decentralized ...READ MORE

answered May 30, 2018 in Blockchain by Shashank
• 10,330 points
68 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,620 points
52 views
+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.