diff --git a/scripts/transfer-wrapped.js b/scripts/transfer-wrapped.js index e2601d4..72383cf 100644 --- a/scripts/transfer-wrapped.js +++ b/scripts/transfer-wrapped.js @@ -10,13 +10,20 @@ module.exports = async (callback) => { const [account,] = await web3.eth.getAccounts(); - const currentBalance = BigInt(await wrapper.balanceOf(account, nftId1)); + const from = process.argv[9] ? process.argv[9] : account; + if (from !== account) { + console.log(`Overrode from address`); + const approved = await wrapper.isApprovedForAll(from, account); + console.log(`Approved? ${approved ? "yes" : "no"}`); + } + + const currentBalance = BigInt(await wrapper.balanceOf(from, nftId1)); console.log(`Current balance: ${currentBalance}`); if (currentBalance >= quantity1) { console.log("Executing transfer transaction..."); try { - const result = await wrapper.safeTransferFrom(account, to, nftId1, quantity1.toString(), []); + const result = await wrapper.safeTransferFrom(from, to, nftId1, quantity1.toString(), []); console.log(`Transaction: ${result.tx}`); } catch (e) {