Adjust inspect for ExtrinsicPayload (#4862)

* Adjust inspect for ExtrinsicPayload

* Adjust
This commit is contained in:
Jaco
2022-05-27 13:30:15 +03:00
committed by GitHub
parent 4166cb7fa5
commit 63c58538dc
6 changed files with 59 additions and 8 deletions
+6 -4
View File
@@ -54,13 +54,15 @@ export class Bytes extends Raw {
/**
* @description Returns a breakdown of the hex encoding for this Codec
*/
override inspect (): Inspect {
override inspect (isBare?: boolean): Inspect {
const clength = compactToU8a(this.length);
return {
outer: this.length
? [clength, super.toU8a()]
: [clength]
outer: isBare
? [super.toU8a()]
: this.length
? [clength, super.toU8a()]
: [clength]
};
}
+6 -2
View File
@@ -231,12 +231,16 @@ export class Struct<
/**
* @description Returns a breakdown of the hex encoding for this Codec
*/
inspect (): Inspect {
inspect (isBare?: BareOpts): Inspect {
const inner = new Array<Inspect>();
for (const [k, v] of this.entries()) {
inner.push({
...v.inspect(),
...v.inspect(
!isBare || isBoolean(isBare)
? isBare
: isBare[k]
),
name: stringCamelCase(k as string)
});
}
+1 -1
View File
@@ -60,7 +60,7 @@ export interface Codec {
/**
* @description Returns a breakdown of the hex encoding for this Codec
*/
inspect (): Inspect;
inspect (isBare?: BareOpts): Inspect;
/**
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation