Elizabet1926 / Solana

Solana SOL/SPLToken Transfer with Swift. SolanaWallet for iOS.
MIT License
2 stars 0 forks source link

在发送转账交易时一直报错 #1

Open LiuBoPOP opened 3 weeks ago

LiuBoPOP commented 3 weeks ago

error = "Error: failed to get recent blockhash: TypeError: Load failed" 好像是Sol的获取recent blockhash 的节点更换了 但是我一直没有找到这个节点应该在哪里替换?

Elizabet1926 commented 3 weeks ago

@LiuBoPOP

solanaWeb.solanaTransfer(privateKey: privateKey,
                         toAddress: toAddress,
                         amount: amount,
                         endpoint: SolanaMainNetValue) { [weak self] state, txid, error in
    guard let self = self else { return }
    print("state = \(state)")
    print("txid = \(txid)")
    if state {
        self.hashLabel.text = txid
    } else {
        self.hashLabel.text = error
    }
}

In this code, replace SolanaMainNetValue with the desired Solana endpoint URL, such as a mainnet or testnet endpoint, to change the network environment where the transfer will be sent. YOU SHOULD BUY Solana endpoint URL IN https://www.quicknode.com/

Let me know if you'd like further customization!