-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add vesting tutorial and init serializer
- Loading branch information
1 parent
116d279
commit 61edb5d
Showing
7 changed files
with
528 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 0 additions & 70 deletions
70
apps/playground/src/pages/apis/utilities/serializers/resolve-data-hash.tsx
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
apps/playground/src/pages/apis/utilities/serializers/serialize-native-script.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
deserializeAddress, | ||
NativeScript, | ||
serializeNativeScript, | ||
} from "@meshsdk/core"; | ||
|
||
import LiveCodeDemo from "~/components/sections/live-code-demo"; | ||
import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; | ||
import { demoAddresses } from "~/data/cardano"; | ||
|
||
export default function SerializeNativeScript() { | ||
return ( | ||
<TwoColumnsScroll | ||
sidebarTo="serializeNativeScript" | ||
title="Serialize Native Script" | ||
leftSection={Left()} | ||
rightSection={Right()} | ||
/> | ||
); | ||
} | ||
|
||
function Left() { | ||
return ( | ||
<> | ||
<p>Serialize Native script into bech32 address.</p> | ||
</> | ||
); | ||
} | ||
|
||
function Right() { | ||
async function runDemo() { | ||
const { pubKeyHash: keyHash } = deserializeAddress( | ||
demoAddresses.testnetPayment, | ||
); | ||
|
||
const nativeScript: NativeScript = { | ||
type: "all", | ||
scripts: [ | ||
{ | ||
type: "before", | ||
slot: "99999999", | ||
}, | ||
{ | ||
type: "sig", | ||
keyHash: keyHash, | ||
}, | ||
], | ||
}; | ||
|
||
const address = serializeNativeScript(nativeScript); | ||
|
||
return address; | ||
} | ||
|
||
let codeSnippet = ``; | ||
|
||
return ( | ||
<LiveCodeDemo | ||
title="Serialize Native Script" | ||
subtitle="Serialize Native script into bech32 address" | ||
code={codeSnippet} | ||
runCodeFunction={runDemo} | ||
></LiveCodeDemo> | ||
); | ||
} |
Oops, something went wrong.