Draft quick README, use ENV var for passing configuration.
This commit is contained in:
parent
1b7be32d74
commit
193792b48f
|
@ -0,0 +1,33 @@
|
||||||
|
# Hello, World!
|
||||||
|
|
||||||
|
An example of an Hello, World! contract using Aiken and [Lucid](https://github.com/spacebudz/lucid).
|
||||||
|
|
||||||
|
See the [full tutorial on aiken-lang.org](https://aiken-lang.org/getting-started/hello-world).
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
```
|
||||||
|
aiken build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Generating Credentials
|
||||||
|
|
||||||
|
```
|
||||||
|
deno run --allow-net --allow-write generate-credentials.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
## Locking Funds
|
||||||
|
|
||||||
|
> **Warning** Require `BLOCKFROST_API_KEY` environment variable to be set.
|
||||||
|
|
||||||
|
```
|
||||||
|
deno run --allow-net --allow-read hello_world-lock.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
## Unlocking Funds
|
||||||
|
|
||||||
|
> **Warning** Require `BLOCKFROST_API_KEY` environment variable to be set.
|
||||||
|
|
||||||
|
```
|
||||||
|
deno run --allow-net --allow-read hello_world-unlock.ts -- TRANSACTION_ID_FROM_LOCK
|
||||||
|
```
|
|
@ -13,7 +13,7 @@ import * as cbor from "https://deno.land/x/cbor@v1.4.1/index.js";
|
||||||
const lucid = await Lucid.new(
|
const lucid = await Lucid.new(
|
||||||
new Blockfrost(
|
new Blockfrost(
|
||||||
"https://cardano-preview.blockfrost.io/api/v0",
|
"https://cardano-preview.blockfrost.io/api/v0",
|
||||||
/* BLOCKFROST API KEY */
|
Deno.env.get('BLOCKFROST_API_KEY'),
|
||||||
),
|
),
|
||||||
"Preview",
|
"Preview",
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,21 +9,21 @@ import {
|
||||||
toHex,
|
toHex,
|
||||||
utf8ToHex
|
utf8ToHex
|
||||||
} from "https://deno.land/x/lucid@0.8.3/mod.ts";
|
} 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";
|
import * as cbor from "https://deno.land/x/cbor@v1.4.1/index.js";
|
||||||
|
|
||||||
const lucid = await Lucid.new(
|
const lucid = await Lucid.new(
|
||||||
new Blockfrost(
|
new Blockfrost(
|
||||||
"https://cardano-preview.blockfrost.io/api/v0",
|
"https://cardano-preview.blockfrost.io/api/v0",
|
||||||
/* BLOCKFROST API KEY */
|
Deno.env.get('BLOCKFROST_API_KEY'),
|
||||||
),
|
),
|
||||||
"Preview",
|
"Preview",
|
||||||
);
|
);
|
||||||
|
|
||||||
lucid.selectWalletFromPrivateKey(await Deno.readTextFile("./key.sk"));
|
lucid.selectWalletFromPrivateKey(await Deno.readTextFile("./key.sk"));
|
||||||
|
|
||||||
const validator = await readValidator("./assets/hello_world/spend/script.cbor");
|
const validator = await readValidator("./assets/hello_world/spend/script.cbor");
|
||||||
|
|
||||||
const utxo = { txHash: '/* Tx ID from hello_world_lock */', outputIndex: 0 };
|
const utxo = { txHash: Deno.args[0], outputIndex: 0 };
|
||||||
|
|
||||||
const redeemer = Data.to(new Constr(0, [ utf8ToHex("Hello, World!")]) );
|
const redeemer = Data.to(new Constr(0, [ utf8ToHex("Hello, World!")]) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue