import '@ethersproject/shims';
import 'text-encoding';
import { ethers } from 'ethers';
import { Buffer } from 'buffer';
const fa = require("@glif/filecoin-address");
import { DAPP_CONTRACT } from "@env"
const networkInfo = {
defaultNetwork: "hyperspace",
networks: {
hyperspace: {
chainId: 3141,
url: "https://api.hyperspace.node.glif.io/rpc/v1",
},
},
}
const MintTokens = async (key, amount) => {
try {
let cleanKey = key.replace(/["]/g, "");
let provider = new ethers.providers.JsonRpcProvider(FevmProviderUrl, networkInfo.networks.hyperspace);
const wallet = new ethers.Wallet(cleanKey, provider);
const signer = wallet.connect(provider);
const f4ContractAddress = fa.newDelegatedEthAddress(DAPP_CONTRACT).toString();
const f4WalletAddress = fa.newDelegatedEthAddress(wallet.address).toString();
const f4ActorAddress = fa.newActorAddress(wallet.address).toString();
console.log("Ethereum Contract address in .env (this address should work for most tools):", DAPP_CONTRACT);
console.log("f4address Contract (also known as t4 address on testnets):", f4ContractAddress);
console.log("f4address Actor (also known as t4 address on testnets):", f4ActorAddress);
console.log("f4address Wallet (also known as t4 address on testnets):", f4WalletAddress);
console.log("Provider:", provider);
console.log("Eth Wallet:", wallet);
console.log("Minting FitMint");
const FitMints = new ethers.Contract(DAPP_CONTRACT, ContractABI.abi, signer)
console.log("Contract:", FitMints)
// //Call the mint method
let result = await FitMints.mint(wallet.address, amount, { gasLimit: 30000 })
if(result) {
console.log("Minting Token:", result)
return result
} else {
return {"result": result.toString()}
}
} catch (error) {
console.log(error)
return error
}
}
export default {
MintTokens,
};
Output of mint token:
[Error: processing response error (bod
c":"2.0","id":50,"error":{"code":1,
"failed to look up actor state nonce: resol
failed (t410fzzzo2dimmzy63d4vgxvfak6wvxdhcr
resolve address t410fzzzo2dimmzy63d4vgxvfak6
j3vy: actor not found: validation failure"}
{"code":1}, requestBody="{"method":"eth_s
ction","params":["0x02f8b1820c4580845968c6aa9ae8453d4e311f6749ae0c80b84440c10f1900008f9535ea502bd6adc671469c0000000000000000000000000001c001a00a9df20582d715909d4d7dd7606f2622e3f64c0faa03bdbc7b6b23cb5f26aaccbd12060c3djsonrpc":"2.0"}", requestMethod="POST", u.io/rpc/v1", code=SERVER_ERROR, version=web/
AI Said
- Check the imports to make sure all necessary packages are imported correctly.
- Verify the contract address in the .env file is correct.
- Verify the network information is correctly set for the Hyperspace network.
- Check the code for the
getTokens
andMintTokens
functions to ensure all parameters are correctly passed. - Make sure the wallet address is correct and matches the f4 address.
- Check the gas limit settings for the
MintTokens
function. - Ensure the request body and method are correctly set in the code.
- Verify the URL for the Json RPC Provider is correct.
But Im just lost, thanks