-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmint.js
35 lines (31 loc) · 1.11 KB
/
mint.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const hre = require("hardhat");
const { encryptDataField, decryptNodeResponse } = require("@swisstronik/utils");
const sendShieldedTransaction = async (signer, destination, data, value) => {
const rpcLink = hre.network.config.url;
const [encryptedData] = await encryptDataField(rpcLink, data);
return await signer.sendTransaction({
from: signer.address,
to: destination,
data: encryptedData,
value,
});
};
async function main() {
const contractAddress = "0x959C51afF36D267afFb71924288144d4E0928aD3"
const [signer] = await hre.ethers.getSigners();
const contractFactory = await hre.ethers.getContractFactory("ZunXBT");
const contract = contractFactory.attach(contractAddress);
const functionName = "safeMint";
const safeMintTx = await sendShieldedTransaction(
signer,
contractAddress,
contract.interface.encodeFunctionData(functionName, [signer.address, 1]),
0
);
await safeMintTx.wait();
console.log(`Transaction URL of Mint: https://explorer-evm.testnet.swisstronik.com/tx/${safeMintTx.hash}`);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});