From 46675ae11d4f1dd5392ff81d8c34688307c18611 Mon Sep 17 00:00:00 2001 From: Intizar Tashov Date: Fri, 3 May 2024 18:17:12 +0900 Subject: [PATCH] Update readme and remove and add consumer hardhat tasks (#26) * explain how to connect consumer to existing payment account * make contract param optional in add and remove consumer tasks * remove console log from hardhat config * fix typos in readme --------- Co-authored-by: Bisonai --- README.md | 5 ++++- hardhat.config.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e772bf..0892b35 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Executing the script will provide you with the cost associated with a single VRF There are two types of payments supported by Orakle Network VRF: **Prepayment** and **Direct Payment**. **Prepayment** requires user to create account and fund it with KLAY before being able to use it. -The script below will create a new account and deposit ` 2.5` KLAY from address corresponding to your mnemonic from `.env` file. +The script below will create a new account and deposit ` 2.5` KLAY from address corresponding to your mnemonic or private key from `.env` file. If you prefer to use Orakl Network VRF without having a long-lasting account, you can use **Direct Payment** method. In such case, you can skip the following command and go directly to **Request VRF with Direct Payment**. @@ -103,6 +103,9 @@ After successfully executing the command above, set the value of environment var If you do not do it, the request for VRF using Prepayment won't be working properly. After setting the `ACC_ID` in `.env` file, you can move to the next step **Request VRF with Prepayment**. +If you'd like to use your existing prepayment account, set your account id in the `.env` file and add your deployed consumer to your account by executing the hardhat `addConsumer` task (described in more detail below). Note that providing `account-id` parameter is optional if your account id is already in the `.env` file and `consumer` parameter is also optional if you've deployed your consumer using hardhat under this repository. + + ## Request & Read VRF Before running following scripts, one must deploy `VRFConsumer` smart contract. diff --git a/hardhat.config.ts b/hardhat.config.ts index 42b5785..5e54357 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -144,7 +144,7 @@ task('withdraw', 'Withdraw $KLAY from account') }) task('addConsumer', 'Add consumer') - .addParam('consumer', 'Consumer Address') + .addOptionalParam('consumer', 'Consumer Address') .addOptionalParam('accountId', 'Account Id') .setAction(async (taskArgs, hre) => { const accId = taskArgs.accountId || process.env.ACC_ID @@ -163,7 +163,7 @@ task('addConsumer', 'Add consumer') }) task('removeConsumer', 'Remove consumer') - .addParam('consumer', 'Consumer Address') + .addOptionalParam('consumer', 'Consumer Address') .addOptionalParam('accountId', 'Account Id') .setAction(async (taskArgs, hre) => { const accId = taskArgs.accountId || process.env.ACC_ID