UNPKG

@f5i23q999d/cow-sdk

Version:

<p align="center"> <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" /> </p>

27 lines 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPreSignTransaction = void 0; const common_1 = require("../common/index.js"); const consts_1 = require("./consts.js"); const utils_1 = require("./utils.js"); const generated_1 = require("../common/generated/index.js"); async function getPreSignTransaction(signer, chainId, account, orderId) { const contract = generated_1.GPv2Settlement__factory.connect(account, signer); const settlementContractAddress = common_1.COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[chainId]; const preSignatureCall = contract.interface.encodeFunctionData('setPreSignature', [orderId, true]); const gas = await contract.estimateGas .setPreSignature(orderId, true) .then((res) => BigInt(res.toHexString())) .catch((error) => { console.error(error); return consts_1.GAS_LIMIT_DEFAULT; }); return { data: preSignatureCall, gasLimit: '0x' + (0, utils_1.calculateGasMargin)(gas).toString(16), to: settlementContractAddress, value: '0', }; } exports.getPreSignTransaction = getPreSignTransaction; //# sourceMappingURL=getPreSignTransaction.js.map