-
Notifications
You must be signed in to change notification settings - Fork 25
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
doc: configure contracts page #33
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3742647
doc: configure contracts page
mexes20 f58b9a1
fix: Implement requested changes and modifications
mexes20 ad7e363
fix: Impl changes
mexes20 6fcbd87
fix: Impl requested changes
mexes20 e3b5089
fix: Impl changes
mexes20 ec96589
final changes implemented
mexes20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
sidebar_position: 4 | ||
description: How to import other Contracts. | ||
--- | ||
|
||
# Importing other contracts | ||
|
||
The `Configure Contracts` page allows you to pull existing contracts from the Starknet network and incorporate them into your `Scaffold-Stark 2` project. | ||
It generates a configuration file that can be used to replace or append to your local predeployedContracts.ts or configExternalContracts.ts file, enabling contract debugging in the `/debug` page of your Scaffold-Stark project. | ||
|
||
### **Getting Started**: | ||
|
||
### ** Accessing the Configure Contracts Page** | ||
|
||
To access the page, navigate to the bottom of the screen and click on Configure Contracts. This will open a new interface where you can search for and import contracts. | ||
|
||
<img src="/img/configure_contracts.png" alt="configure-contracts" /> | ||
|
||
### How to Use the Configure Contracts Page | ||
|
||
#### 1. Chain Selection in `scaffold.config.ts` | ||
|
||
The contracts pulled from the network are determined by the chain configured in the `scaffold.config.ts` file. This configuration decides whether you are interacting with the Sepolia or Mainnet network. | ||
|
||
- If `Sepolia` is configured, contracts will be fetched from the `Sepolia testnet`. | ||
- If `Mainnet` is configured, contracts will be fetched from the `Mainnet network`. | ||
|
||
**Note:** | ||
While some contracts may have the same address on both `Sepolia and Mainnet`, this is not always guaranteed. Always double-check you are on the correct network based on the contract's intended usage. | ||
|
||
```ts | ||
const scaffoldConfig = { | ||
targetNetworks: [chains.devnet], | ||
``` | ||
|
||
#### 2. Enter the Contract Address and Name | ||
|
||
- Once on the page, in the designated input fields, enter the contract address and contract name. | ||
|
||
- These values are required to locate the contract on the network and pull the relevant details (ABI, address, classHash). | ||
|
||
<img src="/img/configure_contracts_Input.png" alt="configure-contracts" /> | ||
|
||
Always make sure the contract address is correct and that you are searching on the right network. | ||
|
||
#### 3. Click the "Download Contract File" Button | ||
|
||
After entering the details, click the `Download Contract File` button. | ||
|
||
This will fetch the contract information (ABI, address, and classHash) from the configured network (either Sepolia or Mainnet, as set in the scaffold.config.ts file). | ||
|
||
#### 4. Generate and Download the Configuration File | ||
|
||
The tool will generate a configuration file that includes: | ||
|
||
- Contract ABI | ||
- Contract Address | ||
- Class Hash | ||
|
||
```ts | ||
export const externalContracts = [ | ||
{ | ||
address: "0x1234...", | ||
abi: [...], // Contract ABI here | ||
classHash: "0x5678..." | ||
} | ||
]; | ||
``` | ||
|
||
#### 5. Replace or Append the Configuration File | ||
|
||
- Download the file and replace or append its contents to your local `configExternalContracts.ts` file. This file is used to register external contracts that you want to interact with in your project. | ||
|
||
Alternatively, if you're working with pre-deployed contracts, you can modify the `predeployedContracts.ts` file. | ||
|
||
#### 6. Use the /debug Page | ||
|
||
- With the updated contract configuration file, navigate to the `/debug page` in your project. | ||
|
||
You can interact with and test the contract using the `Scaffold-Stark hooks` and `utilities` here. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just include this part ser, no need to include the entire file, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay ser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ser, kindly review @metalboyrick