Compare commits

...
42 Commits
Author SHA1 Message Date
Github Actions e2654dd2f8 [CI Skip] release/stable 3.0.1
skip-checks: true
2020-12-14 09:21:39 +00:00
Jaco Greeff 5f0ea88a42 3.0 (#2948)
* 3.0

* CHANGELOG typos
2020-12-14 10:13:17 +01:00
Github Actions 69be690be6 [CI Skip] release/beta 2.10.2-18
skip-checks: true
2020-12-13 16:02:40 +00:00
Jaco Greeff 67d4637786 Bump common (#2947) 2020-12-13 16:55:38 +01:00
Github Actions d2557a3cac [CI Skip] release/beta 2.10.2-17
skip-checks: true
2020-12-13 13:22:02 +00:00
Jaco Greeff e2911a33c4 Replace memoizee with memoize from @polkadot/util (#2946) 2020-12-13 14:15:13 +01:00
Github Actions 9b45901760 [CI Skip] release/beta 2.10.2-16
skip-checks: true
2020-12-13 10:22:49 +00:00
Jaco Greeff 450f53d563 Bump common (#2945)
* Bump common

* Expand CHANGELOG
2020-12-13 11:15:47 +01:00
Github Actions 5374c863ad [CI Skip] release/beta 2.10.2-15
skip-checks: true
2020-12-12 13:12:08 +00:00
Jaco Greeff ce29ae6e0e Bump common (#2944) 2020-12-12 14:05:13 +01:00
Github Actions d420c65c2b [CI Skip] release/beta 2.10.2-14
skip-checks: true
2020-12-11 23:14:23 +00:00
Jaco Greeff 427ae64fab Bump dev (#2943) 2020-12-12 00:06:32 +01:00
Github Actions 173c40b0e5 [CI Skip] release/beta 2.10.2-13
skip-checks: true
2020-12-11 17:51:07 +00:00
Jaco Greeff 208fbb24d5 Build esm (& add x-rxjs package) (#2942) 2020-12-11 18:44:23 +01:00
Github Actions 9ee563e3f6 [CI Skip] release/beta 2.10.2-12
skip-checks: true
2020-12-11 09:28:01 +00:00
Jaco Greeff 70acb27218 Bump dev 2020-12-11 10:19:39 +01:00
Github Actions dd29ebbeae [CI Skip] release/beta 2.10.2-11
skip-checks: true
2020-12-10 16:51:46 +00:00
Jaco Greeff b01935122f Build esm alongside (don't use) (#2940) 2020-12-10 17:43:33 +01:00
Github Actions 71d54821e0 [CI Skip] release/beta 2.10.2-10
skip-checks: true
2020-12-10 14:50:44 +00:00
Jaco Greeff 5df3e1605a Bump deps (#2938) 2020-12-10 15:43:29 +01:00
Github Actions 50737b7ef7 [CI Skip] release/beta 2.10.2-9
skip-checks: true
2020-12-09 19:08:39 +00:00
Jaco Greeff ecc86f797c Bump dev (prefer esm in esm mode) (#2937) 2020-12-09 20:01:36 +01:00
Github Actions ff020d14e4 [CI Skip] release/beta 2.10.2-8
skip-checks: true
2020-12-09 17:08:37 +00:00
Jaco Greeff ff36cb97c2 Bump common, allow esm alongside cjs (#2936)
* Bump common, allow esm alongside cjs

* Bumps
2020-12-09 18:00:01 +01:00
Github Actions 01f2fe7c86 [CI Skip] release/beta 2.10.2-7
skip-checks: true
2020-12-09 11:17:31 +00:00
Jaco Greeff 948d8cccc1 Swap to Metadata <-> registry path imports (#2934)
* Swap to Metadata <-> registry path imports

* Call circulars
2020-12-09 12:09:20 +01:00
Github Actions da2e2f89c9 [CI Skip] release/beta 2.10.2-6
skip-checks: true
2020-12-09 10:10:27 +00:00
Alex D 6b4fd110a1 Types bundle derive (#2932)
* added derives typesBundle overrides

* fix lint
2020-12-09 11:01:33 +01:00
Jaco Greeff a48eba101c Adjust Type dependency on Text (#2933) 2020-12-09 11:01:11 +01:00
Github Actions 78b9d29fa0 [CI Skip] release/beta 2.10.2-5
skip-checks: true
2020-12-08 16:52:37 +00:00
Jaco Greeff 92c9ce15d6 Expand SessionKeys[n] definitions (#2929)
* Expand SessionKeys[n] definitions

* Update packages/types/src/interfaces/session/definitions.ts
2020-12-08 17:44:35 +01:00
Github Actions 11c4239614 [CI Skip] release/beta 2.10.2-4
skip-checks: true
2020-12-08 16:33:06 +00:00
Jaco Greeff 0cb7b34ff0 Update with new consumed Weight structures (#2928)
* Update with new consumed Weight structures

* dispatch(Info, Error} optional in result

* Update for maximumBlockWeight
2020-12-08 17:26:13 +01:00
Github Actions a74382c539 [CI Skip] release/beta 2.10.2-3
skip-checks: true
2020-12-08 12:33:19 +00:00
Krzysztof Jelski beccc2ed9b Derive for bounties and descriptions (#2925)
* WIP on bounties derive.

* wip

* Some basic tests for derive bounties

* Simplify bounties derive and mocks

* Get bounties and descriptions

* Allow for empty bounties. Refactor tests.

* Move tests to test directory

* Attempt to remove duplication

* Sort imports

* Reorganize tests

* Change returned type
2020-12-08 13:25:30 +01:00
Jaco Greeff c29f66c7c5 Inject RPC definitions from typesBundle (#2927)
* Inject RPC definitions from typesBundle

* Augment RPC only, don't clobber
2020-12-08 13:23:41 +01:00
Github Actions dba23e3923 [CI Skip] release/beta 2.10.2-2
skip-checks: true
2020-12-08 10:34:37 +00:00
Jaco Greeff f633b3d6c1 Remove --fix on CI (#2926) 2020-12-08 11:27:07 +01:00
Github Actions b1c7409c59 [CI Skip] release/beta 2.10.2-1
skip-checks: true
2020-12-07 16:34:27 +00:00
Jaco Greeff a2423b1004 Add query sizeAt (#2922)
* Add query sizeAt

* @deprecated for .range
2020-12-07 17:27:33 +01:00
Github Actions c0f1bf7f1e [CI Skip] release/beta 2.10.2-0
skip-checks: true
2020-12-07 15:34:13 +00:00
Jaco Greeff 8e6a1c8fb1 Bump dev (sort imports) (#2923)
* Bump dev (sort imports)

* Resort

* Adjust ApiInterfaceRx
2020-12-07 16:26:19 +01:00
262 changed files with 1855 additions and 1167 deletions
+23
View File
@@ -1,5 +1,28 @@
# CHANGELOG
## 3.0.1 Dec 14, 2020
Upgrade priority: Low. Recommended for the next Kusama/Polkadot upgrades due to additional types and those following chains following Substrate master closely.
**Important** While this package contains no external interface changes, it now compiles and ships both cjs and esm modules. This means that modern bundlers will have more information for tree-shaking available. Additionally when using Node with `.mjs` extensions, the esm version imports will be used on recent Node versions. Adding an export map, as here, may have some impacts so a major semver bump is advised. There may be (small) dragons hiding in the dark corners...
Contributed:
- Injection of derives via typesBundle (Thanks to https://github.com/pr0fedt)
- Added derives for bounties (Thanks to https://github.com/krzysztof-jelski)
Changes:
- Build and expose both cjs and esm via exports map
- Inject RPC definitions for typesBundle, allowing per-spec configuration
- Added `query.<section>.<method>.sizeAt(hash, [...params])` for all storage
- Add new Substrate consumed Weight types
- Expand `SessionKeys<n>` definitions (up to 9)
- Cleanup circular `Type` <-> `Text` definitions
- Cleanup circular `Metadata` <-> `TypeRegistry` imports
- Update `@polkadot/util` to 5.0.1
## 2.10.1 Dec 7, 2020
Upgrade priority: Low. Recommended when following Substrate master and/or parachains development, contains the latest types for both.
+4 -2
View File
@@ -13,7 +13,8 @@ module.exports = Object.assign({}, config, {
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
// eslint-disable-next-line sort-keys
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1',
'@polkadot/x-rxjs(.*)$': '<rootDir>/packages/x-rxjs/src/$1'
},
modulePathIgnorePatterns: [
'<rootDir>/packages/api/build',
@@ -24,7 +25,8 @@ module.exports = Object.assign({}, config, {
'<rootDir>/packages/rpc-provider/build',
'<rootDir>/packages/typegen/build',
'<rootDir>/packages/types/build',
'<rootDir>/packages/types-known/build'
'<rootDir>/packages/types-known/build',
'<rootDir>/packages/x-rxjs/build'
],
resolver: '@polkadot/dev/config/jest-resolver.cjs'
});
+10 -8
View File
@@ -3,14 +3,16 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "Apache-2",
"private": true,
"type": "commonjs",
"workspaces": [
"packages/*"
],
"resolutions": {
"typescript": "^4.1.2"
"typescript": "^4.1.3"
},
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts && (cd packages/typegen && copyfiles scripts/* build)",
"build": "yarn build:interfaces && polkadot-dev-build-ts",
"build:extra": "(cd packages/typegen && copyfiles scripts/* build)",
"build:interfaces": "polkadot-types-internal-interfaces",
"build:release": "polkadot-ci-ghact-build",
"docs:metadata": "polkadot-types-internal-metadata",
@@ -23,14 +25,14 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/register": "^7.12.1",
"@babel/core": "^7.12.10",
"@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.60.8",
"@polkadot/ts": "^0.3.57",
"@polkadot/dev": "^0.61.2",
"@polkadot/ts": "^0.3.58",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.16",
"@types/jest": "^26.0.19",
"copyfiles": "^2.4.1"
},
"version": "2.10.1"
"version": "3.0.1"
}
+6 -10
View File
@@ -1,13 +1,9 @@
{
"name": "@polkadot/api-contract",
"version": "2.10.1",
"version": "3.0.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"sideEffects": false,
"keywords": [
"Polkadot",
"ABI"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -17,10 +13,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "2.10.1",
"@polkadot/types": "2.10.1",
"@polkadot/util": "^4.2.1",
"bn.js": "^4.11.9",
"rxjs": "^6.6.3"
"@polkadot/api": "3.0.1",
"@polkadot/types": "3.0.1",
"@polkadot/util": "^5.0.1",
"@polkadot/x-rxjs": "3.0.1",
"bn.js": "^4.11.9"
}
}
+1 -2
View File
@@ -1,9 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Abi } from '.';
import abis from '../test/contracts';
import { Abi } from '.';
interface JSONAbi {
spec: {
+1 -1
View File
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
import type { Bytes } from '@polkadot/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageParamSpec, ContractMessageSpec, ContractProject } from '@polkadot/types/interfaces';
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageSpec, ContractMessageParamSpec, ContractProject } from '@polkadot/types/interfaces';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './types';
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, u8aConcat, u8aToHex } from '@polkadot/util';
@@ -4,9 +4,8 @@
import fs from 'fs';
import path from 'path';
import { Abi } from '.';
import abis from '../test/contracts';
import { Abi } from '.';
describe('MetaRegistry', (): void => {
Object.keys(abis).forEach((abiName) => {
+2 -2
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ContractDisplayName, ChainProperties, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefVariant, SiTypeDefSequence, SiTypeDefTuple, SiVariant } from '@polkadot/types/interfaces';
import type { ChainProperties, ContractDisplayName, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces';
import type { InterfaceTypes, TypeDef } from '@polkadot/types/types';
import { assert, isUndefined } from '@polkadot/util';
import { TypeRegistry, withTypeString } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/types';
import { assert, isUndefined } from '@polkadot/util';
interface PartialTypeSpec {
readonly type: SiLookupTypeId;
+3 -2
View File
@@ -1,18 +1,19 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { BlueprintDeploy, ContractGeneric, MapConstructorExec } from './types';
import BN from 'bn.js';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { Bytes } from '@polkadot/types';
import { isUndefined, stringCamelCase, compactAddLength, u8aToU8a } from '@polkadot/util';
import { compactAddLength, isUndefined, stringCamelCase, u8aToU8a } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
import { Abi } from '../Abi';
+2 -1
View File
@@ -3,12 +3,13 @@
import fs from 'fs';
import path from 'path';
import { decorateMethod } from '@polkadot/api/promise';
import contractFlipper from '../../test/contracts/ink/flipper.contract.json';
import abiFlipper from '../../test/contracts/ink/flipper.json';
import { mockApi } from './mock';
import { Code } from './Code';
import { mockApi } from './mock';
const wasmFlipper = fs.readFileSync(path.join(__dirname, '../../test/contracts/ink/flipper.wasm'));
+1 -1
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { EventRecord, Hash } from '@polkadot/types/interfaces';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
+7 -4
View File
@@ -1,19 +1,20 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { Bytes } from '@polkadot/types';
import type { AccountId, ContractExecResult, EventRecord } from '@polkadot/types/interfaces';
import type { AccountId, ContractExecResult, EventRecord, Weight } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult, Registry } from '@polkadot/types/types';
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
import type { ContractCallResult, ContractCallSend, ContractGeneric, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
import BN from 'bn.js';
import { map } from 'rxjs/operators';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { assert, bnToBn, isFunction, isUndefined, logger, stringCamelCase } from '@polkadot/util';
import { map } from '@polkadot/x-rxjs/operators';
import { Abi } from '../Abi';
import { applyOnEvent, extractOptions, formatData, isOptions } from '../util';
@@ -144,7 +145,9 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
return gasLimit.lten(0)
? isCall
? MAX_CALL_GAS
: this.api.consts.system.maximumBlockWeight.muln(64).divn(100)
: this.api.consts.system.blockWeights
? this.api.consts.system.blockWeights.perClass.normal.maxExtrinsic.sub(this.api.consts.system.blockWeights.perClass.normal.baseExtrinsic)
: (this.api.consts.system.maximumBlockWeight as Weight).muln(64).divn(100)
: gasLimit;
}
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type BN from 'bn.js';
import type { Observable } from 'rxjs';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { CodecArg } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
export interface BlueprintDeploy<ApiType extends ApiTypes> {
@@ -4,7 +4,7 @@
// Simple non-runnable checks to test type definitions in the editor itself
import { ApiPromise } from '@polkadot/api';
import { TestKeyringMap, createTestPairs } from '@polkadot/keyring/testingPairs';
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
import abiIncrementer from '../test/contracts/ink/incrementer.json';
import { BlueprintPromise, ContractPromise } from '.';
+2 -1
View File
@@ -8,8 +8,9 @@ import type { Codec, CodecArg, Registry, TypeDef } from '@polkadot/types/types';
import type { BlueprintOptions, ContractOptions } from './types';
import BN from 'bn.js';
import { createTypeUnsafe } from '@polkadot/types/create';
import { isBn, isBigInt, isNumber, isString } from '@polkadot/util';
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
type ContractEvents = 'CodeStored' | 'ContractExecution' | 'Instantiated';
+10 -16
View File
@@ -1,14 +1,9 @@
{
"name": "@polkadot/api-derive",
"version": "2.10.1",
"version": "3.0.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"sideEffects": false,
"keywords": [
"Polkadot",
"Promise",
"RxJs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -18,17 +13,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "2.10.1",
"@polkadot/rpc-core": "2.10.1",
"@polkadot/types": "2.10.1",
"@polkadot/util": "^4.2.1",
"@polkadot/util-crypto": "^4.2.1",
"bn.js": "^4.11.9",
"memoizee": "^0.4.14",
"rxjs": "^6.6.3"
"@polkadot/api": "3.0.1",
"@polkadot/rpc-core": "3.0.1",
"@polkadot/types": "3.0.1",
"@polkadot/util": "^5.0.1",
"@polkadot/util-crypto": "^5.0.1",
"@polkadot/x-rxjs": "3.0.1",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^4.2.1",
"@polkadot/rpc-provider": "2.10.1"
"@polkadot/keyring": "^5.0.1",
"@polkadot/rpc-provider": "3.0.1"
}
}
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isU8a, assertReturn } from '@polkadot/util';
import { assertReturn, isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountFlags } from '../types';
import { combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIdAndIndex } from '../types';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Data, Option } from '@polkadot/types';
import type { AccountId, IdentityInfoAdditional, Registration } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountRegistration, DeriveHasIdentity } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isHex, u8aToString } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, AccountIndex, BalanceOf } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import { of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, startWith } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
import { of } from 'rxjs';
import { map, startWith, switchMap } from 'rxjs/operators';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, startWith, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountInfo, DeriveAccountRegistration } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { u8aToString } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+5 -5
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AccountId, AccountData, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+4 -3
View File
@@ -1,16 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveBalancesAll } from '../types';
import BN from 'bn.js';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { bnMax, isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Balance } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveFees } from '../types';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount } from '../types';
import { combineLatest, of } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { memo } from '../util';
+3 -3
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+4 -4
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } from '../type';
import { memo } from '../util';
+4 -4
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { memo } from '../util';
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EventRecord, Hash, SignedBlock } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { FullNewBlock } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { memo } from '../util';
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { combineLatest, of } from 'rxjs';
import { catchError, map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+4 -3
View File
@@ -1,13 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveContractFees } from '../types';
import BN from 'bn.js';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+1 -1
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { proposal as collectiveProposal, proposals as collectiveProposals } from '../collective';
+4 -4
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
import { combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+4 -3
View File
@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCouncilVote } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
export function votesOf (instanceId: string, api: ApiInterfaceRx): (accountId: string | Uint8Array | AccountId) => Observable<DeriveCouncilVote> {
@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec, u64 } from '@polkadot/types';
import type { Option, u64, Vec } from '@polkadot/types';
import type { BlockNumber, Hash, ReferendumIndex, Scheduled } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveDispatch, DeriveProposalImage } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction, stringToHex } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+5 -4
View File
@@ -1,16 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveDemocracyLock } from '../types';
import BN from 'bn.js';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { BN_ZERO, isUndefined } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Hash, VoteThreshold } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalExternal } from '../types';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalImage } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { parseImage } from './util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalImage } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { parseImage } from './util';
@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, Hash, PropIndex } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveProposalImage, DeriveProposal } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposal, DeriveProposalImage } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,13 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { ReferendumIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import BN from 'bn.js';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveReferendumExt } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveReferendum } from '../types';
import { of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { ReferendumInfo, ReferendumInfoFinished } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,16 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDirectVote, VotingDelegating } from '@polkadot/types/interfaces';
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
import BN from 'bn.js';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { calcVotes, getStatus, parseImage } from './util';
@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import BN from 'bn.js';
import { map } from 'rxjs/operators';
import { bnSqrt } from '@polkadot/util';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+1 -1
View File
@@ -3,7 +3,7 @@
import type BN from 'bn.js';
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash, Proposal, PropIndex, ReferendumInfoTo239, ReferendumStatus, Vote, ReferendumIndex, VoteThreshold } from '@polkadot/types/interfaces';
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, ReferendumStatus, Vote, VoteThreshold } from '@polkadot/types/interfaces';
export interface DeriveDemocracyLock {
balance: Balance;
@@ -8,6 +8,7 @@ import type { ITuple } from '@polkadot/types/types';
import type { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
import BN from 'bn.js';
import { bnSqrt } from '@polkadot/util';
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
+3 -3
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec, u32 } from '@polkadot/types';
import type { u32, Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveElectionsInfo } from './types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+1 -1
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, Balance, BlockNumber, SetIndex, VoteIndex } from '@polkadot/types/interfaces';
import type { u32 } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, SetIndex, VoteIndex } from '@polkadot/types/interfaces';
export interface DeriveElectionsInfo {
candidates: AccountId[];
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveHeartbeats } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { BN_ZERO } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+1 -1
View File
@@ -5,10 +5,10 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import { Observable, from } from 'rxjs';
import { ApiRx } from '@polkadot/api/rx';
import { MockProvider } from '@polkadot/rpc-provider/mock';
import { TypeRegistry } from '@polkadot/types/create';
import { from, Observable } from '@polkadot/x-rxjs';
import { ExactDerive } from '.';
+1 -1
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AnyFunction } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import * as accounts from './accounts';
import * as balances from './balances';
+5 -5
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { CollatorId, ParaId } from '@polkadot/types/interfaces';
import type { DeriveParachainInfo, DeriveParachainFull, DeriveParachainActive } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveParachainActive, DeriveParachainFull, DeriveParachainInfo } from '../types';
import type { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads } from './types';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { didUpdateToBool } from './util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { ParaId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveParachain, DeriveParachainInfo } from '../types';
import type { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize } from './types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { didUpdateToBool } from './util';
+1 -1
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Bytes, Option, u32, Vec } from '@polkadot/types';
import type { CollatorId, ParaId, ParaInfo, Retriable, UpwardMessage } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Bytes, Option, u32, Vec } from '@polkadot/types';
export type ParaInfoResult = Option<ParaInfo>;
export type PendingSwap = Option<ParaId>;
+3 -3
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, u32 } from '@polkadot/types';
import type { ActiveEraInfo, EraIndex, Moment, SessionIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSessionIndexes } from '../types';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { u64 } from '@polkadot/types';
import type { SessionIndex } from '@polkadot/types/interfaces';
import type { DeriveSessionInfo, DeriveSessionIndexes } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSessionIndexes, DeriveSessionInfo } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, u64 } from '@polkadot/types';
import type { SessionIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSessionInfo, DeriveSessionProgress } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+1 -1
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { BlockNumber, EraIndex, Moment, SessionIndex } from '@polkadot/types/interfaces';
import type { Option, u32 } from '@polkadot/types';
import type { BlockNumber, EraIndex, Moment, SessionIndex } from '@polkadot/types/interfaces';
export interface DeriveSessionIndexes {
activeEra: EraIndex;
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, BalanceOf, Bid, BidKind } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSocietyCandidate } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec, u32 } from '@polkadot/types';
import type { Option, u32, Vec } from '@polkadot/types';
import type { AccountId, BalanceOf, Bid } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSociety } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+2 -2
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { bool, Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSocietyMember } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSocietyMember } from '../types';
import { combineLatest } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { combineLatest } from '@polkadot/x-rxjs';
import { switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -2
View File
@@ -6,9 +6,10 @@ import type { Balance, StakingLedger, UnlockChunk } from '@polkadot/types/interf
import type { DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types';
import BN from 'bn.js';
import { combineLatest, Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { BN_ZERO } from '@polkadot/util';
import { combineLatest, Observable } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AccountId, EraPoints, EraRewardPoints, RewardPoint } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, EraPoints, EraRewardPoints, RewardPoint } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingElected } from '../types';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { StorageKey } from '@polkadot/types';
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { deriveCache, memo } from '../util';
@@ -1,14 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, u32 } from '@polkadot/types';
import type { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import BN from 'bn.js';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex, EraRewardPoints } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveEraPoints, DeriveEraValPoints } from '../types';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { BN_ZERO } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { deriveCache, memo } from '../util';
import { filterEras } from './util';
+3 -3
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { StorageKey } from '@polkadot/types';
import type { EraIndex, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveEraPrefs, DeriveEraValPrefs } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { deriveCache, memo } from '../util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Balance, EraIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveEraRewards } from '../types';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { deriveCache, memo } from '../util';
import { filterEras } from './util';
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, StorageKey } from '@polkadot/types';
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveEraSlashes, DeriveEraValSlash } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { deriveCache, memo } from '../util';
+3 -3
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Keys } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingKeys } from './types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+3 -3
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingOverview } from '../types';
import { combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveOwnExposure } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { deriveCache, memo } from '../util';
@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakerSlashes } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { deriveCache, memo } from '../util';
+3 -3
View File
@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, EraIndex, Exposure, Nominations, RewardDestination, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingQuery } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { DeriveStakerExposure, DeriveEraValidatorExposure } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveEraValidatorExposure, DeriveStakerExposure } from '../types';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakerPoints } from '../types';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakerPrefs } from '../types';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,17 +1,18 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, EraIndex, StakingLedger, StakingLedgerTo240 } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveEraPoints, DeriveEraPrefs, DeriveEraRewards, DeriveEraValPrefs, DeriveStakerExposure, DeriveStakerReward, DeriveStakerRewardValidator } from '../types';
import type { DeriveStakingQuery } from './types';
import BN from 'bn.js';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakerSlashes } from '../types';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+2 -2
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingValidators } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingWaiting } from '../types';
import { combineLatest } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { proposals as collectiveProposals } from '../collective';
@@ -0,0 +1,61 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex } from '@polkadot/types/interfaces';
import type { Codec, InterfaceTypes } from '@polkadot/types/types';
import { bounties } from '@polkadot/api-derive/treasury/bounties';
import { of } from '@polkadot/x-rxjs';
import { BountyFactory } from '../../test/bountyFactory';
import { BytesFactory } from '../../test/bytesFactory';
import { createApiWithAugmentations } from '../../test/helpers';
const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
describe('bounties derive', () => {
let storageKey: (index: number) => StorageKey;
let defaultBounty: () => Bounty;
let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>;
let optionOf: <T extends Codec> (value: T)=> Option<T>;
let bountyIndex: (index: number) => BountyIndex;
let bytes: (value: string) => Bytes;
beforeAll(() => {
const api = createApiWithAugmentations();
({ bountyIndex, defaultBounty, emptyOption, optionOf, storageKey } = new BountyFactory(api));
({ bytes } = new BytesFactory(api.registry));
});
it('combines bounties with descriptions', async () => {
const mockApi = {
query: {
treasury: {
bounties: {
keys: () => of([storageKey(0), storageKey(1), storageKey(2)]),
multi: () => of([optionOf(defaultBounty()), emptyOption('Bounty'), optionOf(defaultBounty())])
},
bountyCount: () => of(bountyIndex(3)),
bountyDescriptions: {
multi: () => of([
optionOf(bytes('make polkadot even better')),
optionOf(bytes('this will be totally ignored')),
emptyOption('Bytes')
])
}
}
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[0].description).toEqual('make polkadot even better');
expect(result[1].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[1].description).toEqual('');
});
});
@@ -0,0 +1,41 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { DeriveBounties } from '@polkadot/api-derive/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty } from '@polkadot/types/interfaces';
import type { Codec } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import { memo } from '@polkadot/api-derive/util';
import { combineLatest } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
function parseResult ([maybeBounties, maybeDescriptions]: [Option<Bounty>[], Option<Bytes>[]]): DeriveBounties {
const bounties: DeriveBounties = [];
maybeBounties.forEach((bounty, index) => {
if (bounty.isSome) {
bounties.push({ bounty: bounty.unwrap(), description: maybeDescriptions[index].unwrapOrDefault().toUtf8() });
}
});
return bounties;
}
function extractIds (keys: StorageKey[]): Codec[] {
return keys.map(({ args: [id] }: StorageKey) => id);
}
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
return memo(instanceId, (): Observable<DeriveBounties> => api.query.treasury.bountyCount().pipe(
switchMap(() => api.query.treasury.bounties.keys()),
switchMap((keys: StorageKey[]) => {
return combineLatest([
api.query.treasury.bounties.multi<Option<Bounty>>(extractIds(keys)),
api.query.treasury.bountyDescriptions.multi<Option<Bytes>>(extractIds(keys))
]
).pipe(map(parseResult));
})));
}
@@ -2,3 +2,4 @@
// SPDX-License-Identifier: Apache-2.0
export * from './proposals';
export * from './bounties';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { ProposalIndex, TreasuryProposal } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal, DeriveTreasuryProposal, DeriveTreasuryProposals } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

Some files were not shown because too many files have changed in this diff Show More