@@ -30,12 +30,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/api": "^0.43.5",
|
||||
"@polkadot/types": "^0.43.5",
|
||||
"@types/memoizee": "^0.4.2",
|
||||
"@types/rx": "^4.1.1",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.3.3"
|
||||
"memoizee": "^0.4.14"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { Observable, combineLatest, of } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { ApiInterface$Rx } from '@polkadot/api/types';
|
||||
import { HeaderExtended } from '@polkadot/types/Header';
|
||||
import { Header, HeaderExtended } from '@polkadot/types/index';
|
||||
|
||||
import { drr } from '../util/drr';
|
||||
import { HeaderAndValidators } from './subscribeNewHead';
|
||||
@@ -26,7 +26,7 @@ export function getHeader (api: ApiInterface$Rx) {
|
||||
return (hash: Uint8Array | string): Observable<HeaderExtended | undefined> =>
|
||||
// tslint:disable-next-line
|
||||
(combineLatest(
|
||||
api.rpc.chain.getHeader(hash),
|
||||
api.rpc.chain.getHeader(hash) as Observable<Header>,
|
||||
api.query.session
|
||||
? api.query.session.validators.at(hash)
|
||||
: of([])
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
import { Observable, combineLatest, of } from 'rxjs';
|
||||
import { filter, map, switchMap } from 'rxjs/operators';
|
||||
import { ApiInterface$Rx } from '@polkadot/api/types';
|
||||
import { AccountId, Header } from '@polkadot/types/index';
|
||||
import { HeaderExtended } from '@polkadot/types/Header';
|
||||
import { AccountId, Header, HeaderExtended } from '@polkadot/types/index';
|
||||
|
||||
import { drr } from '../util/drr';
|
||||
|
||||
@@ -31,7 +30,7 @@ export function subscribeNewHead (api: ApiInterface$Rx) {
|
||||
header && !!header.blockNumber
|
||||
),
|
||||
switchMap((header: Header): Observable<HeaderAndValidators> =>
|
||||
combineLatest(
|
||||
(combineLatest(
|
||||
of(header),
|
||||
// theoretically we could combine at the first call with session.validators(), however
|
||||
// we make 100% sure we actually get the validators at a specific block so when these
|
||||
@@ -39,7 +38,7 @@ export function subscribeNewHead (api: ApiInterface$Rx) {
|
||||
api.query.session
|
||||
? api.query.session.validators.at(header.hash)
|
||||
: of([])
|
||||
)
|
||||
) as Observable<HeaderAndValidators>)
|
||||
),
|
||||
map(([header, validators]) =>
|
||||
new HeaderExtended(header, validators)
|
||||
|
||||
@@ -29,15 +29,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/api-derive": "^0.43.5",
|
||||
"@polkadot/extrinsics": "^0.43.5",
|
||||
"@polkadot/rpc-provider": "^0.43.5",
|
||||
"@polkadot/rpc-rx": "^0.43.5",
|
||||
"@polkadot/storage": "^0.43.5",
|
||||
"@polkadot/types": "^0.43.5",
|
||||
"@polkadot/util-crypto": "^0.34.12",
|
||||
"@types/rx": "^4.1.1",
|
||||
"rxjs": "^6.3.3"
|
||||
"@polkadot/util-crypto": "^0.34.15"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { KeyringPair } from '@polkadot/keyring/types';
|
||||
import { AccountId, Address, Extrinsic, ExtrinsicStatus, EventRecord, Hash, Index, Method, SignedBlock, Struct, Text, Vector } from '@polkadot/types/index';
|
||||
import { CodecCallback, SignatureOptions } from '@polkadot/types/types';
|
||||
import { Codec, CodecCallback, SignatureOptions } from '@polkadot/types/types';
|
||||
import { ApiInterface$Rx, ApiType, OnCallDefinition, Signer } from './types';
|
||||
|
||||
import { Observable, of, combineLatest } from 'rxjs';
|
||||
@@ -179,7 +179,7 @@ export default class SubmittableExtrinsic<CodecResult, SubscriptionResult> exten
|
||||
let updateId: number | undefined;
|
||||
|
||||
return this._onCall(
|
||||
() => (
|
||||
() => ((
|
||||
isUndefined(options.nonce)
|
||||
? this._api.query.system.accountNonce(address) as Observable<Index>
|
||||
: of(new Index(options.nonce))
|
||||
@@ -199,7 +199,7 @@ export default class SubmittableExtrinsic<CodecResult, SubscriptionResult> exten
|
||||
? this.subscribeObservable(updateId)
|
||||
: this.sendObservable(updateId) as any; // ???
|
||||
})
|
||||
),
|
||||
) as Observable<Codec>),
|
||||
[],
|
||||
statusCb as CodecCallback,
|
||||
isSubscription
|
||||
|
||||
@@ -173,7 +173,7 @@ export default class ApiRx extends ApiBase<RxResult, RxResult> implements ApiRxI
|
||||
resolveReady(this)
|
||||
)
|
||||
)
|
||||
);
|
||||
) as Observable<ApiRx>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/jsonrpc": "^0.43.5",
|
||||
"@polkadot/rpc-provider": "^0.43.5",
|
||||
"@polkadot/types": "^0.43.5",
|
||||
"@polkadot/util": "^0.34.12"
|
||||
"@polkadot/util": "^0.34.15"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@polkadot/keyring": "^0.34.12",
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/keyring": "^0.34.15",
|
||||
"@polkadot/storage": "^0.43.5",
|
||||
"@polkadot/util": "^0.34.12",
|
||||
"@polkadot/util-crypto": "^0.34.12",
|
||||
"@types/nock": "^9.3.0",
|
||||
"@polkadot/util": "^0.34.15",
|
||||
"@polkadot/util-crypto": "^0.34.15",
|
||||
"@types/nock": "^9.3.1",
|
||||
"eventemitter3": "^3.1.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"websocket": "^1.0.28"
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-rx#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/rpc-core": "^0.43.5",
|
||||
"@polkadot/rpc-provider": "^0.43.5",
|
||||
"@types/memoizee": "^0.4.2",
|
||||
"@types/rx": "^4.1.1",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.3.3"
|
||||
"rxjs": "^6.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,27 +117,26 @@ export default class RpcRx implements RpcRxInterface {
|
||||
}
|
||||
|
||||
private createReplay (name: string, params: Array<any>, section: RpcInterface$Section, memoized: Memoized<RpcRxInterface$Method>): Observable<any> {
|
||||
return Observable
|
||||
.create((observer: Observer<any>): Function => {
|
||||
const fn = section[name];
|
||||
const callback = this.createReplayCallback(observer);
|
||||
const subscribe = fn(...params, callback).catch((error) =>
|
||||
observer.next(error)
|
||||
);
|
||||
|
||||
return this.createReplayUnsub(fn, subscribe, params, memoized);
|
||||
})
|
||||
.pipe(
|
||||
map((value) => {
|
||||
if (value instanceof Error) {
|
||||
throw value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}),
|
||||
publishReplay(1),
|
||||
refCount()
|
||||
return new Observable((observer: Observer<any>): Function => {
|
||||
const fn = section[name];
|
||||
const callback = this.createReplayCallback(observer);
|
||||
const subscribe = fn(...params, callback).catch((error) =>
|
||||
observer.next(error)
|
||||
);
|
||||
|
||||
return this.createReplayUnsub(fn, subscribe, params, memoized);
|
||||
})
|
||||
.pipe(
|
||||
map((value) => {
|
||||
if (value instanceof Error) {
|
||||
throw value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}),
|
||||
publishReplay(1),
|
||||
refCount()
|
||||
);
|
||||
}
|
||||
|
||||
private createReplayCallback (observer: Observer<any>) {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/types": "^0.43.5",
|
||||
"@polkadot/util": "^0.34.12"
|
||||
"@polkadot/util": "^0.34.15"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-jsonrpc#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0"
|
||||
"@babel/runtime": "^7.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@polkadot/keyring": "^0.34.12",
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/keyring": "^0.34.15",
|
||||
"@polkadot/types": "^0.43.5",
|
||||
"@polkadot/util": "^0.34.12",
|
||||
"@polkadot/util-crypto": "^0.34.12"
|
||||
"@polkadot/util": "^0.34.15",
|
||||
"@polkadot/util-crypto": "^0.34.15"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@polkadot/keyring": "^0.34.12",
|
||||
"@polkadot/util": "^0.34.12",
|
||||
"core-js": "^2.6.2"
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"@polkadot/keyring": "^0.34.15",
|
||||
"@polkadot/util": "^0.34.15",
|
||||
"core-js": "^2.6.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ export default class Struct<
|
||||
this._Types = (Object
|
||||
.keys(Types) as Array<keyof S>)
|
||||
.reduce((result: E, key) => {
|
||||
result[key] = Types[key].name;
|
||||
// TS2322: Type 'string' is not assignable to type 'E[keyof S]'.
|
||||
(result as any)[key] = Types[key].name;
|
||||
|
||||
return result;
|
||||
}, {} as E);
|
||||
@@ -76,7 +77,8 @@ export default class Struct<
|
||||
|
||||
// Transform array of values to {key: value} mapping
|
||||
return Object.keys(Types).reduce((raw: T, key: keyof S, index) => {
|
||||
raw[key] = values[index];
|
||||
// TS2322: Type 'Codec' is not assignable to type 'T[keyof S]'.
|
||||
(raw as any)[key] = values[index];
|
||||
return raw;
|
||||
}, {} as T);
|
||||
} else if (!value) {
|
||||
@@ -104,7 +106,8 @@ export default class Struct<
|
||||
} else if (value instanceof Map) {
|
||||
const mapped = value.get(jsonKey);
|
||||
|
||||
raw[key] = mapped instanceof Types[key]
|
||||
// TS2322: Type 'Codec' is not assignable to type 'T[keyof S]'.
|
||||
(raw as any)[key] = mapped instanceof Types[key]
|
||||
? mapped
|
||||
: new Types[key](mapped);
|
||||
} else if (isObject(value)) {
|
||||
|
||||
Reference in New Issue
Block a user