NEWTON
Asked
6 months ago
35
views
0
This question has a bounty of $0.00 in testnet ETH. Answers to this question are eligible to win that bounty.
These are testnet contracts. Not real ETH.
$0.00
Looking to call the approve and transfer functions for an erc-20 in the same transaction. Thoughts on how to do this?
ㅤ This question was originally posted on Triality
0
Accepted answer
You can make multicalls and batch many transactions that execute one after the other
See the following code from @bowlsofchili in Telegram:
export const constructTransaction = (contract, method, args = {}) => {
const calldata = stark.compileCalldata(args);
const transaction = {
contractAddress: contract.address,
entrypoint: method,
calldata
};
return transaction
};
export const sendTransactions = async (transactions) => {
try {
return await getStarknet().account.execute(transactions);
} catch (ex) {
return Promise.reject(ex);
}
};
see above, first method will help contruct individual txs and the second execute all of them at once
ㅤ This answer was originally posted on Triality
answered
6 months ago
Does cairo have payable functions?
How do you check if a number is even in Cairo?
Cairo: How do write a log function in Cairo
Cairo: How do I initialize an array in cairo
Expect function call to fail in cairo?
How can I define two functions with the same name but not the same arguments?
Can you explain Cairo v0.10 usage functions as expressions?
Where can I find a list of decorators available in Cairo?
Does Cairo work in python3.10 venv? I can’t install python 3.9
Cairo error for Unexpected '.' after ... which is future
Why am I having trouble deploying my Cairo contract?
Is there a unsigned_div_rem supporting dividing by 2**128 ?
If I want to use starkex do I have to deploy my custom starkex contracts?
What is the expected blocktime for starknet mainnet?