|
|
|
@ -8,12 +8,12 @@ async function main() {
|
|
|
|
|
|
|
|
|
|
const Git3 = await hre.ethers.getContractAt(
|
|
|
|
|
"Git3Hub",
|
|
|
|
|
"0xa709975Bc01e745432f8898499E7b9a60f420117"
|
|
|
|
|
"0xcE386Fe1d237e42dd01c130DA19d32B2c3794C06"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let file = fs.readFileSync("test/git3.png");
|
|
|
|
|
|
|
|
|
|
let buffer = Array.from(file).slice(0, 24576);
|
|
|
|
|
let file = fs.readFileSync("scripts/git3.png");
|
|
|
|
|
let rept
|
|
|
|
|
let buffer = Array.from(file).slice(0, 24 * 1024 * 5);
|
|
|
|
|
let fileSize = buffer.length;
|
|
|
|
|
console.log("buffer", buffer.length);
|
|
|
|
|
|
|
|
|
@ -21,10 +21,17 @@ async function main() {
|
|
|
|
|
if (fileSize > 24 * 1024 - 326) {
|
|
|
|
|
cost = Math.floor((fileSize + 326) / 1024 / 24);
|
|
|
|
|
}
|
|
|
|
|
let repoName = Buffer.from("helloworld")
|
|
|
|
|
// rept = await Git3.createRepo(repoName)
|
|
|
|
|
|
|
|
|
|
let key = ethers.utils.toUtf8Bytes("aaa");
|
|
|
|
|
let rept = await Git3.upload(key, buffer, {
|
|
|
|
|
value: ethers.utils.parseEther(cost.toString()),
|
|
|
|
|
});
|
|
|
|
|
// rept = await Git3.upload(repoName, key, buffer, {
|
|
|
|
|
// value: ethers.utils.parseEther(cost.toString()),
|
|
|
|
|
// });
|
|
|
|
|
console.log(await Git3.download(repoName, key));
|
|
|
|
|
|
|
|
|
|
rept = await Git3.remove(repoName, key)
|
|
|
|
|
|
|
|
|
|
console.log("rept", "https://explorer.galileo.web3q.io/tx/" + rept.hash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|