npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@redstone-finance/gelato-relayer

v0.7.3

Published

RedStone Relayer based on Gelato Web3 Functions

Downloads

138

Readme

RedStone Web3 Functions

Web3 Functions are decentralized cloud functions that work similarly to AWS Lambda or Google Cloud, just for web3. They enable developers to execute on-chain transactions based on arbitrary off-chain data (APIs / subgraphs, etc) & computation. These functions are written in Typescript, stored on IPFS and run by Gelato. w3f class is injected into the hardhat runtime environment.

You can find the official Web3 Functions documentation here.

Table of contents

-The redstone function

The redstone function

The function is an interface written for the @redstone-finance/on-chain-relayer package. The documentation of the RedStone Classic model with relayer can be found here.

Calling the function

Use the predefined

yarn w3f-run

Under the hood, it runs the following command:

npx hardhat w3f-run redstone
  • Options:
    • --logs Show internal Web3 Function logs
    • --debug Show Runtime debug messages
    • --network [NETWORK] Set the default runtime network & provider.

Example:

npx hardhat w3f-run redstone --logs

The configuration: use User arguments

Put the manifestUrls of your configuration in the userArgs.json file. Make sure the corresponding network is listed in the hardhat.config.ts file under w3f.networks configuration property. In the Gelato environment, put the value into a proper field in the create-task form.

gelato-manifestUrl.png

That's it about running the function in a regular (non-fallback) mode.

The fallback mode: Use user secrets

Input your secrets in the .env file in the same directory as your web3 function (i.e. `web3-functions/redstone/.env) to run the function in the fallback mode. To run the function in a non-fallback mode, the user secrets are not needed.

Input your PRIVATE_KEY and ALCHEMY_ID in the top-level .env file

# when >0, runs the trigger functions depending on the manifest in the fallback mode
FALLBACK_OFFSET_IN_MILLISECONDS=120000

# put here a json-decodable array of strings;
# **DO NOT*** use the escaping slashes
HISTORICAL_PACKAGES_GATEWAYS=["https://redstone.finance/..."]

SKIP_TX_SENDING_IF_OFFSET_MINUTES_DID_NOT_PASS=true

gelato-secrets.png

The function fails when any deviation trigger is defined in the manifest, the fallback mode is on, but the HISTORICAL_PACKAGES_GATEWAYS is not properly defined (it must be a non-empty, JSON-decodable array of strings).

Use the deployed Web3Function on Gelato

To create a task on Gelato, visit https://beta.app.gelato.network/new-task

The latest released CID is written to the web3-function_redstone.deployed file. We recommend running the function each minute if no other requirement is needed.

Deploying an updated Web3Function on IPFS

Use the predefined:

yarn w3f-deploy

or

npx hardhat w3f-deploy redstone

command to deploy your web3 function.

The deployer will output your Web3Function IPFS CID, which you can use to create your task on Gelato:

 ✓ Web3Function deployed to ipfs.
 ✓ CID: QmPXoejvmuSMWWAvvDyA4q9uXfZugsQFasAT3mwfL7CKCM

To create a task on Gelato, visit:
> https://beta.app.gelato.network/new-task?cid=QmPXoejvmuSMWWAvvDyA4q9uXfZugsQFasAT3mwfL7CKCM