Expand Data (from identity) with all is/as getters (#3429)
This commit is contained in:
+2
-1
@@ -7,7 +7,8 @@ Changes:
|
||||
- Adjust Struct decoding with better error messages on invalid input objects
|
||||
- Add support for new `BoundedVec` type
|
||||
- Adjusted Statemint `Proxy` type
|
||||
- Updated Xcm types (with Plularity)
|
||||
- Expand `Data` type (as used in identity), with all is/as getters
|
||||
- Updated `Xcm` types (with Plularity)
|
||||
- Remove metadata generation dependency on well-known.json (dedupe)
|
||||
- Adjust WebSocket reconnection delay from 1s to 2.5s
|
||||
- Revert Beefy keys addition for Westend
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user