ethers#PopulatedTransaction TypeScript Examples
The following examples show how to use
ethers#PopulatedTransaction.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: batchCall.ts From celo-web-wallet with MIT License | 7 votes |
async function executeBatchCall(txRequests: PopulatedTransaction[]) {
const provider = getProvider()
try {
const requests: JsonRpcRequest[] = txRequests.map((tx) => {
const hexlified = CeloProvider.hexlifyTransaction(tx, { from: true })
return {
method: 'eth_call',
params: [hexlified, 'latest'],
id: provider._nextId++,
jsonrpc: '2.0',
}
})
const result: string[] = await utils.fetchJson(
provider.connection,
JSON.stringify(requests),
getPayloadResult
)
if (!result || result.length !== txRequests.length) {
throw new Error('Result size / request size mismatch')
}
const hexlifiedResults = result.map((r) => utils.hexlify(r))
return hexlifiedResults
} catch (error) {
logger.error('Failed to perform batch call', error)
throw new Error('Batch call failed')
}
}
Example #2
Source File: submitting.ts From safe-tasks with GNU Lesser General Public License v3.0 | 6 votes |
task("submit-tx", "Executes a Safe transaction")
.addPositionalParam("address", "Address or ENS name of the Safe to check", undefined, types.string)
.addParam("to", "Address of the target", undefined, types.string)
.addParam("value", "Value in ETH", "0", types.string, true)
.addParam("data", "Data as hex string", "0x", types.string, true)
.addParam("signatures", "Comma seperated list of signatures", undefined, types.string, true)
.addParam("gasPrice", "Gas price to be used", undefined, types.int, true)
.addParam("gasLimit", "Gas limit to be used", undefined, types.int, true)
.addFlag("delegatecall", "Indicator if tx should be executed as a delegatecall")
.setAction(async (taskArgs, hre) => {
console.log(`Running on ${hre.network.name}`)
const [signer] = await hre.ethers.getSigners()
const safe = await safeSingleton(hre, taskArgs.address)
const safeAddress = await safe.resolvedAddress
console.log(`Using Safe at ${safeAddress} with ${signer.address}`)
const nonce = await safe.nonce()
if (!isHexString(taskArgs.data)) throw Error(`Invalid hex string provided for data: ${taskArgs.data}`)
const tx = buildSafeTransaction({
to: taskArgs.to,
value: parseEther(taskArgs.value),
data: taskArgs.data,
nonce,
operation: taskArgs.delegatecall ? 1 : 0
})
const signatures = await prepareSignatures(safe, tx, taskArgs.signatures, signer)
const populatedTx: PopulatedTransaction = await populateExecuteTx(safe, tx, signatures, { gasLimit: taskArgs.gasLimit, gasPrice: taskArgs.gasPrice })
const receipt = await signer.sendTransaction(populatedTx).then(tx => tx.wait())
console.log(receipt.transactionHash)
});
Example #3
Source File: Auth.d.ts From nova with GNU Affero General Public License v3.0 | 6 votes |
populateTransaction: {
authority(overrides?: CallOverrides): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
setAuthority(
newAuthority: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
setOwner(
newOwner: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
};
Example #4
Source File: HypervisorFactory.d.ts From hypervisor with The Unlicense | 6 votes |
populateTransaction: {
allHypervisors(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
allHypervisorsLength(
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
createHypervisor(
tokenA: string,
tokenB: string,
fee: BigNumberish,
name: string,
symbol: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
getHypervisor(
arg0: string,
arg1: string,
arg2: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
renounceOwnership(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
transferOwnership(
newOwner: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
uniswapV3Factory(overrides?: CallOverrides): Promise<PopulatedTransaction>;
};
Example #5
Source File: pauseTickets.ts From ghst-staking with MIT License | 6 votes |
async function togglePause() {
let stakingFacet = await ethers.getContractAt(
"StakingFacet",
maticStakingAddress
);
const ownershipFacet = await ethers.getContractAt(
"OwnershipFacet",
maticStakingAddress
);
const owner = await ownershipFacet.owner();
const signer = await getDiamondSigner(ethers, network, undefined, true);
if (network.name === "matic") {
const tx: PopulatedTransaction =
await stakingFacet.populateTransaction.togglePauseTickets();
console.log("tx data:", tx.data);
await sendToMultisig(stakingDiamondUpgrader, signer, tx, ethers);
} else {
stakingFacet = await impersonate(owner, stakingFacet, ethers, network);
await stakingFacet.togglePauseTickets();
stakingFacet = await impersonate(
"0x51208e5cC9215c6360210C48F81C8270637a5218",
stakingFacet,
ethers,
network
);
await stakingFacet.claimTickets([0], [1]);
}
}
Example #6
Source File: Erc20.d.ts From limit-orders-lib with GNU General Public License v3.0 | 6 votes |
populateTransaction: {
name(overrides?: CallOverrides): Promise<PopulatedTransaction>;
approve(
_spender: string,
_value: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>;
transferFrom(
_from: string,
_to: string,
_value: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>;
balanceOf(
_owner: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
symbol(overrides?: CallOverrides): Promise<PopulatedTransaction>;
transfer(
_to: string,
_value: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
allowance(
_owner: string,
_spender: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
Example #7
Source File: CompInterface.d.ts From commonwealth with GNU General Public License v3.0 | 6 votes |
populateTransaction: {
getPriorVotes(
account: string,
blockNumber: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"getPriorVotes(address,uint256)"(
account: string,
blockNumber: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
Example #8
Source File: DutchAuction.d.ts From shoyu with MIT License | 6 votes |
populateTransaction: {
canBid(
arg0: string,
arg1: BigNumberish,
arg2: BytesLike,
arg3: string,
arg4: BigNumberish,
arg5: string,
arg6: BigNumberish,
arg7: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
canClaim(
proxy: string,
deadline: BigNumberish,
params: BytesLike,
arg3: string,
bidPrice: BigNumberish,
arg5: string,
arg6: BigNumberish,
arg7: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
Example #9
Source File: Authority.d.ts From nova with GNU Affero General Public License v3.0 | 5 votes |
populateTransaction: {
canCall(
src: string,
dst: string,
sig: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
Example #10
Source File: IWETH9.d.ts From hardhat-v3-deploy with MIT License | 5 votes |
populateTransaction: {
allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<PopulatedTransaction>
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
approve(spender: string, amount: BigNumberish, overrides?: Overrides): Promise<PopulatedTransaction>
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>
balanceOf(account: string, overrides?: CallOverrides): Promise<PopulatedTransaction>
'balanceOf(address)'(account: string, overrides?: CallOverrides): Promise<PopulatedTransaction>
deposit(overrides?: PayableOverrides): Promise<PopulatedTransaction>
'deposit()'(overrides?: PayableOverrides): Promise<PopulatedTransaction>
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>
'totalSupply()'(overrides?: CallOverrides): Promise<PopulatedTransaction>
transfer(recipient: string, amount: BigNumberish, overrides?: Overrides): Promise<PopulatedTransaction>
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>
withdraw(arg0: BigNumberish, overrides?: Overrides): Promise<PopulatedTransaction>
'withdraw(uint256)'(arg0: BigNumberish, overrides?: Overrides): Promise<PopulatedTransaction>
}
Example #11
Source File: ERC20.d.ts From hypervisor with The Unlicense | 5 votes |
populateTransaction: {
allowance(
owner: string,
spender: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
approve(
spender: string,
amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
balanceOf(
account: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>;
decreaseAllowance(
spender: string,
subtractedValue: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
increaseAllowance(
spender: string,
addedValue: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
name(overrides?: CallOverrides): Promise<PopulatedTransaction>;
symbol(overrides?: CallOverrides): Promise<PopulatedTransaction>;
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>;
transfer(
recipient: string,
amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
};
Example #12
Source File: ArgentWalletDetector.d.ts From limit-orders-lib with GNU General Public License v3.0 | 5 votes |
populateTransaction: {
acceptedCodes(
arg0: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
acceptedImplementations(
arg0: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
addCode(
_code: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
addCodeAndImplementationFromWallet(
_argentWallet: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
addImplementation(
_impl: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
changeOwner(
_newOwner: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
getCodes(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getImplementations(
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
isArgentWallet(
_wallet: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
};
Example #13
Source File: AccessControl.d.ts From commonwealth with GNU General Public License v3.0 | 5 votes |
populateTransaction: {
DEFAULT_ADMIN_ROLE(
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"DEFAULT_ADMIN_ROLE()"(
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
getRoleAdmin(
role: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"getRoleAdmin(bytes32)"(
role: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
grantRole(
role: BytesLike,
account: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
"grantRole(bytes32,address)"(
role: BytesLike,
account: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
hasRole(
role: BytesLike,
account: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"hasRole(bytes32,address)"(
role: BytesLike,
account: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
renounceRole(
role: BytesLike,
account: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
"renounceRole(bytes32,address)"(
role: BytesLike,
account: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
revokeRole(
role: BytesLike,
account: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
"revokeRole(bytes32,address)"(
role: BytesLike,
account: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
supportsInterface(
interfaceId: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"supportsInterface(bytes4)"(
interfaceId: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
Example #14
Source File: TokenInfo.d.ts From tx2uml with MIT License | 5 votes |
populateTransaction: {
getBytes32Properties(
token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
"getBytes32Properties(address)"(
token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
getInfo(
token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
"getInfo(address)"(
token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
getInfoBatch(
tokens: string[],
overrides?: CallOverrides
): Promise<PopulatedTransaction>
"getInfoBatch(address[])"(
tokens: string[],
overrides?: CallOverrides
): Promise<PopulatedTransaction>
getStringProperties(
token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
"getStringProperties(address)"(
token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
}