Skip to content

Commit b632206

Browse files
committed
Add sign to dapp for prize and other needs
1 parent 104d66e commit b632206

5 files changed

Lines changed: 388 additions & 16 deletions

File tree

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ contract_prize_deposit:
175175
--nfc_contract $(nfc_nft_symbol_contract_id) \
176176
--token_id 0
177177

178+
# redeem: message = hex bytes; signature = 64-byte raw R||S hex (128 chars); public_key = 65-byte uncompressed secp256k1 hex (130 chars). Replace public_key with your chip key from NFC/recovery if different.
178179
contract_prize_redeem:
179180
stellar contract invoke \
180181
--source-account $(admin) \
@@ -184,8 +185,10 @@ contract_prize_redeem:
184185
redeem \
185186
--redeemer $(admin) \
186187
--nfc_contract $(nfc_nft_symbol_contract_id) \
187-
--message "toto"$(admin)12 \
188-
--signature 3045022100a383a5d0e5841ec87dde98ad782a1affba52d6421fd2d3fc59073a8624107f8c0220597a10cb9a76cafce97d4c0616490c6b1027fddb5e101ae72486132a62e77e1e \
188+
--message 68656c6c6f \
189+
--signature 42954c99944ab633b99d8d2220f916ccca2eb20cf1fc2a1eff73c03df0a2b1691fc312e81725c8f398292c8078c40e7adbf4c0e6bc466e213fb47b82404a6e55 \
190+
--recovery_id 1 \
191+
--public_key 041e83a31ced7662d909a9eb3f746ce7d385c8f699efe851e318bd2fcfb754a8996495cae0e303e19f2bf9c6542231c5ab30d7aae7a0faf3f59ef94ad5bd275efb \
189192
--nonce 12
190193

191194
## Upgrade

dapp/src/App.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { Layout } from "@stellar/design-system";
1+
import {Layout} from "@stellar/design-system";
22
import "./App.module.css";
33
import ConnectAccount from "./components/ConnectAccount.tsx";
4-
import { Routes, Route, Outlet } from "react-router-dom";
4+
import {Routes, Route, Outlet} from "react-router-dom";
55
import Home from "./pages/Home.tsx";
66

77
const AppLayout: React.FC = () => (
88
<main>
99
<Layout.Header
10-
projectId="Stellar Merch Shop"
11-
projectTitle="Stellar Merch Shop"
12-
contentRight={<ConnectAccount />}
10+
projectId="Chi//mp"
11+
projectTitle="Chi//mp"
12+
contentRight={<ConnectAccount/>}
1313
/>
14-
<Outlet />
14+
<Outlet/>
1515
<Layout.Footer>
1616
<span>
17-
© {new Date().getFullYear()} Stellar Merch Shop. Licensed under the{" "}
17+
© {new Date().getFullYear()} Chi//mp. Licensed under the{" "}
1818
<a
1919
href="http://www.apache.org/licenses/LICENSE-2.0"
2020
target="_blank"
@@ -31,8 +31,8 @@ const AppLayout: React.FC = () => (
3131
function App() {
3232
return (
3333
<Routes>
34-
<Route element={<AppLayout />}>
35-
<Route path="/" element={<Home />} />
34+
<Route element={<AppLayout/>}>
35+
<Route path="/" element={<Home/>}/>
3636
</Route>
3737
</Routes>
3838
);

dapp/src/components/NFCMintProduct.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ import { MintSection } from "./contracts/MintSection.tsx";
1919
import { TransferSection } from "./contracts/TransferSection.tsx";
2020
import { ClaimSection } from "./contracts/ClaimSection.tsx";
2121
import { BalanceSection } from "./contracts/BalanceSection.tsx";
22+
import { SignMessageSection } from "./contracts/SignMessageSection.tsx";
2223
import { ChipNotPresentError } from "../util/nfcClient.ts";
2324

24-
type TabId = "mint" | "transfer" | "claim" | "balance";
25+
type TabId = "mint" | "transfer" | "claim" | "balance" | "sign";
2526

2627
const TABS: Array<{ id: TabId; label: string }> = [
2728
{ id: "mint", label: "Mint" },
2829
{ id: "transfer", label: "Transfer" },
2930
{ id: "claim", label: "Claim" },
3031
{ id: "balance", label: "Balance" },
32+
{ id: "sign", label: "Sign" },
3133
];
3234

3335
/**
@@ -140,6 +142,13 @@ export const NFCMintProduct = () => {
140142
{activeTab === "balance" && (
141143
<BalanceSection key={`balance-${contractId}`} contractId={contractId} />
142144
)}
145+
{activeTab === "sign" && (
146+
<SignMessageSection
147+
key={`sign-${contractId}`}
148+
keyId={selectedKeyId}
149+
contractId={contractId}
150+
/>
151+
)}
143152
</Box>
144153
);
145154
};

0 commit comments

Comments
 (0)