Skip to content

Commit e28b0cc

Browse files
authored
refactor(docs): reformatting docs (usecannon#454)
1 parent 177cdbf commit e28b0cc

File tree

12 files changed

+323742
-101
lines changed

12 files changed

+323742
-101
lines changed

.github/workflows/build-docs.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
branches: [main]
77

8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
812
jobs:
913
build-docs:
1014
runs-on: ubuntu-latest
@@ -27,16 +31,16 @@ jobs:
2731
- 'packages/cli/src/schemas.zod.ts'
2832
2933
- name: Set up Node
30-
if: ${{ steps.file-changes.outputs.schemas_any_changed == 'true' }}
34+
if: ${{ steps.file-changes.outputs.schemas_any_changed }}
3135
uses: actions/setup-node@v2
3236
with:
3337
node-version: '20.5.1'
3438
- name: Build Dependencies
35-
if: ${{ steps.file-changes.outputs.schemas_any_changed == 'true' }}
39+
if: ${{ steps.file-changes.outputs.schemas_any_changed }}
3640
run: |
3741
npm ci
3842
npm run build
3943
4044
- name: Build docs
41-
if: ${{ steps.file-changes.outputs.schemas_any_changed == 'true' }}
45+
if: ${{ steps.file-changes.outputs.schemas_any_changed }}
4246
run: npm run docgen

.gitmodules

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
[submodule "packages/contracts/lib/forge-std"]
2-
path = packages/contracts/lib/forge-std
1+
[submodule "examples/sample-foundry-project/lib/forge-std"]
2+
path = examples/sample-foundry-project/lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
44

5+
[submodule "examples/sample-foundry-project/lib/cannon-std"]
6+
path = examples/sample-foundry-project/lib/cannon-std
7+
url = https://github.com/usecannon/cannon-std
8+
59
[submodule "packages/contracts/lib/openzeppelin-contracts"]
610
path = packages/contracts/lib/openzeppelin-contracts
711
url = https://github.com/openzeppelin/openzeppelin-contracts
Submodule cannon-std added at 321478e
Submodule forge-std added at 1d9650e

packages/builder/src/schemas.zod.ts

+36-8
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const contractSchema = z
9696
)
9797
),
9898
/**
99-
* Constructor or initializer args
99+
* Constructor or initializer args
100100
*/
101101
args: z.array(argsUnion),
102102
/**
@@ -163,10 +163,9 @@ export const importSchema = z
163163
preset: z.string(),
164164
/**
165165
* Previous steps this step is dependent on
166-
* @example
167166
* ```toml
168-
* depends = ['contract.Storage', 'import.Contract']
169-
* ```
167+
* depends = ['contract.Storage', 'import.Contract']
168+
* ```
170169
*/
171170
depends: z.array(
172171
z.string().refine(
@@ -224,6 +223,9 @@ export const invokeSchema = z
224223
(val) => ({ message: `"${val}" must be a valid ethereum address` })
225224
),
226225

226+
/**
227+
* Specify a function to use as the 'from' value in a function call. Example `owner()`.
228+
*/
227229
fromCall: z.object({
228230
/**
229231
* The name of a view function to call on this contract. The result will be used as the from input.
@@ -244,6 +246,9 @@ export const invokeSchema = z
244246
* Override transaction settings
245247
*/
246248
overrides: z.object({
249+
/**
250+
* Gas limit to send along with the transaction
251+
*/
247252
gasLimit: z.string().refine((val) => !!parseInt(val), { message: 'Gas limit is invalid' }),
248253
}),
249254
/**
@@ -361,17 +366,17 @@ export const provisionSchema = z
361366
.object({
362367
/**
363368
* ID of the chain to import the package from
364-
* @default - 13370
369+
* Default - 13370
365370
*/
366371
chainId: z.number().int(),
367372
/**
368373
* Override the preset to use when provisioning this package.
369-
* @default - "main"
374+
* Default - "main"
370375
*/
371376
sourcePreset: z.string(),
372377
/**
373378
* Set the new preset to use for this package.
374-
* @default - "main"
379+
* Default - "main"
375380
*/
376381
targetPreset: z.string(),
377382
/**
@@ -399,9 +404,21 @@ export const provisionSchema = z
399404
);
400405

401406
export const routerSchema = z.object({
407+
/**
408+
* Set of contracts that will be passed to the router
409+
*/
402410
contracts: z.array(z.string()),
411+
/**
412+
* Address to pass to the from call
413+
*/
403414
from: z.string().optional(),
415+
/**
416+
* Used to force new copy of a contract (not actually used)
417+
*/
404418
salt: z.string().optional(),
419+
/**
420+
* List of steps that this action depends on
421+
*/
405422
depends: z.array(z.string()).optional(),
406423
});
407424

@@ -442,7 +459,6 @@ export const chainDefinitionSchema = z
442459
keywords: z.array(z.string()),
443460
/**
444461
* Object that allows the definition of values for use in next steps
445-
* @example
446462
* ```toml
447463
* [settings.owner]
448464
* defaultValue: "some-eth-address"
@@ -470,9 +486,21 @@ export const chainDefinitionSchema = z
470486
* @internal
471487
*/
472488
import: z.record(importSchema),
489+
/**
490+
* @internal
491+
*/
473492
provision: z.record(provisionSchema),
493+
/**
494+
* @internal
495+
*/
474496
contract: z.record(contractSchema),
497+
/**
498+
* @internal
499+
*/
475500
invoke: z.record(invokeSchema),
501+
/**
502+
* @internal
503+
*/
476504
router: z.record(routerSchema),
477505
// ... there may be others that come from plugins
478506
})

0 commit comments

Comments
 (0)