-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from MeshJS/docs-update
v1.7.2
- Loading branch information
Showing
25 changed files
with
212 additions
and
75 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
45 changes: 45 additions & 0 deletions
45
apps/playground/src/pages/apis/transaction/basics/get-txbuilder.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,45 @@ | ||
import Link from "~/components/link"; | ||
import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; | ||
import Codeblock from "~/components/text/codeblock"; | ||
|
||
export default function TransactionGetTxbuilder() { | ||
return ( | ||
<TwoColumnsScroll | ||
sidebarTo="getTxbuilder" | ||
title="Get Txbuilder" | ||
leftSection={Left()} | ||
/> | ||
); | ||
} | ||
|
||
function Left() { | ||
let code1 = ``; | ||
code1 += `const tx = new Transaction({ initiator: wallet });\n`; | ||
code1 += `tx.foo();\n`; | ||
code1 += `\n`; | ||
code1 += `tx.txBuilder.bar()\n`; | ||
|
||
let code2 = `tx.txBuilder.meshTxBuilderBody;`; | ||
|
||
return ( | ||
<> | ||
<p> | ||
The <Link href="/apis/txbuilder">TxBuilder</Link> is a powerful | ||
low-level APIs that allows you to build and sign transactions. You can | ||
get a new instance of TxBuilder by calling <code>txBuilder</code>. Doing | ||
so allows you to access the low-level APIs of TxBuilder,{" "} | ||
<Link href="https://docs.meshjs.dev/transactions/classes/MeshTxBuilder"> | ||
check the docs | ||
</Link>{" "} | ||
for all the available methods. | ||
</p> | ||
<Codeblock data={code1} /> | ||
<p> | ||
For example, you can get the <code>meshTxBuilderBody</code> to retrieve | ||
the transaction JSON. This is useful for debugging and understanding how | ||
the transaction is built. | ||
</p> | ||
<Codeblock data={code2} /> | ||
</> | ||
); | ||
} |
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
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
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
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
62 changes: 62 additions & 0 deletions
62
apps/playground/src/pages/apis/utilities/resolvers/resolve-script-hash.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,62 @@ | ||
import { useState } from "react"; | ||
|
||
import { resolveScriptHash } from "@meshsdk/core"; | ||
|
||
import Input from "~/components/form/input"; | ||
import InputTable from "~/components/sections/input-table"; | ||
import LiveCodeDemo from "~/components/sections/live-code-demo"; | ||
import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; | ||
|
||
export default function ResolveScriptHash() { | ||
return ( | ||
<TwoColumnsScroll | ||
sidebarTo="resolveScriptHash" | ||
title="Resolve Script Hash" | ||
leftSection={Left()} | ||
rightSection={Right()} | ||
/> | ||
); | ||
} | ||
|
||
function Left() { | ||
return ( | ||
<> | ||
<p> | ||
<code>resolveScriptHash</code> will return a script hash. For example, | ||
this is useful when you want to convert a script to a policy ID. | ||
</p> | ||
</> | ||
); | ||
} | ||
|
||
function Right() { | ||
const [userInput, setUserInput] = useState<string>( | ||
"8200581c5867c3b8e27840f556ac268b781578b14c5661fc63ee720dbeab663f", | ||
); | ||
|
||
async function runDemo() { | ||
return resolveScriptHash(userInput); | ||
} | ||
|
||
let codeSnippet = `resolveScriptHash('${userInput}')`; | ||
|
||
return ( | ||
<LiveCodeDemo | ||
title="Resolve Script Hash" | ||
subtitle="Convert script to hash (like policy ID)" | ||
code={codeSnippet} | ||
runCodeFunction={runDemo} | ||
> | ||
<InputTable | ||
listInputs={[ | ||
<Input | ||
value={userInput} | ||
onChange={(e) => setUserInput(e.target.value)} | ||
label=" script address" | ||
key={0} | ||
/>, | ||
]} | ||
/> | ||
</LiveCodeDemo> | ||
); | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.