提问人:Gareja Kirit 提问时间:7/25/2023 最后编辑:Gareja Kirit 更新时间:7/25/2023 访问量:38
发送BNB币时,它抛出错误nodeError(desc: “unknown account”) ios swift
While Sending BNB Coin it throws error nodeError(desc: "unknown account") ios swift
问:
我用来发送 bnb 的函数
我有来自UserDefault的当前用户钱包地址 来自文本字段的接收者用户钱包地址 来自文本字段的金额
我正在发送选项
我用来发送 bnb 的函数
我有来自UserDefault的当前用户钱包地址 来自文本字段的接收者用户钱包地址 来自文本字段的金额
我正在发送选项
let result = try tx.send(password: “”) 此行抛出错误 nodeError(desc: “unknown account”) 错误
func transferETH()
{
let strETHAmount: String = trimString(trimstr: txtTransferAmount.text!)
let strReceiverWalletAddress: String = trimString(trimstr: txtReceiveAddress.text!)
if strETHAmount.count == 0 {
AppDelegate.sharedAppDelegate().hideLoadingView()
return
}
if strReceiverWalletAddress.count == 0 {
AppDelegate.sharedAppDelegate().hideLoadingView()
return
}
if let myaddress = Defaults(key: DefaultsKeys.USER_DEFAULT_WALLET_ADDRESS) as? String {
let walletAddress = EthereumAddress(myaddress)! // Your wallet address
let toAddress = EthereumAddress(strReceiverWalletAddress)! // Receiver wallet address
let contract = web3Obj.contract(Web3.Utils.coldWalletABI, at: toAddress, abiVersion: 2)!
let amount = Web3.Utils.parseToBigUInt(strETHAmount, units: .eth)
print("amount",amount!)
var options = TransactionOptions.defaultOptions
options.value = amount
// options.to = toAddress
options.from = walletAddress
options.gasPrice = .automatic
options.gasLimit = .automatic
let tx = contract.write(
"fallback",
parameters: [AnyObject](),
extraData: Data(),
transactionOptions: options)!
print("txtxtxtxtxtx:",tx)
do {
let result = try tx.send(password: "")
print("result.hash:",result.hash)
AppDelegate.sharedAppDelegate().hideLoadingView()
showAlertHandlerDefaultApple(title: String.str_alert_validation_title, message: String.str_transaction_successfully_done, view: self) { action in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
print("yes")
self.dismiss(animated: true, completion: nil)
}
}
} catch {
AppDelegate.sharedAppDelegate().hideLoadingView()
print("**** Error :",error)
}
}else{
AppDelegate.sharedAppDelegate().hideLoadingView()
}
}
就说这有什么问题
这是期权数据,这里有什么问题
EthereumContract(transactionOptions: 可选(web3swift.TransactionOptions(type: Optional(Legacy),
to:可选(web3swift.EthereumAddress(_address: “0x6378398dec8e7f3419c501919c1d2fdadcbb46fb”,类型:web3swift。EthereumAddress.AddressType.normal)),
from: 可选(web3swift.EthereumAddress(_address: “0xe507be01aa9c0863ab89170c632da43c21c79ad1”,类型:web3swift。EthereumAddress.AddressType.normal)),
chainID:无,
gasLimit: 可选(web3swift.TransactionOptions.GasLimitPolicy.automatic)、
gasPrice:可选(web3swift.TransactionOptions.GasPricePolicy.automatic)、
maxFeePerGas:可选(web3swift.TransactionOptions.FeePerGasPolicy.automatic)、
maxPriorityFeePerGas:可选(web3swift.TransactionOptions.FeePerGasPolicy.automatic)、
value: 可选 (100000000000000000),
nonce: 可选(web3swift.TransactionOptions.NoncePolicy.pending)、TransactionOptions.NoncePolicy.pending)、
callOnBlock:可选(web3swift.TransactionOptions.CallingBlockPolicy.pending), accessList: nil)),
address: 可选(web3swift.EthereumAddress(_address: “0x6378398dec8e7f3419c501919c1d2fdadcbb46fb”,类型:web3swift。EthereumAddress.AddressType.normal)),
_abi:[web3swift。阿比。Element.fallback(web3swift.阿比。Element.Fallback(常量:false,payable:true))])
答: 暂无答案
评论