Compare commits

..
23 Commits
Author SHA1 Message Date
Github Actions e6beb6554d [CI Skip] release/stable 1.18.1
skip-checks: true
2020-06-08 15:53:39 +00:00
Jaco Greeff 099cf5a351 1.18 (#2340)
* 1.18

* Polkadot ProxyType
2020-06-08 17:39:12 +02:00
Github Actions 55e762a348 [CI Skip] release/beta 1.18.0-beta.10
skip-checks: true
2020-06-08 13:43:22 +00:00
Jaco Greeff 0ad146c607 Adjust ProxyType for Westend (#2339) 2020-06-08 15:30:51 +02:00
Github Actions 4e7f3f5268 [CI Skip] release/beta 1.18.0-beta.9
skip-checks: true
2020-06-08 08:02:24 +00:00
Jeremías DíazandJaco Greeff 6a9e3d80f1 feat: add external pagination support (#2325)
* feat: add external pagination support

* Ordering, no functionality changes

* fix: use correct assertion condition

Also moved the PaginationOptions type to the base types file

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-06-08 09:49:53 +02:00
Github Actions dee98fae55 [CI Skip] release/beta 1.18.0-beta.8
skip-checks: true
2020-06-08 05:59:44 +00:00
Xiliang Chen ff52876920 allow Option in enum & Result type (#2336) 2020-06-08 07:45:22 +02:00
Github Actions 4d01a09c54 [CI Skip] release/beta 1.18.0-beta.7
skip-checks: true
2020-06-07 17:27:50 +00:00
Jaco Greeff 7310ea825e Allow for string subids (#2335) 2020-06-07 19:16:16 +02:00
Github Actions 15b80a47c3 [CI Skip] release/beta 1.18.0-beta.6
skip-checks: true
2020-06-07 13:02:15 +00:00
Jaco Greeff 622682b4ef npos-election ElectionScore type (#2334) 2020-06-07 14:50:25 +02:00
Github Actions 56415df4ab [CI Skip] release/beta 1.18.0-beta.5
skip-checks: true
2020-06-06 06:53:17 +00:00
Jaco Greeff 8bea5e5a3b Align Call section/method field names (#2332) 2020-06-06 08:40:41 +02:00
Github Actions d6372ade44 [CI Skip] release/beta 1.18.0-beta.4
skip-checks: true
2020-06-05 20:32:29 +00:00
Jaco Greeff f501994df8 Bump deps (#2333) 2020-06-05 22:20:32 +02:00
Github Actions b787a7d5a0 [CI Skip] release/beta 1.18.0-beta.3
skip-checks: true
2020-06-03 20:20:42 +00:00
Gerben van de Wiel 11d162a10d Adding some extra notes on changes in the specname (#2329) 2020-06-03 22:08:06 +02:00
Github Actions e2564dea17 [CI Skip] release/beta 1.18.0-beta.2
skip-checks: true
2020-06-03 13:40:22 +00:00
Jaco Greeff 2b9152871e Add ProxyType (#2327) 2020-06-03 15:27:11 +02:00
Github Actions 70ecb03d14 [CI Skip] release/beta 1.18.0-beta.1
skip-checks: true
2020-06-03 05:46:05 +00:00
djuanito.eth a2f179acb1 Update fees to current constants (#2320)
* Update fees to current constants

* Reorder args on map()

* Fixed incorrect order of args on map()
2020-06-03 07:34:03 +02:00
Jaco Greeff c8cb97edef beta 0 reset 2020-06-03 07:33:27 +02:00
31 changed files with 530 additions and 294 deletions
+12
View File
@@ -1,5 +1,17 @@
# CHANGELOG
## 1.18.1 Jun 8, 2020
- Expand docs on node-template types (Thanks to https://github.com/g2udevelopment)
- Update contract fees to current impl. (Thanks to https://github.com/djuanit0x)
- Allow `Option` types in enum/Result type generation (Thanks to http://github.com/xlc)
- Add `.entriesPaged` and `.keysPaged` methods for state maps (https://github.com/monitz87)
- Add types for new Substrate proxy module
- Adjust types for new Substrate (renamed) npos-elections module
- `Call` now exposes `method` & `section` fields (aligned with `toHuman()` representation)
- Cater for new Substrate string subscription ids (with backwards compatibility)
- `@polkadot/util` 2.13
## 1.17.2 Jun 2, 2020
- Ensure subscription promise resolves before first result
+3
View File
@@ -20,6 +20,9 @@ All data transferred between the API and the Node is in a SCALE-encoded binary f
To fix this, you should look at the specific `api.tx.*` params and adjust the type definitions for those param types to match what is found on the node side. In some rare cases the cause could be extrinsic formatting related, to track these make an `api.tx.system.remark(data: Bytes)` call, if it fails, the API and node cannot agree on [an extrinsic format and adjustments are required](types.extend.md#impact-on-extrinsics).
If you are using a node-template based version of substrate and you changed the specName you need to add these typings(In addition to other custom types) `{"Address": "AccountId","LookupSource": "AccountId"}`. This is also the case when you use [polkadot-js/apps](https://github.com/polkadot-js/apps) to connect to your node. When the specName stays node-template the API is smart enough to add the custom typings.
## I would like to sign transactions offline
The API itself is independent on where the signature comes from and how it is injected. Additionally it implements a signer interface, that can be used for external signing - an example of this is the [polkadot-js/apps](https://github.com/polkadot-js/apps) support for signing via extensions and even the [polkadot-js/extension](https://github.com/polkadot-js/extension) support for tools such as the [Parity Signer](https://github.com/paritytech/parity-signer).
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.17.2"
"version": "1.18.1"
}
+3 -3
View File
@@ -27,12 +27,12 @@
"@babel/core": "^7.10.2",
"@babel/register": "^7.10.1",
"@babel/runtime": "^7.10.2",
"@polkadot/dev": "^0.55.7",
"@polkadot/ts": "^0.3.25",
"@polkadot/dev": "^0.55.8",
"@polkadot/ts": "^0.3.26",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^25.2.3",
"@vuepress/plugin-search": "^1.5.0",
"copyfiles": "^2.3.0"
},
"version": "1.17.2"
"version": "1.18.1"
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.17.2",
"version": "1.18.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -27,10 +27,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/api": "1.17.2",
"@polkadot/rpc-core": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/api": "1.18.1",
"@polkadot/rpc-core": "1.18.1",
"@polkadot/types": "1.18.1",
"@polkadot/util": "^2.13.1",
"bn.js": "^5.1.2",
"rxjs": "^6.5.5"
}
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.17.2",
"version": "1.18.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -28,17 +28,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/api": "1.17.2",
"@polkadot/rpc-core": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"@polkadot/api": "1.18.1",
"@polkadot/rpc-core": "1.18.1",
"@polkadot/rpc-provider": "1.18.1",
"@polkadot/types": "1.18.1",
"@polkadot/util": "^2.13.1",
"@polkadot/util-crypto": "^2.13.1",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.12.2"
"@polkadot/keyring": "^2.13.1"
}
}
+9 -7
View File
@@ -11,23 +11,24 @@ import { map } from 'rxjs/operators';
import { memo } from '../util';
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN];
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN, BN];
// query via constants (current applicable path)
function queryConstants (api: ApiInterfaceRx): Observable<ResultV2> {
return of([
// deprecated
api.consts.contracts.callBaseFee || api.registry.createType('Balance'),
api.consts.contracts.contractFee || api.registry.createType('Balance'),
api.consts.contracts.creationFee || api.registry.createType('Balance'),
api.consts.contracts.transactionBaseFee || api.registry.createType('Balance'),
api.consts.contracts.transactionByteFee || api.registry.createType('Balance'),
api.consts.contracts.transferFee || api.registry.createType('Balance'),
// current
api.consts.contracts.callBaseFee,
api.consts.contracts.contractFee,
api.consts.contracts.rentByteFee,
api.consts.contracts.rentDepositOffset,
api.consts.contracts.tombstoneDeposit,
api.consts.contracts.transactionBaseFee,
api.consts.contracts.transactionByteFee
api.consts.contracts.surchargeReward,
api.consts.contracts.tombstoneDeposit
]) as unknown as Observable<ResultV2>;
}
@@ -47,12 +48,13 @@ function queryConstants (api: ApiInterfaceRx): Observable<ResultV2> {
export function fees (api: ApiInterfaceRx): () => Observable<DeriveContractFees> {
return memo((): Observable<DeriveContractFees> => {
return queryConstants(api).pipe(
map(([creationFee, transferFee, callBaseFee, contractFee, rentByteFee, rentDepositOffset, tombstoneDeposit, transactionBaseFee, transactionByteFee]): DeriveContractFees => ({
map(([callBaseFee, contractFee, creationFee, transactionBaseFee, transactionByteFee, transferFee, rentByteFee, rentDepositOffset, surchargeReward, tombstoneDeposit]): DeriveContractFees => ({
callBaseFee,
contractFee,
creationFee,
rentByteFee,
rentDepositOffset,
surchargeReward,
tombstoneDeposit,
transactionBaseFee,
transactionByteFee,
+1
View File
@@ -42,6 +42,7 @@ export interface DeriveContractFees {
creationFee: BN;
rentByteFee: BN;
rentDepositOffset: BN;
surchargeReward: BN;
tombstoneDeposit: BN;
transactionBaseFee: BN;
transactionByteFee: BN;
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.17.2",
"version": "1.18.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -27,20 +27,20 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/api-derive": "1.17.2",
"@polkadot/keyring": "^2.12.2",
"@polkadot/metadata": "1.17.2",
"@polkadot/rpc-core": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/types-known": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"@polkadot/api-derive": "1.18.1",
"@polkadot/keyring": "^2.13.1",
"@polkadot/metadata": "1.18.1",
"@polkadot/rpc-core": "1.18.1",
"@polkadot/rpc-provider": "1.18.1",
"@polkadot/types": "1.18.1",
"@polkadot/types-known": "1.18.1",
"@polkadot/util": "^2.13.1",
"@polkadot/util-crypto": "^2.13.1",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.12.2"
"@polkadot/keyring": "^2.13.1"
}
}
+42 -1
View File
@@ -7,7 +7,7 @@ import { RpcInterface } from '@polkadot/rpc-core/types';
import { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { AnyFunction, CallFunction, Codec, CodecArg as Arg, ITuple, InterfaceTypes, ModulesWithCalls, Registry, RegistryTypes } from '@polkadot/types/types';
import { SubmittableExtrinsic } from '../submittable/types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecorateMethod, DecoratedRpc, DecoratedRpcSection, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecorateMethod, DecoratedRpc, DecoratedRpcSection, PaginationOptions, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import BN from 'bn.js';
import { BehaviorSubject, Observable, combineLatest, of } from 'rxjs';
@@ -371,10 +371,20 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
memo((doubleMapArg?: Arg): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, doubleMapArg)));
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
decorated.entriesPaged = decorateMethod(
memo((opts: PaginationOptions): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntriesPaged(creator, opts)));
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
decorated.keys = decorateMethod(
memo((doubleMapArg?: Arg): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, doubleMapArg)));
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
decorated.keysPaged = decorateMethod(
memo((opts: PaginationOptions): Observable<StorageKey[]> =>
this._retrieveMapKeysPaged(creator, opts)));
}
// only support multi where subs are available
@@ -505,6 +515,19 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
);
}
private _retrieveMapKeysPaged ({ iterKey, meta }: StorageEntry, opts: PaginationOptions): Observable<StorageKey[]> {
assert(iterKey && (meta.type.isMap || meta.type.isDoubleMap), 'keys can only be retrieved on maps, linked maps and double maps');
const headKey = iterKey(opts.arg).toHex();
const getKeysPaged = this._rpcCore.state.getKeysPaged;
assert(getKeysPaged, 'Pagination not supported by the chain');
return getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey).pipe(
map((keys) => keys.map((key) => key.setMeta(meta)))
);
}
private _retrieveMapEntries (entry: StorageEntry, arg?: Arg): Observable<[StorageKey, Codec][]> {
return this._retrieveMapKeys(entry, arg).pipe(
switchMap((keys) =>
@@ -529,6 +552,24 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
);
}
private _retrieveMapEntriesPaged (entry: StorageEntry, opts: PaginationOptions): Observable<[StorageKey, Codec][]> {
return this._retrieveMapKeysPaged(entry, opts).pipe(
switchMap((keys) =>
combineLatest<[StorageKey[], ...Codec[][]]>([
of(keys),
this._rpcCore.state.queryStorageAt
? this._rpcCore.state.queryStorageAt<Codec[]>(keys)
: this._rpcCore.state.subscribeStorage<Codec[]>(keys).pipe(take(1))
])
),
map(([keys, ...valsArr]): [StorageKey, Codec][] =>
valsArr
.reduce((result: Codec[], vals) => result.concat(vals), [])
.map((value, index) => [keys[index], value])
)
);
}
protected _decorateDeriveRx (decorateMethod: DecorateMethod<ApiType>): DeriveAllSections<'rxjs', ExactDerive> {
// Pull in derive from api-derive
const derive = decorateDerive(this._rx, this._options.derives);
+7 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { Observable } from 'rxjs';
import { AnyFunction, Callback, Codec } from '@polkadot/types/types';
import { AnyFunction, Callback, Codec, CodecArg } from '@polkadot/types/types';
// Prepend an element V onto the beginning of a tuple T.
// Cons<1, [2,3,4]> is [1,2,3,4]
@@ -68,4 +68,10 @@ export interface DecorateMethodOptions {
methodName?: string;
}
export interface PaginationOptions {
arg?: CodecArg;
pageSize: number;
startKey?: string;
}
export type DecorateMethod<ApiType extends ApiTypes> = <Method extends (...args: any[]) => Observable<any>>(method: Method, options?: DecorateMethodOptions) => any;
+3 -1
View File
@@ -8,7 +8,7 @@ import { Hash } from '@polkadot/types/interfaces';
import { AnyFunction, Callback, Codec, CodecArg } from '@polkadot/types/types';
import StorageKey, { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { ApiTypes, MethodResult, ObsInnerType, PromiseOrObs, UnsubscribePromise } from './base';
import { ApiTypes, MethodResult, ObsInnerType, PaginationOptions, PromiseOrObs, UnsubscribePromise } from './base';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedQueries<ApiType extends ApiTypes> { }
@@ -29,10 +29,12 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
at: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
creator: StorageEntry;
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(arg?: any) => PromiseOrObs<ApiType, [StorageKey, T][]>;
entriesPaged: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(opts: PaginationOptions) => PromiseOrObs<ApiType, [StorageKey, T][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
key: (...args: Parameters<F>) => string;
keyPrefix: () => string;
keys: (arg?: any) => PromiseOrObs<ApiType, StorageKey[]>;
keysPaged: (opts: PaginationOptions) => PromiseOrObs<ApiType, StorageKey[]>;
range: <T extends Codec | any = ObsInnerType<ReturnType<F>>>([from, to]: [Hash | Uint8Array | string, Hash | Uint8Array | string | undefined] | [Hash | Uint8Array | string], ...args: Parameters<F>) => PromiseOrObs<ApiType, [Hash, T][]>;
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
multi: ApiType extends 'rxjs' ? StorageEntryObservableMulti : StorageEntryPromiseMulti;
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.17.2",
"version": "1.18.1",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -27,13 +27,13 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/types": "1.17.2",
"@polkadot/types-known": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"@polkadot/types": "1.18.1",
"@polkadot/types-known": "1.18.1",
"@polkadot/util": "^2.13.1",
"@polkadot/util-crypto": "^2.13.1",
"bn.js": "^5.1.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.12.2"
"@polkadot/keyring": "^2.13.1"
}
}
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.17.2",
"version": "1.18.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,14 +27,14 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/metadata": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/metadata": "1.18.1",
"@polkadot/rpc-provider": "1.18.1",
"@polkadot/types": "1.18.1",
"@polkadot/util": "^2.13.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.12.2"
"@polkadot/keyring": "^2.13.1"
}
}
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.17.2",
"version": "1.18.1",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -27,17 +27,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/metadata": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"@polkadot/metadata": "1.18.1",
"@polkadot/types": "1.18.1",
"@polkadot/util": "^2.13.1",
"@polkadot/util-crypto": "^2.13.1",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
"devDependencies": {
"@polkadot/keyring": "^2.12.2",
"@polkadot/keyring": "^2.13.1",
"mock-socket": "^9.0.3",
"nock": "^12.0.3"
}
@@ -48,6 +48,18 @@ describe('decodeResponse', (): void => {
).toThrow(/123: test error: Some random error description/);
});
it('allows for number subscription ids', (): void => {
expect(
coder.decodeResponse({ id: 1, jsonrpc: '2.0', method: 'test', params: { result: 'test result', subscription: 1 } } as JsonRpcResponse)
).toEqual('test result');
});
it('allows for string subscription ids', (): void => {
expect(
coder.decodeResponse({ id: 1, jsonrpc: '2.0', method: 'test', params: { result: 'test result', subscription: 'abc' } } as JsonRpcResponse)
).toEqual('test result');
});
it('returns the result', (): void => {
expect(
coder.decodeResponse({ id: 1, jsonrpc: '2.0', result: 'some result' } as JsonRpcResponse)
+1 -1
View File
@@ -30,7 +30,7 @@ export default class RpcCoder {
const isSubscription = !isUndefined(response.params) && !isUndefined(response.method);
assert(isNumber(response.id) || (isSubscription && isNumber(response.params.subscription)), 'Invalid id field in decoded object');
assert(isNumber(response.id) || (isSubscription && (isNumber(response.params.subscription) || isString(response.params.subscription))), 'Invalid id field in decoded object');
this._checkError(response.error);
+1 -1
View File
@@ -28,7 +28,7 @@ interface JsonRpcResponseSubscription {
params: {
error?: JsonRpcResponseBaseError;
result: unknown;
subscription: number;
subscription: number | string;
};
}
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.17.2",
"version": "1.18.1",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
@@ -36,11 +36,11 @@
"@babel/core": "^7.10.2",
"@babel/register": "^7.10.1",
"@babel/runtime": "^7.10.2",
"@polkadot/api": "1.17.2",
"@polkadot/metadata": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/api": "1.18.1",
"@polkadot/metadata": "1.18.1",
"@polkadot/rpc-provider": "1.18.1",
"@polkadot/types": "1.18.1",
"@polkadot/util": "^2.13.1",
"handlebars": "^4.7.6",
"websocket": "^1.0.31",
"yargs": "^15.3.1"
+2
View File
@@ -61,6 +61,7 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
case TypeDefInfo.Plain:
case TypeDefInfo.Tuple:
case TypeDefInfo.Vec:
case TypeDefInfo.Option:
return `${isGetter}${asGetter}`;
default:
@@ -89,6 +90,7 @@ function tsResultGetter (definitions: Record<string, ModuleTypes>, resultName =
case TypeDefInfo.Plain:
case TypeDefInfo.Tuple:
case TypeDefInfo.Vec:
case TypeDefInfo.Option:
return `${isGetter}${asGetter}`;
default:
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.17.2",
"version": "1.18.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/types": "1.18.1",
"@polkadot/util": "^2.13.1",
"bn.js": "^5.1.2"
},
"devDependencies": {
+12 -1
View File
@@ -7,12 +7,23 @@ import { OverrideVersionedType } from '@polkadot/types/types';
// these are override types for Polkadot
const versioned: OverrideVersionedType[] = [
{
minmax: [0, undefined],
minmax: [0, 3],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
}
},
{
minmax: [4, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'SudoBalances']
}
}
}
];
+12 -1
View File
@@ -16,12 +16,23 @@ const versioned: OverrideVersionedType[] = [
}
},
{
minmax: [3, undefined],
minmax: [3, 19],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
}
},
{
minmax: [20, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances']
}
}
}
];
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.17.2",
"version": "1.18.1",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -27,16 +27,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/metadata": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"@polkadot/metadata": "1.18.1",
"@polkadot/util": "^2.13.1",
"@polkadot/util-crypto": "^2.13.1",
"@types/bn.js": "^4.11.6",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.12.2",
"@polkadot/keyring": "^2.13.1",
"@types/memoizee": "^0.4.4"
}
}
+8 -2
View File
@@ -31,11 +31,11 @@ import { AttestedCandidate, AuctionIndex, Bidder, CandidateReceipt, CollatorId,
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, ExtrinsicsWeight, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Pays, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, ExtrinsicsWeight, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Pays, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, ProxyType, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, ValidatorCount } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, OffchainAccuracy, PerU16, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, OffchainAccuracy, PerU16, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import { AccountInfo, ChainProperties, ChainType, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system';
@@ -265,6 +265,9 @@ declare module '@polkadot/types/types/registry' {
PhantomData: PhantomData;
'Option<PhantomData>': Option<PhantomData>;
'Vec<PhantomData>': Vec<PhantomData>;
ProxyType: ProxyType;
'Option<ProxyType>': Option<ProxyType>;
'Vec<ProxyType>': Vec<ProxyType>;
RuntimeDbWeight: RuntimeDbWeight;
'Option<RuntimeDbWeight>': Option<RuntimeDbWeight>;
'Vec<RuntimeDbWeight>': Vec<RuntimeDbWeight>;
@@ -888,6 +891,9 @@ declare module '@polkadot/types/types/registry' {
ElectionResult: ElectionResult;
'Option<ElectionResult>': Option<ElectionResult>;
'Vec<ElectionResult>': Vec<ElectionResult>;
ElectionScore: ElectionScore;
'Option<ElectionScore>': Option<ElectionScore>;
'Vec<ElectionScore>': Vec<ElectionScore>;
ElectionSize: ElectionSize;
'Option<ElectionSize>': Option<ElectionSize>;
'Vec<ElectionSize>': Vec<ElectionSize>;
+14
View File
@@ -194,6 +194,13 @@ export default class Call extends Struct implements IMethod {
return this.registry.findMetaCall(this.callIndex).method;
}
/**
* @description Returns the name of the method
*/
public get method (): string {
return this.methodName;
}
/**
* @description Returns the module containing the method
*/
@@ -201,6 +208,13 @@ export default class Call extends Struct implements IMethod {
return this.registry.findMetaCall(this.callIndex).section;
}
/**
* @description Returns the module containing the method
*/
public get section (): string {
return this.sectionName;
}
/**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
@@ -92,6 +92,9 @@ export default {
Perquintill: 'u64',
Phantom: 'Null',
PhantomData: 'Null',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking']
},
RuntimeDbWeight: {
read: 'Weight',
write: 'Weight'
@@ -190,6 +190,14 @@ export interface PhantomData extends Null {}
/** @name PreRuntime */
export interface PreRuntime extends ITuple<[ConsensusEngineId, Bytes]> {}
/** @name ProxyType */
export interface ProxyType extends Enum {
readonly isAny: boolean;
readonly isNonTransfer: boolean;
readonly isGovernance: boolean;
readonly isStaking: boolean;
}
/** @name RuntimeDbWeight */
export interface RuntimeDbWeight extends Struct {
readonly read: Weight;
@@ -51,6 +51,7 @@ export default {
electedStashes: 'Vec<AccountId>',
exposures: 'Vec<(AccountId, Exposure)>'
},
ElectionScore: '[u128; 3]',
ElectionSize: {
validators: 'Compact<ValidatorIndex>',
nominators: 'Compact<NominatorIndex>'
@@ -50,6 +50,9 @@ export interface ElectionResult extends Struct {
readonly exposures: Vec<ITuple<[AccountId, Exposure]>>;
}
/** @name ElectionScore */
export interface ElectionScore extends Vec<u128> {}
/** @name ElectionSize */
export interface ElectionSize extends Struct {
readonly validators: Compact<ValidatorIndex>;
+316 -218
View File
File diff suppressed because it is too large Load Diff