Compare commits

...
28 Commits
Author SHA1 Message Date
Github Actions e3f16e6066 [CI Skip] release/stable 3.4.1
skip-checks: true
2021-01-11 08:13:52 +00:00
Jaco Greeff c3b697d52d 3.4 (#3037) 2021-01-11 09:04:19 +01:00
Github Actions 645fb58e82 [CI Skip] release/beta 3.3.3-5
skip-checks: true
2021-01-10 09:27:13 +00:00
icodezjb 474e509507 Update SessionKeys (#3035)
SessionKeys6, SessionKeys7, SessionKeys8, SessionKeys9
2021-01-10 10:19:55 +01:00
Github Actions df9aff3bac [CI Skip] release/beta 3.3.3-4
skip-checks: true
2021-01-08 16:15:40 +00:00
Jaco Greeff caface921e Adjust max signed check (#3034) 2021-01-08 17:08:04 +01:00
Github Actions ba9cc785c1 [CI Skip] release/beta 3.3.3-3
skip-checks: true
2021-01-08 13:51:18 +00:00
Jaco Greeff 4ff9b51af2 Add API option for chain-specific signedExtensions (#3033)
* Add API option for chain-specific signedExtensions

* typo
2021-01-08 14:42:26 +01:00
Github Actions 2c20a9f395 [CI Skip] release/beta 3.3.3-2
skip-checks: true
2021-01-08 10:28:58 +00:00
Jaco Greeff ee17aa7464 Fix v12 static json 2021-01-08 11:20:18 +01:00
Jaco Greeff 2d01a7b593 Update alias mapping (asset Balance in events) 2021-01-08 11:01:48 +01:00
Github Actions 000e8089d9 [CI Skip] release/beta 3.3.3-1
skip-checks: true
2021-01-08 09:53:41 +00:00
Jaco Greeff 43000b6aaf Update contract types (#3032)
* Update contract types

* Add registry lookup name compat

* cleanup

* Rebuild ts defs
2021-01-08 10:46:12 +01:00
Github Actions 0f8b204db8 [CI Skip] release/beta 3.3.3-0
skip-checks: true
2021-01-07 18:53:56 +00:00
Jaco Greeff 679f4103e1 Fix EthTransaction to ethereum crate (#3030)
* Fix (alhabetically sorted??) EthTransaction

* EthTransaction from ethereum crate
2021-01-07 19:45:37 +01:00
Github Actions 6c61708eff [CI Skip] release/stable 3.3.2
skip-checks: true
2021-01-06 17:30:18 +00:00
Jaco Greeff f0ce53f5a5 dispatchInfo on failed 2021-01-06 18:20:52 +01:00
Jaco Greeff d826ac85fa Event check index (#3028)
* Event check index

* patch
2021-01-06 18:18:08 +01:00
Github Actions 18a81fbbcb [CI Skip] release/beta 3.3.2-4
skip-checks: true
2021-01-06 10:56:45 +00:00
Jeremías Díaz 9ab59c9241 fix(typegen): support vecs of tuples in enums (#3022) 2021-01-06 11:48:32 +01:00
Github Actions 0161996cf6 [CI Skip] release/beta 3.3.2-3
skip-checks: true
2021-01-06 09:51:22 +00:00
Jaco Greeff 99463a3f1d Return result with entries with 0 keys (#3025)
* Return result with entries with 0 keys

* Cleanup
2021-01-06 10:42:53 +01:00
Github Actions cec4c69374 [CI Skip] release/beta 3.3.2-2
skip-checks: true
2021-01-05 13:13:44 +00:00
Jaco Greeff 44077c7cf6 Add ParaGenesisArgs type (#3021) 2021-01-05 14:04:50 +01:00
Github Actions ac7b1bdeeb [CI Skip] release/beta 3.3.2-1
skip-checks: true
2021-01-05 11:30:57 +00:00
Jaco Greeff 1c86333b5f derive.chain.getBlock() now maps events to extrinsics (#3020)
* derive.chain.getBlock() now maps events to extrinsics

* Also apply to subscribeNewBlocks

* Cleanup

* breaking
2021-01-05 12:21:58 +01:00
Github Actions da4108ff9b [CI Skip] release/beta 3.3.2-0
skip-checks: true
2021-01-05 09:46:04 +00:00
Ewa Kowalska 0c5fc15935 Add motions to bounty derive (#3016)
* Add proposals to BountyDerive

* Extract filterBountiesProposals method

* Apply review suggestions
2021-01-05 10:37:45 +01:00
53 changed files with 716 additions and 552 deletions
+2
View File
@@ -8,3 +8,5 @@
2.8.2
3.2.2
3.2.3
3.3.2
+26
View File
@@ -1,5 +1,31 @@
# CHANGELOG
## 3.4.1 Jan 11, 2020
Upgrade priority: Low. Fixes for parachain types, `.entries()` (with no values) and `event.is(...)` checks, users of these interfaces will have benefit.
- **Breaking change** The `derive.chain.{getBlock, subscribeNewBlocks}` now return `SignedBlockExtended`, all with the actual extrinsics and events mapped. Users of the latter interface should take note.
Contributed:
- Fix `SessionKeys{6-9}` definitions (Thanks to https://github.com/icodezjb)
- Support `Vec<(a, b)>` in enums (Thanks to https://github.com/monitz87)
- Add motions to bounty derive (Thanks to https://github.com/ekowalsk)
Changes:
- `derive.chain.getBlock()` now maps events to extrinsics via `.extrinsics` getter
- Ensure dispatchInfo is extracted on failed extrinsics (`getBlock` derive)
- Allow specification of additional signed extrinsic via API options
- Add missing parachain types, `ParaGenesisArgs`
- Correct `EthTransaction` type (as per the correct cargo crate)
- Update with latest contract types for Substrate master
- Update alias mapping for asset palette (including Substrate starting defaults)
- Allow `.entries()` call where 0 keys are present
- Fix `.is` on events not checking the correct index
- Construction of `i*` types ow correctly checks for max positive/negative
## 3.3.1 Jan 4, 2021
Upgrade priority: Low. Recommended for users of frontier evm module with additional types.
+3 -3
View File
@@ -28,11 +28,11 @@
"@babel/core": "^7.12.10",
"@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.61.22",
"@polkadot/dev": "^0.61.24",
"@polkadot/ts": "^0.3.59",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.19",
"@types/jest": "^26.0.20",
"copyfiles": "^2.4.1"
},
"version": "3.3.1"
"version": "3.4.1"
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "3.3.1",
"version": "3.4.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"module": "index.mjs",
@@ -14,10 +14,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "3.3.1",
"@polkadot/types": "3.3.1",
"@polkadot/api": "3.4.1",
"@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/x-rxjs": "3.3.1",
"@polkadot/x-rxjs": "3.4.1",
"bn.js": "^4.11.9"
}
}
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "3.3.1",
"version": "3.4.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"module": "index.mjs",
@@ -14,16 +14,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "3.3.1",
"@polkadot/rpc-core": "3.3.1",
"@polkadot/types": "3.3.1",
"@polkadot/api": "3.4.1",
"@polkadot/rpc-core": "3.4.1",
"@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3",
"@polkadot/x-rxjs": "3.3.1",
"@polkadot/x-rxjs": "3.4.1",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^5.2.3",
"@polkadot/rpc-provider": "3.3.1"
"@polkadot/rpc-provider": "3.4.1"
}
}
@@ -1,16 +1,20 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx, SubmittableExtrinsic } from '@polkadot/api/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex } from '@polkadot/types/interfaces';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import type { Codec, InterfaceTypes } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import { Proposal } from '@polkadot/types/interfaces';
import { of } from '@polkadot/x-rxjs';
import { BountyFactory } from '../../test/bountyFactory';
import { BytesFactory } from '../../test/bytesFactory';
import { createApiWithAugmentations } from '../../test/helpers';
import { ProposalFactory } from '../../test/proposalFactory';
import { bounties } from '.';
const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
@@ -21,22 +25,62 @@ describe('bounties derive', () => {
let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>;
let optionOf: <T extends Codec> (value: T)=> Option<T>;
let bountyIndex: (index: number) => BountyIndex;
let proposalIndex: (index: number) => ProposalIndex;
let bytes: (value: string) => Bytes;
let api: ApiPromise;
let createProposal: (method: SubmittableExtrinsic<'promise'>) => Proposal;
let defaultMockApi: ApiInterfaceRx;
beforeAll(() => {
const api = createApiWithAugmentations();
api = createApiWithAugmentations();
({ bountyIndex, defaultBounty, emptyOption, optionOf, storageKey } = new BountyFactory(api));
({ bytes } = new BytesFactory(api.registry));
({ createProposal, proposalIndex } = new ProposalFactory(api));
});
beforeEach(() => {
defaultMockApi = {
derive: {
council: {
proposals: () => of([] as DeriveCollectiveProposal[])
}
},
query: {
council: {
proposalCount: () => of(proposalIndex(2))
},
treasury: {
bounties: {
keys: () => of([storageKey(0), storageKey(1)]),
multi: () => of([optionOf(defaultBounty()), optionOf(defaultBounty())])
},
bountyCount: () => of(bountyIndex(2)),
bountyDescriptions: {
multi: () => of([
optionOf(bytes('make polkadot even better')),
optionOf(bytes('this will be totally ignored'))
])
}
}
},
tx: api.tx
} as unknown as ApiInterfaceRx;
});
it('creates storage key', function () {
expect(storageKey(194).args[0].eq(194)).toBe(true);
});
it('creates proposal', function () {
expect(createProposal(api.tx.balances.transfer('5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z', 1))).toBeTruthy();
});
it('combines bounties with descriptions', async () => {
const mockApi = {
...defaultMockApi,
query: {
...defaultMockApi.query,
treasury: {
bounties: {
keys: () => of([storageKey(0), storageKey(2), storageKey(3)]),
@@ -64,4 +108,32 @@ describe('bounties derive', () => {
expect(result[1].description).toEqual('');
expect(result[1].index.eq(3)).toBe(true);
});
it('returns motions', async () => {
const result = await bounties('', defaultMockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].proposals).toHaveLength(0);
});
it('combines bounties with motions', async () => {
const mockApi = {
...defaultMockApi,
derive: {
council: {
proposals: () => of([
{ proposal: createProposal(api.tx.bounties.approveBounty(1)) },
{ proposal: createProposal(api.tx.treasury.approveProposal(1)) }] as DeriveCollectiveProposal[])
}
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].proposals).toHaveLength(1);
expect(result[1].proposals[0].proposal.method).toEqual('approveBounty');
});
});
+23 -13
View File
@@ -2,17 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { DeriveBounties } from '@polkadot/api-derive/types';
import type { DeriveBounties, DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import type { Bytes, Option } from '@polkadot/types';
import type { Bounty, BountyIndex } from '@polkadot/types/interfaces';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import { memo } from '@polkadot/api-derive/util';
import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
type Result = [Option<Bounty>[], Option<Bytes>[], BountyIndex[]];
import { filterBountiesProposals } from './helpers/filterBountyProposals';
function parseResult (api: ApiInterfaceRx, [maybeBounties, maybeDescriptions, ids]: Result): DeriveBounties {
type Result = [Option<Bounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]: Result): DeriveBounties {
const bounties: DeriveBounties = [];
maybeBounties.forEach((bounty, index) => {
@@ -20,7 +22,8 @@ function parseResult (api: ApiInterfaceRx, [maybeBounties, maybeDescriptions, id
bounties.push({
bounty: bounty.unwrap(),
description: maybeDescriptions[index].unwrapOrDefault().toUtf8(),
index: ids[index]
index: ids[index],
proposals: bountyProposals.filter((bountyProposal) => ids[index].eq(bountyProposal.proposal.args[0]))
});
}
});
@@ -29,23 +32,30 @@ function parseResult (api: ApiInterfaceRx, [maybeBounties, maybeDescriptions, id
}
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
const bountyBase = api.query.bounties
? api.query.bounties
: api.query.treasury;
const bountyBase = api.query.bounties ? api.query.bounties : api.query.treasury;
return memo(instanceId, (): Observable<DeriveBounties> =>
bountyBase.bountyCount<BountyIndex>().pipe(
switchMap(() => bountyBase.bounties.keys()),
switchMap((keys): Observable<Result> => {
combineLatest([
bountyBase.bountyCount<BountyIndex>(),
api.query.council.proposalCount<ProposalIndex>()
]).pipe(
switchMap(() =>
combineLatest([
bountyBase.bounties.keys(),
api.derive.council.proposals()
])
),
switchMap(([keys, proposals]): Observable<Result> => {
const ids = keys.map(({ args: [id] }) => id as BountyIndex);
return combineLatest([
bountyBase.bounties.multi<Option<Bounty>>(ids),
bountyBase.bountyDescriptions.multi<Option<Bytes>>(ids),
of(ids)
of(ids),
of(filterBountiesProposals(api, proposals))
]);
}),
map(([maybeBounties, maybeDescriptions, ids]) => parseResult(api, [maybeBounties, maybeDescriptions, ids]))
map(parseResult)
)
);
}
@@ -0,0 +1,12 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
export function filterBountiesProposals (api: ApiInterfaceRx, allProposals: DeriveCollectiveProposal[]): DeriveCollectiveProposal[] {
const bountyTxBase = api.tx.bounties ? api.tx.bounties : api.tx.treasury;
const bountyProposalCalls = [bountyTxBase.approveBounty, bountyTxBase.closeBounty, bountyTxBase.proposeCurator, bountyTxBase.unassignCurator];
return allProposals.filter((proposal) => bountyProposalCalls.find((bountyCall) => bountyCall.is(proposal.proposal)));
}
+3 -2
View File
@@ -27,12 +27,13 @@ export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8
return memo(instanceId, (hash: Uint8Array | string): Observable<SignedBlockExtended | undefined> =>
combineLatest([
api.rpc.chain.getBlock(hash),
api.query.system.events.at(hash),
api.query.session
? api.query.session.validators.at(hash)
: of([])
]).pipe(
map(([signedBlock, validators]): SignedBlockExtended =>
new SignedBlockExtended(api.registry, signedBlock, validators)
map(([signedBlock, events, validators]): SignedBlockExtended =>
new SignedBlockExtended(api.registry, signedBlock, events, validators)
),
catchError((): Observable<undefined> =>
// where rpc.chain.getHeader throws, we will land here - it can happen that
@@ -2,32 +2,34 @@
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EventRecord, Hash, SignedBlock } from '@polkadot/types/interfaces';
import type { AccountId, EventRecord, SignedBlock } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { FullNewBlock } from '../types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } from '../type';
import { memo } from '../util';
/**
* @name subscribeNewBlocks
* @returns The latest block & events for that block
*/
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<FullNewBlock> {
return memo(instanceId, (): Observable<FullNewBlock> =>
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
return memo(instanceId, (): Observable<SignedBlockExtended> =>
api.derive.chain.subscribeNewHeads().pipe(
switchMap((header): Observable<[Hash, EventRecord[], SignedBlock]> => {
switchMap((header): Observable<[SignedBlock, EventRecord[], AccountId[] | undefined]> => {
const blockHash = header.hash;
return combineLatest(
of(blockHash),
api.rpc.chain.getBlock(blockHash),
api.query.system.events.at(blockHash),
api.rpc.chain.getBlock(header.hash)
of(header.validators)
);
}),
map(([blockHash, events, block]) => ({ block: block.block, blockHash, blockNumber: block.block.header.number.unwrap(), events, justification: block.justification }))
map(([block, events, validators]) =>
new SignedBlockExtended(api.registry, block, events, validators)
)
)
);
}
-12
View File
@@ -1,12 +0,0 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Block, BlockNumber, EventRecord, Hash, Justification } from '@polkadot/types/interfaces';
export interface FullNewBlock {
block: Block;
blockHash: Hash;
blockNumber: BlockNumber;
events: EventRecord[];
justification: Justification;
}
+8 -23
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, Header } from '@polkadot/types/interfaces';
import type { AnyJson, Constructor, Registry } from '@polkadot/types/types';
import type { Constructor, Registry } from '@polkadot/types/types';
import { Struct } from '@polkadot/types';
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions';
@@ -19,11 +19,13 @@ const _Header = Struct.with(runtimeTypes.types.Header as any) as Constructor<Hea
*/
export class HeaderExtended extends _Header {
readonly #author?: AccountId;
readonly #validators?: AccountId[];
constructor (registry: Registry, header?: Header, sessionValidators?: AccountId[]) {
constructor (registry: Registry, header?: Header, validators?: AccountId[]) {
super(registry, header);
this.#author = extractAuthor(this.digest, sessionValidators);
this.#author = extractAuthor(this.digest, validators);
this.#validators = validators;
}
/**
@@ -34,26 +36,9 @@ export class HeaderExtended extends _Header {
}
/**
* @description Creates a human-friendly JSON representation
* @description Convenience method, returns the validators for the block
*/
public toHuman (isExtended?: boolean): Record<string, AnyJson> {
return {
...super.toHuman(isExtended),
author: this.author
? this.author.toHuman()
: undefined
};
}
/**
* @description Creates the JSON representation
*/
public toJSON (): Record<string, AnyJson> {
return {
...super.toJSON(),
author: this.author
? this.author.toJSON()
: undefined
};
public get validators (): AccountId[] | undefined {
return this.#validators;
}
}
@@ -1,8 +1,8 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, SignedBlock } from '@polkadot/types/interfaces';
import type { AnyJson, Constructor, Registry } from '@polkadot/types/types';
import type { AccountId, DispatchError, DispatchInfo, Event, EventRecord, Extrinsic, SignedBlock } from '@polkadot/types/interfaces';
import type { Constructor, Registry } from '@polkadot/types/types';
import { Struct } from '@polkadot/types';
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions';
@@ -12,6 +12,37 @@ import { extractAuthor } from './util';
// We can ignore the properties, added via Struct.with
const _SignedBlock = Struct.with(runtimeTypes.types.SignedBlock as any) as Constructor<SignedBlock>;
interface TxWithEvent {
dispatchError?: DispatchError;
dispatchInfo?: DispatchInfo;
events: Event[];
extrinsic: Extrinsic;
}
function mapExtrinsics (extrinsics: Extrinsic[], records: EventRecord[]): TxWithEvent[] {
return extrinsics.map((extrinsic, index): TxWithEvent => {
let dispatchError: DispatchError | undefined;
let dispatchInfo: DispatchInfo | undefined;
const events = records
.filter(({ phase }) => phase.isApplyExtrinsic && phase.asApplyExtrinsic.eq(index))
.map(({ event }) => {
if (event.section === 'system') {
if (event.method === 'ExtrinsicSuccess') {
dispatchInfo = event.data[0] as DispatchInfo;
} else if (event.method === 'ExtrinsicFailed') {
dispatchError = event.data[0] as DispatchError;
dispatchInfo = event.data[1] as DispatchInfo;
}
}
return event;
});
return { dispatchError, dispatchInfo, events, extrinsic };
});
}
/**
* @name SignedBlockExtended
* @description
@@ -19,11 +50,15 @@ const _SignedBlock = Struct.with(runtimeTypes.types.SignedBlock as any) as Const
*/
export class SignedBlockExtended extends _SignedBlock {
readonly #author?: AccountId;
readonly #events: EventRecord[];
readonly #extrinsics: TxWithEvent[];
constructor (registry: Registry, block?: SignedBlock, sessionValidators?: AccountId[]) {
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], sessionValidators?: AccountId[]) {
super(registry, block);
this.#author = extractAuthor(this.block.header.digest, sessionValidators);
this.#events = events || ([] as EventRecord[]);
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
}
/**
@@ -34,26 +69,16 @@ export class SignedBlockExtended extends _SignedBlock {
}
/**
* @description Creates a human-friendly JSON representation
* @description Convenience method, returns the events associated with the block
*/
public toHuman (isExtended?: boolean): Record<string, AnyJson> {
return {
...super.toHuman(isExtended),
author: this.author
? this.author.toHuman()
: undefined
};
public get events (): EventRecord[] {
return this.#events;
}
/**
* @description Creates the JSON representation
* @description Returns the extrinsics and their events, mapped
*/
public toJSON (): Record<string, AnyJson> {
return {
...super.toJSON(),
author: this.author
? this.author.toJSON()
: undefined
};
public get extrinsics (): TxWithEvent[] {
return this.#extrinsics;
}
}
+1 -1
View File
@@ -6,7 +6,6 @@ import type { u32 } from '@polkadot/types';
import type { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Bounty, BountyIndex, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VouchingStatus } from '@polkadot/types/interfaces';
export * from './accounts/types';
export * from './chain/types';
export * from './council/types';
export * from './democracy/types';
export * from './elections/types';
@@ -132,6 +131,7 @@ export interface DeriveBounty {
bounty: Bounty;
description: string;
index: BountyIndex;
proposals: DeriveCollectiveProposal[];
}
export type DeriveBounties = DeriveBounty[];
+3 -1
View File
@@ -10,7 +10,9 @@ export function createApiWithAugmentations (): ApiPromise {
const registry = new TypeRegistry();
const metadata = new Metadata(registry, metaStatic);
const api = new ApiPromise({ provider: new WsProvider('ws://', false) });
registry.setMetadata(metadata);
const api = new ApiPromise({ provider: new WsProvider('ws://', false), registry });
api.injectMetadata(metadata, true);
@@ -0,0 +1,25 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiPromise } from '@polkadot/api';
import { SubmittableExtrinsic } from '@polkadot/api/types';
import { Proposal, ProposalIndex } from '@polkadot/types/interfaces';
import { Registry } from '@polkadot/types/types';
export class ProposalFactory {
readonly #api: ApiPromise;
readonly #registry: Registry;
constructor (api: ApiPromise) {
this.#api = api;
this.#registry = this.#api.registry;
}
public createProposal = (method: SubmittableExtrinsic<'promise'>): Proposal => {
return this.#registry.createType('Proposal', method);
};
public proposalIndex = (index: number): ProposalIndex => {
return this.#registry.createType('ProposalIndex', index);
}
}
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "3.3.1",
"version": "3.4.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"module": "index.mjs",
@@ -17,16 +17,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api-derive": "3.3.1",
"@polkadot/api-derive": "3.4.1",
"@polkadot/keyring": "^5.2.3",
"@polkadot/metadata": "3.3.1",
"@polkadot/rpc-core": "3.3.1",
"@polkadot/rpc-provider": "3.3.1",
"@polkadot/types": "3.3.1",
"@polkadot/types-known": "3.3.1",
"@polkadot/metadata": "3.4.1",
"@polkadot/rpc-core": "3.4.1",
"@polkadot/rpc-provider": "3.4.1",
"@polkadot/types": "3.4.1",
"@polkadot/types-known": "3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3",
"@polkadot/x-rxjs": "3.3.1",
"@polkadot/x-rxjs": "3.4.1",
"bn.js": "^4.11.9",
"eventemitter3": "^4.0.7"
}
+5 -4
View File
@@ -3,6 +3,7 @@
import type { Bytes, Option, Vec, bool, u16, u32 } from '@polkadot/types';
import type { ITuple } from '@polkadot/types/types';
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
import type { BalanceStatus } from '@polkadot/types/interfaces/balances';
import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
@@ -28,7 +29,7 @@ declare module '@polkadot/api/types/events' {
/**
* Some assets were destroyed. \[asset_id, owner, balance\]
**/
Burned: AugmentedEvent<ApiType, [AssetId, AccountId, Balance]>;
Burned: AugmentedEvent<ApiType, [AssetId, AccountId, TAssetBalance]>;
/**
* Some asset class was created. \[asset_id, creator, owner\]
**/
@@ -44,7 +45,7 @@ declare module '@polkadot/api/types/events' {
/**
* Some assets was transferred by an admin. \[asset_id, from, to, amount\]
**/
ForceTransferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, Balance]>;
ForceTransferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
/**
* Some account `who` was frozen. \[asset_id, who\]
**/
@@ -52,7 +53,7 @@ declare module '@polkadot/api/types/events' {
/**
* Some assets were issued. \[asset_id, owner, total_supply\]
**/
Issued: AugmentedEvent<ApiType, [AssetId, AccountId, Balance]>;
Issued: AugmentedEvent<ApiType, [AssetId, AccountId, TAssetBalance]>;
/**
* The maximum amount of zombies allowed has changed. \[asset_id, max_zombies\]
**/
@@ -72,7 +73,7 @@ declare module '@polkadot/api/types/events' {
/**
* Some assets were transferred. \[asset_id, from, to, amount\]
**/
Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, Balance]>;
Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
};
balances: {
[key: string]: AugmentedEvent<ApiType>;
+7 -6
View File
@@ -3,6 +3,7 @@
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u16, u32, u64 } from '@polkadot/types';
import type { AnyNumber, ITuple } from '@polkadot/types/types';
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
import type { BabeEquivocationProof } from '@polkadot/types/interfaces/babe';
import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import type { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts';
@@ -45,7 +46,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)`
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
**/
burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<Balance>]>;
burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/**
* Issue a new class of fungible assets from a public origin.
*
@@ -71,7 +72,7 @@ declare module '@polkadot/api/types/submittable' {
*
* Weight: `O(1)`
**/
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, Balance]>;
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, TAssetBalance]>;
/**
* Destroy a class of fungible assets owned by the sender.
*
@@ -108,7 +109,7 @@ declare module '@polkadot/api/types/submittable' {
*
* Weight: `O(1)`
**/
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<Balance>]>;
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<TAssetBalance>]>;
/**
* Destroy a class of fungible assets.
*
@@ -143,7 +144,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `dest`; Post-existence of `source`; Prior & post zombie-status
* of `source`; Account pre-existence of `dest`.
**/
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<Balance>]>;
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<TAssetBalance>]>;
/**
* Disallow further unprivileged transfers from an account.
*
@@ -171,7 +172,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)`
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
**/
mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<Balance>]>;
mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
setMaxZombies: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, Compact<u32>]>;
/**
* Change the Issuer, Admin and Freezer of an asset.
@@ -221,7 +222,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
* of sender; Account pre-existence of `target`.
**/
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<Balance>]>;
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/**
* Change the Owner of an asset.
*
+12 -10
View File
@@ -518,13 +518,13 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._retrieveMapKeys(entry, at, arg).pipe(
switchMap((keys) =>
combineLatest(
arrayChunk(keys, PAGE_SIZE).map((keys) => query(keys))
).pipe(
map((valsArr) =>
arrayFlatten(valsArr).map((value, index): [StorageKey, Codec] => [keys[index], value])
keys.length
? combineLatest(arrayChunk(keys, PAGE_SIZE).map(query)).pipe(
map((valsArr) =>
arrayFlatten(valsArr).map((value, index): [StorageKey, Codec] => [keys[index], value])
)
)
)
: of([])
)
);
}
@@ -532,11 +532,13 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
private _retrieveMapEntriesPaged (entry: StorageEntry, opts: PaginationOptions): Observable<[StorageKey, Codec][]> {
return this._retrieveMapKeysPaged(entry, opts).pipe(
switchMap((keys) =>
this._rpcCore.state.queryStorageAt(keys).pipe(
map((valsArr) =>
valsArr.map((value, index): [StorageKey, Codec] => [keys[index], value])
keys.length
? this._rpcCore.state.queryStorageAt(keys).pipe(
map((valsArr) =>
valsArr.map((value, index): [StorageKey, Codec] => [keys[index], value])
)
)
)
: of([])
)
);
}
+1 -1
View File
@@ -89,7 +89,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
registry.knownTypes.typesAlias = getSpecAlias(registry, chain, version.specName);
}
registry.setMetadata(metadata);
registry.setMetadata(metadata, undefined, this._options.signedExtensions);
return registry;
}
+5
View File
@@ -9,6 +9,7 @@ import type { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import type { Metadata } from '@polkadot/metadata';
import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, SignatureOptions, Signer } from '@polkadot/types/types';
import type { ApiBase } from '../base';
@@ -56,6 +57,10 @@ export interface ApiOptions extends RegisteredTypes {
* @description User-defined RPC methods
*/
rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
/**
* @description Any chain-specific signed extensions that are now well-known
*/
signedExtensions?: Record<string, ExtDef>;
/**
* @description An external signer which will be used to sign extrinsic when account passed in is not KeyringPair
*/
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "3.3.1",
"version": "3.4.1",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"module": "index.mjs",
@@ -17,8 +17,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/types": "3.3.1",
"@polkadot/types-known": "3.3.1",
"@polkadot/types": "3.4.1",
"@polkadot/types-known": "3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3",
"bn.js": "^4.11.9"
@@ -8,7 +8,7 @@ import type { Events, ModuleEvents } from '../types';
import { stringCamelCase } from '@polkadot/util';
function isEvent <T extends AnyTuple> (event: IEvent<AnyTuple>, sectionIndex: number, eventIndex: number): event is IEvent<T> {
return event.index[0] === sectionIndex && event.index[0] === eventIndex;
return event.index[0] === sectionIndex && event.index[1] === eventIndex;
}
/** @internal */
+10 -10
View File
@@ -12320,7 +12320,7 @@
},
{
"name": "min_balance",
"type": "Balance"
"type": "TAssetBalance"
}
],
"documentation": [
@@ -12366,7 +12366,7 @@
},
{
"name": "min_balance",
"type": "Compact<Balance>"
"type": "Compact<TAssetBalance>"
}
],
"documentation": [
@@ -12456,7 +12456,7 @@
},
{
"name": "amount",
"type": "Compact<Balance>"
"type": "Compact<TAssetBalance>"
}
],
"documentation": [
@@ -12487,7 +12487,7 @@
},
{
"name": "amount",
"type": "Compact<Balance>"
"type": "Compact<TAssetBalance>"
}
],
"documentation": [
@@ -12521,7 +12521,7 @@
},
{
"name": "amount",
"type": "Compact<Balance>"
"type": "Compact<TAssetBalance>"
}
],
"documentation": [
@@ -12562,7 +12562,7 @@
},
{
"name": "amount",
"type": "Compact<Balance>"
"type": "Compact<TAssetBalance>"
}
],
"documentation": [
@@ -12729,7 +12729,7 @@
"args": [
"AssetId",
"AccountId",
"Balance"
"TAssetBalance"
],
"documentation": [
" Some assets were issued. \\[asset_id, owner, total_supply\\]"
@@ -12741,7 +12741,7 @@
"AssetId",
"AccountId",
"AccountId",
"Balance"
"TAssetBalance"
],
"documentation": [
" Some assets were transferred. \\[asset_id, from, to, amount\\]"
@@ -12752,7 +12752,7 @@
"args": [
"AssetId",
"AccountId",
"Balance"
"TAssetBalance"
],
"documentation": [
" Some assets were destroyed. \\[asset_id, owner, balance\\]"
@@ -12786,7 +12786,7 @@
"AssetId",
"AccountId",
"AccountId",
"Balance"
"TAssetBalance"
],
"documentation": [
" Some assets was transferred by an admin. \\[asset_id, from, to, amount\\]"
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "3.3.1",
"version": "3.4.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"module": "index.mjs",
@@ -14,11 +14,11 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/metadata": "3.3.1",
"@polkadot/rpc-provider": "3.3.1",
"@polkadot/types": "3.3.1",
"@polkadot/metadata": "3.4.1",
"@polkadot/rpc-provider": "3.4.1",
"@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/x-rxjs": "3.3.1"
"@polkadot/x-rxjs": "3.4.1"
},
"devDependencies": {
"@polkadot/keyring": "^5.2.3"
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "3.3.1",
"version": "3.4.1",
"description": "Transport providers for the API",
"main": "index.js",
"module": "index.mjs",
@@ -14,7 +14,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/types": "3.3.1",
"@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3",
"@polkadot/x-fetch": "^5.2.3",
@@ -24,7 +24,7 @@
},
"devDependencies": {
"@polkadot/keyring": "^5.2.3",
"@polkadot/metadata": "3.3.1",
"@polkadot/metadata": "3.4.1",
"mock-socket": "^9.0.3",
"nock": "^13.0.5"
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "3.3.1",
"version": "3.4.1",
"description": "Type generation scripts",
"main": "index.js",
"module": "index.mjs",
@@ -23,10 +23,10 @@
"@babel/core": "^7.12.10",
"@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@polkadot/api": "3.3.1",
"@polkadot/metadata": "3.3.1",
"@polkadot/rpc-provider": "3.3.1",
"@polkadot/types": "3.3.1",
"@polkadot/api": "3.4.1",
"@polkadot/metadata": "3.4.1",
"@polkadot/rpc-provider": "3.4.1",
"@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3",
"handlebars": "^4.7.6",
"websocket": "^1.0.33",
+1 -1
View File
@@ -52,7 +52,7 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
const keys = (sub as TypeDef[]).map(({ info, name = '', type }): string => {
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
const isComplexType = [TypeDefInfo.Tuple, TypeDefInfo.VecFixed].includes(info);
const isComplexType = [TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? ''
: createGetter(definitions, `as${getter}`, isComplexType ? formatType(definitions, type, imports) : type, imports);
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "3.3.1",
"version": "3.4.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"module": "index.mjs",
@@ -14,7 +14,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/types": "3.3.1",
"@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3",
"bn.js": "^4.11.9"
},
+3
View File
@@ -5,6 +5,9 @@ import type { OverrideModuleType } from '@polkadot/types/types';
// type overrides for modules (where duplication between modules exist)
const typesModules: Record<string, OverrideModuleType> = {
assets: {
Balance: 'TAssetBalance'
},
babe: {
EquivocationProof: 'BabeEquivocationProof'
},
+1 -6
View File
@@ -28,12 +28,7 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [10, undefined],
types: {
...sharedTypes,
ParaGenesisArgs: {
genesisHead: 'Bytes',
validationCode: 'Bytes',
parachain: 'bool'
}
...sharedTypes
}
}
];
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "3.3.1",
"version": "3.4.1",
"description": "Implementation of the Parity codec",
"main": "index.js",
"module": "index.mjs",
@@ -17,10 +17,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/metadata": "3.3.1",
"@polkadot/metadata": "3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3",
"@polkadot/x-rxjs": "3.3.1",
"@polkadot/x-rxjs": "3.4.1",
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9"
},
+12 -3
View File
@@ -14,12 +14,12 @@ import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import type { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims';
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractInfo, ContractStorageKey, Gas, HostFnWeights, InstructionWeights, Limits, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractInfo, ContractStorageKey, DeletedContract, Gas, HostFnWeights, InstructionWeights, Limits, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import type { ContractConstructorSpec, ContractContractSpec, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpec, ContractEventSpec, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpec, ContractMessageSpec, ContractProject, ContractProjectContract, ContractProjectSource, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionCondition, EthTransactionRequest, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth';
import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth';
import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm';
import type { AnySignature, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset';
@@ -29,7 +29,7 @@ import type { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMu
import type { DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV12, DoubleMapTypeV9, ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV9, MapTypeLatest, MapTypeV10, MapTypeV11, MapTypeV12, MapTypeV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV9, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
import type { AbridgedCandidateReceipt, AbstractFungible, AbstractNonFungible, AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Balances, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, ConcreteFungible, ConcreteNonFungible, CoreAssignment, CoreIndex, CoreOccupied, DepositAsset, DepositReserveAsset, DoubleVoteReport, DownwardMessage, ExchangeAsset, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InitiateReserveWithdraw, InitiateTeleport, Junction, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MultiAsset, MultiLocation, NetworkId, NewBidder, Order, OriginKind, OutboundHrmpMessage, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, ParachainProposal, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueryHolding, QueuedParathread, RegisteredParachainInfo, RelayChainBlockNumber, RelayTo, RelayedFrom, Remark, ReserveAssetDeposit, Retriable, Scheduling, SessionInfo, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, TeleportAsset, Transact, TransientValidationData, UpwardMessage, ValidationCode, ValidationData, ValidationFunctionParams, ValidatorGroup, ValidatorSignature, ValidityAttestation, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, WinningData, WinningDataEntry, WithdrawAsset, Xcm, XcmError, XcmResult } from '@polkadot/types/interfaces/parachains';
import type { AbridgedCandidateReceipt, AbstractFungible, AbstractNonFungible, AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Balances, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, ConcreteFungible, ConcreteNonFungible, CoreAssignment, CoreIndex, CoreOccupied, DepositAsset, DepositReserveAsset, DoubleVoteReport, DownwardMessage, ExchangeAsset, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InitiateReserveWithdraw, InitiateTeleport, Junction, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MultiAsset, MultiLocation, NetworkId, NewBidder, Order, OriginKind, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, ParachainProposal, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueryHolding, QueuedParathread, RegisteredParachainInfo, RelayChainBlockNumber, RelayTo, RelayedFrom, Remark, ReserveAssetDeposit, Retriable, Scheduling, SessionInfo, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, TeleportAsset, Transact, TransientValidationData, UpwardMessage, ValidationCode, ValidationData, ValidationFunctionParams, ValidatorGroup, ValidatorSignature, ValidityAttestation, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, WinningData, WinningDataEntry, WithdrawAsset, Xcm, XcmError, XcmResult } from '@polkadot/types/interfaces/parachains';
import type { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { Approvals } from '@polkadot/types/interfaces/poll';
import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';
@@ -588,6 +588,9 @@ declare module '@polkadot/types/types/registry' {
ContractStorageKey: ContractStorageKey;
'Option<ContractStorageKey>': Option<ContractStorageKey>;
'Vec<ContractStorageKey>': Vec<ContractStorageKey>;
DeletedContract: DeletedContract;
'Option<DeletedContract>': Option<DeletedContract>;
'Vec<DeletedContract>': Vec<DeletedContract>;
Gas: Gas;
'Compact<Gas>': Compact<Gas>;
'Option<Gas>': Option<Gas>;
@@ -1548,6 +1551,9 @@ declare module '@polkadot/types/types/registry' {
ParachainDispatchOrigin: ParachainDispatchOrigin;
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>;
ParaGenesisArgs: ParaGenesisArgs;
'Option<ParaGenesisArgs>': Option<ParaGenesisArgs>;
'Vec<ParaGenesisArgs>': Vec<ParaGenesisArgs>;
ParaId: ParaId;
'Compact<ParaId>': Compact<ParaId>;
'Option<ParaId>': Option<ParaId>;
@@ -1928,6 +1934,9 @@ declare module '@polkadot/types/types/registry' {
EthTransaction: EthTransaction;
'Option<EthTransaction>': Option<EthTransaction>;
'Vec<EthTransaction>': Vec<EthTransaction>;
EthTransactionAction: EthTransactionAction;
'Option<EthTransactionAction>': Option<EthTransactionAction>;
'Vec<EthTransactionAction>': Vec<EthTransactionAction>;
EthTransactionCondition: EthTransactionCondition;
'Option<EthTransactionCondition>': Option<EthTransactionCondition>;
'Vec<EthTransactionCondition>': Vec<EthTransactionCondition>;
+5 -2
View File
@@ -78,8 +78,11 @@ export abstract class AbstractInt extends BN implements Codec {
this.#bitLength = bitLength;
this.#isSigned = isSigned;
assert(isSigned || this.gte(BN_ZERO), `${this.toRawType()}: Negative number passed to unsigned type`);
assert(super.bitLength() <= bitLength, `${this.toRawType()}: Input too large. Found input with ${super.bitLength()} bits, expected ${bitLength}`);
const isPositive = this.gte(BN_ZERO);
const maxBits = bitLength - (isSigned && isPositive ? 1 : 0);
assert(isSigned || isPositive, `${this.toRawType()}: Negative number passed to unsigned type`);
assert(super.bitLength() <= maxBits, `${this.toRawType()}: Input too large. Found input with ${super.bitLength()} bits, expected ${maxBits}`);
}
/**
+13 -7
View File
@@ -3,6 +3,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { ChainProperties, DispatchErrorModule, H256 } from '../interfaces/types';
import type { CallFunction, Codec, Constructor, InterfaceTypes, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
@@ -38,8 +39,9 @@ function injectErrors (_: Registry, metadata: Metadata, metadataErrors: Record<s
const eventIndex = new Uint8Array([sectionIndex, index]);
metadataErrors[u8aToHex(eventIndex)] = {
documentation: documentation.map((d): string => d.toString()),
documentation: documentation.map((d) => d.toString()),
index,
method: name.toString(),
name: name.toString(),
section: sectionName
};
@@ -133,6 +135,8 @@ export class TypeRegistry implements Registry {
#signedExtensions: string[] = defaultExtensions;
#userExtensions?: Record<string, ExtDef>;
constructor () {
this.#knownDefaults = { Json, Metadata, Raw, ...baseTypes };
this.#knownDefinitions = definitions as unknown as Record<string, { types: RegistryTypes }>;
@@ -277,11 +281,11 @@ export class TypeRegistry implements Registry {
}
public getSignedExtensionExtra (): Record<string, keyof InterfaceTypes> {
return expandExtensionTypes(this.#signedExtensions, 'extra');
return expandExtensionTypes(this.#signedExtensions, 'payload', this.#userExtensions);
}
public getSignedExtensionTypes (): Record<string, keyof InterfaceTypes> {
return expandExtensionTypes(this.#signedExtensions, 'types');
return expandExtensionTypes(this.#signedExtensions, 'extrinsic', this.#userExtensions);
}
public hasClass (name: string): boolean {
@@ -355,7 +359,7 @@ export class TypeRegistry implements Registry {
}
// sets the metadata
public setMetadata (metadata: Metadata, signedExtensions?: string[]): void {
public setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: Record<string, ExtDef>): void {
injectExtrinsics(this, metadata, this.#metadataCalls);
injectErrors(this, metadata, this.#metadataErrors);
injectEvents(this, metadata, this.#metadataEvents);
@@ -366,7 +370,8 @@ export class TypeRegistry implements Registry {
metadata.asLatest.extrinsic.version.gt(BN_ZERO)
? metadata.asLatest.extrinsic.signedExtensions.map((key) => key.toString())
: defaultExtensions
)
),
userExtensions
);
// setup the chain properties with format overrides
@@ -376,10 +381,11 @@ export class TypeRegistry implements Registry {
}
// sets the available signed extensions
setSignedExtensions (signedExtensions: string[] = defaultExtensions): void {
setSignedExtensions (signedExtensions: string[] = defaultExtensions, userExtensions?: Record<string, ExtDef>): void {
this.#signedExtensions = signedExtensions;
this.#userExtensions = userExtensions;
const unknown = findUnknownExtensions(this.#signedExtensions);
const unknown = findUnknownExtensions(this.#signedExtensions, this.#userExtensions);
if (unknown.length) {
l.warn(`Unknown signed extensions ${unknown.join(', ')} found, treating them as no-effect`);
@@ -2,6 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
export const emptyCheck = {
extra: {},
types: {}
extrinsic: {},
payload: {}
};
@@ -9,7 +9,7 @@ import substrateExtensions from './substrate';
// A mapping of the known signed extensions to the extra fields that they contain. Unlike in the actual extensions,
// we define the extra fields not as a Tuple, but rather as a struct so they can be named. These will be expanded
// into the various fields when added to the payload (we only support V4 onwards with these, V3 and earlier are
// deemded fixed and non-changeable)
// deemed fixed and non-changeable)
const allExtensions: ExtDef = {
...substrateExtensions,
...polkadotExtensions
@@ -26,16 +26,16 @@ const defaultExtensions: Array<keyof typeof allExtensions> = [
'CheckBlockGasLimit'
];
function findUnknownExtensions (extensions: string[]): string[] {
const names = Object.keys(allExtensions);
function findUnknownExtensions (extensions: string[], userExtensions: Record<string, ExtDef> = {}): string[] {
const names = [...Object.keys(allExtensions), ...Object.keys(userExtensions)];
return extensions.filter((key): boolean => !names.includes(key));
return extensions.filter((key) => !names.includes(key));
}
function expandExtensionTypes (extensions: string[], type: keyof ExtInfo): ExtTypes {
function expandExtensionTypes (extensions: string[], type: keyof ExtInfo, userExtensions: Record<string, ExtDef> = {}): ExtTypes {
return extensions
.map((key): ExtInfo => allExtensions[key])
.filter((info): boolean => !!info)
.map((key) => allExtensions[key] || userExtensions[key])
.filter((info): info is ExtInfo => !!info)
.reduce((result, info): ExtTypes => ({ ...result, ...info[type] }), {});
}
@@ -6,53 +6,53 @@ import type { ExtDef } from './types';
import { emptyCheck } from './emptyCheck';
const CheckMortality = {
extra: {
blockHash: 'Hash'
},
types: {
extrinsic: {
era: 'ExtrinsicEra'
},
payload: {
blockHash: 'Hash'
}
};
export default {
ChargeTransactionPayment: {
extra: {},
types: {
extrinsic: {
tip: 'Compact<Balance>'
}
},
payload: {}
},
CheckBlockGasLimit: emptyCheck,
CheckEra: CheckMortality,
CheckGenesis: {
extra: {
extrinsic: {},
payload: {
genesisHash: 'Hash'
},
types: {}
}
},
CheckMortality,
CheckNonce: {
extra: {},
types: {
extrinsic: {
nonce: 'Compact<Index>'
}
},
payload: {}
},
CheckSpecVersion: {
extra: {
extrinsic: {},
payload: {
specVersion: 'u32'
},
types: {}
}
},
CheckTxVersion: {
extra: {
extrinsic: {},
payload: {
transactionVersion: 'u32'
},
types: {}
}
},
CheckVersion: {
extra: {
extrinsic: {},
payload: {
specVersion: 'u32'
},
types: {}
}
},
CheckWeight: emptyCheck,
LockStakingStatus: emptyCheck,
@@ -6,8 +6,8 @@ import type { InterfaceTypes } from '../../types';
export type ExtTypes = Record<string, keyof InterfaceTypes>;
export type ExtInfo = {
extra: ExtTypes;
types: ExtTypes;
extrinsic: ExtTypes;
payload: ExtTypes;
}
export type ExtDef = Record<string, ExtInfo>;
@@ -26,7 +26,7 @@ export default {
zombies: 'u32',
accounts: 'u32'
},
TAssetBalance: 'Balance',
TAssetBalance: 'u64',
TAssetDepositBalance: 'BalanceOf'
}
} as Definitions;
@@ -1,8 +1,8 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Struct, bool, u32 } from '@polkadot/types';
import type { AccountId, Balance, BalanceOf } from '@polkadot/types/interfaces/runtime';
import type { Struct, bool, u32, u64 } from '@polkadot/types';
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces/runtime';
/** @name AssetBalance */
export interface AssetBalance extends Struct {
@@ -26,7 +26,7 @@ export interface AssetDetails extends Struct {
}
/** @name TAssetBalance */
export interface TAssetBalance extends Balance {}
export interface TAssetBalance extends u64 {}
/** @name TAssetDepositBalance */
export interface TAssetDepositBalance extends BalanceOf {}
@@ -136,6 +136,10 @@ export default {
}
},
ContractStorageKey: '[u8; 32]',
DeletedContract: {
pairCount: 'u32',
trieId: 'TrieId'
},
Gas: 'u64',
HostFnWeights: {
caller: 'Weight',
@@ -104,6 +104,12 @@ export interface ContractInfo extends Enum {
/** @name ContractStorageKey */
export interface ContractStorageKey extends U8aFixed {}
/** @name DeletedContract */
export interface DeletedContract extends Struct {
readonly pairCount: u32;
readonly trieId: TrieId;
}
/** @name Gas */
export interface Gas extends u64 {}
@@ -176,26 +176,46 @@ const types: DefinitionsTypes = {
}
},
EthTransaction: {
blockHash: 'Option<H256>',
blockNumber: 'Option<U256>',
chainId: 'Option<u64>',
condition: 'Option<EthTransactionCondition>',
creates: 'Option<H160>',
from: 'H160',
gas: 'U256',
gasPrice: 'U256',
hash: 'H256',
input: 'Bytes',
nonce: 'U256',
publicKey: 'Option<H512>',
r: 'U256',
raw: 'Bytes',
s: 'U256',
standardV: 'U256',
to: 'Option<H160>',
transactionIndex: 'Option<U256>',
v: 'U256',
value: 'U256'
gasPrice: 'U256',
gasLimit: 'U256',
action: 'EthTransactionAction',
value: 'U256',
input: 'Bytes',
// TransactionSignature (embedded)
v: 'u64',
r: 'H256',
s: 'H256'
},
// as per the RPC definition
// TODO: Check these, re-add
// EthTransaction: {
// // hash in Rust
// transactionHash: 'H256',
// nonce: 'U256',
// blockHash: 'Option<H256>',
// blockNumber: 'Option<U256>',
// transactionIndex: 'Option<U256>',
// from: 'H160',
// to: 'Option<H160>',
// value: 'U256',
// gasPrice: 'U256',
// gas: 'U256',
// input: 'Bytes',
// creates: 'Option<H160>',
// raw: 'Bytes',
// publicKey: 'Option<H512>',
// chainId: 'Option<U64>',
// standardV: 'U256',
// v: 'U256',
// r: 'U256',
// s: 'U256'
// },
EthTransactionAction: {
_enum: {
Call: 'H160',
Create: 'Null'
}
},
EthTransactionCondition: {
_enum: {
+15 -19
View File
@@ -2,7 +2,7 @@
/* eslint-disable */
import type { Bytes, Enum, GenericEthereumAccountId, GenericEthereumLookupSource, Option, Struct, U256, U64, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
import type { BlockNumber, H160, H2048, H256, H512 } from '@polkadot/types/interfaces/runtime';
import type { BlockNumber, H160, H2048, H256 } from '@polkadot/types/interfaces/runtime';
/** @name EthAccount */
export interface EthAccount extends Struct {
@@ -211,26 +211,22 @@ export interface EthSyncStatus extends Enum {
/** @name EthTransaction */
export interface EthTransaction extends Struct {
readonly blockHash: Option<H256>;
readonly blockNumber: Option<U256>;
readonly chainId: Option<u64>;
readonly condition: Option<EthTransactionCondition>;
readonly creates: Option<H160>;
readonly from: H160;
readonly gas: U256;
readonly gasPrice: U256;
readonly hash: H256;
readonly input: Bytes;
readonly nonce: U256;
readonly publicKey: Option<H512>;
readonly r: U256;
readonly raw: Bytes;
readonly s: U256;
readonly standardV: U256;
readonly to: Option<H160>;
readonly transactionIndex: Option<U256>;
readonly v: U256;
readonly gasPrice: U256;
readonly gasLimit: U256;
readonly action: EthTransactionAction;
readonly value: U256;
readonly input: Bytes;
readonly v: u64;
readonly r: H256;
readonly s: H256;
}
/** @name EthTransactionAction */
export interface EthTransactionAction extends Enum {
readonly isCall: boolean;
readonly asCall: H160;
readonly isCreate: boolean;
}
/** @name EthTransactionCondition */
@@ -244,6 +244,11 @@ export default {
ParachainDispatchOrigin: {
_enum: ['Signed', 'Parachain', 'Root']
},
ParaGenesisArgs: {
genesisHead: 'Bytes',
validationCode: 'Bytes',
parachain: 'bool'
},
ParaId: 'u32',
ParaInfo: {
scheduling: 'Scheduling'
@@ -520,6 +520,13 @@ export interface ParachainProposal extends Struct {
readonly balance: Balance;
}
/** @name ParaGenesisArgs */
export interface ParaGenesisArgs extends Struct {
readonly genesisHead: Bytes;
readonly validationCode: Bytes;
readonly parachain: bool;
}
/** @name ParaId */
export interface ParaId extends u32 {}
@@ -24,10 +24,10 @@ const keyTypes = {
SessionKeys4: '(AccountId, AccountId, AccountId, AccountId)',
// CC3
SessionKeys5: '(AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys6: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys7: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys8: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys9: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)'
SessionKeys6: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys7: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys8: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys9: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)'
};
export default {
@@ -41,16 +41,16 @@ export interface SessionKeys4 extends ITuple<[AccountId, AccountId, AccountId, A
export interface SessionKeys5 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId]> {}
/** @name SessionKeys6 */
export interface SessionKeys6 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
export interface SessionKeys6 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
/** @name SessionKeys7 */
export interface SessionKeys7 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
export interface SessionKeys7 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
/** @name SessionKeys8 */
export interface SessionKeys8 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
export interface SessionKeys8 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
/** @name SessionKeys9 */
export interface SessionKeys9 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
export interface SessionKeys9 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
/** @name ValidatorCount */
export interface ValidatorCount extends u32 {}
+5 -2
View File
@@ -4,6 +4,7 @@
import type BN from 'bn.js';
import type { Metadata } from '@polkadot/metadata';
import type { Observable } from '@polkadot/x-rxjs';
import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { H256 } from '../interfaces/runtime';
import type { ChainProperties } from '../interfaces/system';
import type { CallFunction } from './calls';
@@ -29,6 +30,8 @@ export type RegistryTypes = Record<string, Constructor | string | Record<string,
export interface RegistryError {
documentation: string[];
index: number;
// compat
method: string;
name: string;
section: string;
}
@@ -111,6 +114,6 @@ export interface Registry {
register (arg1: string | Constructor | RegistryTypes, arg2?: Constructor): void;
setChainProperties (properties?: ChainProperties): void;
setHasher (hasher?: (data: Uint8Array) => Uint8Array): void;
setMetadata (metadata: Metadata, signedExtensions?: string[]): void;
setSignedExtensions (signedExtensions?: string[]): void;
setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: Record<string, ExtDef>): void;
setSignedExtensions (signedExtensions?: string[], userExtensions?: Record<string, ExtDef>): void;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/x-rxjs",
"version": "3.3.1",
"version": "3.4.1",
"description": "A pass-through interface for RxJs (allowing node + mjs usage)",
"main": "index.js",
"sideEffects": false,
+239 -291
View File
File diff suppressed because it is too large Load Diff