Remove api-observable (#530)

* 2019

* Remove api-observable

* tuples (SomeLonelyType) -> SomeLonelyType

* Bump to 0.37.0
This commit is contained in:
Jaco Greeff
2019-01-04 16:18:44 +01:00
committed by GitHub
parent b0490971d6
commit 6678d7255c
266 changed files with 1001 additions and 2298 deletions
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-3
View File
@@ -1,3 +0,0 @@
# @polkadot/api-observable
A combination Observable wrapper around [@polkadot/rpc-rx](packages/rpc-rx), including both [JSON-RPC methods](https://polkadot.js.org/api/METHODS_RPC.html) and [Storage methods](https://polkadot.js.org/api/METHODS_STORAGE.html)
-40
View File
@@ -1,40 +0,0 @@
{
"name": "@polkadot/api-observable",
"version": "0.36.3",
"description": "An Observable wrapper around the Polkadot JS API",
"main": "index.js",
"keywords": [
"Polkadot",
"RxJs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"contributors": [],
"license": "Apache-2.0",
"engines": {
"node": ">=8.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"repository": {
"type": "git",
"url": "git+https://github.com/polkadot-js/api.git"
},
"bugs": {
"url": "https://github.com/polkadot-js/api/issues"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-rx#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/extrinsics": "^0.36.3",
"@polkadot/rpc-core": "^0.36.3",
"@polkadot/rpc-provider": "^0.36.3",
"@polkadot/storage": "^0.36.3",
"@types/rx": "^4.1.1",
"rxjs": "^6.3.3"
}
}
-139
View File
@@ -1,139 +0,0 @@
// Copyright 2017-2018 @polkadot/api-observable authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { ModulesWithMethods } from '@polkadot/types/Method';
import { RpcMethod } from '@polkadot/jsonrpc/types';
import { RpcRxInterface, RpcRxInterface$Method, RpcRxInterface$Section } from '@polkadot/rpc-rx/types';
import { Storage } from '@polkadot/storage/types';
import { EMPTY, Observable, combineLatest, from } from 'rxjs';
import { defaultIfEmpty, map } from 'rxjs/operators';
import extrinsicsFromMeta from '@polkadot/extrinsics/fromMetadata';
import extrinsicsStatic from '@polkadot/extrinsics/static';
import storageFromMeta from '@polkadot/storage/fromMetadata';
import storageStatic from '@polkadot/storage/static';
import { Hash, Method } from '@polkadot/types/index';
import Event from '@polkadot/types/Event';
import { StorageFunction } from '@polkadot/types/StorageKey';
import { assert, isU8a } from '@polkadot/util';
type MapFn<R, T> = (combined: R) => T;
const defaultMapFn = (result: any): any =>
result;
// Raw base implementation for the observable API. It simply provides access to raw calls, allowing
// decendants to make direct queries to either API methods or actual storage
export default class ApiBase {
protected _api: RpcRxInterface;
protected _genesisHash: Hash;
// Observable that returns the first time we are connected and loaded
whenReady: Observable<boolean>;
constructor (api: RpcRxInterface) {
this._api = api;
this._genesisHash = new Hash();
this.whenReady = from(this.init());
}
static extrinsics: ModulesWithMethods = extrinsicsStatic;
static storage: Storage = storageStatic;
// FIXME This logic is duplicated in api-rx, since that should derive
// from that base, it should be removed when the actual extend is done
private init (): Promise<boolean> {
let isReady: boolean = false;
return new Promise((resolveReady) => {
// On connection, load data from chain
this.isConnected().subscribe(async (isConnected) => {
if (!isConnected) {
return;
}
try {
// FIXME This now gets done in api/Base as well, cleanup as soon as we
// have apis based on api-rx & api-promise (For now a bit of inefficiency)
const meta = await this._api.state.getMetadata().toPromise();
this._genesisHash = await this._api.chain.getBlockHash(0).toPromise();
ApiBase.extrinsics = extrinsicsFromMeta(meta);
ApiBase.storage = storageFromMeta(meta);
Event.injectMetadata(meta);
Method.injectMethods(ApiBase.extrinsics);
if (!isReady) {
isReady = true;
resolveReady(true);
}
} catch (error) {
console.error(error);
}
});
});
}
protected combine = <T, R> (observables: Array<Observable<any>>, mapfn: MapFn<R, T> = defaultMapFn): Observable<T> => {
return combineLatest(...observables).pipe(
defaultIfEmpty([] as any),
map(mapfn)
);
}
get genesisHash (): Hash {
return this._genesisHash;
}
isConnected = (): Observable<boolean> => {
return this._api.isConnected();
}
rawCall = <T> ({ method, section }: RpcMethod, ...params: Array<any>): Observable<T> => {
const apiSection = this._api[section as keyof RpcRxInterface] as RpcRxInterface$Section;
assert(apiSection, `Unable to find 'api.${section}'`);
const fn: RpcRxInterface$Method = apiSection[method];
assert(fn, `Unable to find 'api.${section}.${method}'`);
return fn.apply(null, params);
}
// FIXME Remove when extending from api-rx
rawStorage = <T> (key: Uint8Array | StorageFunction, ...params: Array<any>): Observable<T | undefined> => {
return this
.rawStorageMulti(
isU8a(key)
? key
: [key, ...params] as [StorageFunction, any]
)
.pipe(
map((result: Array<T>): T | undefined =>
result[0]
)
);
}
// FIXME Remove when extending from api-rx
rawStorageMulti = <T extends []> (...keys: Array<Uint8Array | [StorageFunction] | [StorageFunction, any]>): Observable<T> => {
let observable;
try {
observable = this._api.state.subscribeStorage(keys);
} catch (error) {
observable = EMPTY;
}
return observable.pipe(
defaultIfEmpty(),
map((result?: Array<any>): T =>
(result || []) as T
)
);
}
}
-84
View File
@@ -1,84 +0,0 @@
// Copyright 2017-2018 @polkadot/api-observable authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Observable } from 'rxjs';
import { defaultIfEmpty, map } from 'rxjs/operators';
import { BlockNumber, ChainProperties, Extrinsic, ExtrinsicStatus, Hash, Header, SignedBlock } from '@polkadot/types/index';
import ApiQueries from './Queries';
// Implementation of calls to API endpoints.
export default class ApiCalls extends ApiQueries {
bestNumber = (): Observable<BlockNumber | undefined> => {
return this
.subscribeNewHead()
.pipe(
map((header?: Header): BlockNumber | undefined =>
header && header.blockNumber
? header.blockNumber
: undefined
)
);
}
bestNumberFinalised = (): Observable<BlockNumber | undefined> => {
return this
.subscribeFinalisedHead()
.pipe(
map((header?: Header): BlockNumber | undefined =>
header && header.blockNumber
? header.blockNumber
: undefined
)
);
}
chain = (): Observable<Text | undefined> => {
return this._api.system.chain();
}
chainProperties = (): Observable<ChainProperties> => {
return this._api.system
.properties()
.pipe(
map((properties?: ChainProperties | null): ChainProperties =>
properties
? properties
: new ChainProperties()
)
);
}
getBlock = (hash: Uint8Array): Observable<SignedBlock | undefined> => {
return this._api.chain.getBlock(hash);
}
subscribeFinalisedHead = (): Observable<Header | undefined> => {
return this._api.chain.subscribeFinalisedHeads().pipe(
defaultIfEmpty()
);
}
subscribeNewHead = (): Observable<Header | undefined> => {
return this._api.chain.subscribeNewHead().pipe(
defaultIfEmpty()
);
}
systemName = (): Observable<Text | undefined> => {
return this._api.system.name();
}
systemVersion = (): Observable<Text | undefined> => {
return this._api.system.version();
}
submitExtrinsic = (extrinsic: Extrinsic): Observable<Hash | undefined> => {
return this._api.author.submitExtrinsic(extrinsic);
}
submitAndWatchExtrinsic = (extrinsic: Extrinsic): Observable<ExtrinsicStatus | undefined> => {
return this._api.author.submitAndWatchExtrinsic(extrinsic);
}
}
-432
View File
@@ -1,432 +0,0 @@
// Copyright 2017-2018 @polkadot/api-observable authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { RxBalance, RxBalanceMap, RxReferendumVote } from './types';
import BN from 'bn.js';
import { EMPTY, Observable, from } from 'rxjs';
import { switchMap, defaultIfEmpty, map } from 'rxjs/operators';
import { decodeAddress } from '@polkadot/keyring';
import { AccountId, AccountIndex, Balance, bool as Bool, BlockNumber, Moment, ReferendumIndex, ReferendumInfo } from '@polkadot/types/index';
import { ENUMSET_SIZE } from '@polkadot/types/AccountIndex';
import { assert } from '@polkadot/util';
import ApiCalls from './Calls';
import { RxProposal } from './classes';
// Combines API calls and queries into single results. This allows for the exposed API to have
// useful extensions, i.e. queries can be made that returns the results from multiple observables,
// make the noise for the API users significantly less
export default class ApiCombined extends ApiCalls {
// Creates a mapping of AccountId (encoded) => AccountIndex
accountIndexes = (): Observable<{ [index: string]: AccountIndex }> => {
return this
.nextAccountEnumSet()
.pipe(
switchMap((nextEnum: AccountIndex | undefined) => {
const lastIndex = nextEnum || new BN(0);
const setSize = ENUMSET_SIZE.toNumber();
const enumRange = [...Array(lastIndex.div(ENUMSET_SIZE).toNumber() + 1).keys()];
return this.combine(
enumRange.map((index) =>
this.getAccountEnumSet(1 + (index * setSize))
),
(all: Array<Array<AccountId> | undefined> = []) => {
return all.reduce((result, list = [], outerIndex: number) => {
list.forEach((accountId, innerIndex) => {
const index = (outerIndex * setSize) + innerIndex;
result[accountId.toString()] = new AccountIndex(index);
});
return result;
}, {} as { [index: string]: AccountIndex });
}
);
})
);
}
// lookup accountId from index
accountIdFromIndex = (_accountIndex: AccountIndex | string): Observable<AccountId | undefined> => {
const accountIndex = _accountIndex instanceof AccountIndex
? _accountIndex
: new AccountIndex(_accountIndex);
return this
.getAccountEnumSet(accountIndex)
.pipe(
map((accounts: Array<AccountId> = []): AccountId | undefined =>
accounts[accountIndex.mod(ENUMSET_SIZE).toNumber()]
)
);
}
// lookup accountIndex from accountId
accountIndexFromId = (accountId: AccountId | string): Observable<AccountIndex | undefined> => {
return this
.accountIndexes()
.pipe(
map((mapping: { [index: string]: AccountIndex } = {}): AccountIndex | undefined =>
mapping[accountId.toString()]
)
);
}
// lookup accountId & accountIndex from value
accountIdAndIndex = (address?: AccountId | AccountIndex | string | null): Observable<[AccountId | undefined, AccountIndex | undefined]> => {
try {
// yes, this can fail, don't care too much, catch will catch it
const length = decodeAddress((address as any).toString()).length;
assert([1, 2, 4, 8, 32].indexOf(length) !== -1, `Invalid length for decoded address, found ${length}`);
if (length === 32) {
const accountId = new AccountId(address as string);
return this
.accountIndexFromId(accountId)
.pipe(
map((accountIndex?: AccountIndex): [AccountId, AccountIndex | undefined] =>
[accountId, accountIndex]
)
);
}
const accountIndex = new AccountIndex(address as string);
return this
.accountIdFromIndex(accountIndex)
.pipe(
map((accountId?: AccountId): [AccountId | undefined, AccountIndex] =>
[accountId, accountIndex]
)
);
} catch (error) {
// swallow
}
// just return empties
return from([]);
}
publicProposalCount = (): Observable<number> => {
return this
.publicProposals()
.pipe(
map((proposals: Array<RxProposal>) =>
proposals.length
)
);
}
referendumsInfo = (referendumIds: Array<ReferendumIndex | BN | number>): Observable<Array<ReferendumInfo>> => {
return this.combine(
referendumIds.map((referendumId) =>
this.referendumInfo(referendumId)
),
(referendums: Array<ReferendumInfo> = []): Array<ReferendumInfo> =>
referendums.filter((referendum) =>
referendum
)
);
}
democracyReferendumVoters = (referendumId: ReferendumIndex | BN | number): Observable<Array<RxReferendumVote>> => {
return this.combine(
[
this.referendumVoters(referendumId),
this.democracyVotersBalancesOf(referendumId),
this.democracyVotersVotesOf(referendumId)
],
([voters, balances, votes]: [Array<AccountId>, Array<Balance>, Array<Bool>]): Array<RxReferendumVote> =>
voters.map((address, index): RxReferendumVote => ({
address,
balance: balances[index] || new Balance(0),
vote: votes[index] || new Bool(false)
}))
);
}
referendums = (): Observable<Array<ReferendumInfo>> => {
return this.combine(
[
this.referendumCount(),
this.democracyNextTally()
]
).pipe(
// @ts-ignore After upgrade to 6.3.2
switchMap(([referendumCount, nextTally]: [ReferendumIndex | undefined, ReferendumIndex | undefined]): Observable<Array<RxReferendum>> =>
referendumCount && nextTally && referendumCount.gt(nextTally) && referendumCount.gtn(0)
? this.referendumsInfo(
[...Array(referendumCount.sub(nextTally).toNumber())].map((_, i) =>
nextTally.addn(i).toNumber()
)
)
: EMPTY
),
defaultIfEmpty([])
);
}
referendumVotes = (index: ReferendumIndex | BN | number, addresses: Array<AccountId | string>): Observable<boolean> => {
return this.combine(
addresses.map((address) =>
this.referendumVote(index, address)
)
);
}
democracyVotersBalancesOf = (referendumId: ReferendumIndex | BN | number): Observable<Array<Balance>> => {
return this
.referendumVoters(referendumId)
.pipe(
switchMap((voters: Array<AccountId> = []) =>
this.votingBalances(...voters)
),
defaultIfEmpty([] as any),
map((balances: Array<RxBalance>) =>
balances.map(({ votingBalance }) =>
votingBalance
)
)
);
}
democracyVotersVotesOf = (referendumId: ReferendumIndex | BN | number): Observable<Array<Bool>> => {
return this
.referendumVoters(referendumId)
.pipe(
switchMap((voters: Array<AccountId> = []) =>
this.referendumVotes(referendumId, voters)
),
defaultIfEmpty([] as any)
);
}
eraBlockLength = (): Observable<BlockNumber | undefined> => {
return this.combine(
[
this.sessionLength(),
this.sessionsPerEra()
],
([sessionLength, sessionsPerEra]: [BlockNumber | undefined, BlockNumber | undefined]): BlockNumber | undefined =>
sessionLength && sessionsPerEra
? new BlockNumber(
sessionLength.mul(sessionsPerEra)
)
: undefined
);
}
eraBlockProgress = (): Observable<BlockNumber | undefined> => {
return this.combine(
[
this.sessionBlockProgress(),
this.sessionLength(),
this.sessionCurrentIndex(),
this.sessionsPerEra(),
this.eraLastLengthChange()
],
([sessionBlockProgress, sessionLength, sessionCurrentIndex, sessionsPerEra, eraLastLengthChange]: [BlockNumber | undefined, BlockNumber | undefined, BlockNumber | undefined, BlockNumber | undefined, BlockNumber | undefined]): BlockNumber | undefined =>
sessionsPerEra && sessionCurrentIndex && sessionLength && sessionBlockProgress
? new BlockNumber(
sessionCurrentIndex
// last era can be null (i.e. new chain, valid key, no value set yet)
.sub(eraLastLengthChange || new BlockNumber(0))
.mod(sessionsPerEra)
.mul(sessionLength)
.add(sessionBlockProgress)
)
: undefined
);
}
eraBlockRemaining = (): Observable<BlockNumber | undefined> => {
return this.combine(
[
this.eraBlockLength(),
this.eraBlockProgress()
],
([eraBlockLength, eraBlockProgress]: [BlockNumber | undefined, BlockNumber | undefined]): BlockNumber | undefined =>
eraBlockLength && eraBlockProgress
? new BlockNumber(
eraBlockLength.sub(eraBlockProgress)
)
: undefined
);
}
sessionBlockProgress = (): Observable<BlockNumber | undefined> => {
return this.combine(
[
this.bestNumber(),
this.sessionLength(),
this.sessionLastLengthChange()
],
([bestNumber, sessionLength, lastSessionLengthChange]: [BlockNumber | undefined, BlockNumber | undefined, BlockNumber | undefined]): BlockNumber | undefined =>
bestNumber && sessionLength
? new BlockNumber(
bestNumber
// last change can be null (i.e. new chain, valid key, no value set yet)
.sub(lastSessionLengthChange || new BlockNumber(0))
.add(sessionLength)
.mod(sessionLength)
)
: undefined
);
}
sessionBlockRemaining = (): Observable<BlockNumber | undefined> => {
return this.combine(
[
this.sessionBlockProgress(),
this.sessionLength()
],
([sessionBlockProgress, sessionLength]: [BlockNumber | undefined, BlockNumber | undefined]): BlockNumber | undefined =>
sessionBlockProgress && sessionLength
? new BlockNumber(
sessionLength.sub(sessionBlockProgress)
)
: undefined
);
}
sessionBrokenValue = (): Observable<Moment | undefined> => {
return this.combine(
[
this.blockNow(),
this.sessionTimeExpected(),
this.sessionTimeRemaining(),
this.sessionCurrentStart()
],
([now, sessionTimeExpected, sessionTimeRemaining, sessionCurrentStart]: [Moment | undefined, Moment | undefined, Moment | undefined, Moment | undefined]): Moment | undefined =>
sessionTimeExpected && sessionTimeRemaining && sessionCurrentStart && now
? new Moment(
Math.round(
100 * (now.getTime() + sessionTimeRemaining.toNumber() - sessionCurrentStart.getTime()) / sessionTimeExpected.toNumber() - 100
)
)
: undefined
);
}
sessionTimeExpected = (): Observable<Moment | undefined> => {
return this.combine(
[
this.sessionLength(),
this.blockPeriod()
],
([sessionLength, blockPeriod]: [BlockNumber | undefined, Moment | undefined]): Moment | undefined =>
sessionLength && blockPeriod
? new Moment(
sessionLength.muln(blockPeriod.toNumber()).muln(1000)
)
: undefined
);
}
sessionTimeRemaining = (): Observable<Moment | undefined> => {
return this.combine(
[
this.sessionBlockRemaining(),
this.blockPeriod()
],
([sessionBlockRemaining, blockPeriod]: [BlockNumber | undefined, Moment | undefined]): Moment | undefined =>
blockPeriod && sessionBlockRemaining
? new Moment(
sessionBlockRemaining.muln(blockPeriod.toNumber()).muln(1000)
)
: undefined
);
}
validatingBalance = (address: AccountId | string): Observable<RxBalance> => {
return this.combine(
[
this.votingBalance(address),
this.votingBalancesNominatorsFor(address)
],
([balance, nominators = []]: [RxBalance, Array<RxBalance>]): RxBalance => {
const nominatedBalance = nominators.reduce((total, nominator: RxBalance) => {
return total.add(nominator.votingBalance);
}, new BN(0));
const result = {
...balance,
nominators,
nominatedBalance: new Balance(nominatedBalance),
stakingBalance: new Balance(
nominatedBalance.add(balance.votingBalance)
)
};
return result;
}
);
}
validatingBalances = (...addresses: Array<AccountId | string>): Observable<RxBalanceMap> => {
return this.combine(
addresses.map((address) =>
this.validatingBalance(address)
),
(result: Array<RxBalance>): RxBalanceMap =>
result.reduce((balances, balance) => {
balances[balance.address.toString()] = balance;
return balances;
}, {} as RxBalanceMap)
);
}
votingBalance = (address: AccountIndex | AccountId | string): Observable<RxBalance> => {
return this
.accountIdAndIndex(address)
.pipe(
switchMap(([accountId]: [AccountId | undefined, AccountIndex | undefined]): Observable<RxBalance> => {
if (!accountId) {
return EMPTY;
}
return this.combine(
[
this.balanceFree(accountId),
this.balanceReserved(accountId)
],
([freeBalance, reservedBalance]: [Balance | undefined, Balance | undefined]): RxBalance => ({
address: accountId,
freeBalance: freeBalance || new Balance(0),
nominatedBalance: new Balance(0),
reservedBalance: reservedBalance || new Balance(0),
stakingBalance: new Balance(0),
votingBalance: new Balance(
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
)
})
);
})
);
}
votingBalancesNominatorsFor = (address: AccountId | string) => {
return this
.stakingNominatorsFor(address)
.pipe(
switchMap((nominators: Array<AccountId>) =>
this.votingBalances(...nominators)
),
defaultIfEmpty([] as any)
);
}
votingBalances = (...addresses: Array<AccountId | string>): Observable<RxBalance[]> => {
return this.combine(
addresses.map((address) =>
this.votingBalance(address)
)
);
}
}
-233
View File
@@ -1,233 +0,0 @@
// Copyright 2017-2018 @polkadot/api-observable authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { RxFees } from './types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { AccountId, AccountIndex, Balance, bool as Bool, BlockNumber, EventRecord, Index, Moment, Perbill, PropIndex, ReferendumIndex, ReferendumInfo, u32 } from '@polkadot/types/index';
import { Tuple } from '@polkadot/types/codec';
import ApiBase from './Base';
import { RxProposal, RxProposalDeposits } from './classes';
// Perform storage queries to the API endpoints.
export default class ApiQueries extends ApiBase {
accountNonce = (address: AccountId | string): Observable<Index | undefined> => {
return this.rawStorage(ApiBase.storage.system.accountNonce, address);
}
balanceFree = (address: AccountId | string): Observable<Balance | undefined> => {
return this.rawStorage(ApiBase.storage.balances.freeBalance, address);
}
balanceReserved = (address: AccountId | string): Observable<Balance | undefined> => {
return this.rawStorage(ApiBase.storage.balances.reservedBalance, address);
}
blockPeriod = (): Observable<Moment | undefined> => {
return this.rawStorage(ApiBase.storage.timestamp.blockPeriod);
}
blockNow = (): Observable<Moment | undefined> => {
return this.rawStorage(ApiBase.storage.timestamp.now);
}
democracyLaunchPeriod = (): Observable<BlockNumber | undefined> => {
return this.rawStorage(ApiBase.storage.democracy.launchPeriod);
}
democracyNextTally = (): Observable<ReferendumIndex | undefined> => {
return this.rawStorage(ApiBase.storage.democracy.nextTally);
}
getAccountEnumSet = (index: AccountIndex | BN | number): Observable<Array<AccountId> | undefined> => {
return this
.rawStorage(ApiBase.storage.balances.enumSet, index)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((accounts: Array<AccountId> | null | undefined) =>
accounts || ([] as Array<AccountId>)
)
);
}
nextAccountEnumSet = (): Observable<AccountIndex | undefined> => {
return this.rawStorage(ApiBase.storage.balances.nextEnumSet);
}
proposalDeposits = (proposalId: PropIndex | BN | number): Observable<RxProposalDeposits | undefined> => {
return this
.rawStorage(ApiBase.storage.democracy.depositOf, proposalId)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((result: Tuple): RxProposalDeposits | undefined =>
result
? new RxProposalDeposits(result)
: undefined
)
);
}
publicProposals = (): Observable<Array<RxProposal>> => {
return this
.rawStorage(ApiBase.storage.democracy.publicProps)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((proposals: Array<Tuple> | null | undefined) =>
(proposals || ([] as Array<Tuple>))
.map((result: Tuple): RxProposal | undefined =>
result
? new RxProposal(result)
: undefined
)
.filter((proposal) =>
proposal
)
)
);
}
referendumCount = (): Observable<ReferendumIndex | undefined> => {
return this.rawStorage(ApiBase.storage.democracy.referendumCount);
}
referendumInfo = (referendumId: ReferendumIndex | BN | number): Observable<ReferendumInfo | undefined> => {
return this
.rawStorage(ApiBase.storage.democracy.referendumInfoOf, referendumId)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((result: Tuple) =>
result
? result[0]
: undefined
)
);
}
referendumVote = (index: ReferendumIndex | BN | number, address: AccountId | string): Observable<Bool | undefined> => {
return this.rawStorage(ApiBase.storage.democracy.voteOf, [index, address]);
}
referendumVoters = (index: ReferendumIndex | BN | number): Observable<Array<AccountId>> => {
return this
.rawStorage(ApiBase.storage.democracy.votersFor, index)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((voters: Array<AccountId> | null | undefined) =>
voters || ([] as Array<AccountId>)
)
);
}
democracyVotingPeriod = (): Observable<BlockNumber | undefined> => {
return this.rawStorage(ApiBase.storage.democracy.votingPeriod);
}
fees = (): Observable<RxFees> => {
return this
.rawStorageMulti(
[ApiBase.storage.balances.transactionBaseFee],
[ApiBase.storage.balances.transactionByteFee],
[ApiBase.storage.balances.creationFee],
[ApiBase.storage.balances.existentialDeposit],
[ApiBase.storage.balances.transferFee]
)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map(([baseFee, byteFee, creationFee, existentialDeposit, transferFee]: [Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined]) => ({
baseFee: baseFee || new Balance(0),
byteFee: byteFee || new Balance(0),
creationFee: creationFee || new Balance(0),
existentialDeposit: existentialDeposit || new Balance(0),
transferFee: transferFee || new Balance(0)
}))
);
}
eraLastLengthChange = (): Observable<BlockNumber | undefined> => {
return this.rawStorage(ApiBase.storage.staking.lastEraLengthChange);
}
sessionReward = (): Observable<Perbill | undefined> => {
return this.rawStorage(ApiBase.storage.staking.sessionReward);
}
sessionRewardCurrent = (): Observable<Balance | undefined> => {
return this.rawStorage(ApiBase.storage.staking.currentSessionReward);
}
sessionCurrentIndex = (): Observable<BlockNumber | undefined> => {
return this.rawStorage(ApiBase.storage.session.currentIndex);
}
sessionCurrentStart = (): Observable<Moment | undefined> => {
return this.rawStorage(ApiBase.storage.session.currentStart);
}
sessionLastLengthChange = (): Observable<BlockNumber | undefined> => {
return this.rawStorage(ApiBase.storage.session.lastLengthChange);
}
sessionLength = (): Observable<BlockNumber | undefined> => {
return this.rawStorage(ApiBase.storage.session.sessionLength);
}
sessionsPerEra = (): Observable<BlockNumber | undefined> => {
return this.rawStorage(ApiBase.storage.staking.sessionsPerEra);
}
sessionValidators = (): Observable<Array<AccountId>> => {
return this
.rawStorage(ApiBase.storage.session.validators)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((validators: Array<AccountId> | null | undefined) =>
validators || ([] as Array<AccountId>)
)
);
}
stakingIntentions = (): Observable<Array<AccountId>> => {
return this
.rawStorage(ApiBase.storage.staking.intentions)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((intentions: Array<AccountId> | null | undefined) =>
intentions || ([] as Array<AccountId>)
)
);
}
stakingNominatorsFor = (address: AccountId | string): Observable<Array<AccountId>> => {
return this
.rawStorage(ApiBase.storage.staking.nominatorsFor, address)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((nominators: Array<AccountId> | null | undefined) =>
nominators || ([] as Array<AccountId>)
)
);
}
stakingNominating = (address: AccountId | string): Observable<AccountId | undefined> => {
return this.rawStorage(ApiBase.storage.staking.nominating, address);
}
systemEvents = (): Observable<Array<EventRecord>> => {
return this
.rawStorage(ApiBase.storage.system.events)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((events: Array<EventRecord> | null | undefined) =>
events || ([] as Array<EventRecord>)
)
);
}
validatorCount = (): Observable<u32 | undefined> => {
return this.rawStorage(ApiBase.storage.staking.validatorCount);
}
}
-50
View File
@@ -1,50 +0,0 @@
// Copyright 2017-2018 @polkadot/api-observable authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Balance, PropIndex, Proposal } from '@polkadot/types/index';
import { Constructor } from '@polkadot/types/types';
import { Struct, Tuple, Vector } from '@polkadot/types/codec';
const ProposalStruct: Constructor<Struct<any>> = Struct.with({ id: PropIndex, proposal: Proposal, address: AccountId });
export class RxProposal extends ProposalStruct {
constructor (value: Tuple) {
super({
id: value[0],
proposal: value[1],
address: value[2]
});
}
get address (): AccountId {
return this.get('address') as AccountId;
}
get id (): PropIndex {
return this.get('id') as PropIndex;
}
get proposal (): Proposal {
return this.get('proposal') as Proposal;
}
}
const DepositStruct: Constructor<Struct<any>> = Struct.with({ balance: Balance, addresses: Vector.with(AccountId) });
export class RxProposalDeposits extends DepositStruct {
constructor (value: Tuple) {
super({
balance: value[0],
addresses: value[1]
});
}
get addresses (): Vector<AccountId> {
return this.get('addresses') as Vector<AccountId>;
}
get balance (): Balance {
return this.get('balance') as Balance;
}
}
-8
View File
@@ -1,8 +0,0 @@
// Copyright 2017-2018 @polkadot/api-observable authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import ApiCombined from './Combined';
export default class Api extends ApiCombined {
}
-40
View File
@@ -1,40 +0,0 @@
// Copyright 2017-2018 @polkadot/api-observable authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Balance, bool as Bool } from '@polkadot/types/index';
import ApiBase from './Base';
import ApiCalls from './Calls';
import ApiCombined from './Combined';
import ApiQueries from './Queries';
export type ApiFunctions = keyof ApiBase | keyof ApiCalls | keyof ApiCombined | keyof ApiQueries;
export type RxBalance = {
address: AccountId,
freeBalance: Balance,
nominatedBalance: Balance,
reservedBalance: Balance,
votingBalance: Balance,
stakingBalance: Balance,
nominators?: Array<RxBalance>
};
export type RxFees = {
baseFee: Balance,
byteFee: Balance,
creationFee: Balance,
existentialDeposit: Balance,
transferFee: Balance
};
export type RxReferendumVote = {
address: AccountId,
balance: Balance,
vote: Bool
};
export type RxBalanceMap = {
[index: string]: RxBalance
};
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "0.36.3",
"version": "0.37.0",
"description": "An RxJS wrapper around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -30,11 +30,11 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/extrinsics": "^0.36.3",
"@polkadot/rpc-provider": "^0.36.3",
"@polkadot/rpc-rx": "^0.36.3",
"@polkadot/storage": "^0.36.3",
"@polkadot/types": "^0.36.3",
"@polkadot/extrinsics": "^0.37.0",
"@polkadot/rpc-provider": "^0.37.0",
"@polkadot/rpc-rx": "^0.37.0",
"@polkadot/storage": "^0.37.0",
"@polkadot/types": "^0.37.0",
"@types/rx": "^4.1.1",
"rxjs": "^6.3.3"
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/api authors & contributors
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "0.36.3",
"version": "0.37.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -30,9 +30,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/jsonrpc": "^0.36.3",
"@polkadot/rpc-provider": "^0.36.3",
"@polkadot/types": "^0.36.3",
"@polkadot/util": "^0.33.28"
"@polkadot/jsonrpc": "^0.37.0",
"@polkadot/rpc-provider": "^0.37.0",
"@polkadot/types": "^0.37.0",
"@polkadot/util": "^0.33.29"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
// Copyright 2017-2019 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "0.36.3",
"version": "0.37.0",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -30,10 +30,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/keyring": "^0.33.28",
"@polkadot/storage": "^0.36.3",
"@polkadot/util": "^0.33.28",
"@polkadot/util-crypto": "^0.33.28",
"@polkadot/keyring": "^0.33.29",
"@polkadot/storage": "^0.37.0",
"@polkadot/util": "^0.33.29",
"@polkadot/util-crypto": "^0.33.29",
"@types/nock": "^9.3.0",
"eventemitter3": "^3.1.0",
"isomorphic-fetch": "^2.2.1",
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-provider authors & contributors
// Copyright 2017-2019 @polkadot/rpc-provider authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-rx",
"version": "0.36.3",
"version": "0.37.0",
"description": "An RxJs wrapper around the Polkadot JS API",
"main": "index.js",
"keywords": [
@@ -30,8 +30,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-rx#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/rpc-core": "^0.36.3",
"@polkadot/rpc-provider": "^0.36.3",
"@polkadot/rpc-core": "^0.37.0",
"@polkadot/rpc-provider": "^0.37.0",
"@types/rx": "^4.1.1",
"rxjs": "^6.3.3"
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-rx authors & contributors
// Copyright 2017-2019 @polkadot/rpc-rx authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-rx authors & contributors
// Copyright 2017-2019 @polkadot/rpc-rx authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-rx authors & contributors
// Copyright 2017-2019 @polkadot/rpc-rx authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-rx authors & contributors
// Copyright 2017-2019 @polkadot/rpc-rx authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-rx authors & contributors
// Copyright 2017-2019 @polkadot/rpc-rx authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/rpc-rx authors & contributors
// Copyright 2017-2019 @polkadot/rpc-rx authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/extrinsics",
"version": "0.36.3",
"version": "0.37.0",
"main": "index.js",
"repository": "https://github.com/polkadot-js/api.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -11,7 +11,7 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/types": "^0.36.3",
"@polkadot/util": "^0.33.28"
"@polkadot/types": "^0.37.0",
"@polkadot/util": "^0.33.29"
}
}
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/extrinsics authors & contributors
// Copyright 2017-2019 @polkadot/extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/extrinsics authors & contributors
// Copyright 2017-2019 @polkadot/extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/extrinsics authors & contributors
// Copyright 2017-2019 @polkadot/extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/extrinsics authors & contributors
// Copyright 2017-2019 @polkadot/extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/extrinsics authors & contributors
// Copyright 2017-2019 @polkadot/extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/extrinsics authors & contributors
// Copyright 2017-2019 @polkadot/extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/extrinsics authors & contributors
// Copyright 2017-2019 @polkadot/extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "0.36.3",
"version": "0.37.0",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"engines": {
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2018 @polkadot/jsonrpc authors & contributors
// Copyright 2017-2019 @polkadot/jsonrpc authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/storage",
"version": "0.36.3",
"version": "0.37.0",
"description": "Generic wrapper wrapper around state storage",
"main": "index.js",
"engines": {
@@ -30,9 +30,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/keyring": "^0.33.28",
"@polkadot/types": "^0.36.3",
"@polkadot/util": "^0.33.28",
"@polkadot/util-crypto": "^0.33.28"
"@polkadot/keyring": "^0.33.29",
"@polkadot/types": "^0.37.0",
"@polkadot/util": "^0.33.29",
"@polkadot/util-crypto": "^0.33.29"
}
}

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