Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ja contents #483

Merged
merged 17 commits into from
Jan 31, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ This workshop is built around Scaffold-ETH 2 and The Graph. You will learn how t
- 🔥 **Burner Wallet & Local Faucet**: Quickly test your application with a burner wallet and local faucet.
- 🔐 **Integration with Wallet Providers**: Connect to different wallet providers and interact with the Ethereum network.

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson1-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_1_1.png)

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson1-2.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_1_2.png)

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson1-3.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/L0_1_3.png)

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson1-4.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_1_4.png)

To learn more about Scaffold-ETH checkout the [Github repository](https://github.com/scaffold-eth/scaffold-eth-2) or [Scaffoldeth.io](https://scaffoldeth.io).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ First, we will start out with a special build of Scaffold-ETH 2 written by Simon

We will need a total of four different windows to setup Scaffold-ETH 2 and The Graph.

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson3-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_3_1.png)

```
git clone -b subgraph-package \
Expand All @@ -21,15 +21,15 @@ cd scaffold-eth-2-subgraph-package && \
yarn install
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson3-2.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_3_2.png)

Next, we will want to start up our local blockchain so that we can eventually deploy and test our smart contracts. Scaffold-ETH 2 comes with Hardhat by default. To spin up the chain just type the following yarn command…

```
yarn chain
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson3-3.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_3_3.png)

> You will keep this window up and available so that you can see any output from hardhat console. 🖥️

Expand All @@ -39,7 +39,7 @@ Next we are going to spin up our frontend application. Scaffold-ETH 2 comes with
yarn start
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson3-4.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_3_4.png)

> You will also want to keep this window up at all times so that you can debug any code changes you make to NextJS, debug performance or just check that the server is running properly.

Expand All @@ -49,16 +49,16 @@ Next, you will want to open up a third window where you can deploy your smart co
yarn deploy
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson3-5.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_3_5.png)

> You should get a tx along with an address and amount of gas spent on the deploy. ⛽

If you navigate to http://localhost:3000 you should see the NextJS application. Explore the menus and features of Scaffold-ETH 2! Someone call in an emergency, cause hot damn that is fire! 🔥

You can test by sending an update to the setGreeting function. In order to do this you will need to get some gas by clicking cash icon in the top right hand corner next to the burner wallet address. This will send you 1 ETH from the faucet.
You can test by sending an update to the setGreeting function. In order to do this you will need to get some gas by clicking cash icon in the top right hand corner next to the burner wallet address. This will send you 1 ETH from the faucet.

Then you can simply navigate to "Debug Contracts", click the string field under setGreeting and type something fun and then click "SEND"

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson3-6.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_3_6.png)

After this is complete you should also get a transaction receipt that you can expand below to verify it was successful.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ yarn clean-node
yarn run-node
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson4-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_4_1.png)

This will spin up all the containers for The Graph using docker-compose. You will know this is complete when it reads "Downloading latest blocks from Ethereum..."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

### ✅ Create and ship our Subgraph

Now we can open up a fourth window to finish setting up The Graph. 😅 In this forth window we will create our local subgraph!
Now we can open up a fourth window to finish setting up The Graph. 😅 In this forth window we will create our local subgraph!

> Note: You will only need to do this once.

```
yarn local-create
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson5-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_5_1.png)

> You should see some output stating your Subgraph has been created along with a log output on your graph-node inside docker.

Expand All @@ -20,7 +20,7 @@ Next we will ship our subgraph! You will need to give your subgraph a version af
yarn local-ship
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson5-2.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_5_2.png)

> This command does the following all in one… 🚀🚀🚀

Expand All @@ -38,7 +38,7 @@ npm install -g ts-node

If your subgraph deployment was successful it will look something like this:

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson5-3.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_5_3.png)

You should get a build completed output along with the address of your Subgraph endpoint.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Go ahead and head over to your subgraph endpoint and take a look!
}
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-0/Lesson6-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-0/0_6_1.png)

> If all is well and you’ve sent a transaction to your smart contract then you will see a similar data output!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Add the following new line of code.

You can drop this event and function anywhere inside the contract, but best practice is to drop it below any modifiers or the constructor.

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson1-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_1_1.png)

We can save our contract and then deploy those new changes.
We can save our contract and then deploy those new changes.

> Pro tip, if you use the --reset flag you will ALWAYS get a fresh contract deployed, regardless of any updates to the source.

Expand All @@ -32,10 +32,10 @@ yarn deploy --reset

You should see the following output:

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson1-2.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_1_2.png)

#### ✅ Test your new function

Navigate over to http://localhost:3000/debug and send vitalik.eth a message.
Navigate over to http://localhost:3000/debug and send vitalik.eth a message.

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson1-3.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_1_3.png)
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type SendMessage @entity(immutable: true) {

```

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson2-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_2_1.png)

#### ✅ Update the Subgraph manifest

Expand All @@ -54,15 +54,15 @@ entities:
handler: handleSendMessage
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson2-2.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_2_2.png)

If you are following along, next you will need to copy over your new abi and regenerate the code.

