Resolve "Monaco Playground Typing and Rollup Bundles"

This commit is contained in:
2025-07-13 06:17:53 +00:00
committed by Jim Hamill
parent 50fb4020b6
commit aa3967a060
14 changed files with 572 additions and 225 deletions
+30 -6
View File
@@ -4,6 +4,9 @@ aside: false
<script lang="ts" setup>
import CodeSandbox from '@theme/components/CodeSandbox.vue'
import { useXOCashLibs } from '@theme/utils/useXOCashLibs';
const xocashLibs = useXOCashLibs();
</script>
# Sandbox
@@ -20,10 +23,17 @@ This'll be very useful for:
The below is Address mess.
<!-- NOTE: It is absolutely crucial you leave a blank line before and after the backticks! Otherwise, you'll end up with errors.-->
<CodeSandbox>
<CodeSandbox
:libs="xocashLibs"
height="50em"
editorHeight="30em"
outputHeight="20em"
fullHeight
>
```
const { Address } = await import('https://cdn.jsdelivr.net/npm/@xocash/stack@0.0.2-development.95/+esm');
import { Address } from '@xocash/stack';
const lockscriptHex = Address.from('bitcoincash:qr2084lauctzarqk20kqlhef8gyneqhceqy75wvw8q').toLockscriptHex();
@@ -43,10 +53,17 @@ console.info('yep');
We can have more than one per page too. For example:
<!-- NOTE: It is absolutely crucial you leave a blank line before and after the backticks! Otherwise, you'll end up with errors.-->
<CodeSandbox>
<CodeSandbox
:libs="xocashLibs"
height="50em"
editorHeight="30em"
outputHeight="20em"
fullHeight
>
```
const { BlockchainElectrum } = await import('https://cdn.jsdelivr.net/npm/@xocash/stack@0.0.2-development.95/+esm');
import { BlockchainElectrum } from '@xocash/stack';
const blockchain = new BlockchainElectrum();
@@ -64,10 +81,17 @@ console.log('Transaction Hex', tx.toHex());
The below demonstrates instantiating a wallet.
<!-- NOTE: It is absolutely crucial you leave a blank line before and after the backticks! Otherwise, you'll end up with errors.-->
<CodeSandbox>
<CodeSandbox
:libs="xocashLibs"
height="50em"
editorHeight="30em"
outputHeight="20em"
fullHeight
>
```
const { BlockchainElectrum, WalletP2PKH } = await import('https://cdn.jsdelivr.net/npm/@xocash/stack@0.0.2-development.95/+esm');
import { BlockchainElectrum, WalletP2PKH } from '@xocash/stack';
const wallet = WalletP2PKH.generateRandom({
blockchain: new BlockchainElectrum