diff --git a/package-lock.json b/package-lock.json index ca823ab..d5655a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -332,7 +332,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -342,7 +341,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -352,7 +350,6 @@ "version": "7.26.3", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", - "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.26.3" @@ -368,7 +365,6 @@ "version": "7.26.3", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", - "dev": true, "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.25.9", @@ -1469,7 +1465,6 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { @@ -3936,7 +3931,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.13.tgz", "integrity": "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==", - "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.25.3", @@ -3950,7 +3944,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.13.tgz", "integrity": "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==", - "dev": true, "license": "MIT", "dependencies": { "@vue/compiler-core": "3.5.13", @@ -3961,7 +3954,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.13.tgz", "integrity": "sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==", - "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.25.3", @@ -3979,7 +3971,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.13.tgz", "integrity": "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==", - "dev": true, "license": "MIT", "dependencies": { "@vue/compiler-dom": "3.5.13", @@ -4026,7 +4017,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.13.tgz", "integrity": "sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==", - "dev": true, "license": "MIT", "dependencies": { "@vue/shared": "3.5.13" @@ -4036,7 +4026,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.13.tgz", "integrity": "sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==", - "dev": true, "license": "MIT", "dependencies": { "@vue/reactivity": "3.5.13", @@ -4047,7 +4036,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.13.tgz", "integrity": "sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==", - "dev": true, "license": "MIT", "dependencies": { "@vue/reactivity": "3.5.13", @@ -4060,7 +4048,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.13.tgz", "integrity": "sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==", - "dev": true, "license": "MIT", "dependencies": { "@vue/compiler-ssr": "3.5.13", @@ -4074,7 +4061,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", - "dev": true, "license": "MIT" }, "node_modules/@vueuse/core": { @@ -4355,6 +4341,13 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/ace-builds": { + "version": "1.39.1", + "resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.39.1.tgz", + "integrity": "sha512-HcJbBzx8qY66t9gZo/sQu7pi0wO/CFLdYn1LxQO1WQTfIkMfyc7LRnBpsp/oNCSSU/LL83jXHN1fqyOTuIhUjg==", + "license": "BSD-3-Clause", + "peer": true + }, "node_modules/acorn": { "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", @@ -5515,7 +5508,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true, "license": "MIT" }, "node_modules/cytoscape": { @@ -6725,7 +6717,6 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=0.12" @@ -7121,7 +7112,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true, "license": "MIT" }, "node_modules/esutils": { @@ -9452,7 +9442,6 @@ "version": "0.30.17", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" @@ -10492,7 +10481,6 @@ "version": "3.3.8", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", - "dev": true, "funding": [ { "type": "github", @@ -11411,7 +11399,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, "license": "ISC" }, "node_modules/picomatch": { @@ -11564,7 +11551,6 @@ "version": "8.4.49", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", - "dev": true, "funding": [ { "type": "opencollective", @@ -12321,6 +12307,12 @@ "node": ">=10.13.0" } }, + "node_modules/resize-observer-polyfill": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==", + "license": "MIT" + }, "node_modules/resolve": { "version": "1.22.9", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.9.tgz", @@ -12885,7 +12877,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -13763,7 +13754,7 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -14309,7 +14300,6 @@ "version": "3.5.13", "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.13.tgz", "integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==", - "dev": true, "license": "MIT", "dependencies": { "@vue/compiler-dom": "3.5.13", @@ -14327,6 +14317,19 @@ } } }, + "node_modules/vue3-ace-editor": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/vue3-ace-editor/-/vue3-ace-editor-2.2.4.tgz", + "integrity": "sha512-FZkEyfpbH068BwjhMyNROxfEI8135Sc+x8ouxkMdCNkuj/Tuw83VP/gStFQqZHqljyX9/VfMTCdTqtOnJZGN8g==", + "license": "MIT", + "dependencies": { + "resize-observer-polyfill": "^1.5.1" + }, + "peerDependencies": { + "ace-builds": "*", + "vue": "^3" + } + }, "node_modules/walk-up-path": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz", @@ -14717,7 +14720,8 @@ "license": "ISC", "dependencies": { "@xocash/primitives": "*", - "@xocash/stack": "*" + "@xocash/stack": "*", + "vue3-ace-editor": "^2.2.4" }, "devDependencies": { "typedoc": "^0.27.5", diff --git a/packages/docs/package.json b/packages/docs/package.json index cb8b77c..26baced 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -15,7 +15,8 @@ "license": "ISC", "dependencies": { "@xocash/primitives": "*", - "@xocash/stack": "*" + "@xocash/stack": "*", + "vue3-ace-editor": "^2.2.4" }, "devDependencies": { "typedoc": "^0.27.5", diff --git a/packages/docs/src/.vitepress/theme/components/CodeSandbox.vue b/packages/docs/src/.vitepress/theme/components/CodeSandbox.vue new file mode 100644 index 0000000..e033249 --- /dev/null +++ b/packages/docs/src/.vitepress/theme/components/CodeSandbox.vue @@ -0,0 +1,462 @@ + + + + + diff --git a/packages/docs/src/.vitepress/theme/components/CodeSandboxTemplate.html b/packages/docs/src/.vitepress/theme/components/CodeSandboxTemplate.html new file mode 100644 index 0000000..4fc28a0 --- /dev/null +++ b/packages/docs/src/.vitepress/theme/components/CodeSandboxTemplate.html @@ -0,0 +1,122 @@ + + + + + Code Sandbox + + + + + + + + + diff --git a/packages/docs/src/.vitepress/theme/components/Playground.vue b/packages/docs/src/.vitepress/theme/components/Playground.vue new file mode 100644 index 0000000..28f5cf7 --- /dev/null +++ b/packages/docs/src/.vitepress/theme/components/Playground.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/packages/docs/src/.vitepress/theme/custom.css b/packages/docs/src/.vitepress/theme/custom.css index 554550f..2769771 100644 --- a/packages/docs/src/.vitepress/theme/custom.css +++ b/packages/docs/src/.vitepress/theme/custom.css @@ -130,6 +130,41 @@ details summary { gap: 20px; /* Space between the icons and arrows */ } +/* Buttons */ + +.button-container { + display: flex; /* or display: grid */ + gap: 10px; /* Adjust the size to your preference */ +} + +.primary-button { + padding: 8px 16px; + background-color: var(--vp-button-brand-bg); + color: var(--vp-button-brand-text); + border: none; + border-radius: 4px; + cursor: pointer; + font-weight: bold; +} + +.primary-button:hover { + background-color: var(--vp-button-brand-hover-bg); +} + +.secondary-button { + padding: 4px 8px; + background-color: var(--vp-c-brand-soft); + color: var(--vp-button-brand-text); + border: none; + border-radius: 4px; + cursor: pointer; + font-weight: bold; +} + +.secondary-button:hover { + background-color: var(--vp-button-brand-hover-bg); +} + /* BCH icon styling */ .bch-icon { width: 64px; diff --git a/packages/docs/src/.vitepress/theme/index.ts b/packages/docs/src/.vitepress/theme/index.ts index 196b9c0..81f7fb1 100644 --- a/packages/docs/src/.vitepress/theme/index.ts +++ b/packages/docs/src/.vitepress/theme/index.ts @@ -9,7 +9,5 @@ import './tools.css'; export default { extends: DefaultTheme, Layout, - enhanceApp({ app, router, siteData }) { - // ... - }, + enhanceApp({ _app, _router, _siteData }) {}, } satisfies Theme; diff --git a/packages/docs/src/playground.md b/packages/docs/src/playground.md new file mode 100644 index 0000000..a27d5d3 --- /dev/null +++ b/packages/docs/src/playground.md @@ -0,0 +1,30 @@ +--- +layout: false +--- + + + + + + +``` +// Import the Electrum Blockchain Adapter from XO Stack. +const { BlockchainElectrum } = await import('https://cdn.jsdelivr.net/npm/@xocash/stack@0.0.2-development.95/+esm'); + +// Instantiate and start the Electrum Blockchain Adapter. +const blockchain = new BlockchainElectrum(); +await blockchain.start(); + +// Fetch a transaction. +const tx = await blockchain.fetchTransaction('a23bbd321067fd039da53f007b26f62591e58e6554b0488d83534c032dbca38b'); + +// Log it to the console. +console.log('Transaction Hex', tx.toHex()); +``` + + diff --git a/packages/docs/src/tools/sandbox.md b/packages/docs/src/tools/sandbox.md new file mode 100644 index 0000000..446ff4b --- /dev/null +++ b/packages/docs/src/tools/sandbox.md @@ -0,0 +1,81 @@ +--- +aside: false +--- + + + +# Sandbox + +We can include Code Sandboxes in our documentation. + +This'll be very useful for: + +1. Guides +2. Testing + +## Primitives + +The below is Address mess. + + + + +``` +const { Address } = await import('https://cdn.jsdelivr.net/npm/@xocash/stack@0.0.2-development.95/+esm'); + +const lockscriptHex = Address.from('bitcoincash:qr2084lauctzarqk20kqlhef8gyneqhceqy75wvw8q').toLockscriptHex(); + +console.log(lockscriptHex); + +// Testing one new line +console.log({ + someText: 'abc' +}); +console.info('yep'); +``` + + + +## Blockchain Connections + +We can have more than one per page too. For example: + + + + +``` +const { BlockchainElectrum } = await import('https://cdn.jsdelivr.net/npm/@xocash/stack@0.0.2-development.95/+esm'); + +const blockchain = new BlockchainElectrum(); + +await blockchain.start(); + +const tx = await blockchain.fetchTransaction('a23bbd321067fd039da53f007b26f62591e58e6554b0488d83534c032dbca38b'); + +console.log('Transaction Hex', tx.toHex()); +``` + + + +## Wallet Example + +The below demonstrates instantiating a wallet. + + + + +``` +const { BlockchainElectrum, WalletP2PKH } = await import('https://cdn.jsdelivr.net/npm/@xocash/stack@0.0.2-development.95/+esm'); + +const wallet = WalletP2PKH.generateRandom({ + blockchain: new BlockchainElectrum +}); + +const address = await wallet.getReceivingAddress(); + +console.log(address.toCashAddr()); +``` + +