0

I have the following code that used to work:

    client := n.getClient()

    // get the account details for master account
    masterKey := keypair.Master(n.passphrase)
    ar := horizonclient.AccountRequest{AccountID: masterKey.Address()}
    masterAccount, err := client.AccountDetail(ar)
    if err != nil {
        // error getting master account details (it usually happens when horizon is not working)
        return horizon.Transaction{}, err
    }

    // create the operation
    op := txnbuild.CreateAccount{
        Destination: "GAXFXGYRBTINYDICJMLJSPMY5BCRGAW2MGGQCNP6JB7NK5HFLB7KIZJT",
        Amount:      "10",
    }

    // build the transaction
    txn, err := txnbuild.NewTransaction(
        txnbuild.TransactionParams{
            SourceAccount:        &masterAccount,
            IncrementSequenceNum: true,
            Operations:           []txnbuild.Operation{&op},
            BaseFee:              txnbuild.MinBaseFee,
            Timebounds:           txnbuild.NewTimeout(300),
        },
    )

    if err != nil {
        // Error building the transaction
        return horizon.Transaction{}, err
    }

    // sign the transaction
    signedTxn, err := txn.Sign(n.passphrase, masterKey.(*keypair.Full))
    if err != nil {
        // error signing the transaction
        return horizon.Transaction{} ,err
    }

    // submit transaction
    return client.SubmitTransaction(signedTxn)

which is pretty much the same as the example given in the GO SDK on txnbuild.

Unfortunately, since I upgraded to the latest version of Stellar, the code is not working any longer. I am getting 400 response with txn_not_supported on extra information on the error.

Any help would be really appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.