ios - 在 Xcode 中发送交易时收到 "configurationError"

标签 ios blockchain aion pokt

当我尝试在 Aion 网络上发送交易时,我不断收到“configurationError”。我正在使用 Xcode 创建我的 IOS dApp。

我必须发送交易的代码是:

@IBAction func sendTxButton(_ sender: Any) {

    //deleted my address and pk

    let address = "0x0" 
    let privateKey = "0x0"


    let nonce = BigInt.init(3)
    let to =  "0xa0d969df9232b45239b577c3790887081b5a22ffd5a46a8d82584ee560485624"
    let value =  BigInt.init(10000000)
    let nrgPrice = BigInt.init(10000000000)
    let nrg = BigInt.init(21000)

    var txParams = [AnyHashable: Any]()
    txParams["nonce"] = HexStringUtil.prependZeroX(hex: nonce.toString(radix: 16))
    txParams["to"] = to
    txParams["data"] = ""
    txParams["value"] = HexStringUtil.prependZeroX(hex: value.toString(radix: 16))
    txParams["nrgPrice"] = HexStringUtil.prependZeroX(hex: nrgPrice.toString(radix: 16))
    txParams["nrg"] = HexStringUtil.prependZeroX(hex: nrg.toString(radix: 16))

    do {


        let importWallet = try PocketAion.importWallet(privateKey: privateKey, subnetwork: "32", address: address, data: nil)

        try PocketAion.eth.sendTransaction(wallet: importWallet, nonce: nonce, to: to, data: "", value: value, nrgPrice: nrgPrice, nrg: nrg, handler: { (result, error) in
            if error != nil {
                print(error!)
                return
            } else {
                print("the hash:", result!)
            }

        })

    } catch{
        print(error)
    }

}

我已经满足了发送交易的所有要求,但无法弄清楚出了什么问题。(这是为了在 Aion 测试网“32”上发送测试代币)。

最佳答案

检查您的 AppDelegate 类。确保您已添加“配置”并将其指向正确的 URL,并在应用程序功能下确保将配置设置为“自身”。


class AppDelegate: UIResponder, UIApplicationDelegate, Configuration {



    public var nodeURL: URL{

        get {

            return URL.init(string: "https://aion.pokt.network")!

        }

    }



    var window: UIWindow?





    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Override point for customization after application launch.



       PocketAion.shared.setConfiguration(config: self)

        return true

    }

关于ios - 在 Xcode 中发送交易时收到 "configurationError",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54914608/

相关文章:

ios - 当 UIView 中的文本在动画之前更改时,为什么 UIView 动画会失败?

iOS UITextField.inputView 错误

go - 如何设计一个在另一个对等点上调用相同的链代码?

rust - 将 Solana 空投到特定帐户

websocket - 如何在 BSC 上获取待处理的交易

aion - 通过前端部署 Aion dApp 时出错 : fs. readFileSync 不是函数

ios - 如何在其 subview 之一正在动画时释放 UIView?

ios - UIImagePickerController takePicture 解除 Controller