Dev bump (#4012)
* Bump API/Common (esnext exports) * Bump deps * Adjust * Bumps * Bumps * repository * Update dev * Remove Rococo (for the time being) * script extension
This commit is contained in:
parent
09d9e3dadf
commit
64299ebd29
@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/apps authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const base = require('@polkadot/dev/config/eslint');
|
||||
const base = require('@polkadot/dev/config/eslint.cjs');
|
||||
|
||||
// add override for any (a metric ton of them, initial conversion)
|
||||
module.exports = {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/apps authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports = require('@polkadot/dev/config/babel');
|
||||
module.exports = require('@polkadot/dev/config/babel-config-cjs.cjs');
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/apps authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const config = require('@polkadot/dev/config/jest');
|
||||
const config = require('@polkadot/dev/config/jest.cjs');
|
||||
|
||||
const findPackages = require('./scripts/findPackages');
|
||||
|
||||
|
||||
20
package.json
20
package.json
@ -12,13 +12,13 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^2.6.1",
|
||||
"@polkadot/api-contract": "^2.6.1",
|
||||
"@polkadot/keyring": "^4.0.1",
|
||||
"@polkadot/networks": "^4.0.1",
|
||||
"@polkadot/types": "^2.6.1",
|
||||
"@polkadot/util": "^4.0.1",
|
||||
"@polkadot/util-crypto": "^4.0.1",
|
||||
"@polkadot/api": "^2.6.2-7",
|
||||
"@polkadot/api-contract": "^2.6.2-7",
|
||||
"@polkadot/keyring": "^4.0.2-12",
|
||||
"@polkadot/networks": "^4.0.2-12",
|
||||
"@polkadot/types": "^2.6.2-7",
|
||||
"@polkadot/util": "^4.0.2-12",
|
||||
"@polkadot/util-crypto": "^4.0.2-12",
|
||||
"@polkadot/wasm-crypto": "^2.0.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"styled-components": "^5.2.0",
|
||||
@ -27,7 +27,7 @@
|
||||
"scripts": {
|
||||
"analyze": "yarn clean && BUILD_ANALYZE=1 yarn run build:code && yarn source-map-explorer packages/apps/build/main.*.js",
|
||||
"build": "yarn run build:i18n && yarn run build:code",
|
||||
"build:code": "NODE_ENV=production node_modules/@polkadot/dev/scripts/polkadot-dev-build-ts.js",
|
||||
"build:code": "NODE_ENV=production node_modules/@polkadot/dev/scripts/polkadot-dev-build-ts.cjs",
|
||||
"build:i18n": "i18next-scanner --config i18next-scanner.config.js && node ./scripts/i18nSort.js",
|
||||
"build:release:electron": "yarn build && yarn build:electron && yarn postinstall:electron",
|
||||
"build:release:ipfs": "node scripts/ipfsUpload.js",
|
||||
@ -65,8 +65,8 @@
|
||||
"@babel/register": "^7.12.1",
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@pinata/sdk": "^1.1.11",
|
||||
"@polkadot/dev": "^0.59.20",
|
||||
"@polkadot/ts": "^0.3.53",
|
||||
"@polkadot/dev": "^0.60.1",
|
||||
"@polkadot/ts": "^0.3.54",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/chart.js": "^2.9.27",
|
||||
"@types/file-saver": "^2.0.1",
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
@ -15,7 +13,7 @@
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@edgeware/node-types": "^3.0.7",
|
||||
"@laminar/type-definitions": "^0.2.0-beta.141",
|
||||
"@polkadot/networks": "^4.0.1",
|
||||
"@polkadot/networks": "^4.0.2-12",
|
||||
"@subsocial/types": "^0.4.7"
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,69 +171,69 @@ function createLiveNetworks (t: TFunction): LinkOption[] {
|
||||
function createTestNetworks (t: TFunction): LinkOption[] {
|
||||
return [
|
||||
// polkadot test relays
|
||||
{
|
||||
dnslink: 'rococo',
|
||||
info: 'rococo',
|
||||
text: t('rpc.rococo', 'Rococo', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }),
|
||||
value: 'wss://rococo-rpc.polkadot.io'
|
||||
},
|
||||
{
|
||||
info: 'rococoTick',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.tick', 'Tick', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }),
|
||||
value: 'wss://tick-rpc.polkadot.io'
|
||||
},
|
||||
{
|
||||
info: 'rococoTrick',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.trick', 'Trick', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Prity' } }),
|
||||
value: 'wss://trick-rpc.polkadot.io'
|
||||
},
|
||||
{
|
||||
info: 'rococoTrack',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.track', 'Track', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }),
|
||||
value: 'wss://track-rpc.polkadot.io'
|
||||
},
|
||||
{
|
||||
info: 'rococoAcala',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.acala', 'Mandala PC1', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Acala' } }),
|
||||
value: 'wss://rococo-1.acala.laminar.one'
|
||||
},
|
||||
{
|
||||
info: 'rococoDarwinia',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.darwinia', 'Darwinia PC1', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Darwinia Network' } }),
|
||||
value: 'wss://parachain-rpc.darwinia.network'
|
||||
},
|
||||
{
|
||||
info: 'rococoPlasm',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.plasm', 'Plasm PC1', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }),
|
||||
value: 'wss://rpc.parachain.plasmnet.io'
|
||||
},
|
||||
{
|
||||
info: 'rococoRobonomics',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.robonomics', 'Robonomics PC1', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Airalab' } }),
|
||||
value: 'wss://parachain-rpc.robonomics.network'
|
||||
},
|
||||
{
|
||||
info: 'rococoLaminar',
|
||||
isChild: true,
|
||||
text: t('rpc.rococo.laminar', 'Turbulence PC1', { ns: 'apps-config' }),
|
||||
textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Laminar' } }),
|
||||
value: 'wss://rococo-1.laminar-chain.laminar.one'
|
||||
},
|
||||
// {
|
||||
// dnslink: 'rococo',
|
||||
// info: 'rococo',
|
||||
// text: t('rpc.rococo', 'Rococo', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }),
|
||||
// value: 'wss://rococo-rpc.polkadot.io'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoTick',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.tick', 'Tick', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }),
|
||||
// value: 'wss://tick-rpc.polkadot.io'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoTrick',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.trick', 'Trick', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Prity' } }),
|
||||
// value: 'wss://trick-rpc.polkadot.io'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoTrack',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.track', 'Track', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }),
|
||||
// value: 'wss://track-rpc.polkadot.io'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoAcala',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.acala', 'Mandala PC1', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Acala' } }),
|
||||
// value: 'wss://rococo-1.acala.laminar.one'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoDarwinia',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.darwinia', 'Darwinia PC1', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Darwinia Network' } }),
|
||||
// value: 'wss://parachain-rpc.darwinia.network'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoPlasm',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.plasm', 'Plasm PC1', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }),
|
||||
// value: 'wss://rpc.parachain.plasmnet.io'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoRobonomics',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.robonomics', 'Robonomics PC1', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Airalab' } }),
|
||||
// value: 'wss://parachain-rpc.robonomics.network'
|
||||
// },
|
||||
// {
|
||||
// info: 'rococoLaminar',
|
||||
// isChild: true,
|
||||
// text: t('rpc.rococo.laminar', 'Turbulence PC1', { ns: 'apps-config' }),
|
||||
// textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Laminar' } }),
|
||||
// value: 'wss://rococo-1.laminar-chain.laminar.one'
|
||||
// },
|
||||
// alphabetical based on chain name
|
||||
{
|
||||
info: 'centrifuge',
|
||||
@ -360,7 +360,7 @@ function createCustom (t: TFunction): LinkOption[] {
|
||||
: [];
|
||||
}
|
||||
|
||||
export default function create (t: TFunction): LinkOption[] {
|
||||
export function createEndpoints (t: TFunction): LinkOption[] {
|
||||
return [
|
||||
...createCustom(t),
|
||||
{
|
||||
|
||||
@ -1,16 +1,8 @@
|
||||
// Copyright 2017-2020 @polkadot/apps-config authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import createEndpoints from './endpoints';
|
||||
import createLanguages from './languages';
|
||||
import createSs58 from './ss58';
|
||||
import { CUSTOM_ENDPOINT_KEY } from './constants';
|
||||
import { ethereumNetworks } from './ethereumNetworks';
|
||||
|
||||
export {
|
||||
createEndpoints,
|
||||
createLanguages,
|
||||
createSs58,
|
||||
CUSTOM_ENDPOINT_KEY,
|
||||
ethereumNetworks
|
||||
};
|
||||
export { CUSTOM_ENDPOINT_KEY } from './constants';
|
||||
export { createEndpoints } from './endpoints';
|
||||
export { ethereumNetworks } from './ethereumNetworks';
|
||||
export { createLanguages } from './languages';
|
||||
export { createSs58 } from './ss58';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
import { TFunction } from 'i18next';
|
||||
import { Option } from './types';
|
||||
|
||||
export default function create (t: TFunction): Option[] {
|
||||
export function createLanguages (t: TFunction): Option[] {
|
||||
return [
|
||||
{
|
||||
text: t('lng.detect', 'Default browser language (auto-detect)', { ns: 'apps-config' }),
|
||||
|
||||
@ -11,7 +11,7 @@ import known from '@polkadot/networks';
|
||||
// text: The text you wish to display in the dropdown
|
||||
// value: The actual ss5Format value (as registered)
|
||||
|
||||
export default function create (t: TFunction): Option[] {
|
||||
export function createSs58 (t: TFunction): Option[] {
|
||||
return [
|
||||
{
|
||||
info: 'default',
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.12.3",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@polkadot/dev": "^0.59.20",
|
||||
"@polkadot/dev": "^0.60.1",
|
||||
"@polkadot/react-components": "^0.66.2-5",
|
||||
"electron-log": "^4.3.0",
|
||||
"electron-updater": "^4.3.5"
|
||||
|
||||
@ -20,14 +20,19 @@ function createWebpack () {
|
||||
mode: ENV,
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
include: /node_modules/,
|
||||
test: /\.mjs$/,
|
||||
type: 'javascript/auto'
|
||||
},
|
||||
{
|
||||
exclude: /(node_modules)/,
|
||||
test: /\.(js|ts|tsx)$/,
|
||||
test: /\.(js|mjs|ts|tsx)$/,
|
||||
use: [
|
||||
require.resolve('thread-loader'),
|
||||
{
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: require('@polkadot/dev/config/babel')
|
||||
options: require('@polkadot/dev/config/babel-config-cjs.cjs')
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -48,7 +53,7 @@ function createWebpack () {
|
||||
new CopyWebpackPlugin({ patterns: [{ from: 'assets' }] })
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx']
|
||||
extensions: ['.js', '.jsx', '.json', '.mjs', '.ts', '.tsx']
|
||||
},
|
||||
target: 'electron-main'
|
||||
}
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -5,11 +5,9 @@
|
||||
"description": "An Apps portal into the Polkadot network",
|
||||
"main": "index.js",
|
||||
"homepage": ".",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
@ -18,7 +16,7 @@
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/apps-config": "^0.66.2-5",
|
||||
"@polkadot/apps-routing": "^0.66.2-5",
|
||||
"@polkadot/dev": "^0.59.20",
|
||||
"@polkadot/dev": "^0.60.1",
|
||||
"@polkadot/react-api": "^0.66.2-5",
|
||||
"@polkadot/react-components": "^0.66.2-5",
|
||||
"@polkadot/react-hooks": "^0.66.2-5",
|
||||
|
||||
@ -53,6 +53,11 @@ function createWebpack (ENV, context) {
|
||||
mode: ENV,
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
include: /node_modules/,
|
||||
test: /\.mjs$/,
|
||||
type: 'javascript/auto'
|
||||
},
|
||||
{
|
||||
exclude: /(node_modules)/,
|
||||
test: /\.css$/,
|
||||
@ -80,12 +85,12 @@ function createWebpack (ENV, context) {
|
||||
},
|
||||
{
|
||||
exclude: /(node_modules)/,
|
||||
test: /\.(js|ts|tsx)$/,
|
||||
test: /\.(js|mjs|ts|tsx)$/,
|
||||
use: [
|
||||
require.resolve('thread-loader'),
|
||||
{
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: require('@polkadot/dev/config/babel')
|
||||
options: require('@polkadot/dev/config/babel-config-cjs.cjs')
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -193,7 +198,7 @@ function createWebpack (ENV, context) {
|
||||
]).filter((plugin) => plugin),
|
||||
resolve: {
|
||||
alias,
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
||||
extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx']
|
||||
},
|
||||
watch: !isProd,
|
||||
watchOptions: {
|
||||
|
||||
@ -3,17 +3,15 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/react-components": "^0.66.2-5",
|
||||
"@polkadot/vanitygen": "^0.23.1",
|
||||
"@polkadot/vanitygen": "^0.23.2-4",
|
||||
"detect-browser": "^5.2.0",
|
||||
"file-saver": "^2.0.2"
|
||||
},
|
||||
|
||||
@ -3,17 +3,15 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/react-components": "^0.66.2-5",
|
||||
"@polkadot/vanitygen": "^0.23.1",
|
||||
"@polkadot/vanitygen": "^0.23.2-4",
|
||||
"detect-browser": "^5.2.0",
|
||||
"file-saver": "^2.0.2"
|
||||
},
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -6,12 +6,10 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/api-contract": "^2.6.1"
|
||||
"@polkadot/api-contract": "^2.6.2-7"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import { CodeStored } from '@polkadot/app-contracts/types';
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { registry } from '@polkadot/react-api';
|
||||
import Row from '@polkadot/react-components/Row';
|
||||
import { Icon } from '@polkadot/react-components';
|
||||
@ -40,7 +39,7 @@ function CodeRow ({ buttons, children, className, code: { json }, isInline, with
|
||||
const trimmedName = name.trim();
|
||||
|
||||
if (trimmedName && codeHash) {
|
||||
contracts.saveCode(createType(registry, 'Hash', codeHash), { name })
|
||||
contracts.saveCode(registry.createType('Hash', codeHash), { name })
|
||||
.catch((e): void => console.error(e));
|
||||
}
|
||||
},
|
||||
@ -50,7 +49,7 @@ function CodeRow ({ buttons, children, className, code: { json }, isInline, with
|
||||
const _onSaveTags = useCallback(
|
||||
(): void => {
|
||||
codeHash && contracts
|
||||
.saveCode(createType(registry, 'Hash', codeHash), { tags })
|
||||
.saveCode(registry.createType('Hash', codeHash), { tags })
|
||||
.catch((e): void => console.error(e));
|
||||
},
|
||||
[codeHash, tags]
|
||||
|
||||
@ -7,7 +7,7 @@ import React from 'react';
|
||||
import { ThemeProps } from '@polkadot/react-components/types';
|
||||
import styled from 'styled-components';
|
||||
import { Icon, Tooltip } from '@polkadot/react-components';
|
||||
import { encodeTypeDef } from '@polkadot/types';
|
||||
import { encodeTypeDef } from '@polkadot/types/create';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
|
||||
@ -8,7 +8,6 @@ import EventEmitter from 'eventemitter3';
|
||||
import store from 'store';
|
||||
import { Abi } from '@polkadot/api-contract';
|
||||
import { api, registry } from '@polkadot/react-api';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
const KEY_CODE = 'code:';
|
||||
|
||||
@ -29,7 +28,7 @@ class Store extends EventEmitter {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
public async saveCode (codeHash: string | Hash, partial: Partial<CodeJson>): Promise<void> {
|
||||
const hex = (typeof codeHash === 'string' ? createType(registry, 'Hash', codeHash) : codeHash).toHex();
|
||||
const hex = (typeof codeHash === 'string' ? registry.createType('Hash', codeHash) : codeHash).toHex();
|
||||
const existing = this.getCode(hex);
|
||||
const json = {
|
||||
...(existing ? existing.json : {}),
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -7,7 +7,8 @@ import { TypeDef } from '@polkadot/types/types';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import Params from '@polkadot/react-params';
|
||||
import { Compact, Option, getTypeDef } from '@polkadot/types';
|
||||
import { Compact, Option } from '@polkadot/types';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { calcPassing } from '@polkadot/api-derive/democracy/util';
|
||||
|
||||
import { approxChanges } from './util';
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -5,7 +5,8 @@ import { DigestItem } from '@polkadot/types/interfaces';
|
||||
import { Codec, TypeDef } from '@polkadot/types/types';
|
||||
|
||||
import React, { useRef } from 'react';
|
||||
import { Struct, Tuple, Raw, Vec, getTypeDef } from '@polkadot/types';
|
||||
import { Struct, Tuple, Raw, Vec } from '@polkadot/types';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
import { Expander, Table } from '@polkadot/react-components';
|
||||
import Params from '@polkadot/react-params';
|
||||
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
// Copyright 2017-2020 @polkadot/app-democracy authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { ParaInfo } from '@polkadot/types/interfaces';
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useMemo, useRef } from 'react';
|
||||
import { useApi, useFormField, useModal } from '@polkadot/react-hooks';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { BN_THOUSAND, u8aToHex, u8aToString } from '@polkadot/util';
|
||||
|
||||
import { Button, Dropdown, InputFile, InputNumber, InputWasm, Modal, TxButton } from '@polkadot/react-components';
|
||||
@ -43,15 +41,13 @@ function Register ({ isDisabled, nextFreeId = BN_THOUSAND, sudoKey }: Props): Re
|
||||
);
|
||||
const [code, isCodeValid, setCode] = useFormField<Uint8Array>(
|
||||
null,
|
||||
(code): boolean => !!code && isWasmValidRef.current
|
||||
(code) => !!code && isWasmValidRef.current
|
||||
);
|
||||
const [initialHeadState, isInitialHeadStateValid, setInitialHeadState] = useFormField<Uint8Array>(null);
|
||||
const [scheduling, , setScheduling] = useFormField<Scheduling>('Always');
|
||||
|
||||
const info = useMemo(
|
||||
(): ParaInfo => {
|
||||
return createType(api.registry, 'ParaInfo', { scheduling });
|
||||
},
|
||||
() => api.registry.createType('ParaInfo', { scheduling }),
|
||||
[api, scheduling]
|
||||
);
|
||||
const extrinsic = useMemo(
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -9,7 +9,7 @@ import React, { useCallback, useState } from 'react';
|
||||
import { Button, InputRpc } from '@polkadot/react-components';
|
||||
import Params from '@polkadot/react-params';
|
||||
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
|
||||
import { getTypeDef } from '@polkadot/types';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
import { isNull } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -7,7 +7,7 @@ import { PayoutStash } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { AddressSmall, TxButton } from '@polkadot/react-components';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { BlockToTime, FormatBalance } from '@polkadot/react-query';
|
||||
|
||||
@ -26,7 +26,7 @@ import { STORE_FAVS_BASE } from './constants';
|
||||
import { useTranslation } from './translate';
|
||||
import useSortedTargets from './useSortedTargets';
|
||||
|
||||
const HIDDEN_ACC = ['actions', 'payouts'];
|
||||
const HIDDEN_ACC = ['actions', 'payout'];
|
||||
|
||||
const transformElection = {
|
||||
transform: (status: ElectionStatus) => status.isOpen
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -12,8 +12,8 @@ import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
import { Button, Labelled } from '@polkadot/react-components';
|
||||
import { withCallDiv } from '@polkadot/react-api/hoc';
|
||||
import valueToText from '@polkadot/react-params/valueToText';
|
||||
import { Compact, Option, Raw } from '@polkadot/types';
|
||||
import { isU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
||||
import { Option, Raw } from '@polkadot/types';
|
||||
import { compactStripLength, isU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
@ -39,7 +39,7 @@ function keyToName (isConst: boolean, _key: Uint8Array | QueryableStorageEntry<'
|
||||
const key = _key as Uint8Array | QueryableStorageEntry<'promise'>;
|
||||
|
||||
if (isU8a(key)) {
|
||||
const u8a = Compact.stripLengthPrefix(key);
|
||||
const [, u8a] = compactStripLength(key);
|
||||
|
||||
// If the string starts with `:`, handle it as a pure string
|
||||
return u8a[0] === 0x3a
|
||||
|
||||
@ -8,11 +8,11 @@ import { RawParams } from '@polkadot/react-params/types';
|
||||
import { ComponentProps as Props } from '../types';
|
||||
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { Button, InputStorage } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import Params from '@polkadot/react-params';
|
||||
import { getTypeDef } from '@polkadot/types';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
import { isNull, isUndefined } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
|
||||
@ -7,8 +7,7 @@ import React, { useCallback, useState } from 'react';
|
||||
import { Button, Input } from '@polkadot/react-components';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
import { u8aToU8a } from '@polkadot/util';
|
||||
import { Compact } from '@polkadot/types';
|
||||
import { compactAddLength, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
function Raw ({ onAdd }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
@ -27,7 +26,7 @@ function Raw ({ onAdd }: Props): React.ReactElement<Props> {
|
||||
|
||||
setValue({
|
||||
isValid: u8a.length !== 0,
|
||||
key: Compact.addLengthPrefix(u8a)
|
||||
key: compactAddLength(u8a)
|
||||
});
|
||||
},
|
||||
[]
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
|
||||
@ -9,30 +9,19 @@
|
||||
"RxJs"
|
||||
],
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/polkadot-js/ui/issues"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"bugs": "https://github.com/polkadot-js/apps/issues",
|
||||
"homepage": "https://github.com/polkadot-js/apps/tree/master/packages/react-api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@polkadot/api": "^2.6.1",
|
||||
"@polkadot/extension-dapp": "^0.35.0-beta.42",
|
||||
"@polkadot/api": "^2.6.2-7",
|
||||
"@polkadot/extension-dapp": "^0.35.0-beta.47",
|
||||
"rxjs-compat": "^6.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import { ApiProps, ApiState } from './types';
|
||||
|
||||
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
||||
import store from 'store';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api/promise';
|
||||
import { setDeriveCache, deriveMapCache } from '@polkadot/api-derive/util';
|
||||
import { typesChain, typesSpec, typesBundle, typesRpc } from '@polkadot/apps-config/api';
|
||||
import { POLKADOT_DENOM_BLOCK, POLKADOT_GENESIS } from '@polkadot/apps-config/api/constants';
|
||||
@ -22,7 +22,7 @@ import uiSettings from '@polkadot/ui-settings';
|
||||
import ApiSigner from '@polkadot/react-signer/signers/ApiSigner';
|
||||
import { formatBalance, isTestChain } from '@polkadot/util';
|
||||
import { setSS58Format } from '@polkadot/util-crypto';
|
||||
import addressDefaults from '@polkadot/util-crypto/address/defaults';
|
||||
import { defaults as addressDefaults } from '@polkadot/util-crypto/address/defaults';
|
||||
|
||||
import ApiContext from './ApiContext';
|
||||
import registry from './typeRegistry';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/react-api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
import { InjectedExtension } from '@polkadot/extension-inject/types';
|
||||
import { SubmittableExtrinsicFunction } from '@polkadot/api/promise/types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api/promise';
|
||||
|
||||
// helpers for HOC props
|
||||
export type OmitProps<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
@ -2,11 +2,9 @@
|
||||
"name": "@polkadot/react-components",
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
@ -14,15 +12,15 @@
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
||||
"@fortawesome/react-fontawesome": "^0.1.11",
|
||||
"@polkadot/keyring": "^4.0.1",
|
||||
"@polkadot/keyring": "^4.0.2-12",
|
||||
"@polkadot/react-api": "^0.66.2-5",
|
||||
"@polkadot/react-identicon": "^0.62.1",
|
||||
"@polkadot/react-qr": "^0.62.1",
|
||||
"@polkadot/react-identicon": "^0.62.2-11",
|
||||
"@polkadot/react-qr": "^0.62.2-11",
|
||||
"@polkadot/react-query": "^0.66.2-5",
|
||||
"@polkadot/ui-keyring": "^0.62.1",
|
||||
"@polkadot/ui-settings": "^0.62.1",
|
||||
"@polkadot/util": "^4.0.1",
|
||||
"@polkadot/util-crypto": "^4.0.1",
|
||||
"@polkadot/ui-keyring": "^0.62.2-11",
|
||||
"@polkadot/ui-settings": "^0.62.2-11",
|
||||
"@polkadot/util": "^4.0.2-12",
|
||||
"@polkadot/util-crypto": "^4.0.2-12",
|
||||
"chart.js": "^2.9.4",
|
||||
"codeflask": "^1.4.1",
|
||||
"i18next": "^19.8.3",
|
||||
|
||||
@ -7,7 +7,8 @@ import { Codec, IExtrinsic, IMethod, TypeDef } from '@polkadot/types/types';
|
||||
import BN from 'bn.js';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { GenericCall, getTypeDef } from '@polkadot/types';
|
||||
import { GenericCall } from '@polkadot/types';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
import Params from '@polkadot/react-params';
|
||||
import { FormatBalance } from '@polkadot/react-query';
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import { Codec } from '@polkadot/types/types';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Input } from '@polkadot/react-components';
|
||||
import Params from '@polkadot/react-params';
|
||||
import { getTypeDef } from '@polkadot/types';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
|
||||
import { useTranslation } from './translate';
|
||||
import { classes, getContractAbi } from './util';
|
||||
|
||||
@ -6,7 +6,8 @@ import { RawParam } from '@polkadot/react-params/types';
|
||||
import { TypeDef } from '@polkadot/types/types';
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { GenericCall, getTypeDef } from '@polkadot/types';
|
||||
import { GenericCall } from '@polkadot/types';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
import Params from '@polkadot/react-params';
|
||||
import { isUndefined } from '@polkadot/util';
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@ import store from 'store';
|
||||
import styled from 'styled-components';
|
||||
import { withMulti, withObservable } from '@polkadot/react-api/hoc';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import keyringOption from '@polkadot/ui-keyring/options';
|
||||
import createKeyringItem from '@polkadot/ui-keyring/options/item';
|
||||
import { isNull, isUndefined } from '@polkadot/util';
|
||||
|
||||
@ -316,7 +315,7 @@ const ExportedComponent = withMulti(
|
||||
max-width: 0;
|
||||
}
|
||||
`,
|
||||
withObservable(keyringOption.optionsSubject, {
|
||||
withObservable(keyring.keyringOption.optionsSubject, {
|
||||
propName: 'optionsAll',
|
||||
transform: (optionsAll: KeyringOptions): Record<string, (Option | React.ReactNode)[]> =>
|
||||
Object.entries(optionsAll).reduce((result: Record<string, (Option | React.ReactNode)[]>, [type, options]): Record<string, (Option | React.ReactNode)[]> => {
|
||||
|
||||
@ -5,7 +5,7 @@ import { ConstantCodec } from '@polkadot/metadata/decorate/types';
|
||||
import { DropdownOptions, DropdownOption } from '../../util/types';
|
||||
|
||||
import React from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
|
||||
const section = api.consts[sectionName];
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
import { DropdownOptions } from '../../util/types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
export default function createOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
|
||||
@ -5,7 +5,7 @@ import { SubmittableExtrinsicFunction } from '@polkadot/api/types';
|
||||
import { DropdownOptions } from '../util/types';
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
import Dropdown from '../Dropdown';
|
||||
import { classes } from '../util';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
import { DropdownOption, DropdownOptions } from '../../util/types';
|
||||
|
||||
import React from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
|
||||
const section = api.tx[sectionName];
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
import { DropdownOptions } from '../../util/types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
export default function createOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
|
||||
@ -5,7 +5,7 @@ import { DefinitionRpcExt } from '@polkadot/types/types';
|
||||
import { DropdownOption, DropdownOptions } from '../../util/types';
|
||||
|
||||
import React from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
|
||||
|
||||
export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
import { DropdownOptions } from '../../util/types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
export default function createOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
// Copyright 2017-2020 @polkadot/react-components authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { StorageEntry } from '@polkadot/types/primitive/types';
|
||||
import { DropdownOptions, DropdownOption } from '../../util/types';
|
||||
|
||||
import React from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { StorageEntry, unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
|
||||
export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
|
||||
const section = api.query[sectionName];
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
import { DropdownOptions } from '../../util/types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
export default function createOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
|
||||
@ -10,7 +10,6 @@ import React, { useCallback, useRef, useState } from 'react';
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { registry } from '@polkadot/react-api';
|
||||
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
import { getContractAbi } from '../util';
|
||||
import { QueueProvider } from './Context';
|
||||
@ -217,8 +216,8 @@ function Queue ({ children }: Props): React.ReactElement<Props> {
|
||||
addToTxQueue({
|
||||
accountId: payload.address,
|
||||
// this is not great, but the Extrinsic we don't need a submittable
|
||||
extrinsic: createType(registry, 'Extrinsic',
|
||||
{ method: createType(registry, 'Call', payload.method) },
|
||||
extrinsic: registry.createType('Extrinsic',
|
||||
{ method: registry.createType('Call', payload.method) },
|
||||
{ version: payload.version }
|
||||
) as unknown as SubmittableExtrinsic,
|
||||
payload,
|
||||
|
||||
@ -25,6 +25,21 @@ interface ValueState {
|
||||
value: BN;
|
||||
}
|
||||
|
||||
function getValues (selectedId: string | null | undefined, isCouncil: boolean | undefined, allBalances: DeriveBalancesAll, existential: BN): ValueState {
|
||||
const value = allBalances.lockedBalance;
|
||||
const maxValue = allBalances.votingBalance.add(isCouncil ? allBalances.reservedBalance : BN_ZERO);
|
||||
|
||||
return {
|
||||
maxValue,
|
||||
selectedId,
|
||||
value: value.isZero()
|
||||
? maxValue.gt(existential)
|
||||
? maxValue.sub(existential)
|
||||
: BN_ZERO
|
||||
: value
|
||||
};
|
||||
}
|
||||
|
||||
function VoteValue ({ accountId, autoFocus, isCouncil, onChange }: Props): React.ReactElement<Props> | null {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
@ -35,14 +50,10 @@ function VoteValue ({ accountId, autoFocus, isCouncil, onChange }: Props): React
|
||||
// if the set accountId changes and the new balances is for that id, set it
|
||||
allBalances && allBalances.accountId.eq(accountId) && setValue((state) =>
|
||||
state.selectedId !== accountId
|
||||
? ({
|
||||
maxValue: allBalances.votingBalance.add(isCouncil ? allBalances.reservedBalance : BN_ZERO),
|
||||
selectedId: accountId,
|
||||
value: allBalances.lockedBalance
|
||||
})
|
||||
? getValues(accountId, isCouncil, allBalances, api.consts.balances.existentialDeposit)
|
||||
: state
|
||||
);
|
||||
}, [allBalances, accountId, isCouncil]);
|
||||
}, [allBalances, accountId, api, isCouncil]);
|
||||
|
||||
// only do onChange to parent when the BN value comes in, not our formatted version
|
||||
useEffect((): void => {
|
||||
@ -66,7 +77,7 @@ function VoteValue ({ accountId, autoFocus, isCouncil, onChange }: Props): React
|
||||
defaultValue={
|
||||
isDisabled
|
||||
? undefined
|
||||
: maxValue
|
||||
: value
|
||||
}
|
||||
help={t<string>('The amount that is associated with this vote. This value is is locked for the duration of the vote.')}
|
||||
isDisabled={isDisabled}
|
||||
|
||||
@ -9,26 +9,15 @@
|
||||
"RxJs"
|
||||
],
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/polkadot-js/ui/issues"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"bugs": "https://github.com/polkadot-js/apps/issues",
|
||||
"homepage": "https://github.com/polkadot-js/apps/tree/master/packages/react-hooks#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"memoizee": "^0.4.14"
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
// Copyright 2017-2020 @polkadot/react-hooks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as useAccountId } from './useAccountId';
|
||||
export { default as useAccountInfo } from './useAccountInfo';
|
||||
export { default as useAccounts } from './useAccounts';
|
||||
export { default as useAddresses } from './useAddresses';
|
||||
export { default as useApi } from './useApi';
|
||||
export { default as useAvailableSlashes } from './useAvailableSlashes';
|
||||
export { default as useBlockTime } from './useBlockTime';
|
||||
export { default as useCacheKey } from './useCacheKey';
|
||||
export { default as useCall } from './useCall';
|
||||
export { default as useContracts } from './useContracts';
|
||||
export { default as useFormField } from './useFormField';
|
||||
export { default as useDebounce } from './useDebounce';
|
||||
export { default as useFavorites } from './useFavorites';
|
||||
export { default as useIncrement } from './useIncrement';
|
||||
export { default as useIpfs } from './useIpfs';
|
||||
export { default as useIsMountedRef } from './useIsMountedRef';
|
||||
export { default as useLoadingDelay } from './useLoadingDelay';
|
||||
export { default as useMembers } from './useMembers';
|
||||
export { default as useModal } from './useModal';
|
||||
export { default as useNonEmptyString } from './useNonEmptyString';
|
||||
export { default as useNonZeroBn } from './useNonZeroBn';
|
||||
export { default as useOwnEraRewards } from './useOwnEraRewards';
|
||||
export { default as useOwnStashes, useOwnStashIds } from './useOwnStashes';
|
||||
export { default as useOwnStashInfos } from './useOwnStashInfos';
|
||||
export { default as usePassword } from './usePassword';
|
||||
export { default as useRegistrars } from './useRegistrars';
|
||||
export { default as useStashIds } from './useStashIds';
|
||||
export { default as useSudo } from './useSudo';
|
||||
export { default as useToggle } from './useToggle';
|
||||
export { default as useVotingStatus } from './useVotingStatus';
|
||||
export { default as useWeight } from './useWeight';
|
||||
export { useAccountId } from './useAccountId';
|
||||
export { useAccountInfo } from './useAccountInfo';
|
||||
export { useAccounts } from './useAccounts';
|
||||
export { useAddresses } from './useAddresses';
|
||||
export { useApi } from './useApi';
|
||||
export { useAvailableSlashes } from './useAvailableSlashes';
|
||||
export { useBlockTime } from './useBlockTime';
|
||||
export { useCacheKey } from './useCacheKey';
|
||||
export { useCall } from './useCall';
|
||||
export { useContracts } from './useContracts';
|
||||
export { useFormField } from './useFormField';
|
||||
export { useDebounce } from './useDebounce';
|
||||
export { useFavorites } from './useFavorites';
|
||||
export { useIncrement } from './useIncrement';
|
||||
export { useIpfs } from './useIpfs';
|
||||
export { useIsMountedRef } from './useIsMountedRef';
|
||||
export { useLoadingDelay } from './useLoadingDelay';
|
||||
export { useMembers } from './useMembers';
|
||||
export { useModal } from './useModal';
|
||||
export { useNonEmptyString } from './useNonEmptyString';
|
||||
export { useNonZeroBn } from './useNonZeroBn';
|
||||
export { useOwnEraRewards } from './useOwnEraRewards';
|
||||
export { useOwnStashes, useOwnStashIds } from './useOwnStashes';
|
||||
export { useOwnStashInfos } from './useOwnStashInfos';
|
||||
export { usePassword } from './usePassword';
|
||||
export { useRegistrars } from './useRegistrars';
|
||||
export { useStashIds } from './useStashIds';
|
||||
export { useSudo } from './useSudo';
|
||||
export { useToggle } from './useToggle';
|
||||
export { useVotingStatus } from './useVotingStatus';
|
||||
export { useWeight } from './useWeight';
|
||||
|
||||
@ -5,7 +5,7 @@ import { StringOrNull } from '@polkadot/react-components/types';
|
||||
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
export default function useAccountId (initialValue: StringOrNull = null, onChangeAccountId?: (_: StringOrNull) => void): [StringOrNull, (_: StringOrNull) => void] {
|
||||
export function useAccountId (initialValue: StringOrNull = null, onChangeAccountId?: (_: StringOrNull) => void): [StringOrNull, (_: StringOrNull) => void] {
|
||||
const [accountId, setAccountId] = useState<StringOrNull>(initialValue);
|
||||
|
||||
const _setAccountId = useCallback(
|
||||
|
||||
@ -9,11 +9,11 @@ import { AddressFlags, AddressIdentity, UseAccountInfo } from './types';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
import useAccounts from './useAccounts';
|
||||
import useAddresses from './useAddresses';
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
import useToggle from './useToggle';
|
||||
import { useAccounts } from './useAccounts';
|
||||
import { useAddresses } from './useAddresses';
|
||||
import { useApi } from './useApi';
|
||||
import { useCall } from './useCall';
|
||||
import { useToggle } from './useToggle';
|
||||
|
||||
const IS_NONE = {
|
||||
isCouncil: false,
|
||||
@ -32,7 +32,7 @@ const IS_NONE = {
|
||||
isTechCommittee: false
|
||||
};
|
||||
|
||||
export default function useAccountInfo (value: string | null, isContract = false): UseAccountInfo {
|
||||
export function useAccountInfo (value: string | null, isContract = false): UseAccountInfo {
|
||||
const { api } = useApi();
|
||||
const { isAccount } = useAccounts();
|
||||
const { isAddress } = useAddresses();
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import accountObservable from '@polkadot/ui-keyring/observable/accounts';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
interface UseAccounts {
|
||||
allAccounts: string[];
|
||||
@ -12,12 +12,12 @@ interface UseAccounts {
|
||||
isAccount: (address: string) => boolean;
|
||||
}
|
||||
|
||||
export default function useAccounts (): UseAccounts {
|
||||
export function useAccounts (): UseAccounts {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [state, setState] = useState<UseAccounts>({ allAccounts: [], hasAccounts: false, isAccount: () => false });
|
||||
|
||||
useEffect((): () => void => {
|
||||
const subscription = accountObservable.subject.subscribe((accounts): void => {
|
||||
const subscription = keyring.accounts.subject.subscribe((accounts): void => {
|
||||
if (mountedRef.current) {
|
||||
const allAccounts = accounts ? Object.keys(accounts) : [];
|
||||
const hasAccounts = allAccounts.length !== 0;
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import addressObservable from '@polkadot/ui-keyring/observable/addresses';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
interface UseAccounts {
|
||||
interface UseAddresses {
|
||||
allAddresses: string[];
|
||||
hasAddresses: boolean;
|
||||
isAddress: (address: string) => boolean;
|
||||
}
|
||||
|
||||
export default function useAccounts (): UseAccounts {
|
||||
export function useAddresses (): UseAddresses {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [state, setState] = useState<UseAccounts>({ allAddresses: [], hasAddresses: false, isAddress: () => false });
|
||||
const [state, setState] = useState<UseAddresses>({ allAddresses: [], hasAddresses: false, isAddress: () => false });
|
||||
|
||||
useEffect((): () => void => {
|
||||
const subscription = addressObservable.subject.subscribe((addresses): void => {
|
||||
const subscription = keyring.addresses.subject.subscribe((addresses): void => {
|
||||
if (mountedRef.current) {
|
||||
const allAddresses = addresses ? Object.keys(addresses) : [];
|
||||
const hasAddresses = allAddresses.length !== 0;
|
||||
|
||||
@ -6,6 +6,6 @@ import { ApiProps } from '@polkadot/react-api/types';
|
||||
import { useContext } from 'react';
|
||||
import { ApiContext } from '@polkadot/react-api';
|
||||
|
||||
export default function useApi (): ApiProps {
|
||||
export function useApi (): ApiProps {
|
||||
return useContext(ApiContext);
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import { Option, Vec } from '@polkadot/types';
|
||||
|
||||
type Unsub = () => void;
|
||||
|
||||
export default function useAvailableSlashes (): [BN, UnappliedSlash[]][] {
|
||||
export function useAvailableSlashes (): [BN, UnappliedSlash[]][] {
|
||||
const { api } = useApi();
|
||||
const indexes = useCall<DeriveSessionIndexes>(api.derive.session?.indexes);
|
||||
const earliestSlash = useCall<Option<EraIndex>>(api.query.staking?.earliestUnappliedSlash);
|
||||
|
||||
@ -12,7 +12,7 @@ type Result = [number, string];
|
||||
|
||||
const DEFAULT_TIME = new BN(6000);
|
||||
|
||||
export default function useBlockTime (blocks = BN_ONE): Result {
|
||||
export function useBlockTime (blocks = BN_ONE): Result {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
|
||||
import store from 'store';
|
||||
import useApi from './useApi';
|
||||
import { useApi } from './useApi';
|
||||
|
||||
// create a chain-specific key for the local cache
|
||||
export default function useCacheKey <T> (storageKeyBase: string): [(defaultValue?: T) => T | undefined, (value: T) => T] {
|
||||
export function useCacheKey <T> (storageKeyBase: string): [(defaultValue?: T) => T | undefined, (value: T) => T] {
|
||||
const { api, isDevelopment } = useApi();
|
||||
const storageKey = useMemo(
|
||||
() => `${storageKeyBase}:${isDevelopment ? 'development' : api.genesisHash.toHex()}`,
|
||||
|
||||
@ -8,7 +8,7 @@ import { CallOptions, CallParam, CallParams } from './types';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { isNull, isUndefined } from '@polkadot/util';
|
||||
|
||||
import useIsMountedRef, { MountedRef } from './useIsMountedRef';
|
||||
import { useIsMountedRef, MountedRef } from './useIsMountedRef';
|
||||
|
||||
type TrackFnResult = Promise<() => void>;
|
||||
|
||||
@ -94,7 +94,7 @@ function subscribe <T> (mountedRef: MountedRef, tracker: TrackerRef, fn: TrackFn
|
||||
// - returns a promise with an unsubscribe function
|
||||
// - has a callback to set the value
|
||||
// FIXME The typings here need some serious TLC
|
||||
export default function useCall <T> (fn: TrackFn | undefined | null | false, params?: CallParams, options?: CallOptions<T>): T | undefined {
|
||||
export function useCall <T> (fn: TrackFn | undefined | null | false, params?: CallParams, options?: CallOptions<T>): T | undefined {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const tracker = useRef<Tracker>({ count: 0, isActive: false, serialized: null, subscriber: null });
|
||||
const [value, setValue] = useState<T | undefined>((options || {}).defaultValue);
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import contractObservable from '@polkadot/ui-keyring/observable/contracts';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
interface UseContracts {
|
||||
allContracts: string[];
|
||||
@ -12,12 +12,12 @@ interface UseContracts {
|
||||
isContract: (address: string) => boolean;
|
||||
}
|
||||
|
||||
export default function useContracts (): UseContracts {
|
||||
export function useContracts (): UseContracts {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [state, setState] = useState<UseContracts>({ allContracts: [], hasContracts: false, isContract: () => false });
|
||||
|
||||
useEffect((): () => void => {
|
||||
const subscription = contractObservable.subject.subscribe((contracts): void => {
|
||||
const subscription = keyring.contracts.subject.subscribe((contracts): void => {
|
||||
if (mountedRef.current) {
|
||||
const allContracts = contracts ? Object.keys(contracts) : [];
|
||||
const hasContracts = allContracts.length !== 0;
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
const DEFAULT_DELAY = 250;
|
||||
|
||||
// Debounces inputs
|
||||
export default function useDebounce <T> (value: T, delay?: number): T {
|
||||
export function useDebounce <T> (value: T, delay?: number): T {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [debouncedValue, setDebouncedValue] = useState(value);
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import useCacheKey from './useCacheKey';
|
||||
import { useCacheKey } from './useCacheKey';
|
||||
|
||||
// hook for favorites with local storage
|
||||
export default function useFavorites (storageKeyBase: string): [string[], (address: string) => void] {
|
||||
export function useFavorites (storageKeyBase: string): [string[], (address: string) => void] {
|
||||
const [getCache, setCache] = useCacheKey<string[]>(storageKeyBase);
|
||||
const [favorites, setFavorites] = useState<string[]>(getCache() || []);
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ export type FormField<T> = [
|
||||
(_?: T | null) => void
|
||||
];
|
||||
|
||||
export default function useFormField<T> (defaultValue: T | null, validate: (_: T) => boolean = (): boolean => true): FormField<T> {
|
||||
export function useFormField<T> (defaultValue: T | null, validate: (_: T) => boolean = (): boolean => true): FormField<T> {
|
||||
const [value, setValue] = useState<T | null>(defaultValue);
|
||||
const isValid = useMemo(
|
||||
(): boolean => !!value && validate(value),
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { useCallback, useState } from 'react';
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
export default function useIncrement (defaultValue = 1): [number, () => void, (value: number) => void] {
|
||||
export function useIncrement (defaultValue = 1): [number, () => void, (value: number) => void] {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [value, setValue] = useState(defaultValue);
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ export function extractIpfsDetails (): State {
|
||||
: extractOther(url);
|
||||
}
|
||||
|
||||
export default function useIpfs (): State {
|
||||
export function useIpfs (): State {
|
||||
const [state] = useState(extractIpfsDetails());
|
||||
|
||||
return state;
|
||||
|
||||
@ -5,7 +5,7 @@ import { useEffect, useRef } from 'react';
|
||||
|
||||
export type MountedRef = React.MutableRefObject<boolean>;
|
||||
|
||||
export default function useIsMountedRef (): MountedRef {
|
||||
export function useIsMountedRef (): MountedRef {
|
||||
const isMounted = useRef(false);
|
||||
|
||||
useEffect((): () => void => {
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
export default function useLoadingDelay (delay = 100): boolean {
|
||||
export function useLoadingDelay (delay = 100): boolean {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ const transformMembers = {
|
||||
accounts.map((accountId) => accountId.toString())
|
||||
};
|
||||
|
||||
export default function useMembers (collective: 'council' | 'technicalCommittee' = 'council'): Result {
|
||||
export function useMembers (collective: 'council' | 'technicalCommittee' = 'council'): Result {
|
||||
const { api } = useApi();
|
||||
const { allAccounts, hasAccounts } = useAccounts();
|
||||
const retrieved = useCall<string[]>(hasAccounts && api.query[collective]?.members, undefined, transformMembers);
|
||||
|
||||
@ -5,9 +5,9 @@ import { ModalState } from './types';
|
||||
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import useToggle from './useToggle';
|
||||
import { useToggle } from './useToggle';
|
||||
|
||||
export default function useModal (defaultIsOpen?: boolean, onOpen?: () => void, onClose?: () => void): ModalState {
|
||||
export function useModal (defaultIsOpen?: boolean, onOpen?: () => void, onClose?: () => void): ModalState {
|
||||
const [isOpen, , setIsOpen] = useToggle(defaultIsOpen || false);
|
||||
const _onOpen = useCallback(
|
||||
(): void => {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2020 @polkadot/react-hooks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import useFormField, { FormField } from './useFormField';
|
||||
import { useFormField, FormField } from './useFormField';
|
||||
|
||||
export default function useNonEmptyString (initialValue = ''): FormField<string> {
|
||||
export function useNonEmptyString (initialValue = ''): FormField<string> {
|
||||
return useFormField(
|
||||
initialValue,
|
||||
(value?: string | null): boolean => (value && value.length > 0) || false
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import BN from 'bn.js';
|
||||
import useFormField, { FormField } from './useFormField';
|
||||
import { useFormField, FormField } from './useFormField';
|
||||
import { BN_ZERO } from '@polkadot/util';
|
||||
|
||||
export default function useNonZeroBn (initialValue: BN = BN_ZERO): FormField<BN> {
|
||||
export function useNonZeroBn (initialValue: BN = BN_ZERO): FormField<BN> {
|
||||
return useFormField(
|
||||
initialValue,
|
||||
(value: BN): boolean => !value.isZero()
|
||||
|
||||
@ -9,9 +9,9 @@ import { useEffect, useState } from 'react';
|
||||
import { registry } from '@polkadot/react-api';
|
||||
import { BN_ZERO } from '@polkadot/util';
|
||||
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useApi } from './useApi';
|
||||
import { useCall } from './useCall';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
import { useOwnStashIds } from './useOwnStashes';
|
||||
|
||||
interface State {
|
||||
@ -87,7 +87,7 @@ function getValRewards (validatorEras: ValidatorWithEras[], erasPoints: DeriveEr
|
||||
};
|
||||
}
|
||||
|
||||
export default function useOwnEraRewards (maxEras?: number, ownValidators?: StakerState[]): State {
|
||||
export function useOwnEraRewards (maxEras?: number, ownValidators?: StakerState[]): State {
|
||||
const { api } = useApi();
|
||||
const mountedRef = useIsMountedRef();
|
||||
const stashIds = useOwnStashIds();
|
||||
|
||||
@ -9,11 +9,11 @@ import { StakerState } from './types';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import useAccounts from './useAccounts';
|
||||
import useApi from './useApi';
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import useOwnStashes from './useOwnStashes';
|
||||
import useStashIds from './useStashIds';
|
||||
import { useAccounts } from './useAccounts';
|
||||
import { useApi } from './useApi';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
import { useOwnStashes } from './useOwnStashes';
|
||||
import { useStashIds } from './useStashIds';
|
||||
|
||||
type ValidatorInfo = ITuple<[ValidatorPrefs, Codec]> | ValidatorPrefs;
|
||||
type Queried = Record<string, [boolean, DeriveStakingAccount, ValidatorInfo]>;
|
||||
@ -55,7 +55,7 @@ function getStakerState (stashId: string, allAccounts: string[], allStashes: str
|
||||
};
|
||||
}
|
||||
|
||||
export default function useOwnStashInfos (): StakerState[] | undefined {
|
||||
export function useOwnStashInfos (): StakerState[] | undefined {
|
||||
const { api } = useApi();
|
||||
const { allAccounts } = useAccounts();
|
||||
const mountedRef = useIsMountedRef();
|
||||
|
||||
@ -6,9 +6,9 @@ import { AccountId, StakingLedger } from '@polkadot/types/interfaces';
|
||||
import { useMemo } from 'react';
|
||||
import { Option } from '@polkadot/types';
|
||||
|
||||
import useAccounts from './useAccounts';
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
import { useAccounts } from './useAccounts';
|
||||
import { useApi } from './useApi';
|
||||
import { useCall } from './useCall';
|
||||
|
||||
type IsInKeyring = boolean;
|
||||
|
||||
@ -30,7 +30,7 @@ function getStashes (allAccounts: string[], ownBonded: Option<AccountId>[], ownL
|
||||
return result;
|
||||
}
|
||||
|
||||
export default function useOwnStashes (): [string, IsInKeyring][] | undefined {
|
||||
export function useOwnStashes (): [string, IsInKeyring][] | undefined {
|
||||
const { allAccounts, hasAccounts } = useAccounts();
|
||||
const { api } = useApi();
|
||||
const ownBonded = useCall<Option<AccountId>[]>(hasAccounts && api.query.staking?.bonded.multi, [allAccounts]);
|
||||
|
||||
@ -11,7 +11,7 @@ interface PasswordProps {
|
||||
setIsPasswordValid: React.Dispatch<boolean>;
|
||||
}
|
||||
|
||||
export default function usePassword (): PasswordProps {
|
||||
export function usePassword (): PasswordProps {
|
||||
const [password, setPassword] = useState('');
|
||||
const [isPasswordValid, setIsPasswordValid] = useState(false);
|
||||
|
||||
|
||||
@ -6,9 +6,9 @@ import { RegistrarInfo } from '@polkadot/types/interfaces';
|
||||
import { useMemo } from 'react';
|
||||
import { Option } from '@polkadot/types';
|
||||
|
||||
import useAccounts from './useAccounts';
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
import { useAccounts } from './useAccounts';
|
||||
import { useApi } from './useApi';
|
||||
import { useCall } from './useCall';
|
||||
|
||||
interface RegistrarNull {
|
||||
address: string | null;
|
||||
@ -26,7 +26,7 @@ interface State {
|
||||
skipQuery?: boolean;
|
||||
}
|
||||
|
||||
export default function useRegistrars (skipQuery?: boolean): State {
|
||||
export function useRegistrars (skipQuery?: boolean): State {
|
||||
const { api } = useApi();
|
||||
const { allAccounts, hasAccounts } = useAccounts();
|
||||
const query = useCall<Option<RegistrarInfo>[]>(!skipQuery && hasAccounts && api.query.identity?.registrars);
|
||||
|
||||
@ -3,14 +3,14 @@
|
||||
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
import { useApi } from './useApi';
|
||||
import { useCall } from './useCall';
|
||||
|
||||
const transformStashes = {
|
||||
transform: (stashes: AccountId[]) => stashes.map((accountId) => accountId.toString())
|
||||
};
|
||||
|
||||
export default function useStashIds (): string[] | undefined {
|
||||
export function useStashIds (): string[] | undefined {
|
||||
const { api } = useApi();
|
||||
|
||||
return useCall<string[]>(api.derive.staking.stashes, undefined, transformStashes);
|
||||
|
||||
@ -6,15 +6,15 @@ import { UseSudo } from './types';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import useAccounts from './useAccounts';
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
import { useAccounts } from './useAccounts';
|
||||
import { useApi } from './useApi';
|
||||
import { useCall } from './useCall';
|
||||
|
||||
const transformSudo = {
|
||||
transform: (key: AccountId) => key.toString()
|
||||
};
|
||||
|
||||
export default function useSudo (): UseSudo {
|
||||
export function useSudo (): UseSudo {
|
||||
const { api } = useApi();
|
||||
const { allAccounts, hasAccounts } = useAccounts();
|
||||
const sudoKey = useCall<string>(hasAccounts && api.query.sudo?.key, undefined, transformSudo);
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
// Simple wrapper for a true/false toggle
|
||||
export default function useToggle (defaultValue = false, onToggle?: (isActive: boolean) => void): [boolean, () => void, (value: boolean) => void] {
|
||||
export function useToggle (defaultValue = false, onToggle?: (isActive: boolean) => void): [boolean, () => void, (value: boolean) => void] {
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [isActive, setActive] = useState(defaultValue);
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@ import { useMemo } from 'react';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { isFunction } from '@polkadot/util';
|
||||
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
import { useApi } from './useApi';
|
||||
import { useCall } from './useCall';
|
||||
|
||||
interface State {
|
||||
hasFailed: boolean;
|
||||
@ -51,7 +51,7 @@ function getStatus (api: ApiPromise, bestNumber: BlockNumber, votes: Votes, numM
|
||||
};
|
||||
}
|
||||
|
||||
export default function useVotingStatus (votes: Votes | null | undefined, numMembers: number, section: 'council' | 'technicalCommittee'): State {
|
||||
export function useVotingStatus (votes: Votes | null | undefined, numMembers: number, section: 'council' | 'technicalCommittee'): State {
|
||||
const { api } = useApi();
|
||||
const bestNumber = useCall<BlockNumber>(api.derive.chain.bestNumber);
|
||||
|
||||
|
||||
@ -7,15 +7,15 @@ import BN from 'bn.js';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { BN_ZERO } from '@polkadot/util';
|
||||
|
||||
import useApi from './useApi';
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import { useApi } from './useApi';
|
||||
import { useIsMountedRef } from './useIsMountedRef';
|
||||
|
||||
// a random address that we are using for our queries
|
||||
const ZERO_ACCOUNT = '5CAUdnwecHGxxyr5vABevAfZ34Fi4AaraDRMwfDQXQ52PXqg';
|
||||
const EMPTY_STATE: [BN, number] = [BN_ZERO, 0];
|
||||
|
||||
// for a given call, calculate the weight
|
||||
export default function useWeight (call?: Call | null): [BN, number] {
|
||||
export function useWeight (call?: Call | null): [BN, number] {
|
||||
const { api } = useApi();
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [state, setState] = useState(EMPTY_STATE);
|
||||
|
||||
@ -2,11 +2,9 @@
|
||||
"name": "@polkadot/react-params",
|
||||
"version": "0.66.2-5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"repository": "github:polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -7,7 +7,7 @@ import BN from 'bn.js';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { registry } from '@polkadot/react-api';
|
||||
import { Input, InputNumber } from '@polkadot/react-components';
|
||||
import { ClassOf } from '@polkadot/types';
|
||||
import { ClassOf } from '@polkadot/types/create';
|
||||
import { bnToBn, formatNumber, isUndefined } from '@polkadot/util';
|
||||
|
||||
import Bare from './Bare';
|
||||
|
||||
@ -5,9 +5,8 @@ import { TypeDef } from '@polkadot/types/types';
|
||||
import { RawParam, RawParamOnChange, RawParamOnEnter, RawParamOnEscape, Size } from '../types';
|
||||
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { Compact } from '@polkadot/types';
|
||||
import { Input } from '@polkadot/react-components';
|
||||
import { hexToU8a, isAscii, isHex, isU8a, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
||||
import { compactAddLength, hexToU8a, isAscii, isHex, isU8a, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
@ -83,7 +82,7 @@ function BaseBytes ({ asHex, children, className = '', defaultValue: { value },
|
||||
);
|
||||
|
||||
if (withLength && isValid) {
|
||||
value = Compact.addLengthPrefix(value);
|
||||
value = compactAddLength(value);
|
||||
}
|
||||
|
||||
onChange && onChange({
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user