Bump common (#1879)
* Bump common * Add documentation to extended call * TODO for toHuman event * CHANGELOG
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
- The `@polkadot/types/codec/create` has been moved to `@polkadot/types/create`, imports from `@polkadot/types` are unaffected
|
||||
- Expose chain properies on registry (and use for API type formatting)
|
||||
- Add `toHuman(isExtended?: boolean)` to all codec types, formatting into a human-readable structure
|
||||
|
||||
# 1.2.1 Feb 16, 2020
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"@polkadot/api": "^1.3.0-beta.8",
|
||||
"@polkadot/rpc-core": "^1.3.0-beta.8",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"bn.js": "^5.1.1",
|
||||
"rxjs": "^6.5.4"
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
"@polkadot/rpc-core": "^1.3.0-beta.8",
|
||||
"@polkadot/rpc-provider": "^1.3.0-beta.8",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util-crypto": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.4.0-beta.0",
|
||||
"bn.js": "^5.1.1",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.3.1"
|
||||
"@polkadot/keyring": "^2.4.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/api-derive": "^1.3.0-beta.8",
|
||||
"@polkadot/keyring": "^2.3.1",
|
||||
"@polkadot/keyring": "^2.4.0-beta.0",
|
||||
"@polkadot/metadata": "^1.3.0-beta.8",
|
||||
"@polkadot/rpc-core": "^1.3.0-beta.8",
|
||||
"@polkadot/rpc-provider": "^1.3.0-beta.8",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util-crypto": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.4.0-beta.0",
|
||||
"bn.js": "^5.1.1",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"rxjs": "^6.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.3.1"
|
||||
"@polkadot/keyring": "^2.4.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1"
|
||||
"@polkadot/util": "^2.4.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util-crypto": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.4.0-beta.0",
|
||||
"bn.js": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.3.1"
|
||||
"@polkadot/keyring": "^2.4.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@
|
||||
"@polkadot/metadata": "^1.3.0-beta.8",
|
||||
"@polkadot/rpc-provider": "^1.3.0-beta.8",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.3.1"
|
||||
"@polkadot/keyring": "^2.4.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,15 +30,15 @@
|
||||
"@polkadot/jsonrpc": "^1.3.0-beta.8",
|
||||
"@polkadot/metadata": "^1.3.0-beta.8",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util-crypto": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.4.0-beta.0",
|
||||
"bn.js": "^5.1.1",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"websocket": "^1.0.31"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.3.1",
|
||||
"@polkadot/keyring": "^2.4.0-beta.0",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^11.8.2"
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"@polkadot/jsonrpc": "^1.3.0-beta.8",
|
||||
"@polkadot/metadata": "^1.3.0-beta.8",
|
||||
"@polkadot/types": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"websocket": "^1.0.31",
|
||||
"yargs": "^15.1.0"
|
||||
},
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/metadata": "^1.3.0-beta.8",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"@polkadot/util-crypto": "^2.3.1",
|
||||
"@polkadot/util": "^2.4.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.4.0-beta.0",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^5.1.1",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.3.1",
|
||||
"@polkadot/keyring": "^2.4.0-beta.0",
|
||||
"@types/memoizee": "^0.4.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export default class UInt extends AbstractInt {
|
||||
public toHuman (isExpanded?: boolean): any {
|
||||
// FIXME we need proper expansion here
|
||||
return this instanceof ClassOf(this.registry, 'Balance')
|
||||
? formatBalance(this, { withSi: true, withUnit: true })
|
||||
? formatBalance(this, { withSi: true, withUnit: this.registry.chainToken }, this.registry.chainDecimals)
|
||||
: super.toHuman(isExpanded);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ChainProperties, DispatchErrorModule } from '../interfaces/types';
|
||||
import { CallFunction, Codec, Constructor, InterfaceTypes, RegistryError, RegistryTypes, Registry, RegistryMetadata, TypeDef } from '../types';
|
||||
|
||||
import extrinsicsFromMeta from '@polkadot/metadata/Decorated/extrinsics/fromMetadata';
|
||||
import { assert, isFunction, isString, isU8a, isUndefined, stringCamelCase, u8aToHex } from '@polkadot/util';
|
||||
import { assert, formatBalance, isFunction, isString, isU8a, isUndefined, stringCamelCase, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import Raw from '../codec/Raw';
|
||||
import { EventData } from '../primitive/Generic/Event';
|
||||
@@ -121,7 +121,7 @@ export class TypeRegistry implements Registry {
|
||||
public get chainToken (): string {
|
||||
return this._chainProperties?.tokenSymbol.isSome
|
||||
? this._chainProperties.tokenSymbol.unwrap().toString()
|
||||
: 'DEV';
|
||||
: formatBalance.getDefaults().unit;
|
||||
}
|
||||
|
||||
// find a specific call
|
||||
|
||||
@@ -215,7 +215,11 @@ export default class Call extends Struct implements IMethod {
|
||||
callIndex: u8aToHex(this.callIndex),
|
||||
section: call?.section,
|
||||
method: call?.method,
|
||||
args: this.args.map((arg) => arg.toHuman(isExpanded))
|
||||
args: this.args.map((arg) => arg.toHuman(isExpanded)),
|
||||
...(isExpanded && call
|
||||
? { documentation: call.meta.documentation.map((d) => d.toString()) }
|
||||
: {}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { TypeDef } from '../../create/types';
|
||||
import { EventMetadataLatest } from '../../interfaces/metadata';
|
||||
import { EventId } from '../../interfaces/system';
|
||||
import { Constructor, Registry, RegistryMetadataEvent } from '../../types';
|
||||
import { AnyJsonObject, Constructor, Registry, RegistryMetadataEvent } from '../../types';
|
||||
|
||||
import Struct from '../../codec/Struct';
|
||||
import Tuple from '../../codec/Tuple';
|
||||
@@ -141,4 +141,13 @@ export default class Event extends Struct {
|
||||
public get typeDef (): TypeDef[] {
|
||||
return this.data.typeDef;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public toHuman (isExpanded?: boolean): AnyJsonObject {
|
||||
// FIXME May this human-friendly
|
||||
return this.toJSON();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2077,14 +2077,14 @@
|
||||
webpack-cli "^3.3.11"
|
||||
yargs "^15.1.0"
|
||||
|
||||
"@polkadot/keyring@^2.3.1":
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-2.3.1.tgz#64ed052760c6ebf3e71a2413a0f362d8522d0060"
|
||||
integrity sha512-MvkyR/ohYAsSQrSEVBo6w/S5S9i4AEPYGNqPOyR7erEJD3YQjZhJJkJx23w6XsbWr0XDfzJG9SQ5uq585DIi4g==
|
||||
"@polkadot/keyring@^2.4.0-beta.0":
|
||||
version "2.4.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-2.4.0-beta.0.tgz#d43996daf38c53b35eccd3016246726a26c7b483"
|
||||
integrity sha512-dv4wonHpWnXDNHyidWdKzXZQnDesxQWWbATbDeZUv4P1Hwbn4zpa8+nQoRuKi7v5OmFJvm0Ailb84/sWQweoYA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.8.4"
|
||||
"@polkadot/util" "^2.3.1"
|
||||
"@polkadot/util-crypto" "^2.3.1"
|
||||
"@polkadot/util" "^2.4.0-beta.0"
|
||||
"@polkadot/util-crypto" "^2.4.0-beta.0"
|
||||
|
||||
"@polkadot/ts@^0.2.3":
|
||||
version "0.2.3"
|
||||
@@ -2093,13 +2093,13 @@
|
||||
dependencies:
|
||||
"@types/chrome" "^0.0.95"
|
||||
|
||||
"@polkadot/util-crypto@^2.3.1":
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-2.3.1.tgz#e95bace6ef59408657df1068f8044766744f453c"
|
||||
integrity sha512-I9lKhheW/cWeFSs5NBgiw5WkkfAsceEzW4/eWf/s39TLVueUnOiXG/+fcaRHBZmBDMhK9Mc2FxvLn2Df6YQGUg==
|
||||
"@polkadot/util-crypto@^2.4.0-beta.0":
|
||||
version "2.4.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-2.4.0-beta.0.tgz#a821c29835ca6e23b0db6faecf3edc263fac75fb"
|
||||
integrity sha512-fc6g5GNGDv1QbIeaa5BaBvdXQHmkBmsydVoZEzE49YLPHA142WzM1dof0SuP5/C/K6O11oq3yP9Ns7H+lWJf2g==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.8.4"
|
||||
"@polkadot/util" "^2.3.1"
|
||||
"@polkadot/util" "^2.4.0-beta.0"
|
||||
"@polkadot/wasm-crypto" "^1.0.1"
|
||||
base-x "^3.0.7"
|
||||
bip39 "^3.0.2"
|
||||
@@ -2112,10 +2112,10 @@
|
||||
tweetnacl "^1.0.3"
|
||||
xxhashjs "^0.2.2"
|
||||
|
||||
"@polkadot/util@^2.3.1":
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-2.3.1.tgz#ea4142386e66db14eae78c8fda4fb62693cf072a"
|
||||
integrity sha512-g00HThGm0t1sciOxDKuqnSsh6fyGUKtazVac0v58fMOtbX0geTu0TpddRdFav/L5KO6lkq8DBFUQW95x9Cf4gw==
|
||||
"@polkadot/util@^2.4.0-beta.0":
|
||||
version "2.4.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-2.4.0-beta.0.tgz#2a289a1a9da1f59b1e07399252fdf8fbe2bf5d76"
|
||||
integrity sha512-mSC/NSpqImx45f9FWf6qjzjqDpRnF1v7dfeRfRxkPGX94zrRRS/jTjPbPmOhnbfA3+vokShq3/t3DvESwYH9ZQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.8.4"
|
||||
bn.js "^5.1.1"
|
||||
|
||||
Reference in New Issue
Block a user