Code Monkey home page Code Monkey logo

gogopool-observer's Introduction

Garden-Observer

(re)Actions for on-chain events. Uses Tenderly Actions and Vitest for local development.

Setup

While installing dependencies for the root as well as the actions folder, copy over the env.example file to a .env file.

# ./ (in root) install deps for local dev
npm i

# ./src/actions install deps to ship over to serverless land ๐Ÿ๏ธ
cd ./src/actions && npm i

Testing

Testing is handled with Vitest and sets the environment to be development. This is so Discord isn't spammed during testing.

# Start vitest in visual mode. How exciting!
npm run test

The tests use a payload in the aptly named payload folder which contains a single transaction receipt. The tests basically mock having that event triggered and how to respond. The functions are designed to "throw" if the event shouldn't have been responded to. Maybe this was a bad decision. But they early exit which is fun.

I have this in BetterTouchTool set to a hotkey to get the tx receipt. Could use cast receipt <tx> --rpc-url https://eth.llamarpc.com as well.

async (clipboardContentString) => {
  try {
    return JSON.stringify(
      (
        await (
          await fetch("https://eth.llamarpc.com", {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: `{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["${clipboardContentString}"],"id":67}`,
          })
        ).json()
      ).result
    );
  } catch (error) {
    return "Error";
  }
};

Deployment

Deployment happens either through GitHub Actions or locally.

Locally

Call tenderly actions deploy which will upload the whole lot to Tenderly with some helpful output.

npm run deploy

GitHub Actions

On every push, this action will deploy the actions to Tenderly. This is important to ensure that what exists on Tenderly is synched with what's in GitHub.

๐Ÿšจ TENDERLY_ACCESS_KEY and TENDERLY_EMAIL must be set in a GitHub environment called "production"! If it's not called "production", make sure to update the github-actions-deploy.yaml! ๐Ÿšจ

gogopool-observer's People

Contributors

namaskar-1f64f avatar russeii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.