File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ const BGComponent = lazy(() => import('@components/BitGoJS'));
77const BGApiComponent = lazy ( ( ) => import ( '@components/BitGoAPI' ) ) ;
88const CoinsComponent = lazy ( ( ) => import ( '@components/Coins' ) ) ;
99const KeyCardComponent = lazy ( ( ) => import ( '@components/KeyCard' ) ) ;
10+ const WasmMiniscriptComponent = lazy (
11+ ( ) => import ( '@components/WasmMiniscript' ) ,
12+ ) ;
1013const EcdsaChallengeComponent = lazy (
1114 ( ) => import ( '@components/EcdsaChallenge' ) ,
1215) ;
@@ -24,6 +27,10 @@ const App = () => {
2427 < Route path = "/bitgo-api" element = { < BGApiComponent /> } />
2528 < Route path = "/coins" element = { < CoinsComponent /> } />
2629 < Route path = "/keycard" element = { < KeyCardComponent /> } />
30+ < Route
31+ path = "/wasm-miniscript"
32+ element = { < WasmMiniscriptComponent /> }
33+ />
2734 < Route
2835 path = "/ecdsachallenge"
2936 element = { < EcdsaChallengeComponent /> }
Original file line number Diff line number Diff line change @@ -38,6 +38,12 @@ const Navbar = () => {
3838 >
3939 Key Card
4040 </ NavItem >
41+ < NavItem
42+ activeRoute = { pathname === '/wasm-miniscript' }
43+ onClick = { ( ) => navigate ( '/wasm-miniscript' ) }
44+ >
45+ Wasm Miniscript
46+ </ NavItem >
4147 < NavItem
4248 activeRoute = { pathname === '/ecdsachallenge' }
4349 onClick = { ( ) => navigate ( '/ecdsachallenge' ) }
Original file line number Diff line number Diff line change 1+ import React , { useState } from 'react' ;
2+ import { Descriptor } from '@bitgo/wasm-miniscript' ;
3+
4+ // these two lines are necessary to load the wasm module
5+ // eslint-disable-next-line import/no-internal-modules
6+ import * as wasm from '@bitgo/wasm-miniscript/dist/wasm/wasm_miniscript' ;
7+ void wasm ;
8+
9+ const defaultDescriptor =
10+ 'wpkh(xpub661MyMwAqRbcFQpwd6c6aaioiXWuygdeknqE8v6PSNusNjwZypj1uXTVNysfsFPEDL6X3yS1kL6JeWyy9bAiR97Gz8KD9Z1W54uBw9U9j2t/*)' ;
11+
12+ export default function ( ) {
13+ const [ descriptorString ] = useState ( defaultDescriptor ) ;
14+ const descriptor = Descriptor . fromString ( descriptorString , 'derivable' ) ;
15+ return (
16+ < div >
17+ < pre > { descriptor . toString ( ) } </ pre >
18+ < pre >
19+ { Buffer . from ( descriptor . atDerivationIndex ( 0 ) . scriptPubkey ( ) ) . toString (
20+ 'hex' ,
21+ ) }
22+ </ pre >
23+ </ div >
24+ ) ;
25+ }
You can’t perform that action at this time.
0 commit comments