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”,