This project is an example of a command-line interface (CLI) that uses the functions-toolkit to interact with Chainlink Functions. Official docs.
To set up the project, follow these steps:
-
Clone this repository.
git clone https://github.com/DynamicNFTHub/AutoMetaNFT.git
-
Change the dir.
cd AutoMetaNFT
-
Install the required dependencies.
npm install
-
I use @chainlink/env-enc package to encrypt environment variables at rest. Set the password to encrypt and decrypt the environment varilable file
.env.enc
:npx env-enc set-pw
-
Set the following variables:
- PRIVATE_KEY
- POLYGON_MUMBAI_RPC_URL
- WEB_SERVER_AUTHENTICATION_KEY
-
Modify your "source.js":
const url = "" // REPLACE this with your REST url
-
Modify your "updateRequest.js":
const consumerAddress = "0x" // REPLACE this with your Functions consumer address const subscriptionId = 3 // REPLACE this with your subscription ID
-
Run the "updateRequest.js" script:
node scripts/updateRequest.js