Skip to content

Commit efe9952

Browse files
committed
wip
1 parent 93f722d commit efe9952

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

examples/package.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,23 @@ async function main() {
2323
{ id: "B" },
2424
);
2525

26+
// publish the module on substrate.run
2627
// const publication = await substrate.module.publish({
2728
// name: "my reusable graph",
2829
// nodes: [a, b],
2930
// inputs: { x, y, z },
3031
// });
3132

32-
const p = new Module(
33+
// update the module on substrate.run
34+
// const updated = await substrate.module.publish({
35+
// id: publication.id,
36+
// name: "my reusable graph (edited)",
37+
// nodes: [a, b],
38+
// inputs: { x, y, z },
39+
// });
40+
41+
// using the module from JSON
42+
const mod = new Module(
3343
{
3444
json: substrate.module.serialize({
3545
nodes: [a, b],
@@ -47,17 +57,29 @@ async function main() {
4757
{ id: "Module" },
4858
);
4959

60+
// using the module from publication/module id
61+
// const mod = new Module({
62+
// id: publication.id,
63+
// inputs: { y: "yyy", z: { arr: ["123"] } },
64+
// });
65+
66+
// using the module from publication/module uri
67+
// const mod = new Module({
68+
// uri: publication.uri,
69+
// inputs: { y: "yyy", z: { arr: ["123"] } },
70+
// });
71+
5072
const c = new Box(
5173
{
5274
value: {
53-
"1": p.future.get("A.value.z.arr[0]"),
54-
"2": p.future.get("B.value.b"),
75+
"1": mod.future.get("A.value.z.arr[0]"),
76+
"2": mod.future.get("B.value.b"),
5577
},
5678
},
5779
{ id: "C" },
5880
);
5981

60-
const res = await substrate.run(p, c);
82+
const res = await substrate.run(mod, c);
6183
console.log("res", JSON.stringify(res.json, null, 2));
6284
}
6385
main();

0 commit comments

Comments
 (0)