Skip to content

Commit

Permalink
Bump dev (#5591)
Browse files Browse the repository at this point in the history
* Bump dev

* Adjust

* Adjust
  • Loading branch information
jacogr authored Apr 13, 2023
1 parent 8fe02a1 commit a7526ba
Show file tree
Hide file tree
Showing 46 changed files with 218 additions and 225 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"test:one": "polkadot-dev-run-test --env node"
},
"devDependencies": {
"@polkadot/dev": "^0.72.39",
"@polkadot/dev": "^0.72.42",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/node": "^18.15.11"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/api-base/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ApiInterfaceRx {
call: QueryableCalls<'rxjs'>;
consts: QueryableConsts<'rxjs'>;
extrinsicType: number;
genesisHash?: Hash;
genesisHash?: Hash | undefined;
hasSubscriptions: boolean;
registry: Registry;
runtimeMetadata: Metadata;
Expand All @@ -22,7 +22,7 @@ export interface ApiInterfaceRx {
queryMulti: QueryableStorageMulti<'rxjs'>;
rpc: DecoratedRpc<'rxjs', RpcInterface>;
tx: SubmittableExtrinsics<'rxjs'>;
signer?: Signer;
signer?: Signer | undefined;

callAt: (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion) => Observable<QueryableCalls<'rxjs'>>;
queryAt: (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion) => Observable<QueryableStorage<'rxjs'>>;
Expand Down
8 changes: 4 additions & 4 deletions packages/api-base/src/types/submittable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export type SubmittablePaymentResult<ApiType extends ApiTypes> =
: Promise<RuntimeDispatchInfo>;

export interface SubmittableResultValue {
dispatchError?: DispatchError;
dispatchInfo?: DispatchInfo;
dispatchError?: DispatchError | undefined;
dispatchInfo?: DispatchInfo | undefined;
events?: EventRecord[];
internalError?: Error;
internalError?: Error | undefined;
status: ExtrinsicStatus;
txHash: Hash;
txIndex?: number;
txIndex?: number | undefined;
blockNumber?: BlockNumber;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/api-contract/src/base/Blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface BlueprintConstructor<ApiType extends ApiTypes> {
}

export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
readonly contract?: Contract<ApiType>;
readonly contract?: Contract<ApiType> | undefined;

constructor (result: ISubmittableResult, contract?: Contract<ApiType>) {
super(result);
Expand Down
12 changes: 6 additions & 6 deletions packages/api-contract/src/base/Code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export interface CodeConstructor<ApiType extends ApiTypes> {
}

export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
readonly blueprint?: Blueprint<ApiType>;
readonly contract?: Contract<ApiType>;
readonly blueprint?: Blueprint<ApiType> | undefined;
readonly contract?: Contract<ApiType> | undefined;

constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>, contract?: Contract<ApiType>) {
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType> | undefined, contract?: Contract<ApiType> | undefined) {
super(result);

this.blueprint = blueprint;
Expand Down Expand Up @@ -77,14 +77,14 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
encodeSalt(salt)
).withResultTransform((result: ISubmittableResult) =>
new CodeSubmittableResult(result, ...(applyOnEvent(result, ['CodeStored', 'Instantiated'], (records: EventRecord[]) =>
records.reduce<[Blueprint<ApiType>?, Contract<ApiType>?]>(([blueprint, contract], { event }) =>
records.reduce<[Blueprint<ApiType> | undefined, Contract<ApiType> | undefined]>(([blueprint, contract], { event }) =>
this.api.events.contracts.Instantiated.is(event)
? [blueprint, new Contract<ApiType>(this.api, this.abi, (event as unknown as { data: [Codec, AccountId] }).data[1], this._decorateMethod)]
: this.api.events.contracts.CodeStored.is(event)
? [new Blueprint<ApiType>(this.api, this.abi, (event as unknown as { data: [AccountId] }).data[0], this._decorateMethod), contract]
: [blueprint, contract],
[])
) || []))
[undefined, undefined])
) || [undefined, undefined]))
);
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api-contract/src/base/Contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function createTx <ApiType extends ApiTypes> (meta: AbiMessage, fn: (options: Co
}

export class ContractSubmittableResult extends SubmittableResult {
readonly contractEvents?: DecodedEvent[];
readonly contractEvents?: DecodedEvent[] | undefined;

constructor (result: ISubmittableResult, contractEvents?: DecodedEvent[]) {
super(result);
Expand Down
2 changes: 1 addition & 1 deletion packages/api-contract/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ export interface WeightAll {
v1Weight: BN;
v2Weight: {
refTime: BN;
proofSize?: BN;
proofSize?: BN | undefined;
};
}
2 changes: 1 addition & 1 deletion packages/api-derive/src/accounts/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function retrieveNick (api: DeriveApi, accountId?: AccountId): Observable<string
export function info (instanceId: string, api: DeriveApi): (address?: AccountIndex | AccountId | Address | Uint8Array | string | null) => Observable<DeriveAccountInfo> {
return memo(instanceId, (address?: AccountIndex | AccountId | Address | Uint8Array | string | null): Observable<DeriveAccountInfo> =>
api.derive.accounts.idAndIndex(address).pipe(
switchMap(([accountId, accountIndex]): Observable<[Partial<DeriveAccountInfo>, DeriveAccountRegistration, string?]> =>
switchMap(([accountId, accountIndex]): Observable<[Partial<DeriveAccountInfo>, DeriveAccountRegistration, string | undefined]> =>
combineLatest([
of({ accountId, accountIndex }),
api.derive.accounts.identity(accountId),
Expand Down
34 changes: 17 additions & 17 deletions packages/api-derive/src/accounts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@

import type { AccountId, AccountIndex, RegistrationJudgement } from '@polkadot/types/interfaces';

export type AccountIdAndIndex = [AccountId?, AccountIndex?];
export type AccountIdAndIndex = [AccountId | undefined, AccountIndex | undefined];

export type AccountIndexes = Record<string, AccountIndex>;

export interface DeriveAccountRegistration {
display?: string;
displayParent?: string;
email?: string;
image?: string;
legal?: string;
other?: Record<string, string>;
parent?: AccountId;
pgp?: string;
riot?: string;
twitter?: string;
web?: string;
display?: string | undefined;
displayParent?: string | undefined;
email?: string | undefined;
image?: string | undefined;
legal?: string | undefined;
other?: Record<string, string> | undefined;
parent?: AccountId | undefined;
pgp?: string | undefined;
riot?: string | undefined;
twitter?: string | undefined;
web?: string | undefined;
judgements: RegistrationJudgement[];
}

Expand All @@ -30,14 +30,14 @@ export interface DeriveAccountFlags {
}

export interface DeriveAccountInfo {
accountId?: AccountId;
accountIndex?: AccountIndex;
accountId?: AccountId | undefined;
accountIndex?: AccountIndex | undefined;
identity: DeriveAccountRegistration;
nickname?: string;
nickname?: string | undefined;
}

export interface DeriveHasIdentity {
display?: string;
display?: string | undefined;
hasIdentity: boolean;
parentId?: string;
parentId?: string | undefined;
}
10 changes: 5 additions & 5 deletions packages/api-derive/src/democracy/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface DeriveDemocracyLock {

export interface DeriveProposalImage extends AtBlock {
balance: Balance;
proposal?: Call;
proposal?: Call | undefined;
proposalHash?: HexString;
proposalLen?: number;
proposer: AccountId;
Expand All @@ -32,27 +32,27 @@ export interface DeriveProposalImage extends AtBlock {
export interface DeriveDispatch extends AtBlock {
index: ReferendumIndex;
imageHash: HexString;
image?: DeriveProposalImage;
image?: DeriveProposalImage | undefined;
}

export interface DeriveProposal {
balance?: Balance;
index: PropIndex;
image?: DeriveProposalImage;
image?: DeriveProposalImage | undefined;
imageHash: Hash;
proposer: AccountId;
seconds: Vec<AccountId>;
}

export interface DeriveProposalExternal {
image?: DeriveProposalImage;
image?: DeriveProposalImage | undefined;
imageHash: HexString;
threshold: PalletDemocracyVoteThreshold;
}

export interface DeriveReferendum {
index: ReferendumIndex;
image?: DeriveProposalImage;
image?: DeriveProposalImage | undefined;
imageHash: HexString;
status: PalletDemocracyReferendumStatus | ReferendumInfoTo239;
}
Expand Down
10 changes: 5 additions & 5 deletions packages/api-derive/src/society/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import type { PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletS

export interface DeriveSociety {
bids: PalletSocietyBid[];
defender?: AccountId;
defender?: AccountId | undefined;
hasDefender: boolean;
head?: AccountId;
founder?: AccountId;
head?: AccountId | undefined;
founder?: AccountId | undefined;
maxMembers: u32;
pot: BalanceOf;
}
Expand All @@ -28,6 +28,6 @@ export interface DeriveSocietyMember {
isSuspended: boolean;
payouts: [BlockNumber, Balance][];
strikes: StrikeCount;
vote?: PalletSocietyVote;
vouching?: PalletSocietyVouchingStatus;
vote?: PalletSocietyVote | undefined;
vouching?: PalletSocietyVouchingStatus | undefined;
}
2 changes: 1 addition & 1 deletion packages/api-derive/src/type/HeaderExtended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function createHeaderExtended (registry: Registry, header?: Header, valid
const HeaderBase = registry.createClass('Header');

class Implementation extends HeaderBase implements HeaderExtended {
readonly #author?: AccountId;
readonly #author?: AccountId | undefined;

constructor (registry: Registry, header?: Header, validators?: AccountId[] | null, author?: AccountId | null) {
super(registry, header);
Expand Down
2 changes: 1 addition & 1 deletion packages/api-derive/src/type/SignedBlockExtended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function createSignedBlockExtended (registry: Registry, block?: SignedBlo
const SignedBlockBase = registry.createClass('SignedBlock');

class Implementation extends SignedBlockBase implements SignedBlockExtended {
readonly #author?: AccountId;
readonly #author?: AccountId | undefined;
readonly #events: EventRecord[];
readonly #extrinsics: TxWithEvent[];

Expand Down
4 changes: 2 additions & 2 deletions packages/api-derive/src/type/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export interface SignedBlockExtended extends SignedBlock {
}

export interface TxWithEvent {
dispatchError?: DispatchError;
dispatchInfo?: DispatchInfo;
dispatchError?: DispatchError | undefined;
dispatchInfo?: DispatchInfo | undefined;
events: Event[];
extrinsic: Extrinsic;
}
2 changes: 1 addition & 1 deletion packages/api/src/base/Decorate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface MetaDecoration {
}

interface FullDecoration<ApiType extends ApiTypes> {
createdAt?: Uint8Array;
createdAt?: Uint8Array | undefined;
decoratedApi: ApiDecoration<ApiType>;
decoratedMeta: DecoratedMeta;
}
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/submittable/Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ function extractInfo (events: EventRecord[] = []): DispatchInfo | undefined {
}

export class SubmittableResult implements ISubmittableResult {
readonly dispatchError?: DispatchError;
readonly dispatchError?: DispatchError | undefined;

readonly dispatchInfo?: DispatchInfo;
readonly dispatchInfo?: DispatchInfo | undefined;

readonly internalError?: Error;
readonly internalError?: Error | undefined;

readonly events: EventRecord[];

readonly status: ExtrinsicStatus;

readonly txHash: Hash;

readonly txIndex?: number;
readonly txIndex?: number | undefined;

readonly blockNumber?: BlockNumber;
readonly blockNumber?: BlockNumber | undefined;

constructor ({ blockNumber, dispatchError, dispatchInfo, events, internalError, status, txHash, txIndex }: SubmittableResultValue) {
this.dispatchError = dispatchError || extractError(events);
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/submittable/createClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { SubmittableResult } from './Result.js';
interface SubmittableOptions<ApiType extends ApiTypes> {
api: ApiInterfaceRx;
apiType: ApiTypes;
blockHash?: Uint8Array;
blockHash?: Uint8Array | undefined;
decorateMethod: ApiBase<ApiType>['_decorateMethod'];
}

Expand Down Expand Up @@ -58,7 +58,7 @@ function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions
});
}

function makeSignAndSendOptions (partialOptions?: Partial<SignerOptions> | Callback<ISubmittableResult>, statusCb?: Callback<ISubmittableResult>): [Partial<SignerOptions>, Callback<ISubmittableResult>?] {
function makeSignAndSendOptions (partialOptions?: Partial<SignerOptions> | Callback<ISubmittableResult>, statusCb?: Callback<ISubmittableResult>): [Partial<SignerOptions>, Callback<ISubmittableResult> | undefined] {
let options: Partial<SignerOptions> = {};

if (isFunction(partialOptions)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-provider/src/substrate-connect/Health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class InnerChecker {
let parsedResponse: {id: string, result?: SmoldotHealth, params?: { subscription: string }};

try {
parsedResponse = JSON.parse(jsonRpcResponse) as { id: string, result: undefined | SmoldotHealth };
parsedResponse = JSON.parse(jsonRpcResponse) as { id: string, result?: SmoldotHealth };
} catch {
return jsonRpcResponse;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-provider/src/substrate-connect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ScProvider implements ProviderInterface {
readonly #Sc: SubstrateConnect;
readonly #coder: RpcCoder = new RpcCoder();
readonly #spec: string | ScType.WellKnownChain;
readonly #sharedSandbox?: ScProvider;
readonly #sharedSandbox?: ScProvider | undefined;
readonly #subscriptions: Map<string, [ResponseCallback, { unsubscribeMethod: string; id: string | number }]> = new Map();
readonly #resubscribeMethods: Map<string, ActiveSubs> = new Map();
readonly #requests: Map<number, ResponseCallback> = new Map();
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-provider/src/ws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface WsStateAwaiting {
method: string;
params: unknown[];
start: number;
subscription?: SubscriptionHandler;
subscription?: SubscriptionHandler | undefined;
}

interface WsStateSubscription extends SubscriptionHandler {
Expand Down
2 changes: 1 addition & 1 deletion packages/typegen/src/generate/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { ExtraTypes } from './types.js';
import Handlebars from 'handlebars';

import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { unwrapStorageSi } from '@polkadot/types/primitive/StorageKey';
import { unwrapStorageSi } from '@polkadot/types/util';
import lookupDefinitions from '@polkadot/types-augment/lookup/definitions';
import { stringCamelCase } from '@polkadot/util';

Expand Down
2 changes: 1 addition & 1 deletion packages/typegen/src/metadataMd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Metadata, TypeRegistry, Vec } from '@polkadot/types';
import * as definitions from '@polkadot/types/interfaces/definitions';
import { getStorage as getSubstrateStorage } from '@polkadot/types/metadata/decorate/storage/getStorage';
import { Text } from '@polkadot/types/primitive';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { unwrapStorageType } from '@polkadot/types/util';
import kusamaMeta, { rpc as kusamaRpc, version as kusamaVer } from '@polkadot/types-support/metadata/static-kusama';
import polkadotMeta, { rpc as polkadotRpc, version as polkadotVer } from '@polkadot/types-support/metadata/static-polkadot';
import substrateMeta from '@polkadot/types-support/metadata/static-substrate';
Expand Down
4 changes: 2 additions & 2 deletions packages/types-codec/src/abstract/Base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type { AnyJson, BareOpts, Codec, Inspect, IU8a, Registry } from '../types
export abstract class AbstractBase<T extends Codec> implements Codec {
readonly registry: Registry;

public createdAtHash?: IU8a;
public initialU8aLength?: number;
public createdAtHash?: IU8a | undefined;
public initialU8aLength?: number | undefined;
public isStorageFallback?: boolean;

readonly #raw: T;
Expand Down
2 changes: 1 addition & 1 deletion packages/types-codec/src/abstract/Object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export abstract class AbstractObject<T extends ToString> implements CodecObject<
readonly registry: Registry;

public createdAtHash?: IU8a;
public initialU8aLength?: number;
public initialU8aLength?: number | undefined;
public isStorageFallback?: boolean;

readonly $: T;
Expand Down
Loading

0 comments on commit a7526ba

Please sign in to comment.