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 2.8.2
3.2.2 3.2.2
3.2.3 3.2.3
3.3.2
+26
View File
@@ -1,5 +1,31 @@
# CHANGELOG # 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 ## 3.3.1 Jan 4, 2021
Upgrade priority: Low. Recommended for users of frontier evm module with additional types. 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/core": "^7.12.10",
"@babel/register": "^7.12.10", "@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.61.22", "@polkadot/dev": "^0.61.24",
"@polkadot/ts": "^0.3.59", "@polkadot/ts": "^0.3.59",
"@polkadot/typegen": "workspace:packages/typegen", "@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.19", "@types/jest": "^26.0.20",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"version": "3.3.1" "version": "3.4.1"
} }
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-contract", "name": "@polkadot/api-contract",
"version": "3.3.1", "version": "3.4.1",
"description": "Interfaces for interacting with contracts and contract ABIs", "description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -14,10 +14,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/api": "3.3.1", "@polkadot/api": "3.4.1",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"@polkadot/x-rxjs": "3.3.1", "@polkadot/x-rxjs": "3.4.1",
"bn.js": "^4.11.9" "bn.js": "^4.11.9"
} }
} }
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-derive", "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.", "description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -14,16 +14,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/api": "3.3.1", "@polkadot/api": "3.4.1",
"@polkadot/rpc-core": "3.3.1", "@polkadot/rpc-core": "3.4.1",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^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" "bn.js": "^4.11.9"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^5.2.3", "@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 // Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0 // 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 { 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 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 { of } from '@polkadot/x-rxjs';
import { BountyFactory } from '../../test/bountyFactory'; import { BountyFactory } from '../../test/bountyFactory';
import { BytesFactory } from '../../test/bytesFactory'; import { BytesFactory } from '../../test/bytesFactory';
import { createApiWithAugmentations } from '../../test/helpers'; import { createApiWithAugmentations } from '../../test/helpers';
import { ProposalFactory } from '../../test/proposalFactory';
import { bounties } from '.'; import { bounties } from '.';
const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM'; const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
@@ -21,22 +25,62 @@ describe('bounties derive', () => {
let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>; let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>;
let optionOf: <T extends Codec> (value: T)=> Option<T>; let optionOf: <T extends Codec> (value: T)=> Option<T>;
let bountyIndex: (index: number) => BountyIndex; let bountyIndex: (index: number) => BountyIndex;
let proposalIndex: (index: number) => ProposalIndex;
let bytes: (value: string) => Bytes; let bytes: (value: string) => Bytes;
let api: ApiPromise;
let createProposal: (method: SubmittableExtrinsic<'promise'>) => Proposal;
let defaultMockApi: ApiInterfaceRx;
beforeAll(() => { beforeAll(() => {
const api = createApiWithAugmentations(); api = createApiWithAugmentations();
({ bountyIndex, defaultBounty, emptyOption, optionOf, storageKey } = new BountyFactory(api)); ({ bountyIndex, defaultBounty, emptyOption, optionOf, storageKey } = new BountyFactory(api));
({ bytes } = new BytesFactory(api.registry)); ({ 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 () { it('creates storage key', function () {
expect(storageKey(194).args[0].eq(194)).toBe(true); 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 () => { it('combines bounties with descriptions', async () => {
const mockApi = { const mockApi = {
...defaultMockApi,
query: { query: {
...defaultMockApi.query,
treasury: { treasury: {
bounties: { bounties: {
keys: () => of([storageKey(0), storageKey(2), storageKey(3)]), keys: () => of([storageKey(0), storageKey(2), storageKey(3)]),
@@ -64,4 +108,32 @@ describe('bounties derive', () => {
expect(result[1].description).toEqual(''); expect(result[1].description).toEqual('');
expect(result[1].index.eq(3)).toBe(true); 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 // SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types'; 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 { 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 { memo } from '@polkadot/api-derive/util';
import { combineLatest, Observable, of } from '@polkadot/x-rxjs'; import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators'; 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 = []; const bounties: DeriveBounties = [];
maybeBounties.forEach((bounty, index) => { maybeBounties.forEach((bounty, index) => {
@@ -20,7 +22,8 @@ function parseResult (api: ApiInterfaceRx, [maybeBounties, maybeDescriptions, id
bounties.push({ bounties.push({
bounty: bounty.unwrap(), bounty: bounty.unwrap(),
description: maybeDescriptions[index].unwrapOrDefault().toUtf8(), 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> { export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
const bountyBase = api.query.bounties const bountyBase = api.query.bounties ? api.query.bounties : api.query.treasury;
? api.query.bounties
: api.query.treasury;
return memo(instanceId, (): Observable<DeriveBounties> => return memo(instanceId, (): Observable<DeriveBounties> =>
bountyBase.bountyCount<BountyIndex>().pipe( combineLatest([
switchMap(() => bountyBase.bounties.keys()), bountyBase.bountyCount<BountyIndex>(),
switchMap((keys): Observable<Result> => { 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); const ids = keys.map(({ args: [id] }) => id as BountyIndex);
return combineLatest([ return combineLatest([
bountyBase.bounties.multi<Option<Bounty>>(ids), bountyBase.bounties.multi<Option<Bounty>>(ids),
bountyBase.bountyDescriptions.multi<Option<Bytes>>(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> => return memo(instanceId, (hash: Uint8Array | string): Observable<SignedBlockExtended | undefined> =>
combineLatest([ combineLatest([
api.rpc.chain.getBlock(hash), api.rpc.chain.getBlock(hash),
api.query.system.events.at(hash),
api.query.session api.query.session
? api.query.session.validators.at(hash) ? api.query.session.validators.at(hash)
: of([]) : of([])
]).pipe( ]).pipe(
map(([signedBlock, validators]): SignedBlockExtended => map(([signedBlock, events, validators]): SignedBlockExtended =>
new SignedBlockExtended(api.registry, signedBlock, validators) new SignedBlockExtended(api.registry, signedBlock, events, validators)
), ),
catchError((): Observable<undefined> => catchError((): Observable<undefined> =>
// where rpc.chain.getHeader throws, we will land here - it can happen that // where rpc.chain.getHeader throws, we will land here - it can happen that
@@ -2,32 +2,34 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types'; 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 { Observable } from '@polkadot/x-rxjs';
import type { FullNewBlock } from '../types';
import { combineLatest, of } from '@polkadot/x-rxjs'; import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators'; import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } from '../type';
import { memo } from '../util'; import { memo } from '../util';
/** /**
* @name subscribeNewBlocks * @name subscribeNewBlocks
* @returns The latest block & events for that block * @returns The latest block & events for that block
*/ */
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<FullNewBlock> { export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
return memo(instanceId, (): Observable<FullNewBlock> => return memo(instanceId, (): Observable<SignedBlockExtended> =>
api.derive.chain.subscribeNewHeads().pipe( api.derive.chain.subscribeNewHeads().pipe(
switchMap((header): Observable<[Hash, EventRecord[], SignedBlock]> => { switchMap((header): Observable<[SignedBlock, EventRecord[], AccountId[] | undefined]> => {
const blockHash = header.hash; const blockHash = header.hash;
return combineLatest( return combineLatest(
of(blockHash), api.rpc.chain.getBlock(blockHash),
api.query.system.events.at(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 // SPDX-License-Identifier: Apache-2.0
import type { AccountId, Header } from '@polkadot/types/interfaces'; 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 { Struct } from '@polkadot/types';
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions'; 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 { export class HeaderExtended extends _Header {
readonly #author?: AccountId; readonly #author?: AccountId;
readonly #validators?: AccountId[];
constructor (registry: Registry, header?: Header, sessionValidators?: AccountId[]) { constructor (registry: Registry, header?: Header, validators?: AccountId[]) {
super(registry, header); 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> { public get validators (): AccountId[] | undefined {
return { return this.#validators;
...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
};
} }
} }
@@ -1,8 +1,8 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors // Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { AccountId, SignedBlock } from '@polkadot/types/interfaces'; import type { AccountId, DispatchError, DispatchInfo, Event, EventRecord, Extrinsic, SignedBlock } 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 { Struct } from '@polkadot/types';
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions'; 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 // We can ignore the properties, added via Struct.with
const _SignedBlock = Struct.with(runtimeTypes.types.SignedBlock as any) as Constructor<SignedBlock>; 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 * @name SignedBlockExtended
* @description * @description
@@ -19,11 +50,15 @@ const _SignedBlock = Struct.with(runtimeTypes.types.SignedBlock as any) as Const
*/ */
export class SignedBlockExtended extends _SignedBlock { export class SignedBlockExtended extends _SignedBlock {
readonly #author?: AccountId; 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); super(registry, block);
this.#author = extractAuthor(this.block.header.digest, sessionValidators); 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> { public get events (): EventRecord[] {
return { return this.#events;
...super.toHuman(isExtended),
author: this.author
? this.author.toHuman()
: undefined
};
} }
/** /**
* @description Creates the JSON representation * @description Returns the extrinsics and their events, mapped
*/ */
public toJSON (): Record<string, AnyJson> { public get extrinsics (): TxWithEvent[] {
return { return this.#extrinsics;
...super.toJSON(),
author: this.author
? this.author.toJSON()
: undefined
};
} }
} }
+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'; 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 './accounts/types';
export * from './chain/types';
export * from './council/types'; export * from './council/types';
export * from './democracy/types'; export * from './democracy/types';
export * from './elections/types'; export * from './elections/types';
@@ -132,6 +131,7 @@ export interface DeriveBounty {
bounty: Bounty; bounty: Bounty;
description: string; description: string;
index: BountyIndex; index: BountyIndex;
proposals: DeriveCollectiveProposal[];
} }
export type DeriveBounties = DeriveBounty[]; export type DeriveBounties = DeriveBounty[];
+3 -1
View File
@@ -10,7 +10,9 @@ export function createApiWithAugmentations (): ApiPromise {
const registry = new TypeRegistry(); const registry = new TypeRegistry();
const metadata = new Metadata(registry, metaStatic); 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); 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", "name": "@polkadot/api",
"version": "3.3.1", "version": "3.4.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC", "description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -17,16 +17,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/api-derive": "3.3.1", "@polkadot/api-derive": "3.4.1",
"@polkadot/keyring": "^5.2.3", "@polkadot/keyring": "^5.2.3",
"@polkadot/metadata": "3.3.1", "@polkadot/metadata": "3.4.1",
"@polkadot/rpc-core": "3.3.1", "@polkadot/rpc-core": "3.4.1",
"@polkadot/rpc-provider": "3.3.1", "@polkadot/rpc-provider": "3.4.1",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/types-known": "3.3.1", "@polkadot/types-known": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^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", "bn.js": "^4.11.9",
"eventemitter3": "^4.0.7" "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 { Bytes, Option, Vec, bool, u16, u32 } from '@polkadot/types';
import type { ITuple } from '@polkadot/types/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 { BalanceStatus } from '@polkadot/types/interfaces/balances';
import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective'; import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus'; 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\] * 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\] * 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\] * 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\] * 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\] * 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\] * 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\] * Some assets were transferred. \[asset_id, from, to, amount\]
**/ **/
Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, Balance]>; Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
}; };
balances: { balances: {
[key: string]: AugmentedEvent<ApiType>; [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 { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u16, u32, u64 } from '@polkadot/types';
import type { AnyNumber, ITuple } from '@polkadot/types/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 { BabeEquivocationProof } from '@polkadot/types/interfaces/babe';
import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective'; import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import type { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts'; import type { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts';
@@ -45,7 +46,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`. * 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. * Issue a new class of fungible assets from a public origin.
* *
@@ -71,7 +72,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * 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. * Destroy a class of fungible assets owned by the sender.
* *
@@ -108,7 +109,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * 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. * 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 * Modes: Pre-existence of `dest`; Post-existence of `source`; Prior & post zombie-status
* of `source`; Account pre-existence of `dest`. * 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. * Disallow further unprivileged transfers from an account.
* *
@@ -171,7 +172,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`. * 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>]>; 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. * 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 * Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
* of sender; Account pre-existence of `target`. * 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. * 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( return this._retrieveMapKeys(entry, at, arg).pipe(
switchMap((keys) => switchMap((keys) =>
combineLatest( keys.length
arrayChunk(keys, PAGE_SIZE).map((keys) => query(keys)) ? combineLatest(arrayChunk(keys, PAGE_SIZE).map(query)).pipe(
).pipe( map((valsArr) =>
map((valsArr) => arrayFlatten(valsArr).map((value, index): [StorageKey, Codec] => [keys[index], value])
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][]> { private _retrieveMapEntriesPaged (entry: StorageEntry, opts: PaginationOptions): Observable<[StorageKey, Codec][]> {
return this._retrieveMapKeysPaged(entry, opts).pipe( return this._retrieveMapKeysPaged(entry, opts).pipe(
switchMap((keys) => switchMap((keys) =>
this._rpcCore.state.queryStorageAt(keys).pipe( keys.length
map((valsArr) => ? this._rpcCore.state.queryStorageAt(keys).pipe(
valsArr.map((value, index): [StorageKey, Codec] => [keys[index], value]) 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.knownTypes.typesAlias = getSpecAlias(registry, chain, version.specName);
} }
registry.setMetadata(metadata); registry.setMetadata(metadata, undefined, this._options.signedExtensions);
return registry; 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 { Metadata } from '@polkadot/metadata';
import type { RpcInterface } from '@polkadot/rpc-core/types'; import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/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 { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, SignatureOptions, Signer } from '@polkadot/types/types'; import type { DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, SignatureOptions, Signer } from '@polkadot/types/types';
import type { ApiBase } from '../base'; import type { ApiBase } from '../base';
@@ -56,6 +57,10 @@ export interface ApiOptions extends RegisteredTypes {
* @description User-defined RPC methods * @description User-defined RPC methods
*/ */
rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>; 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 * @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", "name": "@polkadot/metadata",
"version": "3.3.1", "version": "3.4.1",
"description": "Helpers to extract information from runtime metadata", "description": "Helpers to extract information from runtime metadata",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -17,8 +17,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/types-known": "3.3.1", "@polkadot/types-known": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3", "@polkadot/util-crypto": "^5.2.3",
"bn.js": "^4.11.9" "bn.js": "^4.11.9"
@@ -8,7 +8,7 @@ import type { Events, ModuleEvents } from '../types';
import { stringCamelCase } from '@polkadot/util'; import { stringCamelCase } from '@polkadot/util';
function isEvent <T extends AnyTuple> (event: IEvent<AnyTuple>, sectionIndex: number, eventIndex: number): event is IEvent<T> { 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 */ /** @internal */
+10 -10
View File
@@ -12320,7 +12320,7 @@
}, },
{ {
"name": "min_balance", "name": "min_balance",
"type": "Balance" "type": "TAssetBalance"
} }
], ],
"documentation": [ "documentation": [
@@ -12366,7 +12366,7 @@
}, },
{ {
"name": "min_balance", "name": "min_balance",
"type": "Compact<Balance>" "type": "Compact<TAssetBalance>"
} }
], ],
"documentation": [ "documentation": [
@@ -12456,7 +12456,7 @@
}, },
{ {
"name": "amount", "name": "amount",
"type": "Compact<Balance>" "type": "Compact<TAssetBalance>"
} }
], ],
"documentation": [ "documentation": [
@@ -12487,7 +12487,7 @@
}, },
{ {
"name": "amount", "name": "amount",
"type": "Compact<Balance>" "type": "Compact<TAssetBalance>"
} }
], ],
"documentation": [ "documentation": [
@@ -12521,7 +12521,7 @@
}, },
{ {
"name": "amount", "name": "amount",
"type": "Compact<Balance>" "type": "Compact<TAssetBalance>"
} }
], ],
"documentation": [ "documentation": [
@@ -12562,7 +12562,7 @@
}, },
{ {
"name": "amount", "name": "amount",
"type": "Compact<Balance>" "type": "Compact<TAssetBalance>"
} }
], ],
"documentation": [ "documentation": [
@@ -12729,7 +12729,7 @@
"args": [ "args": [
"AssetId", "AssetId",
"AccountId", "AccountId",
"Balance" "TAssetBalance"
], ],
"documentation": [ "documentation": [
" Some assets were issued. \\[asset_id, owner, total_supply\\]" " Some assets were issued. \\[asset_id, owner, total_supply\\]"
@@ -12741,7 +12741,7 @@
"AssetId", "AssetId",
"AccountId", "AccountId",
"AccountId", "AccountId",
"Balance" "TAssetBalance"
], ],
"documentation": [ "documentation": [
" Some assets were transferred. \\[asset_id, from, to, amount\\]" " Some assets were transferred. \\[asset_id, from, to, amount\\]"
@@ -12752,7 +12752,7 @@
"args": [ "args": [
"AssetId", "AssetId",
"AccountId", "AccountId",
"Balance" "TAssetBalance"
], ],
"documentation": [ "documentation": [
" Some assets were destroyed. \\[asset_id, owner, balance\\]" " Some assets were destroyed. \\[asset_id, owner, balance\\]"
@@ -12786,7 +12786,7 @@
"AssetId", "AssetId",
"AccountId", "AccountId",
"AccountId", "AccountId",
"Balance" "TAssetBalance"
], ],
"documentation": [ "documentation": [
" Some assets was transferred by an admin. \\[asset_id, from, to, amount\\]" " Some assets was transferred by an admin. \\[asset_id, from, to, amount\\]"
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-core", "name": "@polkadot/rpc-core",
"version": "3.3.1", "version": "3.4.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -14,11 +14,11 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/metadata": "3.3.1", "@polkadot/metadata": "3.4.1",
"@polkadot/rpc-provider": "3.3.1", "@polkadot/rpc-provider": "3.4.1",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"@polkadot/x-rxjs": "3.3.1" "@polkadot/x-rxjs": "3.4.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^5.2.3" "@polkadot/keyring": "^5.2.3"
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-provider", "name": "@polkadot/rpc-provider",
"version": "3.3.1", "version": "3.4.1",
"description": "Transport providers for the API", "description": "Transport providers for the API",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -14,7 +14,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3", "@polkadot/util-crypto": "^5.2.3",
"@polkadot/x-fetch": "^5.2.3", "@polkadot/x-fetch": "^5.2.3",
@@ -24,7 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^5.2.3", "@polkadot/keyring": "^5.2.3",
"@polkadot/metadata": "3.3.1", "@polkadot/metadata": "3.4.1",
"mock-socket": "^9.0.3", "mock-socket": "^9.0.3",
"nock": "^13.0.5" "nock": "^13.0.5"
} }
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/typegen", "name": "@polkadot/typegen",
"version": "3.3.1", "version": "3.4.1",
"description": "Type generation scripts", "description": "Type generation scripts",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -23,10 +23,10 @@
"@babel/core": "^7.12.10", "@babel/core": "^7.12.10",
"@babel/register": "^7.12.10", "@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/api": "3.3.1", "@polkadot/api": "3.4.1",
"@polkadot/metadata": "3.3.1", "@polkadot/metadata": "3.4.1",
"@polkadot/rpc-provider": "3.3.1", "@polkadot/rpc-provider": "3.4.1",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"handlebars": "^4.7.6", "handlebars": "^4.7.6",
"websocket": "^1.0.33", "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 keys = (sub as TypeDef[]).map(({ info, name = '', type }): string => {
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_'))); 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 const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? '' ? ''
: createGetter(definitions, `as${getter}`, isComplexType ? formatType(definitions, type, imports) : type, imports); : createGetter(definitions, `as${getter}`, isComplexType ? formatType(definitions, type, imports) : type, imports);
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types-known", "name": "@polkadot/types-known",
"version": "3.3.1", "version": "3.4.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -14,7 +14,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/types": "3.3.1", "@polkadot/types": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"bn.js": "^4.11.9" "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) // type overrides for modules (where duplication between modules exist)
const typesModules: Record<string, OverrideModuleType> = { const typesModules: Record<string, OverrideModuleType> = {
assets: {
Balance: 'TAssetBalance'
},
babe: { babe: {
EquivocationProof: 'BabeEquivocationProof' EquivocationProof: 'BabeEquivocationProof'
}, },
+1 -6
View File
@@ -28,12 +28,7 @@ const versioned: OverrideVersionedType[] = [
{ {
minmax: [10, undefined], minmax: [10, undefined],
types: { types: {
...sharedTypes, ...sharedTypes
ParaGenesisArgs: {
genesisHead: 'Bytes',
validationCode: 'Bytes',
parachain: 'bool'
}
} }
} }
]; ];
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types", "name": "@polkadot/types",
"version": "3.3.1", "version": "3.4.1",
"description": "Implementation of the Parity codec", "description": "Implementation of the Parity codec",
"main": "index.js", "main": "index.js",
"module": "index.mjs", "module": "index.mjs",
@@ -17,10 +17,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@polkadot/metadata": "3.3.1", "@polkadot/metadata": "3.4.1",
"@polkadot/util": "^5.2.3", "@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^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", "@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9" "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 { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims';
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective'; import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus'; 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 { 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 { 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 { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine'; 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 { 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 { 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'; 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 { 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 { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences'; 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 { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { Approvals } from '@polkadot/types/interfaces/poll'; import type { Approvals } from '@polkadot/types/interfaces/poll';
import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy'; import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';
@@ -588,6 +588,9 @@ declare module '@polkadot/types/types/registry' {
ContractStorageKey: ContractStorageKey; ContractStorageKey: ContractStorageKey;
'Option<ContractStorageKey>': Option<ContractStorageKey>; 'Option<ContractStorageKey>': Option<ContractStorageKey>;
'Vec<ContractStorageKey>': Vec<ContractStorageKey>; 'Vec<ContractStorageKey>': Vec<ContractStorageKey>;
DeletedContract: DeletedContract;
'Option<DeletedContract>': Option<DeletedContract>;
'Vec<DeletedContract>': Vec<DeletedContract>;
Gas: Gas; Gas: Gas;
'Compact<Gas>': Compact<Gas>; 'Compact<Gas>': Compact<Gas>;
'Option<Gas>': Option<Gas>; 'Option<Gas>': Option<Gas>;
@@ -1548,6 +1551,9 @@ declare module '@polkadot/types/types/registry' {
ParachainDispatchOrigin: ParachainDispatchOrigin; ParachainDispatchOrigin: ParachainDispatchOrigin;
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>; 'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>; 'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>;
ParaGenesisArgs: ParaGenesisArgs;
'Option<ParaGenesisArgs>': Option<ParaGenesisArgs>;
'Vec<ParaGenesisArgs>': Vec<ParaGenesisArgs>;
ParaId: ParaId; ParaId: ParaId;
'Compact<ParaId>': Compact<ParaId>; 'Compact<ParaId>': Compact<ParaId>;
'Option<ParaId>': Option<ParaId>; 'Option<ParaId>': Option<ParaId>;
@@ -1928,6 +1934,9 @@ declare module '@polkadot/types/types/registry' {
EthTransaction: EthTransaction; EthTransaction: EthTransaction;
'Option<EthTransaction>': Option<EthTransaction>; 'Option<EthTransaction>': Option<EthTransaction>;
'Vec<EthTransaction>': Vec<EthTransaction>; 'Vec<EthTransaction>': Vec<EthTransaction>;
EthTransactionAction: EthTransactionAction;
'Option<EthTransactionAction>': Option<EthTransactionAction>;
'Vec<EthTransactionAction>': Vec<EthTransactionAction>;
EthTransactionCondition: EthTransactionCondition; EthTransactionCondition: EthTransactionCondition;
'Option<EthTransactionCondition>': Option<EthTransactionCondition>; 'Option<EthTransactionCondition>': Option<EthTransactionCondition>;
'Vec<EthTransactionCondition>': Vec<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.#bitLength = bitLength;
this.#isSigned = isSigned; this.#isSigned = isSigned;
assert(isSigned || this.gte(BN_ZERO), `${this.toRawType()}: Negative number passed to unsigned type`); const isPositive = this.gte(BN_ZERO);
assert(super.bitLength() <= bitLength, `${this.toRawType()}: Input too large. Found input with ${super.bitLength()} bits, expected ${bitLength}`); 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 */ /* eslint-disable @typescript-eslint/no-var-requires */
import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { ChainProperties, DispatchErrorModule, H256 } from '../interfaces/types'; import type { ChainProperties, DispatchErrorModule, H256 } from '../interfaces/types';
import type { CallFunction, Codec, Constructor, InterfaceTypes, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../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]); const eventIndex = new Uint8Array([sectionIndex, index]);
metadataErrors[u8aToHex(eventIndex)] = { metadataErrors[u8aToHex(eventIndex)] = {
documentation: documentation.map((d): string => d.toString()), documentation: documentation.map((d) => d.toString()),
index, index,
method: name.toString(),
name: name.toString(), name: name.toString(),
section: sectionName section: sectionName
}; };
@@ -133,6 +135,8 @@ export class TypeRegistry implements Registry {
#signedExtensions: string[] = defaultExtensions; #signedExtensions: string[] = defaultExtensions;
#userExtensions?: Record<string, ExtDef>;
constructor () { constructor () {
this.#knownDefaults = { Json, Metadata, Raw, ...baseTypes }; this.#knownDefaults = { Json, Metadata, Raw, ...baseTypes };
this.#knownDefinitions = definitions as unknown as Record<string, { types: RegistryTypes }>; 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> { public getSignedExtensionExtra (): Record<string, keyof InterfaceTypes> {
return expandExtensionTypes(this.#signedExtensions, 'extra'); return expandExtensionTypes(this.#signedExtensions, 'payload', this.#userExtensions);
} }
public getSignedExtensionTypes (): Record<string, keyof InterfaceTypes> { public getSignedExtensionTypes (): Record<string, keyof InterfaceTypes> {
return expandExtensionTypes(this.#signedExtensions, 'types'); return expandExtensionTypes(this.#signedExtensions, 'extrinsic', this.#userExtensions);
} }
public hasClass (name: string): boolean { public hasClass (name: string): boolean {
@@ -355,7 +359,7 @@ export class TypeRegistry implements Registry {
} }
// sets the metadata // 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); injectExtrinsics(this, metadata, this.#metadataCalls);
injectErrors(this, metadata, this.#metadataErrors); injectErrors(this, metadata, this.#metadataErrors);
injectEvents(this, metadata, this.#metadataEvents); injectEvents(this, metadata, this.#metadataEvents);
@@ -366,7 +370,8 @@ export class TypeRegistry implements Registry {
metadata.asLatest.extrinsic.version.gt(BN_ZERO) metadata.asLatest.extrinsic.version.gt(BN_ZERO)
? metadata.asLatest.extrinsic.signedExtensions.map((key) => key.toString()) ? metadata.asLatest.extrinsic.signedExtensions.map((key) => key.toString())
: defaultExtensions : defaultExtensions
) ),
userExtensions
); );
// setup the chain properties with format overrides // setup the chain properties with format overrides
@@ -376,10 +381,11 @@ export class TypeRegistry implements Registry {
} }
// sets the available signed extensions // sets the available signed extensions
setSignedExtensions (signedExtensions: string[] = defaultExtensions): void { setSignedExtensions (signedExtensions: string[] = defaultExtensions, userExtensions?: Record<string, ExtDef>): void {
this.#signedExtensions = signedExtensions; this.#signedExtensions = signedExtensions;
this.#userExtensions = userExtensions;
const unknown = findUnknownExtensions(this.#signedExtensions); const unknown = findUnknownExtensions(this.#signedExtensions, this.#userExtensions);
if (unknown.length) { if (unknown.length) {
l.warn(`Unknown signed extensions ${unknown.join(', ')} found, treating them as no-effect`); l.warn(`Unknown signed extensions ${unknown.join(', ')} found, treating them as no-effect`);
@@ -2,6 +2,6 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
export const emptyCheck = { export const emptyCheck = {
extra: {}, extrinsic: {},
types: {} 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, // 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 // 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 // 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 = { const allExtensions: ExtDef = {
...substrateExtensions, ...substrateExtensions,
...polkadotExtensions ...polkadotExtensions
@@ -26,16 +26,16 @@ const defaultExtensions: Array<keyof typeof allExtensions> = [
'CheckBlockGasLimit' 'CheckBlockGasLimit'
]; ];
function findUnknownExtensions (extensions: string[]): string[] { function findUnknownExtensions (extensions: string[], userExtensions: Record<string, ExtDef> = {}): string[] {
const names = Object.keys(allExtensions); 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 return extensions
.map((key): ExtInfo => allExtensions[key]) .map((key) => allExtensions[key] || userExtensions[key])
.filter((info): boolean => !!info) .filter((info): info is ExtInfo => !!info)
.reduce((result, info): ExtTypes => ({ ...result, ...info[type] }), {}); .reduce((result, info): ExtTypes => ({ ...result, ...info[type] }), {});
} }
@@ -6,53 +6,53 @@ import type { ExtDef } from './types';
import { emptyCheck } from './emptyCheck'; import { emptyCheck } from './emptyCheck';
const CheckMortality = { const CheckMortality = {
extra: { extrinsic: {
blockHash: 'Hash'
},
types: {
era: 'ExtrinsicEra' era: 'ExtrinsicEra'
},
payload: {
blockHash: 'Hash'
} }
}; };
export default { export default {
ChargeTransactionPayment: { ChargeTransactionPayment: {
extra: {}, extrinsic: {
types: {
tip: 'Compact<Balance>' tip: 'Compact<Balance>'
} },
payload: {}
}, },
CheckBlockGasLimit: emptyCheck, CheckBlockGasLimit: emptyCheck,
CheckEra: CheckMortality, CheckEra: CheckMortality,
CheckGenesis: { CheckGenesis: {
extra: { extrinsic: {},
payload: {
genesisHash: 'Hash' genesisHash: 'Hash'
}, }
types: {}
}, },
CheckMortality, CheckMortality,
CheckNonce: { CheckNonce: {
extra: {}, extrinsic: {
types: {
nonce: 'Compact<Index>' nonce: 'Compact<Index>'
} },
payload: {}
}, },
CheckSpecVersion: { CheckSpecVersion: {
extra: { extrinsic: {},
payload: {
specVersion: 'u32' specVersion: 'u32'
}, }
types: {}
}, },
CheckTxVersion: { CheckTxVersion: {
extra: { extrinsic: {},
payload: {
transactionVersion: 'u32' transactionVersion: 'u32'
}, }
types: {}
}, },
CheckVersion: { CheckVersion: {
extra: { extrinsic: {},
payload: {
specVersion: 'u32' specVersion: 'u32'
}, }
types: {}
}, },
CheckWeight: emptyCheck, CheckWeight: emptyCheck,
LockStakingStatus: emptyCheck, LockStakingStatus: emptyCheck,
@@ -6,8 +6,8 @@ import type { InterfaceTypes } from '../../types';
export type ExtTypes = Record<string, keyof InterfaceTypes>; export type ExtTypes = Record<string, keyof InterfaceTypes>;
export type ExtInfo = { export type ExtInfo = {
extra: ExtTypes; extrinsic: ExtTypes;
types: ExtTypes; payload: ExtTypes;
} }
export type ExtDef = Record<string, ExtInfo>; export type ExtDef = Record<string, ExtInfo>;
@@ -26,7 +26,7 @@ export default {
zombies: 'u32', zombies: 'u32',
accounts: 'u32' accounts: 'u32'
}, },
TAssetBalance: 'Balance', TAssetBalance: 'u64',
TAssetDepositBalance: 'BalanceOf' TAssetDepositBalance: 'BalanceOf'
} }
} as Definitions; } as Definitions;
@@ -1,8 +1,8 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */ /* eslint-disable */
import type { Struct, bool, u32 } from '@polkadot/types'; import type { Struct, bool, u32, u64 } from '@polkadot/types';
import type { AccountId, Balance, BalanceOf } from '@polkadot/types/interfaces/runtime'; import type { AccountId, BalanceOf } from '@polkadot/types/interfaces/runtime';
/** @name AssetBalance */ /** @name AssetBalance */
export interface AssetBalance extends Struct { export interface AssetBalance extends Struct {
@@ -26,7 +26,7 @@ export interface AssetDetails extends Struct {
} }
/** @name TAssetBalance */ /** @name TAssetBalance */
export interface TAssetBalance extends Balance {} export interface TAssetBalance extends u64 {}
/** @name TAssetDepositBalance */ /** @name TAssetDepositBalance */
export interface TAssetDepositBalance extends BalanceOf {} export interface TAssetDepositBalance extends BalanceOf {}
@@ -136,6 +136,10 @@ export default {
} }
}, },
ContractStorageKey: '[u8; 32]', ContractStorageKey: '[u8; 32]',
DeletedContract: {
pairCount: 'u32',
trieId: 'TrieId'
},
Gas: 'u64', Gas: 'u64',
HostFnWeights: { HostFnWeights: {
caller: 'Weight', caller: 'Weight',
@@ -104,6 +104,12 @@ export interface ContractInfo extends Enum {
/** @name ContractStorageKey */ /** @name ContractStorageKey */
export interface ContractStorageKey extends U8aFixed {} export interface ContractStorageKey extends U8aFixed {}
/** @name DeletedContract */
export interface DeletedContract extends Struct {
readonly pairCount: u32;
readonly trieId: TrieId;
}
/** @name Gas */ /** @name Gas */
export interface Gas extends u64 {} export interface Gas extends u64 {}
@@ -176,26 +176,46 @@ const types: DefinitionsTypes = {
} }
}, },
EthTransaction: { 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', nonce: 'U256',
publicKey: 'Option<H512>', gasPrice: 'U256',
r: 'U256', gasLimit: 'U256',
raw: 'Bytes', action: 'EthTransactionAction',
s: 'U256', value: 'U256',
standardV: 'U256', input: 'Bytes',
to: 'Option<H160>', // TransactionSignature (embedded)
transactionIndex: 'Option<U256>', v: 'u64',
v: 'U256', r: 'H256',
value: 'U256' 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: { EthTransactionCondition: {
_enum: { _enum: {
+15 -19
View File
@@ -2,7 +2,7 @@
/* eslint-disable */ /* eslint-disable */
import type { Bytes, Enum, GenericEthereumAccountId, GenericEthereumLookupSource, Option, Struct, U256, U64, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types'; 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 */ /** @name EthAccount */
export interface EthAccount extends Struct { export interface EthAccount extends Struct {
@@ -211,26 +211,22 @@ export interface EthSyncStatus extends Enum {
/** @name EthTransaction */ /** @name EthTransaction */
export interface EthTransaction extends Struct { 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 nonce: U256;
readonly publicKey: Option<H512>; readonly gasPrice: U256;
readonly r: U256; readonly gasLimit: U256;
readonly raw: Bytes; readonly action: EthTransactionAction;
readonly s: U256;
readonly standardV: U256;
readonly to: Option<H160>;
readonly transactionIndex: Option<U256>;
readonly v: U256;
readonly value: U256; 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 */ /** @name EthTransactionCondition */
@@ -244,6 +244,11 @@ export default {
ParachainDispatchOrigin: { ParachainDispatchOrigin: {
_enum: ['Signed', 'Parachain', 'Root'] _enum: ['Signed', 'Parachain', 'Root']
}, },
ParaGenesisArgs: {
genesisHead: 'Bytes',
validationCode: 'Bytes',
parachain: 'bool'
},
ParaId: 'u32', ParaId: 'u32',
ParaInfo: { ParaInfo: {
scheduling: 'Scheduling' scheduling: 'Scheduling'
@@ -520,6 +520,13 @@ export interface ParachainProposal extends Struct {
readonly balance: Balance; readonly balance: Balance;
} }
/** @name ParaGenesisArgs */
export interface ParaGenesisArgs extends Struct {
readonly genesisHead: Bytes;
readonly validationCode: Bytes;
readonly parachain: bool;
}
/** @name ParaId */ /** @name ParaId */
export interface ParaId extends u32 {} export interface ParaId extends u32 {}
@@ -24,10 +24,10 @@ const keyTypes = {
SessionKeys4: '(AccountId, AccountId, AccountId, AccountId)', SessionKeys4: '(AccountId, AccountId, AccountId, AccountId)',
// CC3 // CC3
SessionKeys5: '(AccountId, AccountId, AccountId, AccountId, AccountId)', SessionKeys5: '(AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys6: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)', SessionKeys6: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys7: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)', SessionKeys7: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)',
SessionKeys8: '(AccountId, AccountId, 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, AccountId)' SessionKeys9: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)'
}; };
export default { 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]> {} export interface SessionKeys5 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId]> {}
/** @name SessionKeys6 */ /** @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 */ /** @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 */ /** @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 */ /** @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 */ /** @name ValidatorCount */
export interface ValidatorCount extends u32 {} export interface ValidatorCount extends u32 {}
+5 -2
View File
@@ -4,6 +4,7 @@
import type BN from 'bn.js'; import type BN from 'bn.js';
import type { Metadata } from '@polkadot/metadata'; import type { Metadata } from '@polkadot/metadata';
import type { Observable } from '@polkadot/x-rxjs'; import type { Observable } from '@polkadot/x-rxjs';
import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { H256 } from '../interfaces/runtime'; import type { H256 } from '../interfaces/runtime';
import type { ChainProperties } from '../interfaces/system'; import type { ChainProperties } from '../interfaces/system';
import type { CallFunction } from './calls'; import type { CallFunction } from './calls';
@@ -29,6 +30,8 @@ export type RegistryTypes = Record<string, Constructor | string | Record<string,
export interface RegistryError { export interface RegistryError {
documentation: string[]; documentation: string[];
index: number; index: number;
// compat
method: string;
name: string; name: string;
section: string; section: string;
} }
@@ -111,6 +114,6 @@ export interface Registry {
register (arg1: string | Constructor | RegistryTypes, arg2?: Constructor): void; register (arg1: string | Constructor | RegistryTypes, arg2?: Constructor): void;
setChainProperties (properties?: ChainProperties): void; setChainProperties (properties?: ChainProperties): void;
setHasher (hasher?: (data: Uint8Array) => Uint8Array): void; setHasher (hasher?: (data: Uint8Array) => Uint8Array): void;
setMetadata (metadata: Metadata, signedExtensions?: string[]): void; setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: Record<string, ExtDef>): void;
setSignedExtensions (signedExtensions?: string[]): void; setSignedExtensions (signedExtensions?: string[], userExtensions?: Record<string, ExtDef>): void;
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/x-rxjs", "name": "@polkadot/x-rxjs",
"version": "3.3.1", "version": "3.4.1",
"description": "A pass-through interface for RxJs (allowing node + mjs usage)", "description": "A pass-through interface for RxJs (allowing node + mjs usage)",
"main": "index.js", "main": "index.js",
"sideEffects": false, "sideEffects": false,
+239 -291
View File
File diff suppressed because it is too large Load Diff