Skip to content

Commit 6596e3d

Browse files
committed
Refactor credits.aleo templates to use Credits class with numeric amounts
1 parent 75085fb commit 6596e3d

File tree

3 files changed

+122
-231
lines changed

3 files changed

+122
-231
lines changed

create-leo-app/template-react-credits-aleo-functions-ts/src/App.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function App() {
101101

102102
// Form inputs for split
103103
const [splitRecord, setSplitRecord] = useState(SAMPLE_RECORD_1);
104-
const [splitAmount, setSplitAmount] = useState("250000u64");
104+
const [splitAmount, setSplitAmount] = useState(250000);
105105

106106
const executeFunction = async (
107107
functionName: string,
@@ -198,9 +198,9 @@ function App() {
198198
type="text"
199199
value={publicAmount}
200200
onChange={(e) =>
201-
setPublicAmount(e.target.value)
201+
setPublicAmount(Number(e.target.value) || 0)
202202
}
203-
placeholder="50000u64"
203+
placeholder="50000"
204204
/>
205205
</div>
206206
</div>
@@ -260,9 +260,9 @@ function App() {
260260
type="text"
261261
value={pubToPrivAmount}
262262
onChange={(e) =>
263-
setPubToPrivAmount(e.target.value)
263+
setPubToPrivAmount(Number(e.target.value) || 0)
264264
}
265-
placeholder="50000u64"
265+
placeholder="50000"
266266
/>
267267
</div>
268268
</div>
@@ -343,9 +343,9 @@ function App() {
343343
type="text"
344344
value={privateAmount}
345345
onChange={(e) =>
346-
setPrivateAmount(e.target.value)
346+
setPrivateAmount(Number(e.target.value) || 0)
347347
}
348-
placeholder="50000u64"
348+
placeholder="50000"
349349
/>
350350
</div>
351351
</div>
@@ -416,9 +416,9 @@ function App() {
416416
type="text"
417417
value={privToPubAmount}
418418
onChange={(e) =>
419-
setPrivToPubAmount(e.target.value)
419+
setPrivToPubAmount(Number(e.target.value) || 0)
420420
}
421-
placeholder="50000u64"
421+
placeholder="50000"
422422
/>
423423
</div>
424424
</div>
@@ -547,9 +547,9 @@ function App() {
547547
type="text"
548548
value={splitAmount}
549549
onChange={(e) =>
550-
setSplitAmount(e.target.value)
550+
setSplitAmount(Number(e.target.value) || 0)
551551
}
552-
placeholder="250000u64"
552+
placeholder="250000"
553553
/>
554554
</div>
555555
</div>

create-leo-app/template-react-credits-aleo-functions-ts/src/constants/sampleRecords.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ export const SAMPLE_RECORD_2 = `{
2222
export const SAMPLE_RECIPIENT =
2323
"aleo1vskzxa2qqgnhznxsqh6tgq93c30sfkj6xqwe7sr85lgjkexjlcxs3lxhy3";
2424

25-
export const SAMPLE_AMOUNT = "50000u64";
25+
export const SAMPLE_AMOUNT = 50000;

0 commit comments

Comments
 (0)