Skip to content

Commit ef3e8c5

Browse files
committed
feat: 🎸 souvenir form validation, contracts updated
1 parent 7c3fa3b commit ef3e8c5

File tree

7 files changed

+37
-415
lines changed

7 files changed

+37
-415
lines changed

‎poap/contract/contracts/Poap.sol

-271
This file was deleted.

‎poap/src/App.svelte

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import context from './lib/context';
44
import NotFound from './routes/NotFound.svelte';
55
import MintSouvenir from './routes/MintSouvenir.svelte';
6-
import TLinkRequired from './routes/TLinkRequired.svelte';
76
import CreateSouvenir from './routes/CreateSouvenir.svelte';
87
import './styles.css';
98

‎poap/src/routes/CreateSouvenir.svelte

+9-21
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
let eventName = '';
1111
let description = '';
1212
let imageUrl = '';
13-
let imageUrlValid = '';
13+
let imageUrlValid = false;
1414
let selectedFile = null;
1515
let fileInput = null;
1616
let startDate = '';
17-
let startDateValid = '';
17+
let startDateValid = false;
1818
let endDate = '';
19-
let endDateValid = '';
19+
let endDateValid = false;
2020
let attendees = '';
21-
let attendeesValid = '';
21+
let attendeesValid = false;
2222
let mintCondition = 'public';
2323
let secret = '';
2424
let tlink = '';
@@ -41,19 +41,7 @@
4141
return;
4242
}
4343
// Handle form submission
44-
tlink = await getTlink(
45-
{
46-
name: eventName,
47-
description,
48-
imageUrl,
49-
startDate,
50-
endDate,
51-
attendees,
52-
mintCondition,
53-
secret
54-
},
55-
selectedFile
56-
);
44+
tlink = await getTlink();
5745
}
5846
5947
$: {
@@ -96,15 +84,15 @@
9684
missingRequirement += 'Private minting require secret word. ';
9785
}
9886
99-
if (attendees >= 25 && totalBalance < 100n * 10n**18n) {
87+
if (parseInt(attendees || "0") >= 25 && totalBalance < 100n * 10n**18n) {
10088
missingRequirement += 'You need to hold at least 100 SLN to create souvenir with 25+ attendees. ';
10189
}
10290
}
10391
$: {
10492
startDateValid = !endDate || startDate <= endDate
10593
endDateValid = endDate >= new Date().toISOString().split("T")[0]
106-
attendeesValid = attendees > 0
107-
imageUrlValid = !imageUrl || uriPattern.test(imageUrl)
94+
attendeesValid = parseInt(attendees || "0") > 0
95+
imageUrlValid = imageUrl && uriPattern.test(imageUrl)
10896
10997
}
11098
function getSLNTotalBalance() {
@@ -134,7 +122,7 @@
134122
const signature = (await tokenscript.personal.sign({ data: msgToSign })) as string;
135123
136124
// TODO fix coinBase smartwalletSignature
137-
console.log({ msgToSign, signature });
125+
// console.log({ msgToSign, signature });
138126
139127
tokenscript.action.showLoader();
140128

‎poap/src/routes/MintSouvenir.svelte

+1-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
}
9494
9595
async function handleSouvenirChange() {
96-
console.log('...handleSouvenirChange');
9796
try {
9897
let status = await getPoapStatus(poapId);
9998
console.log({ status });
@@ -112,8 +111,6 @@
112111
tokenscript.action.showMessageToast('error', 'Failed to prepare Minting', error.message);
113112
}
114113
}
115-
116-
// TODO update link for "Make My Own"
117114
</script>
118115

119116
<div
@@ -210,7 +207,7 @@
210207
<div class="text-white/80 hover:text-white text-sm transition-colors mt-2">
211208
<a
212209
target="_blank"
213-
href="https://viewer-staging.tokenscript.org/?chain=11155111&contract=0xcddcdc3231d062de953c94f59a335b1a4911ffdc&scriptId=7738_49#card=CreateSouvenir"
210+
href={`https://viewer${env.CONTRACT_CHAIN == "11155111" ? "-staging" : ""}.tokenscript.org/?chain=${env.CONTRACT_CHAIN}&contract=${env.CONTRACT_ADDRESS}&scriptId=7738_${env.SCRIPT_ID}#card=CreateSouvenir`}
214211
>Make My Own</a
215212
>
216213
</div>

0 commit comments

Comments
 (0)