-
Notifications
You must be signed in to change notification settings - Fork 2
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
16 changed files
with
552 additions
and
25 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
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,22 @@ | ||
html:has(.theme-ethdenver24) { | ||
body, html { | ||
@apply bg-gradient-to-b from-[#844AFF] to-[#844AFF] text-white; | ||
} | ||
/* body:before { | ||
content: ''; | ||
@apply fixed inset-0 -z-10 brightness-75; | ||
background: url('/ethdenver24/bg.svg') no-repeat center center; | ||
} */ | ||
.btn { | ||
@apply bg-[#FF65AF] hover:bg-[#FF65AF] active:bg-[#FF65AF] text-white; | ||
} | ||
.card-bg { | ||
@apply bg-[#F8F8F9] shadow-lg; | ||
} | ||
.card-body { | ||
@apply text-black; | ||
} | ||
.link { | ||
@apply text-[#FF65AF]; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { FC } from 'react'; | ||
|
||
export const AlreadyClaimed: FC<{ to: string }> = ({ to }) => { | ||
return ( | ||
<div className="space-y-2 w-full"> | ||
<p>It appears you already have this POAP 🎉</p> | ||
<p>You should see it in your collection</p> | ||
<a | ||
// href={'https://collectors.poap.xyz/token/' + poap_id} | ||
href={'https://collectors.poap.xyz/scan/' + to} | ||
target="_blank" | ||
className="btn w-full p-4" | ||
> | ||
View Collection | ||
</a> | ||
</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,26 @@ | ||
// eslint-disable-next-line unicorn/prefer-node-protocol, simple-import-sort/imports | ||
import { inspect } from 'util'; | ||
import { FC } from 'react'; | ||
import { AlreadyClaimed } from './AlreadyClaimed'; | ||
|
||
export const ClaimError: FC<{ data: unknown; recipient: string }> = ({ | ||
data, | ||
recipient, | ||
}) => { | ||
if ( | ||
data['statusCode'] == 400 && | ||
data['error'] == 'Bad Request' && | ||
data['message'] == 'You already minted a POAP for this drop.' | ||
) { | ||
return <AlreadyClaimed to={recipient} />; | ||
} | ||
|
||
return ( | ||
<div className="space-y-2 w-full"> | ||
<p>There was an error claiming this POAP.</p> | ||
<pre className="text-xs whitespace-break-spaces text-start bg-neutral-200/20 p-2 rounded-lg border"> | ||
<code>{inspect(data)}</code> | ||
</pre> | ||
</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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
type ErrorResponse = { | ||
error: 'Bad Request'; | ||
message: 'You already minted a POAP for this drop.'; | ||
statusCode: 400; | ||
}; | ||
|
||
export const mintPOAP = async ( | ||
otpCode: string, | ||
recipient: string, | ||
poapEventId: number | ||
) => { | ||
const headers = new Headers(); | ||
|
||
headers.append('Content-Type', 'application/json'); | ||
headers.append('x-iyk-code', otpCode); | ||
|
||
const response = await fetch('https://api.iyk.app/poap-events/mint', { | ||
method: 'POST', | ||
headers, | ||
body: JSON.stringify({ | ||
recipient, | ||
poapEventId, | ||
}), | ||
}); | ||
|
||
if (!response.ok) { | ||
if (response.status == 400) { | ||
const error: ErrorResponse = await response.json(); | ||
|
||
return [undefined, error]; | ||
} | ||
|
||
return [undefined, response]; | ||
} | ||
|
||
const data = await response.json(); | ||
|
||
return [data, undefined]; | ||
}; |
Oops, something went wrong.