# zkturk-contract-artifacts

> Package consists of following artifacts useful for ZkTurk contract interaction: - `contracts/` - `json` artifacts of the contracts. Useful contract **abi** are here, - `typechain-types/` - typechain-types of all contracts, - `frontend-clients` - frontend

Latest version **1.0.29** (published 2023-10-09) · 0 weekly downloads

## Install

```sh
npm install zkturk-contract-artifacts
pnpm add zkturk-contract-artifacts
yarn add zkturk-contract-artifacts
bun add zkturk-contract-artifacts
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.29 |
| Published | 2023-10-09 |
| First published | 2023-07-07 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 344.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | npmscienceacademy |

## Links

- npm: https://www.npmjs.com/package/zkturk-contract-artifacts
- Repository: https://github.com/alcibiadescleinias/zkturk-contract
- Homepage: https://github.com/alcibiadescleinias/zkturk-contract#readme
- Issues: https://github.com/alcibiadescleinias/zkturk-contract/issues
- npm.io page: https://npm.io/package/zkturk-contract-artifacts

## Dependencies (1)

- [ethers](https://npm.io/package/ethers.md) ^5.7.2

## Recent versions

- 1.0.29 (latest) — 2023-10-09
- 1.0.28 — 2023-10-09
- 1.0.27 — 2023-09-29
- 1.0.26 — 2023-09-27
- 1.0.25 — 2023-09-15
- 1.0.24 — 2023-09-06
- 1.0.23 — 2023-09-04
- 1.0.22 — 2023-09-04
- 1.0.21 — 2023-09-02
- 1.0.20 — 2023-09-02
- 1.0.19 — 2023-08-28
- 1.0.18 — 2023-08-28
- 1.0.17 — 2023-08-19
- 1.0.16 — 2023-08-15
- 1.0.15 — 2023-08-14
- … 22 more at https://npm.io/package/zkturk-contract-artifacts/versions

## README

# zkturk-contract-artifacts
Package consists of following artifacts useful for ZkTurk contract interaction:
- `contracts/` - `json` artifacts of the contracts. Useful contract **abi** are here, 
- `typechain-types/` - typechain-types of all contracts,
- `frontend-clients` - frontend oriented classes those need only 
signer and abi to initiate and then used to interact with contract logic. Kinda API with the contracts in the blockchain.

# Install 
```bash
npm i zkturk-contract-artifacts
```

# Example Repo Code
Script code that you may run with `ts-node <script.ts>` is below:

```typescript
import {ZkTurk} from "zkturk-contract-artifacts/dist/typechain-types";
import {ethers} from "ethers";
import {ZkTurkClient} from "zkturk-contract-artifacts/dist/frontend-clients/ZkTurkClient";
// For the line below "resolveJsonModule": true policy should be used.
import ZkTurkArtifacts from "zkturk-contract-artifacts/dist/contracts/ZkTurk.sol/ZkTurk.json";

// ZkTurk contract deployed address (You should know the address).
const contractAddress = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
// Hardhat network localhost (You should have node available on rpc).
const rpcProviderUrl = "http://localhost:8545"


async function workWithFrontendClientExample() {
    // Bad example of how to use wallet from a private key.
    const privateKeyFoo = "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"  // From Hardhat network.
    const provider = new ethers.providers.JsonRpcProvider(rpcProviderUrl)  // harhdat localhost
    const signer = new ethers.Wallet(privateKeyFoo, provider);

    // RM ts-ignore if uses real frontend provider, like commented below:
    // const provider = new ethers.providers.Web3Provider(window.ethereum);
    // const signer = provider.getSigner()
    // @ts-ignore
    const client = new ZkTurkClient(signer, ZkTurkArtifacts.abi, contractAddress)

    console.log('client.getAllProblems()', await client.getAllProblems())
}

async function workWithContractExample() {
    const provider = new ethers.providers.JsonRpcProvider(rpcProviderUrl)
    const contractInstance = new ethers.Contract(contractAddress, ZkTurkArtifacts.abi, provider) as ZkTurk;

    // Signer is not needed for contract call
    console.log('await contractInstance.owner()', await contractInstance.owner())
}


async function main() {
    console.log('Starting...')
    await workWithFrontendClientExample()
    await workWithContractExample()
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
```

## Example of tsconfig.json
```json
{
  "compilerOptions": {
    "incremental": true,            /* Enable incremental compilation */
    "target": "es5",                /* Specify ECMAScript target version: */
    "module": "commonjs",           /* 'none', 'commonjs', 'amd', 'system', etc */
    "declaration": true,            /* Concatenate & emit output to single file.*/
    "outDir": "dist",                /* Redirect output to the directory. */
    "esModuleInterop": true,        /* Enables intero between CommonJS and ES */
    "skipLibCheck": true,           /* Skip type checking of declaration files. */
    "forceConsistentCasingInFileNames": true, /* Disallow inconsistently */
    "resolveJsonModule": true
  }
}
```

## Example of package.json dependency entities
```
  "dependencies": {
    "ts-node": "^10.9.1",
    "typescript": "^5.1.6",
    "zkturk-contract-artifacts": "^0.0.7"
  },
  "devDependencies": {
    "@types/node": "^20.4.0"
  }
```

---
_Source: https://npm.io/package/zkturk-contract-artifacts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
