-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update codegen to use the latest OpenAPI spec (#81)
* Update codegen to use the latest OpenAPI spec * Update RunPython example
- Loading branch information
1 parent
e0b2f75
commit 2912147
Showing
10 changed files
with
916 additions
and
1,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env -S npx ts-node --transpileOnly | ||
|
||
import { Substrate, RunPython } from "substrate"; | ||
|
||
async function main() { | ||
const SUBSTRATE_API_KEY = process.env["SUBSTRATE_API_KEY"]; | ||
|
||
const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY }); | ||
|
||
const node = new RunPython({ | ||
code: "import numpy as np; print(SB_IN['foo']); SB_OUT['result']=np.sum([1,2]).item()", | ||
input: { | ||
foo: "bar", | ||
}, | ||
pip_install: ["numpy"], | ||
}); | ||
|
||
const res = await substrate.run(node); | ||
|
||
console.log(res.get(node)); | ||
} | ||
main(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20240418.20240430 | ||
20240530.20240531 |
Oops, something went wrong.