0.1.3 • Published 6 months ago

@krakenfx/verify v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

@krakenfx/verify

Solidity contracts for Kraken Verify - EAS attestation utilities for verified Kraken users.

Installation

# Using npm
npm install @krakenfx/verify

# Using yarn
yarn add @krakenfx/verify

# Using pnpm
pnpm add @krakenfx/verify

Setup

Solidity Setup

Remappings

Generate remappings for Foundry:

forge remappings > remappings.txt

You might need to add this extra one manually if you're using pnpm:

@ethereum-attestation-service/=node_modules/.pnpm/@ethereum-attestation-service+eas-contracts@1.8.0/node_modules/@ethereum-attestation-service

IDE Configuration

Update your IDE to support remappings. For VS Code:

// .vscode/settings.json
{
  "solidity.remappings": [
    "...=node_modules/...",
  ]
}

TypeScript Setup

If you're using TypeScript in your project, make sure to configure it to handle JSON imports:

// tsconfig.json
{
  "compilerOptions": {
    // ...other options
    "resolveJsonModule": true,
    "esModuleInterop": true
  }
}

Smart Contract Usage

// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

// Import directly from package
import { KrakenVerifyAccessControl } from "@krakenfx/verify/src/abstracts/KrakenVerifyAccessControl.sol";

contract MyContract is KrakenVerifyAccessControl {
    // Only users with valid Kraken Verify attestations can call this function
    function verifiedUserFunction() external onlyVerified {
        // Your implementation
    }
}

Client Usage

ESM / TypeScript

// ES Modules / TypeScript
import { VerifyClient } from "@krakenfx/verify";

const verifyClient = new VerifyClient();

// Check if an address is verified
const isVerified = await verifyClient.isAddressVerified(
  "0x2193981f2d65149644C039c9071f2bE8b5938F0B"
);

console.log(
  `Verification result: ${isVerified ? "✅ Verified" : "❌ Not verified"}`
);

CommonJS

// CommonJS
const { VerifyClient } = require("@krakenfx/verify");

const verifyClient = new VerifyClient();

// Check if an address is verified
async function checkVerification() {
  const isVerified = await verifyClient.isAddressVerified(
    "0x2193981f2d65149644C039c9071f2bE8b5938F0B"
  );
  
  console.log(
    `Verification result: ${isVerified ? "✅ Verified" : "❌ Not verified"}`
  );
}

checkVerification();

What's Included

This package provides access control for verified Kraken users through EAS attestations:

  • KrakenVerifyAccessControl.sol: Abstract contract with the onlyVerified modifier
  • Supporting libraries and interfaces for attestation verification
  • TypeScript client for verification checks

Requirements

  • Solidity 0.8.24
  • TypeScript (for client usage)
  • Viem (peer dependency for TypeScript client)

License

MIT