Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 1.27 KB

structure.md

File metadata and controls

40 lines (29 loc) · 1.27 KB
title sidebar_title description
Folder Structure
Folder Structure
How to structure your Cadence files

Currently, Framework expects a specific hierarchy of files inside your base directory. There are no rules that enforce the name of the base directory, but there should be 3 folders inside with names:

  • contracts
  • transactions
  • scripts

Each of those folders shall store corresponding templates types, i.e. contracts folder stores contract templates.

You can have nested folders inside them, but templates in each of those root folders would be treated as of certain type.

Usage

File is in the root of scripts folder

For this simple case you just need to specify name of the file

// Let's assume your base folder is one level above your test
const basePath = path.resolve("../cadence")
const [result, error] = await executeScript("log-message")

File is in nested folder

Let's assume template you want to execute is in scripts/utility/log-message In this case you will need to provide a path relative to scripts folder (no / prefix needed)

// Let's assume your base folder is one level above your test
const basePath = path.resolve("../cadence")
const [result, error] = await executeScript("utility/log-message")