v0.77.100

This commit is contained in:
ian.he
2019-05-27 15:46:27 +12:00
parent 116714a8f9
commit daaa16523d
4 changed files with 50 additions and 10 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
{
"version": "0.77.1",
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=10.13.0",
@@ -13,20 +13,20 @@
"typescript": "^3.4.3"
},
"scripts": {
"build": "polkadot-dev-build-ts && yarn run build:methodsdoc && polkadot-dev-build-docs",
"build": "plugnet-dev-build-ts && yarn run build:methodsdoc",
"build:htmldoc": "yarn clean && typedoc --theme default --out docs/html",
"build:methodsdoc": "node packages/types/src/scripts/MetadataMdWrapper.js",
"check": "yarn lint",
"lint": "tslint --project . && tsc --noEmit --pretty",
"clean": "polkadot-dev-clean-build",
"postinstall": "polkadot-dev-yarn-only",
"clean": "plugnet-dev-clean-build",
"postinstall": "plugnet-dev-yarn-only",
"test": "jest --coverage"
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/register": "^7.4.0",
"@babel/runtime": "^7.4.3",
"@polkadot/dev": "^0.30.0-beta.1",
"@plugnet/dev": "^0.30.1",
"@polkadot/ts": "^0.1.56",
"gh-pages": "^2.0.1"
}
+1 -1
View File
@@ -10,7 +10,7 @@ import Api from '../../src/promise';
import WsProvider from '../../../rpc-provider/src/ws';
import SingleAccountSigner from "../util/SingleAccountSigner";
describe('e2e transactions', () => {
describe.skip('e2e transactions', () => {
const keyring = testingPairs({ type: 'ed25519' });
let api;
+22 -2
View File
@@ -11,6 +11,7 @@ import Vector from '../../codec/Vector';
import Bytes from '../../primitive/Bytes';
import Text from '../../primitive/Text';
import Type from '../../primitive/Type';
import { DoubleMapType } from '../v4/Storage';
export class StorageFunctionModifier extends Enum {
constructor (value?: any) {
@@ -69,14 +70,22 @@ export class MapType extends Struct {
export class PlainType extends Type {
}
export class StorageFunctionType extends EnumType<PlainType | MapType> {
export class StorageFunctionType extends EnumType<PlainType | MapType | DoubleMapType> {
constructor (value?: any, index?: number) {
super({
PlainType,
MapType
MapType,
DoubleMapType
}, value, index);
}
/**
* @description `true` if the storage entry is a doublemap
*/
get isDoubleMap (): boolean {
return this.toNumber() === 2;
}
/**
* @description `true` if the storage entry is a map
*/
@@ -84,6 +93,13 @@ export class StorageFunctionType extends EnumType<PlainType | MapType> {
return this.toNumber() === 1;
}
/**
* @description The value as a double mapped value
*/
get asDoubleMap (): DoubleMapType {
return this.value as DoubleMapType;
}
/**
* @description The value as a mapped value
*/
@@ -102,6 +118,10 @@ export class StorageFunctionType extends EnumType<PlainType | MapType> {
* @description Returns the string representation of the value
*/
toString (): string {
if (this.isDoubleMap) {
return this.asDoubleMap.value.toString();
}
if (this.isMap) {
if (this.asMap.isLinked) {
return `(${this.asMap.value.toString()}, Linkage<${this.asMap.key.toString()}>)`;
+22 -2
View File
@@ -2,6 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { DoubleMapType } from './../v4/Storage';
import { AnyNumber } from '../../types';
import EnumType from '../../codec/EnumType';
@@ -50,14 +52,22 @@ export class MapType extends Struct {
}
}
export class StorageFunctionType extends EnumType<PlainType | MapType> {
export class StorageFunctionType extends EnumType<PlainType | MapType | DoubleMapType> {
constructor (value?: any, index?: number) {
super({
PlainType,
MapType
MapType,
DoubleMapType
}, value, index);
}
/**
* @description `true` if the storage entry is a doublemap
*/
get isDoubleMap (): boolean {
return this.toNumber() === 2;
}
/**
* @description `true` if the storage entry is a map
*/
@@ -65,6 +75,13 @@ export class StorageFunctionType extends EnumType<PlainType | MapType> {
return this.toNumber() === 1;
}
/**
* @description The value as a double mapped value
*/
get asDoubleMap (): DoubleMapType {
return this.value as DoubleMapType;
}
/**
* @description The value as a mapped value
*/
@@ -83,6 +100,9 @@ export class StorageFunctionType extends EnumType<PlainType | MapType> {
* @description Returns the string representation of the value
*/
toString (): string {
if (this.isDoubleMap) {
return this.asDoubleMap.value.toString();
}
return this.isMap
? this.asMap.value.toString()
: this.asType.toString();