yann4460 / elrond-sdk.dotnet

Elrond SDK for .NET Core
GNU General Public License v3.0
17 stars 4 forks source link

Adding data to TransactionRequest causes signing failure in TransactionRequest.Send #21

Open ethanrushh opened 2 years ago

ethanrushh commented 2 years ago

I am using the documentation and I am able to successfully create a transaction if no data is present. When adding data using txRequest.SetData() the transaction will fail after.

Here is the code I am using:

private static async Task GetAccountBalance()
        {
            var _provider = new ElrondProvider(new HttpClient(), new ElrondNetworkConfiguration(Network.DevNet));
            var aliceAccount =
                new Account(Address.FromBech32(<address is here>));

// Ensure that the account in synchronize with the network to have a valid Nonce
            await aliceAccount.Sync(_provider);

// Alice send 1 EGLD to bob
            var txRequest = TransactionRequest.Create(aliceAccount, await NetworkConfig.GetFromNetwork(_provider), aliceAccount.Address, TokenAmount.EGLD("1"));
            txRequest.SetData("Hello");

            var tx        = await txRequest.Send(_provider, Wallet.DeriveFromMnemonic(mnemonic));

// Await the execution of the transaction
            await tx.AwaitExecuted(_provider);
        }

Again to clarify: when txRequest.SetData("Hello"); is NOT present, the transaction is successful. An internal C# exception is thrown when that line is present.