-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Increase toast visibility # Omit cluster selector # Use env variables for token addresses # Remove the inability to interact with the wallet modal # Improve the amount field
- Loading branch information
Showing
19 changed files
with
137 additions
and
192 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 |
---|---|---|
|
@@ -12,11 +12,12 @@ It demonstrates how to integrate the [`TokenUpgrade`](https://github.com/hoodies | |
|
||
Use the button down here to launch it on [Vercel](https://vercel.com). | ||
|
||
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fhoodieshq%2Ftoken-upgrade-ui&env=NEXT_PUBLIC_TOKEN_UPGRADE_PROGRAM_ID&envDescription=Upgrade%20Program%20Address&project-name=solana-token-upgrade-app&repository-name=solana-token-upgrade-app&demo-title=Token%20Upgrade%20UI&demo-description=App%20to%20Upgrade%20Token%20on%20Solana%20Blockchain) | ||
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fhoodieshq%2Ftoken-upgrade-ui&env=NEXT_PUBLIC_CLUSTER_URL&env=NEXT_PUBLIC_ESCROW_AUTHY_ADDRESS&env=NEXT_PUBLIC_ORIGIN_TOKEN_ADDRESS&env=NEXT_PUBLIC_TARGET_TOKEN_ADDRESS&env=NEXT_PUBLIC_TOKEN_UPGRADE_PROGRAM_ID&envDescription=Upgrade%20Program%20Address%20Variables&root-directory=packages%2Fapp&project-name=solana-token-upgrade-app&repository-name=solana-token-upgrade-app&demo-title=Token%20Upgrade%20UI&demo-description=App%20to%20Upgrade%20Token%20on%20Solana%20Blockchain) | ||
|
||
Bear in mind it will require some configuration: | ||
|
||
- Set `NEXT_PUBLIC_TOKEN_UPGRADE_PROGRAM_ID` environment variable and provide the address of the deployed [`token-upgrade`](https://github.com/solana-labs/solana-program-library/tree/master/token-upgrade) program. | ||
- Set all [other env variables](/packages/app/.env) to the proper values. | ||
- The [root directory](https://vercel.com/docs/deployments/configure-a-build#root-directory) should lead to the `packages/app` directory. | ||
- `[email protected]` | ||
|
||
|
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 +1,5 @@ | ||
NEXT_PUBLIC_CLUSTER_URL= | ||
NEXT_PUBLIC_ESCROW_AUTHY_ADDRESS= | ||
NEXT_PUBLIC_ORIGIN_TOKEN_ADDRESS= | ||
NEXT_PUBLIC_TARGET_TOKEN_ADDRESS= | ||
NEXT_PUBLIC_TOKEN_UPGRADE_PROGRAM_ID= |
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,9 +1,37 @@ | ||
import dynamic from "next/dynamic" | ||
import * as web3 from "@solana/web3.js" | ||
import { | ||
CLUSTER_URL, | ||
ORIGIN_TOKEN_ADDRESS, | ||
TARGET_TOKEN_ADDRESS, | ||
ESCROW_AUTHY_ADDRESS, | ||
TOKEN_UPGRADE_PROGRAM_ID, | ||
} from "../env" | ||
|
||
function guardConfiguration() { | ||
const isValidAddr = (a?: string) => { | ||
return Boolean(a) && a ? Boolean(new web3.PublicKey(a)) : false | ||
} | ||
|
||
return ( | ||
Boolean(new URL(CLUSTER_URL ?? "")) && | ||
isValidAddr(ORIGIN_TOKEN_ADDRESS) && | ||
isValidAddr(TARGET_TOKEN_ADDRESS) && | ||
isValidAddr(ESCROW_AUTHY_ADDRESS) && | ||
isValidAddr(TOKEN_UPGRADE_PROGRAM_ID) | ||
) | ||
} | ||
|
||
const NoSSRIndexEntrie = dynamic(() => import("../entries/index"), { | ||
ssr: false, | ||
}) | ||
|
||
export default function Home() { | ||
if (!guardConfiguration()) { | ||
throw new Error( | ||
"Application is not configured correctly. Please provide valid token addresses. See the project README for more information.", | ||
) | ||
} | ||
|
||
return <NoSSRIndexEntrie /> | ||
} |
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,2 +1,10 @@ | ||
export const CLUSTER_URL = process.env.NEXT_PUBLIC_CLUSTER_URL | ||
|
||
export const TOKEN_UPGRADE_PROGRAM_ID = | ||
process.env.NEXT_PUBLIC_TOKEN_UPGRADE_PROGRAM_ID | ||
|
||
export const ORIGIN_TOKEN_ADDRESS = process.env.NEXT_PUBLIC_ORIGIN_TOKEN_ADDRESS | ||
|
||
export const TARGET_TOKEN_ADDRESS = process.env.NEXT_PUBLIC_TARGET_TOKEN_ADDRESS | ||
|
||
export const ESCROW_AUTHY_ADDRESS = process.env.NEXT_PUBLIC_ESCROW_AUTHY_ADDRESS |
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 was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.