skittles 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ yarn add skittles
37
37
  Here's a simple example of a Skittles smart contract:
38
38
 
39
39
  ```typescript
40
- import { address, SkittlesEvent } from "skittles/types/core-types";
40
+ import { address, msg, SkittlesEvent } from "skittles/lib/types/core-types";
41
41
 
42
42
  interface TransferEvent {
43
43
  from: address;
@@ -64,7 +64,7 @@ export class Token {
64
64
  this.Transfer.emit({
65
65
  from: msg.sender,
66
66
  to,
67
- amount
67
+ amount,
68
68
  });
69
69
 
70
70
  return true;
@@ -88,7 +88,7 @@ export class Token {
88
88
  Create a `skittles.config.ts` file in your project root:
89
89
 
90
90
  ```typescript
91
- import { SkittlesConfig } from "skittles/types/core-types";
91
+ import { SkittlesConfig } from "skittles/lib/types/core-types";
92
92
 
93
93
  const config: SkittlesConfig = {
94
94
  optimizer: {
@@ -101,6 +101,7 @@ export default config;
101
101
  ```
102
102
 
103
103
  The configuration options include:
104
+
104
105
  - `optimizer.enabled`: Enable/disable the optimizer
105
106
  - `optimizer.runs`: Number of runs for the optimizer (default: 200)
106
107
 
@@ -10,6 +10,7 @@ const get_bytecode_1 = __importDefault(require("../bytecode/get-bytecode"));
10
10
  const file_helper_1 = require("../helpers/file-helper");
11
11
  const get_yul_1 = __importDefault(require("../yul/get-yul"));
12
12
  const get_file_data_1 = __importDefault(require("./get-file-data"));
13
+ const path_1 = __importDefault(require("path"));
13
14
  const doTask = (task, fn) => {
14
15
  const spinner = (0, ora_1.default)(task).start();
15
16
  const response = fn();
@@ -18,7 +19,7 @@ const doTask = (task, fn) => {
18
19
  };
19
20
  const getConfig = () => {
20
21
  try {
21
- return require("../../skittles.config.ts");
22
+ return require(`${process.cwd()}/skittles.config.ts`);
22
23
  }
23
24
  catch {
24
25
  throw new Error("No skittles.config.ts file found");
@@ -26,7 +27,7 @@ const getConfig = () => {
26
27
  };
27
28
  const skittlesCompile = () => {
28
29
  // Loading cache and config
29
- const cache = JSON.parse((0, file_helper_1.readFile)("build/cache.json"));
30
+ const cache = JSON.parse((0, file_helper_1.readFile)(path_1.default.join(process.cwd(), "build/cache.json")));
30
31
  const config = getConfig();
31
32
  // Getting file data
32
33
  const fileData = doTask("Processing Files", () => (0, get_file_data_1.default)(cache));
@@ -7,7 +7,7 @@ exports.relativePathToAbsolute = exports.getContractName = exports.clearDirector
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const constants_1 = require("../data/constants");
10
- const CONTRCT_PATH = "./contracts";
10
+ const CONTRCT_PATH = path_1.default.join(process.cwd(), "contracts");
11
11
  const getAllFilesInDirectory = (dir) => {
12
12
  const files = [];
13
13
  fs_1.default.readdirSync(dir).forEach((file) => {
@@ -5,12 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const ethers_1 = require("ethers");
7
7
  const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
8
9
  const getFileString = (fileName) => {
9
10
  return fs_1.default.readFileSync(fileName, { encoding: "utf8" });
10
11
  };
11
12
  const getSkittlesFactory = async (signer, contract) => {
12
- const abi = JSON.parse(getFileString(`./build/abi/${contract}.abi`));
13
- const bytecode = getFileString(`./build/bytecode/${contract}.bytecode`);
13
+ const abi = JSON.parse(getFileString(path_1.default.join(process.cwd(), `build/abi/${contract}.abi`)));
14
+ const bytecode = getFileString(path_1.default.join(process.cwd(), `build/bytecode/${contract}.bytecode`));
14
15
  return new ethers_1.ContractFactory(abi, bytecode, signer);
15
16
  };
16
17
  exports.default = getSkittlesFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skittles",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "TypeScript Smart Contract Language for the EVM",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -34,14 +34,20 @@
34
34
  "ora": "^5.0.0",
35
35
  "solc": "^0.8.16",
36
36
  "typescript": "^4.7.4",
37
- "yargs": "^17.5.1"
38
- },
39
- "devDependencies": {
37
+ "yargs": "^17.5.1",
40
38
  "@nomiclabs/hardhat-ethers": "^2.1.1",
41
39
  "@nomiclabs/hardhat-etherscan": "^3.1.0",
42
40
  "@nomiclabs/hardhat-waffle": "^2.0.3",
43
41
  "@typechain/ethers-v5": "^7.2.0",
44
42
  "@typechain/hardhat": "^2.3.1",
43
+ "ts-node": "^10.9.1",
44
+ "dotenv": "^16.0.1",
45
+ "typechain": "^5.2.0",
46
+ "ethereum-waffle": "^3.4.4",
47
+ "hardhat": "^2.10.2",
48
+ "hardhat-gas-reporter": "^1.0.8"
49
+ },
50
+ "devDependencies": {
45
51
  "@types/chai": "^4.3.3",
46
52
  "@types/listr": "^0.14.4",
47
53
  "@types/mocha": "^9.1.1",
@@ -50,7 +56,6 @@
50
56
  "@typescript-eslint/eslint-plugin": "^4.33.0",
51
57
  "@typescript-eslint/parser": "^4.33.0",
52
58
  "chai": "^4.3.6",
53
- "dotenv": "^16.0.1",
54
59
  "eslint": "^7.32.0",
55
60
  "eslint-config-prettier": "^8.5.0",
56
61
  "eslint-config-standard": "^16.0.3",
@@ -58,15 +63,10 @@
58
63
  "eslint-plugin-node": "^11.1.0",
59
64
  "eslint-plugin-prettier": "^3.4.1",
60
65
  "eslint-plugin-promise": "^5.2.0",
61
- "ethereum-waffle": "^3.4.4",
62
- "hardhat": "^2.10.2",
63
- "hardhat-gas-reporter": "^1.0.8",
64
66
  "prettier": "^2.7.1",
65
67
  "prettier-plugin-solidity": "^1.0.0-beta.13",
66
68
  "solhint": "^3.3.7",
67
- "solidity-coverage": "^0.7.21",
68
- "ts-node": "^10.9.1",
69
- "typechain": "^5.2.0"
69
+ "solidity-coverage": "^0.7.21"
70
70
  },
71
71
  "prettier": {
72
72
  "printWidth": 100