B4J Question [ Web3X ] Invalid Sender ?

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
hello everyone !!
i'm trying to send founds between 2 wallets in ropsten, but when i call SendFunds Function, i have this Log :

Bash:
*** mainpage: B4XPage_Appear
*** mainpage: B4XPage_Resize [mainpage]
0xidm19jjdaj91jdal0...................
return SendFunds = [IsInitialized=true, Success=false, Value=null
, Error=[IsInitialized=true, Code=-32000, Message=invalid sender
, Data=null]]
*** mainpage: B4XPage_Disappear [mainpage]

source code :
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private Web3Ropsten As Web3X
    Private Utils As W3Utils
    Private InfuraRopstenLink As String = "https://ropsten.infura.io/v3/MY_INFURA_ID"
End Sub

Public Sub Initialize
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    B4XPages.GetManager.LogEvents = True
    Root = Root1
    Root.LoadLayout("MainPage")
    Utils.Initialize
    Web3Ropsten = Utils.BuildWeb3Infura(InfuraRopstenLink)

    
    Dim Path As String = "D:\wallet\UTC--2022-04-18T20-06-35.daksdkas8das7da7sdha8sj2d931kj8d7agehdajd8.json"
    Wait For (Utils.LoadWallet(Path, "MY_PASSWORD")) Complete (Result As W3AsyncResult)
    If Result.Success Then
        Dim Credentials As W3Credentials = Result.Value
        Log(Credentials.Address) ' on this line show my wallet address, works fine ...
    End If
 
    Dim ToAddress As String = "0xaas8dha89dhnas8da76sgdffda6ygs69999eg"
    Dim Amount As BigInteger = Utils.BigIntFromUnit("0.01", "ether")
    Dim MaxPriorityFeePerGas As BigInteger = Utils.BigIntFromUnit("3", "gwei")
    Dim MaxFeePerGas As BigInteger = Utils.BigIntFromUnit("200", "gwei")
    Dim ChainId As Int = Utils.CHAINID_ROPSTEN
    Wait For (Web3Ropsten.SendFunds(ChainId, Credentials, ToAddress, Amount, MaxPriorityFeePerGas, MaxFeePerGas)) Complete (Result As W3AsyncResult)
    Log("Return SendFunds = "&Result)
    Result.Success Then
        Dim hash As W3TransactionHash = Result.Value
        Log("Transaction sent successfully: ")
        Log(hash.Hash)
        Dim Timeout As Int = 300 'seconds
        Wait For (Web3Ropsten.EthGetTransactionReceipt(hash, Timeout)) Complete (Result As W3AsyncResult)
        If Result.Success Then
            Dim tr As W3TransactionReceipt = Result.Value
            If tr.Pending Then
                Log("Transaction still pending")
            Else
                Log("Transaction completed, ok? " & tr.StatusOk)
                Log(tr)
            End If
        Else
            Log("Error getting receipt: " & Result.Error)
        End If
    else
    Log("Error")
    End If

End Sub

does anyone know what i'm doing wrong?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…