@kaiachain/kss-bridges-celer
Version:
TypeScript client and use-cases for cBridge
20 lines • 804 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getContract = exports.getSigner = void 0;
const ethers_1 = require("ethers");
const getSigner = (chainRPC, privateKey) => {
if (!privateKey) {
return new ethers_1.providers.JsonRpcProvider(chainRPC);
}
else {
return new ethers_1.Wallet(privateKey, new ethers_1.providers.JsonRpcProvider(chainRPC));
}
};
exports.getSigner = getSigner;
const getContract = (address, abi, chainRPC, privateKey) => {
const contractSigner = (0, exports.getSigner)(chainRPC, privateKey);
const contractInterface = new ethers_1.utils.Interface(abi);
return new ethers_1.Contract(address, contractInterface, contractSigner);
};
exports.getContract = getContract;
//# sourceMappingURL=constant.js.map