if (typeof value !== 'string' && !(value instanceof ArrayBuffer) && !(value instanceof Uint8Array)) {
throw new TypeError('Invalid address input', { cause: value })
}
- if (hex.is(value)) {
- if (value.length === ACCOUNT_KEY_HEX_LENGTH) {
+ if (typeof value === 'string') {
+ if (hex.is(value) && value.length === ACCOUNT_KEY_HEX_LENGTH) {
this.#address = (this.constructor as typeof Address).fromPublicKey(hex.toBuffer(value))
} else {
_validate(value)
this.#publicKey = this.#address.toPublicKey()\r
} catch (err) {\r
console.error(err)\r
- throw new TypeError('Failed to import Account from public data', { cause: { err } })\r
+ throw new TypeError('Failed to import Account from public data', { cause: err })\r
}\r
}\r
}\r