chore(gift_card): use kupmios backed by demeter for lucid
This commit is contained in:
parent
057102c491
commit
4e380012fb
|
@ -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)
|
||||
|
|
|
@ -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<Lucid | null>(null);
|
||||
const [kupoUrl, setKupoUrl] = useState<string>("");
|
||||
const [ogmiosUrl, setOgmiosUrl] = useState<string>("");
|
||||
const [tokenName, setTokenName] = useState<string>("");
|
||||
const [giftADA, setGiftADA] = useState<string | undefined>();
|
||||
const [lockTxHash, setLockTxHash] = useState<string | undefined>(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) {
|
|||
<div>
|
||||
{!lucid
|
||||
? (
|
||||
<Input
|
||||
type="password"
|
||||
id="blockfrostApiKey"
|
||||
onKeyDown={async (e) => {
|
||||
if (e.key === "Enter") {
|
||||
await setupLucid(e.currentTarget.value);
|
||||
}
|
||||
}}
|
||||
<form
|
||||
class="mt-10 grid grid-cols-1 gap-y-8"
|
||||
onSubmit={setupLucid}
|
||||
>
|
||||
Blockfrost API KEY (PRESS ENTER)
|
||||
</Input>
|
||||
<Input
|
||||
type="text"
|
||||
id="kupoUrl"
|
||||
onInput={(e) => setKupoUrl(e.currentTarget.value)}
|
||||
>
|
||||
Kupo URL
|
||||
</Input>
|
||||
<Input
|
||||
type="text"
|
||||
id="ogmiosUrl"
|
||||
onInput={(e) => setOgmiosUrl(e.currentTarget.value)}
|
||||
>
|
||||
Ogmios URL
|
||||
</Input>
|
||||
|
||||
<Button type="submit">Setup Lucid</Button>
|
||||
</form>
|
||||
)
|
||||
: (
|
||||
<form
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
},
|
||||
"validators": [
|
||||
{
|
||||
"title": "main.gift_card",
|
||||
"title": "oneshot.gift_card",
|
||||
"redeemer": {
|
||||
"title": "rdmr",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/main~1Action"
|
||||
"$ref": "#/definitions/oneshot~1Action"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
|
@ -29,11 +29,11 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"compiledCode": "59029b0100003232323232323232323232232222533300832323232323232323232323232323232533301d30200021323232533301b3370e0029000099299980e19b87003480084cdc780200c0a50301332533301c3370e9000180f9baa0011001153301e4912a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001632323300100d23375e6644646660020029000001911199981199b8700400202a23330040043370000690011816000800980b000a40000326002002444a666046004266e9520024bd700991929998101801801099ba548000cc0980092f5c0266600a00a002006604e006604a0042a66603666e1c008cdc0a40009001099b8f00301714a0603a6ea8050dd6980e8011bae301b001153301a491364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016301e00132320010013232332232332232533301e3370e00290010801099190009bab302600130160033020375400400297adef6c6033223300500200100200100300a3001001222533301e00213374a900125eb804c8c8c8c94ccc074cdc7802800899ba548000cc08cdd300125eb804ccc01c01c00c014dd7180f8019bab301f002302200330200023756603800260380026036002603400260320046eb0c05c004c01c014dd7180a8009802a99980699b8748000c040dd500088008a99807a492a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001630130013013002301100130010022300d37540022930b1bae0013001001222533300900214984cc014c004c02c008ccc00c00cc0300080055cd2b9b5738aae7555cf2ab9f5740ae855d101",
|
||||
"hash": "9185bf20c9bbdd7062d9b2dc11a03290bfb256938395d56855baee81"
|
||||
"compiledCode": "590288010000323232323232323232323232323232232222533300c323232323232323232323232323232533302030230021323232533301e3370e9000000899299980f99b87003480084cdc780200b8a50301c32533301f3370e9000180f00088008a99810a492a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001632323300100d23375e6603a603e002900000c18008009112999813001099ba5480092f5c026464a6660466006004266e952000330290024bd700999802802800801981500198140010a99980f19b8700233702900024004266e3c00c058528180e0099bad3020002375c603c0022a6603a9201334c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e206578706563746564001630210013200132323232533301d3370e90010008a5eb7bdb1804c8c8004dd59812800980d801180d8009980080180518008009112999810801099ba5480092f5c0264646464a66604066e3c0140044cdd2a40006604c6e980092f5c0266600e00e00600a6eb8c08800cdd59811001181280198118011bab301f001301f001301e001301d001301c00237586034002602000a6eb8c060004c0394ccc040cdc3a4000601e00220022a660249212a4578706563746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016301600130160023014001300a001149858dd7000980080091129998068010a4c2660126002601e00466600600660200040026600200290001111199980399b8700100300e233330050053370000890011808000801001118039baa001230053754002ae695cdab9c5573aaae7955cfaba05742ae89",
|
||||
"hash": "502ff5bb41c7b02e4950ad25572391efc87205cd6ab17b5826e625cb"
|
||||
},
|
||||
{
|
||||
"title": "main.redeem",
|
||||
"title": "oneshot.redeem",
|
||||
"datum": {
|
||||
"title": "_d",
|
||||
"schema": {
|
||||
|
@ -60,8 +60,8 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"compiledCode": "5901980100003232323232323232323232232232222533300a323232323232323232323232533301b301e0021323253330183370e00266e052000480084cdc780100a0a50375a60360046eb8c06400454cc0612401364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016301c00132320010013232332232332232533301c3370e00290010801099190009bab30240013012003301e375400400297adef6c603322330050020010020010030103001001222533301c00213374a900125eb804c8c8c8c94ccc06ccdc7802800899ba548000cc084dd300125eb804ccc01c01c00c014dd7180e8019bab301d0023020003301e00237566034002603400260320026030002602e00260080026028002600400644646660020029000001911199980819b870040020172333004004337000069001180c800800918079baa001149858dd70009bae0013001001222533300900214984cc014c004c02c008ccc00c00cc0300080055cd2b9b5738aae7555cf2ab9f5740ae855d11",
|
||||
"hash": "e1c247d17b275dc889a0437d23f7791a2ea60a6d1b84612572668ec2"
|
||||
"compiledCode": "5901830100003232323232323232323232323232232232222533300d32323232323232323232533301c301f0021323253330193370e00266e052000480084cdc78010090a50375a60380046eb8c06800454cc0652401334c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2065787065637465640016301d001320013232323253330193370e90010008a5eb7bdb1804c8c8004dd59810800980c001180d9baa0013300100300e3001001222533301d00213374a900125eb804c8c8c8c94ccc070cdc7802800899ba548000cc088dd300125eb804ccc01c01c00c014dd7180f0019bab301e0023021003301f002375660360026036002603400260320026030002601c002602a00260180022930b1bae001375c0026002002444a66601800429309980418009807001199801801980780100099800800a40004444666600c66e1c00400c0348cccc014014cdc000224004601e0020040044600c6ea80055cd2b9b5738aae7555cf2ab9f5740ae855d11",
|
||||
"hash": "f58be496ad6e6233bfc241e35ba089cc6eb167945df2f62373d16b51"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
|
@ -113,7 +113,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"main/Action": {
|
||||
"oneshot/Action": {
|
||||
"title": "Action",
|
||||
"anyOf": [
|
||||
{
|
||||
|
@ -131,4 +131,4 @@
|
|||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export type LocalCache = {
|
|||
|
||||
export function readValidators(): Validators {
|
||||
const redeem = (blueprint as Blueprint).validators.find((v) =>
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue