Skip to content

Commit a628357

Browse files
authored
Merge pull request #3 from SubstrateLabs/hwwu/toolchain-update
2 parents eb15ace + 73fbb1b commit a628357

File tree

12 files changed

+102
-732
lines changed

12 files changed

+102
-732
lines changed

_internal/_template/README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@
99
export SUBSTRATE_API_KEY=ENTER_YOUR_KEY
1010

1111
# Run the TypeScript example
12+
13+
# If using tsx:
1214
cd typescript # Navigate to the typescript example
1315
npm install # Install dependencies
14-
ts-node example.ts # Run the example
16+
npx tsx example.ts # Run the example
17+
18+
# If using Deno:
19+
cd typescript
20+
deno run example.ts
21+
22+
# Run the Python example
1523

1624
# If using Poetry:
1725
cd python # Navigate to the python example
@@ -20,9 +28,9 @@ poetry run main # Run the example
2028

2129
# If using Rye:
2230
# Update pyproject.toml to switch to Rye.
23-
cd python # Navigate to the python example
24-
rye sync # Install dependencies and build the example
25-
rye run main # Run the example
31+
cd python
32+
rye sync
33+
rye run main
2634
```
2735

2836
</details>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Substrate Example Templates in Typescript
2+
3+
This is a Substrate example template written in Typescript. To run this example,
4+
5+
```bash
6+
# Set your API key as an environment variable.
7+
# Get one here https://www.substrate.run/dashboard/keys if this is your first time.
8+
export SUBSTRATE_API_KEY=<your Substrate API key>
9+
10+
# Navigate to the python example directory.
11+
cd typescript
12+
```
13+
14+
To run the example with tsx (default), run the following.
15+
16+
```bash
17+
npx tsx ./example.ts
18+
19+
# Or you can use the package.json scripts
20+
npm run start
21+
```
22+
23+
To run the example with Deno, uncomment the Deno sections in `example.ts` and
24+
run the following.
25+
26+
```bash
27+
deno run ./example.ts
28+
```

_internal/_template/typescript/example.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#!/usr/bin/env -S npx ts-node --transpileOnly
2-
import { Substrate, ComputeText } from "substrate";
1+
import { ComputeText, Substrate } from "substrate";
2+
3+
// Uncomment the following line if using Deno
4+
// import process from "node:process";
35

46
async function main() {
57
const apiKey = process.env["SUBSTRATE_API_KEY"] || "YOUR_API_KEY";

0 commit comments

Comments
 (0)