Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2654dd2f8 | ||
|
|
5f0ea88a42 | ||
|
|
69be690be6 | ||
|
|
67d4637786 | ||
|
|
d2557a3cac | ||
|
|
e2911a33c4 | ||
|
|
9b45901760 | ||
|
|
450f53d563 | ||
|
|
5374c863ad | ||
|
|
ce29ae6e0e | ||
|
|
d420c65c2b | ||
|
|
427ae64fab | ||
|
|
173c40b0e5 | ||
|
|
208fbb24d5 | ||
|
|
9ee563e3f6 | ||
|
|
70acb27218 | ||
|
|
dd29ebbeae | ||
|
|
b01935122f | ||
|
|
71d54821e0 | ||
|
|
5df3e1605a | ||
|
|
50737b7ef7 | ||
|
|
ecc86f797c | ||
|
|
ff020d14e4 | ||
|
|
ff36cb97c2 | ||
|
|
01f2fe7c86 | ||
|
|
948d8cccc1 | ||
|
|
da2e2f89c9 | ||
|
|
6b4fd110a1 | ||
|
|
a48eba101c | ||
|
|
78b9d29fa0 | ||
|
|
92c9ce15d6 | ||
|
|
11c4239614 | ||
|
|
0cb7b34ff0 | ||
|
|
a74382c539 | ||
|
|
beccc2ed9b | ||
|
|
c29f66c7c5 | ||
|
|
dba23e3923 | ||
|
|
f633b3d6c1 | ||
|
|
b1c7409c59 | ||
|
|
a2423b1004 | ||
|
|
c0f1bf7f1e | ||
|
|
8e6a1c8fb1 |
@@ -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
@@ -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
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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,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: {
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,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';
|
||||
|
||||
|
||||
@@ -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,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 '.';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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,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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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,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';
|
||||
|
||||
|
||||
@@ -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,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';
|
||||
|
||||
@@ -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,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>;
|
||||
|
||||
@@ -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,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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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,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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user