Compare commits

..
14 Commits
Author SHA1 Message Date
Github Actions f5c25d75ff [CI Skip] release/stable 4.7.2
skip-checks: true
2021-04-26 18:20:50 +00:00
Jaco 780cc62942 4.7.2 (#3448)
* 4.7.2

* XcmError update
2021-04-26 20:11:39 +02:00
Github Actions 165568c905 [CI Skip] release/beta 4.7.2-5
skip-checks: true
2021-04-26 16:34:59 +00:00
Jaco 976a48d8f9 Update .nvmrc (#3447)
As per https://github.com/polkadot-js/api/issues/3446 (also need one on common before bumping to a patch)
2021-04-26 19:24:44 +03:00
Github Actions 35cbbbe0ed [CI Skip] release/beta 4.7.2-4
skip-checks: true
2021-04-26 12:06:50 +00:00
Jaco 772769c981 Add membership derives (#3442) 2021-04-26 13:57:30 +02:00
Github Actions 1ba2bd1766 [CI Skip] release/beta 4.7.2-3
skip-checks: true
2021-04-26 10:43:48 +00:00
Jaco 4afa345a7d Cleanup encodedLength calculations (#3441)
* Cleanup encodedLength calculations

* Remove array santize

* Test adjustments
2021-04-26 12:33:16 +02:00
Github Actions 5c03359f32 [CI Skip] release/beta 4.7.2-2
skip-checks: true
2021-04-25 15:16:21 +00:00
Jaco Greeff 04120505f0 Fix H32 definition 2021-04-25 18:08:02 +03:00
Github Actions 7bd9dd65f8 [CI Skip] release/beta 4.7.2-1
skip-checks: true
2021-04-25 14:44:02 +00:00
Jaco 5f57ecb2e1 Update ETH types (#3439)
* Update ETH types

* Build
2021-04-25 16:34:42 +02:00
Github Actions 9123f1d805 [CI Skip] release/beta 4.7.2-0
skip-checks: true
2021-04-25 11:28:54 +00:00
Jaco 7050c4a554 Updated Xcm OriginKind enum (#3438) 2021-04-25 13:18:47 +02:00
45 changed files with 280 additions and 201 deletions
+2 -1
View File
@@ -20,4 +20,5 @@
4.0.2 4.0.2
4.0.3 4.0.3
4.6.2 4.6.2
4.7.2
+1 -1
View File
@@ -1 +1 @@
12 14
+13
View File
@@ -1,5 +1,18 @@
# CHANGELOG # CHANGELOG
## 4.7.2 Apr 26, 2021
Upgrade priority: Low. Recommended for users of 4.7.1 using nvm
Changes:
- Update `.nvmrc` to reflect engines changes
- Update `EthBlock`/`EthHeader` types (as per Rust origin)
- Updated Xcm `OriginKind` enum
- Add derives for `membership`
- Cleanups on encodedLength calculations
## 4.7.1 Apr 25, 2021 ## 4.7.1 Apr 25, 2021
Upgrade priority: Low. Recommended for users following Substrate master. Upgrade priority: Low. Recommended for users following Substrate master.
+1 -1
View File
@@ -34,5 +34,5 @@
"@types/jest": "^26.0.22", "@types/jest": "^26.0.22",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"version": "4.7.1" "version": "4.7.2"
} }
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-contract", "name": "@polkadot/api-contract",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs", "description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js", "main": "index.js",
@@ -20,8 +20,8 @@
"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.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/api": "4.7.1", "@polkadot/api": "4.7.2",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"@polkadot/x-rxjs": "^6.3.1", "@polkadot/x-rxjs": "^6.3.1",
"bn.js": "^4.11.9" "bn.js": "^4.11.9"
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/api-contract', version: '4.7.2' };
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-derive", "name": "@polkadot/api-derive",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"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",
@@ -20,9 +20,9 @@
"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.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/api": "4.7.1", "@polkadot/api": "4.7.2",
"@polkadot/rpc-core": "4.7.1", "@polkadot/rpc-core": "4.7.2",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"@polkadot/util-crypto": "^6.3.1", "@polkadot/util-crypto": "^6.3.1",
"@polkadot/x-rxjs": "^6.3.1", "@polkadot/x-rxjs": "^6.3.1",
@@ -30,6 +30,6 @@
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^6.3.1", "@polkadot/keyring": "^6.3.1",
"@polkadot/rpc-provider": "4.7.1" "@polkadot/rpc-provider": "4.7.2"
} }
} }
@@ -13,6 +13,8 @@ import { catchError, map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util'; import { memo } from '../util';
type Collective = 'council' | 'membership' | 'technicalCommittee';
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]]; type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] { function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {
@@ -29,7 +31,7 @@ function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): Derive
.filter((proposal): proposal is DeriveCollectiveProposal => !!proposal); .filter((proposal): proposal is DeriveCollectiveProposal => !!proposal);
} }
function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): (hashes: (Hash | Uint8Array | string)[]) => Observable<DeriveCollectiveProposal[]> { function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: Collective): (hashes: (Hash | Uint8Array | string)[]) => Observable<DeriveCollectiveProposal[]> {
return memo(instanceId, (hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> => return memo(instanceId, (hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> =>
(isFunction(api.query[section]?.proposals) && hashes.length (isFunction(api.query[section]?.proposals) && hashes.length
? combineLatest<Result>([ ? combineLatest<Result>([
@@ -49,19 +51,19 @@ function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: 'coun
); );
} }
export function proposals (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): () => Observable<DeriveCollectiveProposal[]> { export function proposals (instanceId: string, api: ApiInterfaceRx, section: Collective): () => Observable<DeriveCollectiveProposal[]> {
const proposalsFrom = _proposalsFrom(instanceId, api, section); const proposalsFrom = _proposalsFrom(instanceId, api, section);
return memo(instanceId, (): Observable<DeriveCollectiveProposal[]> => return memo(instanceId, (): Observable<DeriveCollectiveProposal[]> =>
isFunction(api.query[section]?.proposals) isFunction(api.query[section]?.proposals)
? api.query[section].proposals().pipe( ? api.query[section as 'council'].proposals().pipe(
switchMap(proposalsFrom) switchMap(proposalsFrom)
) )
: of([] as DeriveCollectiveProposal[]) : of([] as DeriveCollectiveProposal[])
); );
} }
export function proposal (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> { export function proposal (instanceId: string, api: ApiInterfaceRx, section: Collective): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
const proposalsFrom = _proposalsFrom(instanceId, api, section); const proposalsFrom = _proposalsFrom(instanceId, api, section);
return memo(instanceId, (hash: Hash | Uint8Array | string): Observable<DeriveCollectiveProposal | null> => return memo(instanceId, (hash: Hash | Uint8Array | string): Observable<DeriveCollectiveProposal | null> =>
+2 -2
View File
@@ -10,9 +10,9 @@ import { proposal as collectiveProposal, proposals as collectiveProposals } from
import { memo } from '../util'; import { memo } from '../util';
export function proposal (instanceId: string, api: ApiInterfaceRx): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> { export function proposal (instanceId: string, api: ApiInterfaceRx): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
return memo(instanceId, collectiveProposal(instanceId, api)); return memo(instanceId, collectiveProposal(instanceId, api, 'council'));
} }
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCollectiveProposal[]> { export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCollectiveProposal[]> {
return memo(instanceId, collectiveProposals(instanceId, api)); return memo(instanceId, collectiveProposals(instanceId, api, 'council'));
} }
+3 -1
View File
@@ -16,6 +16,7 @@ import * as council from './council';
import * as democracy from './democracy'; import * as democracy from './democracy';
import * as elections from './elections'; import * as elections from './elections';
import * as imOnline from './imOnline'; import * as imOnline from './imOnline';
import * as membership from './membership';
import * as parachains from './parachains'; import * as parachains from './parachains';
import * as session from './session'; import * as session from './session';
import * as society from './society'; import * as society from './society';
@@ -27,7 +28,7 @@ import * as tx from './tx';
export { packageInfo } from './packageInfo'; export { packageInfo } from './packageInfo';
export * from './type'; export * from './type';
export const derive = { accounts, balances, bounties, chain, contracts, council, democracy, elections, imOnline, parachains, session, society, staking, technicalCommittee, treasury, tx }; export const derive = { accounts, balances, bounties, chain, contracts, council, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
type DeriveSection<Section> = { type DeriveSection<Section> = {
[Method in keyof Section]: Section[Method] extends AnyFunction [Method in keyof Section]: Section[Method] extends AnyFunction
@@ -49,6 +50,7 @@ const deriveAvail: Record<string, string[]> = {
democracy: ['democracy'], democracy: ['democracy'],
elections: ['electionsPhragmen', 'elections'], elections: ['electionsPhragmen', 'elections'],
imOnline: ['imOnline'], imOnline: ['imOnline'],
membership: ['membership'],
parachains: ['parachains', 'registrar'], parachains: ['parachains', 'registrar'],
session: ['session'], session: ['session'],
society: ['society'], society: ['society'],
@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './proposals';
@@ -0,0 +1,13 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { proposals as collectiveProposals } from '../collective';
import { memo } from '../util';
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCollectiveProposal[]> {
return memo(instanceId, collectiveProposals(instanceId, api, 'membership'));
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/api-derive', version: '4.7.2' };
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api", "name": "@polkadot/api",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"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",
@@ -20,13 +20,13 @@
"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.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/api-derive": "4.7.1", "@polkadot/api-derive": "4.7.2",
"@polkadot/keyring": "^6.3.1", "@polkadot/keyring": "^6.3.1",
"@polkadot/metadata": "4.7.1", "@polkadot/metadata": "4.7.2",
"@polkadot/rpc-core": "4.7.1", "@polkadot/rpc-core": "4.7.2",
"@polkadot/rpc-provider": "4.7.1", "@polkadot/rpc-provider": "4.7.2",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/types-known": "4.7.1", "@polkadot/types-known": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"@polkadot/util-crypto": "^6.3.1", "@polkadot/util-crypto": "^6.3.1",
"@polkadot/x-rxjs": "^6.3.1", "@polkadot/x-rxjs": "^6.3.1",
+23 -7
View File
@@ -31,7 +31,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
#registries: VersionedRegistry[] = []; #registries: VersionedRegistry[] = [];
#updateSub?: Subscription; #updateSub?: Subscription | null = null;
constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) { constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
super(options, type, decorateMethod); super(options, type, decorateMethod);
@@ -156,10 +156,10 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// on re-connection to the same chain, we don't want to re-do everything from chain again // on re-connection to the same chain, we don't want to re-do everything from chain again
if (this._isReady) { if (this._isReady) {
return true; return true;
} else if (this.#updateSub) {
this.#updateSub.unsubscribe();
} }
this._unsubscribeUpdates();
// only load from on-chain if we are not a clone (default path), alternatively // only load from on-chain if we are not a clone (default path), alternatively
// just use the values from the source instance provided // just use the values from the source instance provided
[this._genesisHash, this._runtimeMetadata] = this._options.source?._isReady [this._genesisHash, this._runtimeMetadata] = this._options.source?._isReady
@@ -302,6 +302,25 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
return true; return true;
} }
private _unsubscribeHealth (): void {
if (this.#healthTimer) {
clearInterval(this.#healthTimer);
this.#healthTimer = null;
}
}
private _unsubscribeUpdates (): void {
if (this.#updateSub) {
this.#updateSub.unsubscribe();
this.#updateSub = null;
}
}
protected _unsubscribe (): void {
this._unsubscribeHealth();
this._unsubscribeUpdates();
}
#onProviderConnect = async (): Promise<void> => { #onProviderConnect = async (): Promise<void> => {
this.emit('connected'); this.emit('connected');
this._isConnected.next(true); this._isConnected.next(true);
@@ -337,10 +356,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
this.emit('disconnected'); this.emit('disconnected');
this._isConnected.next(false); this._isConnected.next(false);
if (this.#healthTimer) { this._unsubscribeHealth();
clearInterval(this.#healthTimer);
this.#healthTimer = null;
}
}; };
#onProviderError = (error: Error): void => { #onProviderError = (error: Error): void => {
+2
View File
@@ -50,6 +50,8 @@ export abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType>
* @description Disconnect from the underlying provider, halting all network traffic * @description Disconnect from the underlying provider, halting all network traffic
*/ */
public disconnect (): Promise<void> { public disconnect (): Promise<void> {
this._unsubscribe();
return this._rpcCore.disconnect(); return this._rpcCore.disconnect();
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/api', version: '4.7.2' };
+1 -3
View File
@@ -165,9 +165,7 @@ export class ApiRx extends ApiBase<'rxjs'> {
this.#isReadyRx = from<Promise<ApiRx>>( this.#isReadyRx = from<Promise<ApiRx>>(
// You can create an observable from an event, however my mind groks this form better // You can create an observable from an event, however my mind groks this form better
new Promise((resolve): void => { new Promise((resolve): void => {
super.on('ready', (): void => { super.on('ready', () => resolve(this));
resolve(this);
});
}) })
); );
} }
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/metadata", "name": "@polkadot/metadata",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"description": "Helpers to extract information from runtime metadata", "description": "Helpers to extract information from runtime metadata",
"main": "index.js", "main": "index.js",
@@ -20,8 +20,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.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/types-known": "4.7.1", "@polkadot/types-known": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"@polkadot/util-crypto": "^6.3.1", "@polkadot/util-crypto": "^6.3.1",
"bn.js": "^4.11.9" "bn.js": "^4.11.9"
+2 -2
View File
@@ -3,7 +3,7 @@
import type { Registry } from '@polkadot/types/types'; import type { Registry } from '@polkadot/types/types';
import { isString, u8aConcat, u8aToU8a } from '@polkadot/util'; import { isString, u8aToU8a } from '@polkadot/util';
import { MetadataVersioned } from './MetadataVersioned'; import { MetadataVersioned } from './MetadataVersioned';
@@ -11,7 +11,7 @@ import { MetadataVersioned } from './MetadataVersioned';
const VERSION_IDX = 4; const VERSION_IDX = 4;
// magic + lowest supported version // magic + lowest supported version
const EMPTY_METADATA = u8aConcat(new Uint8Array([0x6d, 0x65, 0x74, 0x61, 9])); const EMPTY_METADATA = new Uint8Array([0x6d, 0x65, 0x74, 0x61, 9]);
const EMPTY_U8A = new Uint8Array(); const EMPTY_U8A = new Uint8Array();
function sanitizeInput (_value: Uint8Array | string = EMPTY_U8A): Uint8Array { function sanitizeInput (_value: Uint8Array | string = EMPTY_U8A): Uint8Array {
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/metadata', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/metadata', version: '4.7.2' };
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-core", "name": "@polkadot/rpc-core",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
@@ -20,9 +20,9 @@
"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.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/metadata": "4.7.1", "@polkadot/metadata": "4.7.2",
"@polkadot/rpc-provider": "4.7.1", "@polkadot/rpc-provider": "4.7.2",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"@polkadot/x-rxjs": "^6.3.1" "@polkadot/x-rxjs": "^6.3.1"
}, },
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/rpc-core', version: '4.7.2' };
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-provider", "name": "@polkadot/rpc-provider",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"description": "Transport providers for the API", "description": "Transport providers for the API",
"main": "index.js", "main": "index.js",
@@ -20,7 +20,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.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"@polkadot/util-crypto": "^6.3.1", "@polkadot/util-crypto": "^6.3.1",
"@polkadot/x-fetch": "^6.3.1", "@polkadot/x-fetch": "^6.3.1",
@@ -31,7 +31,7 @@
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^6.3.1", "@polkadot/keyring": "^6.3.1",
"@polkadot/metadata": "4.7.1", "@polkadot/metadata": "4.7.2",
"mock-socket": "^9.0.3", "mock-socket": "^9.0.3",
"nock": "^13.0.11" "nock": "^13.0.11"
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.7.2' };
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/typegen", "name": "@polkadot/typegen",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"description": "Type generation scripts", "description": "Type generation scripts",
"main": "index.js", "main": "index.js",
@@ -29,10 +29,10 @@
"@babel/core": "^7.13.16", "@babel/core": "^7.13.16",
"@babel/register": "^7.13.16", "@babel/register": "^7.13.16",
"@babel/runtime": "^7.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/api": "4.7.1", "@polkadot/api": "4.7.2",
"@polkadot/metadata": "4.7.1", "@polkadot/metadata": "4.7.2",
"@polkadot/rpc-provider": "4.7.1", "@polkadot/rpc-provider": "4.7.2",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"websocket": "^1.0.34", "websocket": "^1.0.34",
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/typegen', version: '4.7.2' };
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types-known", "name": "@polkadot/types-known",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
@@ -21,7 +21,7 @@
"dependencies": { "dependencies": {
"@babel/runtime": "^7.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/networks": "^6.3.1", "@polkadot/networks": "^6.3.1",
"@polkadot/types": "4.7.1", "@polkadot/types": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"bn.js": "^4.11.9" "bn.js": "^4.11.9"
}, },
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/types-known', version: '4.7.2' };
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types", "name": "@polkadot/types",
"version": "4.7.1", "version": "4.7.2",
"type": "module", "type": "module",
"description": "Implementation of the Parity codec", "description": "Implementation of the Parity codec",
"main": "index.js", "main": "index.js",
@@ -20,7 +20,7 @@
"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.13.17", "@babel/runtime": "^7.13.17",
"@polkadot/metadata": "4.7.1", "@polkadot/metadata": "4.7.2",
"@polkadot/util": "^6.3.1", "@polkadot/util": "^6.3.1",
"@polkadot/util-crypto": "^6.3.1", "@polkadot/util-crypto": "^6.3.1",
"@polkadot/x-rxjs": "^6.3.1", "@polkadot/x-rxjs": "^6.3.1",
+8 -2
View File
@@ -21,7 +21,7 @@ import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot
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, EthFilterChanges, 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 { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, 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';
@@ -41,7 +41,7 @@ import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/ty
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase'; import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery'; import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc'; import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H512, H64, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionPriority, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionPriority, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces/scaleInfo'; import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler'; import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session'; import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
@@ -385,6 +385,7 @@ declare module '@polkadot/types/types/registry' {
'Option<EthTransactionAction>': Option<EthTransactionAction>; 'Option<EthTransactionAction>': Option<EthTransactionAction>;
'Option<EthTransactionCondition>': Option<EthTransactionCondition>; 'Option<EthTransactionCondition>': Option<EthTransactionCondition>;
'Option<EthTransactionRequest>': Option<EthTransactionRequest>; 'Option<EthTransactionRequest>': Option<EthTransactionRequest>;
'Option<EthTransactionSignature>': Option<EthTransactionSignature>;
'Option<EthTransactionStatus>': Option<EthTransactionStatus>; 'Option<EthTransactionStatus>': Option<EthTransactionStatus>;
'Option<EthWork>': Option<EthWork>; 'Option<EthWork>': Option<EthWork>;
'Option<Event>': Option<Event>; 'Option<Event>': Option<Event>;
@@ -457,6 +458,7 @@ declare module '@polkadot/types/types/registry' {
'Option<H160>': Option<H160>; 'Option<H160>': Option<H160>;
'Option<H2048>': Option<H2048>; 'Option<H2048>': Option<H2048>;
'Option<H256>': Option<H256>; 'Option<H256>': Option<H256>;
'Option<H32>': Option<H32>;
'Option<H512>': Option<H512>; 'Option<H512>': Option<H512>;
'Option<H64>': Option<H64>; 'Option<H64>': Option<H64>;
'Option<Hash>': Option<Hash>; 'Option<Hash>': Option<Hash>;
@@ -1177,6 +1179,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<EthTransactionAction>': Vec<EthTransactionAction>; 'Vec<EthTransactionAction>': Vec<EthTransactionAction>;
'Vec<EthTransactionCondition>': Vec<EthTransactionCondition>; 'Vec<EthTransactionCondition>': Vec<EthTransactionCondition>;
'Vec<EthTransactionRequest>': Vec<EthTransactionRequest>; 'Vec<EthTransactionRequest>': Vec<EthTransactionRequest>;
'Vec<EthTransactionSignature>': Vec<EthTransactionSignature>;
'Vec<EthTransactionStatus>': Vec<EthTransactionStatus>; 'Vec<EthTransactionStatus>': Vec<EthTransactionStatus>;
'Vec<EthWork>': Vec<EthWork>; 'Vec<EthWork>': Vec<EthWork>;
'Vec<Event>': Vec<Event>; 'Vec<Event>': Vec<Event>;
@@ -1249,6 +1252,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<H160>': Vec<H160>; 'Vec<H160>': Vec<H160>;
'Vec<H2048>': Vec<H2048>; 'Vec<H2048>': Vec<H2048>;
'Vec<H256>': Vec<H256>; 'Vec<H256>': Vec<H256>;
'Vec<H32>': Vec<H32>;
'Vec<H512>': Vec<H512>; 'Vec<H512>': Vec<H512>;
'Vec<H64>': Vec<H64>; 'Vec<H64>': Vec<H64>;
'Vec<Hash>': Vec<Hash>; 'Vec<Hash>': Vec<Hash>;
@@ -1969,6 +1973,7 @@ declare module '@polkadot/types/types/registry' {
EthTransactionAction: EthTransactionAction; EthTransactionAction: EthTransactionAction;
EthTransactionCondition: EthTransactionCondition; EthTransactionCondition: EthTransactionCondition;
EthTransactionRequest: EthTransactionRequest; EthTransactionRequest: EthTransactionRequest;
EthTransactionSignature: EthTransactionSignature;
EthTransactionStatus: EthTransactionStatus; EthTransactionStatus: EthTransactionStatus;
EthWork: EthWork; EthWork: EthWork;
Event: Event; Event: Event;
@@ -2041,6 +2046,7 @@ declare module '@polkadot/types/types/registry' {
H160: H160; H160: H160;
H2048: H2048; H2048: H2048;
H256: H256; H256: H256;
H32: H32;
H512: H512; H512: H512;
H64: H64; H64: H64;
Hash: Hash; Hash: Hash;
+1 -3
View File
@@ -30,9 +30,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public get encodedLength (): number {
return this.reduce((total, raw): number => { return this.reduce((total, entry) => total + entry.encodedLength, compactToU8a(this.length).length);
return total + raw.encodedLength;
}, compactToU8a(this.length).length);
} }
/** /**
+1 -5
View File
@@ -74,11 +74,7 @@ export class Tuple extends AbstractArray<Codec> {
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public get encodedLength (): number {
return this.reduce((length: number, entry: Codec): number => { return this.reduce((total, entry) => total + entry.encodedLength, 0);
length += entry.encodedLength;
return length;
}, 0);
} }
/** /**
+1 -1
View File
@@ -63,7 +63,7 @@ export class VecFixed<T extends Codec> extends AbstractArray<T> {
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public get encodedLength (): number {
return this.toU8a().length; return this.reduce((total, entry) => total + entry.encodedLength, 0);
} }
public toU8a (): Uint8Array { public toU8a (): Uint8Array {
+2 -2
View File
@@ -5,7 +5,7 @@ import { alias, removeColons } from './sanitize';
describe('sanitize', (): void => { describe('sanitize', (): void => {
describe('alias', (): void => { describe('alias', (): void => {
const exec = alias(['String'], 'Text'); const exec = alias('String', 'Text');
it('replaces all occurrences for types', (): void => { it('replaces all occurrences for types', (): void => {
expect(exec('(String,Address,MasterString,String)')).toEqual( expect(exec('(String,Address,MasterString,String)')).toEqual(
@@ -27,7 +27,7 @@ describe('sanitize', (): void => {
}); });
it('handles emdedded Vec/Tuples', (): void => { it('handles emdedded Vec/Tuples', (): void => {
const ann = alias(['Announcement'], 'ProxyAnnouncement'); const ann = alias('Announcement', 'ProxyAnnouncement');
expect(ann('(Vec<Announcement>,BalanceOf)')).toEqual( expect(ann('(Vec<Announcement>,BalanceOf)')).toEqual(
'(Vec<ProxyAnnouncement>,BalanceOf)' '(Vec<ProxyAnnouncement>,BalanceOf)'
+16 -18
View File
@@ -12,8 +12,8 @@ const BOX_PRECEDING = ['<', '(', '[', '"', ',', ' ']; // start of vec, tuple, fi
const mappings: Mapper[] = [ const mappings: Mapper[] = [
// alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport // alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport
alias(['<T::InherentOfflineReport as InherentOfflineReport>::Inherent'], 'InherentOfflineReport', false), alias('<T::InherentOfflineReport as InherentOfflineReport>::Inherent', 'InherentOfflineReport', false),
alias(['VecDeque<'], 'Vec<', false), alias('VecDeque<', 'Vec<', false),
// <T::Balance as HasCompact> // <T::Balance as HasCompact>
cleanupCompact(), cleanupCompact(),
// Change BoundedVec<Type, Size> to Vec<Type> // Change BoundedVec<Type, Size> to Vec<Type>
@@ -27,16 +27,17 @@ const mappings: Mapper[] = [
// remove generics, `MisbehaviorReport<Hash, BlockNumber>` -> `MisbehaviorReport` // remove generics, `MisbehaviorReport<Hash, BlockNumber>` -> `MisbehaviorReport`
removeGenerics(), removeGenerics(),
// alias String -> Text (compat with jsonrpc methods) // alias String -> Text (compat with jsonrpc methods)
alias(['String'], 'Text'), alias('String', 'Text'),
// alias Vec<u8> -> Bytes // alias Vec<u8> -> Bytes
alias(['Vec<u8>', '&\\[u8\\]'], 'Bytes'), alias('Vec<u8>', 'Bytes'),
alias('&\\[u8\\]', 'Bytes'),
// alias RawAddress -> Address // alias RawAddress -> Address
alias(['RawAddress'], 'Address'), alias('RawAddress', 'Address'),
// lookups, mapped to Address/AccountId as appropriate in runtime // lookups, mapped to Address/AccountId as appropriate in runtime
alias(['Lookup::Source'], 'LookupSource'), alias('Lookup::Source', 'LookupSource'),
alias(['Lookup::Target'], 'LookupTarget'), alias('Lookup::Target', 'LookupTarget'),
// HACK duplication between contracts & primitives, however contracts prefixed with exec // HACK duplication between contracts & primitives, however contracts prefixed with exec
alias(['exec::StorageKey'], 'ContractStorageKey'), alias('exec::StorageKey', 'ContractStorageKey'),
// flattens tuples with one value, `(AccountId)` -> `AccountId` // flattens tuples with one value, `(AccountId)` -> `AccountId`
flattenSingleTuple(), flattenSingleTuple(),
// converts ::Type to Type, <T as Trait<I>>::Proposal -> Proposal // converts ::Type to Type, <T as Trait<I>>::Proposal -> Proposal
@@ -62,17 +63,14 @@ export function findClosing (value: string, start: number): number {
throw new Error(`Unable to find closing matching <> on '${value}' (start ${start})`); throw new Error(`Unable to find closing matching <> on '${value}' (start ${start})`);
} }
export function alias (src: string[], dest: string, withChecks = true): Mapper { export function alias (src: string, dest: string, withChecks = true): Mapper {
return (value: string): string => return (value: string): string =>
src.reduce((value, src): string => value.replace(
value new RegExp(`(^${src}|${BOX_PRECEDING.map((box) => `\\${box}${src}`).join('|')})`, 'g'),
.replace( (src): string =>
new RegExp(`(^${src}|${BOX_PRECEDING.map((box) => `\\${box}${src}`).join('|')})`, 'g'), withChecks && BOX_PRECEDING.includes(src[0])
(src): string => ? `${src[0]}${dest}`
withChecks && BOX_PRECEDING.includes(src[0]) : dest
? `${src[0]}${dest}`
: dest
), value
); );
} }
@@ -24,6 +24,28 @@ const types: DefinitionsTypes = {
storageProof: 'Vec<EthStorageProof>' storageProof: 'Vec<EthStorageProof>'
}, },
EthBlock: { EthBlock: {
header: 'EthHeader',
transactions: 'Vec<EthTransaction>',
ommers: 'Vec<EthHeader>'
},
EthHeader: {
parentHash: 'H256',
ommersHash: 'H256',
beneficiary: 'H160',
stateRoot: 'H256',
transactionsRoot: 'H256',
receiptsRoot: 'H256',
logsBloom: 'EthBloom',
difficulty: 'U256',
number: 'U256',
gasLimit: 'U256',
gasUsed: 'U256',
timestamp: 'u64',
extraData: 'Bytes',
mixMash: 'H256',
nonce: 'H64'
},
EthRichBlock: {
_alias: { _alias: {
blockHash: 'hash', blockHash: 'hash',
blockSize: 'size' blockSize: 'size'
@@ -40,7 +62,7 @@ const types: DefinitionsTypes = {
gasUsed: 'U256', gasUsed: 'U256',
gasLimit: 'U256', gasLimit: 'U256',
extraData: 'Bytes', extraData: 'Bytes',
logsBloom: 'H2048', logsBloom: 'EthBloom',
timestamp: 'U256', timestamp: 'U256',
difficulty: 'U256', difficulty: 'U256',
totalDifficulty: 'Option<U256>', totalDifficulty: 'Option<U256>',
@@ -95,7 +117,7 @@ const types: DefinitionsTypes = {
Null: 'Null' Null: 'Null'
} }
}, },
EthHeader: { EthRichHeader: {
_alias: { _alias: {
blockHash: 'hash', blockHash: 'hash',
blockSize: 'size' blockSize: 'size'
@@ -112,7 +134,7 @@ const types: DefinitionsTypes = {
gasUsed: 'U256', gasUsed: 'U256',
gasLimit: 'U256', gasLimit: 'U256',
extraData: 'Bytes', extraData: 'Bytes',
logsBloom: 'H2048', logsBloom: 'EthBloom',
timestamp: 'U256', timestamp: 'U256',
difficulty: 'U256', difficulty: 'U256',
sealFields: 'Vec<Bytes>', sealFields: 'Vec<Bytes>',
@@ -142,11 +164,9 @@ const types: DefinitionsTypes = {
contractAddress: 'Option<H160>', contractAddress: 'Option<H160>',
logs: 'Vec<EthLog>', logs: 'Vec<EthLog>',
root: 'Option<H256>', root: 'Option<H256>',
logsBloom: 'H2048', logsBloom: 'EthBloom',
statusCode: 'Option<U64>' statusCode: 'Option<U64>'
}, },
EthRichBlock: 'EthBlock',
EthRichHeader: 'EthHeader',
EthStorageProof: { EthStorageProof: {
key: 'U256', key: 'U256',
value: 'U256', value: 'U256',
@@ -189,35 +209,13 @@ const types: DefinitionsTypes = {
action: 'EthTransactionAction', action: 'EthTransactionAction',
value: 'U256', value: 'U256',
input: 'Bytes', input: 'Bytes',
// TransactionSignature (embedded) signature: 'EthTransactionSignature'
},
EthTransactionSignature: {
v: 'u64', v: 'u64',
r: 'H256', r: 'H256',
s: 'H256' s: 'H256'
}, },
// as per the RPC definition
// TODO: Check these, re-add
// EthTransaction: {
// // hash in Rust
// transactionHash: 'H256',
// nonce: 'U256',
// blockHash: 'Option<H256>',
// blockNumber: 'Option<U256>',
// transactionIndex: 'Option<U256>',
// from: 'H160',
// to: 'Option<H160>',
// value: 'U256',
// gasPrice: 'U256',
// gas: 'U256',
// input: 'Bytes',
// creates: 'Option<H160>',
// raw: 'Bytes',
// publicKey: 'Option<H512>',
// chainId: 'Option<U64>',
// standardV: 'U256',
// v: 'U256',
// r: 'U256',
// s: 'U256'
// },
EthTransactionAction: { EthTransactionAction: {
_enum: { _enum: {
Call: 'H160', Call: 'H160',
+63 -38
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 } from '@polkadot/types/interfaces/runtime'; import type { BlockNumber, H160, H2048, H256, H64 } from '@polkadot/types/interfaces/runtime';
/** @name EthAccount */ /** @name EthAccount */
export interface EthAccount extends Struct { export interface EthAccount extends Struct {
@@ -17,26 +17,9 @@ export interface EthAccount extends Struct {
/** @name EthBlock */ /** @name EthBlock */
export interface EthBlock extends Struct { export interface EthBlock extends Struct {
readonly blockHash: Option<H256>; readonly header: EthHeader;
readonly parentHash: H256;
readonly sha3Uncles: H256;
readonly author: H160;
readonly miner: H160;
readonly stateRoot: H256;
readonly transactionsRoot: H256;
readonly receiptsRoot: H256;
readonly number: Option<U256>;
readonly gasUsed: U256;
readonly gasLimit: U256;
readonly extraData: Bytes;
readonly logsBloom: H2048;
readonly timestamp: U256;
readonly difficulty: U256;
readonly totalDifficulty: Option<U256>;
readonly sealFields: Vec<Bytes>;
readonly uncles: Vec<H256>;
readonly transactions: Vec<EthTransaction>; readonly transactions: Vec<EthTransaction>;
readonly blockSize: Option<U256>; readonly ommers: Vec<EthHeader>;
} }
/** @name EthBloom */ /** @name EthBloom */
@@ -112,23 +95,21 @@ export interface EthFilterTopicInner extends Enum {
/** @name EthHeader */ /** @name EthHeader */
export interface EthHeader extends Struct { export interface EthHeader extends Struct {
readonly blockHash: Option<H256>;
readonly parentHash: H256; readonly parentHash: H256;
readonly sha3Uncles: H256; readonly ommersHash: H256;
readonly author: H160; readonly beneficiary: H160;
readonly miner: H160;
readonly stateRoot: H256; readonly stateRoot: H256;
readonly transactionsRoot: H256; readonly transactionsRoot: H256;
readonly receiptsRoot: H256; readonly receiptsRoot: H256;
readonly number: Option<U256>; readonly logsBloom: EthBloom;
readonly gasUsed: U256;
readonly gasLimit: U256;
readonly extraData: Bytes;
readonly logsBloom: H2048;
readonly timestamp: U256;
readonly difficulty: U256; readonly difficulty: U256;
readonly sealFields: Vec<Bytes>; readonly number: U256;
readonly blockSize: Option<U256>; readonly gasLimit: U256;
readonly gasUsed: U256;
readonly timestamp: u64;
readonly extraData: Bytes;
readonly mixMash: H256;
readonly nonce: H64;
} }
/** @name EthLog */ /** @name EthLog */
@@ -158,15 +139,54 @@ export interface EthReceipt extends Struct {
readonly contractAddress: Option<H160>; readonly contractAddress: Option<H160>;
readonly logs: Vec<EthLog>; readonly logs: Vec<EthLog>;
readonly root: Option<H256>; readonly root: Option<H256>;
readonly logsBloom: H2048; readonly logsBloom: EthBloom;
readonly statusCode: Option<U64>; readonly statusCode: Option<U64>;
} }
/** @name EthRichBlock */ /** @name EthRichBlock */
export interface EthRichBlock extends EthBlock {} export interface EthRichBlock extends Struct {
readonly blockHash: Option<H256>;
readonly parentHash: H256;
readonly sha3Uncles: H256;
readonly author: H160;
readonly miner: H160;
readonly stateRoot: H256;
readonly transactionsRoot: H256;
readonly receiptsRoot: H256;
readonly number: Option<U256>;
readonly gasUsed: U256;
readonly gasLimit: U256;
readonly extraData: Bytes;
readonly logsBloom: EthBloom;
readonly timestamp: U256;
readonly difficulty: U256;
readonly totalDifficulty: Option<U256>;
readonly sealFields: Vec<Bytes>;
readonly uncles: Vec<H256>;
readonly transactions: Vec<EthTransaction>;
readonly blockSize: Option<U256>;
}
/** @name EthRichHeader */ /** @name EthRichHeader */
export interface EthRichHeader extends EthHeader {} export interface EthRichHeader extends Struct {
readonly blockHash: Option<H256>;
readonly parentHash: H256;
readonly sha3Uncles: H256;
readonly author: H160;
readonly miner: H160;
readonly stateRoot: H256;
readonly transactionsRoot: H256;
readonly receiptsRoot: H256;
readonly number: Option<U256>;
readonly gasUsed: U256;
readonly gasLimit: U256;
readonly extraData: Bytes;
readonly logsBloom: EthBloom;
readonly timestamp: U256;
readonly difficulty: U256;
readonly sealFields: Vec<Bytes>;
readonly blockSize: Option<U256>;
}
/** @name EthStorageProof */ /** @name EthStorageProof */
export interface EthStorageProof extends Struct { export interface EthStorageProof extends Struct {
@@ -226,9 +246,7 @@ export interface EthTransaction extends Struct {
readonly action: EthTransactionAction; readonly action: EthTransactionAction;
readonly value: U256; readonly value: U256;
readonly input: Bytes; readonly input: Bytes;
readonly v: u64; readonly signature: EthTransactionSignature;
readonly r: H256;
readonly s: H256;
} }
/** @name EthTransactionAction */ /** @name EthTransactionAction */
@@ -257,6 +275,13 @@ export interface EthTransactionRequest extends Struct {
readonly nonce: Option<U256>; readonly nonce: Option<U256>;
} }
/** @name EthTransactionSignature */
export interface EthTransactionSignature extends Struct {
readonly v: u64;
readonly r: H256;
readonly s: H256;
}
/** @name EthTransactionStatus */ /** @name EthTransactionStatus */
export interface EthTransactionStatus extends Struct { export interface EthTransactionStatus extends Struct {
readonly transactionHash: H256; readonly transactionHash: H256;
@@ -62,8 +62,9 @@ export default {
normal: 'Weight', normal: 'Weight',
operational: 'Weight' operational: 'Weight'
}, },
H32: '[u8; 4; H32]',
H64: '[u8; 8; H64]', H64: '[u8; 8; H64]',
H128: '[u8; 16; H64]', H128: '[u8; 16; H128]',
H160: '[u8; 20; H160]', H160: '[u8; 20; H160]',
H256: '[u8; 32; H256]', H256: '[u8; 32; H256]',
H512: '[u8; 64; H512]', H512: '[u8; 64; H512]',
@@ -123,6 +123,9 @@ export interface H2048 extends U8aFixed {}
/** @name H256 */ /** @name H256 */
export interface H256 extends U8aFixed {} export interface H256 extends U8aFixed {}
/** @name H32 */
export interface H32 extends U8aFixed {}
/** @name H512 */ /** @name H512 */
export interface H512 extends U8aFixed {} export interface H512 extends U8aFixed {}
@@ -179,7 +179,7 @@ export default {
...xmcOrder, ...xmcOrder,
DoubleEncodedCall: { encoded: 'Vec<u8>' }, DoubleEncodedCall: { encoded: 'Vec<u8>' },
XcmOriginKind: { XcmOriginKind: {
_enum: ['Native', 'SovereignAccount', 'Superuser'] _enum: ['Native', 'SovereignAccount', 'Superuser', 'Xcm']
}, },
XcmResponse: { XcmResponse: {
_enum: { _enum: {
@@ -212,7 +212,8 @@ export default {
WeightNotComputable: 'Null', WeightNotComputable: 'Null',
Barrier: 'Null', Barrier: 'Null',
NotWithdrawable: 'Null', NotWithdrawable: 'Null',
LocationCannotHold: 'Null' LocationCannotHold: 'Null',
TooExpensive: 'Null'
} }
}, },
XcmOutcome: { XcmOutcome: {
@@ -281,6 +281,7 @@ export interface XcmError extends Enum {
readonly isBarrier: boolean; readonly isBarrier: boolean;
readonly isNotWithdrawable: boolean; readonly isNotWithdrawable: boolean;
readonly isLocationCannotHold: boolean; readonly isLocationCannotHold: boolean;
readonly isTooExpensive: boolean;
} }
/** @name XcmHrmpChannelAccepted */ /** @name XcmHrmpChannelAccepted */
@@ -375,6 +376,7 @@ export interface XcmOriginKind extends Enum {
readonly isNative: boolean; readonly isNative: boolean;
readonly isSovereignAccount: boolean; readonly isSovereignAccount: boolean;
readonly isSuperuser: boolean; readonly isSuperuser: boolean;
readonly isXcm: boolean;
} }
/** @name XcmOutcome */ /** @name XcmOutcome */
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types', version: '4.7.1' }; export const packageInfo = { name: '@polkadot/types', version: '4.7.2' };
+1 -1
View File
@@ -28,7 +28,7 @@ function decodeText (value?: null | Text | string | AnyU8a | { toString: () => s
const [offset, length] = compactFromU8a(value); const [offset, length] = compactFromU8a(value);
const total = offset + length.toNumber(); const total = offset + length.toNumber();
assert(length.lten(MAX_LENGTH), () => `Text length ${length.toString()} exceeds ${MAX_LENGTH}`); assert(length.lten(MAX_LENGTH), () => `Text: length ${length.toString()} exceeds ${MAX_LENGTH}`);
assert(total <= value.length, () => `Text: required length less than remainder, expected at least ${total}, found ${value.length}`); assert(total <= value.length, () => `Text: required length less than remainder, expected at least ${total}, found ${value.length}`);
return u8aToString(value.subarray(offset, total)); return u8aToString(value.subarray(offset, total));
+32 -32
View File
@@ -1788,24 +1788,24 @@ __metadata:
resolution: "@polkadot/api-contract@workspace:packages/api-contract" resolution: "@polkadot/api-contract@workspace:packages/api-contract"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/api": 4.7.1 "@polkadot/api": 4.7.2
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@polkadot/x-rxjs": ^6.3.1 "@polkadot/x-rxjs": ^6.3.1
bn.js: ^4.11.9 bn.js: ^4.11.9
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/api-derive@4.7.1, @polkadot/api-derive@workspace:packages/api-derive": "@polkadot/api-derive@4.7.2, @polkadot/api-derive@workspace:packages/api-derive":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/api-derive@workspace:packages/api-derive" resolution: "@polkadot/api-derive@workspace:packages/api-derive"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/api": 4.7.1 "@polkadot/api": 4.7.2
"@polkadot/keyring": ^6.3.1 "@polkadot/keyring": ^6.3.1
"@polkadot/rpc-core": 4.7.1 "@polkadot/rpc-core": 4.7.2
"@polkadot/rpc-provider": 4.7.1 "@polkadot/rpc-provider": 4.7.2
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@polkadot/util-crypto": ^6.3.1 "@polkadot/util-crypto": ^6.3.1
"@polkadot/x-rxjs": ^6.3.1 "@polkadot/x-rxjs": ^6.3.1
@@ -1813,18 +1813,18 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/api@4.7.1, @polkadot/api@workspace:packages/api": "@polkadot/api@4.7.2, @polkadot/api@workspace:packages/api":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/api@workspace:packages/api" resolution: "@polkadot/api@workspace:packages/api"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/api-derive": 4.7.1 "@polkadot/api-derive": 4.7.2
"@polkadot/keyring": ^6.3.1 "@polkadot/keyring": ^6.3.1
"@polkadot/metadata": 4.7.1 "@polkadot/metadata": 4.7.2
"@polkadot/rpc-core": 4.7.1 "@polkadot/rpc-core": 4.7.2
"@polkadot/rpc-provider": 4.7.1 "@polkadot/rpc-provider": 4.7.2
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/types-known": 4.7.1 "@polkadot/types-known": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@polkadot/util-crypto": ^6.3.1 "@polkadot/util-crypto": ^6.3.1
"@polkadot/x-rxjs": ^6.3.1 "@polkadot/x-rxjs": ^6.3.1
@@ -1933,14 +1933,14 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@polkadot/metadata@4.7.1, @polkadot/metadata@workspace:packages/metadata": "@polkadot/metadata@4.7.2, @polkadot/metadata@workspace:packages/metadata":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/metadata@workspace:packages/metadata" resolution: "@polkadot/metadata@workspace:packages/metadata"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/keyring": ^6.3.1 "@polkadot/keyring": ^6.3.1
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/types-known": 4.7.1 "@polkadot/types-known": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@polkadot/util-crypto": ^6.3.1 "@polkadot/util-crypto": ^6.3.1
bn.js: ^4.11.9 bn.js: ^4.11.9
@@ -1956,28 +1956,28 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@polkadot/rpc-core@4.7.1, @polkadot/rpc-core@workspace:packages/rpc-core": "@polkadot/rpc-core@4.7.2, @polkadot/rpc-core@workspace:packages/rpc-core":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/rpc-core@workspace:packages/rpc-core" resolution: "@polkadot/rpc-core@workspace:packages/rpc-core"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/keyring": ^6.3.1 "@polkadot/keyring": ^6.3.1
"@polkadot/metadata": 4.7.1 "@polkadot/metadata": 4.7.2
"@polkadot/rpc-provider": 4.7.1 "@polkadot/rpc-provider": 4.7.2
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@polkadot/x-rxjs": ^6.3.1 "@polkadot/x-rxjs": ^6.3.1
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/rpc-provider@4.7.1, @polkadot/rpc-provider@workspace:packages/rpc-provider": "@polkadot/rpc-provider@4.7.2, @polkadot/rpc-provider@workspace:packages/rpc-provider":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider" resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/keyring": ^6.3.1 "@polkadot/keyring": ^6.3.1
"@polkadot/metadata": 4.7.1 "@polkadot/metadata": 4.7.2
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@polkadot/util-crypto": ^6.3.1 "@polkadot/util-crypto": ^6.3.1
"@polkadot/x-fetch": ^6.3.1 "@polkadot/x-fetch": ^6.3.1
@@ -2006,10 +2006,10 @@ __metadata:
"@babel/core": ^7.13.16 "@babel/core": ^7.13.16
"@babel/register": ^7.13.16 "@babel/register": ^7.13.16
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/api": 4.7.1 "@polkadot/api": 4.7.2
"@polkadot/metadata": 4.7.1 "@polkadot/metadata": 4.7.2
"@polkadot/rpc-provider": 4.7.1 "@polkadot/rpc-provider": 4.7.2
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@types/websocket": ^1.0.2 "@types/websocket": ^1.0.2
"@types/yargs": ^16.0.1 "@types/yargs": ^16.0.1
@@ -2025,26 +2025,26 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/types-known@4.7.1, @polkadot/types-known@workspace:packages/types-known": "@polkadot/types-known@4.7.2, @polkadot/types-known@workspace:packages/types-known":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/types-known@workspace:packages/types-known" resolution: "@polkadot/types-known@workspace:packages/types-known"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/networks": ^6.3.1 "@polkadot/networks": ^6.3.1
"@polkadot/types": 4.7.1 "@polkadot/types": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@types/bn.js": ^4.11.6 "@types/bn.js": ^4.11.6
bn.js: ^4.11.9 bn.js: ^4.11.9
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/types@4.7.1, @polkadot/types@workspace:packages/types": "@polkadot/types@4.7.2, @polkadot/types@workspace:packages/types":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/types@workspace:packages/types" resolution: "@polkadot/types@workspace:packages/types"
dependencies: dependencies:
"@babel/runtime": ^7.13.17 "@babel/runtime": ^7.13.17
"@polkadot/keyring": ^6.3.1 "@polkadot/keyring": ^6.3.1
"@polkadot/metadata": 4.7.1 "@polkadot/metadata": 4.7.2
"@polkadot/util": ^6.3.1 "@polkadot/util": ^6.3.1
"@polkadot/util-crypto": ^6.3.1 "@polkadot/util-crypto": ^6.3.1
"@polkadot/x-rxjs": ^6.3.1 "@polkadot/x-rxjs": ^6.3.1