-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6efc9d5
commit d29184f
Showing
1 changed file
with
79 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<title>Merkleization Flow</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<!-- This import map tells the browser what version of the SDK to use, the route is rewritten by the | ||
local web server to point to the correct version --> | ||
<script src="/importmap"></script> | ||
</head> | ||
<body> | ||
<script type="module"> | ||
import { getRuntimeUrl } from "../js/poc-helpers.js"; | ||
import { mkRuntimeLifecycle } from "@marlowe.io/runtime-lifecycle/browser"; | ||
import { mkRestClient } from "@marlowe.io/runtime-rest-client"; | ||
|
||
const runtimeURL = getRuntimeUrl(); | ||
const walletName = "nami"; | ||
|
||
const restClient = mkRestClient(runtimeURL); | ||
const runtimeLifeCycle = await mkRuntimeLifecycle({ | ||
runtimeURL, | ||
walletName, | ||
}); | ||
|
||
const contract_pt1_Label = "mycontractpart1"; | ||
const contract_pt2_Label = "mycontractpart2"; | ||
const contract_pt3_Label = "mycontractpart3"; | ||
|
||
const contract_pt1 = { | ||
let: "x", | ||
be: 5n, | ||
then: { ref: contract_pt2_Label }, | ||
}; | ||
const contract_pt2 = { | ||
let: "y", | ||
be: { use_value: "x" }, | ||
then: { ref: contract_pt3_Label }, | ||
}; | ||
|
||
const contract_pt3 = { let: "z", be: { use_value: "y" }, then: "close" }; | ||
|
||
const runtimeGood = await restClient.healthcheck(); | ||
if (!runtimeGood) throw "Healthcheck failed!"; | ||
|
||
debugger; | ||
|
||
const { contractSourceId, intermediateIds } = | ||
await restClient.createContractSources(contract_pt1_Label, [ | ||
{ type: "contract", label: contract_pt1_Label, contract_pt1 }, | ||
{ type: "contract", label: contract_pt2_Label, contract_pt2 }, | ||
{ type: "contract", label: contract_pt3_Label, contract_pt3 }, | ||
]); | ||
|
||
debugger; | ||
|
||
const contract = await restClient.getContractSourceById({ | ||
contractSourceId, | ||
}); | ||
|
||
debugger; | ||
|
||
const { results: adjacencyResults } = | ||
await restClient.getContractSourceAdjacency({ | ||
contractSourceId, | ||
}); | ||
|
||
debugger; | ||
|
||
const { results: closureResults } = | ||
await restClient.getContractSourceClosure({ | ||
contractSourceId, | ||
}); | ||
|
||
debugger; | ||
</script> | ||
</body> | ||
</html> |