-
rpc error: code = Internal desc = failed to execute the script on the execution node execution-48601e8a1568f18ca4a574a656710342857f939f598679280a6941cc7b800b6f@execution-003.devnet31.nodes.onflow.org:3569=100: rpc error: code = Internal desc = failed to execute script: failed to execute script at block (cad25de450a477658998d0c56ab025676ca9dbae4c4cc575331386dbe2884878): [Error Code: 1101] cadence runtime error Execution failed:
error: unexpected token: identifier
โ 80ee3d58a7e0e50fe8b0db2a704f1f8c00d1810dabe82bb29cee7bac78c0cf2b:4:9
|
4 | import Momentables from 0x91a8a7ecba2b2e6c
| ^at Object.onEnd (ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1)
at ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1
at ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1
at Array.forEach ()
at e.rawOnError (ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1)
at e.onTransportHeaders (ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1)
at t.responseCallback (ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1)
at e.exports.s.emit (ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1)
at e.exports.d._connect (ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1)
at ce3ec5e6bce6e2f49e6cf496c7ad3714cf41d7b3.2d8bd907af46b21e535d.js:1
1 Like
Could you provide us more details on what you are trying to attempt? cc:@flowjosh, does this error sounds familiar to you?
I just deployed contracts to testnet and this error occurs when i try to initialize the account, โMomentablesโ is a contract which is deployed and available on address 0x91a8a7ecba2b2e6c.
@veerdev Can you share the entire text of the transaction?
@flowjosh Thanks in advance
import { transaction, limit, proposer, payer, authorizations, authz, cdc } from "@onflow/fcl"
import { invariant } from '@onflow/util-invariant';
import { tx } from './util/tx';
const CODE = cdc`
import FungibleToken from 0xFungibleToken
import NonFungibleToken from 0xNonFungibleToken
import FUSD from 0xFUSD
import Momentables from 0xMomentables
import NFTStorefront from 0xNFTStorefront
pub fun hasFUSD(_ address: Address): Bool {
let receiver = getAccount(address)
.getCapability<&FUSD.Vault{FungibleToken.Receiver}>(/public/fusdReceiver)
.check()
let balance = getAccount(address)
.getCapability<&FUSD.Vault{FungibleToken.Balance}>(/public/fusdBalance)
.check()
return receiver && balance`Preformatted text`
}
pub fun hasItems(_ address: Address): Bool {
return getAccount(address)
.getCapability<&Momentables.Collection{NonFungibleToken.CollectionPublic, Momentables.MomentablesCollectionPublic}>(Momentables.CollectionPublicPath)
.check()
}
pub fun hasStorefront(_ address: Address): Bool {
return getAccount(address)
.getCapability<&NFTStorefront.Storefront{NFTStorefront.StorefrontPublic}>(NFTStorefront.StorefrontPublicPath)
.check()
}
transaction {
prepare(acct: AuthAccount) {
if !hasFUSD(acct.address) {
if acct.borrow<&FUSD.Vault>(from: /storage/fusdVault) == nil {
acct.save(<-FUSD.createEmptyVault(), to: /storage/fusdVault)
}
acct.unlink(/public/fusdReceiver)
acct.unlink(/public/fusdBalance)
acct.link<&FUSD.Vault{FungibleToken.Receiver}>(/public/fusdReceiver, target: /storage/fusdVault)
acct.link<&FUSD.Vault{FungibleToken.Balance}>(/public/fusdBalance, target: /storage/fusdVault)
}
if !hasItems(acct.address) {
if acct.borrow<&Momentables.Collection>(from: Momentables.CollectionStoragePath) == nil {
acct.save(<-Momentables.createEmptyCollection(), to: Momentables.CollectionStoragePath)
}
acct.unlink(Momentables.CollectionPublicPath)
acct.link<&Momentables.Collection{NonFungibleToken.CollectionPublic, Momentables.MomentablesCollectionPublic}>(Momentables.CollectionPublicPath, target: Momentables.CollectionStoragePath)
}
if !hasStorefront(acct.address) {
if acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath) == nil {
acct.save(<-NFTStorefront.createStorefront(), to: NFTStorefront.StorefrontStoragePath)
}
acct.unlink(NFTStorefront.StorefrontPublicPath)
acct.link<&NFTStorefront.Storefront{NFTStorefront.StorefrontPublic}>(NFTStorefront.StorefrontPublicPath, target: NFTStorefront.StorefrontStoragePath)
}
}
}
`;
export async function initializeAccount(address, opts = {}) {
invariant(address != null, "Tried to initialize an account but no address was supplied")
return tx(
[
transaction(CODE),
limit(70),
proposer(authz),
payer(authz),
authorizations([authz]),
],
opts
);
}
Solved the issue, it seems some variables are wrong in env file.