Compile hello world error #495
Replies: 1 comment
-
Did you set the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I make guid https://aiken-lang.org/example--hello-world
but compile error
source code:
import {
Blockfrost,
C,
Constr,
Data,
Lucid,
SpendingValidator,
TxHash,
fromHex,
toHex,
utf8ToHex,
} from "https://deno.land/x/lucid@0.8.3/mod.ts";
import * as cbor from "https://deno.land/x/cbor@v1.4.1/index.js";
const lucid = await Lucid.new(
new Blockfrost(
"https://cardano-preview.blockfrost.io/api/v0",
Deno.env.get("BLOCKFROST_API_KEY")
),
"Preview"
);
lucid.selectWalletFromPrivateKey(await Deno.readTextFile("./key.sk"));
const validator = await readValidator();
// --- Supporting functions
async function readValidator(): Promise {
const validator = JSON.parse(await Deno.readTextFile("plutus.json")).validators[0];
return {
type: "PlutusV2",
script: toHex(cbor.encode(fromHex(validator.compiledCode))),
};
}
const publicKeyHash = lucid.utils.getAddressDetails(
await lucid.wallet.address()
).paymentCredential?.hash;
const datum = Data.to(new Constr(0, [publicKeyHash]));
const txHash = await lock(1000000n, { into: validator, owner: datum });
await lucid.awaitTx(txHash);
console.log(
1 tADA locked into the contract at: Tx ID: ${txHash} Datum: ${datum}
);// --- Supporting functions
async function lock(
lovelace: bigint,
{ into, owner }: { into: SpendingValidator; owner: string }
): Promise {
const contractAddress = lucid.utils.validatorToAddress(into);
}
Beta Was this translation helpful? Give feedback.
All reactions