feat: add interaction scripts

This commit is contained in:
zoruka 2022-12-07 15:35:35 -03:00
parent ef8baad617
commit 07ad6b672a
3 changed files with 67 additions and 0 deletions

26
scripts/mint.js Normal file
View File

@ -0,0 +1,26 @@
require('dotenv').config();
// TODO: make this arguments
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
const params = [
'0x7ED735b7095C05d78dF169F991f2b7f1A1F1A049', // to
'Fleek App', // name
'Description', // description
'https://fleek.network/fleek-network-logo-minimal.png', // image
'https://fleek.co/', // external url
'fleek.eth', // ens
'6ea6ad16c46ae85faced7e50555ff7368422f57', // commit hash
'https://github.com/org/repo', // repo
'fleek', // author
];
(async () => {
const contract = await hre.ethers.getContractAt(
'FleekERC721',
contractAddress
);
const transaction = await contract.mint(...params);
console.log('Response: ', transaction);
})();

20
scripts/tokenURI.js Normal file
View File

@ -0,0 +1,20 @@
require('dotenv').config();
// TODO: make this arguments
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
const tokenId = 3;
(async () => {
const contract = await hre.ethers.getContractAt(
'FleekERC721',
contractAddress
);
const transaction = await contract.tokenURI(tokenId);
const parsed = JSON.parse(
Buffer.from(transaction.slice(29), 'base64').toString('utf-8')
);
console.log('Response: ', parsed);
})();

21
scripts/upgrade.js Normal file
View File

@ -0,0 +1,21 @@
require('dotenv').config();
// TODO: make this arguments
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
const params = [
3, // tokenId
'97e7908f70f0862d753c66689ff09e70caa43df2', // commit hash
'https://github.com/org/new-repo', // repo
'new-author', // author
];
(async () => {
const contract = await hre.ethers.getContractAt(
'FleekERC721',
contractAddress
);
const transaction = await contract.upgradeTokenBuild(...params);
console.log('Response: ', transaction);
})();