NEWTON
Asked
4 months ago
25
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
4 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?
What is ArgentX?
How to create Structs in Cairo Lang for StarkNet?
How to protect my contract from reentrancy in Cairo Language / StarkNet?
How does a full node like pathfinder work
Will it be possible to invoke functions from within the loops in Cairo 1.0?
How can I connect to deployed StarkNet contract using starknetjs?
I am already running a full Ethereum node on my server. Can I set the PATHFINDER_ETHEREUM_API_URL parameter to my node's endpoint for pathfinder?