Error While running a transaction

import React, {useState} from “react”

import * as fcl from “@onflow/fcl”

import styled from ‘styled-components’

const simpleTransaction = fcl.cdc`

import NonFungibleToken from 0x4fc019cea9fc4817

import KittyItems from 0x4fc019cea9fc4817

// This transaction configures an account to hold Kitty Items.

transaction {

    prepare(signer: AuthAccount) {

        // if the account doesn't already have a collection

        if signer.borrow<&KittyItems.Collection>(from: KittyItems.CollectionStoragePath) == nil {

            // create a new empty collection

            let collection <- KittyItems.createEmptyCollection()

            

            // save it to the account

            signer.save(<-collection, to: KittyItems.CollectionStoragePath)

            // create a public capability for the collection

            signer.link<&KittyItems.Collection{NonFungibleToken.CollectionPublic, KittyItems.KittyItemsCollectionPublic}>(KittyItems.CollectionPublicPath, target: KittyItems.CollectionStoragePath)

        }

    }

}

`

const SetupAccount = () => {

const [status, setStatus] = useState(“Not started”)

const [transaction, setTransaction] = useState(null)

const SetupAccount = async (event) => {

event.preventDefault()



setStatus("Resolving...")

const blockResponse = await fcl.send([

  fcl.getLatestBlock(),

])

const block = await fcl.decode(blockResponse)



try {

  const tx = await fcl.send([

    fcl.transaction(simpleTransaction),

    fcl.proposer(fcl.currentUser().authorization),

    fcl.payer(fcl.currentUser().authorization),

    fcl.authorizations([               

      fcl.currentUser().authorization  

    ]),

    fcl.ref(block.id),

  ])

  const { transactionId } = tx

  setStatus(`Transaction (${transactionId}) sent, waiting for confirmation`)

  const unsub = fcl

    .tx(transactionId)

    .subscribe(transaction => {

      setTransaction(transaction)

      if (fcl.tx.isSealed(transaction)) {

        setStatus(`Transaction (${transactionId}) is Sealed`)

        unsub()

      }

    })

} catch (error) {

  console.error(error)

  setStatus("Transaction failed")

}

}

return (

<Card>

  <Header>SetupAccount</Header>

  <Code>{simpleTransaction}</Code>

  <button onClick={SetupAccount}>

    Setup

  </button>

  <Code>Status: {status}</Code>

  {transaction && <Code>{JSON.stringify(transaction, null, 2)}</Code>}

</Card>

)

}

export default SetupAccount

when I am running this Transaction It is giving me error
“errorMessage”: “[Error Code: 1109] failed to deduct 10000 transaction fees from f086a545ce3c552d: Execution failed:\nerror: computation limited exceeded: 10\n → 7e60df042a9c0868.FlowToken:61:12\n”,

Can you try increasing the computation limit.

fcl.send([
  ...,
  fcl.limit(35), // make this larger than the default 10, you want it to be as small as possible but large enough to work
  ...,
])
1 Like

Thank You that one helped
But now I am getting new error

“errorMessage”: “[Error Code: 1007] invalid proposal key: public key 1 on account 133e1613b8b3aed3 has sequence number 57, but given 56”,

what is this

This is in reference to the sequence number of the proposer for the transaction. You can sort of think about in a similar way to a nonce with an ethereum transaction.

My guess is you submitted two transactions in quick succession, effectively submitting two transactions with the same sequence number. The first transaction bumped the sequence number, and then when the second transaction went to execute it had the same sequence number as the first one.

There are ways of getting around this limitation but they will change based on what you are trying to achieve. What are you trying to do? This almost only ever comes up with trying to do multiple transactions at once with the same proposer, so are you trying to do multiple of the same thing? or a couple different things?