Compare commits

..
28 Commits
Author SHA1 Message Date
Github Actions 8481647d2c [CI Skip] release/stable 1.25.1
skip-checks: true
2020-07-20 07:35:42 +00:00
Jaco Greeff 658dda66a4 1.25 (#2440)
* 1.25

* Bump metadata
2020-07-20 09:25:04 +02:00
Github Actions 87f18efe72 [CI Skip] release/beta 1.25.0-beta.12
skip-checks: true
2020-07-17 12:38:05 +00:00
Jaco Greeff bcdfcce89c Bump dev 2020-07-17 14:26:19 +02:00
Github Actions 9418f1de56 [CI Skip] release/beta 1.25.0-beta.11
skip-checks: true
2020-07-17 12:15:43 +00:00
Jaco Greeff 37c8b8e592 Dev bumpd 2020-07-17 14:03:45 +02:00
Github Actions 4f8db79a40 [CI Skip] release/beta 1.25.0-beta.10
skip-checks: true
2020-07-17 10:28:46 +00:00
Jaco Greeff 54cf086a89 Update ContractExecResult (#2437) 2020-07-17 12:17:35 +02:00
Github Actions 37ddcaa32d [CI Skip] release/beta 1.25.0-beta.9
skip-checks: true
2020-07-17 09:38:57 +00:00
Jaco Greeff 6a2baf8352 Types for Polkadot purchase (#2436) 2020-07-17 11:27:21 +02:00
Github Actions ecca91dffd [CI Skip] release/beta 1.25.0-beta.8
skip-checks: true
2020-07-17 06:59:19 +00:00
Jaco Greeff 42576d74ac Bump deps (#2435) 2020-07-17 08:47:57 +02:00
Github Actions 26a6f20dbf [CI Skip] release/beta 1.25.0-beta.7
skip-checks: true
2020-07-17 06:33:03 +00:00
Chevdor c3ee8393b2 Add 'Registrar #1' as user (#2433) 2020-07-17 08:20:08 +02:00
Github Actions b6f0b9f262 [CI Skip] release/beta 1.25.0-beta.6
skip-checks: true
2020-07-15 17:25:30 +00:00
Jaco Greeff 991dc48020 Raw/Bytes toHuman() uses utf8 as available (#2431)
* Raw/Bytes toHuman() uses utf8 as available

* Rewrite yarn.lock

* Bump babel
2020-07-15 18:55:50 +02:00
Github Actions e4a82f9a1d [CI Skip] release/beta 1.25.0-beta.5
skip-checks: true
2020-07-15 08:58:08 +00:00
Jaco Greeff c8b6012553 networkstate reputation i32 (#2430) 2020-07-15 10:48:18 +02:00
Github Actions d0fe862605 [CI Skip] release/beta 1.25.0-beta.4
skip-checks: true
2020-07-14 17:14:55 +00:00
Jaco Greeff 61a0198695 Fallback for setImmediate (#2428) 2020-07-14 19:04:16 +02:00
Github Actions 345a97dc9f [CI Skip] release/beta 1.25.0-beta.3
skip-checks: true
2020-07-14 13:02:42 +00:00
Brad LarsonandBrad Larson f821ab8ecd [NEW] Support for custom headers with providers (#2423)
* [NEW] Support for custom headers with providers

This allows the user to supply arbitrary headers when constructing the
providers.

* [FIX] null -> undefined, use isChildClass

Co-authored-by: Brad Larson <brad@polychain.capital>
2020-07-14 14:49:42 +02:00
Github Actions f9e2bf332d [CI Skip] release/beta 1.25.0-beta.2
skip-checks: true
2020-07-14 08:40:25 +00:00
Jaco Greeff ad69430980 Clazz prototype fix for Linkage (#2426)
* Cleanup progress calcs for Aura

* Clazz prototype
2020-07-14 10:28:38 +02:00
Github Actions d25743016c [CI Skip] release/beta 1.25.0-beta.1
skip-checks: true
2020-07-14 08:15:18 +00:00
Jaco Greeff ee0a46adc4 Cleanup progress calcs for Aura (#2425) 2020-07-14 10:02:44 +02:00
Github Actions f516abfc3f [CI Skip] release/beta 1.25.0-beta.0
skip-checks: true
2020-07-13 18:53:28 +00:00
philipstanislaus 1a96ca5c0e Update types for centrifuge chain v1.2.0 (#2424)
* Update types for centrifuge chain v1.2.0

* Make linter happy
2020-07-13 20:41:15 +02:00
37 changed files with 1076 additions and 610 deletions
+13
View File
@@ -1,5 +1,18 @@
# CHANGELOG
## 1.25.1 Jul 20, 2020
- **Important** Contract RPC result updated on Substrate, on older chains supply `ContractExecResult: 'ContractExecResultTo255'`
- Support for custom HTTP headers in providers (Thanks to https://github.com/brad-larson)
- Update known types for Centrifuge (Thanks to https://github.com/philipstanislaus)
- Update API users with Registrar #1 (Thanks to https://github.com/chevdor)
- Raw/Bytes `toHuman()` displays utf-8 as available
- Add fallback for `setImmediate` when not polyfilled
- Update `NetworkState` reputation type for `system_networkState` RPC
- Update session progress calcs for Aura (cater for negative)
- Fix class prototype for (basically-deprecated) Linkage type
- Add Polkadot types for `purchase` pallet
## 1.24.1 Jul 13, 2020
- Added `isAscii` & `isUtf8` getters to `Bytes` & `Raw` types
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.24.1"
"version": "1.25.1"
}
+7 -7
View File
@@ -24,15 +24,15 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.10.4",
"@babel/register": "^7.10.4",
"@babel/runtime": "^7.10.4",
"@polkadot/dev": "^0.55.21",
"@polkadot/ts": "^0.3.27",
"@babel/core": "^7.10.5",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.10.5",
"@polkadot/dev": "^0.55.27",
"@polkadot/ts": "^0.3.29",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.4",
"@types/jest": "^26.0.5",
"@vuepress/plugin-search": "^1.5.2",
"copyfiles": "^2.3.0"
},
"version": "1.24.1"
"version": "1.25.1"
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.24.1",
"version": "1.25.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -26,10 +26,10 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/api": "1.24.1",
"@polkadot/rpc-core": "1.24.1",
"@polkadot/types": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/api": "1.25.1",
"@polkadot/rpc-core": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"bn.js": "^5.1.2",
"rxjs": "^6.6.0"
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.24.1",
"version": "1.25.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -27,11 +27,11 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/api": "1.24.1",
"@polkadot/rpc-core": "1.24.1",
"@polkadot/rpc-provider": "1.24.1",
"@polkadot/types": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/api": "1.25.1",
"@polkadot/rpc-core": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"bn.js": "^5.1.2",
+5 -8
View File
@@ -30,14 +30,11 @@ function createDerive (api: ApiInterfaceRx, info: DeriveSessionInfo, [currentSlo
function queryAura (api: ApiInterfaceRx): Observable<DeriveSessionProgress> {
return api.derive.session.info().pipe(
map((info): DeriveSessionProgress =>
createDerive(api, info, [
api.registry.createType('u64', 1),
api.registry.createType('u64', 1),
api.registry.createType('u64', 1),
api.registry.createType('SessionIndex', 1)
])
)
map((info): DeriveSessionProgress => ({
...info,
eraProgress: api.registry.createType('BlockNumber'),
sessionProgress: api.registry.createType('BlockNumber')
}))
);
}
+1 -1
View File
@@ -97,7 +97,7 @@ Some of the users of the API (let us know if you are missing from the list), inc
- [Polkawallet.io](https://polkawallet.io) and [Polkawallet (Github)](https://github.com/polkawallet-io/polkawallet-RN/) A mobile wallet for the Polkadot network to manage funds and make transactions, available on both Androind and iOS
- [PolkaStats.io](https://polkastats.io), [PolkaStats frontend GitHub repository](https://github.com/Colm3na/polkastats-v2) and [PolkaStats backend GitHub repository](https://github.com/Colm3na/polkastats-backend-v2) Polkadot network statistics (currently Kusama and Alexander). Shows network information and staking details from validators and intentions.
- [Polkadot API Server (GitHub)](https://github.com/SimplyVC/polkadot_api_server) A lightweight server for querying Polkadot nodes from any language, built primarily as a backend for [PANIC for Polkadot (GitHub)](https://github.com/SimplyVC/panic_polkadot/), a validator monitoring and alerting tool.
- [Identity Registrar #1 from Chevdor on Westend, Kusama and Polkadot](https://www.chevdor.com/tags/registrar/)
## Classes
[Classes](SUMMARY.md)
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.24.1",
"version": "1.25.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -26,14 +26,14 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/api-derive": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/api-derive": "1.25.1",
"@polkadot/keyring": "^2.18.1",
"@polkadot/metadata": "1.24.1",
"@polkadot/rpc-core": "1.24.1",
"@polkadot/rpc-provider": "1.24.1",
"@polkadot/types": "1.24.1",
"@polkadot/types-known": "1.24.1",
"@polkadot/metadata": "1.25.1",
"@polkadot/rpc-core": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/types-known": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"bn.js": "^5.1.2",
+8 -2
View File
@@ -17,7 +17,7 @@ import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity
import { AuthIndex } from '@polkadot/types/interfaces/imOnline';
import { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, ExtrinsicsWeight, Hash, KeyTypeId, Moment, Perbill, ProxyType, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, ExtrinsicsWeight, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, ProxyType, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
import { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
@@ -392,7 +392,7 @@ declare module '@polkadot/api/types/storage' {
};
multisig: {
[index: string]: QueryableStorageEntry<ApiType>;
calls: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Option<ITuple<[Bytes, AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
calls: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Option<ITuple<[OpaqueCall, AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* The set of open multisig operations.
**/
@@ -470,6 +470,12 @@ declare module '@polkadot/api/types/storage' {
* Lookup from identity to the block number and index of the task.
**/
lookup: AugmentedQuery<ApiType, (arg: Bytes | string | Uint8Array) => Observable<Option<TaskAddress>>> & QueryableStorageEntry<ApiType>;
/**
* Storage version of the pallet.
*
* New networks start with last version.
**/
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>> & QueryableStorageEntry<ApiType>;
};
session: {
[index: string]: QueryableStorageEntry<ApiType>;
+115 -31
View File
@@ -4,6 +4,7 @@
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { Compact, Option, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u16, u32, u64 } from '@polkadot/types/primitive';
import { BabeEquivocationProof } from '@polkadot/types/interfaces/babe';
import { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts';
import { AccountVote, Conviction, PropIndex, Proposal, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
@@ -12,7 +13,7 @@ import { Extrinsic, Signature } from '@polkadot/types/interfaces/extrinsics';
import { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa';
import { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
import { Heartbeat } from '@polkadot/types/interfaces/imOnline';
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, Perbill, Percent, ProxyType, Weight } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, ProxyType, Weight } from '@polkadot/types/interfaces/runtime';
import { Period, Priority } from '@polkadot/types/interfaces/scheduler';
import { Keys } from '@polkadot/types/interfaces/session';
import { SocietyJudgement } from '@polkadot/types/interfaces/society';
@@ -31,6 +32,27 @@ declare module '@polkadot/api/types/submittable' {
**/
setUncles: AugmentedSubmittable<(newUncles: Vec<Header> | (Header | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
};
babe: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Report authority equivocation/misbehavior. This method will verify
* the equivocation proof and validate the given key ownership proof
* against the extracted offender. If both are valid, the offence will
* be reported.
**/
reportEquivocation: AugmentedSubmittable<(equivocationProof: BabeEquivocationProof | { offender?: any; slotNumber?: any; firstHeader?: any; secondHeader?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Report authority equivocation/misbehavior. This method will verify
* the equivocation proof and validate the given key ownership proof
* against the extracted offender. If both are valid, the offence will
* be reported.
* This extrinsic must be called unsigned and it is expected that only
* block authors will call it (validated in `ValidateUnsigned`), as such
* if the block author is defined it will be defined as the equivocation
* reporter.
**/
reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: BabeEquivocationProof | { offender?: any; slotNumber?: any; firstHeader?: any; secondHeader?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
balances: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
@@ -873,19 +895,27 @@ declare module '@polkadot/api/types/submittable' {
* equivocation proof and validate the given key ownership proof
* against the extracted offender. If both are valid, the offence
* will be reported.
*
* Since the weight of the extrinsic is 0, in order to avoid DoS by
* submission of invalid equivocation reports, a mandatory pre-validation of
* the extrinsic is implemented in a `SignedExtension`.
**/
reportEquivocation: AugmentedSubmittable<(equivocationProof: GrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Report voter equivocation/misbehavior. This method will verify the
* equivocation proof and validate the given key ownership proof
* against the extracted offender. If both are valid, the offence
* will be reported.
*
* This extrinsic must be called unsigned and it is expected that only
* block authors will call it (validated in `ValidateUnsigned`), as such
* if the block author is defined it will be defined as the equivocation
* reporter.
**/
reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: GrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
identity: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Add a registrar to the system.
*
* The dispatch origin for this call must be `RegistrarOrigin` or `Root`.
* The dispatch origin for this call must be `T::RegistrarOrigin`.
*
* - `account`: the account of the registrar.
*
@@ -898,6 +928,16 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
addRegistrar: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Add the given account to the sender's subs.
*
* Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated
* to the sender.
*
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
* sub identity of `sub`.
**/
addSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Cancel a previous request.
*
@@ -946,7 +986,7 @@ declare module '@polkadot/api/types/submittable' {
* `Slash`. Verification request deposits are not returned; they should be cancelled
* manually using `cancel_request`.
*
* The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`.
* The dispatch origin for this call must match `T::ForceOrigin`.
*
* - `target`: the account whose identity the judgement is upon. This must be an account
* with a registered identity.
@@ -983,6 +1023,36 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Remove the sender as a sub-account.
*
* Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated
* to the sender (*not* the original depositor).
*
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
* super-identity.
*
* NOTE: This should not normally be used, but is provided in the case that the non-
* controller of an account is maliciously registered as a sub-account.
**/
quitSub: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
/**
* Remove the given account from the sender's subs.
*
* Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated
* to the sender.
*
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
* sub identity of `sub`.
**/
removeSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Alter the associated name of the given sub-account.
*
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
* sub identity of `sub`.
**/
renameSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Request a judgement from a registrar.
*
@@ -1334,7 +1404,7 @@ declare module '@polkadot/api/types/submittable' {
* - Plus Call Weight
* # </weight>
**/
asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], maybeTimepoint: Option<Timepoint> | null | object | string | Uint8Array, call: Bytes | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], maybeTimepoint: Option<Timepoint> | null | object | string | Uint8Array, call: OpaqueCall | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Immediately dispatch a multi-signature call using a single approval from the caller.
*
@@ -1748,6 +1818,14 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
schedule: AugmentedSubmittable<(when: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Anonymously schedule a task after a delay.
*
* # <weight>
* Same as [`schedule`].
* # </weight>
**/
scheduleAfter: AugmentedSubmittable<(after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Schedule a named task.
*
@@ -1761,6 +1839,14 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Schedule a named task after a delay.
*
* # <weight>
* Same as [`schedule_named`].
* # </weight>
**/
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
session: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -2172,7 +2258,7 @@ declare module '@polkadot/api/types/submittable' {
/**
* Cancel enactment of a deferred slash.
*
* Can be called by either the root origin or the `T::SlashCancelOrigin`.
* Can be called by the `T::SlashCancelOrigin`.
*
* Parameters: era and indices of the slashes for that era to kill.
*
@@ -2306,7 +2392,9 @@ declare module '@polkadot/api/types/submittable' {
* - Contains a limited number of reads and writes.
* -----------
* N is the Number of payouts for the validator (including the validator)
* Base Weight: 110 + 54.2 * N µs (Median Slopes)
* Base Weight:
* - Reward Destination Staked: 110 + 54.2 * N µs (Median Slopes)
* - Reward Destination Controller (Creating): 120 + 41.95 * N µs (Median Slopes)
* DB Weight:
* - Read: EraElectionStatus, CurrentEra, HistoryDepth, ErasValidatorReward,
* ErasStakersClipped, ErasRewardPoints, ErasValidatorPrefs (8 items)
@@ -2908,7 +2996,7 @@ declare module '@polkadot/api/types/submittable' {
/**
* Add a member `who` to the set.
*
* May only be called from `AddOrigin` or root.
* May only be called from `T::AddOrigin`.
**/
addMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
@@ -2921,29 +3009,33 @@ declare module '@polkadot/api/types/submittable' {
changeKey: AugmentedSubmittable<(updated: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Remove the prime member if it exists.
*
* May only be called from `T::PrimeOrigin`.
**/
clearPrime: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
/**
* Remove a member `who` from the set.
*
* May only be called from `RemoveOrigin` or root.
* May only be called from `T::RemoveOrigin`.
**/
removeMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Change the membership to a new set, disregarding the existing membership. Be nice and
* pass `members` pre-sorted.
*
* May only be called from `ResetOrigin` or root.
* May only be called from `T::ResetOrigin`.
**/
resetMembers: AugmentedSubmittable<(members: Vec<AccountId> | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
/**
* Set the prime member. Must be a current member.
*
* May only be called from `T::PrimeOrigin`.
**/
setPrime: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Swap out one member `remove` for another `add`.
*
* May only be called from `SwapOrigin` or root.
* May only be called from `T::SwapOrigin`.
*
* Prime membership is *not* passed from `remove` to `add`, if extant.
**/
@@ -2979,6 +3071,8 @@ declare module '@polkadot/api/types/submittable' {
* Approve a proposal. At a later time, the proposal will be allocated to the beneficiary
* and the original deposit will be returned.
*
* May only be called from `T::ApproveOrigin`.
*
* # <weight>
* - Complexity: O(1).
* - DbReads: `Proposals`, `Approvals`
@@ -3021,6 +3115,8 @@ declare module '@polkadot/api/types/submittable' {
/**
* Reject a proposed spend. The original deposit will be slashed.
*
* May only be called from `T::RejectOrigin`.
*
* # <weight>
* - Complexity: O(1)
* - DbReads: `Proposals`, `rejected proposer account`
@@ -3136,7 +3232,10 @@ declare module '@polkadot/api/types/submittable' {
*
* NOTE: If you need to ensure that any account-based filtering is not honored (i.e.
* because you expect `proxy` to have been used prior in the call stack and you do not want
* the call restrictions to apply to any sub-accounts), then use `as_sub` instead.
* the call restrictions to apply to any sub-accounts), then use `as_multi_threshold_1`
* in the Multisig pallet instead.
*
* NOTE: Prior to version *12, this was called `as_limited_sub`.
*
* The dispatch origin for this call must be _Signed_.
*
@@ -3145,22 +3244,7 @@ declare module '@polkadot/api/types/submittable' {
* - Plus the weight of the `call`
* # </weight>
**/
asLimitedSub: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Send a call through an indexed pseudonym of the sender.
*
* NOTE: If you need to ensure that any account-based filtering is honored (i.e. because
* you expect `proxy` to have been used prior in the call stack and you want it to apply to
* any sub-accounts), then use `as_limited_sub` instead.
*
* The dispatch origin for this call must be _Signed_.
*
* # <weight>
* - Base weight: 2.861 µs
* - Plus the weight of the `call`
* # </weight>
**/
asSub: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
asDerivative: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Send a batch of dispatch calls.
*
+6 -2
View File
@@ -69,7 +69,9 @@ function decorateCall<Method extends DecorateFn<ObsInnerType<ReturnType<Method>>
catchError((error) => tracker.reject(error))
).subscribe((result): void => {
tracker.resolve(result);
setImmediate(() => subscription.unsubscribe());
typeof setImmediate === 'undefined'
? setTimeout(() => subscription.unsubscribe(), 0)
: setImmediate(() => subscription.unsubscribe());
});
});
}
@@ -87,7 +89,9 @@ function decorateSubscribe<Method extends DecorateFn<ObsInnerType<ReturnType<Met
).subscribe((result): void => {
// We use setImmediate here to ensure that the Promise above (tracker) has resolved, before returning
// the first result. By putting is back in the queue, the promise above is guarded for first execution
setImmediate(() => resultCb(result) as void);
typeof setImmediate === 'undefined'
? setTimeout(() => resultCb(result) as void, 0)
: setImmediate(() => resultCb(result) as void);
});
});
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.24.1",
"version": "1.25.1",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -26,9 +26,9 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/types": "1.24.1",
"@polkadot/types-known": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/types": "1.25.1",
"@polkadot/types-known": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"bn.js": "^5.1.2"
@@ -565,34 +565,7 @@
]
},
{
"name": "as_sub",
"args": [
{
"name": "index",
"type": "u16"
},
{
"name": "call",
"type": "Call"
}
],
"documentation": [
" Send a call through an indexed pseudonym of the sender.",
"",
" NOTE: If you need to ensure that any account-based filtering is honored (i.e. because",
" you expect `proxy` to have been used prior in the call stack and you want it to apply to",
" any sub-accounts), then use `as_limited_sub` instead.",
"",
" The dispatch origin for this call must be _Signed_.",
"",
" # <weight>",
" - Base weight: 2.861 µs",
" - Plus the weight of the `call`",
" # </weight>"
]
},
{
"name": "as_limited_sub",
"name": "as_derivative",
"args": [
{
"name": "index",
@@ -611,7 +584,10 @@
"",
" NOTE: If you need to ensure that any account-based filtering is not honored (i.e.",
" because you expect `proxy` to have been used prior in the call stack and you do not want",
" the call restrictions to apply to any sub-accounts), then use `as_sub` instead.",
" the call restrictions to apply to any sub-accounts), then use `as_multi_threshold_1`",
" in the Multisig pallet instead.",
"",
" NOTE: Prior to version *12, this was called `as_limited_sub`.",
"",
" The dispatch origin for this call must be _Signed_.",
"",
@@ -801,7 +777,50 @@
}
]
},
"calls": [],
"calls": [
{
"name": "report_equivocation",
"args": [
{
"name": "equivocation_proof",
"type": "BabeEquivocationProof"
},
{
"name": "key_owner_proof",
"type": "KeyOwnerProof"
}
],
"documentation": [
" Report authority equivocation/misbehavior. This method will verify",
" the equivocation proof and validate the given key ownership proof",
" against the extracted offender. If both are valid, the offence will",
" be reported."
]
},
{
"name": "report_equivocation_unsigned",
"args": [
{
"name": "equivocation_proof",
"type": "BabeEquivocationProof"
},
{
"name": "key_owner_proof",
"type": "KeyOwnerProof"
}
],
"documentation": [
" Report authority equivocation/misbehavior. This method will verify",
" the equivocation proof and validate the given key ownership proof",
" against the extracted offender. If both are valid, the offence will",
" be reported.",
" This extrinsic must be called unsigned and it is expected that only",
" block authors will call it (validated in `ValidateUnsigned`), as such",
" if the block author is defined it will be defined as the equivocation",
" reporter."
]
}
],
"events": null,
"constants": [
{
@@ -2617,7 +2636,7 @@
"documentation": [
" Cancel enactment of a deferred slash.",
"",
" Can be called by either the root origin or the `T::SlashCancelOrigin`.",
" Can be called by the `T::SlashCancelOrigin`.",
"",
" Parameters: era and indices of the slashes for that era to kill.",
"",
@@ -2660,7 +2679,9 @@
" - Contains a limited number of reads and writes.",
" -----------",
" N is the Number of payouts for the validator (including the validator)",
" Base Weight: 110 + 54.2 * N µs (Median Slopes)",
" Base Weight:",
" - Reward Destination Staked: 110 + 54.2 * N µs (Median Slopes)",
" - Reward Destination Controller (Creating): 120 + 41.95 * N µs (Median Slopes)",
" DB Weight:",
" - Read: EraElectionStatus, CurrentEra, HistoryDepth, ErasValidatorReward,",
" ErasStakersClipped, ErasRewardPoints, ErasValidatorPrefs (8 items)",
@@ -2991,9 +3012,9 @@
"type": "EraIndex",
"value": "0xa8000000",
"documentation": [
" Number of eras that slashes are deferred by, after computation. ",
" Number of eras that slashes are deferred by, after computation.",
"",
" This should be less than the bonding duration. ",
" This should be less than the bonding duration.",
" Set to 0 if slashes should be applied immediately, without opportunity for",
" intervention."
]
@@ -3017,7 +3038,7 @@
"type": "u32",
"value": "0x0a000000",
"documentation": [
" Maximum number of balancing iterations to run in the offchain submission. ",
" Maximum number of balancing iterations to run in the offchain submission.",
"",
" If set to 0, balance_solution will not be executed at all."
]
@@ -6114,7 +6135,7 @@
"documentation": [
" Add a member `who` to the set.",
"",
" May only be called from `AddOrigin` or root."
" May only be called from `T::AddOrigin`."
]
},
{
@@ -6128,7 +6149,7 @@
"documentation": [
" Remove a member `who` from the set.",
"",
" May only be called from `RemoveOrigin` or root."
" May only be called from `T::RemoveOrigin`."
]
},
{
@@ -6146,7 +6167,7 @@
"documentation": [
" Swap out one member `remove` for another `add`.",
"",
" May only be called from `SwapOrigin` or root.",
" May only be called from `T::SwapOrigin`.",
"",
" Prime membership is *not* passed from `remove` to `add`, if extant."
]
@@ -6163,7 +6184,7 @@
" Change the membership to a new set, disregarding the existing membership. Be nice and",
" pass `members` pre-sorted.",
"",
" May only be called from `ResetOrigin` or root."
" May only be called from `T::ResetOrigin`."
]
},
{
@@ -6191,14 +6212,18 @@
}
],
"documentation": [
" Set the prime member. Must be a current member."
" Set the prime member. Must be a current member.",
"",
" May only be called from `T::PrimeOrigin`."
]
},
{
"name": "clear_prime",
"args": [],
"documentation": [
" Remove the prime member if it exists."
" Remove the prime member if it exists.",
"",
" May only be called from `T::PrimeOrigin`."
]
}
],
@@ -6398,15 +6423,35 @@
"type": "KeyOwnerProof"
}
],
"documentation": [
" Report voter equivocation/misbehavior. This method will verify the",
" equivocation proof and validate the given key ownership proof",
" against the extracted offender. If both are valid, the offence",
" will be reported."
]
},
{
"name": "report_equivocation_unsigned",
"args": [
{
"name": "equivocation_proof",
"type": "GrandpaEquivocationProof"
},
{
"name": "key_owner_proof",
"type": "KeyOwnerProof"
}
],
"documentation": [
" Report voter equivocation/misbehavior. This method will verify the",
" equivocation proof and validate the given key ownership proof",
" against the extracted offender. If both are valid, the offence",
" will be reported.",
"",
" Since the weight of the extrinsic is 0, in order to avoid DoS by",
" submission of invalid equivocation reports, a mandatory pre-validation of",
" the extrinsic is implemented in a `SignedExtension`."
" This extrinsic must be called unsigned and it is expected that only",
" block authors will call it (validated in `ValidateUnsigned`), as such",
" if the block author is defined it will be defined as the equivocation",
" reporter."
]
}
],
@@ -6469,6 +6514,12 @@
" A key ownership proof provided as part of an equivocation report is invalid."
]
},
{
"name": "InvalidEquivocationProof",
"documentation": [
" An equivocation proof provided as part of an equivocation report is invalid."
]
},
{
"name": "DuplicateOffenceReport",
"documentation": [
@@ -6593,6 +6644,8 @@
"documentation": [
" Reject a proposed spend. The original deposit will be slashed.",
"",
" May only be called from `T::RejectOrigin`.",
"",
" # <weight>",
" - Complexity: O(1)",
" - DbReads: `Proposals`, `rejected proposer account`",
@@ -6612,6 +6665,8 @@
" Approve a proposal. At a later time, the proposal will be allocated to the beneficiary",
" and the original deposit will be returned.",
"",
" May only be called from `T::ApproveOrigin`.",
"",
" # <weight>",
" - Complexity: O(1).",
" - DbReads: `Proposals`, `Approvals`",
@@ -7217,17 +7272,6 @@
}
],
"events": [
{
"name": "Transfer",
"args": [
"AccountId",
"AccountId",
"Balance"
],
"documentation": [
" Transfer happened `from` to `to` with given `value` as part of a `call` or `instantiate`."
]
},
{
"name": "Instantiated",
"args": [
@@ -7259,19 +7303,17 @@
"AccountId",
"AccountId",
"Hash",
"Balance",
"bool"
"Balance"
],
"documentation": [
" Restoration for a contract has been initiated.",
" Restoration for a contract has been successful.",
"",
" # Params",
"",
" - `donor`: `AccountId`: Account ID of the restoring contract",
" - `dest`: `AccountId`: Account ID of the restored contract",
" - `code_hash`: `Hash`: Code hash of the restored contract",
" - `rent_allowance: `Balance`: Rent allowance of the restored contract",
" - `success`: `bool`: True if the restoration was successful"
" - `rent_allowance: `Balance`: Rent allowance of the restored contract"
]
},
{
@@ -7292,17 +7334,6 @@
" Triggered when the current schedule is updated."
]
},
{
"name": "Dispatched",
"args": [
"AccountId",
"bool"
],
"documentation": [
" A call was dispatched from the given account. The bool signals whether it was",
" successful execution or not."
]
},
{
"name": "ContractExecution",
"args": [
@@ -7329,7 +7360,7 @@
{
"name": "TombstoneDeposit",
"type": "BalanceOf",
"value": "0x00407a10f35a00000000000000000000",
"value": "0x00a0acb9030000000000000000000000",
"documentation": [
" The minimum amount required to generate a tombstone."
]
@@ -7350,7 +7381,7 @@
{
"name": "RentByteFee",
"type": "BalanceOf",
"value": "0x00407a10f35a00000000000000000000",
"value": "0x00286bee000000000000000000000000",
"documentation": [
" Price of a byte of storage per one block interval. Should be greater than 0."
]
@@ -7358,7 +7389,7 @@
{
"name": "RentDepositOffset",
"type": "BalanceOf",
"value": "0x00008a5d784563010000000000000000",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The amount of funds a contract should deposit in order to offset",
" the cost of one byte.",
@@ -7372,7 +7403,7 @@
{
"name": "SurchargeReward",
"type": "BalanceOf",
"value": "0x0080a1a76b4a35000000000000000000",
"value": "0x005cb2ec220000000000000000000000",
"documentation": [
" Reward that is received by the party whose touch has led",
" to removal of a contract."
@@ -7432,6 +7463,27 @@
"documentation": [
" An origin TrieId written in the current block."
]
},
{
"name": "OutOfGas",
"documentation": [
" The executed contract exhausted its gas limit."
]
},
{
"name": "OutputBufferTooSmall",
"documentation": [
" The output buffer supplied to a contract API call was too small."
]
},
{
"name": "InsufficientBalance",
"documentation": [
" Performing the requested transfer would have brought the contract below",
" the subsistence threshold. No transfer is allowed to do this in order to allow",
" for a tombstone to be created. Use `ext_terminate` to remove a contract without",
" leaving a tombstone behind."
]
}
]
},
@@ -7947,7 +7999,7 @@
"documentation": [
" Add a registrar to the system.",
"",
" The dispatch origin for this call must be `RegistrarOrigin` or `Root`.",
" The dispatch origin for this call must be `T::RegistrarOrigin`.",
"",
" - `account`: the account of the registrar.",
"",
@@ -8249,7 +8301,7 @@
" `Slash`. Verification request deposits are not returned; they should be cancelled",
" manually using `cancel_request`.",
"",
" The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`.",
" The dispatch origin for this call must match `T::ForceOrigin`.",
"",
" - `target`: the account whose identity the judgement is upon. This must be an account",
" with a registered identity.",
@@ -8263,6 +8315,81 @@
" - One event.",
" # </weight>"
]
},
{
"name": "add_sub",
"args": [
{
"name": "sub",
"type": "LookupSource"
},
{
"name": "data",
"type": "Data"
}
],
"documentation": [
" Add the given account to the sender's subs.",
"",
" Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated",
" to the sender.",
"",
" The dispatch origin for this call must be _Signed_ and the sender must have a registered",
" sub identity of `sub`."
]
},
{
"name": "rename_sub",
"args": [
{
"name": "sub",
"type": "LookupSource"
},
{
"name": "data",
"type": "Data"
}
],
"documentation": [
" Alter the associated name of the given sub-account.",
"",
" The dispatch origin for this call must be _Signed_ and the sender must have a registered",
" sub identity of `sub`."
]
},
{
"name": "remove_sub",
"args": [
{
"name": "sub",
"type": "LookupSource"
}
],
"documentation": [
" Remove the given account from the sender's subs.",
"",
" Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated",
" to the sender.",
"",
" The dispatch origin for this call must be _Signed_ and the sender must have a registered",
" sub identity of `sub`."
]
},
{
"name": "quit_sub",
"args": [],
"documentation": [
" Remove the sender as a sub-account.",
"",
" Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated",
" to the sender (*not* the original depositor).",
"",
" The dispatch origin for this call must be _Signed_ and the sender must have a registered",
" super-identity.",
"",
" NOTE: This should not normally be used, but is provided in the case that the non-",
" controller of an account is maliciously registered as a sub-account."
]
}
],
"events": [
@@ -8333,6 +8460,40 @@
"documentation": [
" A registrar was added."
]
},
{
"name": "SubIdentityAdded",
"args": [
"AccountId",
"AccountId",
"Balance"
],
"documentation": [
" A sub-identity (first) was added to an identity (second) and the deposit paid."
]
},
{
"name": "SubIdentityRemoved",
"args": [
"AccountId",
"AccountId",
"Balance"
],
"documentation": [
" A sub-identity (first) was removed from an identity (second) and the deposit freed."
]
},
{
"name": "SubIdentityRevoked",
"args": [
"AccountId",
"AccountId",
"Balance"
],
"documentation": [
" A sub-identity (first arg) was cleared, and the given deposit repatriated from the",
" main identity account (second arg) to the sub-identity account."
]
}
],
"constants": [
@@ -8467,6 +8628,24 @@
"documentation": [
" Maximum amount of registrars reached. Cannot add any more."
]
},
{
"name": "AlreadyClaimed",
"documentation": [
" Account ID is already named."
]
},
{
"name": "NotSub",
"documentation": [
" Sender is not a sub-account."
]
},
{
"name": "NotOwned",
"documentation": [
" Sub-account isn't owned by sender."
]
}
]
},
@@ -9269,6 +9448,15 @@
"documentation": [
" Society is unfounded."
]
},
{
"name": "Deposit",
"args": [
"Balance"
],
"documentation": [
" Some funds were deposited into the society account."
]
}
],
"constants": [
@@ -10223,6 +10411,19 @@
"documentation": [
" Lookup from identity to the block number and index of the task."
]
},
{
"name": "StorageVersion",
"modifier": "Default",
"type": {
"Plain": "Releases"
},
"fallback": "0x00",
"documentation": [
" Storage version of the pallet.",
"",
" New networks start with last version."
]
}
]
},
@@ -10342,6 +10543,66 @@
" - Will use base weight of 100 which should be good for up to 30 scheduled calls",
" # </weight>"
]
},
{
"name": "schedule_after",
"args": [
{
"name": "after",
"type": "BlockNumber"
},
{
"name": "maybe_periodic",
"type": "Option<Period>"
},
{
"name": "priority",
"type": "Priority"
},
{
"name": "call",
"type": "Call"
}
],
"documentation": [
" Anonymously schedule a task after a delay.",
"",
" # <weight>",
" Same as [`schedule`].",
" # </weight>"
]
},
{
"name": "schedule_named_after",
"args": [
{
"name": "id",
"type": "Bytes"
},
{
"name": "after",
"type": "BlockNumber"
},
{
"name": "maybe_periodic",
"type": "Option<Period>"
},
{
"name": "priority",
"type": "Priority"
},
{
"name": "call",
"type": "Call"
}
],
"documentation": [
" Schedule a named task after a delay.",
"",
" # <weight>",
" Same as [`schedule_named`].",
" # </weight>"
]
}
],
"events": [
@@ -10372,7 +10633,26 @@
}
],
"constants": [],
"errors": []
"errors": [
{
"name": "FailedToSchedule",
"documentation": [
" Failed to schedule a call"
]
},
{
"name": "FailedToCancel",
"documentation": [
" Failed to cancel a scheduled call"
]
},
{
"name": "TargetBlockNumberInPast",
"documentation": [
" Given target block number is in the past."
]
}
]
},
{
"name": "Proxy",
@@ -10713,7 +10993,7 @@
"Map": {
"hasher": "Identity",
"key": "[u8;32]",
"value": "(Bytes,AccountId,BalanceOf)",
"value": "(OpaqueCall,AccountId,BalanceOf)",
"linked": false
}
},
@@ -10772,7 +11052,7 @@
},
{
"name": "call",
"type": "Bytes"
"type": "OpaqueCall"
},
{
"name": "store_call",
@@ -11103,11 +11383,10 @@
"CheckSpecVersion",
"CheckTxVersion",
"CheckGenesis",
"CheckEra",
"CheckMortality",
"CheckNonce",
"CheckWeight",
"ChargeTransactionPayment",
"ValidateEquivocationReport"
"ChargeTransactionPayment"
]
}
}
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.24.1",
"version": "1.25.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -26,10 +26,10 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/metadata": "1.24.1",
"@polkadot/rpc-provider": "1.24.1",
"@polkadot/types": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/metadata": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"memoizee": "^0.4.14",
"rxjs": "^6.6.0"
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.24.1",
"version": "1.25.1",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -26,9 +26,9 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/metadata": "1.24.1",
"@polkadot/types": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/metadata": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"bn.js": "^5.1.2",
@@ -24,6 +24,12 @@ describe('Http', (): void => {
).not.toThrow();
});
it('allows custom headers', (): void => {
expect(
(): Http => new Http('https://', { foo: 'bar' })
).not.toThrow();
});
it('always returns isConnected true', (): void => {
expect(http.isConnected()).toEqual(true);
});
+6 -2
View File
@@ -40,14 +40,17 @@ export default class HttpProvider implements ProviderInterface {
readonly #endpoint: string;
readonly #headers: Record<string, string>;
/**
* @param {string} endpoint The endpoint url starting with http://
*/
constructor (endpoint: string = defaults.HTTP_URL) {
constructor (endpoint: string = defaults.HTTP_URL, headers: Record<string, string> = {}) {
assert(/^(https|http):\/\//.test(endpoint), `Endpoint should start with 'http://', received '${endpoint}'`);
this.#coder = new Coder();
this.#endpoint = endpoint;
this.#headers = headers;
}
/**
@@ -102,7 +105,8 @@ export default class HttpProvider implements ProviderInterface {
headers: {
Accept: 'application/json',
'Content-Length': `${body.length}`,
'Content-Type': 'application/json'
'Content-Type': 'application/json',
...this.#headers
},
method: 'POST'
});
+10 -3
View File
@@ -7,7 +7,7 @@
import { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitted, ProviderInterfaceEmitCb } from '../types';
import EventEmitter from 'eventemitter3';
import { assert, isNull, isUndefined, logger } from '@polkadot/util';
import { assert, isNull, isUndefined, isChildClass, logger } from '@polkadot/util';
import Coder from '../coder';
import defaults from '../defaults';
@@ -67,6 +67,8 @@ export default class WsProvider implements WSProviderInterface {
readonly #endpoints: string[];
readonly #headers: Record<string, string>;
readonly #eventemitter: EventEmitter;
readonly #handlers: Record<string, WsStateAwaiting> = {};
@@ -89,7 +91,7 @@ export default class WsProvider implements WSProviderInterface {
* @param {string | string[]} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`, may provide an array of endpoint strings.
* @param {boolean} autoConnect Whether to connect automatically or not.
*/
constructor (endpoint: string | string[] = defaults.WS_URL, autoConnectMs: number | false = 1000) {
constructor (endpoint: string | string[] = defaults.WS_URL, autoConnectMs: number | false = 1000, headers: Record<string, string> = {}) {
const endpoints = Array.isArray(endpoint)
? endpoint
: [endpoint];
@@ -105,6 +107,7 @@ export default class WsProvider implements WSProviderInterface {
this.#coder = new Coder();
this.#endpointIndex = -1;
this.#endpoints = endpoints;
this.#headers = headers;
this.#websocket = null;
if (autoConnectMs > 0) {
@@ -138,7 +141,11 @@ export default class WsProvider implements WSProviderInterface {
const WS = await getWSClass();
this.#websocket = new WS(this.#endpoints[this.#endpointIndex]);
this.#websocket = typeof WebSocket !== 'undefined' && isChildClass(WebSocket, WS)
? new WS(this.#endpoints[this.#endpointIndex])
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
: new WS(this.#endpoints[this.#endpointIndex], undefined, undefined, this.#headers);
this.#websocket.onclose = this.#onSocketClose;
this.#websocket.onerror = this.#onSocketError;
this.#websocket.onmessage = this.#onSocketMessage;
@@ -28,6 +28,12 @@ describe('Ws', (): void => {
createWs([]).isConnected()
).toEqual(false);
});
it('allows you to initialize the provider with custom headers', (): void => {
expect(
(): WsProvider => new WsProvider(TEST_WS_URL, 1000, { foo: 'bar' })
).not.toThrow();
});
});
describe('Endpoint Parsing', (): void => {
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.24.1",
"version": "1.25.1",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
@@ -33,13 +33,13 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": {
"@babel/core": "^7.10.4",
"@babel/register": "^7.10.4",
"@babel/runtime": "^7.10.4",
"@polkadot/api": "1.24.1",
"@polkadot/metadata": "1.24.1",
"@polkadot/rpc-provider": "1.24.1",
"@polkadot/types": "1.24.1",
"@babel/core": "^7.10.5",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.10.5",
"@polkadot/api": "1.25.1",
"@polkadot/metadata": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"handlebars": "^4.7.6",
"websocket": "^1.0.31",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.24.1",
"version": "1.25.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -26,8 +26,8 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/types": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"bn.js": "^5.1.2"
},
@@ -4,17 +4,29 @@
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
Address: 'GenericAddress',
LookupSource: 'GenericAddress',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
};
const versioned: OverrideVersionedType[] = [
{
// most chains started at 1000 (Fulvous at 224)
minmax: [1, undefined],
minmax: [1, 228],
types: {
...sharedTypes,
Address: 'AccountId',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
LookupSource: 'AccountId'
}
},
{
minmax: [229, undefined],
types: {
...sharedTypes
}
}
];
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.24.1",
"version": "1.25.1",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -26,8 +26,8 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/metadata": "1.24.1",
"@babel/runtime": "^7.10.5",
"@polkadot/metadata": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"@types/bn.js": "^4.11.6",
+14 -1
View File
@@ -14,7 +14,7 @@ import { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims';
import { MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractExecResultSuccessTo255, ContractExecResultTo255, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { 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 { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
@@ -30,6 +30,7 @@ import { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, Repo
import { AbridgedCandidateReceipt, AttestedCandidate, AuctionIndex, Bidder, CandidateCommitments, CandidateReceipt, CollatorId, CollatorSignature, DoubleVoteReport, DownwardMessage, GlobalValidationSchedule, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, LocalValidationData, NewBidder, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, Remark, Retriable, Scheduling, SigningContext, SlotRange, Statement, SubId, UpwardMessage, ValidationCode, ValidatorSignature, ValidityAttestation, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { Approvals } from '@polkadot/types/interfaces/poll';
import { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
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, ExtrinsicsWeight, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, OpaqueCall, Origin, Pays, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, ProxyType, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
@@ -423,6 +424,12 @@ declare module '@polkadot/types/types/registry' {
ContractCallRequest: ContractCallRequest;
'Option<ContractCallRequest>': Option<ContractCallRequest>;
'Vec<ContractCallRequest>': Vec<ContractCallRequest>;
ContractExecResultSuccessTo255: ContractExecResultSuccessTo255;
'Option<ContractExecResultSuccessTo255>': Option<ContractExecResultSuccessTo255>;
'Vec<ContractExecResultSuccessTo255>': Vec<ContractExecResultSuccessTo255>;
ContractExecResultTo255: ContractExecResultTo255;
'Option<ContractExecResultTo255>': Option<ContractExecResultTo255>;
'Vec<ContractExecResultTo255>': Vec<ContractExecResultTo255>;
ContractExecResultSuccess: ContractExecResultSuccess;
'Option<ContractExecResultSuccess>': Option<ContractExecResultSuccess>;
'Vec<ContractExecResultSuccess>': Vec<ContractExecResultSuccess>;
@@ -1275,6 +1282,12 @@ declare module '@polkadot/types/types/registry' {
Approvals: Approvals;
'Option<Approvals>': Option<Approvals>;
'Vec<Approvals>': Vec<Approvals>;
AccountStatus: AccountStatus;
'Option<AccountStatus>': Option<AccountStatus>;
'Vec<AccountStatus>': Vec<AccountStatus>;
AccountValidity: AccountValidity;
'Option<AccountValidity>': Option<AccountValidity>;
'Vec<AccountValidity>': Vec<AccountValidity>;
CallMetadataV0: CallMetadataV0;
'Option<CallMetadataV0>': Option<CallMetadataV0>;
'Vec<CallMetadataV0>': Vec<CallMetadataV0>;
+3 -1
View File
@@ -117,7 +117,9 @@ export default class Raw extends Uint8Array implements IU8a {
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
public toHuman (): AnyJson {
return this.toJSON();
return this.isUtf8
? this.toUtf8()
: this.toJSON();
}
/**
+1 -1
View File
@@ -115,7 +115,7 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
const Clazz = Struct.with({ previous: type, next: type } as any);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ClassOf.prototype.toRawType = function (): string {
Clazz.prototype.toRawType = function (): string {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
return `Linkage<${this.next.toRawType(true)}>`;
};
@@ -76,10 +76,21 @@ export default {
gasLimit: 'u64',
inputData: 'Bytes'
},
ContractExecResultSuccess: {
ContractExecResultSuccessTo255: {
status: 'u8',
data: 'Raw'
},
ContractExecResultTo255: {
_enum: {
Success: 'ContractExecResultSuccessTo255',
Error: 'Null'
}
},
ContractExecResultSuccess: {
flags: 'u32',
data: 'Vec<u8>',
gasConsumed: 'u64'
},
ContractExecResult: {
_enum: {
Success: 'ContractExecResultSuccess',
@@ -36,10 +36,24 @@ export interface ContractExecResult extends Enum {
/** @name ContractExecResultSuccess */
export interface ContractExecResultSuccess extends Struct {
readonly flags: u32;
readonly data: Bytes;
readonly gasConsumed: u64;
}
/** @name ContractExecResultSuccessTo255 */
export interface ContractExecResultSuccessTo255 extends Struct {
readonly status: u8;
readonly data: Raw;
}
/** @name ContractExecResultTo255 */
export interface ContractExecResultTo255 extends Enum {
readonly isSuccess: boolean;
readonly asSuccess: ContractExecResultSuccessTo255;
readonly isError: boolean;
}
/** @name ContractInfo */
export interface ContractInfo extends Enum {
readonly isAlive: boolean;
@@ -40,6 +40,7 @@ export { default as attestations } from './attestations/definitions';
export { default as claims } from './claims/definitions';
export { default as parachains } from './parachains/definitions';
export { default as poll } from './poll/definitions';
export { default as purchase } from './purchase/definitions';
// pull in metadata & rpc last, assuming that is uses info from above
export { default as metadata } from './metadata/definitions';
@@ -0,0 +1,24 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
rpc: {},
types: {
AccountStatus: {
validity: 'AccountValidity',
freeBalance: 'Balance',
lockedBalance: 'Balance',
signature: 'Vec<u8>',
vat: 'Permill'
},
AccountValidity: {
_enum: ['Invalid', 'Initiated', 'Pending', 'ValidLow', 'ValidHigh', 'Completed']
}
}
} as Definitions;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types';
@@ -0,0 +1,27 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import { Enum, Struct } from '@polkadot/types/codec';
import { Bytes } from '@polkadot/types/primitive';
import { Balance, Permill } from '@polkadot/types/interfaces/runtime';
/** @name AccountStatus */
export interface AccountStatus extends Struct {
readonly validity: AccountValidity;
readonly freeBalance: Balance;
readonly lockedBalance: Balance;
readonly signature: Bytes;
readonly vat: Permill;
}
/** @name AccountValidity */
export interface AccountValidity extends Enum {
readonly isInvalid: boolean;
readonly isInitiated: boolean;
readonly isPending: boolean;
readonly isValidLow: boolean;
readonly isValidHigh: boolean;
readonly isCompleted: boolean;
}
export type PHANTOM_PURCHASE = 'purchase';
@@ -222,7 +222,7 @@ export default {
},
NetworkStatePeersetInfo: {
connected: 'bool',
reputation: 'u64'
reputation: 'i32'
},
NodeRole: {
_enum: {
@@ -4,7 +4,7 @@
import { ITuple } from '@polkadot/types/types';
import { Compact, Enum, HashMap, Option, Result, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { GenericEvent } from '@polkadot/types/generic';
import { Bytes, Text, bool, u32, u64, u8 } from '@polkadot/types/primitive';
import { Bytes, Text, bool, i32, u32, u64, u8 } from '@polkadot/types/primitive';
import { AccountData } from '@polkadot/types/interfaces/balances';
import { BlockNumber, Digest, Hash, Index, Pays, Weight } from '@polkadot/types/interfaces/runtime';
@@ -191,7 +191,7 @@ export interface NetworkStatePeerset extends Struct {
/** @name NetworkStatePeersetInfo */
export interface NetworkStatePeersetInfo extends Struct {
readonly connected: bool;
readonly reputation: u64;
readonly reputation: i32;
}
/** @name NodeRole */
+1
View File
@@ -34,6 +34,7 @@ export * from './attestations/types';
export * from './claims/types';
export * from './parachains/types';
export * from './poll/types';
export * from './purchase/types';
export * from './metadata/types';
export * from './rpc/types';
export * from './author/types';
+361 -410
View File
File diff suppressed because it is too large Load Diff