@foundry-rs/cast 1.4.4-nightly.20251104.804ad9f → 1.4.4-nightly.20251111.25196fa

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.
Files changed (3) hide show
  1. package/README.md +49 -1
  2. package/bin.mjs +27 -8
  3. package/package.json +14 -6
package/README.md CHANGED
@@ -1,5 +1,53 @@
1
- # Cast
1
+ # [Cast](https://getfoundry.sh/cast)
2
2
 
3
3
  Cast is a Swiss Army knife for interacting with Ethereum applications from the command line.
4
4
  You can make smart contract calls, send transactions, or retrieve any type of chain data - all from your command-line!
5
5
  The cast binary can be used both within and outside of a Foundry project.
6
+
7
+ ## Usage
8
+
9
+ ### One-off commands
10
+
11
+ Example
12
+
13
+ ```sh
14
+ npx --yes @foundry-rs/cast@nightly block-number
15
+ ```
16
+
17
+ More generally
18
+
19
+ ```sh
20
+ npx --yes @foundry-rs/cast@<version|nightly> <command> [args...]
21
+ ```
22
+
23
+ ### Install then use
24
+
25
+ locally to your project
26
+
27
+ ```sh
28
+ npm add @foundry-rs/cast@nightly
29
+ npx cast <command> [args...]
30
+ ```
31
+
32
+ globally
33
+
34
+ ```sh
35
+ npm add --global @foundry-rs/cast@nightly
36
+ cast <command> [args...]
37
+ ```
38
+
39
+ ---
40
+
41
+ Also works with `deno`, `bun`, and `pnpm`:
42
+
43
+ ```sh
44
+ deno run --quiet --allow-all npm:@foundry-rs/cast@nightly <command> [args...]
45
+ ```
46
+
47
+ ```sh
48
+ bun x @foundry-rs/cast@nightly <command> [args...]
49
+ ```
50
+
51
+ ```sh
52
+ pnpm dlx --silent @foundry-rs/cast@nightly <command> [args...]
53
+ ```
package/bin.mjs CHANGED
@@ -29,13 +29,21 @@ if (!platformPackage) {
29
29
  }
30
30
 
31
31
  const child = NodeChildProcess.spawn(
32
- selectBinaryPath(),
33
- process.argv.slice(2),
34
- { stdio: 'inherit' }
32
+ selectBinaryPath(),
33
+ process.argv.slice(2),
34
+ { stdio: 'inherit' }
35
35
  )
36
36
 
37
- process.on('SIGINT', killChild)
38
- process.on('SIGTERM', killChild)
37
+ /**
38
+ * @type {Record<'SIGINT' | 'SIGTERM', () => void>}
39
+ */
40
+ const signalHandlers = {
41
+ SIGINT: () => forwardSignal('SIGINT'),
42
+ SIGTERM: () => forwardSignal('SIGTERM')
43
+ }
44
+
45
+ for (const [signal, handler] of Object.entries(signalHandlers))
46
+ process.on(signal, handler)
39
47
 
40
48
  /**
41
49
  * Determines which tool wrapper is executing.
@@ -126,8 +134,19 @@ function selectBinaryPath() {
126
134
  }
127
135
 
128
136
  /**
129
- * Kills the child process.
137
+ * Forwards a received signal to the child process, then re-emits it locally to
138
+ * preserve Node.js default exit semantics.
139
+ * @param {'SIGINT' | 'SIGTERM'} signal
130
140
  */
131
- function killChild() {
132
- child.kill()
141
+ function forwardSignal(signal) {
142
+ try {
143
+ if (!child.killed)
144
+ child.kill(signal)
145
+ } catch (error) {
146
+ if (!error || (typeof error === 'object' && 'code' in error && error.code !== 'ESRCH'))
147
+ throw error
148
+ }
149
+
150
+ process.off(signal, signalHandlers[signal])
151
+ process.kill(process.pid, signal)
133
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foundry-rs/cast",
3
- "version": "1.4.4-nightly.20251104.804ad9f",
3
+ "version": "1.4.4-nightly.20251111.25196fa",
4
4
  "type": "module",
5
5
  "homepage": "https://getfoundry.sh/cast",
6
6
  "description": "Swiss Army knife for interacting with Ethereum applications from the command line",
@@ -16,17 +16,25 @@
16
16
  "postinstall": "TARGET_TOOL=cast node ./postinstall.mjs"
17
17
  },
18
18
  "optionalDependencies": {
19
- "@foundry-rs/cast-darwin-arm64": "1.4.4-nightly.20251104.804ad9f",
20
- "@foundry-rs/cast-darwin-amd64": "1.4.4-nightly.20251104.804ad9f",
21
- "@foundry-rs/cast-linux-arm64": "1.4.4-nightly.20251104.804ad9f",
22
- "@foundry-rs/cast-linux-amd64": "1.4.4-nightly.20251104.804ad9f",
23
- "@foundry-rs/cast-win32-amd64": "1.4.4-nightly.20251104.804ad9f"
19
+ "@foundry-rs/cast-darwin-arm64": "1.4.4-nightly.20251111.25196fa",
20
+ "@foundry-rs/cast-darwin-amd64": "1.4.4-nightly.20251111.25196fa",
21
+ "@foundry-rs/cast-linux-arm64": "1.4.4-nightly.20251111.25196fa",
22
+ "@foundry-rs/cast-linux-amd64": "1.4.4-nightly.20251111.25196fa",
23
+ "@foundry-rs/cast-win32-amd64": "1.4.4-nightly.20251111.25196fa"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public",
27
27
  "provenance": true,
28
28
  "registry": "https://registry.npmjs.org"
29
29
  },
30
+ "keywords": [
31
+ "foundry",
32
+ "testing",
33
+ "ethereum",
34
+ "solidity",
35
+ "blockchain",
36
+ "smart-contracts"
37
+ ],
30
38
  "license": "MIT OR Apache-2.0",
31
39
  "repository": {
32
40
  "directory": "npm",