UNPKG

@verax-attestation-registry/verax-sdk

Version:

Verax Attestation Registry SDK to interact with the subgraph and the contracts

26 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeTransaction = void 0; const errorHandler_1 = require("./errorHandler"); const constants_1 = require("./constants"); // TODO: Use correct type for request async function executeTransaction( // eslint-disable-next-line @typescript-eslint/no-explicit-any request, publicClient, walletClient, waitForConfirmation = false) { if (!walletClient) { throw new Error("VeraxSDK - Wallet not available"); } try { const hash = await walletClient.writeContract(request); if (waitForConfirmation) { // Wait for the transaction to be confirmed return await publicClient.waitForTransactionReceipt({ hash }); } return { transactionHash: hash }; } catch (err) { (0, errorHandler_1.handleError)(constants_1.ActionType.Transaction, err); } } exports.executeTransaction = executeTransaction; //# sourceMappingURL=transactionSender.js.map