Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlock int v2 #172

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/(general)/integration/unlock/[lockId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import LockStats from '@/integrations/unlock/components/lock-stats'

export default function UnlockLockPage({ params }: { params: { lockId: string } }) {
return (
<div className="flex flex-col items-center justify-center">
<div className="flex flex-col items-center justify-center space-y-4">
<h1 className="text-4xl font-bold">Lock Stats</h1>
<LockStats lockId={params.lockId} />
<ButtonKeyCheckout lockId={params.lockId} />
Expand Down
23 changes: 17 additions & 6 deletions app/(general)/integration/unlock/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
'use client'

import { WalletConnect } from '@/components/blockchain/wallet-connect'
import { IsWalletConnected } from '@/components/shared/is-wallet-connected'
import { IsWalletDisconnected } from '@/components/shared/is-wallet-disconnected'
import { Button } from '@/components/ui/button'
import FormDeployLock from '@/integrations/unlock/components/form-deploy-lock'
import UserKeys from '@/integrations/unlock/components/user-keys'
import UserLocks from '@/integrations/unlock/components/user-locks'
import useUnlockSuppertedNetworks from '@/integrations/unlock/hooks/use-unlock-supported-networks'

export default function UnlockIntegration() {
const { isSupported } = useUnlockSuppertedNetworks()

return (
<div>
<div className="flex items-center justify-center">
Expand All @@ -15,12 +20,18 @@ export default function UnlockIntegration() {
</a>
</div>
<IsWalletConnected>
<h1 className="p-4 text-center text-4xl font-bold">Create a Lock</h1>
<FormDeployLock />
<h1 className="p-4 text-center text-4xl font-bold">Created Locks</h1>
<UserLocks />
<h1 className="p-4 text-center text-4xl font-bold">Owned Keys</h1>
<UserKeys />
{isSupported ? (
<>
<h1 className="p-4 text-center text-4xl font-bold">Create a Lock</h1>
<FormDeployLock />
<h1 className="p-4 text-center text-4xl font-bold">Created Locks</h1>
<UserLocks />
<h1 className="p-4 text-center text-4xl font-bold">Owned Keys</h1>
<UserKeys />
</>
) : (
<h1>Unsupported Network</h1>
)}
</IsWalletConnected>

<IsWalletDisconnected>
Expand Down
14 changes: 11 additions & 3 deletions integrations/unlock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ The also includes an example of using a lock as a paywall, and will require the
- Paywall example with an already deployed example lock
- View lock statistics, and purchase keys from created locks.

## Abis
`publicLicV13Abi` and `unlockV12Abi` are abis for the unlock protocol contracts for
generating typesafe wagmi hooks

## Components

`ButtonKeyCheckout()`
Opens the checkout modal for a specified key.

'FromDeployLock()'
For to create and deploy new locks.
For creating and deploying new locks.

'KeyPreview()'
Simply a preview card for the user keys list.
Expand All @@ -38,10 +42,14 @@ Displays all keys owned by the user for the connected chain.
`UserLocks()`
Displays all locks owned by the user for the connected chain.

## Generated
Contains typesafe hooks generated by wagmi cli for unlock protocol contracts

## Hooks

`UseDeployLock()`
React hook to interact with unlock protocol smart contracts.
`UseUnlockSupportedNetworks()`
React hook to return is network is supported by unlock, and some unlock data for
that network

`UseUnlockSubgraph()`
React hook to interact with The Graph protocol, and query information
Expand Down
Loading
Loading