diff --git a/examples/gift_card/README.md b/examples/gift_card/README.md index 3fcf9612..ea504039 100644 --- a/examples/gift_card/README.md +++ b/examples/gift_card/README.md @@ -13,12 +13,13 @@ This will watch the project directory and restart as necessary. ## What's This? This is an example of a gift card. With these contracts you can lock anything -and have it be unlockable only with a simultaneously minted NFT. This -minted NFT holds the power to unlock the assets and is considered the "gift card". +and have it be unlockable only with a simultaneously minted NFT. This minted NFT +holds the power to unlock the assets and is considered the "gift card". ## Tech -* [Aiken](https://aiken-lang.org) -* [Deno](https://deno.land) -* [fresh](https://fresh.deno.dev) -* [lucid](https://github.com/spacebudz/lucid) +- [Aiken](https://aiken-lang.org) +- [Demeter](https://demeter.run) +- [Deno](https://deno.land) +- [fresh](https://fresh.deno.dev) +- [lucid](https://github.com/spacebudz/lucid) diff --git a/examples/gift_card/islands/App.tsx b/examples/gift_card/islands/App.tsx index e717b490..c3f0aeef 100644 --- a/examples/gift_card/islands/App.tsx +++ b/examples/gift_card/islands/App.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "preact/hooks"; -import { Blockfrost, Constr, Data, fromText, Lucid } from "lucid/mod.ts"; +import { Constr, Data, fromText, Kupmios, Lucid } from "lucid/mod.ts"; import { Input } from "~/components/Input.tsx"; import { Button } from "~/components/Button.tsx"; @@ -17,6 +17,8 @@ export interface AppProps { export default function App({ validators }: AppProps) { const [lucid, setLucid] = useState(null); + const [kupoUrl, setKupoUrl] = useState(""); + const [ogmiosUrl, setOgmiosUrl] = useState(""); const [tokenName, setTokenName] = useState(""); const [giftADA, setGiftADA] = useState(); const [lockTxHash, setLockTxHash] = useState(undefined); @@ -29,11 +31,13 @@ export default function App({ validators }: AppProps) { AppliedValidators | null >(null); - const setupLucid = async (blockfrostApiKey: string) => { + const setupLucid = async (e: Event) => { + e.preventDefault(); + const lucid = await Lucid.new( - new Blockfrost( - "https://cardano-preprod.blockfrost.io/api/v0", - blockfrostApiKey, + new Kupmios( + kupoUrl, + ogmiosUrl, ), "Preprod", ); @@ -200,17 +204,27 @@ export default function App({ validators }: AppProps) {
{!lucid ? ( - { - if (e.key === "Enter") { - await setupLucid(e.currentTarget.value); - } - }} +
- Blockfrost API KEY (PRESS ENTER) - + setKupoUrl(e.currentTarget.value)} + > + Kupo URL + + setOgmiosUrl(e.currentTarget.value)} + > + Ogmios URL + + + +
) : (
- v.title === "main.redeem" + v.title === "oneshot.redeem" ); if (!redeem) { @@ -34,7 +34,7 @@ export function readValidators(): Validators { } const giftCard = (blueprint as Blueprint).validators.find((v) => - v.title === "main.gift_card" + v.title === "oneshot.gift_card" ); if (!giftCard) { diff --git a/examples/gift_card/validators/main.ak b/examples/gift_card/validators/oneshot.ak similarity index 100% rename from examples/gift_card/validators/main.ak rename to examples/gift_card/validators/oneshot.ak