diff --git a/packages/types/src/codec/Vector.ts b/packages/types/src/codec/Vector.ts index 0a4ff4fc6d..3405459115 100644 --- a/packages/types/src/codec/Vector.ts +++ b/packages/types/src/codec/Vector.ts @@ -19,21 +19,23 @@ export default class Vector< > extends Base> { private _Type: Constructor; - constructor (Type: Constructor, value: U8a | Uint8Array | string | Array = [] as Array) { + constructor (Type: Constructor, value: Vector | U8a | Uint8Array | string | Array = [] as Array) { super( - Vector.decode(Type, value) + Vector.decodeVector(Type, value) ); this._Type = Type; } - static decode (Type: Constructor, value: U8a | Uint8Array | string | Array): Array { + static decodeVector (Type: Constructor, value: Vector | U8a | Uint8Array | string | Array): Array { if (Array.isArray(value)) { return value.map((entry) => entry instanceof Type ? entry : new Type(entry) ); + } else if (value instanceof Vector) { + return Vector.decodeVector(Type, value.raw); } const u8a = value instanceof U8a