-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from a-singh09/blockchain-integration
[Feat] Added blockchain integration in the Create Stablecoin form
- Loading branch information
Showing
6 changed files
with
258 additions
and
104 deletions.
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
NEXT_PUBLIC_WEBSITE_URL= | ||
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= | ||
NEXT_PUBLIC_ALCHEMY_API_KEY= | ||
NEXT_PUBLIC_NETWORK= | ||
NEXT_PUBLIC_FACTORY_ADDRESS_FOUNDRY= | ||
NEXT_PUBLIC_FACTORY_ADDRESS_SEPOLIA= | ||
NEXT_PUBLIC_FACTORY_ADDRESS_ETHEREUM= |
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
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
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
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 |
---|---|---|
@@ -1,6 +1,45 @@ | ||
export const Chains: Chain[] = [ | ||
{ value: "1", label: "Ethereum" }, | ||
{ value: "56", label: "Binance Smart Chain" }, | ||
{ value: "137", label: "Polygon" }, | ||
{ value: "2001", label: "Milkomeda" }, | ||
export interface Chain { | ||
value: string; | ||
label: string; | ||
factoryAddress: `0x${string}`; | ||
} | ||
|
||
const isDevelopment = process.env.NODE_ENV === "development"; | ||
|
||
const productionChains = [ | ||
{ | ||
value: "1", | ||
label: "Ethereum", | ||
factoryAddress: | ||
(process.env.NEXT_PUBLIC_FACTORY_ADDRESS_ETHEREUM as `0x${string}`) || | ||
undefined, | ||
}, | ||
{ | ||
value: "11155111", | ||
label: "Sepolia", | ||
factoryAddress: | ||
(process.env.NEXT_PUBLIC_FACTORY_ADDRESS_SEPOLIA as `0x${string}`) || | ||
undefined, | ||
}, | ||
]; | ||
|
||
const developmentChains = [ | ||
{ | ||
value: "31337", | ||
label: "Foundry", | ||
factoryAddress: | ||
(process.env.NEXT_PUBLIC_FACTORY_ADDRESS_FOUNDRY as `0x${string}`) || | ||
undefined, | ||
}, | ||
]; | ||
|
||
export const Chains: Chain[] = isDevelopment | ||
? developmentChains | ||
: productionChains; | ||
|
||
export const getFactoryAddress = ( | ||
chainId: number, | ||
): `0x${string}` | undefined => { | ||
return Chains.find((chain) => Number(chain.value) === chainId) | ||
?.factoryAddress; | ||
}; |
Oops, something went wrong.