* 1.0

* signAsync typing

* Merge master
This commit is contained in:
Jaco Greeff
2020-01-30 16:59:04 +01:00
committed by GitHub
parent 59e069f091
commit ca7edf1593
14 changed files with 85 additions and 81 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -27,6 +27,6 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/types": "^1.0.0-beta.44"
"@polkadot/types": "^1.0.0"
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -28,10 +28,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/api": "^1.0.0-beta.44",
"@polkadot/types": "^1.0.0-beta.44"
"@polkadot/api": "^1.0.0",
"@polkadot/types": "^1.0.0"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.0-beta.10"
"@polkadot/keyring": "^2.0.1"
}
}
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -30,15 +30,15 @@
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/api-derive": "^1.0.0-beta.44",
"@polkadot/keyring": "^2.0.0-beta.10",
"@polkadot/metadata": "^1.0.0-beta.44",
"@polkadot/rpc-core": "^1.0.0-beta.44",
"@polkadot/rpc-provider": "^1.0.0-beta.44",
"@polkadot/types": "^1.0.0-beta.44",
"@polkadot/util-crypto": "^2.0.0-beta.10"
"@polkadot/api-derive": "^1.0.0",
"@polkadot/keyring": "^2.0.1",
"@polkadot/metadata": "^1.0.0",
"@polkadot/rpc-core": "^1.0.0",
"@polkadot/rpc-provider": "^1.0.0",
"@polkadot/types": "^1.0.0",
"@polkadot/util-crypto": "^2.0.1"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.0-beta.10"
"@polkadot/keyring": "^2.0.1"
}
}
+10 -10
View File
@@ -3,10 +3,10 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Address, Call, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
import { Address, Call, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
import { Callback, Codec, Constructor, IKeyringPair, Registry, SignatureOptions } from '@polkadot/types/types';
import { ApiInterfaceRx, ApiTypes, SignerResult } from '../types';
import { SignerOptions, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultImpl, SubmittableResultResult, SubmittableResultSubscription, SubmittableThis } from './types';
import { AddressOrPair, SignerOptions, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultImpl, SubmittableResultResult, SubmittableResultSubscription, SubmittableThis } from './types';
import { Observable, combineLatest, of } from 'rxjs';
import { first, map, mapTo, mergeMap, switchMap, tap } from 'rxjs/operators';
@@ -50,7 +50,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
}
// calculate the payment info for this transaction (if signed and submitted)
public paymentInfo (account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType> {
public paymentInfo (account: AddressOrPair, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType> {
const [allOptions] = this._makeSignAndSendOptions(options);
const address = isKeyringPair(account) ? account.address : account.toString();
@@ -82,7 +82,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
// signs a transaction, returning `this` to allow chaining. E.g.: `sign(...).send()`
//
// also supports signing through external signers
public signAsync (account: IKeyringPair | string | AccountId | Address, optionsOrNonce: Partial<SignerOptions>): SubmittableThis<ApiType, this> {
public signAsync (account: AddressOrPair, optionsOrNonce: Partial<SignerOptions>): SubmittableThis<ApiType, this> {
return this._decorateMethod(
(): Observable<this> =>
this._signObservable(account, optionsOrNonce).pipe(mapTo(this))
@@ -90,16 +90,16 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
}
// signAndSend with an immediate Hash result
public signAndSend (account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
public signAndSend (account: AddressOrPair, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
// signAndSend with a subscription, i.e. callback provided
public signAndSend (account: IKeyringPair | string | AccountId | Address, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
public signAndSend (account: AddressOrPair, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
// signAndSend with options and a callback
public signAndSend (account: IKeyringPair | string | AccountId | Address, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
public signAndSend (account: AddressOrPair, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
// signAndSend implementation for all 3 cases above
public signAndSend (account: IKeyringPair | string | AccountId | Address, optionsOrStatus?: Partial<SignerOptions> | Callback<SubmittableResultImpl>, optionalStatusCb?: Callback<SubmittableResultImpl>): SubmittableResultResult<ApiType> | SubmittableResultSubscription<ApiType> {
public signAndSend (account: AddressOrPair, optionsOrStatus?: Partial<SignerOptions> | Callback<SubmittableResultImpl>, optionalStatusCb?: Callback<SubmittableResultImpl>): SubmittableResultResult<ApiType> | SubmittableResultSubscription<ApiType> {
const [options, statusCb] = this._makeSignAndSendOptions(optionsOrStatus, optionalStatusCb);
const isSubscription = this._api.hasSubscriptions && (this._ignoreStatusCb || !!statusCb);
@@ -144,7 +144,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
return [options, statusCb];
}
private _signObservable (account: IKeyringPair | string | AccountId | Address, optionsOrNonce: Partial<SignerOptions>): Observable<number | undefined> {
private _signObservable (account: AddressOrPair, optionsOrNonce: Partial<SignerOptions>): Observable<number | undefined> {
const address = isKeyringPair(account) ? account.address : account.toString();
const options = this._optionsOrNonce(optionsOrNonce);
let updateId: number | undefined;
@@ -164,7 +164,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
);
}
private async _signViaSigner (address: | string | AccountId | Address, options: SignatureOptions, header: Header | null): Promise<number> {
private async _signViaSigner (address: Address | string | Uint8Array, options: SignatureOptions, header: Header | null): Promise<number> {
const signer = options.signer || this._api.signer;
assert(signer, 'No signer specified, either via api.setSigner or via sign options');
+7 -5
View File
@@ -52,8 +52,10 @@ export interface SignerOptions {
tip?: AnyNumber;
}
export type AddressOrPair = IKeyringPair | string | AccountId | Address;
export interface SubmittableExtrinsic<ApiType extends ApiTypes> extends IExtrinsic {
paymentInfo (account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType>;
paymentInfo (account: AddressOrPair, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType>;
send(): SubmittableResultResult<ApiType>;
@@ -61,11 +63,11 @@ export interface SubmittableExtrinsic<ApiType extends ApiTypes> extends IExtrins
sign(account: IKeyringPair, _options: Partial<SignatureOptions>): this;
signAsync(account: IKeyringPair, _options: Partial<SignatureOptions>): SubmittableThis<ApiType, this>;
signAsync(account: AddressOrPair, _options: Partial<SignatureOptions>): SubmittableThis<ApiType, this>;
signAndSend(account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
signAndSend(account: AddressOrPair, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
signAndSend(account: IKeyringPair | string | AccountId | Address, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
signAndSend(account: AddressOrPair, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
signAndSend(account: IKeyringPair | string | AccountId | Address, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
signAndSend(account: AddressOrPair, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -27,11 +27,11 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/types": "^1.0.0-beta.44",
"@polkadot/util": "^2.0.0-beta.10",
"@polkadot/util-crypto": "^2.0.0-beta.10"
"@polkadot/types": "^1.0.0",
"@polkadot/util": "^2.0.1",
"@polkadot/util-crypto": "^2.0.1"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.0-beta.10"
"@polkadot/keyring": "^2.0.1"
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,10 +27,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/jsonrpc": "^1.0.0-beta.44",
"@polkadot/rpc-provider": "^1.0.0-beta.44",
"@polkadot/types": "^1.0.0-beta.44",
"@polkadot/util": "^2.0.0-beta.10",
"@polkadot/jsonrpc": "^1.0.0",
"@polkadot/rpc-provider": "^1.0.0",
"@polkadot/types": "^1.0.0",
"@polkadot/util": "^2.0.1",
"rxjs": "^6.5.4"
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -27,15 +27,15 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/metadata": "^1.0.0-beta.44",
"@polkadot/util": "^2.0.0-beta.10",
"@polkadot/util-crypto": "^2.0.0-beta.10",
"@polkadot/metadata": "^1.0.0",
"@polkadot/util": "^2.0.1",
"@polkadot/util-crypto": "^2.0.1",
"eventemitter3": "^4.0.0",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.0-beta.10",
"@polkadot/keyring": "^2.0.1",
"mock-socket": "^9.0.3",
"nock": "^11.7.2"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"publishConfig": {
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.0.0-beta.44",
"version": "1.0.0",
"description": "Implementation of the Parity codec",
"main": "index.js",
"bin": {
@@ -34,14 +34,14 @@
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/metadata": "^1.0.0-beta.44",
"@polkadot/util": "^2.0.0-beta.10",
"@polkadot/util-crypto": "^2.0.0-beta.10",
"@polkadot/metadata": "^1.0.0",
"@polkadot/util": "^2.0.1",
"@polkadot/util-crypto": "^2.0.1",
"memoizee": "^0.4.14",
"yargs": "^15.1.0"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.0-beta.10",
"@polkadot/keyring": "^2.0.1",
"@types/memoizee": "^0.4.3",
"@types/yargs": "^15.0.2"
}