Giter VIP home page Giter VIP logo

safesnap-simulation's Introduction

Safesnap Simulation

This project serves as a simple wrapper around Tenderly's Simulation API, enabling private use of the Tenderly access token and secure interaction with the Tenderly API.

Requirements

  • Node.js
  • npm or yarn
  • Cloudflare account
  • Wrangler CLI

Local Development

To run this project locally, you need to install the dependencies and use Wrangler's dev command to start the development server.

Live Deployment

The deployed Cloudflare worker can be accessed at: https://safesnap-simulation.gnosisguild.workers.dev

Setup

  1. Clone the repository:
git clone url_to_repository
cd safesnap-simulation
  1. Install dependencies:
npm install

or if you use yarn:

yarn install
  1. Start the local development environment with Wrangler:
wrangler dev

Simulation Request Example

The following is an example of a simulation body for bundle transactions:

{
  "simulations": [
    {
      "network_id": "",
      "from": "",
      "to": "",
      "input": "",
      "value": "",
      "save": true,
      "save_if_fails": true,
      "gas": 8000000,
      "gas_price": 0,
      "simulation_type": "full"
    }
  ]
}

This command starts a local server where you can test your worker. It automatically reloads your worker when you make changes to the source code.

Deploying to Cloudflare Workers

To deploy the worker to Cloudflare Workers, you need to configure your project with the necessary environment variables and use the wrangler deploy command.

Environment Variables

The worker requires the following environment variables to connect to the Tenderly API:

  • TENDERLY_USER: Your Tenderly username. Set this variable in wrangler.toml.
  • TENDERLY_PROJECT: The Tenderly project name. Set this variable in wrangler.toml.
  • TENDERLY_ACCESS_KEY: This should be kept secret. It is added to the Cloudflare worker via API in a GitHub Action. You can also manually add this using the Cloudflare Dashboard for local testing or staging environments.

Deployment

  1. To deploy the worker to Cloudflare, ensure you have set up your wrangler.toml with the correct account details and environment variables (excluding the secret TENDERLY_ACCESS_KEY).

  2. Deploy your worker to Cloudflare Workers:

wrangler publish

Ensure that TENDERLY_ACCESS_KEY is securely added to your Cloudflare Worker as described in the "Environment Variables" section.

Contributing

Contributions to this project are welcome. Please ensure to follow the code style.

safesnap-simulation's People

Contributors

juliopavila avatar

Watchers

 avatar  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.