Skip to content

Commit

Permalink
api, api-{augment, base, contract, derive}, rpc-{augment, core, provi…
Browse files Browse the repository at this point in the history
…der}, types, types-{augment, codec, create, known} 11.1.1
  • Loading branch information
github-actions[bot] committed May 21, 2024
1 parent d73d527 commit 424f9c1
Show file tree
Hide file tree
Showing 25 changed files with 132 additions and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## master

- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 11.1.1
- phishing 0.22.7
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 11.0.3
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 11.0.2
Expand Down
2 changes: 1 addition & 1 deletion api-augment/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/api-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/api-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion api-base/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/api-base', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/api-base', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
4 changes: 3 additions & 1 deletion api-base/types/submittable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import type { Observable } from 'https://esm.sh/rxjs@7.8.1';
import type { AccountId, Address, ApplyExtrinsicResult, BlockNumber, Call, DispatchError, DispatchInfo, EventRecord, Extrinsic, ExtrinsicStatus, Hash, RuntimeDispatchInfo } from 'https://deno.land/x/polkadot/types/interfaces/index.ts';
import type { AnyFunction, AnyNumber, AnyTuple, Callback, CallBase, Codec, IExtrinsicEra, IKeyringPair, ISubmittableResult, Signer } from 'https://deno.land/x/polkadot/types/types/index.ts';
import type { AnyFunction, AnyNumber, AnyTuple, AnyU8a, Callback, CallBase, Codec, IExtrinsicEra, IKeyringPair, ISubmittableResult, Signer } from 'https://deno.land/x/polkadot/types/types/index.ts';
import type { ApiTypes, EmptyBase, PromiseOrObs } from './base.ts';

export type AugmentedSubmittable<T extends AnyFunction, A extends AnyTuple = AnyTuple> = T & CallBase<A>;
Expand All @@ -15,6 +15,8 @@ export interface SignerOptions {
signer?: Signer;
tip?: AnyNumber;
assetId?: AnyNumber | object;
mode?: AnyNumber;
metadataHash?: AnyU8a;
}

export type SubmittableDryRunResult<ApiType extends ApiTypes> =
Expand Down
2 changes: 1 addition & 1 deletion api-contract/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/api-contract', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/api-contract', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
26 changes: 23 additions & 3 deletions api-derive/accounts/identity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import type { Observable } from 'https://esm.sh/rxjs@7.8.1';
import type { Bytes, Data } from 'https://deno.land/x/polkadot/types/mod.ts';
import type { AccountId } from 'https://deno.land/x/polkadot/types/interfaces/index.ts';
import type { Bytes, Data, Struct } from 'https://deno.land/x/polkadot/types/mod.ts';
import type { AccountId, H160 } from 'https://deno.land/x/polkadot/types/interfaces/index.ts';
import type { PalletIdentityLegacyIdentityInfo, PalletIdentityRegistration } from 'https://deno.land/x/polkadot/types/lookup.ts';
import type { Option } from 'https://deno.land/x/polkadot/types-codec/mod.ts';
import type { ITuple } from 'https://deno.land/x/polkadot/types-codec/types/index.ts';
Expand All @@ -15,9 +15,26 @@ import { firstMemo, memo } from '../util/index.ts';

type IdentityInfoAdditional = PalletIdentityLegacyIdentityInfo['additional'][0];

interface PeopleIdentityInfo extends Struct {
display: Data;
legal: Data;
web: Data;
matrix: Data;
email: Data;
pgpFingerprint: Option<H160>;
image: Data;
twitter: Data;
github: Data;
discord: Data;
}

const UNDEF_HEX = { toHex: () => undefined };

