Remove typesChain overrides (#7956)

This commit is contained in:
Jaco 2022-08-03 10:38:15 +02:00 committed by GitHub
parent 9d9f73a93c
commit ed5d253e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 133 deletions

View File

@ -1,103 +0,0 @@
// Copyright 2017-2022 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
// structs need to be in order
/* eslint-disable sort-keys */
export default {
AccountInfo: 'AccountInfoWithProviders',
Address: 'AccountId',
AddressInfo: 'Vec<u8>',
LookupSource: 'AccountId',
EraBenefits: {
total_benefits: 'Balance',
total_funds: 'Balance',
used_benefits: 'Balance',
active_era: 'EraIndex'
},
FeeReductionBenefit: {
funds: 'Balance',
total_fee_reduction_count: 'u32',
used_fee_reduction_quota: 'Balance',
used_fee_reduction_count: 'u32',
refreshed_at: 'EraIndex'
},
CsmBalance: 'Balance',
CsmBalanceOf: 'Balance',
ETHAddress: 'Vec<u8>',
EthereumTxHash: 'H256',
CSMLedger: {
total: 'Compact<Balance>',
active: 'Compact<Balance>',
unlocking: 'Vec<CSMUnlockChunk<Balance>>'
},
CSMUnlockChunk: {
value: 'Compact<Balance>',
bn: 'Compact<BlockNumber>'
},
FileInfo: {
file_size: 'u64',
expired_on: 'BlockNumber',
calculated_at: 'BlockNumber',
amount: 'Balance',
prepaid: 'Balance',
reported_replica_count: 'u32',
replicas: 'Vec<Replica<AccountId>>'
},
MerchantLedger: {
reward: 'Balance',
collateral: 'Balance'
},
Releases: {
_enum: ['V1_0_0', 'V2_0_0']
},
Replica: {
who: 'AccountId',
valid_at: 'BlockNumber',
anchor: 'SworkerAnchor',
is_reported: 'bool'
},
Status: {
_enum: ['Free', 'Reserved']
},
UsedInfo: {
used_size: 'u64',
reported_group_count: 'u32',
groups: 'BTreeMap<SworkerAnchor, bool>'
},
Guarantee: {
targets: 'Vec<IndividualExposure<AccountId, Balance>>',
total: 'Compact<Balance>',
submitted_in: 'EraIndex',
suppressed: 'bool'
},
ValidatorPrefs: {
guarantee_fee: 'Compact<Perbill>'
},
IASSig: 'Vec<u8>',
Identity: {
anchor: 'SworkerAnchor',
punishment_deadline: 'u64',
group: 'Option<AccountId>'
},
ISVBody: 'Vec<u8>',
MerkleRoot: 'Vec<u8>',
ReportSlot: 'u64',
PKInfo: {
code: 'SworkerCode',
anchor: 'Option<SworkerAnchor>'
},
SworkerAnchor: 'Vec<u8>',
SworkerCert: 'Vec<u8>',
SworkerCode: 'Vec<u8>',
SworkerPubKey: 'Vec<u8>',
SworkerSignature: 'Vec<u8>',
WorkReport: {
report_slot: 'u64',
used: 'u64',
free: 'u64',
reported_files_size: 'u64',
reported_srd_root: 'MerkleRoot',
reported_files_root: 'MerkleRoot'
}
};

View File

@ -1,12 +0,0 @@
// Copyright 2017-2022 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { typesChain } from '@phala/typedefs';
import CrustMaxwell from './crust-maxwell';
// alphabetical, based on the actual displayed name
export default {
...typesChain,
'Crust Maxwell': CrustMaxwell
};

View File

@ -3,18 +3,9 @@
import type { OverrideBundleType } from '@polkadot/types/types';
import typesChain from './chain';
import spec from './spec';
export * from './constants';
export * from './params';
export function getChainTypes (_specName: string, chainName: string): Record<string, string | Record<string, unknown>> {
return {
...(typesChain[chainName as keyof typeof typesChain] || {})
};
}
export const typesBundle: OverrideBundleType = { spec };
export { typesChain };

View File

@ -6,7 +6,7 @@ import fs from 'fs';
import { ApiPromise, WsProvider } from '@polkadot/api';
import { assert, isError, isString } from '@polkadot/util';
import { typesBundle, typesChain } from '../api';
import { typesBundle } from '../api';
import { createWsEndpoints } from '../endpoints';
import { fetchJson } from './fetch';
@ -41,8 +41,7 @@ function createChecker (issueFile: string, failures: string[]): (name: string, w
provider,
throwOnConnect: true,
throwOnUnknown: false,
typesBundle,
typesChain
typesBundle
});
setTimeout((): void => {

View File

@ -13,7 +13,7 @@ import store from 'store';
import { ApiPromise, WsProvider } from '@polkadot/api';
import { deriveMapCache, setDeriveCache } from '@polkadot/api-derive/util';
import { ethereumChains, typesBundle, typesChain } from '@polkadot/apps-config';
import { ethereumChains, typesBundle } from '@polkadot/apps-config';
import { web3Accounts, web3Enable } from '@polkadot/extension-dapp';
import { TokenUnit } from '@polkadot/react-components/InputNumber';
import { StatusContext } from '@polkadot/react-components/Status';
@ -265,8 +265,7 @@ async function createApi (apiUrl: string, signer: ApiSigner, onError: (error: un
registry,
signer,
types,
typesBundle,
typesChain
typesBundle
});
// See https://github.com/polkadot-js/api/pull/4672#issuecomment-1078843960

View File

@ -6,7 +6,7 @@ import type { ProviderInterface } from '@polkadot/rpc-provider/types';
import { useEffect, useMemo, useRef, useState } from 'react';
import { ApiPromise, WsProvider } from '@polkadot/api';
import { typesBundle, typesChain } from '@polkadot/apps-config';
import { typesBundle } from '@polkadot/apps-config';
import { arrayShuffle, isString } from '@polkadot/util';
import { createNamedHook } from './createNamedHook';
@ -45,8 +45,7 @@ function useApiUrlImpl (url?: null | string | string[]): ApiPromise | null {
ApiPromise
.create({
provider: (providerRef.current = new WsProvider(urls)),
typesBundle,
typesChain
typesBundle
})
.then((api) => mountedRef.current && setState(api))
.catch(console.error);