0.2.0 • Published 17 days ago

@unlock-protocol/hardhat-plugin v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
17 days ago

Unlock Hardhat plugin

Unlock hardhat plugin provides a set of tasks and scripts to interact directly with the Unlock Protocol

Installation

yarn install @unlock-protocol/hardhat-plugin

Import the plugin in your hardhat.config.js:

require("@unlock-protocol/hardhat-plugin");

Or if you are using TypeScript, in your hardhat.config.ts:

import "@unlock-protocol/hardhat-plugin";

Configuration

Networks

Info about already deployed Unlock contracts (on mainnet, rinkeby, optimism, bsc,xdai/gnosis, etc.) are added to the unlock param of the hardhat config. You can pass custom info about your own Unlock deployments directly in hardhat.config.js - following the NetworkConfig type in @unlock-protocol/types.

Config example

import "@unlock-protocol/hardhat-plugin";

const config: HardhatUserConfig = {
  solidity: '0.8.7',
  unlock: {
    31337: {
      name: 'Custom Localhost Name',
    },
    12345: {
      name: 'My New Network',
      unlockAddress: '0x...', // your own unlock deployment address
    },
  },
}

Signer

By default, the first hardhat accounts will be used.
You can also pass a private key as follow by exporting WALLET_PRIVATE_KEY to the environment

export WALLET_PRIVATE_KEY=xxx

Usage

There are no additional steps you need to take for this plugin to work.

Install it and access ethers through the Hardhat Runtime Environment anywhere you need it (tasks, scripts, tests, etc).

import { unlock } from 'hardhat'

// deploy the Unlock contract
await unlock.deployUnlock()

// deploy the template
await unlock.deployPublicLock()

// deploy the entire protocol (localhost only)
await unlock.deployProtocol()

// create a lock
const lockArgs = {
  expirationDuration: 60 * 60 * 24 * 7, // 7 days
  currencyContractAddress: null, // null for ETH or erc20 address
  keyPrice: '100000000', // in wei
  maxNumberOfKeys: 10,
  name: 'A Demo Lock'
}
await unlock.createLock(lockArgs)
0.2.0

17 days ago

0.1.6

2 months ago

0.1.4

2 months ago

0.1.0

9 months ago

0.1.2

8 months ago

0.1.1

9 months ago

0.1.3

8 months ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15-alpha.3

2 years ago

0.0.15-alpha.4

2 years ago

0.0.15-alpha.1

2 years ago

0.0.15-alpha.2

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago