1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

remove specific estimategas functions from TokenUtils

This commit is contained in:
Miquel A. Cabot 2022-06-13 11:23:32 +02:00
parent c92aaeba47
commit 635c7b7cd5

View File

@ -11,29 +11,6 @@ import {
LoggerInstance
} from '.'
/**
* Estimate gas cost for approval function
* @param {String} account
* @param {String} tokenAddress
* @param {String} spender
* @param {String} amount
* @param {String} force
* @param {Contract} contractInstance optional contract instance
* @return {Promise<number>}
*/
export async function estApprove(
web3: Web3,
account: string,
tokenAddress: string,
spender: string,
amount: string,
contractInstance?: Contract
): Promise<number> {
const tokenContract = contractInstance || new web3.eth.Contract(minAbi, tokenAddress)
return calculateEstimatedGas(account, tokenContract.methods.approve, spender, amount)
}
/**
* Approve spender to spent amount tokens
* @param {String} account
@ -82,29 +59,6 @@ export async function approve(
return result
}
/**
* Estimate gas cost for transfer function
* @param {String} account
* @param {String} tokenAddress
* @param {String} recipient
* @param {String} amount
* @param {String} force
* @param {Contract} contractInstance optional contract instance
* @return {Promise<number>}
*/
export async function estTransfer(
web3: Web3,
account: string,
tokenAddress: string,
recipient: string,
amount: string,
contractInstance?: Contract
): Promise<number> {
const tokenContract = contractInstance || new web3.eth.Contract(minAbi, tokenAddress)
return calculateEstimatedGas(account, tokenContract.methods.transfer, recipient, amount)
}
/**
* Moves amount tokens from the callers account to recipient.
* @param {String} account