API optional augmentation (#4355)

* API optional augmentation

* Rebuild

* Rebuild

* Cleanups

* Adjust, no multi-imports

* Adjust

* Adjust

* Dedupe

* Augmented exports

* It builds via references (no circulars)

* Don't output *.manual.{js,cjs}
This commit is contained in:
Jaco
2021-12-19 21:30:34 +02:00
committed by GitHub
parent fe27d8059e
commit 3d4511607f
90 changed files with 282 additions and 322 deletions
-31
View File
@@ -1,31 +0,0 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { QueryableConsts } from '@polkadot/api-augment/consts';
import type { QueryableStorage } from '@polkadot/api-augment/query';
import type { SubmittableExtrinsics } from '@polkadot/api-augment/tx';
import type { DecoratedRpc, QueryableStorageMulti } from '@polkadot/api-base/types';
import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { Metadata } from '@polkadot/types';
import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { Registry, Signer } from '@polkadot/types/types';
declare module '@polkadot/api-base/types/api' {
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
export interface ApiInterfaceRx {
consts: QueryableConsts<'rxjs'>;
extrinsicType: number;
genesisHash?: Hash;
hasSubscriptions: boolean;
registry: Registry;
runtimeMetadata: Metadata;
runtimeVersion: RuntimeVersion;
query: QueryableStorage<'rxjs'>;
queryAt: (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion) => Observable<QueryableStorage<'rxjs'>>;
queryMulti: QueryableStorageMulti<'rxjs'>;
rpc: DecoratedRpc<'rxjs', RpcInterface>;
tx: SubmittableExtrinsics<'rxjs'>;
signer?: Signer;
}
}
@@ -1,5 +1,4 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
// augmented
export const __API_AUGMENT_TX = 'augmented';
import '@polkadot/types-augment';
+3 -8
View File
@@ -1,14 +1,14 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { ApiTypes, AugmentedConst, QueryableModuleConsts } from '@polkadot/api-base/types';
import type { ApiTypes } from '@polkadot/api-base/types';
import type { U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types';
import type { Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, PalletContractsSchedule, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
declare module '@polkadot/api-augment/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> {
declare module '@polkadot/api-base/types/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> {
assets: {
/**
* The amount of funds that must be reserved when creating a new approval.
@@ -951,9 +951,4 @@ declare module '@polkadot/api-augment/consts' {
[key: string]: Codec;
};
} // AugmentedConsts
export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> {
[key: string]: QueryableModuleConsts;
} // QueryableConsts
} // declare module
+2 -7
View File
@@ -1,9 +1,9 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { ApiTypes, AugmentedError, ModuleErrors } from '@polkadot/api-base/types';
import type { ApiTypes } from '@polkadot/api-base/types';
declare module '@polkadot/api-augment/errors' {
declare module '@polkadot/api-base/types/errors' {
export interface AugmentedErrors<ApiType extends ApiTypes> {
assets: {
/**
@@ -1559,9 +1559,4 @@ declare module '@polkadot/api-augment/errors' {
[key: string]: AugmentedError<ApiType>;
};
} // AugmentedErrors
export interface DecoratedErrors<ApiType extends ApiTypes> extends AugmentedErrors<ApiType> {
[key: string]: ModuleErrors<ApiType>;
} // DecoratedErrors
} // declare module
+2 -7
View File
@@ -1,13 +1,13 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { ApiTypes, AugmentedEvent, ModuleEvents } from '@polkadot/api-base/types';
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, NodeRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError } from '@polkadot/types/lookup';
declare module '@polkadot/api-augment/events' {
declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> {
assets: {
/**
@@ -1154,9 +1154,4 @@ declare module '@polkadot/api-augment/events' {
[key: string]: AugmentedEvent<ApiType>;
};
} // AugmentedEvents
export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEvents<ApiType> {
[key: string]: ModuleEvents<ApiType>;
} // DecoratedEvents
} // declare module
+1 -3
View File
@@ -1,12 +1,10 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '@polkadot/rpc-augment';
import '@polkadot/types-augment';
import './consts';
import './errors';
import './events';
import './query';
import './tx';
// these are external to this module
import './api';
import './rpc';
+2 -11
View File
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { ApiTypes, AugmentedQuery, QueryableModuleStorage, QueryableModuleStorageAt, QueryableStorageEntry } from '@polkadot/api-base/types';
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
@@ -9,7 +9,7 @@ import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';
declare module '@polkadot/api-augment/query' {
declare module '@polkadot/api-base/types/storage' {
export interface AugmentedQueries<ApiType extends ApiTypes> {
assets: {
/**
@@ -1450,13 +1450,4 @@ declare module '@polkadot/api-augment/query' {
[key: string]: QueryableStorageEntry<ApiType>;
};
} // AugmentedQueries
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
[key: string]: QueryableModuleStorage<ApiType>;
} // QueryableStorage
export interface QueryableStorageAt<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
[key: string]: QueryableModuleStorageAt<ApiType>;
} // QueryableStorageAt
} // declare module
+2 -9
View File
@@ -1,15 +1,14 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction, SubmittableModuleExtrinsics } from '@polkadot/api-base/types';
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
import type { NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
declare module '@polkadot/api-augment/tx' {
declare module '@polkadot/api-base/types/submittable' {
export interface AugmentedSubmittables<ApiType extends ApiTypes> {
assets: {
/**
@@ -4655,10 +4654,4 @@ declare module '@polkadot/api-augment/tx' {
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
} // AugmentedSubmittables
export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> {
(extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType>;
[key: string]: SubmittableModuleExtrinsics<ApiType>;
} // SubmittableExtrinsics
} // declare module
-3
View File
@@ -1,9 +1,6 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
// trigger in the same way as we do externally
import './augment';
export { packageInfo } from './packageInfo';
export * from './types';
-5
View File
@@ -1,5 +0,0 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
// augmented
export const __API_AUGMENT_CONSTS = 'augmented';
+2 -2
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as rpcInfo } from '@polkadot/rpc-core/packageInfo';
import { packageInfo as baseInfo } from '@polkadot/api-base/packageInfo';
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [rpcInfo, typesInfo]);
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [baseInfo, typesInfo]);
-5
View File
@@ -1,5 +0,0 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
// augmented
export const __API_AUGMENT_ERRORS = 'augmented';
-5
View File
@@ -1,5 +0,0 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
// augmented
export const __API_AUGMENT_EVENTS = 'augmented';
-5
View File
@@ -1,5 +0,0 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
// augmented
export const __API_AUGMENT_QUERY = 'augmented';
-12
View File
@@ -1,12 +0,0 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
// trigger in the same way as we do externally
import '@polkadot/api-augment';
// Important: we do the exports here via the full package name
export * from '@polkadot/api-augment/consts';
export * from '@polkadot/api-augment/errors';
export * from '@polkadot/api-augment/events';
export * from '@polkadot/api-augment/query';
export * from '@polkadot/api-augment/tx';