From 0c4cc51f74babcfaaa40e8f6e8f8b5162908bab2 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 24 Sep 2020 18:48:24 +0200 Subject: [PATCH] Perbill formatting with rawType equality (#2646) * Perbill formatting with rawType equality * Balance toHuman() check * Formatter lookup * typing * Merge * Better Compact detection --- packages/api-contract/package.json | 2 +- packages/api-derive/package.json | 6 +- packages/api/package.json | 8 +-- packages/metadata/package.json | 6 +- packages/rpc-core/package.json | 4 +- packages/rpc-provider/package.json | 6 +- packages/typegen/package.json | 2 +- .../typegen/src/generate/interfaceRegistry.ts | 7 +- packages/typegen/src/generate/query.ts | 6 +- packages/typegen/src/generate/rpc.ts | 2 +- packages/typegen/src/generate/tx.ts | 2 +- packages/typegen/src/util/derived.ts | 12 ++-- packages/types-known/package.json | 2 +- packages/types/package.json | 6 +- packages/types/src/augment/registry.ts | 12 ++++ packages/types/src/codec/AbstractInt.ts | 30 +++++--- packages/types/src/codec/UInt.spec.ts | 7 ++ .../src/interfaces/runtime/definitions.ts | 12 ++-- .../types/src/interfaces/runtime/types.ts | 14 ++-- yarn.lock | 70 +++++++++---------- 20 files changed, 123 insertions(+), 93 deletions(-) diff --git a/packages/api-contract/package.json b/packages/api-contract/package.json index 2dcceb3102..d7ed8bff3c 100644 --- a/packages/api-contract/package.json +++ b/packages/api-contract/package.json @@ -30,7 +30,7 @@ "@polkadot/api": "1.35.0-beta.8", "@polkadot/rpc-core": "1.35.0-beta.8", "@polkadot/types": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", "bn.js": "^5.1.3", "rxjs": "^6.6.3" } diff --git a/packages/api-derive/package.json b/packages/api-derive/package.json index a022aa7890..ada8958f5d 100644 --- a/packages/api-derive/package.json +++ b/packages/api-derive/package.json @@ -32,13 +32,13 @@ "@polkadot/rpc-core": "1.35.0-beta.8", "@polkadot/rpc-provider": "1.35.0-beta.8", "@polkadot/types": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", - "@polkadot/util-crypto": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", + "@polkadot/util-crypto": "^3.5.0-beta.13", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "devDependencies": { - "@polkadot/keyring": "^3.5.0-beta.12" + "@polkadot/keyring": "^3.5.0-beta.13" } } diff --git a/packages/api/package.json b/packages/api/package.json index bee093525c..a4fcd699d8 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -28,19 +28,19 @@ "dependencies": { "@babel/runtime": "^7.11.2", "@polkadot/api-derive": "1.35.0-beta.8", - "@polkadot/keyring": "^3.5.0-beta.12", + "@polkadot/keyring": "^3.5.0-beta.13", "@polkadot/metadata": "1.35.0-beta.8", "@polkadot/rpc-core": "1.35.0-beta.8", "@polkadot/rpc-provider": "1.35.0-beta.8", "@polkadot/types": "1.35.0-beta.8", "@polkadot/types-known": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", - "@polkadot/util-crypto": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", + "@polkadot/util-crypto": "^3.5.0-beta.13", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7", "rxjs": "^6.6.3" }, "devDependencies": { - "@polkadot/keyring": "^3.5.0-beta.12" + "@polkadot/keyring": "^3.5.0-beta.13" } } diff --git a/packages/metadata/package.json b/packages/metadata/package.json index 4d83c78dfa..67f8881682 100644 --- a/packages/metadata/package.json +++ b/packages/metadata/package.json @@ -29,11 +29,11 @@ "@babel/runtime": "^7.11.2", "@polkadot/types": "1.35.0-beta.8", "@polkadot/types-known": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", - "@polkadot/util-crypto": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", + "@polkadot/util-crypto": "^3.5.0-beta.13", "bn.js": "^5.1.3" }, "devDependencies": { - "@polkadot/keyring": "^3.5.0-beta.12" + "@polkadot/keyring": "^3.5.0-beta.13" } } diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index 125f933156..4c7df6019a 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -30,11 +30,11 @@ "@polkadot/metadata": "1.35.0-beta.8", "@polkadot/rpc-provider": "1.35.0-beta.8", "@polkadot/types": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "devDependencies": { - "@polkadot/keyring": "^3.5.0-beta.12" + "@polkadot/keyring": "^3.5.0-beta.13" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index 103a81dc22..60b067bc89 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -29,15 +29,15 @@ "@babel/runtime": "^7.11.2", "@polkadot/metadata": "1.35.0-beta.8", "@polkadot/types": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", - "@polkadot/util-crypto": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", + "@polkadot/util-crypto": "^3.5.0-beta.13", "@polkadot/x-fetch": "^0.3.2", "@polkadot/x-ws": "^0.3.2", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7" }, "devDependencies": { - "@polkadot/keyring": "^3.5.0-beta.12", + "@polkadot/keyring": "^3.5.0-beta.13", "mock-socket": "^9.0.3", "nock": "^13.0.4" } diff --git a/packages/typegen/package.json b/packages/typegen/package.json index 2270060ba4..dbd044b063 100644 --- a/packages/typegen/package.json +++ b/packages/typegen/package.json @@ -40,7 +40,7 @@ "@polkadot/metadata": "1.35.0-beta.8", "@polkadot/rpc-provider": "1.35.0-beta.8", "@polkadot/types": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", "handlebars": "^4.7.6", "websocket": "^1.0.32", "yargs": "^16.0.3" diff --git a/packages/typegen/src/generate/interfaceRegistry.ts b/packages/typegen/src/generate/interfaceRegistry.ts index fa99acc25f..85cd47f57d 100644 --- a/packages/typegen/src/generate/interfaceRegistry.ts +++ b/packages/typegen/src/generate/interfaceRegistry.ts @@ -4,6 +4,7 @@ import Handlebars from 'handlebars'; import Raw from '@polkadot/types/codec/Raw'; +import { TypeRegistry } from '@polkadot/types/create'; import * as defaultDefinitions from '@polkadot/types/interfaces/definitions'; import * as defaultPrimitives from '@polkadot/types/primitive'; @@ -20,6 +21,8 @@ const generateInterfaceTypesTemplate = Handlebars.compile(template); /** @internal */ export function generateInterfaceTypes (importDefinitions: { [importPath: string]: Record }, dest: string): void { + const registry = new TypeRegistry(); + writeFile(dest, (): string => { Object.entries(importDefinitions).reduce((acc, def) => Object.assign(acc, def), {}); @@ -34,7 +37,7 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string .forEach((primitiveName) => { setImports(definitions, imports, [primitiveName]); - items.push(...getDerivedTypes(definitions, primitiveName, primitiveName, imports)); + items.push(...getDerivedTypes(registry, definitions, primitiveName, primitiveName, imports)); }); const existingTypes: Record = {}; @@ -47,7 +50,7 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string uniqueTypes.forEach((type) => { existingTypes[type] = true; - items.push(...getDerivedTypes(definitions, type, types[type] as string, imports)); + items.push(...getDerivedTypes(registry, definitions, type, types[type] as string, imports)); }); }); diff --git a/packages/typegen/src/generate/query.ts b/packages/typegen/src/generate/query.ts index 41c43f7585..6d2b2878a3 100644 --- a/packages/typegen/src/generate/query.ts +++ b/packages/typegen/src/generate/query.ts @@ -28,7 +28,7 @@ function entrySignature (allDefs: Record, registry: Registr return ['', formatType(allDefs, outputType, imports)]; } else if (storageEntry.type.isMap) { // Find similar types of the `key` type - const similarTypes = getSimilarTypes(allDefs, registry, storageEntry.type.asMap.key.toString(), imports); + const similarTypes = getSimilarTypes(registry, allDefs, storageEntry.type.asMap.key.toString(), imports); setImports(allDefs, imports, [ ...similarTypes, @@ -41,8 +41,8 @@ function entrySignature (allDefs: Record, registry: Registr ]; } else if (storageEntry.type.isDoubleMap) { // Find similar types of `key1` and `key2` types - const similarTypes1 = getSimilarTypes(allDefs, registry, storageEntry.type.asDoubleMap.key1.toString(), imports); - const similarTypes2 = getSimilarTypes(allDefs, registry, storageEntry.type.asDoubleMap.key2.toString(), imports); + const similarTypes1 = getSimilarTypes(registry, allDefs, storageEntry.type.asDoubleMap.key1.toString(), imports); + const similarTypes2 = getSimilarTypes(registry, allDefs, storageEntry.type.asDoubleMap.key2.toString(), imports); setImports(allDefs, imports, [ ...similarTypes1, diff --git a/packages/typegen/src/generate/rpc.ts b/packages/typegen/src/generate/rpc.ts index b497d20a90..b03e00ae27 100644 --- a/packages/typegen/src/generate/rpc.ts +++ b/packages/typegen/src/generate/rpc.ts @@ -69,7 +69,7 @@ export function generateRpcTypes (importDefinitions: { [importPath: string]: Rec setImports(allDefs, imports, [def.type]); args = def.params.map((param) => { - const similarTypes = getSimilarTypes(definitions, registry, param.type, imports); + const similarTypes = getSimilarTypes(registry, definitions, param.type, imports); setImports(allDefs, imports, [param.type, ...similarTypes]); diff --git a/packages/typegen/src/generate/tx.ts b/packages/typegen/src/generate/tx.ts index dc971f2682..84428a210c 100644 --- a/packages/typegen/src/generate/tx.ts +++ b/packages/typegen/src/generate/tx.ts @@ -48,7 +48,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr const params = args .map(({ name, type }) => { const typeStr = type.toString(); - const similarTypes = getSimilarTypes(allDefs, registry, typeStr, imports).map((type): string => formatType(allDefs, type, imports)); + const similarTypes = getSimilarTypes(registry, allDefs, typeStr, imports).map((type): string => formatType(allDefs, type, imports)); const nameStr = mapName(name); setImports(allDefs, imports, [...similarTypes.filter((type): boolean => !type.startsWith('(') && !type.startsWith('{')), typeStr]); diff --git a/packages/typegen/src/util/derived.ts b/packages/typegen/src/util/derived.ts index 6a31bc11c9..aa88cd9d7a 100644 --- a/packages/typegen/src/util/derived.ts +++ b/packages/typegen/src/util/derived.ts @@ -33,9 +33,9 @@ const voteConvictions = arrayToStrType(AllConvictions); // From `T`, generate `Compact, Option, Vec` /** @internal */ -export function getDerivedTypes (definitions: Record, type: string, primitiveName: string, imports: TypeImports): string[] { +export function getDerivedTypes (registry: Registry, definitions: Record, type: string, primitiveName: string, imports: TypeImports): string[] { // `primitiveName` represents the actual primitive type our type is mapped to - const isCompact = isCompactEncodable((primitiveClasses as Record)[primitiveName]); + const isCompact = isCompactEncodable((primitiveClasses as Record)[primitiveName] || ClassOfUnsafe(registry, type)); const def = getTypeDef(type); setImports(definitions, imports, ['Option', 'Vec', isCompact ? 'Compact' : '']); @@ -72,7 +72,7 @@ export function getDerivedTypes (definitions: Record, type: // - if param instanceof AbstractInt, then param: u64 | Uint8array | AnyNumber // etc /** @internal */ -export function getSimilarTypes (definitions: Record, registry: Registry, _type: string, imports: TypeImports): string[] { +export function getSimilarTypes (registry: Registry, definitions: Record, _type: string, imports: TypeImports): string[] { const typeParts = _type.split('::'); const type = typeParts[typeParts.length - 1]; const possibleTypes = [type]; @@ -97,10 +97,10 @@ export function getSimilarTypes (definitions: Record, regis // this could be that we define a Vec type and refer to it by name if (subDef) { if (subDef.info === TypeDefInfo.Plain) { - possibleTypes.push(`(${getSimilarTypes(definitions, registry, subDef.type, imports).join(' | ')})[]`); + possibleTypes.push(`(${getSimilarTypes(registry, definitions, subDef.type, imports).join(' | ')})[]`); } else if (subDef.info === TypeDefInfo.Tuple) { const subs = (subDef.sub as TypeDef[]).map(({ type }): string => - getSimilarTypes(definitions, registry, type, imports).join(' | ') + getSimilarTypes(registry, definitions, type, imports).join(' | ') ); possibleTypes.push(`([${subs.join(', ')}])[]`); @@ -149,7 +149,7 @@ export function getSimilarTypes (definitions: Record, regis // this could be that we define a Tuple type and refer to it by name if (Array.isArray(subDef)) { - const subs = subDef.map(({ type }) => getSimilarTypes(definitions, registry, type, imports).join(' | ')); + const subs = subDef.map(({ type }) => getSimilarTypes(registry, definitions, type, imports).join(' | ')); possibleTypes.push(`[${subs.join(', ')}]`); } diff --git a/packages/types-known/package.json b/packages/types-known/package.json index 1f13c48580..7d5c9933db 100644 --- a/packages/types-known/package.json +++ b/packages/types-known/package.json @@ -28,7 +28,7 @@ "dependencies": { "@babel/runtime": "^7.11.2", "@polkadot/types": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", "bn.js": "^5.1.3" }, "devDependencies": { diff --git a/packages/types/package.json b/packages/types/package.json index 240d3e6526..018c283b81 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -28,15 +28,15 @@ "dependencies": { "@babel/runtime": "^7.11.2", "@polkadot/metadata": "1.35.0-beta.8", - "@polkadot/util": "^3.5.0-beta.12", - "@polkadot/util-crypto": "^3.5.0-beta.12", + "@polkadot/util": "^3.5.0-beta.13", + "@polkadot/util-crypto": "^3.5.0-beta.13", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "devDependencies": { - "@polkadot/keyring": "^3.5.0-beta.12", + "@polkadot/keyring": "^3.5.0-beta.13", "@types/memoizee": "^0.4.4" } } diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index 0b7741a7d3..a95900235b 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -137,6 +137,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; FixedU64: FixedU64; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; Fixed128: Fixed128; @@ -146,12 +147,14 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; FixedU128: FixedU128; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; I32F32: I32F32; 'Option': Option; 'Vec': Vec; U32F32: U32F32; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; PerU16: PerU16; @@ -181,6 +184,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; AccountIndex: AccountIndex; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; Address: Address; @@ -195,6 +199,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; BalanceOf: BalanceOf; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; Block: Block; @@ -217,6 +222,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; ConsensusEngineId: ConsensusEngineId; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; Digest: Digest; @@ -855,6 +861,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; SchedulePriority: SchedulePriority; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; Scheduled: Scheduled; @@ -980,6 +987,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; MomentOf: MomentOf; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; Nominations: Nominations; @@ -993,6 +1001,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; OffchainAccuracy: OffchainAccuracy; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; OffchainAccuracyCompact: OffchainAccuracyCompact; @@ -1301,9 +1310,11 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; LeasePeriod: LeasePeriod; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; LeasePeriodOf: LeasePeriodOf; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; LocalValidationData: LocalValidationData; @@ -1329,6 +1340,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Vec': Vec; RelayChainBlockNumber: RelayChainBlockNumber; + 'Compact': Compact; 'Option': Option; 'Vec': Vec; Remark: Remark; diff --git a/packages/types/src/codec/AbstractInt.ts b/packages/types/src/codec/AbstractInt.ts index bbb53794b9..354233f9a8 100644 --- a/packages/types/src/codec/AbstractInt.ts +++ b/packages/types/src/codec/AbstractInt.ts @@ -13,10 +13,15 @@ export type UIntBitLength = 8 | 16 | 32 | 64 | 128 | 256; export const DEFAULT_UINT_BITS = 64; -const PER_B = new BN(1_000_000_000); -const PER_M = new BN(1_000_000); const MUL_P = new BN(1_00_00); +const FORMATTERS: [string, BN][] = [ + ['Perquintill', new BN(1_000_000_000_000)], + ['Perbill', new BN(1_000_000_000)], + ['Permill', new BN(1_000_000)], + ['Percent', new BN(100)] +]; + function toPercentage (value: BN, divisor: BN): string { return `${(value.mul(MUL_P).div(divisor).toNumber() / 100).toFixed(2)}%`; } @@ -168,16 +173,19 @@ export default abstract class AbstractInt extends BN implements Codec { */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public toHuman (isExpanded?: boolean): string { - // FIXME we need proper expansion here - return this instanceof this.registry.createClass('Balance') - ? this.isMax() + const rawType = this.toRawType(); + + if (rawType === 'Balance') { + return this.isMax() ? 'everything' - : formatBalance(this, { decimals: this.registry.chainDecimals, withSi: true, withUnit: this.registry.chainToken }) - : this instanceof this.registry.createClass('Perbill') - ? toPercentage(this, PER_B) - : this instanceof this.registry.createClass('Permill') - ? toPercentage(this, PER_M) - : formatNumber(this); + : formatBalance(this, { decimals: this.registry.chainDecimals, withSi: true, withUnit: this.registry.chainToken }); + } + + const [, divisor] = FORMATTERS.find(([type]) => type === rawType) || []; + + return divisor + ? toPercentage(this, divisor) + : formatNumber(this); } /** diff --git a/packages/types/src/codec/UInt.spec.ts b/packages/types/src/codec/UInt.spec.ts index 5e5fd6dc0a..0077b99361 100644 --- a/packages/types/src/codec/UInt.spec.ts +++ b/packages/types/src/codec/UInt.spec.ts @@ -119,5 +119,12 @@ describe('UInt', (): void => { new (UInt.with(64, 'SomethingElse'))(registry).toRawType() ).toEqual('SomethingElse'); }); + + it('has proper toHuman() for PerMill/PerBill/Percent/Balance', (): void => { + expect(registry.createType('Perbill', 12_340_000).toHuman()).toEqual('1.23%'); + expect(registry.createType('Percent', 12).toHuman()).toEqual('12.00%'); + expect(registry.createType('Permill', 16_900).toHuman()).toEqual('1.69%'); + expect(registry.createType('Balance', '123456789012345').toHuman()).toEqual('123.456 Unit'); + }); }); }); diff --git a/packages/types/src/interfaces/runtime/definitions.ts b/packages/types/src/interfaces/runtime/definitions.ts index ca38c084d5..9bbfd16bfe 100644 --- a/packages/types/src/interfaces/runtime/definitions.ts +++ b/packages/types/src/interfaces/runtime/definitions.ts @@ -15,11 +15,11 @@ const numberTypes = { FixedU128: 'UInt<128, FixedU128>', I32F32: 'Int<64, I32F32>', U32F32: 'UInt<64, U32F32>', - PerU16: 'u16', - Perbill: 'u32', - Percent: 'u8', - Permill: 'u32', - Perquintill: 'u64' + PerU16: 'UInt<16, PerU16>', + Perbill: 'UInt<32, Perbill>', + Percent: 'UInt<8, Percent>', + Permill: 'UInt<32, Permill>', + Perquintill: 'UInt<64, Perquintill>' }; export default { @@ -31,7 +31,7 @@ export default { AccountIndex: 'GenericAccountIndex', Address: 'GenericAddress', AssetId: 'u32', - Balance: 'u128', + Balance: 'UInt<128, Balance>', BalanceOf: 'Balance', Block: 'GenericBlock', BlockNumber: 'u32', diff --git a/packages/types/src/interfaces/runtime/types.ts b/packages/types/src/interfaces/runtime/types.ts index b41be103d1..b441fa7b86 100644 --- a/packages/types/src/interfaces/runtime/types.ts +++ b/packages/types/src/interfaces/runtime/types.ts @@ -4,7 +4,7 @@ import { ITuple } from '@polkadot/types/types'; import { Compact, Enum, Int, Struct, U8aFixed, UInt, Vec } from '@polkadot/types/codec'; import { GenericAccountId, GenericAccountIndex, GenericBlock, GenericCall, GenericConsensusEngineId, GenericLookupSource } from '@polkadot/types/generic'; -import { Bytes, DoNotConstruct, Null, StorageKey, u128, u16, u32, u64, u8 } from '@polkadot/types/primitive'; +import { Bytes, DoNotConstruct, Null, StorageKey, u32, u64 } from '@polkadot/types/primitive'; import { AuthorityId } from '@polkadot/types/interfaces/consensus'; import { Signature } from '@polkadot/types/interfaces/extrinsics'; @@ -24,7 +24,7 @@ export interface Address extends GenericAddress {} export interface AssetId extends u32 {} /** @name Balance */ -export interface Balance extends u128 {} +export interface Balance extends UInt {} /** @name BalanceOf */ export interface BalanceOf extends Balance {} @@ -170,19 +170,19 @@ export interface Pays extends Enum { } /** @name Perbill */ -export interface Perbill extends u32 {} +export interface Perbill extends UInt {} /** @name Percent */ -export interface Percent extends u8 {} +export interface Percent extends UInt {} /** @name Permill */ -export interface Permill extends u32 {} +export interface Permill extends UInt {} /** @name Perquintill */ -export interface Perquintill extends u64 {} +export interface Perquintill extends UInt {} /** @name PerU16 */ -export interface PerU16 extends u16 {} +export interface PerU16 extends UInt {} /** @name Phantom */ export interface Phantom extends Null {} diff --git a/yarn.lock b/yarn.lock index 28ac751d6d..366928f817 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2759,7 +2759,7 @@ __metadata: "@polkadot/api": 1.35.0-beta.8 "@polkadot/rpc-core": 1.35.0-beta.8 "@polkadot/types": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 bn.js: ^5.1.3 rxjs: ^6.6.3 languageName: unknown @@ -2771,12 +2771,12 @@ __metadata: dependencies: "@babel/runtime": ^7.11.2 "@polkadot/api": 1.35.0-beta.8 - "@polkadot/keyring": ^3.5.0-beta.12 + "@polkadot/keyring": ^3.5.0-beta.13 "@polkadot/rpc-core": 1.35.0-beta.8 "@polkadot/rpc-provider": 1.35.0-beta.8 "@polkadot/types": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 - "@polkadot/util-crypto": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 + "@polkadot/util-crypto": ^3.5.0-beta.13 bn.js: ^5.1.3 memoizee: ^0.4.14 rxjs: ^6.6.3 @@ -2789,14 +2789,14 @@ __metadata: dependencies: "@babel/runtime": ^7.11.2 "@polkadot/api-derive": 1.35.0-beta.8 - "@polkadot/keyring": ^3.5.0-beta.12 + "@polkadot/keyring": ^3.5.0-beta.13 "@polkadot/metadata": 1.35.0-beta.8 "@polkadot/rpc-core": 1.35.0-beta.8 "@polkadot/rpc-provider": 1.35.0-beta.8 "@polkadot/types": 1.35.0-beta.8 "@polkadot/types-known": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 - "@polkadot/util-crypto": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 + "@polkadot/util-crypto": ^3.5.0-beta.13 bn.js: ^5.1.3 eventemitter3: ^4.0.7 rxjs: ^6.6.3 @@ -2899,14 +2899,14 @@ __metadata: languageName: node linkType: hard -"@polkadot/keyring@npm:^3.5.0-beta.12": - version: 3.5.0-beta.12 - resolution: "@polkadot/keyring@npm:3.5.0-beta.12" +"@polkadot/keyring@npm:^3.5.0-beta.13": + version: 3.5.0-beta.13 + resolution: "@polkadot/keyring@npm:3.5.0-beta.13" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/util": 3.5.0-beta.12 - "@polkadot/util-crypto": 3.5.0-beta.12 - checksum: 63a1d8cff1f982b4936e6bfb1d8b98920f6f47924f0b231de63d419d3974f31dd8a34716f444837647564bde44a332495ae66b806f4439fc661ff7ac72f8b47c + "@polkadot/util": 3.5.0-beta.13 + "@polkadot/util-crypto": 3.5.0-beta.13 + checksum: bbdeaa9e334d271c882e14368403b9e460a37d34e7f086ed104d7df0c8fdd10eb152223f4e43e761cd0e63b058bf616b4e37fd25284c66a39fd7a23686b773ca languageName: node linkType: hard @@ -2915,11 +2915,11 @@ __metadata: resolution: "@polkadot/metadata@workspace:packages/metadata" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/keyring": ^3.5.0-beta.12 + "@polkadot/keyring": ^3.5.0-beta.13 "@polkadot/types": 1.35.0-beta.8 "@polkadot/types-known": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 - "@polkadot/util-crypto": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 + "@polkadot/util-crypto": ^3.5.0-beta.13 bn.js: ^5.1.3 languageName: unknown linkType: soft @@ -2929,11 +2929,11 @@ __metadata: resolution: "@polkadot/rpc-core@workspace:packages/rpc-core" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/keyring": ^3.5.0-beta.12 + "@polkadot/keyring": ^3.5.0-beta.13 "@polkadot/metadata": 1.35.0-beta.8 "@polkadot/rpc-provider": 1.35.0-beta.8 "@polkadot/types": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 memoizee: ^0.4.14 rxjs: ^6.6.3 languageName: unknown @@ -2944,11 +2944,11 @@ __metadata: resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/keyring": ^3.5.0-beta.12 + "@polkadot/keyring": ^3.5.0-beta.13 "@polkadot/metadata": 1.35.0-beta.8 "@polkadot/types": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 - "@polkadot/util-crypto": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 + "@polkadot/util-crypto": ^3.5.0-beta.13 "@polkadot/x-fetch": ^0.3.2 "@polkadot/x-ws": ^0.3.2 bn.js: ^5.1.3 @@ -2978,7 +2978,7 @@ __metadata: "@polkadot/metadata": 1.35.0-beta.8 "@polkadot/rpc-provider": 1.35.0-beta.8 "@polkadot/types": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 "@types/websocket": ^1.0.1 "@types/yargs": ^15.0.7 handlebars: ^4.7.6 @@ -2999,7 +2999,7 @@ __metadata: dependencies: "@babel/runtime": ^7.11.2 "@polkadot/types": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 "@types/bn.js": ^4.11.6 bn.js: ^5.1.3 languageName: unknown @@ -3010,10 +3010,10 @@ __metadata: resolution: "@polkadot/types@workspace:packages/types" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/keyring": ^3.5.0-beta.12 + "@polkadot/keyring": ^3.5.0-beta.13 "@polkadot/metadata": 1.35.0-beta.8 - "@polkadot/util": ^3.5.0-beta.12 - "@polkadot/util-crypto": ^3.5.0-beta.12 + "@polkadot/util": ^3.5.0-beta.13 + "@polkadot/util-crypto": ^3.5.0-beta.13 "@types/bn.js": ^4.11.6 "@types/memoizee": ^0.4.4 bn.js: ^5.1.3 @@ -3022,12 +3022,12 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/util-crypto@npm:3.5.0-beta.12, @polkadot/util-crypto@npm:^3.5.0-beta.12": - version: 3.5.0-beta.12 - resolution: "@polkadot/util-crypto@npm:3.5.0-beta.12" +"@polkadot/util-crypto@npm:3.5.0-beta.13, @polkadot/util-crypto@npm:^3.5.0-beta.13": + version: 3.5.0-beta.13 + resolution: "@polkadot/util-crypto@npm:3.5.0-beta.13" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/util": 3.5.0-beta.12 + "@polkadot/util": 3.5.0-beta.13 "@polkadot/wasm-crypto": ^1.4.1 base-x: ^3.0.8 bip39: ^3.0.2 @@ -3039,13 +3039,13 @@ __metadata: scryptsy: ^2.1.0 tweetnacl: ^1.0.3 xxhashjs: ^0.2.2 - checksum: f366a1826fd05e4396e1adb97353b0bf18a26cb94c7786115c7096f735e528db56fa83b106e3785cd1672c6c44cda3bb4d1c03046d8416c7ee1a7196be6e8800 + checksum: db9222d3b067f349ec9ee711af115be5e035c4b7a30e9b11f9f2a26b0ecc17d38f79f15896ec9f7445475c7cfa0a8b78170f1d8bd55bdfaadfa03c8ada4f778c languageName: node linkType: hard -"@polkadot/util@npm:3.5.0-beta.12, @polkadot/util@npm:^3.5.0-beta.12": - version: 3.5.0-beta.12 - resolution: "@polkadot/util@npm:3.5.0-beta.12" +"@polkadot/util@npm:3.5.0-beta.13, @polkadot/util@npm:^3.5.0-beta.13": + version: 3.5.0-beta.13 + resolution: "@polkadot/util@npm:3.5.0-beta.13" dependencies: "@babel/runtime": ^7.11.2 "@polkadot/x-textdecoder": ^0.3.2 @@ -3055,7 +3055,7 @@ __metadata: camelcase: ^5.3.1 chalk: ^4.1.0 ip-regex: ^4.1.0 - checksum: ad4513479c9b9ed20cb06eae999663c98b1fddf7c2116d7c57d02d722264cb8be100561aa9a2bd6c12cde1f464e4c410f9f1a3d8a1a4c7c1696e35e68c9f7b4d + checksum: c720fa6410a8b7e8771bb12f39eab703f49b207fc19a8c654d455381594f6bd22151d7193fc74a6177622f47bfc6a20122823d94a3ea10ed2606b6d42f0ba88b languageName: node linkType: hard