-
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.
- Loading branch information
Showing
37 changed files
with
1,038 additions
and
647 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch" | ||
} |
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,37 @@ | ||
name: 🐞 Bug Report | ||
description: Create a bug report to help us improve | ||
title: "bug: " | ||
labels: ["🐞❔ unconfirmed bug"] | ||
body: | ||
- type: textarea | ||
attributes: | ||
label: Provide environment information | ||
description: | | ||
Run this command in your project root and paste the results in a code block: | ||
```bash | ||
npx envinfo --system --binaries | ||
``` | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe the bug | ||
description: A clear and concise description of the bug, as well as what you expected to happen when encountering it. | ||
validations: | ||
required: true | ||
- type: input | ||
attributes: | ||
label: Link to reproduction | ||
description: Please provide a link to a reproduction of the bug. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: To reproduce | ||
description: Describe how to reproduce your bug. Steps, code snippets, reproduction repos etc. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Additional information | ||
description: Add any other information related to the bug here, screenshots if applicable. |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# @solana/token-upgrade-app | ||
|
||
## 1.0.0 | ||
|
||
### Major Changes | ||
|
||
- Initial release | ||
|
||
Contains: | ||
|
||
- Demo application package | ||
- UI package which contains needed components | ||
- `issue-tokens.mts` script which allows to create proper accounts for upgrade process |
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,101 +1,9 @@ | ||
"use client" | ||
import { TokenUpgrade, useNotificationContext } from "@solana/token-upgrade-ui" | ||
import { Pattern } from "../shared/pattern" | ||
import { TOKEN_UPGRADE_PROGRAM_ID } from "../env" | ||
import { useCallback, useEffect, useState } from "react" | ||
import ChangeCluster from "../features/change-cluster" | ||
import Input from "../shared/input" | ||
import * as web3 from "@solana/web3.js" | ||
import dynamic from "next/dynamic" | ||
|
||
export default function Home() { | ||
const { setNotification } = useNotificationContext() | ||
|
||
const _log = useCallback( | ||
(msg: string) => { | ||
setNotification({ message: msg }) | ||
globalThis.console.log(msg) | ||
}, | ||
[setNotification], | ||
) | ||
|
||
const [token, setToken] = useState<web3.PublicKey>() | ||
const [tokenExt, setTokenExt] = useState<web3.PublicKey>() | ||
const [escrow, setEscrow] = useState<web3.PublicKey>() | ||
|
||
useEffect(() => { | ||
const url = new URLSearchParams(globalThis.location.search) | ||
console.log(url.get("token"), url.get("tokenExt"), url.get("escrow")) | ||
const NoSSRIndexEntrie = dynamic(() => import("../entries/index"), { | ||
ssr: false, | ||
}) | ||
|
||
const t = url.get("token") | ||
const te = url.get("tokenExt") | ||
const e = url.get("escrow") | ||
if (t) setToken(new web3.PublicKey(t)) | ||
if (te) setTokenExt(new web3.PublicKey(te)) | ||
if (e) setEscrow(new web3.PublicKey(e)) | ||
}, []) | ||
|
||
return ( | ||
<> | ||
<Pattern /> | ||
<div className="prose py-2 dark:prose-invert"> | ||
<div className="container flex justify-center"> | ||
<TokenUpgrade | ||
escrow={escrow?.toString()} | ||
onUpgradeStart={() => _log("Upgrading token")} | ||
onUpgradeEnd={({ signature }) => | ||
setNotification({ | ||
message: "Token upgraded", | ||
link: `https://explorer.solana.com/tx/${signature}`, | ||
}) | ||
} | ||
onUpgradeError={(error) => | ||
_log(`Error: ${error.message || error.name}`) | ||
} | ||
tokenAddress={token?.toString()} | ||
tokenExtAddress={tokenExt?.toString()} | ||
tokenUpgradeProgramId={TOKEN_UPGRADE_PROGRAM_ID} | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div className="light:text-black dark:text-white"> | ||
<div className="container flex flex-col items-center justify-center py-2"> | ||
<div className="min-w-80 pb-1.5 pt-2.5"> | ||
<Input | ||
defaultValue={token?.toString()} | ||
name="tokenAddress" | ||
label="Token address" | ||
onChange={(e) => { | ||
setToken(new web3.PublicKey(e.target.value.trim())) | ||
}} | ||
placeholder="Paste here token address to update" | ||
/> | ||
</div> | ||
<div className="min-w-80 pb-1.5 pt-2.5"> | ||
<Input | ||
defaultValue={tokenExt?.toString()} | ||
name="token2022Address" | ||
label="Token Extension address" | ||
onChange={(e) => { | ||
setTokenExt(new web3.PublicKey(e.target.value.trim())) | ||
}} | ||
placeholder="Paste here token address to update" | ||
/> | ||
</div> | ||
<div className="min-w-80 pb-1.5 pt-2.5"> | ||
<Input | ||
defaultValue={escrow?.toString()} | ||
name="escrow" | ||
label="Escrow address" | ||
onChange={(e) => { | ||
setEscrow(new web3.PublicKey(e.target.value.trim())) | ||
}} | ||
placeholder="Paste here token address to update" | ||
/> | ||
</div> | ||
<ChangeCluster className="min-w-80 pb-1.5 pt-2.5" /> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
export default function Home() { | ||
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use client" | ||
import * as React from "react" | ||
import { Layout } from "../features/layout" | ||
import IndexPage from "../widgets/index-page" | ||
|
||
export default function IndexEntrie() { | ||
return ( | ||
<Layout> | ||
<IndexPage /> | ||
</Layout> | ||
) | ||
} |
9 changes: 4 additions & 5 deletions
9
packages/app/src/widgets/layout.tsx → packages/app/src/features/layout.tsx
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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import * as web3 from "@solana/web3.js" | ||
import ChangeCluster from "../features/change-cluster" | ||
import Input from "../shared/input" | ||
import { Pattern } from "../shared/pattern" | ||
import { TOKEN_UPGRADE_PROGRAM_ID } from "../env" | ||
import { TokenUpgrade, useNotificationContext } from "@solana/token-upgrade-ui" | ||
import { useCallback, useEffect, useState } from "react" | ||
import { useConnection } from "@solana/wallet-adapter-react" | ||
|
||
function getCluster(rpc: string) { | ||
function getMoniker(s: string): web3.Cluster | "custom" { | ||
if (s === web3.clusterApiUrl("devnet")) return "devnet" | ||
if (s === web3.clusterApiUrl("mainnet-beta")) return "mainnet-beta" | ||
if (s === web3.clusterApiUrl("testnet")) return "testnet" | ||
return "custom" | ||
} | ||
return getMoniker(rpc) | ||
} | ||
|
||
export default function IndexPage() { | ||
const { connection } = useConnection() | ||
const { setNotification } = useNotificationContext() | ||
|
||
const _log = useCallback( | ||
(msg: string) => { | ||
setNotification({ message: msg }) | ||
globalThis.console.log(msg) | ||
}, | ||
[setNotification], | ||
) | ||
|
||
const [token, setToken] = useState<web3.PublicKey>() | ||
const [tokenExt, setTokenExt] = useState<web3.PublicKey>() | ||
const [escrow, setEscrow] = useState<web3.PublicKey>() | ||
|
||
useEffect(() => { | ||
const url = new URLSearchParams(globalThis.location.search) | ||
|
||
const t = url.get("token") | ||
const te = url.get("tokenExt") | ||
const e = url.get("escrow") | ||
if (t) setToken(new web3.PublicKey(t)) | ||
if (te) setTokenExt(new web3.PublicKey(te)) | ||
if (e) setEscrow(new web3.PublicKey(e)) | ||
}, []) | ||
|
||
return ( | ||
<> | ||
<Pattern /> | ||
<div className="prose py-2 dark:prose-invert"> | ||
<div className="container flex justify-center"> | ||
<TokenUpgrade | ||
escrow={escrow?.toString()} | ||
onUpgradeStart={() => _log("Upgrading token")} | ||
onUpgradeEnd={({ signature }) => | ||
setNotification({ | ||
message: "Token upgraded", | ||
link: `https://explorer.solana.com/tx/${signature}?cluster=${getCluster(connection.rpcEndpoint)}`, | ||
}) | ||
} | ||
onUpgradeError={(error) => | ||
_log(`Error: ${error.message || error.name}`) | ||
} | ||
tokenAddress={token?.toString()} | ||
tokenExtAddress={tokenExt?.toString()} | ||
tokenUpgradeProgramId={TOKEN_UPGRADE_PROGRAM_ID} | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div className="light:text-black dark:text-white"> | ||
<div className="container flex flex-col items-center justify-center py-2"> | ||
<div className="min-w-80 pb-1.5 pt-2.5"> | ||
<Input | ||
defaultValue={token?.toString()} | ||
name="tokenAddress" | ||
label="Token address" | ||
onChange={(e) => { | ||
setToken(new web3.PublicKey(e.target.value.trim())) | ||
}} | ||
placeholder="Paste here token address to update" | ||
/> | ||
</div> | ||
<div className="min-w-80 pb-1.5 pt-2.5"> | ||
<Input | ||
defaultValue={tokenExt?.toString()} | ||
name="token2022Address" | ||
label="Token Extension address" | ||
onChange={(e) => { | ||
setTokenExt(new web3.PublicKey(e.target.value.trim())) | ||
}} | ||
placeholder="Paste here token address to update" | ||
/> | ||
</div> | ||
<div className="min-w-80 pb-1.5 pt-2.5"> | ||
<Input | ||
defaultValue={escrow?.toString()} | ||
name="escrow" | ||
label="Escrow address" | ||
onChange={(e) => { | ||
setEscrow(new web3.PublicKey(e.target.value.trim())) | ||
}} | ||
placeholder="Paste here token address to update" | ||
/> | ||
</div> | ||
<ChangeCluster className="min-w-80 pb-1.5 pt-2.5" /> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} |
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,13 @@ | ||
# token-upgrade-ui-shared | ||
|
||
## 1.0.0 | ||
|
||
### Major Changes | ||
|
||
- Initial release | ||
|
||
Contains: | ||
|
||
- Demo application package | ||
- UI package which contains needed components | ||
- `issue-tokens.mts` script which allows to create proper accounts for upgrade process |
Oops, something went wrong.