linting fixes for remix-ws-templates

pull/4771/head
lianahus 7 months ago
parent 4fe4b7f97e
commit 811d90ae36
  1. 2
      libs/remix-ws-templates/src/script-templates/etherscan/receiptGuidScript.ts
  2. 2
      libs/remix-ws-templates/src/script-templates/etherscan/verifyScript.ts
  3. 4
      libs/remix-ws-templates/src/script-templates/sindri/index.ts
  4. 2
      libs/remix-ws-templates/src/script-templates/sindri/run_compile.ts
  5. 2
      libs/remix-ws-templates/src/script-templates/sindri/run_prove.ts
  6. 4
      libs/remix-ws-templates/src/script-templates/sindri/utils.ts
  7. 2
      libs/remix-ws-templates/src/templates/gnosisSafeMultisig/scripts/web3-lib.ts
  8. 1
      libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_zkproof.ts
  9. 2
      libs/remix-ws-templates/src/templates/ozerc1155/scripts/web3-lib.ts
  10. 2
      libs/remix-ws-templates/src/templates/ozerc20/scripts/web3-lib.ts
  11. 2
      libs/remix-ws-templates/src/templates/ozerc721/scripts/web3-lib.ts
  12. 2
      libs/remix-ws-templates/src/templates/playground/scripts/web3-lib.ts
  13. 2
      libs/remix-ws-templates/src/templates/remixDefault/scripts/web3-lib.ts
  14. 2
      libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_zkproof.ts
  15. 2
      libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_zkproof.ts
  16. 5
      libs/remix-ws-templates/src/templates/semaphore/scripts/run_verification.ts
  17. 2
      libs/remix-ws-templates/src/templates/zeroxErc20/scripts/web3-lib.ts

@ -5,5 +5,5 @@
* @returns {{ status, message, succeed }} receiptStatus * @returns {{ status, message, succeed }} receiptStatus
*/ */
export const receiptStatus = async (apikey: string, guid: string, isProxyContract?: boolean) => { export const receiptStatus = async (apikey: string, guid: string, isProxyContract?: boolean) => {
return await remix.call('etherscan' as any, 'receiptStatus', guid, apikey, isProxyContract) return await remix.call('etherscan' as any, 'receiptStatus', guid, apikey, isProxyContract)
} }

@ -13,5 +13,5 @@ export const verify = async (apikey: string, contractAddress: string, contractAr
const compilationResultParam = await remix.call('compilerArtefacts' as any, 'getCompilerAbstract', contractFile) const compilationResultParam = await remix.call('compilerArtefacts' as any, 'getCompilerAbstract', contractFile)
console.log('verifying.. ' + contractName) console.log('verifying.. ' + contractName)
// update apiKey and chainRef to verify contract on multiple networks // update apiKey and chainRef to verify contract on multiple networks
return await remix.call('etherscan' as any, 'verify', apikey, contractAddress, contractArguments, contractName, compilationResultParam, chainRef, isProxyContract, expectedImplAddress) return await remix.call('etherscan' as any, 'verify', apikey, contractAddress, contractArguments, contractName, compilationResultParam, chainRef, isProxyContract, expectedImplAddress)
} }

@ -71,12 +71,12 @@ export const sindriScripts = async (plugin: any) => {
if (a.isTemplateEntrypoint !== b.isTemplateEntrypoint) return +b.isTemplateEntrypoint - +a.isTemplateEntrypoint if (a.isTemplateEntrypoint !== b.isTemplateEntrypoint) return +b.isTemplateEntrypoint - +a.isTemplateEntrypoint
return a.path.localeCompare(b.path) return a.path.localeCompare(b.path)
}) })
.map(({path}) => path)[0] || './circuit.circom' .map(({ path }) => path)[0] || './circuit.circom'
sindriManifest.circuitPath = circomCircuitPath sindriManifest.circuitPath = circomCircuitPath
} }
// Derive the circuit name from the workspace name. // Derive the circuit name from the workspace name.
const {name: workspaceName} = await plugin.call('filePanel', 'getCurrentWorkspace') const { name: workspaceName } = await plugin.call('filePanel', 'getCurrentWorkspace')
sindriManifest.name = sindriManifest.name =
workspaceName workspaceName
.replace(/\s*-+\s*\d*$/, '') .replace(/\s*-+\s*\d*$/, '')

