GithubHelp home page GithubHelp logo

0xlny / cairo1js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from khanti42/cairo1js

0.0 0.0 0.0 337 KB

DAPP to test Cairo 1 smart-contract on Starknet - powered by starknet.js

Home Page: https://cairo1-js.vercel.app

License: MIT License

JavaScript 0.25% TypeScript 79.97% CSS 12.45% Cairo 7.33%

cairo1js's Introduction

Cairo1JS Local Enviornment Set up

Presentation

This repo is a fork used to demonstrates how StarkNet DAPP builders can create a local environment to test upcoming features/fixes of the StarkNet snap metamask extension.

The DAPP is made in the next.js framework, using the experimental appDir feature. Coded in Typescript. Using React, Zustand context & Chaka-ui components.

Setting Up Local Test Environment for StarkNet MetaMask Snap with get-starknet

The get-starknet module communicates with the StarkNet Snap by utilizing a Webpack-fed module that serves as an RPC client. This client enables communication with the StarkNet Snap. Below we describe a way to set up this environment locally to facilitate the testing of upcoming features in the StarkNet Metamask Snap.

Environment Setup

The environment configuration is as follows:

graph TD
    THIS_DAPP -->|GET_STARKNET| RPC_CLIENT
    RPC_CLIENT -->|TALKS WITH| REMOTE_ENTRY["localhost:8082/remoteEntry.js"]
    REMOTE_ENTRY -->|USES | METAMASK_SNAP["localhost:8081"]
Loading

This setup allows a StarkNet DAPP to test upcoming features in the MetaMask Snap locally before these changes are released. This early testing facilitates feedback during the iterative process with StarkNet DAPP builders.

To set up this local test environment for the StarkNet MetaMask Snap with get-starknet, follow these steps:

Part 1 : Metamask starknet-snap

  1. Clone the StarkNet Snap repository:
git clone https://github.com/Consensys/starknet-snap.git
cd starknet-snap
yarn 
yarn setup 
  1. Serve packages/starknet-snap locally:

For the local serving of starknet-snap, you need both

  • a Voyager Alchemy API key.
  • an Alchemy API key.

Make sure to add the following to your .env file in the packages/starknet-snap of the starknet-snap repo. You can use the .env.example file as a starting point.

cd packages/starknet-snap 
cp .env.example .env 
# Edit .env and populate voyager and alchemy key
yarn workspace @consensys/starknet-snap watch
  1. Build and serve the remoteEntry.js (necessary for the get-starknet MetaMask bridge):
cd packages/get-starknet
cp .env.sample .env 
# No need to edit .env
yarn serve:fed:local

Part 2 : Starknet.io Get-starknet repo

  1. Clone the get-starknet repository:

To get the multi wallet discovery feature we need to get the fork from Consensys because the change has not been merged in the upstream repo yet

git clone https://github.com/Consensys/get-starknet.git
cd get-starknet
git checkout feat/eip-6963
echo "SNAP_ID=local:http://localhost:8081" > .env
cp packages/core/.env.sample packages/core/.env
pnpm install 
pnpm run build 
cd packages/ui
yarn link 
# This will link a get-starknet package to be used in the next section. 

Part 3 : In this repo

yarn
yarn link get-starknet 
cp .env.sample .env.local
# Edit .env.local to set a starknet RPC url (you can use the one you used in Part 1)
yarn dev

cairo1js's People

Contributors

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