Skip to content

Commit

Permalink
use sendTransaction instead of just send
Browse files Browse the repository at this point in the history
  • Loading branch information
Atatakai authored and Atatakai committed Jun 14, 2024
1 parent 6705ab6 commit 5eff940
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/autonolas-registry/components/ListServices/mint.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';

import { notifyError, notifySuccess } from '@autonolas/frontend-library';

import { getEstimatedGasLimit } from 'libs/util-functions';
import { getEstimatedGasLimit } from 'libs/util-functions/src';

import { getServiceManagerContract } from 'common-util/Contracts';
import { AlertError, AlertSuccess, convertStringToArray } from 'common-util/List/ListCommon';
Expand Down
2 changes: 1 addition & 1 deletion apps/autonolas-registry/components/ListServices/update.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';

import { Loader, notifyError, notifySuccess } from '@autonolas/frontend-library';

import { getEstimatedGasLimit } from 'libs/util-functions';
import { getEstimatedGasLimit } from 'libs/util-functions/src';

import { getServiceManagerContract } from '../../common-util/Contracts';
import { AlertError, convertStringToArray } from '../../common-util/List/ListCommon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from 'react';

import { getEstimatedGasLimit } from 'libs/util-functions';
import { getEstimatedGasLimit } from 'libs/util-functions/src';

import { ADDRESSES } from 'common-util/constants/addresses';
import {
Expand Down
19 changes: 15 additions & 4 deletions apps/govern/common-util/functions/requests.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { readContracts } from '@wagmi/core';
import { AbiFunction } from 'viem';

import { sendTransaction } from '@autonolas/frontend-library';

import { STAKING_FACTORY } from 'libs/util-contracts/src/lib/abiAndAddresses';
import { getEstimatedGasLimit } from 'libs/util-functions/src';

import { wagmiConfig } from 'common-util/config/wagmi';
import { SUPPORTED_CHAINS, wagmiConfig } from 'common-util/config/wagmi';
import { RPC_URLS } from 'common-util/constants/rpcs';
import { Address } from 'types/index';

import { getAddressFromBytes32 } from './addresses';
Expand All @@ -23,9 +27,16 @@ export const voteForNomineeWeights = async ({
weights,
}: VoteForNomineeWeightsParams) => {
const contract = getVoteWeightingContract();
const result = await contract.methods
.voteForNomineeWeightsBatch(nominees, chainIds, weights)
.send({ from: account });
const voteFn = contract.methods.voteForNomineeWeightsBatch(nominees, chainIds, weights);

const estimatedGas = await getEstimatedGasLimit(voteFn, account);
const fn = voteFn.send({ from: account, estimatedGas });

const result = await sendTransaction(fn, account, {
supportedChains: SUPPORTED_CHAINS,
rpcUrls: RPC_URLS,
});

return result;
};

Expand Down

0 comments on commit 5eff940

Please sign in to comment.