@ -1,4 +1,4 @@
import {compile} from './utils' import { compile } from './utils'
const main = async () => { const main = async () => {
const circuit = await compile() const circuit = await compile()

@ -1,4 +1,4 @@
import {prove} from './utils' import { prove } from './utils'
// You must modify the input signals to include the data you're trying to generate a proof for. // You must modify the input signals to include the data you're trying to generate a proof for.
const signals: {[name: string]: number | string} = {} const signals: {[name: string]: number | string} = {}

@ -1,5 +1,5 @@
import sindriClient from 'sindri' import sindriClient from 'sindri'
import type {CircuitInfoResponse, ProofInfoResponse} from 'sindri' import type { CircuitInfoResponse, ProofInfoResponse } from 'sindri'
sindriClient.logLevel = 'info' sindriClient.logLevel = 'info'
@ -9,7 +9,7 @@ const authorize = async () => {
if (!apiKey) { if (!apiKey) {
throw new Error('Missing API key.') throw new Error('Missing API key.')
} }
sindriClient.authorize({apiKey}) sindriClient.authorize({ apiKey })
} catch { } catch {
const message = 'No Sindri API key found. Please click the gear in the lower left corner to open the settings page, and add your API key under "Sindri Credentials".' const message = 'No Sindri API key found. Please click the gear in the lower left corner to open the settings page, and add your API key under "Sindri Credentials".'
await remix.call('notification', 'toast', message) await remix.call('notification', 'toast', message)

@ -21,7 +21,7 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,

@ -51,7 +51,6 @@ const logger = {
console.log('check') console.log('check')
await snarkjs.wtns.check(r1cs, wtns, logger); await snarkjs.wtns.check(r1cs, wtns, logger);
console.log('prove') console.log('prove')
const { proof, publicSignals } = await snarkjs.groth16.prove(zkey_final, wtns); const { proof, publicSignals } = await snarkjs.groth16.prove(zkey_final, wtns);

@ -21,7 +21,7 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,

@ -21,7 +21,7 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,

@ -21,7 +21,7 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,

@ -21,7 +21,7 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,

@ -21,7 +21,7 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,

@ -50,7 +50,7 @@ function hash(message: any): bigint {
for (let k = 0; k < 2; k++) { for (let k = 0; k < 2; k++) {
const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32))) const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32))) const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
secrets.push({identityTrapdoor, identityNullifier}) secrets.push({ identityTrapdoor, identityNullifier })
const secret = poseidon([identityNullifier, identityTrapdoor]) const secret = poseidon([identityNullifier, identityTrapdoor])
const identityCommitment = poseidon([secret]) const identityCommitment = poseidon([secret])

@ -50,7 +50,7 @@ function hash(message: any): bigint {
for (let k = 0; k < 2; k++) { for (let k = 0; k < 2; k++) {
const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32))) const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32))) const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
secrets.push({identityTrapdoor, identityNullifier}) secrets.push({ identityTrapdoor, identityNullifier })
const secret = poseidon([identityNullifier, identityTrapdoor]) const secret = poseidon([identityNullifier, identityTrapdoor])
const identityCommitment = poseidon([secret]) const identityCommitment = poseidon([secret])

@ -47,7 +47,7 @@ function hash(message: any): bigint {
for (let k = 0; k < 2; k++) { for (let k = 0; k < 2; k++) {
const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32))) const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32))) const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
secrets.push({identityTrapdoor, identityNullifier}) secrets.push({ identityTrapdoor, identityNullifier })
const secret = poseidon([identityNullifier, identityTrapdoor]) const secret = poseidon([identityNullifier, identityTrapdoor])
const identityCommitment = poseidon([secret]) const identityCommitment = poseidon([secret])
@ -86,7 +86,6 @@ function hash(message: any): bigint {
console.log('check') console.log('check')
await snarkjs.wtns.check(r1cs, wtns, logger); await snarkjs.wtns.check(r1cs, wtns, logger);
console.log('prove') console.log('prove')
const { proof, publicSignals } = await snarkjs.groth16.prove(zkey_final, wtns); const { proof, publicSignals } = await snarkjs.groth16.prove(zkey_final, wtns);
@ -94,8 +93,6 @@ function hash(message: any): bigint {
console.log('zk proof validity', verified); console.log('zk proof validity', verified);
proof1.root.toString() === publicSignals[0] ? console.log('merkle proof valid') : console.log('merkle proof invalid') proof1.root.toString() === publicSignals[0] ? console.log('merkle proof valid') : console.log('merkle proof invalid')
} catch (e) { } catch (e) {
console.error(e.message) console.error(e.message)
} }

@ -21,7 +21,7 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,

Loading…
Cancel
Save