-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Update fetch-and-compile readme with fetchAndCompileMultiple and getSupportedNetworks #4719
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you for adding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a new TS project to verify this snippet and ran into issues simply importing @Truffle/fetch-and-compile
and trying to compile. Adding the snippet led to a lot more type errors.
$ tsc
node_modules/@truffle/compile-common/dist/src/types.d.ts:1:47 - error TS2307: Cannot find module '@truffle/contract-schema/spec' or its corresponding type declarations.
1 import type { Abi, ImmutableReferences } from "@truffle/contract-schema/spec";
tsconfig.json
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"strict": true,
"outDir": "dist",
"sourceMap": true
}
}
package.json
{
"name": "fetch-and-compile",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@truffle/fetch-and-compile": "^0.4.0"
}
}
@@ -65,5 +65,56 @@ async function decode(address: string) { | |||
decode("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"); | |||
``` | |||
|
|||
If you want to fetch and compile multiple contracts from the same network, you can use `fetchAndCompileMultiple`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at this point we need to start introducing headings for each exposed interface, so that they remain visually separate. Would be nice also to have an upfront bulleted list at the top (with some preamble), linking to the individual headings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll go back and do that.
OK, I added headers as @gnidan suggested, and added a note about |
packages/fetch-and-compile/README.md
Outdated
@@ -2,7 +2,11 @@ | |||
|
|||
This is used to obtain external verified sourced and compile them. | |||
|
|||
### Usage | |||
Note: If you import this into your TS project, you may need to set `skipLibCheck` in your tsconfig due to an indirect dependency on @truffle/contract-schema. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set is ambiguous here, perhaps enable, or explicitly "set skipLibCheck to true"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the help getting this tested
Thanks to @lsqproduction for noticing we'd forgotten to update this. Hoping these usage examples are sufficient?