Expand Data (from identity) with all is/as getters (#3429)

This commit is contained in:
Jaco
2021-04-23 07:34:01 +02:00
committed by GitHub
parent 90d8db651b
commit 5903704b61
2 changed files with 30 additions and 1 deletions
+28
View File
@@ -59,6 +59,14 @@ export class Data extends Enum {
}, ...decodeData(registry, value));
}
get asBlakeTwo256 (): H256 {
return this.value as H256;
}
get asKeccak256 (): H256 {
return this.value as H256;
}
get asRaw (): Bytes {
return this.value as Bytes;
}
@@ -67,6 +75,22 @@ export class Data extends Enum {
return this.value as H256;
}
get asShaThree256 (): H256 {
return this.value as H256;
}
get isBlakeTwo256 (): boolean {
return this.index === 2;
}
get isKeccak256 (): boolean {
return this.index === 4;
}
get isNone (): boolean {
return this.index === 0;
}
get isRaw (): boolean {
return this.index === 1;
}
@@ -75,6 +99,10 @@ export class Data extends Enum {
return this.index === 3;
}
get isShaThree256 (): boolean {
return this.index === 5;
}
/**
* @description The encoded length
*/