Skip to content

Commit 2aa458c

Browse files
authored
fix: enable clean imports from @hashgraph/asset-tokenization-contracts/scripts (#700)
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
1 parent 0e736f1 commit 2aa458c

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@hashgraph/asset-tokenization-contracts": patch
3+
---
4+
5+
fix: enable clean imports from /scripts path with Hardhat compatibility
6+
7+
Fixed npm package exports to enable clean imports:
8+
9+
- Import from `@hashgraph/asset-tokenization-contracts/scripts` instead of `/build/scripts`
10+
- Added `typesVersions` field for legacy TypeScript `moduleResolution: "node"` compatibility (required by Hardhat)
11+
- Added missing runtime dependencies: `tslib` and `dotenv`
12+
- Removed duplicate export entry that caused confusion
13+
- Added package validation tools: `publint` and `@arethetypeswrong/cli`
14+
15+
This maintains full compatibility with Hardhat v2 CommonJS requirements while providing proper TypeScript type resolution.

packages/ats/contracts/package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
"type": "commonjs",
55
"main": "./build/typechain-types/index.js",
66
"types": "./build/typechain-types/index.d.ts",
7-
"files": [
8-
"artifacts/",
9-
"contracts/",
10-
"typechain-types/",
11-
"scripts/",
12-
"build/",
13-
"!artifacts/build-info/",
14-
"!build/**/*.map"
15-
],
7+
"typesVersions": {
8+
"*": {
9+
"scripts": ["./build/scripts/index.d.ts"],
10+
"typechain-types": ["./build/typechain-types/index.d.ts"],
11+
"test": ["./build/test/index.d.ts"]
12+
}
13+
},
14+
"files": ["artifacts/", "contracts/", "typechain-types/", "build/", "!artifacts/build-info/", "!build/**/*.map"],
1615
"exports": {
1716
".": {
1817
"types": "./build/typechain-types/index.d.ts",
@@ -22,7 +21,6 @@
2221
},
2322
"./artifacts/*": "./artifacts/*",
2423
"./contracts/*": "./contracts/*",
25-
"./scripts/": "./scripts/index.ts",
2624
"./scripts": {
2725
"types": "./build/scripts/index.d.ts",
2826
"import": "./build/scripts/index.js",
@@ -104,12 +102,15 @@
104102
"slither:summary": "docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v \"$(pwd)\":\"/home/ethsec/contracts\" -w \"/home/ethsec/contracts\" -u 0:0 trailofbits/eth-security-toolbox /bin/sh -c \"solc-select install 0.8.18 && solc-select use 0.8.18 && slither . --print human-summary --solc-remaps @=node_modules/@\"",
105103
"slither:storageLayout": "docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v \"$(pwd)\":\"/home/ethsec/contracts\" -w \"/home/ethsec/contracts\" -u 0:0 trailofbits/eth-security-toolbox /bin/sh -c \"solc-select install 0.8.18 && solc-select use 0.8.18 && slither . --print variable-order --solc-remaps @=node_modules/@\"",
106104
"slither:inheritance": "docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v \"$(pwd)\":\"/home/ethsec/contracts\" -w \"/home/ethsec/contracts\" -u 0:0 trailofbits/eth-security-toolbox /bin/sh -c \"solc-select install 0.8.18 && solc-select use 0.8.18 && slither . --print inheritance --solc-remaps @=node_modules/@\"",
105+
"validate:package": "npm run build && npx publint && npx @arethetypeswrong/cli --pack",
107106
"prepack": "npm run build",
108107
"doc": "npx hardhat dodoc"
109108
},
110109
"dependencies": {
111110
"zod": "^3.22.4",
112-
"ethers": "^5.8.0"
111+
"ethers": "^5.8.0",
112+
"tslib": "^2.8.1",
113+
"dotenv": "^16.0.3"
113114
},
114115
"devDependencies": {
115116
"@hashgraph/sdk": "2.64.5",

packages/ats/contracts/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"compilerOptions": {
33
"target": "ES2022",
44
"module": "commonjs",
5+
"moduleResolution": "node10",
56
"declaration": true,
67
"sourceMap": true,
78
"esModuleInterop": true,

0 commit comments

Comments
 (0)