From ecd30e3fee7c58e7d7ea5550372e6fa2a4114eb0 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Sat, 23 Mar 2019 12:42:02 +0100 Subject: [PATCH] Expose types on JS console (#832) --- packages/app-js/src/Playground.tsx | 3 +++ packages/app-js/src/snippets/wrapping.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/app-js/src/Playground.tsx b/packages/app-js/src/Playground.tsx index 3445628a85..ea7a5a3daa 100644 --- a/packages/app-js/src/Playground.tsx +++ b/packages/app-js/src/Playground.tsx @@ -15,6 +15,7 @@ import snappy from 'snappyjs'; import { withApi, withMulti } from '@polkadot/ui-api'; import { Button, Dropdown, Editor } from '@polkadot/ui-app'; import uiKeyring from '@polkadot/ui-keyring'; +import * as types from '@polkadot/types'; import * as util from '@polkadot/util'; import * as hashing from '@polkadot/util-crypto'; @@ -36,6 +37,7 @@ type Injected = { global: null, hashing: typeof hashing, keyring: KeyringInstance | null, + types: typeof types, util: typeof util, window: null }; @@ -177,6 +179,7 @@ class Playground extends React.PureComponent { keyring: isDevelopment ? uiKeyring.keyring : null, + types, util, window: null }; diff --git a/packages/app-js/src/snippets/wrapping.ts b/packages/app-js/src/snippets/wrapping.ts index 96208529ce..26ed601691 100644 --- a/packages/app-js/src/snippets/wrapping.ts +++ b/packages/app-js/src/snippets/wrapping.ts @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. export default function makeWrapper (isDevelopment: boolean): string { - const args = `api, hashing, ${isDevelopment ? 'keyring, ' : ''}util`; + const args = `api, hashing, ${isDevelopment ? 'keyring, ' : ''}types, util`; return `// All code is wrapped within an async closure, // allowing access to ${args}.