Skip to content

Commit

Permalink
handle Uint8Array too
Browse files Browse the repository at this point in the history
  • Loading branch information
artursapek committed Nov 27, 2024
1 parent 90ee22e commit dbc0411
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/definitions/src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ export function toNative<C extends Chain>(
// 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);
Expand Down

0 comments on commit dbc0411

Please sign in to comment.