"use strict";
// SPDX-License-Identifier: Apache-2.0
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ContractId_1 = __importDefault(require("./ContractId"));
const InvalidEvmAddress_1 = require("./error/InvalidEvmAddress");
class EvmAddress {
    value;
    constructor(value) {
        if (value.length == 42 && value.startsWith("0x")) {
            this.value = value;
        }
        else if (value.length === 40) {
            this.value = "0x" + value;
        }
        else {
            throw new InvalidEvmAddress_1.InvalidEvmAddress(value);
        }
    }
    toContractId() {
        return ContractId_1.default.fromHederaEthereumAddress(this.value);
    }
    toString() {
        return this.value;
    }
}
exports.default = EvmAddress;
