diff --git a/examples/hello_world/generate-credentials.ts b/examples/hello_world/generate-credentials.ts index cd9ff01b..dde0352d 100644 --- a/examples/hello_world/generate-credentials.ts +++ b/examples/hello_world/generate-credentials.ts @@ -2,9 +2,13 @@ import { Lucid } from "https://deno.land/x/lucid@0.8.3/mod.ts"; const lucid = await Lucid.new(undefined, "Preview"); -const privateKey = lucid.utils.generatePrivateKey(); +const privateKey = lucid + .utils + .generatePrivateKey(); await Deno.writeTextFile("key.sk", privateKey); -const address = await lucid.selectWalletFromPrivateKey(privateKey).wallet +const address = await lucid + .selectWalletFromPrivateKey(privateKey) + .wallet .address(); await Deno.writeTextFile("key.addr", address); diff --git a/examples/hello_world/hello_world-lock.ts b/examples/hello_world/hello_world-lock.ts index 3e060248..8acdfd3a 100644 --- a/examples/hello_world/hello_world-lock.ts +++ b/examples/hello_world/hello_world-lock.ts @@ -25,8 +25,10 @@ const validator = await readValidator(); // --- Supporting functions async function readValidator(): Promise { - const validator = - JSON.parse(await Deno.readTextFile("plutus.json")).validators[0]; + const validator = JSON + .parse(await Deno.readTextFile("plutus.json")) + .validators[0]; + return { type: "PlutusV2", script: toHex(cbor.encode(fromHex(validator.compiledCode))), @@ -40,12 +42,12 @@ const publicKeyHash = lucid.utils const datum = Data.to(new Constr(0, [publicKeyHash])); -const txHash = await lock(BigInt(1000000), { into: validator, owner: datum }); +const txHash = await lock(1000000n, { into: validator, owner: datum }); await lucid.awaitTx(txHash); -console.log(`1 ADA locked into the contract at: - Tx Hash: ${txHash} +console.log(`1 tADA locked into the contract at: + Tx ID: ${txHash} Datum: ${datum} `); diff --git a/examples/hello_world/hello_world-unlock.ts b/examples/hello_world/hello_world-unlock.ts index c15b391e..d7a05377 100644 --- a/examples/hello_world/hello_world-unlock.ts +++ b/examples/hello_world/hello_world-unlock.ts @@ -34,10 +34,11 @@ const unlockTxHash = await unlock(utxo, { using: redeemer, }); + await lucid.awaitTx(unlockTxHash); -console.log(`1 ADA unlocked from the contract - Tx Hash: ${unlockTxHash} +console.log(`1 tADA unlocked from the contract + Tx ID: ${unlockTxHash} Redeemer: ${redeemer} `); @@ -64,8 +65,10 @@ async function unlock( } async function readValidator(): Promise { - const validator = - JSON.parse(await Deno.readTextFile("plutus.json")).validators[0]; + const validator = JSON + .parse(await Deno.readTextFile("plutus.json")) + .validators[0]; + return { type: "PlutusV2", script: toHex(cbor.encode(fromHex(validator.compiledCode))),