@foundry-rs/cast 1.4.4 → 1.5.0-nightly.20251116.cd86772

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 +34 -1
  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
@@ -28,7 +28,22 @@ if (!platformPackage) {
28
28
  process.exit(1)
29
29
  }
30
30
 
31
- NodeChildProcess.spawn(selectBinaryPath(), process.argv.slice(2), { stdio: 'inherit' })
31
+ const child = NodeChildProcess.spawn(
32
+ selectBinaryPath(),
33
+ process.argv.slice(2),
34
+ { stdio: 'inherit' }
35
+ )
36
+
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)
32
47
 
33
48
  /**
34
49
  * Determines which tool wrapper is executing.
@@ -117,3 +132,21 @@ function selectBinaryPath() {
117
132
 
118
133
  return NodePath.join(__dirname, '..', 'dist', binaryName)
119
134
  }
135
+
136
+ /**
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
140
+ */
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)
152
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foundry-rs/cast",
3
- "version": "1.4.4",
3
+ "version": "1.5.0-nightly.20251116.cd86772",
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",
20
- "@foundry-rs/cast-darwin-amd64": "1.4.4",
21
- "@foundry-rs/cast-linux-arm64": "1.4.4",
22
- "@foundry-rs/cast-linux-amd64": "1.4.4",
23
- "@foundry-rs/cast-win32-amd64": "1.4.4"
19
+ "@foundry-rs/cast-darwin-arm64": "1.5.0-nightly.20251116.cd86772",
20
+ "@foundry-rs/cast-darwin-amd64": "1.5.0-nightly.20251116.cd86772",
21
+ "@foundry-rs/cast-linux-arm64": "1.5.0-nightly.20251116.cd86772",
22
+ "@foundry-rs/cast-linux-amd64": "1.5.0-nightly.20251116.cd86772",
23
+ "@foundry-rs/cast-win32-amd64": "1.5.0-nightly.20251116.cd86772"
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",