-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:change layout of value utilities documentation
- Loading branch information
1 parent
e55b896
commit 5e81f1e
Showing
25 changed files
with
1,354 additions
and
1,091 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
apps/playground/src/pages/apis/data/value/addasset-operator.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,60 @@ | ||
import { Asset, MeshValue } from "@meshsdk/common"; | ||
|
||
import LiveCodeDemo from "~/components/sections/live-code-demo"; | ||
import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; | ||
|
||
export default function AddassetOperator() { | ||
return ( | ||
<TwoColumnsScroll | ||
sidebarTo="AddassetOperator" | ||
title="Add an asset to the Value class's value record with parameters - asset" | ||
leftSection={Left()} | ||
rightSection={Right()} | ||
/> | ||
); | ||
} | ||
|
||
function Left() { | ||
return ( | ||
<> | ||
<p> | ||
<code>addAsset</code> Add an asset to the Value class's value record | ||
with parameters: | ||
</p> | ||
<ul> | ||
<b>asset</b> - Asset to add | ||
</ul> | ||
</> | ||
); | ||
} | ||
|
||
function Right() { | ||
async function runaddassetDemo() { | ||
const value = new MeshValue(); | ||
const singleAsset: Asset = { | ||
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234", | ||
quantity: "100", | ||
}; | ||
value.addAsset(singleAsset); | ||
return value.value; | ||
} | ||
|
||
let code = ` | ||
import { MeshValue } from "@meshsdk/common"; | ||
const value = new MeshValue(); | ||
const singleAsset: Asset = { unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234", quantity: "100" }; | ||
value.addAsset(singleAsset); | ||
return value.value; | ||
`; | ||
|
||
return ( | ||
<> | ||
<LiveCodeDemo | ||
title="addAsset" | ||
subtitle="Add an asset to the Value class's value record with parameters - asset" | ||
code={code} | ||
runCodeFunction={runaddassetDemo} | ||
/> | ||
</> | ||
); | ||
} |
73 changes: 73 additions & 0 deletions
73
apps/playground/src/pages/apis/data/value/addassets-operator.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,73 @@ | ||
import { Asset, MeshValue } from "@meshsdk/common"; | ||
|
||
import LiveCodeDemo from "~/components/sections/live-code-demo"; | ||
import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; | ||
|
||
export default function AddassetsOperator() { | ||
return ( | ||
<TwoColumnsScroll | ||
sidebarTo="AddassetsOperator" | ||
title="Add an array of assets to the Value class's value record with parameters - assets" | ||
leftSection={Left()} | ||
rightSection={Right()} | ||
/> | ||
); | ||
} | ||
|
||
function Left() { | ||
return ( | ||
<> | ||
<p> | ||
<code>addAssets</code> Add an array of assets to the Value class's value | ||
record with parameters: | ||
</p> | ||
<ul> | ||
<b>assets</b> - Asset[] to add | ||
</ul> | ||
</> | ||
); | ||
} | ||
|
||
function Right() { | ||
async function runaddassetsDemo() { | ||
const value = new MeshValue(); | ||
const assets: Asset[] = [ | ||
{ | ||
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234", | ||
quantity: "100", | ||
}, | ||
{ unit: "lovelace", quantity: "10" }, | ||
{ | ||
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234", | ||
quantity: "100", | ||
}, | ||
{ unit: "lovelace", quantity: "10" }, | ||
]; | ||
value.addAssets(assets); | ||
return value.value; | ||
} | ||
|
||
let code = ` | ||
import { MeshValue } from "@meshsdk/common"; | ||
const value = new MeshValue(); | ||
const assets: Asset[] = [ | ||
{ unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234", quantity: "100" }, | ||
{ unit: "lovelace", quantity: "10" }, | ||
{ unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234", quantity: "100" }, | ||
{ unit: "lovelace", quantity: "10" }, | ||
]; | ||
value.addAssets(assets); | ||
return value.value; | ||
`; | ||
|
||
return ( | ||
<> | ||
<LiveCodeDemo | ||
title="addAssets" | ||
subtitle="Add an array of assets to the Value class's value record with parameters - assets" | ||
code={code} | ||
runCodeFunction={runaddassetsDemo} | ||
/> | ||
</> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.