```
yarn abi-copy && yarn codegen
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson2-3.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_2_3.png)

#### ✅ Update the mapping script

Expand Down Expand Up @@ -122,7 +122,7 @@ export function handleSendMessage(event: SendMessageEvent): void {

Your changes should be accepted inside of your editor without any linting errors.

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson2-4.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_2_4.png)

After that is done, you are almost done… time to ship it!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
yarn local-ship
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson3-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_3_1.png)

Be sure to add a new version number to your subgraph when it prompts you. This should be higher then the previous version.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Test
## Test

### ✅ Test your newly deployed Subgraph

Expand All @@ -14,8 +14,8 @@ Next, lets see if our data is in The Graph. Here is an example query that shows
}
```

You should get a nice response like this:
You should get a nice response like this:

![](/public/images/The_Graph-SE2-Subgraph-package/section-1/Lesson4-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-1/1_4_1.png)

Data is such a beautiful thing huh?
Data is such a beautiful thing huh?
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you need some testnet funds you can try the following faucets:
yarn run generate
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson2-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_2_1.png)

You should see the following saved to your hardhats environment variable file
```
Expand All @@ -27,7 +27,7 @@ You should see the following saved to your hardhats environment variable file
yarn account
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson2-2.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_2_2.png)

This should display your public address along with a fancy QR code. And balances?!? Woooowwwww that is slick! <3

Expand Down Expand Up @@ -60,4 +60,4 @@ Public address: 0x87f00B2c39F97CD00BC6d09777BC4327aCA39180

Send over some testnet ETH from the chain of your choice. I would suggest sepolia as its fairly easy to get some testnet ETH from various sources. In the output below you can see I now have a sepolia balance.

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson2-3.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_2_3.png)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Now we can deploy to our testnet of choice... in this example we will deploy to
yarn deploy --network sepolia
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson3-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_3_1.png)

If all is well you should see the following success output.

Expand All @@ -23,7 +23,7 @@ deploying "YourContract" (tx: 0xf404021d736271a7a0a84d124ed35250c533efe37c177536
yarn verify --network sepolia
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson3-2.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_3_2.png)

You should see the following successful output...

Expand All @@ -32,6 +32,6 @@ verifying YourContract (0x541D469C06990B7F0bd5103b57997cE8a39C050c) ...
waiting for result...
=> contract YourContract is now verified
```

You can also check your contract was successfully on etherscan. [Here](https://sepolia.etherscan.io/address/0x541D469C06990B7F0bd5103b57997cE8a39C050c#code) is the one I deployed and verified.

Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ Now that our smart contract is on a public testnet it is time to push our Subgra

#### ✅ Navigate to https://thegraph.com/studio

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Studio1.png)
![Studio1](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_4_1.png)

#### ✅ Connect your wallet

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Studio2.png)
![Studio2](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_4_2.png)

You might need to sign a request to verify that you own the connected wallet.

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Studio3.png)
![Studio3](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_4_3.png)

#### ✅ Click Create a Subgraph

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Studio4.png)
![Studio4](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_4_4.png)

#### ✅ Name your Subgraph

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Studio5.png)
![Studio5](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_4_5.png)

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

#### ✅ Use the Graph CLI to complete the deployment

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Studio6.png)
![Studio6](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_5_1.png)

You can install the Graph CLI globally using the following command.

```
yarn global add @graphprotocol/graph-cli
```

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson5.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_5_2.png)

#### ✅ Init your Subgraph

Expand All @@ -24,7 +24,7 @@ graph init --studio name_of_your_subgraph

It should looks something like this...

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson5-1.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_5_3.png)

#### ✅ Authenticate to Studio

Expand All @@ -40,7 +40,7 @@ Success looks like this:
Deploy key set for https://api.studio.thegraph.com/deploy/
```

#### ✅ Run codegen and build your subgraph
#### ✅ Run codegen and build your subgraph

You will need to change into the directory where the subgraph was created in the previous step.

Expand All @@ -51,7 +51,7 @@ graph codegen && graph build

Success will look something like the following!

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson5-3.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_5_4.png)

#### ✅ Deploy

Expand All @@ -63,13 +63,13 @@ graph deploy --studio name_of_your_subgraph

Choose a version and fire away!

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Lesson5-4.png)
![](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_5_5.png)

It might take up to 5 minutes for you subgraph to deploy to the studio. Once it has been deployed, you can check that is fully syncing and has no errors. A successful deploy will look like the following.

![](/public/images/The_Graph-SE2-Subgraph-package/section-2/Studio7.png)
![Studio7](/public/images/The_Graph-SE2-Subgraph-package/section-2/2_5_6.png)

#### ✅ Send a transaction and verify in Subgraph Playground
#### ✅ Send a transaction and verify in Subgraph Playground

On Etherscan you can send a transaction directly to your contract on the Contract -> Write Contract tab.

Expand All @@ -86,7 +86,7 @@ Our Query:
}
```

Our data object response:
Our data object response:

```
{
Expand Down
Loading
Loading