Rename inspect() to inspectU8a() (#5425)
* Rename inspect() to inspectU8a() * Additional adjustments
This commit is contained in:
+4
-1
@@ -2,10 +2,13 @@
|
||||
|
||||
## master
|
||||
|
||||
- **Breaking change** The `Codec.inspect()` call has been renamed to `Codec.inspectU8a()`. This should not only have a minor impact on (very limited) users since the functionality is not used in general operation, but rather only in specialized tools that wish the inspect the actual bytes encoding.
|
||||
|
||||
Changes:
|
||||
|
||||
- Add `$isStorageFallback` on the `Codec` interface. (`true` if entry was created from a metadata fallback value from an empty storage item)
|
||||
- Rename `initialU8aLength/createdAtHash` to `$initialU8aLength/$createdAtHash` on the `Codec` interface. (these are marked for internal usage)
|
||||
- Prefix `isEmpty/initialU8aLength/createdAtHash` with `$` on the `Codec` interface, e.g. `$isEmpty`. (The original interface getters has been marked as deprecated, aill warn, but is available)
|
||||
- Rename `inspect()` to `inspectU8a()` on `Codec` interfaces
|
||||
|
||||
|
||||
## 9.11.3 Jan 15, 2023
|
||||
|
||||
@@ -98,7 +98,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
inner: this.inspectInner(),
|
||||
outer: [compactToU8a(this.length)]
|
||||
@@ -109,7 +109,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
const inner = new Array<Inspect>(this.length);
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
inner[i] = this[i].inspect();
|
||||
inner[i] = this[i].inspectU8a();
|
||||
}
|
||||
|
||||
return inner;
|
||||
|
||||
@@ -75,8 +75,8 @@ export abstract class AbstractBase<T extends Codec> implements Codec {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
return this.#raw.inspect();
|
||||
public inspectU8a (): Inspect {
|
||||
return this.#raw.inspectU8a();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -170,7 +170,7 @@ export abstract class AbstractInt extends BN implements INumber {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [this.toU8a()]
|
||||
};
|
||||
|
||||
@@ -98,7 +98,7 @@ describe('Compact', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new (Compact.with(U32))(registry, 0xffff).inspect()
|
||||
new (Compact.with(U32))(registry, 0xffff).inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([254, 255, 3, 0])]
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ export class Compact<T extends INumber> implements ICompact<T> {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [this.toU8a()]
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ export class DoNotConstruct implements Codec {
|
||||
throw this.#neverError;
|
||||
}
|
||||
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
throw this.#neverError;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ describe('Enum', (): void => {
|
||||
registry,
|
||||
{ Text, U32 },
|
||||
'0x0134120000'
|
||||
).inspect()
|
||||
).inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([0x01]), new Uint8Array([0x34, 0x12, 0x00, 0x00])]
|
||||
});
|
||||
|
||||
@@ -380,12 +380,12 @@ export class Enum implements IEnum {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
if (this.$isBasic) {
|
||||
return { outer: [new Uint8Array([this.index])] };
|
||||
}
|
||||
|
||||
const { inner, outer = [] } = this.#raw.inspect();
|
||||
const { inner, outer = [] } = this.#raw.inspectU8a();
|
||||
|
||||
return {
|
||||
inner,
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('Int', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new Int(registry, '0x12', 16).inspect()
|
||||
new Int(registry, '0x12', 16).inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([0x12, 0x00])]
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@ export class Null implements Codec {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ describe('Option', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new Option(registry, U32, '1234').inspect()
|
||||
new Option(registry, U32, '1234').inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([0x01]), new Uint8Array([210, 4, 0, 0])]
|
||||
});
|
||||
|
||||
@@ -180,12 +180,12 @@ export class Option<T extends Codec> implements IOption<T> {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
if (this.isNone) {
|
||||
return { outer: [new Uint8Array([0])] };
|
||||
}
|
||||
|
||||
const { inner, outer = [] } = this.#raw.inspect();
|
||||
const { inner, outer = [] } = this.#raw.inspectU8a();
|
||||
|
||||
return {
|
||||
inner,
|
||||
|
||||
@@ -123,7 +123,7 @@ describe('Tuple', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
tuple.inspect()
|
||||
tuple.inspectU8a()
|
||||
).toEqual({
|
||||
inner: [
|
||||
{ outer: [new Uint8Array([7 << 2]), stringToU8a('bazzing')] },
|
||||
|
||||
@@ -115,7 +115,7 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public override inspect (): Inspect {
|
||||
public override inspectU8a (): Inspect {
|
||||
return {
|
||||
inner: this.inspectInner()
|
||||
};
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('UInt', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new UInt(registry, '0x12', 16).inspect()
|
||||
new UInt(registry, '0x12', 16).inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([0x12, 0x00])]
|
||||
});
|
||||
|
||||
@@ -185,7 +185,7 @@ describe('Vec', (): void => {
|
||||
];
|
||||
const vec = registry.createType('Vec<AccountId>', addrs);
|
||||
|
||||
expect(vec.inspect()).toEqual({
|
||||
expect(vec.inspectU8a()).toEqual({
|
||||
inner: addrs.map((a) => ({
|
||||
outer: [decodeAddress(a)]
|
||||
})),
|
||||
|
||||
@@ -62,7 +62,7 @@ describe('VecFixed', (): void => {
|
||||
});
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(test.inspect()).toEqual({
|
||||
expect(test.inspectU8a()).toEqual({
|
||||
inner: [
|
||||
{ outer: [new Uint8Array([1 << 2]), stringToU8a('1')] },
|
||||
{ outer: [new Uint8Array([1 << 2]), stringToU8a('2')] },
|
||||
|
||||
@@ -76,7 +76,7 @@ export class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public override inspect (): Inspect {
|
||||
public override inspectU8a (): Inspect {
|
||||
return {
|
||||
inner: this.inspectInner()
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ describe('BTreeMap', (): void => {
|
||||
[new Text(registry, '1'), new Text(registry, 'foo')],
|
||||
[new Text(registry, '2'), new Text(registry, 'bar')],
|
||||
[new Text(registry, '3'), new Text(registry, 'baz')]
|
||||
])).inspect()
|
||||
])).inspectU8a()
|
||||
).toEqual({
|
||||
inner: [
|
||||
{ outer: [new Uint8Array([1 << 2]), stringToU8a('1')] },
|
||||
|
||||
@@ -209,7 +209,7 @@ describe('BTreeSet', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new (BTreeSet.with(U32))(registry, [1, 2, 3, 4]).inspect()
|
||||
new (BTreeSet.with(U32))(registry, [1, 2, 3, 4]).inspectU8a()
|
||||
).toEqual({
|
||||
inner: [
|
||||
{ outer: [new Uint8Array([1, 0, 0, 0])] },
|
||||
|
||||
@@ -155,11 +155,11 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
const inner = new Array<Inspect>();
|
||||
|
||||
for (const v of this.values()) {
|
||||
inner.push(v.inspect());
|
||||
inner.push(v.inspectU8a());
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('BitVec', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new BitVec(registry, '0x0837').inspect()
|
||||
new BitVec(registry, '0x0837').inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([0]), new Uint8Array([0x08, 0x37])]
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ export class BitVec extends Raw {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public override inspect (): Inspect {
|
||||
public override inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [compactToU8a(this.#decodedLength), super.toU8a()]
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('Bytes', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new Bytes(registry, '0x12345678').inspect()
|
||||
new Bytes(registry, '0x12345678').inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([4 << 2]), new Uint8Array([0x12, 0x34, 0x56, 0x78])]
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ export class Bytes extends Raw {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public override inspect (isBare?: boolean): Inspect {
|
||||
public override inspectU8a (isBare?: boolean): Inspect {
|
||||
const clength = compactToU8a(this.length);
|
||||
|
||||
return {
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('HashMap', (): void => {
|
||||
new (HashMap.with(Text, Text))(registry, new Map([
|
||||
[new Text(registry, '1'), new Text(registry, 'foo')],
|
||||
[new Text(registry, '2'), new Text(registry, 'bar')]
|
||||
])).inspect()
|
||||
])).inspectU8a()
|
||||
).toEqual({
|
||||
inner: [
|
||||
{ outer: [new Uint8Array([1 << 2]), stringToU8a('1')] },
|
||||
|
||||
@@ -107,7 +107,7 @@ describe('CodecMap', (): void => {
|
||||
new CodecMap(registry, Text, Text, new Map([
|
||||
[new Text(registry, '1'), new Text(registry, 'foo')],
|
||||
[new Text(registry, '2'), new Text(registry, 'bar')]
|
||||
])).inspect()
|
||||
])).inspectU8a()
|
||||
).toEqual({
|
||||
inner: [
|
||||
{ outer: [new Uint8Array([1 << 2]), stringToU8a('1')] },
|
||||
|
||||
@@ -168,12 +168,12 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
const inner = new Array<Inspect>();
|
||||
|
||||
for (const [k, v] of this.entries()) {
|
||||
inner.push(k.inspect());
|
||||
inner.push(v.inspect());
|
||||
inner.push(k.inspectU8a());
|
||||
inner.push(v.inspectU8a());
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('OptionBool', (): void => {
|
||||
});
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(new OptionBool(registry, true).inspect()).toEqual({
|
||||
expect(new OptionBool(registry, true).inspectU8a()).toEqual({
|
||||
outer: [new Uint8Array([1])]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ export class OptionBool extends Option<Bool> {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public override inspect (): Inspect {
|
||||
public override inspectU8a (): Inspect {
|
||||
return { outer: [this.toU8a()] };
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('Range', (): void => {
|
||||
});
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(range.inspect()).toEqual({
|
||||
expect(range.inspectU8a()).toEqual({
|
||||
inner: [
|
||||
{ outer: [new Uint8Array([1, 0, 0, 0])] },
|
||||
{ outer: [new Uint8Array([2, 0, 0, 0])] }
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('U8aFixed', (): void => {
|
||||
});
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(u8a.inspect()).toEqual({
|
||||
expect(u8a.inspectU8a()).toEqual({
|
||||
outer: [new Uint8Array([1, 2, 3, 4])]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ describe('WrapperKeepOpaque', (): void => {
|
||||
|
||||
it('has a sane inspect (non-decodable)', (): void => {
|
||||
expect(
|
||||
new ClazzUSize(registry, u8au32).inspect()
|
||||
new ClazzUSize(registry, u8au32).inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([4 << 2]), new Uint8Array([0x87, 0xd6, 0x12, 0x00])]
|
||||
});
|
||||
@@ -60,7 +60,7 @@ describe('WrapperKeepOpaque', (): void => {
|
||||
|
||||
it('has a sane inspect (decodable)', (): void => {
|
||||
expect(
|
||||
new ClazzU32(registry, u8au32).inspect()
|
||||
new ClazzU32(registry, u8au32).inspectU8a()
|
||||
).toEqual({
|
||||
inner: [{ outer: [new Uint8Array([0x87, 0xd6, 0x12, 0x00])] }],
|
||||
outer: [new Uint8Array([4 << 2])]
|
||||
|
||||
@@ -70,10 +70,10 @@ export class WrapperKeepOpaque<T extends Codec> extends Bytes {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public override inspect (): Inspect {
|
||||
public override inspectU8a (): Inspect {
|
||||
return this.#decoded
|
||||
? {
|
||||
inner: [this.#decoded.inspect()],
|
||||
inner: [this.#decoded.inspectU8a()],
|
||||
outer: [compactToU8a(this.length)]
|
||||
}
|
||||
: {
|
||||
|
||||
@@ -47,7 +47,7 @@ describe('WrapperOpaque', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new WrapperOpaque(registry, 'u32', '0x78563412').inspect()
|
||||
new WrapperOpaque(registry, 'u32', '0x78563412').inspectU8a()
|
||||
).toEqual({
|
||||
inner: [{ outer: [new Uint8Array([0x78, 0x56, 0x34, 0x12])] }],
|
||||
outer: [new Uint8Array([4 << 2])]
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('Bool', (): void => {
|
||||
});
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(new Bool(registry, true).inspect()).toEqual({
|
||||
expect(new Bool(registry, true).inspectU8a()).toEqual({
|
||||
outer: [new Uint8Array([1])]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -97,7 +97,7 @@ export class bool extends Boolean implements Codec {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [this.toU8a()]
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('Date', (): void => {
|
||||
});
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(new CodecDate(registry, 3).inspect()).toEqual({
|
||||
expect(new CodecDate(registry, 3).inspectU8a()).toEqual({
|
||||
outer: [new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0])]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ export class CodecDate extends Date implements INumber {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [this.toU8a()]
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ export class Float extends Number implements IFloat {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [this.toU8a()]
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ export class Json extends Map<string, any> implements Codec {
|
||||
/**
|
||||
* @description Unimplemented, will throw
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
throw new Error('Unimplemented');
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ describe('Raw', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new Raw(registry, [1, 2, 3, 4, 5]).inspect()
|
||||
new Raw(registry, [1, 2, 3, 4, 5]).inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([1, 2, 3, 4, 5])]
|
||||
});
|
||||
|
||||
@@ -111,7 +111,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [this.toU8a()]
|
||||
};
|
||||
|
||||
@@ -97,7 +97,7 @@ describe('Set', (): void => {
|
||||
});
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(set.inspect()).toEqual({
|
||||
expect(set.inspectU8a()).toEqual({
|
||||
outer: [new Uint8Array([SET_ROLES.full | SET_ROLES.authority])]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -215,7 +215,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
return {
|
||||
outer: [this.toU8a()]
|
||||
};
|
||||
|
||||
@@ -380,7 +380,7 @@ describe('Struct', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new Struct(registry, def, val).inspect()
|
||||
new Struct(registry, def, val).inspectU8a()
|
||||
).toEqual({
|
||||
inner: [
|
||||
{
|
||||
|
||||
@@ -251,12 +251,12 @@ export class Struct<
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (isBare?: BareOpts): Inspect {
|
||||
public inspectU8a (isBare?: BareOpts): Inspect {
|
||||
const inner = new Array<Inspect>();
|
||||
|
||||
for (const [k, v] of this.entries()) {
|
||||
inner.push({
|
||||
...v.inspect(
|
||||
...v.inspectU8a(
|
||||
!isBare || isBoolean(isBare)
|
||||
? isBare
|
||||
: isBare[k]
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('Text', (): void => {
|
||||
|
||||
it('has a sane inspect', (): void => {
|
||||
expect(
|
||||
new Text(registry, 'abcde').inspect()
|
||||
new Text(registry, 'abcde').inspectU8a()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([5 << 2]), stringToU8a('abcde')]
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ export class Text extends String implements IText {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public inspect (): Inspect {
|
||||
public inspectU8a (): Inspect {
|
||||
const value = stringToU8a(super.toString());
|
||||
|
||||
return {
|
||||
|
||||
@@ -89,7 +89,7 @@ export interface Codec extends CodecDeprecated {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
inspect (isBare?: BareOpts): Inspect;
|
||||
inspectU8a (isBare?: BareOpts): Inspect;
|
||||
|
||||
/**
|
||||
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
||||
|
||||
@@ -266,13 +266,13 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
override inspect (): Inspect {
|
||||
override inspectU8a (): Inspect {
|
||||
const encoded = u8aConcat(...this.toU8aInner());
|
||||
|
||||
return {
|
||||
inner: this.isSigned
|
||||
? this.inner.inspect().inner
|
||||
: this.inner.method.inspect().inner,
|
||||
? this.inner.inspectU8a().inner
|
||||
: this.inner.method.inspectU8a().inner,
|
||||
outer: [compactToU8a(encoded.length), new Uint8Array([this.version])]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('ExtrinsicPayload', (): void => {
|
||||
const a = new ExtrinsicPayload(registry, TEST, { version: 4 });
|
||||
const b = new ExtrinsicPayload(registry, a.toU8a(), { version: 4 });
|
||||
|
||||
expect(a.inspect()).toEqual(b.inspect());
|
||||
expect(a.inspectU8a()).toEqual(b.inspectU8a());
|
||||
expect(a.toJSON()).toEqual(b.toJSON());
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('ExtrinsicPayload', (): void => {
|
||||
const a = new ExtrinsicPayload(registry, TEST, { version: 4 });
|
||||
const b = new ExtrinsicPayload(registry, a.toHex(), { version: 4 });
|
||||
|
||||
expect(a.inspect()).toEqual(b.inspect());
|
||||
expect(a.inspectU8a()).toEqual(b.inspectU8a());
|
||||
expect(a.toJSON()).toEqual(b.toJSON());
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('ExtrinsicPayload', (): void => {
|
||||
it('has a sane inspect', (): void => {
|
||||
// we don't expect this to fail, however it is actually a good
|
||||
// reference for the ordering in base Substrate
|
||||
expect(new ExtrinsicPayload(registry, { method: tx.timestamp.set(0).toHex() } as never).inspect()).toEqual({
|
||||
expect(new ExtrinsicPayload(registry, { method: tx.timestamp.set(0).toHex() } as never).inspectU8a()).toEqual({
|
||||
inner: [
|
||||
{ name: 'method', outer: [new Uint8Array([3, 0, 0])] },
|
||||
{ name: 'era', outer: [new Uint8Array([0]), new Uint8Array([0])] },
|
||||
|
||||
@@ -40,8 +40,8 @@ export class GenericExtrinsicPayloadV4 extends Struct {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
public override inspect (): Inspect {
|
||||
return super.inspect({ method: true });
|
||||
public override inspectU8a (): Inspect {
|
||||
return super.inspectU8a({ method: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -93,7 +93,7 @@ export class GenericLookupSource extends AbstractBase<GenericAccountId | Generic
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
override inspect (): Inspect {
|
||||
override inspectU8a (): Inspect {
|
||||
const value = this.inner.toU8a().subarray(0, this._rawLength);
|
||||
|
||||
return {
|
||||
|
||||
@@ -55,8 +55,8 @@ export class GenericMultiAddress extends Enum {
|
||||
/**
|
||||
* @description Returns a breakdown of the hex encoding for this Codec
|
||||
*/
|
||||
override inspect (): Inspect {
|
||||
const { inner, outer = [] } = this.inner.inspect();
|
||||
override inspectU8a (): Inspect {
|
||||
const { inner, outer = [] } = this.inner.inspectU8a();
|
||||
|
||||
return {
|
||||
inner,
|
||||
|
||||
Reference in New Issue
Block a user