Comments (1)
We are investing how to improve the developer workflow around updating smart contracts and frontend code.
After you create a project using BOAT, these are the folders and files you are interested in when updating a smart contract:
Using BuyMeACoffee smart contract as an example below
<project-name>
├── contracts
│ ├── src
│ │ └── BuyMeACoffee.sol ← smart contract code
│ └──out/BuyMeACoffee.sol
│ └── BuyMeACoffee.json ← output from "forge build" which contains the updated ABI
│
└── web/app/buy-me-coffee
└── _contracts
├── BuyMeACoffeeABI.ts ← copy of ABI from contracts/out/BuyMeACoffee.json
└── useBuyMeACoffeeContract.ts ← deploy address
Importing updated ABI to frontend code
After updating your smart contract code, run forget build
in the contracts
folder. This will create a json in the contracts/out
directory.
The output json contains additional information. We only need the abi
property from that json object. Let's use jq
to extract just the abi
property
# from the "contract" folder
jq .abi out/BuyMeACoffee/BuyMeACoffee.json
Take the output of jq
and update web/app/buy-me-coffee/_contracts/BuyMeACoffeeABI.ts
Done with first step!
Deploying your smart contract and updating frontend code
Make sure you got all the environment variables squared away in contracts/.env
and get some base sepolia eth from a faucet!
To deploy your smart contract,
# from the "contract" folder
source .env && forge script script/LocalContract.s.sol:LocalContractScript --broadcast --rpc-url https://sepolia.base.org
In the long output, find the value for Contract Address
.
Copy that value and update web/app/buy-me-coffee/_contracts/useBuyMeACoffeeContract.ts
with the new address.
Outro
This is one of the more error prone steps. Take it step by step.
If you are new smart contract deployment, just try deploying the existing BuyMeACoffee
contract and replace the contract address. After, try updating BuyMeACoffee.sol
and get the new ABI in your frontend code.
We are thinking of ways to make this step easier in the future! Happy hacking!
from build-onchain-apps.
Related Issues (20)
- Feature Request: Mint NFT Stepper UI
- Feature Request: Mint NFT Flow - Better Design for States
- Feature Request: ERC 721 and 1155 Support for Mint NFT
- Feature Request: Internationalize All Text
- Feature Request: Use react-query and/or wagmi instead of custom fetch hooks for datafetching HOT 4
- Feature Request: Typescript import path HOT 6
- Feature Request: Automatic contracts and UI abi syncing HOT 6
- Feature Request: Template Folder Restructure HOT 2
- Feature Request: Make onchainkit a dependency HOT 2
- Bug Bash Feb 2024 HOT 16
- Feedback: just tried BASE for our project HOT 2
- Documentation Request: Explanation of `publicMint` function in `AllowlistNFT.sol`
- Feature Request: Improving CLI flow HOT 2
- Documentation Request: HOT 1
- Documentation Request: Explanation of `buyCoffee` and `getMemos` functions in `BuyMeACoffee.sol`
- Feature Request: Improve ipfs utils
- Feature Request: please think about adding functionality to pay gass fee other than ETH HOT 3
- Feature Request: Add linting to `template/contracts/` HOT 2
- Bug: `cast` doesn't work in `contracts` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from build-onchain-apps.