πŸ”‹Generating the data to sign

How to generate a properly formatted data using a contract interface particular function

Encode a Transaction to Relay using ethers

  let iface = new ethers.utils.Interface(gameABIV2);
  let dataFct

  dataFct = iface.encodeFunctionData("enterGameGasLess",
    [
      gameData.collectionId, // 1,2,3
      gameData.tokenId, //glmj ID
      gameData.badge1, //badge1 ID
      gameData.badge2, //badge2 ID
      gameData.jBoostId, //jBoost ID
      gameData.rented //rented
    ])

Get a Nonce for a particular wallet

async function getNonces(wallet) {

  const preCompileContract = new ethers.Contract(callPermitAddress, callPermitABI, provider)
  let nonce
  try {
    nonce = await preCompileContract.nonces(wallet);
  }
  catch (nonceErr) {
    console.log(nonceErr, 'nonce error')
  }
  return await nonce
}

Create the Permit Message data to sign

Last updated