Skip to content

Commit ca7edf1

Browse files
authored
1.0 (#1781)
* 1.0 * signAsync typing * Merge master
1 parent 59e069f commit ca7edf1

File tree

14 files changed

+85
-81
lines changed

14 files changed

+85
-81
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# 1.0.0-beta-x
1+
# 1.0.1
22

33
- **Breaking change** Drop support for Substrate v1 chain in all derives
4-
- Add `polkadot-types-from-chain` & `polkadot-types-from-defs` TypeScript generators (`@polkadot/types` bin)
4+
- Return unsub functions from provider .on emitters (Thanks to https://github.com/jak-pan)
5+
- Add `polkadot-types-from-chain` & `polkadot-types-from-defs` TypeScript generators to `@polkadot/types`
56
- Only decorate derives where relevant parent `api.query.*` is available
67
- Support `.entries(arg?: any)` lookups on DoubleMaps (in addition to previously supported maps)
78
- Remove un-deployed support for v11 metadata (this was decided against on Substrate)
@@ -12,6 +13,7 @@
1213
- Don't map empy tuples, e.. `()` to `Null`, rather keep them empty
1314
- Add lookups to the metadata erros via `findMetaError`
1415
- Update metadata and types for the lastest Substrate & Polkadot versions
16+
- Support metadata V11 as per lastest Substrate
1517
- Remove old known types for Substrate V1
1618

1719
# 0.100.1

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"packages": [
1010
"packages/*"
1111
],
12-
"version": "1.0.0-beta.44"
12+
"version": "1.0.0"
1313
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@babel/core": "^7.8.3",
3030
"@babel/register": "^7.8.3",
3131
"@babel/runtime": "^7.8.3",
32-
"@polkadot/dev": "^0.33.1",
32+
"@polkadot/dev": "^0.33.3",
3333
"@polkadot/ts": "^0.2.1"
3434
}
3535
}

packages/api-contract/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api-contract",
3-
"version": "1.0.0-beta.44",
3+
"version": "1.0.0",
44
"description": "Interfaces for interacting with contracts and contract ABIs",
55
"main": "index.js",
66
"keywords": [
@@ -27,6 +27,6 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.3",
30-
"@polkadot/types": "^1.0.0-beta.44"
30+
"@polkadot/types": "^1.0.0"
3131
}
3232
}

packages/api-derive/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api-derive",
3-
"version": "1.0.0-beta.44",
3+
"version": "1.0.0",
44
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
55
"main": "index.js",
66
"keywords": [
@@ -28,10 +28,10 @@
2828
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
2929
"dependencies": {
3030
"@babel/runtime": "^7.8.3",
31-
"@polkadot/api": "^1.0.0-beta.44",
32-
"@polkadot/types": "^1.0.0-beta.44"
31+
"@polkadot/api": "^1.0.0",
32+
"@polkadot/types": "^1.0.0"
3333
},
3434
"devDependencies": {
35-
"@polkadot/keyring": "^2.0.0-beta.10"
35+
"@polkadot/keyring": "^2.0.1"
3636
}
3737
}

packages/api/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api",
3-
"version": "1.0.0-beta.44",
3+
"version": "1.0.0",
44
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
55
"main": "index.js",
66
"keywords": [
@@ -30,15 +30,15 @@
3030
},
3131
"dependencies": {
3232
"@babel/runtime": "^7.8.3",
33-
"@polkadot/api-derive": "^1.0.0-beta.44",
34-
"@polkadot/keyring": "^2.0.0-beta.10",
35-
"@polkadot/metadata": "^1.0.0-beta.44",
36-
"@polkadot/rpc-core": "^1.0.0-beta.44",
37-
"@polkadot/rpc-provider": "^1.0.0-beta.44",
38-
"@polkadot/types": "^1.0.0-beta.44",
39-
"@polkadot/util-crypto": "^2.0.0-beta.10"
33+
"@polkadot/api-derive": "^1.0.0",
34+
"@polkadot/keyring": "^2.0.1",
35+
"@polkadot/metadata": "^1.0.0",
36+
"@polkadot/rpc-core": "^1.0.0",
37+
"@polkadot/rpc-provider": "^1.0.0",
38+
"@polkadot/types": "^1.0.0",
39+
"@polkadot/util-crypto": "^2.0.1"
4040
},
4141
"devDependencies": {
42-
"@polkadot/keyring": "^2.0.0-beta.10"
42+
"@polkadot/keyring": "^2.0.1"
4343
}
4444
}