function dataAsString (data: Data): string | undefined {
if (!data) {
return data;
}

return data.isRaw
? u8aToString(data.asRaw.toU8a(true))
: data.isNone
Expand Down Expand Up @@ -55,13 +72,16 @@ function extractIdentity (identityOfOpt?: Option<ITuple<[PalletIdentityRegistrat
const topDisplay = dataAsString(info.display);

return {
discord: dataAsString((info as unknown as PeopleIdentityInfo).discord),
display: (superOf && dataAsString(superOf[1])) || topDisplay,
displayParent: superOf && topDisplay,
email: dataAsString(info.email),
github: dataAsString((info as unknown as PeopleIdentityInfo).github),
image: dataAsString(info.image),
judgements,
legal: dataAsString(info.legal),
other: extractOther(info.additional),
matrix: dataAsString((info as unknown as PeopleIdentityInfo).matrix),
other: info.additional ? extractOther(info.additional) : {},
parent: superOf?.[0],
pgp: info.pgpFingerprint.unwrapOr(UNDEF_HEX).toHex(),
riot: dataAsString(info.riot),
Expand Down
3 changes: 3 additions & 0 deletions api-derive/accounts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ export type AccountIdAndIndex = [AccountId | undefined, AccountIndex | undefined
export type AccountIndexes = Record<string, AccountIndex>;

export interface DeriveAccountRegistration {
discord?: string | undefined;
display?: string | undefined;
displayParent?: string | undefined;
email?: string | undefined;
github?: string | undefined;
image?: string | undefined;
legal?: string | undefined;
matrix?: string | undefined;
other?: Record<string, string> | undefined;
parent?: AccountId | undefined;
pgp?: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion api-derive/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/api-derive', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/api-derive', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
6 changes: 4 additions & 2 deletions api-derive/staking/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ export function nextElected (instanceId: string, api: DeriveApi): () => Observab
// only populate for next era in the last session, so track both here - entries are not
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
switchMap(({ currentEra }) => api.query.staking.erasStakersPaged.keys(currentEra)),
map((keys) => keys.map(({ args: [, accountId] }) => accountId))
// Dedupe any duplicates
map((keys) => [...new Set(keys.map(({ args: [, accountId] }) => accountId.toString()))].map((a) => api.registry.createType('AccountId', a)))
)
: api.query.staking.erasStakers
? api.derive.session.indexes().pipe(
// only populate for next era in the last session, so track both here - entries are not
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
switchMap(({ currentEra }) => api.query.staking.erasStakers.keys(currentEra)),
map((keys) => keys.map(({ args: [, accountId] }) => accountId))
// Dedupe any duplicates
map((keys) => [...new Set(keys.map(({ args: [, accountId] }) => accountId.toString()))].map((a) => api.registry.createType('AccountId', a)))
)
: api.query.staking['currentElected']<AccountId[]>()
);
Expand Down
2 changes: 1 addition & 1 deletion api/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/api', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/api', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion rpc-augment/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/rpc-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/rpc-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion rpc-core/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/rpc-core', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/rpc-core', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion rpc-provider/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/rpc-provider', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/rpc-provider', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion types-augment/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/types-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/types-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion types-codec/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/types-codec', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/types-codec', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion types-create/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/types-create', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/types-create', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
2 changes: 1 addition & 1 deletion types-known/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/types-known', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/types-known', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
14 changes: 11 additions & 3 deletions types/extrinsic/Extrinsic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { AnyJson, AnyTuple, AnyU8a, ArgsDef, IMethod, Inspect, IOption } fr
import type { HexString } from 'https://deno.land/x/polkadot/util/types.ts';
import type { EcdsaSignature, Ed25519Signature, ExtrinsicUnknown, ExtrinsicV4, Sr25519Signature } from '../interfaces/extrinsics/index.ts';
import type { FunctionMetadataLatest } from '../interfaces/metadata/index.ts';
import type { Address, Call, CodecHash } from '../interfaces/runtime/index.ts';
import type { Address, Call, CodecHash, Hash } from '../interfaces/runtime/index.ts';
import type { MultiLocation } from '../interfaces/types.ts';
import type { CallBase, ExtrinsicPayloadValue, ICompact, IExtrinsic, IKeyringPair, INumber, Registry, SignatureOptions } from '../types/index.ts';
import type { GenericExtrinsicEra } from './ExtrinsicEra.ts';
Expand Down Expand Up @@ -191,10 +191,17 @@ abstract class ExtrinsicBase<A extends AnyTuple> extends AbstractBase<ExtrinsicV
/**
* @description Forward compat
*/
public get assetId (): IOption<INumber> | IOption<MultiLocation> {
public get assetId (): IOption<INumber | MultiLocation> {
return this.inner.signature.assetId;
}

/**
* @description Forward compat
*/
public get metadataHash (): IOption<Hash> {
return this.inner.signature.metadataHash;
}

/**
* @description Returns the raw transaction version (not flagged with signing information)
*/
Expand Down Expand Up @@ -320,8 +327,9 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
},
this.isSigned
? {
assetId: this.assetId.toHuman(isExpanded, disableAscii),
assetId: this.assetId ? this.assetId.toHuman(isExpanded, disableAscii) : null,
era: this.era.toHuman(isExpanded, disableAscii),
metadataHash: this.metadataHash ? this.metadataHash.toHex() : null,
nonce: this.nonce.toHuman(isExpanded, disableAscii),
signature: this.signature.toHex(),
signer: this.signer.toHuman(isExpanded, disableAscii),
Expand Down
11 changes: 9 additions & 2 deletions types/extrinsic/ExtrinsicPayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { AnyJson, BareOpts, Registry } from 'https://deno.land/x/polkadot/t
import type { HexString } from 'https://deno.land/x/polkadot/util/types.ts';
import type { BlockHash } from '../interfaces/chain/index.ts';
import type { ExtrinsicPayloadV4 } from '../interfaces/extrinsics/index.ts';
import type { MultiLocation } from '../interfaces/types.ts';
import type { Hash, MultiLocation } from '../interfaces/types.ts';
import type { ExtrinsicPayloadValue, ICompact, IKeyringPair, INumber, IOption } from '../types/index.ts';
import type { GenericExtrinsicEra } from './ExtrinsicEra.ts';

Expand Down Expand Up @@ -110,10 +110,17 @@ export class GenericExtrinsicPayload extends AbstractBase<ExtrinsicPayloadVx> {
/**
* @description The (optional) asset id as a [[u32]] or [[MultiLocation]] for this payload
*/
public get assetId (): IOption<INumber | IOption<MultiLocation>> {
public get assetId (): IOption<INumber | MultiLocation> {
return this.inner.assetId;
}

/**
* @description The (optional) [[Hash]] of the genesis metadata for this payload
*/
public get metadataHash (): IOption<Hash> {
return this.inner.metadataHash;
}

/**
* @description Compares the value of the input to see if there is a match
*/
Expand Down
19 changes: 18 additions & 1 deletion types/extrinsic/SignerPayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import { objectProperty, objectSpread, u8aToHex } from 'https://deno.land/x/polk

export interface SignerPayloadType extends Codec {
address: Address;
assetId: IOption<INumber | MultiLocation>;
blockHash: Hash;
blockNumber: INumber;
era: ExtrinsicEra;
genesisHash: Hash;
metadataHash: IOption<Hash>;
method: Call;
mode: INumber;
nonce: ICompact<INumber>;
runtimeVersion: IRuntimeVersion;
signedExtensions: Vec<Text>;
Expand All @@ -24,11 +27,14 @@ export interface SignerPayloadType extends Codec {

const knownTypes: Record<string, string> = {
address: 'Address',
assetId: 'Option<TAssetConversion>',
blockHash: 'Hash',
blockNumber: 'BlockNumber',
era: 'ExtrinsicEra',
genesisHash: 'Hash',
metadataHash: 'Option<[u8;32]>',
method: 'Call',
mode: 'u8',
nonce: 'Compact<Index>',
runtimeVersion: 'RuntimeVersion',
signedExtensions: 'Vec<Text>',
Expand Down Expand Up @@ -102,14 +108,22 @@ export class GenericSignerPayload extends Struct implements ISignerPayload, Sign
return this.getT('tip');
}

get assetId (): IOption<INumber> | IOption<MultiLocation> {
get assetId (): IOption<INumber | MultiLocation> {
return this.getT('assetId');
}

get version (): INumber {
return this.getT('version');
}

get mode (): INumber {
return this.getT('mode');
}

get metadataHash (): IOption<Hash> {
return this.getT('metadataHash');
}

/**
* @description Creates an representation of the structure as an ISignerPayload JSON
*/
Expand Down Expand Up @@ -137,11 +151,14 @@ export class GenericSignerPayload extends Struct implements ISignerPayload, Sign
// the known defaults as managed explicitly and has different
// formatting in cases, e.g. we mostly expose a hex format here
address: this.address.toString(),
assetId: this.assetId ? this.assetId.toJSON() : null,
blockHash: this.blockHash.toHex(),
blockNumber: this.blockNumber.toHex(),
era: this.era.toHex(),
genesisHash: this.genesisHash.toHex(),
metadataHash: this.metadataHash.isSome ? this.metadataHash.toHex() : null,
method: this.method.toHex(),
mode: this.mode.toNumber(),
nonce: this.nonce.toHex(),
signedExtensions: this.signedExtensions.map((e) => e.toString()),
specVersion: this.runtimeVersion.specVersion.toHex(),
Expand Down
10 changes: 10 additions & 0 deletions types/extrinsic/signedExtensions/substrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import type { ExtDef, ExtInfo } from './types.ts';

import { emptyCheck } from './emptyCheck.ts';

const CheckMetadataHash: ExtInfo = {
extrinsic: {
mode: 'u8'
},
payload: {
metadataHash: 'Option<[u8;32]>'
}
};

const CheckMortality: ExtInfo = {
extrinsic: {
era: 'ExtrinsicEra'
Expand All @@ -29,6 +38,7 @@ export const substrate: ExtDef = {
genesisHash: 'Hash'
}
},
CheckMetadataHash,
CheckMortality,
CheckNonZeroSender: emptyCheck,
CheckNonce: {
Expand Down
11 changes: 9 additions & 2 deletions types/extrinsic/v4/ExtrinsicPayload.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import type { SignOptions } from 'https://deno.land/x/polkadot/keyring/types.ts';
import type { MultiLocation } from 'https://deno.land/x/polkadot/types/interfaces/index.ts';
import type { Hash, MultiLocation } from 'https://deno.land/x/polkadot/types/interfaces/index.ts';
import type { Bytes } from 'https://deno.land/x/polkadot/types-codec/mod.ts';
import type { Inspect, Registry } from 'https://deno.land/x/polkadot/types-codec/types/index.ts';
import type { HexString } from 'https://deno.land/x/polkadot/util/types.ts';
Expand Down Expand Up @@ -103,10 +103,17 @@ export class GenericExtrinsicPayloadV4 extends Struct {
/**
* @description The (optional) asset id for this signature for chains that support transaction fees in assets
*/
public get assetId (): IOption<INumber | IOption<MultiLocation>> {
public get assetId (): IOption<INumber | MultiLocation> {
return this.getT('assetId');
}

/**
* @description The (optional) asset id for this signature for chains that support transaction fees in assets
*/
public get metadataHash (): IOption<Hash> {
return this.getT('metadataHash');
}

/**
* @description Sign the payload with the keypair
*/
Expand Down
11 changes: 9 additions & 2 deletions types/extrinsic/v4/ExtrinsicSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { MultiLocation } from 'https://deno.land/x/polkadot/types/interfaces/index.ts';
import type { HexString } from 'https://deno.land/x/polkadot/util/types.ts';
import type { EcdsaSignature, Ed25519Signature, ExtrinsicEra, ExtrinsicSignature, Sr25519Signature } from '../../interfaces/extrinsics/index.ts';
import type { Address, Call } from '../../interfaces/runtime/index.ts';
import type { Address, Call, Hash } from '../../interfaces/runtime/index.ts';
import type { ExtrinsicPayloadValue, ICompact, IExtrinsicSignature, IKeyringPair, INumber, IOption, Registry, SignatureOptions } from '../../types/index.ts';
import type { ExtrinsicSignatureOptions } from '../types.ts';

Expand Down Expand Up @@ -119,10 +119,17 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
/**
* @description The [[u32]] or [[MultiLocation]] assetId
*/
public get assetId (): IOption<INumber> | IOption<MultiLocation> {
public get assetId (): IOption<INumber | MultiLocation> {
return this.getT('assetId');
}

/**
* @description The [[Hash]] for the metadata
*/
public get metadataHash (): IOption<Hash> {
return this.getT('metadataHash');
}

protected _injectSignature (signer: Address, signature: ExtrinsicSignature, payload: GenericExtrinsicPayloadV4): IExtrinsicSignature {
// use the fields exposed to guide the getters
for (let i = 0, count = this.#signKeys.length; i < count; i++) {
Expand Down
2 changes: 1 addition & 1 deletion types/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/types', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.0.3' };
export const packageInfo = { name: '@polkadot/types', path: new URL(import.meta.url).pathname, type: 'deno', version: '11.1.1' };
Loading

0 comments on commit 424f9c1

Please sign in to comment.