"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deriveForeignContractAddress = void 0;
const connect_sdk_solana_1 = require("@wormhole-foundation/connect-sdk-solana");
const connect_sdk_1 = require("@wormhole-foundation/connect-sdk");
function deriveForeignContractAddress(programId, chainId) {
    const chainIdBuf = Buffer.alloc(2);
    chainIdBuf.writeUInt16BE((0, connect_sdk_1.toChainId)(chainId));
    return connect_sdk_solana_1.utils.deriveAddress([Buffer.from('foreign_contract'), chainIdBuf], programId);
}
exports.deriveForeignContractAddress = deriveForeignContractAddress;
//# sourceMappingURL=foreignContract.js.map