packages/api/src/submittable/createClass.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// This software may be modified and distributed under the terms
44
// of the Apache-2.0 license. See the LICENSE file for details.
55

6-
import { AccountId, Address, Call, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
6+
import { Address, Call, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
77
import { Callback, Codec, Constructor, IKeyringPair, Registry, SignatureOptions } from '@polkadot/types/types';
88
import { ApiInterfaceRx, ApiTypes, SignerResult } from '../types';
9-
import { SignerOptions, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultImpl, SubmittableResultResult, SubmittableResultSubscription, SubmittableThis } from './types';
9+
import { AddressOrPair, SignerOptions, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultImpl, SubmittableResultResult, SubmittableResultSubscription, SubmittableThis } from './types';
1010

1111
import { Observable, combineLatest, of } from 'rxjs';
1212
import { first, map, mapTo, mergeMap, switchMap, tap } from 'rxjs/operators';
@@ -50,7 +50,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
5050
}
5151

5252
// calculate the payment info for this transaction (if signed and submitted)
53-
public paymentInfo (account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType> {
53+
public paymentInfo (account: AddressOrPair, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType> {
5454
const [allOptions] = this._makeSignAndSendOptions(options);
5555
const address = isKeyringPair(account) ? account.address : account.toString();
5656

@@ -82,24 +82,24 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
8282
// signs a transaction, returning `this` to allow chaining. E.g.: `sign(...).send()`
8383
//
8484
// also supports signing through external signers
85-
public signAsync (account: IKeyringPair | string | AccountId | Address, optionsOrNonce: Partial<SignerOptions>): SubmittableThis<ApiType, this> {
85+
public signAsync (account: AddressOrPair, optionsOrNonce: Partial<SignerOptions>): SubmittableThis<ApiType, this> {
8686
return this._decorateMethod(
8787
(): Observable<this> =>
8888
this._signObservable(account, optionsOrNonce).pipe(mapTo(this))
8989
)();
9090
}
9191

9292
// signAndSend with an immediate Hash result
93-
public signAndSend (account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
93+
public signAndSend (account: AddressOrPair, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
9494

9595
// signAndSend with a subscription, i.e. callback provided
96-
public signAndSend (account: IKeyringPair | string | AccountId | Address, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
96+
public signAndSend (account: AddressOrPair, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
9797

9898
// signAndSend with options and a callback
99-
public signAndSend (account: IKeyringPair | string | AccountId | Address, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
99+
public signAndSend (account: AddressOrPair, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
100100

101101
// signAndSend implementation for all 3 cases above
102-
public signAndSend (account: IKeyringPair | string | AccountId | Address, optionsOrStatus?: Partial<SignerOptions> | Callback<SubmittableResultImpl>, optionalStatusCb?: Callback<SubmittableResultImpl>): SubmittableResultResult<ApiType> | SubmittableResultSubscription<ApiType> {
102+
public signAndSend (account: AddressOrPair, optionsOrStatus?: Partial<SignerOptions> | Callback<SubmittableResultImpl>, optionalStatusCb?: Callback<SubmittableResultImpl>): SubmittableResultResult<ApiType> | SubmittableResultSubscription<ApiType> {
103103
const [options, statusCb] = this._makeSignAndSendOptions(optionsOrStatus, optionalStatusCb);
104104
const isSubscription = this._api.hasSubscriptions && (this._ignoreStatusCb || !!statusCb);
105105

@@ -144,7 +144,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
144144
return [options, statusCb];
145145
}
146146

147-
private _signObservable (account: IKeyringPair | string | AccountId | Address, optionsOrNonce: Partial<SignerOptions>): Observable<number | undefined> {
147+
private _signObservable (account: AddressOrPair, optionsOrNonce: Partial<SignerOptions>): Observable<number | undefined> {
148148
const address = isKeyringPair(account) ? account.address : account.toString();
149149
const options = this._optionsOrNonce(optionsOrNonce);
150150
let updateId: number | undefined;
@@ -164,7 +164,7 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
164164
);
165165
}
166166

167-
private async _signViaSigner (address: | string | AccountId | Address, options: SignatureOptions, header: Header | null): Promise<number> {
167+
private async _signViaSigner (address: Address | string | Uint8Array, options: SignatureOptions, header: Header | null): Promise<number> {
168168
const signer = options.signer || this._api.signer;
169169

170170
assert(signer, 'No signer specified, either via api.setSigner or via sign options');

packages/api/src/submittable/types.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,22 @@ export interface SignerOptions {
5252
tip?: AnyNumber;
5353
}
5454

55+
export type AddressOrPair = IKeyringPair | string | AccountId | Address;
56+
5557
export interface SubmittableExtrinsic<ApiType extends ApiTypes> extends IExtrinsic {
56-
paymentInfo (account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType>;
58+
paymentInfo (account: AddressOrPair, options?: Partial<SignerOptions>): SubmittablePaymentResult<ApiType>;
5759

5860
send(): SubmittableResultResult<ApiType>;
5961

6062
send(statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
6163

6264
sign(account: IKeyringPair, _options: Partial<SignatureOptions>): this;
6365

64-
signAsync(account: IKeyringPair, _options: Partial<SignatureOptions>): SubmittableThis<ApiType, this>;
66+
signAsync(account: AddressOrPair, _options: Partial<SignatureOptions>): SubmittableThis<ApiType, this>;
6567

66-
signAndSend(account: IKeyringPair | string | AccountId | Address, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
68+
signAndSend(account: AddressOrPair, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
6769

68-
signAndSend(account: IKeyringPair | string | AccountId | Address, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
70+
signAndSend(account: AddressOrPair, statusCb: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
6971

70-
signAndSend(account: IKeyringPair | string | AccountId | Address, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
72+
signAndSend(account: AddressOrPair, options: Partial<SignerOptions>, statusCb?: Callback<SubmittableResultImpl>): SubmittableResultSubscription<ApiType>;
7173
}

packages/metadata/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/metadata",
3-
"version": "1.0.0-beta.44",
3+
"version": "1.0.0",
44
"description": "Helpers to extract information from runtime metadata",
55
"main": "index.js",
66
"publishConfig": {
@@ -27,11 +27,11 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.3",
30-
"@polkadot/types": "^1.0.0-beta.44",
31-
"@polkadot/util": "^2.0.0-beta.10",
32-
"@polkadot/util-crypto": "^2.0.0-beta.10"
30+
"@polkadot/types": "^1.0.0",
31+
"@polkadot/util": "^2.0.1",
32+
"@polkadot/util-crypto": "^2.0.1"
3333
},
3434
"devDependencies": {
35-
"@polkadot/keyring": "^2.0.0-beta.10"
35+
"@polkadot/keyring": "^2.0.1"
3636
}
3737
}

packages/rpc-core/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/rpc-core",
3-
"version": "1.0.0-beta.44",
3+
"version": "1.0.0",
44
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
55
"main": "index.js",
66
"keywords": [
@@ -27,10 +27,10 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.3",
30-
"@polkadot/jsonrpc": "^1.0.0-beta.44",
31-
"@polkadot/rpc-provider": "^1.0.0-beta.44",
32-
"@polkadot/types": "^1.0.0-beta.44",
33-
"@polkadot/util": "^2.0.0-beta.10",
30+
"@polkadot/jsonrpc": "^1.0.0",
31+
"@polkadot/rpc-provider": "^1.0.0",
32+
"@polkadot/types": "^1.0.0",
33+
"@polkadot/util": "^2.0.1",
3434
"rxjs": "^6.5.4"
3535
}
3636
}

0 commit comments

Comments
 (0)