From dbc0411d77e7a7a64be5eb14318352fd6f0337a9 Mon Sep 17 00:00:00 2001 From: Artur Sapek Date: Wed, 27 Nov 2024 12:08:59 -0500 Subject: [PATCH] handle Uint8Array too --- core/definitions/src/address.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/definitions/src/address.ts b/core/definitions/src/address.ts index 8bf35fba9..c2eb1e989 100644 --- a/core/definitions/src/address.ts +++ b/core/definitions/src/address.ts @@ -109,10 +109,12 @@ export function toNative( // NativeAddress or UniversalAddress, and it failed to parse directly // as a NativeAddress, we try one more time to parse it as a UniversalAddress // first and then convert that to a NativeAddress. - if (typeof ua === 'string' && ua.length === 32 && UniversalAddress.isValidAddress(ua)) { + if ( + (typeof ua === 'string' && ua.length === 32) || + (ua instanceof Uint8Array && ua.length === 32) || + ) { console.error(err); console.error('Attempting to parse as UniversalAddress'); - // try to parse it as a universal address return (new UniversalAddress(ua)).toNative(chain); } else { throw new Error(err);