override transfer from
This commit is contained in:
parent
a5f9d9f139
commit
791ca05333
|
@ -10,13 +10,20 @@ module.exports = async (callback) => {
|
||||||
|
|
||||||
const [account,] = await web3.eth.getAccounts();
|
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}`);
|
console.log(`Current balance: ${currentBalance}`);
|
||||||
|
|
||||||
if (currentBalance >= quantity1) {
|
if (currentBalance >= quantity1) {
|
||||||
console.log("Executing transfer transaction...");
|
console.log("Executing transfer transaction...");
|
||||||
try {
|
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}`);
|
console.log(`Transaction: ${result.tx}`);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue