From 703fb54dd4e798954900f701d4d162454dc9e3f8 Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 16:14:16 -0500 Subject: [PATCH 01/15] chore: updated styling --- integrations/unlock/components/form-deploy-lock.tsx | 13 ++++++------- integrations/unlock/components/key-preview.tsx | 4 ++-- integrations/unlock/components/lock-preview.tsx | 2 +- integrations/unlock/components/user-locks.tsx | 1 - lib/generated/blockchain.ts | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/integrations/unlock/components/form-deploy-lock.tsx b/integrations/unlock/components/form-deploy-lock.tsx index 5bb01c2d..d1bc46e2 100644 --- a/integrations/unlock/components/form-deploy-lock.tsx +++ b/integrations/unlock/components/form-deploy-lock.tsx @@ -3,7 +3,6 @@ import { useState } from 'react' import { Button } from '@/components/ui/button' -import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' import { useDeployLock } from '../hooks/use-deploy-lock' @@ -54,13 +53,13 @@ export default function FormDeployLock() {
- setLockName(e.target.value)} /> + setLockName(e.target.value)} />
{unlimitedKeys ? ( - + ) : ( - setMaxKeys(Number(e.target.value))} /> + setMaxKeys(Number(e.target.value))} /> )}

unlimited:

@@ -71,9 +70,9 @@ export default function FormDeployLock() {
{unlimitedDuration ? ( - + ) : ( - setDuration(Number(e.target.value))} /> + setDuration(Number(e.target.value))} /> )}

unlimited

@@ -83,7 +82,7 @@ export default function FormDeployLock() {
- setKeyPrice(e.target.value)} /> + setKeyPrice(e.target.value)} />
diff --git a/integrations/unlock/components/key-preview.tsx b/integrations/unlock/components/key-preview.tsx index a0d4dddf..5e5a7df4 100644 --- a/integrations/unlock/components/key-preview.tsx +++ b/integrations/unlock/components/key-preview.tsx @@ -3,8 +3,8 @@ interface KeyPreviewProps { } export default function KeyPreview({ lockName }: KeyPreviewProps) { return ( -
-
+
+

{lockName}

diff --git a/integrations/unlock/components/lock-preview.tsx b/integrations/unlock/components/lock-preview.tsx index a97c5784..036e292e 100644 --- a/integrations/unlock/components/lock-preview.tsx +++ b/integrations/unlock/components/lock-preview.tsx @@ -5,7 +5,7 @@ interface LockPreviewProps { export default function LockPreview({ lockId, lockName }: LockPreviewProps) { return ( -
+

{lockName}

diff --git a/integrations/unlock/components/user-locks.tsx b/integrations/unlock/components/user-locks.tsx index e4016643..d936b257 100644 --- a/integrations/unlock/components/user-locks.tsx +++ b/integrations/unlock/components/user-locks.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ 'use client' import { useEffect, useState } from 'react' diff --git a/lib/generated/blockchain.ts b/lib/generated/blockchain.ts index fe4bf74a..acaeeab7 100644 --- a/lib/generated/blockchain.ts +++ b/lib/generated/blockchain.ts @@ -1,4 +1,4 @@ -// Generated by @wagmi/cli@1.1.0 on 8/21/2023 at 2:07:57 PM +// Generated by @wagmi/cli@1.1.0 on 9/5/2023 at 3:29:16 PM import { useContractRead, UseContractReadConfig, From 4a5e0f92a48a63f76e0bd9cdc1519de7bbcf2e0b Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 16:42:36 -0500 Subject: [PATCH 02/15] chore: typescript stuff -- saving progress --- .../unlock/components/button-key-checkout.tsx | 2 -- .../unlock/components/paywall-demo.tsx | 14 ++++----- integrations/unlock/components/user-keys.tsx | 4 +-- .../unlock/hooks/use-unlock-subgraph.tsx | 29 +++++++------------ 4 files changed, 18 insertions(+), 31 deletions(-) diff --git a/integrations/unlock/components/button-key-checkout.tsx b/integrations/unlock/components/button-key-checkout.tsx index 596b2e25..da927861 100644 --- a/integrations/unlock/components/button-key-checkout.tsx +++ b/integrations/unlock/components/button-key-checkout.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ 'use client' import { useEffect, useState } from 'react' diff --git a/integrations/unlock/components/paywall-demo.tsx b/integrations/unlock/components/paywall-demo.tsx index b867c85d..4bc4d22f 100644 --- a/integrations/unlock/components/paywall-demo.tsx +++ b/integrations/unlock/components/paywall-demo.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ 'use client' import { useEffect, useState } from 'react' @@ -11,7 +9,7 @@ import { useAccount } from 'wagmi' import { Button } from '@/components/ui/button' export default function PaywallDemo() { - const [unlockStatus, setUnlockStatus] = useState('locked') + const [unlockStatus, setUnlockStatus] = useState('locked') const { connector } = useAccount() const paywall = new Paywall(networks) @@ -26,9 +24,9 @@ export default function PaywallDemo() { }, } - function handleUnlock(e: any) { - console.log(e.detail) - setUnlockStatus(e.detail) + function handleUnlock(e: CustomEvent) { + const detail: string | undefined = e.detail + setUnlockStatus(detail) } useEffect(() => { @@ -41,13 +39,13 @@ export default function PaywallDemo() { script.async = true document.body.appendChild(script) - window.addEventListener('unlockProtocol', handleUnlock) + window.addEventListener('unlockProtocol', handleUnlock as EventListener) return () => { // remove script when component is unmounted document.body.removeChild(script) if ('unlockProtocolConfig' in window) delete window.unlockProtocolConfig - window.removeEventListener('unlockProtocol', handleUnlock) + window.removeEventListener('unlockProtocol', handleUnlock as EventListener) } }, []) diff --git a/integrations/unlock/components/user-keys.tsx b/integrations/unlock/components/user-keys.tsx index 6222a9c3..35cba0fd 100644 --- a/integrations/unlock/components/user-keys.tsx +++ b/integrations/unlock/components/user-keys.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ 'use client' import { useEffect, useState } from 'react' @@ -18,8 +17,7 @@ export default function UserKeys() { useEffect(() => { async function fetchUserKeys() { - const keys = await getUserKeys() - console.log(keys) + const keys: UserKeysQueryQuery | undefined = await getUserKeys() setUserKeys(keys) } void fetchUserKeys() diff --git a/integrations/unlock/hooks/use-unlock-subgraph.tsx b/integrations/unlock/hooks/use-unlock-subgraph.tsx index 50769a6d..2a2facdf 100644 --- a/integrations/unlock/hooks/use-unlock-subgraph.tsx +++ b/integrations/unlock/hooks/use-unlock-subgraph.tsx @@ -1,19 +1,16 @@ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -import { networks } from '@unlock-protocol/networks' +import { GraphQLResponse } from 'graphql-request/build/esm/types' import { useAccount, useNetwork } from 'wagmi' import { LockStatsQueryDocument, UserKeysQueryDocument, UserLocksQueryDocument, execute } from '@/.graphclient' -const getEndpoint = (id: number) => { +const getEndpoint = (id: number | undefined) => { switch (id) { case 1: return 'mainnet-v2' case 5: return 'goerli-v2' case 80001: - return 'goerli-v2' + return 'mumbai-v2' default: return 'goerli-v2' } @@ -23,30 +20,26 @@ export default function useUnlockSubgraph() { const { address } = useAccount() const { chain } = useNetwork() - // prevent hook from running if wallet is not connected - if (!address || !chain?.id) throw new Error('Wallet not connected') - - // prevent hook from running if chain is not supported - const networkConfig = networks[chain.id] - if (!networkConfig) throw new Error('Unsupported Chain') - - const unlockNetworkEndpoint = getEndpoint(chain.id) + let unlockNetworkEndpoint = getEndpoint(5) // default to goerli + if (chain) { + unlockNetworkEndpoint = getEndpoint(chain.id) + } async function getUserKeys() { const variables = { user: address } - const result = await execute(UserKeysQueryDocument, variables, { network: unlockNetworkEndpoint }) - return result?.data + const result: GraphQLResponse = await execute(UserKeysQueryDocument, variables, { network: unlockNetworkEndpoint }) + return result.data } async function getUserLocks() { const variables = { user: address } - const result = await execute(UserLocksQueryDocument, variables, { network: unlockNetworkEndpoint }) + const result: GraphQLResponse = await execute(UserLocksQueryDocument, variables, { network: unlockNetworkEndpoint }) return result?.data } async function getLockStats({ lockId }: { lockId: string }) { const variables = { lockId: lockId } - const result = await execute(LockStatsQueryDocument, variables, { network: unlockNetworkEndpoint }) + const result: GraphQLResponse = await execute(LockStatsQueryDocument, variables, { network: unlockNetworkEndpoint }) return result?.data } From 2bef73ce2c9a8c654c48926a2d1b027be1defd7b Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 16:58:37 -0500 Subject: [PATCH 03/15] chore: typescript stuff -- execute from graph client still a problem --- .../unlock/components/button-key-checkout.tsx | 18 ++---------------- integrations/unlock/components/lock-stats.tsx | 2 +- integrations/unlock/components/user-keys.tsx | 2 +- integrations/unlock/components/user-locks.tsx | 2 +- .../unlock/hooks/use-unlock-subgraph.tsx | 1 + 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/integrations/unlock/components/button-key-checkout.tsx b/integrations/unlock/components/button-key-checkout.tsx index da927861..80823adc 100644 --- a/integrations/unlock/components/button-key-checkout.tsx +++ b/integrations/unlock/components/button-key-checkout.tsx @@ -1,25 +1,19 @@ 'use client' -import { useEffect, useState } from 'react' - import networks from '@unlock-protocol/networks' import { Paywall } from '@unlock-protocol/paywall' import { useNetwork } from 'wagmi' import { useAccount } from 'wagmi' import { Button } from '@/components/ui/button' -import useUnlockSubgraph from '@/integrations/unlock/hooks/use-unlock-subgraph' export default function ButtonKeyCheckout({ lockId }: { lockId: string }) { const { chain } = useNetwork() - const { getLockStats } = useUnlockSubgraph() - const [lockAddress, setLockAddress] = useState('') const { connector } = useAccount() - const baseUrl = 'https://app.unlock-protocol.com/checkout?' const paywallConfig = { locks: { - [lockAddress]: { + [lockId]: { network: chain?.id, }, }, @@ -34,13 +28,5 @@ export default function ButtonKeyCheckout({ lockId }: { lockId: string }) { } } - useEffect(() => { - async function fetchLockAddress() { - const stats = await getLockStats({ lockId }) - setLockAddress(stats.locks[0].address) - } - void fetchLockAddress() - }, [lockId]) - - return
{lockAddress && }
+ return
{}
} diff --git a/integrations/unlock/components/lock-stats.tsx b/integrations/unlock/components/lock-stats.tsx index 3c70f3bf..d0ee9824 100644 --- a/integrations/unlock/components/lock-stats.tsx +++ b/integrations/unlock/components/lock-stats.tsx @@ -14,7 +14,7 @@ export default function LockStats({ lockId }: { lockId: string }) { useEffect(() => { async function fetchLockStats() { - const stats: LockStatsQueryQuery = await getLockStats({ lockId }) + const stats: LockStatsQueryQuery = (await getLockStats({ lockId })) as LockStatsQueryQuery setLockStats(stats) } void fetchLockStats() diff --git a/integrations/unlock/components/user-keys.tsx b/integrations/unlock/components/user-keys.tsx index 35cba0fd..8b7bd370 100644 --- a/integrations/unlock/components/user-keys.tsx +++ b/integrations/unlock/components/user-keys.tsx @@ -17,7 +17,7 @@ export default function UserKeys() { useEffect(() => { async function fetchUserKeys() { - const keys: UserKeysQueryQuery | undefined = await getUserKeys() + const keys: UserKeysQueryQuery | undefined = (await getUserKeys()) as UserKeysQueryQuery setUserKeys(keys) } void fetchUserKeys() diff --git a/integrations/unlock/components/user-locks.tsx b/integrations/unlock/components/user-locks.tsx index d936b257..b7334ba6 100644 --- a/integrations/unlock/components/user-locks.tsx +++ b/integrations/unlock/components/user-locks.tsx @@ -17,7 +17,7 @@ export default function UserLocks() { useEffect(() => { async function fetchUserLocks() { - const locks = await getUserLocks() + const locks = (await getUserLocks()) as UserLocksQueryQuery setUserLocks(locks) } void fetchUserLocks() diff --git a/integrations/unlock/hooks/use-unlock-subgraph.tsx b/integrations/unlock/hooks/use-unlock-subgraph.tsx index 2a2facdf..f4aaa3ed 100644 --- a/integrations/unlock/hooks/use-unlock-subgraph.tsx +++ b/integrations/unlock/hooks/use-unlock-subgraph.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { GraphQLResponse } from 'graphql-request/build/esm/types' import { useAccount, useNetwork } from 'wagmi' From 5997fd9a9311b063d095a49773b57fae1a864c14 Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 17:10:18 -0500 Subject: [PATCH 04/15] chore: generated wagmi --- .../unlock/abis/public-lock-v13-abi.ts | 934 ++++++++++++ integrations/unlock/abis/unlock-v12-abi.ts | 378 +++++ integrations/unlock/generated/unlock-wagmi.ts | 1323 +++++++++++++++++ integrations/unlock/wagmi.config.ts | 19 + lib/generated/blockchain.ts | 2 +- 5 files changed, 2655 insertions(+), 1 deletion(-) create mode 100644 integrations/unlock/abis/public-lock-v13-abi.ts create mode 100644 integrations/unlock/abis/unlock-v12-abi.ts create mode 100644 integrations/unlock/generated/unlock-wagmi.ts create mode 100644 integrations/unlock/wagmi.config.ts diff --git a/integrations/unlock/abis/public-lock-v13-abi.ts b/integrations/unlock/abis/public-lock-v13-abi.ts new file mode 100644 index 00000000..e4c3eb54 --- /dev/null +++ b/integrations/unlock/abis/public-lock-v13-abi.ts @@ -0,0 +1,934 @@ +export const publicLockV13Abi = [ + { type: 'error', inputs: [], name: 'CANNOT_APPROVE_SELF' }, + { type: 'error', inputs: [], name: 'CANT_BE_SMALLER_THAN_SUPPLY' }, + { type: 'error', inputs: [], name: 'CANT_EXTEND_NON_EXPIRING_KEY' }, + { type: 'error', inputs: [], name: 'GAS_REFUND_FAILED' }, + { type: 'error', inputs: [], name: 'INSUFFICIENT_ERC20_VALUE' }, + { type: 'error', inputs: [], name: 'INSUFFICIENT_VALUE' }, + { type: 'error', inputs: [], name: 'INVALID_ADDRESS' }, + { type: 'error', inputs: [{ name: 'hookIndex', internalType: 'uint8', type: 'uint8' }], name: 'INVALID_HOOK' }, + { type: 'error', inputs: [], name: 'INVALID_LENGTH' }, + { type: 'error', inputs: [], name: 'INVALID_TOKEN' }, + { type: 'error', inputs: [], name: 'KEY_NOT_VALID' }, + { type: 'error', inputs: [], name: 'KEY_TRANSFERS_DISABLED' }, + { type: 'error', inputs: [], name: 'LOCK_HAS_CHANGED' }, + { type: 'error', inputs: [], name: 'LOCK_SOLD_OUT' }, + { type: 'error', inputs: [], name: 'MAX_KEYS_REACHED' }, + { type: 'error', inputs: [], name: 'MIGRATION_REQUIRED' }, + { type: 'error', inputs: [], name: 'NON_COMPLIANT_ERC721_RECEIVER' }, + { type: 'error', inputs: [], name: 'NON_RENEWABLE_LOCK' }, + { type: 'error', inputs: [], name: 'NOT_ENOUGH_FUNDS' }, + { type: 'error', inputs: [], name: 'NOT_ENOUGH_TIME' }, + { type: 'error', inputs: [], name: 'NOT_READY_FOR_RENEWAL' }, + { type: 'error', inputs: [], name: 'NO_SUCH_KEY' }, + { type: 'error', inputs: [], name: 'NULL_VALUE' }, + { type: 'error', inputs: [], name: 'ONLY_KEY_MANAGER_OR_APPROVED' }, + { type: 'error', inputs: [], name: 'ONLY_LOCK_MANAGER' }, + { type: 'error', inputs: [], name: 'ONLY_LOCK_MANAGER_OR_KEY_GRANTER' }, + { type: 'error', inputs: [], name: 'OUT_OF_RANGE' }, + { type: 'error', inputs: [], name: 'OWNER_CANT_BE_ADDRESS_ZERO' }, + { type: 'error', inputs: [], name: 'SCHEMA_VERSION_NOT_CORRECT' }, + { type: 'error', inputs: [], name: 'TRANSFER_TO_SELF' }, + { type: 'error', inputs: [], name: 'TransferFailed' }, + { type: 'error', inputs: [], name: 'UNAUTHORIZED' }, + { type: 'error', inputs: [], name: 'UNAUTHORIZED_KEY_MANAGER_UPDATE' }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'owner', internalType: 'address', type: 'address', indexed: true }, + { name: 'approved', internalType: 'address', type: 'address', indexed: true }, + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + ], + name: 'Approval', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'owner', internalType: 'address', type: 'address', indexed: true }, + { name: 'operator', internalType: 'address', type: 'address', indexed: true }, + { name: 'approved', internalType: 'bool', type: 'bool', indexed: false }, + ], + name: 'ApprovalForAll', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: 'owner', internalType: 'address', type: 'address', indexed: true }, + { name: 'sendTo', internalType: 'address', type: 'address', indexed: true }, + { name: 'refund', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'CancelKey', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'onKeyPurchaseHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyCancelHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onValidKeyHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onTokenURIHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyTransferHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyExtendHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyGrantHook', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'EventHooksUpdated', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: 'newExpiration', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'timeAdded', internalType: 'bool', type: 'bool', indexed: false }, + ], + name: 'ExpirationChanged', + }, + { type: 'event', anonymous: false, inputs: [{ name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }], name: 'ExpireKey' }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'refundValue', internalType: 'uint256', type: 'uint256', indexed: false }], + name: 'GasRefundValueChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'receiver', internalType: 'address', type: 'address', indexed: true }, + { name: 'refundedAmount', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'GasRefunded', + }, + { type: 'event', anonymous: false, inputs: [{ name: 'version', internalType: 'uint8', type: 'uint8', indexed: false }], name: 'Initialized' }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: 'newTimestamp', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'KeyExtended', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'KeyGranterAdded', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'KeyGranterRemoved', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: '_newManager', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'KeyManagerChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'updatedRecordsCount', internalType: 'uint256', type: 'uint256', indexed: false }], + name: 'KeysMigrated', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'expirationDuration', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'maxNumberOfKeys', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'maxKeysPerAcccount', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'LockConfig', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'LockManagerAdded', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'LockManagerRemoved', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'name', internalType: 'string', type: 'string', indexed: false }, + { name: 'symbol', internalType: 'string', type: 'string', indexed: false }, + { name: 'baseTokenURI', internalType: 'string', type: 'string', indexed: false }, + ], + name: 'LockMetadata', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'previousOwner', internalType: 'address', type: 'address', indexed: false }, + { name: 'newOwner', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'OwnershipTransferred', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'oldKeyPrice', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'keyPrice', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'oldTokenAddress', internalType: 'address', type: 'address', indexed: false }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'PricingChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'referrer', internalType: 'address', type: 'address', indexed: true }, + { name: 'fee', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'ReferrerFee', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'freeTrialLength', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'refundPenaltyBasisPoints', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'RefundPenaltyChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'previousAdminRole', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'newAdminRole', internalType: 'bytes32', type: 'bytes32', indexed: true }, + ], + name: 'RoleAdminChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'account', internalType: 'address', type: 'address', indexed: true }, + { name: 'sender', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'RoleGranted', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'account', internalType: 'address', type: 'address', indexed: true }, + { name: 'sender', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'RoleRevoked', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'from', internalType: 'address', type: 'address', indexed: true }, + { name: 'to', internalType: 'address', type: 'address', indexed: true }, + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + ], + name: 'Transfer', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'transferFeeBasisPoints', internalType: 'uint256', type: 'uint256', indexed: false }], + name: 'TransferFeeChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'lockAddress', internalType: 'address', type: 'address', indexed: true }, + { name: 'unlockAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'UnlockCallFailed', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'sender', internalType: 'address', type: 'address', indexed: true }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: true }, + { name: 'recipient', internalType: 'address', type: 'address', indexed: true }, + { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'Withdrawal', + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'DEFAULT_ADMIN_ROLE', + outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'addLockManager', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_approved', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'approve', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_keyOwner', internalType: 'address', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: 'balance', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'burn', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'cancelAndRefund', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'expirationDuration', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'expireAndRefundFor', + outputs: [], + }, + { + stateMutability: 'payable', + type: 'function', + inputs: [ + { name: '_value', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + { name: '_data', internalType: 'bytes', type: 'bytes' }, + ], + name: 'extend', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'freeTrialLength', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'gasRefundValue', + outputs: [{ name: '_refundValue', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'getApproved', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'getCancelAndRefundValue', + outputs: [{ name: 'refund', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_keyOwner', internalType: 'address', type: 'address' }], + name: 'getHasValidKey', + outputs: [{ name: 'isValid', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'role', internalType: 'bytes32', type: 'bytes32' }], + name: 'getRoleAdmin', + outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_time', internalType: 'uint256', type: 'uint256' }, + ], + name: 'getTransferFee', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_duration', internalType: 'uint256', type: 'uint256' }, + ], + name: 'grantKeyExtension', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_recipients', internalType: 'address[]', type: 'address[]' }, + { name: '_expirationTimestamps', internalType: 'uint256[]', type: 'uint256[]' }, + { name: '_keyManagers', internalType: 'address[]', type: 'address[]' }, + ], + name: 'grantKeys', + outputs: [{ name: '', internalType: 'uint256[]', type: 'uint256[]' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'grantRole', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'hasRole', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_lockCreator', internalType: 'address payable', type: 'address' }, + { name: '_expirationDuration', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_keyPrice', internalType: 'uint256', type: 'uint256' }, + { name: '_maxNumberOfKeys', internalType: 'uint256', type: 'uint256' }, + { name: '_lockName', internalType: 'string', type: 'string' }, + ], + name: 'initialize', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_owner', internalType: 'address', type: 'address' }, + { name: '_operator', internalType: 'address', type: 'address' }, + ], + name: 'isApprovedForAll', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'isLockManager', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'isOwner', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + ], + name: 'isRenewable', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'isValidKey', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'keyExpirationTimestampFor', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + name: 'keyManagerOf', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'keyPrice', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'lendKey', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'maxKeysPerAddress', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'maxNumberOfKeys', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenIdFrom', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenIdTo', internalType: 'uint256', type: 'uint256' }, + { name: '_amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'mergeKeys', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [{ name: '', internalType: 'bytes', type: 'bytes' }], name: 'migrate', outputs: [] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'name', outputs: [{ name: '', internalType: 'string', type: 'string' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'numberOfOwners', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyCancelHook', + outputs: [{ name: '', internalType: 'contract ILockKeyCancelHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyExtendHook', + outputs: [{ name: '', internalType: 'contract ILockKeyExtendHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyGrantHook', + outputs: [{ name: '', internalType: 'contract ILockKeyGrantHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyPurchaseHook', + outputs: [{ name: '', internalType: 'contract ILockKeyPurchaseHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyTransferHook', + outputs: [{ name: '', internalType: 'contract ILockKeyTransferHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onTokenURIHook', + outputs: [{ name: '', internalType: 'contract ILockTokenURIHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onValidKeyHook', + outputs: [{ name: '', internalType: 'contract ILockValidKeyHook', type: 'address' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'owner', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'ownerOf', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'pure', + type: 'function', + inputs: [], + name: 'publicLockVersion', + outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }], + }, + { + stateMutability: 'payable', + type: 'function', + inputs: [ + { name: '_values', internalType: 'uint256[]', type: 'uint256[]' }, + { name: '_recipients', internalType: 'address[]', type: 'address[]' }, + { name: '_referrers', internalType: 'address[]', type: 'address[]' }, + { name: '_keyManagers', internalType: 'address[]', type: 'address[]' }, + { name: '_data', internalType: 'bytes[]', type: 'bytes[]' }, + ], + name: 'purchase', + outputs: [{ name: '', internalType: 'uint256[]', type: 'uint256[]' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + { name: '_data', internalType: 'bytes', type: 'bytes' }, + ], + name: 'purchasePriceFor', + outputs: [{ name: 'minKeyPrice', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'address', type: 'address' }], + name: 'referrerFees', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'refundPenaltyBasisPoints', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + ], + name: 'renewMembershipFor', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'renounceLockManager', outputs: [] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'renounceRole', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'revokeRole', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'safeTransferFrom', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_data', internalType: 'bytes', type: 'bytes' }, + ], + name: 'safeTransferFrom', + outputs: [], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'schemaVersion', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_approved', internalType: 'bool', type: 'bool' }, + ], + name: 'setApprovalForAll', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_onKeyPurchaseHook', internalType: 'address', type: 'address' }, + { name: '_onKeyCancelHook', internalType: 'address', type: 'address' }, + { name: '_onValidKeyHook', internalType: 'address', type: 'address' }, + { name: '_onTokenURIHook', internalType: 'address', type: 'address' }, + { name: '_onKeyTransferHook', internalType: 'address', type: 'address' }, + { name: '_onKeyExtendHook', internalType: 'address', type: 'address' }, + { name: '_onKeyGrantHook', internalType: 'address', type: 'address' }, + ], + name: 'setEventHooks', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_refundValue', internalType: 'uint256', type: 'uint256' }], + name: 'setGasRefundValue', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_keyManager', internalType: 'address', type: 'address' }, + ], + name: 'setKeyManagerOf', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_lockName', internalType: 'string', type: 'string' }, + { name: '_lockSymbol', internalType: 'string', type: 'string' }, + { name: '_baseTokenURI', internalType: 'string', type: 'string' }, + ], + name: 'setLockMetadata', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'setOwner', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_referrer', internalType: 'address', type: 'address' }, + { name: '_feeBasisPoint', internalType: 'uint256', type: 'uint256' }, + ], + name: 'setReferrerFee', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_tokenIdFrom', internalType: 'uint256', type: 'uint256' }, + { name: '_timeShared', internalType: 'uint256', type: 'uint256' }, + ], + name: 'shareKey', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }], + name: 'supportsInterface', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'symbol', outputs: [{ name: '', internalType: 'string', type: 'string' }] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'tokenAddress', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_index', internalType: 'uint256', type: 'uint256' }], + name: 'tokenByIndex', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_keyOwner', internalType: 'address', type: 'address' }, + { name: '_index', internalType: 'uint256', type: 'uint256' }, + ], + name: 'tokenOfOwnerByIndex', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'tokenURI', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_keyOwner', internalType: 'address', type: 'address' }], + name: 'totalKeys', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'totalSupply', + outputs: [{ name: '_totalKeysCreated', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'transferFeeBasisPoints', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'unlendKey', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'unlockProtocol', + outputs: [{ name: '', internalType: 'contract IUnlock', type: 'address' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_keyPrice', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + ], + name: 'updateKeyPricing', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_newExpirationDuration', internalType: 'uint256', type: 'uint256' }, + { name: '_maxNumberOfKeys', internalType: 'uint256', type: 'uint256' }, + { name: '_maxKeysPerAcccount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'updateLockConfig', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_freeTrialLength', internalType: 'uint256', type: 'uint256' }, + { name: '_refundPenaltyBasisPoints', internalType: 'uint256', type: 'uint256' }, + ], + name: 'updateRefundPenalty', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'updateSchemaVersion', outputs: [] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_transferFeeBasisPoints', internalType: 'uint256', type: 'uint256' }], + name: 'updateTransferFee', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_recipient', internalType: 'address payable', type: 'address' }, + { name: '_amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'withdraw', + outputs: [], + }, + { stateMutability: 'payable', type: 'receive' }, +] as const diff --git a/integrations/unlock/abis/unlock-v12-abi.ts b/integrations/unlock/abis/unlock-v12-abi.ts new file mode 100644 index 00000000..f9e8d9b6 --- /dev/null +++ b/integrations/unlock/abis/unlock-v12-abi.ts @@ -0,0 +1,378 @@ +export const unlockV12Abi = [ + { type: 'error', inputs: [], name: 'Unlock__ALREADY_DEPLOYED' }, + { type: 'error', inputs: [], name: 'Unlock__INVALID_AMOUNT' }, + { type: 'error', inputs: [], name: 'Unlock__MANAGER_ONLY' }, + { type: 'error', inputs: [{ name: 'lockAddress', internalType: 'address', type: 'address' }], name: 'Unlock__MISSING_LOCK' }, + { type: 'error', inputs: [], name: 'Unlock__MISSING_LOCK_TEMPLATE' }, + { type: 'error', inputs: [], name: 'Unlock__MISSING_PROXY_ADMIN' }, + { type: 'error', inputs: [], name: 'Unlock__MISSING_TEMPLATE' }, + { type: 'error', inputs: [], name: 'Unlock__VERSION_TOO_HIGH' }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'udt', internalType: 'address', type: 'address', indexed: false }, + { name: 'weth', internalType: 'address', type: 'address', indexed: false }, + { name: 'estimatedGasForPurchase', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'globalTokenSymbol', internalType: 'string', type: 'string', indexed: false }, + { name: 'globalTokenURI', internalType: 'string', type: 'string', indexed: false }, + { name: 'chainId', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'ConfigUnlock', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'grossNetworkProduct', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: '_valueInETH', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: false }, + { name: 'value', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'lockAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'GNPChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'lockAddress', internalType: 'address', type: 'address', indexed: false }, + { name: 'version', internalType: 'uint16', type: 'uint16', indexed: false }, + ], + name: 'LockUpgraded', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'lockOwner', internalType: 'address', type: 'address', indexed: true }, + { name: 'newLockAddress', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'NewLock', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'previousOwner', internalType: 'address', type: 'address', indexed: true }, + { name: 'newOwner', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'OwnershipTransferred', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'grossNetworkProduct', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'totalDiscountGranted', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'ResetTrackedValue', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'publicLockAddress', internalType: 'address', type: 'address', indexed: false }], + name: 'SetLockTemplate', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'impl', internalType: 'address', type: 'address', indexed: true }, + { name: 'version', internalType: 'uint16', type: 'uint16', indexed: true }, + ], + name: 'UnlockTemplateAdded', + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'sender', internalType: 'address', type: 'address' }], + name: '__initializeOwnable', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'impl', internalType: 'address', type: 'address' }, + { name: 'version', internalType: 'uint16', type: 'uint16' }, + ], + name: 'addLockTemplate', + outputs: [], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'chainId', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'pure', + type: 'function', + inputs: [ + { name: '', internalType: 'address', type: 'address' }, + { name: '', internalType: 'uint256', type: 'uint256' }, + ], + name: 'computeAvailableDiscountFor', + outputs: [ + { name: 'discount', internalType: 'uint256', type: 'uint256' }, + { name: 'tokens', internalType: 'uint256', type: 'uint256' }, + ], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_udt', internalType: 'address', type: 'address' }, + { name: '_weth', internalType: 'address', type: 'address' }, + { name: '_estimatedGasForPurchase', internalType: 'uint256', type: 'uint256' }, + { name: '_symbol', internalType: 'string', type: 'string' }, + { name: '_URI', internalType: 'string', type: 'string' }, + { name: '_chainId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'configUnlock', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_expirationDuration', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_keyPrice', internalType: 'uint256', type: 'uint256' }, + { name: '_maxNumberOfKeys', internalType: 'uint256', type: 'uint256' }, + { name: '_lockName', internalType: 'string', type: 'string' }, + { name: '', internalType: 'bytes12', type: 'bytes12' }, + ], + name: 'createLock', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'data', internalType: 'bytes', type: 'bytes' }], + name: 'createUpgradeableLock', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'data', internalType: 'bytes', type: 'bytes' }, + { name: '_lockVersion', internalType: 'uint16', type: 'uint16' }, + ], + name: 'createUpgradeableLockAtVersion', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'estimatedGasForPurchase', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'getAdmin', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'getGlobalBaseTokenURI', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'getGlobalTokenSymbol', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'globalBaseTokenURI', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'globalTokenSymbol', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'grossNetworkProduct', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_unlockOwner', internalType: 'address', type: 'address' }], + name: 'initialize', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'initializeProxyAdmin', outputs: [] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'isOwner', outputs: [{ name: '', internalType: 'bool', type: 'bool' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'address', type: 'address' }], + name: 'locks', + outputs: [ + { name: 'deployed', internalType: 'bool', type: 'bool' }, + { name: 'totalSales', internalType: 'uint256', type: 'uint256' }, + { name: 'yieldedDiscountTokens', internalType: 'uint256', type: 'uint256' }, + ], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'networkBaseFee', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'owner', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'postLockUpgrade', outputs: [] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'protocolFee', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'proxyAdminAddress', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'publicLockAddress', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_version', internalType: 'uint16', type: 'uint16' }], + name: 'publicLockImpls', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'publicLockLatestVersion', + outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_impl', internalType: 'address', type: 'address' }], + name: 'publicLockVersions', + outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '', internalType: 'uint256', type: 'uint256' }, + { name: '', internalType: 'uint256', type: 'uint256' }, + ], + name: 'recordConsumedDiscount', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_value', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + ], + name: 'recordKeyPurchase', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'lock', internalType: 'address', type: 'address' }], + name: 'removeLock', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'renounceOwnership', outputs: [] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_grossNetworkProduct', internalType: 'uint256', type: 'uint256' }, + { name: '_totalDiscountGranted', internalType: 'uint256', type: 'uint256' }, + ], + name: 'resetTrackedValue', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_publicLockAddress', internalType: 'address', type: 'address' }], + name: 'setLockTemplate', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_oracleAddress', internalType: 'address', type: 'address' }, + ], + name: 'setOracle', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_protocolFee', internalType: 'uint256', type: 'uint256' }], + name: 'setProtocolFee', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'totalDiscountGranted', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'newOwner', internalType: 'address', type: 'address' }], + name: 'transferOwnership', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'token', internalType: 'address', type: 'address' }, + { name: 'to', internalType: 'address', type: 'address' }, + { name: 'amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'transferTokens', + outputs: [], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'udt', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'address', type: 'address' }], + name: 'uniswapOracles', + outputs: [{ name: '', internalType: 'contract IUniswapOracleV3', type: 'address' }], + }, + { stateMutability: 'pure', type: 'function', inputs: [], name: 'unlockVersion', outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'lockAddress', internalType: 'address payable', type: 'address' }, + { name: 'version', internalType: 'uint16', type: 'uint16' }, + ], + name: 'upgradeLock', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'weth', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { stateMutability: 'payable', type: 'receive' }, +] as const diff --git a/integrations/unlock/generated/unlock-wagmi.ts b/integrations/unlock/generated/unlock-wagmi.ts new file mode 100644 index 00000000..a77e5202 --- /dev/null +++ b/integrations/unlock/generated/unlock-wagmi.ts @@ -0,0 +1,1323 @@ +// Generated by @wagmi/cli@1.1.0 on 9/5/2023 at 5:06:21 PM + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// UnlockV12 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const unlockV12ABI = [ + { type: 'error', inputs: [], name: 'Unlock__ALREADY_DEPLOYED' }, + { type: 'error', inputs: [], name: 'Unlock__INVALID_AMOUNT' }, + { type: 'error', inputs: [], name: 'Unlock__MANAGER_ONLY' }, + { type: 'error', inputs: [{ name: 'lockAddress', internalType: 'address', type: 'address' }], name: 'Unlock__MISSING_LOCK' }, + { type: 'error', inputs: [], name: 'Unlock__MISSING_LOCK_TEMPLATE' }, + { type: 'error', inputs: [], name: 'Unlock__MISSING_PROXY_ADMIN' }, + { type: 'error', inputs: [], name: 'Unlock__MISSING_TEMPLATE' }, + { type: 'error', inputs: [], name: 'Unlock__VERSION_TOO_HIGH' }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'udt', internalType: 'address', type: 'address', indexed: false }, + { name: 'weth', internalType: 'address', type: 'address', indexed: false }, + { name: 'estimatedGasForPurchase', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'globalTokenSymbol', internalType: 'string', type: 'string', indexed: false }, + { name: 'globalTokenURI', internalType: 'string', type: 'string', indexed: false }, + { name: 'chainId', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'ConfigUnlock', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'grossNetworkProduct', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: '_valueInETH', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: false }, + { name: 'value', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'lockAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'GNPChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'lockAddress', internalType: 'address', type: 'address', indexed: false }, + { name: 'version', internalType: 'uint16', type: 'uint16', indexed: false }, + ], + name: 'LockUpgraded', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'lockOwner', internalType: 'address', type: 'address', indexed: true }, + { name: 'newLockAddress', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'NewLock', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'previousOwner', internalType: 'address', type: 'address', indexed: true }, + { name: 'newOwner', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'OwnershipTransferred', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'grossNetworkProduct', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'totalDiscountGranted', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'ResetTrackedValue', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'publicLockAddress', internalType: 'address', type: 'address', indexed: false }], + name: 'SetLockTemplate', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'impl', internalType: 'address', type: 'address', indexed: true }, + { name: 'version', internalType: 'uint16', type: 'uint16', indexed: true }, + ], + name: 'UnlockTemplateAdded', + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'sender', internalType: 'address', type: 'address' }], + name: '__initializeOwnable', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'impl', internalType: 'address', type: 'address' }, + { name: 'version', internalType: 'uint16', type: 'uint16' }, + ], + name: 'addLockTemplate', + outputs: [], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'chainId', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'pure', + type: 'function', + inputs: [ + { name: '', internalType: 'address', type: 'address' }, + { name: '', internalType: 'uint256', type: 'uint256' }, + ], + name: 'computeAvailableDiscountFor', + outputs: [ + { name: 'discount', internalType: 'uint256', type: 'uint256' }, + { name: 'tokens', internalType: 'uint256', type: 'uint256' }, + ], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_udt', internalType: 'address', type: 'address' }, + { name: '_weth', internalType: 'address', type: 'address' }, + { name: '_estimatedGasForPurchase', internalType: 'uint256', type: 'uint256' }, + { name: '_symbol', internalType: 'string', type: 'string' }, + { name: '_URI', internalType: 'string', type: 'string' }, + { name: '_chainId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'configUnlock', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_expirationDuration', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_keyPrice', internalType: 'uint256', type: 'uint256' }, + { name: '_maxNumberOfKeys', internalType: 'uint256', type: 'uint256' }, + { name: '_lockName', internalType: 'string', type: 'string' }, + { name: '', internalType: 'bytes12', type: 'bytes12' }, + ], + name: 'createLock', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'data', internalType: 'bytes', type: 'bytes' }], + name: 'createUpgradeableLock', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'data', internalType: 'bytes', type: 'bytes' }, + { name: '_lockVersion', internalType: 'uint16', type: 'uint16' }, + ], + name: 'createUpgradeableLockAtVersion', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'estimatedGasForPurchase', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'getAdmin', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'getGlobalBaseTokenURI', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'getGlobalTokenSymbol', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'globalBaseTokenURI', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'globalTokenSymbol', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'grossNetworkProduct', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_unlockOwner', internalType: 'address', type: 'address' }], + name: 'initialize', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'initializeProxyAdmin', outputs: [] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'isOwner', outputs: [{ name: '', internalType: 'bool', type: 'bool' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'address', type: 'address' }], + name: 'locks', + outputs: [ + { name: 'deployed', internalType: 'bool', type: 'bool' }, + { name: 'totalSales', internalType: 'uint256', type: 'uint256' }, + { name: 'yieldedDiscountTokens', internalType: 'uint256', type: 'uint256' }, + ], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'networkBaseFee', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'owner', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'postLockUpgrade', outputs: [] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'protocolFee', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'proxyAdminAddress', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'publicLockAddress', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_version', internalType: 'uint16', type: 'uint16' }], + name: 'publicLockImpls', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'publicLockLatestVersion', + outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_impl', internalType: 'address', type: 'address' }], + name: 'publicLockVersions', + outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '', internalType: 'uint256', type: 'uint256' }, + { name: '', internalType: 'uint256', type: 'uint256' }, + ], + name: 'recordConsumedDiscount', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_value', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + ], + name: 'recordKeyPurchase', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'lock', internalType: 'address', type: 'address' }], + name: 'removeLock', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'renounceOwnership', outputs: [] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_grossNetworkProduct', internalType: 'uint256', type: 'uint256' }, + { name: '_totalDiscountGranted', internalType: 'uint256', type: 'uint256' }, + ], + name: 'resetTrackedValue', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_publicLockAddress', internalType: 'address', type: 'address' }], + name: 'setLockTemplate', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_oracleAddress', internalType: 'address', type: 'address' }, + ], + name: 'setOracle', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_protocolFee', internalType: 'uint256', type: 'uint256' }], + name: 'setProtocolFee', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'totalDiscountGranted', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'newOwner', internalType: 'address', type: 'address' }], + name: 'transferOwnership', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'token', internalType: 'address', type: 'address' }, + { name: 'to', internalType: 'address', type: 'address' }, + { name: 'amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'transferTokens', + outputs: [], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'udt', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'address', type: 'address' }], + name: 'uniswapOracles', + outputs: [{ name: '', internalType: 'contract IUniswapOracleV3', type: 'address' }], + }, + { stateMutability: 'pure', type: 'function', inputs: [], name: 'unlockVersion', outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'lockAddress', internalType: 'address payable', type: 'address' }, + { name: 'version', internalType: 'uint16', type: 'uint16' }, + ], + name: 'upgradeLock', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'weth', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { stateMutability: 'payable', type: 'receive' }, +] as const + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// PublicLockV13 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const publicLockV13ABI = [ + { type: 'error', inputs: [], name: 'CANNOT_APPROVE_SELF' }, + { type: 'error', inputs: [], name: 'CANT_BE_SMALLER_THAN_SUPPLY' }, + { type: 'error', inputs: [], name: 'CANT_EXTEND_NON_EXPIRING_KEY' }, + { type: 'error', inputs: [], name: 'GAS_REFUND_FAILED' }, + { type: 'error', inputs: [], name: 'INSUFFICIENT_ERC20_VALUE' }, + { type: 'error', inputs: [], name: 'INSUFFICIENT_VALUE' }, + { type: 'error', inputs: [], name: 'INVALID_ADDRESS' }, + { type: 'error', inputs: [{ name: 'hookIndex', internalType: 'uint8', type: 'uint8' }], name: 'INVALID_HOOK' }, + { type: 'error', inputs: [], name: 'INVALID_LENGTH' }, + { type: 'error', inputs: [], name: 'INVALID_TOKEN' }, + { type: 'error', inputs: [], name: 'KEY_NOT_VALID' }, + { type: 'error', inputs: [], name: 'KEY_TRANSFERS_DISABLED' }, + { type: 'error', inputs: [], name: 'LOCK_HAS_CHANGED' }, + { type: 'error', inputs: [], name: 'LOCK_SOLD_OUT' }, + { type: 'error', inputs: [], name: 'MAX_KEYS_REACHED' }, + { type: 'error', inputs: [], name: 'MIGRATION_REQUIRED' }, + { type: 'error', inputs: [], name: 'NON_COMPLIANT_ERC721_RECEIVER' }, + { type: 'error', inputs: [], name: 'NON_RENEWABLE_LOCK' }, + { type: 'error', inputs: [], name: 'NOT_ENOUGH_FUNDS' }, + { type: 'error', inputs: [], name: 'NOT_ENOUGH_TIME' }, + { type: 'error', inputs: [], name: 'NOT_READY_FOR_RENEWAL' }, + { type: 'error', inputs: [], name: 'NO_SUCH_KEY' }, + { type: 'error', inputs: [], name: 'NULL_VALUE' }, + { type: 'error', inputs: [], name: 'ONLY_KEY_MANAGER_OR_APPROVED' }, + { type: 'error', inputs: [], name: 'ONLY_LOCK_MANAGER' }, + { type: 'error', inputs: [], name: 'ONLY_LOCK_MANAGER_OR_KEY_GRANTER' }, + { type: 'error', inputs: [], name: 'OUT_OF_RANGE' }, + { type: 'error', inputs: [], name: 'OWNER_CANT_BE_ADDRESS_ZERO' }, + { type: 'error', inputs: [], name: 'SCHEMA_VERSION_NOT_CORRECT' }, + { type: 'error', inputs: [], name: 'TRANSFER_TO_SELF' }, + { type: 'error', inputs: [], name: 'TransferFailed' }, + { type: 'error', inputs: [], name: 'UNAUTHORIZED' }, + { type: 'error', inputs: [], name: 'UNAUTHORIZED_KEY_MANAGER_UPDATE' }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'owner', internalType: 'address', type: 'address', indexed: true }, + { name: 'approved', internalType: 'address', type: 'address', indexed: true }, + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + ], + name: 'Approval', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'owner', internalType: 'address', type: 'address', indexed: true }, + { name: 'operator', internalType: 'address', type: 'address', indexed: true }, + { name: 'approved', internalType: 'bool', type: 'bool', indexed: false }, + ], + name: 'ApprovalForAll', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: 'owner', internalType: 'address', type: 'address', indexed: true }, + { name: 'sendTo', internalType: 'address', type: 'address', indexed: true }, + { name: 'refund', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'CancelKey', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'onKeyPurchaseHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyCancelHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onValidKeyHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onTokenURIHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyTransferHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyExtendHook', internalType: 'address', type: 'address', indexed: false }, + { name: 'onKeyGrantHook', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'EventHooksUpdated', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: 'newExpiration', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'timeAdded', internalType: 'bool', type: 'bool', indexed: false }, + ], + name: 'ExpirationChanged', + }, + { type: 'event', anonymous: false, inputs: [{ name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }], name: 'ExpireKey' }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'refundValue', internalType: 'uint256', type: 'uint256', indexed: false }], + name: 'GasRefundValueChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'receiver', internalType: 'address', type: 'address', indexed: true }, + { name: 'refundedAmount', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'GasRefunded', + }, + { type: 'event', anonymous: false, inputs: [{ name: 'version', internalType: 'uint8', type: 'uint8', indexed: false }], name: 'Initialized' }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: 'newTimestamp', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'KeyExtended', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'KeyGranterAdded', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'KeyGranterRemoved', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + { name: '_newManager', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'KeyManagerChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'updatedRecordsCount', internalType: 'uint256', type: 'uint256', indexed: false }], + name: 'KeysMigrated', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'expirationDuration', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'maxNumberOfKeys', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'maxKeysPerAcccount', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'LockConfig', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'LockManagerAdded', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'account', internalType: 'address', type: 'address', indexed: true }], + name: 'LockManagerRemoved', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'name', internalType: 'string', type: 'string', indexed: false }, + { name: 'symbol', internalType: 'string', type: 'string', indexed: false }, + { name: 'baseTokenURI', internalType: 'string', type: 'string', indexed: false }, + ], + name: 'LockMetadata', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'previousOwner', internalType: 'address', type: 'address', indexed: false }, + { name: 'newOwner', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'OwnershipTransferred', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'oldKeyPrice', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'keyPrice', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'oldTokenAddress', internalType: 'address', type: 'address', indexed: false }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'PricingChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'referrer', internalType: 'address', type: 'address', indexed: true }, + { name: 'fee', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'ReferrerFee', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'freeTrialLength', internalType: 'uint256', type: 'uint256', indexed: false }, + { name: 'refundPenaltyBasisPoints', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'RefundPenaltyChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'previousAdminRole', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'newAdminRole', internalType: 'bytes32', type: 'bytes32', indexed: true }, + ], + name: 'RoleAdminChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'account', internalType: 'address', type: 'address', indexed: true }, + { name: 'sender', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'RoleGranted', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true }, + { name: 'account', internalType: 'address', type: 'address', indexed: true }, + { name: 'sender', internalType: 'address', type: 'address', indexed: true }, + ], + name: 'RoleRevoked', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'from', internalType: 'address', type: 'address', indexed: true }, + { name: 'to', internalType: 'address', type: 'address', indexed: true }, + { name: 'tokenId', internalType: 'uint256', type: 'uint256', indexed: true }, + ], + name: 'Transfer', + }, + { + type: 'event', + anonymous: false, + inputs: [{ name: 'transferFeeBasisPoints', internalType: 'uint256', type: 'uint256', indexed: false }], + name: 'TransferFeeChanged', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'lockAddress', internalType: 'address', type: 'address', indexed: true }, + { name: 'unlockAddress', internalType: 'address', type: 'address', indexed: false }, + ], + name: 'UnlockCallFailed', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: 'sender', internalType: 'address', type: 'address', indexed: true }, + { name: 'tokenAddress', internalType: 'address', type: 'address', indexed: true }, + { name: 'recipient', internalType: 'address', type: 'address', indexed: true }, + { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false }, + ], + name: 'Withdrawal', + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'DEFAULT_ADMIN_ROLE', + outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'addLockManager', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_approved', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'approve', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_keyOwner', internalType: 'address', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: 'balance', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'burn', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'cancelAndRefund', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'expirationDuration', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'expireAndRefundFor', + outputs: [], + }, + { + stateMutability: 'payable', + type: 'function', + inputs: [ + { name: '_value', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + { name: '_data', internalType: 'bytes', type: 'bytes' }, + ], + name: 'extend', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'freeTrialLength', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'gasRefundValue', + outputs: [{ name: '_refundValue', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'getApproved', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'getCancelAndRefundValue', + outputs: [{ name: 'refund', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_keyOwner', internalType: 'address', type: 'address' }], + name: 'getHasValidKey', + outputs: [{ name: 'isValid', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'role', internalType: 'bytes32', type: 'bytes32' }], + name: 'getRoleAdmin', + outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_time', internalType: 'uint256', type: 'uint256' }, + ], + name: 'getTransferFee', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_duration', internalType: 'uint256', type: 'uint256' }, + ], + name: 'grantKeyExtension', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_recipients', internalType: 'address[]', type: 'address[]' }, + { name: '_expirationTimestamps', internalType: 'uint256[]', type: 'uint256[]' }, + { name: '_keyManagers', internalType: 'address[]', type: 'address[]' }, + ], + name: 'grantKeys', + outputs: [{ name: '', internalType: 'uint256[]', type: 'uint256[]' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'grantRole', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'hasRole', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_lockCreator', internalType: 'address payable', type: 'address' }, + { name: '_expirationDuration', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_keyPrice', internalType: 'uint256', type: 'uint256' }, + { name: '_maxNumberOfKeys', internalType: 'uint256', type: 'uint256' }, + { name: '_lockName', internalType: 'string', type: 'string' }, + ], + name: 'initialize', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_owner', internalType: 'address', type: 'address' }, + { name: '_operator', internalType: 'address', type: 'address' }, + ], + name: 'isApprovedForAll', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'isLockManager', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'isOwner', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + ], + name: 'isRenewable', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'isValidKey', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'keyExpirationTimestampFor', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + name: 'keyManagerOf', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'keyPrice', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'lendKey', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'maxKeysPerAddress', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'maxNumberOfKeys', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenIdFrom', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenIdTo', internalType: 'uint256', type: 'uint256' }, + { name: '_amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'mergeKeys', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [{ name: '', internalType: 'bytes', type: 'bytes' }], name: 'migrate', outputs: [] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'name', outputs: [{ name: '', internalType: 'string', type: 'string' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'numberOfOwners', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyCancelHook', + outputs: [{ name: '', internalType: 'contract ILockKeyCancelHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyExtendHook', + outputs: [{ name: '', internalType: 'contract ILockKeyExtendHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyGrantHook', + outputs: [{ name: '', internalType: 'contract ILockKeyGrantHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyPurchaseHook', + outputs: [{ name: '', internalType: 'contract ILockKeyPurchaseHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onKeyTransferHook', + outputs: [{ name: '', internalType: 'contract ILockKeyTransferHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onTokenURIHook', + outputs: [{ name: '', internalType: 'contract ILockTokenURIHook', type: 'address' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'onValidKeyHook', + outputs: [{ name: '', internalType: 'contract ILockValidKeyHook', type: 'address' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'owner', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'ownerOf', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + }, + { + stateMutability: 'pure', + type: 'function', + inputs: [], + name: 'publicLockVersion', + outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }], + }, + { + stateMutability: 'payable', + type: 'function', + inputs: [ + { name: '_values', internalType: 'uint256[]', type: 'uint256[]' }, + { name: '_recipients', internalType: 'address[]', type: 'address[]' }, + { name: '_referrers', internalType: 'address[]', type: 'address[]' }, + { name: '_keyManagers', internalType: 'address[]', type: 'address[]' }, + { name: '_data', internalType: 'bytes[]', type: 'bytes[]' }, + ], + name: 'purchase', + outputs: [{ name: '', internalType: 'uint256[]', type: 'uint256[]' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + { name: '_data', internalType: 'bytes', type: 'bytes' }, + ], + name: 'purchasePriceFor', + outputs: [{ name: 'minKeyPrice', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', internalType: 'address', type: 'address' }], + name: 'referrerFees', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'refundPenaltyBasisPoints', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_referrer', internalType: 'address', type: 'address' }, + ], + name: 'renewMembershipFor', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'renounceLockManager', outputs: [] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'renounceRole', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: 'role', internalType: 'bytes32', type: 'bytes32' }, + { name: 'account', internalType: 'address', type: 'address' }, + ], + name: 'revokeRole', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'safeTransferFrom', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_data', internalType: 'bytes', type: 'bytes' }, + ], + name: 'safeTransferFrom', + outputs: [], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'schemaVersion', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_approved', internalType: 'bool', type: 'bool' }, + ], + name: 'setApprovalForAll', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_onKeyPurchaseHook', internalType: 'address', type: 'address' }, + { name: '_onKeyCancelHook', internalType: 'address', type: 'address' }, + { name: '_onValidKeyHook', internalType: 'address', type: 'address' }, + { name: '_onTokenURIHook', internalType: 'address', type: 'address' }, + { name: '_onKeyTransferHook', internalType: 'address', type: 'address' }, + { name: '_onKeyExtendHook', internalType: 'address', type: 'address' }, + { name: '_onKeyGrantHook', internalType: 'address', type: 'address' }, + ], + name: 'setEventHooks', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_refundValue', internalType: 'uint256', type: 'uint256' }], + name: 'setGasRefundValue', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + { name: '_keyManager', internalType: 'address', type: 'address' }, + ], + name: 'setKeyManagerOf', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_lockName', internalType: 'string', type: 'string' }, + { name: '_lockSymbol', internalType: 'string', type: 'string' }, + { name: '_baseTokenURI', internalType: 'string', type: 'string' }, + ], + name: 'setLockMetadata', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: 'account', internalType: 'address', type: 'address' }], + name: 'setOwner', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_referrer', internalType: 'address', type: 'address' }, + { name: '_feeBasisPoint', internalType: 'uint256', type: 'uint256' }, + ], + name: 'setReferrerFee', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_to', internalType: 'address', type: 'address' }, + { name: '_tokenIdFrom', internalType: 'uint256', type: 'uint256' }, + { name: '_timeShared', internalType: 'uint256', type: 'uint256' }, + ], + name: 'shareKey', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }], + name: 'supportsInterface', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'symbol', outputs: [{ name: '', internalType: 'string', type: 'string' }] }, + { stateMutability: 'view', type: 'function', inputs: [], name: 'tokenAddress', outputs: [{ name: '', internalType: 'address', type: 'address' }] }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_index', internalType: 'uint256', type: 'uint256' }], + name: 'tokenByIndex', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_keyOwner', internalType: 'address', type: 'address' }, + { name: '_index', internalType: 'uint256', type: 'uint256' }, + ], + name: 'tokenOfOwnerByIndex', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_tokenId', internalType: 'uint256', type: 'uint256' }], + name: 'tokenURI', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_keyOwner', internalType: 'address', type: 'address' }], + name: 'totalKeys', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'totalSupply', + outputs: [{ name: '_totalKeysCreated', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'transferFeeBasisPoints', + outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', internalType: 'address', type: 'address' }, + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_recipient', internalType: 'address', type: 'address' }, + { name: '_tokenId', internalType: 'uint256', type: 'uint256' }, + ], + name: 'unlendKey', + outputs: [], + }, + { + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'unlockProtocol', + outputs: [{ name: '', internalType: 'contract IUnlock', type: 'address' }], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_keyPrice', internalType: 'uint256', type: 'uint256' }, + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + ], + name: 'updateKeyPricing', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_newExpirationDuration', internalType: 'uint256', type: 'uint256' }, + { name: '_maxNumberOfKeys', internalType: 'uint256', type: 'uint256' }, + { name: '_maxKeysPerAcccount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'updateLockConfig', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_freeTrialLength', internalType: 'uint256', type: 'uint256' }, + { name: '_refundPenaltyBasisPoints', internalType: 'uint256', type: 'uint256' }, + ], + name: 'updateRefundPenalty', + outputs: [], + }, + { stateMutability: 'nonpayable', type: 'function', inputs: [], name: 'updateSchemaVersion', outputs: [] }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [{ name: '_transferFeeBasisPoints', internalType: 'uint256', type: 'uint256' }], + name: 'updateTransferFee', + outputs: [], + }, + { + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_tokenAddress', internalType: 'address', type: 'address' }, + { name: '_recipient', internalType: 'address payable', type: 'address' }, + { name: '_amount', internalType: 'uint256', type: 'uint256' }, + ], + name: 'withdraw', + outputs: [], + }, + { stateMutability: 'payable', type: 'receive' }, +] as const diff --git a/integrations/unlock/wagmi.config.ts b/integrations/unlock/wagmi.config.ts new file mode 100644 index 00000000..ec72d6bd --- /dev/null +++ b/integrations/unlock/wagmi.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from '@wagmi/cli' + +import { publicLockV13Abi } from './abis/public-lock-v13-abi' +import { unlockV12Abi } from './abis/unlock-v12-abi' + +export default defineConfig({ + out: 'integrations/unlock/generated/unlock-wagmi.ts', + contracts: [ + { + name: 'UnlockV12', + abi: unlockV12Abi, + }, + { + name: 'PublicLockV13', + abi: publicLockV13Abi, + }, + ], + plugins: [], +}) diff --git a/lib/generated/blockchain.ts b/lib/generated/blockchain.ts index acaeeab7..e83e4517 100644 --- a/lib/generated/blockchain.ts +++ b/lib/generated/blockchain.ts @@ -1,4 +1,4 @@ -// Generated by @wagmi/cli@1.1.0 on 9/5/2023 at 3:29:16 PM +// Generated by @wagmi/cli@1.1.0 on 9/5/2023 at 5:05:06 PM import { useContractRead, UseContractReadConfig, From 4e3a52370e830fa2a1c124239ab36463a1fefd26 Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 17:51:56 -0500 Subject: [PATCH 05/15] feat: lock deploy using generated wagmi functions working with hardcoded goerli address --- .../unlock/components/form-deploy-lock.tsx | 25 +- integrations/unlock/generated/unlock-wagmi.ts | 3133 ++++++++++++++++- integrations/unlock/hooks/use-deploy-lock.tsx | 49 - integrations/unlock/wagmi.config.ts | 3 +- 4 files changed, 3150 insertions(+), 60 deletions(-) delete mode 100644 integrations/unlock/hooks/use-deploy-lock.tsx diff --git a/integrations/unlock/components/form-deploy-lock.tsx b/integrations/unlock/components/form-deploy-lock.tsx index d1bc46e2..72b1f7da 100644 --- a/integrations/unlock/components/form-deploy-lock.tsx +++ b/integrations/unlock/components/form-deploy-lock.tsx @@ -2,10 +2,12 @@ import { useState } from 'react' +import { ethers } from 'ethers' + import { Button } from '@/components/ui/button' import { Switch } from '@/components/ui/switch' -import { useDeployLock } from '../hooks/use-deploy-lock' +import { usePrepareUnlockV12CreateLock, useUnlockV12CreateLock } from '../generated/unlock-wagmi' export default function FormDeployLock() { const [lockName, setLockName] = useState('test lock') @@ -17,16 +19,21 @@ export default function FormDeployLock() { const [unlimitedKeys, setUnlimitedKeys] = useState(false) const [unlimitedDuration, setUnlimitedDuration] = useState(false) - const { data, isLoading, isSuccess, deployLock } = useDeployLock() + const { config } = usePrepareUnlockV12CreateLock({ + address: '0x627118a4fB747016911e5cDA82e2E77C531e8206', // goerli + args: [ + duration === 0 ? BigInt(ethers.constants.MaxUint256.toString()) : BigInt(duration * 60 * 60 * 24), + ethers.constants.AddressZero, // token address defaults to ETH, can be any ERC20 + BigInt(ethers.utils.parseUnits(keyPrice, 18).toString()), // key price in ETH + maxKeys === 0 ? BigInt(ethers.constants.MaxUint256.toString()) : BigInt(maxKeys), + lockName, + '0x000000000000000000000000', + ], + }) + const { write, isLoading, isSuccess } = useUnlockV12CreateLock(config) function handleDeploy() { - deployLock(duration, keyPrice, maxKeys, lockName) - .then(() => { - console.log('deploying lock...') - }) - .catch((e) => { - console.log('error deploying lock', e) - }) + write?.() } function handleUnlimitedKeys(e: boolean) { diff --git a/integrations/unlock/generated/unlock-wagmi.ts b/integrations/unlock/generated/unlock-wagmi.ts index a77e5202..27a0d35b 100644 --- a/integrations/unlock/generated/unlock-wagmi.ts +++ b/integrations/unlock/generated/unlock-wagmi.ts @@ -1,4 +1,15 @@ -// Generated by @wagmi/cli@1.1.0 on 9/5/2023 at 5:06:21 PM +// Generated by @wagmi/cli@1.1.0 on 9/5/2023 at 5:15:18 PM +import { + useContractRead, + UseContractReadConfig, + useContractWrite, + UseContractWriteConfig, + usePrepareContractWrite, + UsePrepareContractWriteConfig, + useContractEvent, + UseContractEventConfig, +} from 'wagmi' +import { ReadContractResult, WriteContractMode, PrepareWriteContractResult } from 'wagmi/actions' ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // UnlockV12 @@ -1321,3 +1332,3123 @@ export const publicLockV13ABI = [ }, { stateMutability: 'payable', type: 'receive' }, ] as const + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// React +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__. + */ +export function useUnlockV12Read>( + config: Omit, 'abi'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, ...config } as UseContractReadConfig) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"chainId"`. + */ +export function useUnlockV12ChainId>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'chainId', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"computeAvailableDiscountFor"`. + */ +export function useUnlockV12ComputeAvailableDiscountFor< + TFunctionName extends 'computeAvailableDiscountFor', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'computeAvailableDiscountFor', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"estimatedGasForPurchase"`. + */ +export function useUnlockV12EstimatedGasForPurchase< + TFunctionName extends 'estimatedGasForPurchase', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'estimatedGasForPurchase', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"getAdmin"`. + */ +export function useUnlockV12GetAdmin>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'getAdmin', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"getGlobalBaseTokenURI"`. + */ +export function useUnlockV12GetGlobalBaseTokenUri< + TFunctionName extends 'getGlobalBaseTokenURI', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'getGlobalBaseTokenURI', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"getGlobalTokenSymbol"`. + */ +export function useUnlockV12GetGlobalTokenSymbol< + TFunctionName extends 'getGlobalTokenSymbol', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'getGlobalTokenSymbol', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"globalBaseTokenURI"`. + */ +export function useUnlockV12GlobalBaseTokenUri< + TFunctionName extends 'globalBaseTokenURI', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'globalBaseTokenURI', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"globalTokenSymbol"`. + */ +export function useUnlockV12GlobalTokenSymbol< + TFunctionName extends 'globalTokenSymbol', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'globalTokenSymbol', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"grossNetworkProduct"`. + */ +export function useUnlockV12GrossNetworkProduct< + TFunctionName extends 'grossNetworkProduct', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'grossNetworkProduct', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"isOwner"`. + */ +export function useUnlockV12IsOwner>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'isOwner', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"locks"`. + */ +export function useUnlockV12Locks>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'locks', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"networkBaseFee"`. + */ +export function useUnlockV12NetworkBaseFee< + TFunctionName extends 'networkBaseFee', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'networkBaseFee', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"owner"`. + */ +export function useUnlockV12Owner>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'owner', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"protocolFee"`. + */ +export function useUnlockV12ProtocolFee>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'protocolFee', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"proxyAdminAddress"`. + */ +export function useUnlockV12ProxyAdminAddress< + TFunctionName extends 'proxyAdminAddress', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'proxyAdminAddress', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"publicLockAddress"`. + */ +export function useUnlockV12PublicLockAddress< + TFunctionName extends 'publicLockAddress', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'publicLockAddress', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"publicLockImpls"`. + */ +export function useUnlockV12PublicLockImpls< + TFunctionName extends 'publicLockImpls', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'publicLockImpls', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"publicLockLatestVersion"`. + */ +export function useUnlockV12PublicLockLatestVersion< + TFunctionName extends 'publicLockLatestVersion', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'publicLockLatestVersion', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"publicLockVersions"`. + */ +export function useUnlockV12PublicLockVersions< + TFunctionName extends 'publicLockVersions', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'publicLockVersions', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"recordConsumedDiscount"`. + */ +export function useUnlockV12RecordConsumedDiscount< + TFunctionName extends 'recordConsumedDiscount', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'recordConsumedDiscount', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"totalDiscountGranted"`. + */ +export function useUnlockV12TotalDiscountGranted< + TFunctionName extends 'totalDiscountGranted', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'totalDiscountGranted', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"udt"`. + */ +export function useUnlockV12Udt>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'udt', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"uniswapOracles"`. + */ +export function useUnlockV12UniswapOracles< + TFunctionName extends 'uniswapOracles', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'uniswapOracles', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"unlockVersion"`. + */ +export function useUnlockV12UnlockVersion< + TFunctionName extends 'unlockVersion', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: unlockV12ABI, functionName: 'unlockVersion', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"weth"`. + */ +export function useUnlockV12Weth>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: unlockV12ABI, functionName: 'weth', ...config } as UseContractReadConfig< + typeof unlockV12ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__. + */ +export function useUnlockV12Write( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], TFunctionName, TMode> + : UseContractWriteConfig & { + abi?: never + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"__initializeOwnable"`. + */ +export function useUnlockV12InitializeOwnable( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + '__initializeOwnable', + TMode + > & { functionName?: '__initializeOwnable' } + : UseContractWriteConfig & { + abi?: never + functionName?: '__initializeOwnable' + } = {} as any +) { + return useContractWrite({ + abi: unlockV12ABI, + functionName: '__initializeOwnable', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"addLockTemplate"`. + */ +export function useUnlockV12AddLockTemplate( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'addLockTemplate', TMode> & { + functionName?: 'addLockTemplate' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'addLockTemplate' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'addLockTemplate', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"configUnlock"`. + */ +export function useUnlockV12ConfigUnlock( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'configUnlock', TMode> & { + functionName?: 'configUnlock' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'configUnlock' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'configUnlock', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"createLock"`. + */ +export function useUnlockV12CreateLock( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'createLock', TMode> & { + functionName?: 'createLock' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'createLock' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'createLock', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"createUpgradeableLock"`. + */ +export function useUnlockV12CreateUpgradeableLock( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'createUpgradeableLock', + TMode + > & { functionName?: 'createUpgradeableLock' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'createUpgradeableLock' + } = {} as any +) { + return useContractWrite({ + abi: unlockV12ABI, + functionName: 'createUpgradeableLock', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"createUpgradeableLockAtVersion"`. + */ +export function useUnlockV12CreateUpgradeableLockAtVersion( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'createUpgradeableLockAtVersion', + TMode + > & { functionName?: 'createUpgradeableLockAtVersion' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'createUpgradeableLockAtVersion' + } = {} as any +) { + return useContractWrite({ + abi: unlockV12ABI, + functionName: 'createUpgradeableLockAtVersion', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"initialize"`. + */ +export function useUnlockV12Initialize( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'initialize', TMode> & { + functionName?: 'initialize' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'initialize' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'initialize', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"initializeProxyAdmin"`. + */ +export function useUnlockV12InitializeProxyAdmin( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'initializeProxyAdmin', + TMode + > & { functionName?: 'initializeProxyAdmin' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'initializeProxyAdmin' + } = {} as any +) { + return useContractWrite({ + abi: unlockV12ABI, + functionName: 'initializeProxyAdmin', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"postLockUpgrade"`. + */ +export function useUnlockV12PostLockUpgrade( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'postLockUpgrade', TMode> & { + functionName?: 'postLockUpgrade' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'postLockUpgrade' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'postLockUpgrade', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"recordKeyPurchase"`. + */ +export function useUnlockV12RecordKeyPurchase( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'recordKeyPurchase', TMode> & { + functionName?: 'recordKeyPurchase' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'recordKeyPurchase' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'recordKeyPurchase', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"removeLock"`. + */ +export function useUnlockV12RemoveLock( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'removeLock', TMode> & { + functionName?: 'removeLock' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'removeLock' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'removeLock', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"renounceOwnership"`. + */ +export function useUnlockV12RenounceOwnership( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'renounceOwnership', TMode> & { + functionName?: 'renounceOwnership' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'renounceOwnership' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'renounceOwnership', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"resetTrackedValue"`. + */ +export function useUnlockV12ResetTrackedValue( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'resetTrackedValue', TMode> & { + functionName?: 'resetTrackedValue' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'resetTrackedValue' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'resetTrackedValue', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"setLockTemplate"`. + */ +export function useUnlockV12SetLockTemplate( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setLockTemplate', TMode> & { + functionName?: 'setLockTemplate' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setLockTemplate' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'setLockTemplate', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"setOracle"`. + */ +export function useUnlockV12SetOracle( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setOracle', TMode> & { + functionName?: 'setOracle' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setOracle' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'setOracle', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"setProtocolFee"`. + */ +export function useUnlockV12SetProtocolFee( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setProtocolFee', TMode> & { + functionName?: 'setProtocolFee' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setProtocolFee' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'setProtocolFee', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"transferOwnership"`. + */ +export function useUnlockV12TransferOwnership( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'transferOwnership', TMode> & { + functionName?: 'transferOwnership' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'transferOwnership' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'transferOwnership', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"transferTokens"`. + */ +export function useUnlockV12TransferTokens( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'transferTokens', TMode> & { + functionName?: 'transferTokens' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'transferTokens' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'transferTokens', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"upgradeLock"`. + */ +export function useUnlockV12UpgradeLock( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'upgradeLock', TMode> & { + functionName?: 'upgradeLock' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'upgradeLock' + } = {} as any +) { + return useContractWrite({ abi: unlockV12ABI, functionName: 'upgradeLock', ...config } as any) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__. + */ +export function usePrepareUnlockV12Write( + config: Omit, 'abi'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, ...config } as UsePrepareContractWriteConfig) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"__initializeOwnable"`. + */ +export function usePrepareUnlockV12InitializeOwnable( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: '__initializeOwnable', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + '__initializeOwnable' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"addLockTemplate"`. + */ +export function usePrepareUnlockV12AddLockTemplate( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'addLockTemplate', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'addLockTemplate' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"configUnlock"`. + */ +export function usePrepareUnlockV12ConfigUnlock( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'configUnlock', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'configUnlock' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"createLock"`. + */ +export function usePrepareUnlockV12CreateLock( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'createLock', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'createLock' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"createUpgradeableLock"`. + */ +export function usePrepareUnlockV12CreateUpgradeableLock( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'createUpgradeableLock', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'createUpgradeableLock' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"createUpgradeableLockAtVersion"`. + */ +export function usePrepareUnlockV12CreateUpgradeableLockAtVersion( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'createUpgradeableLockAtVersion', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'createUpgradeableLockAtVersion' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"initialize"`. + */ +export function usePrepareUnlockV12Initialize( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'initialize', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'initialize' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"initializeProxyAdmin"`. + */ +export function usePrepareUnlockV12InitializeProxyAdmin( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'initializeProxyAdmin', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'initializeProxyAdmin' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"postLockUpgrade"`. + */ +export function usePrepareUnlockV12PostLockUpgrade( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'postLockUpgrade', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'postLockUpgrade' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"recordKeyPurchase"`. + */ +export function usePrepareUnlockV12RecordKeyPurchase( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'recordKeyPurchase', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'recordKeyPurchase' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"removeLock"`. + */ +export function usePrepareUnlockV12RemoveLock( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'removeLock', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'removeLock' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"renounceOwnership"`. + */ +export function usePrepareUnlockV12RenounceOwnership( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'renounceOwnership', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'renounceOwnership' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"resetTrackedValue"`. + */ +export function usePrepareUnlockV12ResetTrackedValue( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'resetTrackedValue', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'resetTrackedValue' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"setLockTemplate"`. + */ +export function usePrepareUnlockV12SetLockTemplate( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'setLockTemplate', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'setLockTemplate' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"setOracle"`. + */ +export function usePrepareUnlockV12SetOracle( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'setOracle', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'setOracle' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"setProtocolFee"`. + */ +export function usePrepareUnlockV12SetProtocolFee( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'setProtocolFee', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'setProtocolFee' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"transferOwnership"`. + */ +export function usePrepareUnlockV12TransferOwnership( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'transferOwnership', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'transferOwnership' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"transferTokens"`. + */ +export function usePrepareUnlockV12TransferTokens( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'transferTokens', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'transferTokens' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link unlockV12ABI}__ and `functionName` set to `"upgradeLock"`. + */ +export function usePrepareUnlockV12UpgradeLock( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: unlockV12ABI, functionName: 'upgradeLock', ...config } as UsePrepareContractWriteConfig< + typeof unlockV12ABI, + 'upgradeLock' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__. + */ +export function useUnlockV12Event( + config: Omit, 'abi'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"ConfigUnlock"`. + */ +export function useUnlockV12ConfigUnlockEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'ConfigUnlock', ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"GNPChanged"`. + */ +export function useUnlockV12GnpChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'GNPChanged', ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"LockUpgraded"`. + */ +export function useUnlockV12LockUpgradedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'LockUpgraded', ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"NewLock"`. + */ +export function useUnlockV12NewLockEvent(config: Omit, 'abi' | 'eventName'> = {} as any) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'NewLock', ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"OwnershipTransferred"`. + */ +export function useUnlockV12OwnershipTransferredEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'OwnershipTransferred', ...config } as UseContractEventConfig< + typeof unlockV12ABI, + 'OwnershipTransferred' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"ResetTrackedValue"`. + */ +export function useUnlockV12ResetTrackedValueEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'ResetTrackedValue', ...config } as UseContractEventConfig< + typeof unlockV12ABI, + 'ResetTrackedValue' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"SetLockTemplate"`. + */ +export function useUnlockV12SetLockTemplateEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'SetLockTemplate', ...config } as UseContractEventConfig< + typeof unlockV12ABI, + 'SetLockTemplate' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link unlockV12ABI}__ and `eventName` set to `"UnlockTemplateAdded"`. + */ +export function useUnlockV12UnlockTemplateAddedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: unlockV12ABI, eventName: 'UnlockTemplateAdded', ...config } as UseContractEventConfig< + typeof unlockV12ABI, + 'UnlockTemplateAdded' + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__. + */ +export function usePublicLockV13Read>( + config: Omit, 'abi'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, ...config } as UseContractReadConfig) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"DEFAULT_ADMIN_ROLE"`. + */ +export function usePublicLockV13DefaultAdminRole< + TFunctionName extends 'DEFAULT_ADMIN_ROLE', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'DEFAULT_ADMIN_ROLE', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"balanceOf"`. + */ +export function usePublicLockV13BalanceOf< + TFunctionName extends 'balanceOf', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'balanceOf', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"expirationDuration"`. + */ +export function usePublicLockV13ExpirationDuration< + TFunctionName extends 'expirationDuration', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'expirationDuration', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"freeTrialLength"`. + */ +export function usePublicLockV13FreeTrialLength< + TFunctionName extends 'freeTrialLength', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'freeTrialLength', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"gasRefundValue"`. + */ +export function usePublicLockV13GasRefundValue< + TFunctionName extends 'gasRefundValue', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'gasRefundValue', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"getApproved"`. + */ +export function usePublicLockV13GetApproved< + TFunctionName extends 'getApproved', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'getApproved', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"getCancelAndRefundValue"`. + */ +export function usePublicLockV13GetCancelAndRefundValue< + TFunctionName extends 'getCancelAndRefundValue', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'getCancelAndRefundValue', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"getHasValidKey"`. + */ +export function usePublicLockV13GetHasValidKey< + TFunctionName extends 'getHasValidKey', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'getHasValidKey', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"getRoleAdmin"`. + */ +export function usePublicLockV13GetRoleAdmin< + TFunctionName extends 'getRoleAdmin', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'getRoleAdmin', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"getTransferFee"`. + */ +export function usePublicLockV13GetTransferFee< + TFunctionName extends 'getTransferFee', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'getTransferFee', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"hasRole"`. + */ +export function usePublicLockV13HasRole>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'hasRole', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"isApprovedForAll"`. + */ +export function usePublicLockV13IsApprovedForAll< + TFunctionName extends 'isApprovedForAll', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'isApprovedForAll', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"isLockManager"`. + */ +export function usePublicLockV13IsLockManager< + TFunctionName extends 'isLockManager', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'isLockManager', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"isOwner"`. + */ +export function usePublicLockV13IsOwner>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'isOwner', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"isRenewable"`. + */ +export function usePublicLockV13IsRenewable< + TFunctionName extends 'isRenewable', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'isRenewable', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"isValidKey"`. + */ +export function usePublicLockV13IsValidKey< + TFunctionName extends 'isValidKey', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'isValidKey', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"keyExpirationTimestampFor"`. + */ +export function usePublicLockV13KeyExpirationTimestampFor< + TFunctionName extends 'keyExpirationTimestampFor', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'keyExpirationTimestampFor', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"keyManagerOf"`. + */ +export function usePublicLockV13KeyManagerOf< + TFunctionName extends 'keyManagerOf', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'keyManagerOf', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"keyPrice"`. + */ +export function usePublicLockV13KeyPrice>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'keyPrice', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"maxKeysPerAddress"`. + */ +export function usePublicLockV13MaxKeysPerAddress< + TFunctionName extends 'maxKeysPerAddress', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'maxKeysPerAddress', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"maxNumberOfKeys"`. + */ +export function usePublicLockV13MaxNumberOfKeys< + TFunctionName extends 'maxNumberOfKeys', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'maxNumberOfKeys', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"name"`. + */ +export function usePublicLockV13Name>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'name', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"numberOfOwners"`. + */ +export function usePublicLockV13NumberOfOwners< + TFunctionName extends 'numberOfOwners', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'numberOfOwners', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"onKeyCancelHook"`. + */ +export function usePublicLockV13OnKeyCancelHook< + TFunctionName extends 'onKeyCancelHook', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'onKeyCancelHook', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"onKeyExtendHook"`. + */ +export function usePublicLockV13OnKeyExtendHook< + TFunctionName extends 'onKeyExtendHook', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'onKeyExtendHook', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"onKeyGrantHook"`. + */ +export function usePublicLockV13OnKeyGrantHook< + TFunctionName extends 'onKeyGrantHook', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'onKeyGrantHook', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"onKeyPurchaseHook"`. + */ +export function usePublicLockV13OnKeyPurchaseHook< + TFunctionName extends 'onKeyPurchaseHook', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'onKeyPurchaseHook', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"onKeyTransferHook"`. + */ +export function usePublicLockV13OnKeyTransferHook< + TFunctionName extends 'onKeyTransferHook', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'onKeyTransferHook', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"onTokenURIHook"`. + */ +export function usePublicLockV13OnTokenUriHook< + TFunctionName extends 'onTokenURIHook', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'onTokenURIHook', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"onValidKeyHook"`. + */ +export function usePublicLockV13OnValidKeyHook< + TFunctionName extends 'onValidKeyHook', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'onValidKeyHook', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"owner"`. + */ +export function usePublicLockV13Owner>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'owner', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"ownerOf"`. + */ +export function usePublicLockV13OwnerOf>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'ownerOf', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"publicLockVersion"`. + */ +export function usePublicLockV13PublicLockVersion< + TFunctionName extends 'publicLockVersion', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'publicLockVersion', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"purchasePriceFor"`. + */ +export function usePublicLockV13PurchasePriceFor< + TFunctionName extends 'purchasePriceFor', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'purchasePriceFor', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"referrerFees"`. + */ +export function usePublicLockV13ReferrerFees< + TFunctionName extends 'referrerFees', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'referrerFees', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"refundPenaltyBasisPoints"`. + */ +export function usePublicLockV13RefundPenaltyBasisPoints< + TFunctionName extends 'refundPenaltyBasisPoints', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'refundPenaltyBasisPoints', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"schemaVersion"`. + */ +export function usePublicLockV13SchemaVersion< + TFunctionName extends 'schemaVersion', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'schemaVersion', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"supportsInterface"`. + */ +export function usePublicLockV13SupportsInterface< + TFunctionName extends 'supportsInterface', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'supportsInterface', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"symbol"`. + */ +export function usePublicLockV13Symbol>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'symbol', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"tokenAddress"`. + */ +export function usePublicLockV13TokenAddress< + TFunctionName extends 'tokenAddress', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'tokenAddress', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"tokenByIndex"`. + */ +export function usePublicLockV13TokenByIndex< + TFunctionName extends 'tokenByIndex', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'tokenByIndex', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"tokenOfOwnerByIndex"`. + */ +export function usePublicLockV13TokenOfOwnerByIndex< + TFunctionName extends 'tokenOfOwnerByIndex', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'tokenOfOwnerByIndex', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"tokenURI"`. + */ +export function usePublicLockV13TokenUri>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'tokenURI', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"totalKeys"`. + */ +export function usePublicLockV13TotalKeys< + TFunctionName extends 'totalKeys', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'totalKeys', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"totalSupply"`. + */ +export function usePublicLockV13TotalSupply< + TFunctionName extends 'totalSupply', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'totalSupply', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"transferFeeBasisPoints"`. + */ +export function usePublicLockV13TransferFeeBasisPoints< + TFunctionName extends 'transferFeeBasisPoints', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'transferFeeBasisPoints', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"unlockProtocol"`. + */ +export function usePublicLockV13UnlockProtocol< + TFunctionName extends 'unlockProtocol', + TSelectData = ReadContractResult +>(config: Omit, 'abi' | 'functionName'> = {} as any) { + return useContractRead({ abi: publicLockV13ABI, functionName: 'unlockProtocol', ...config } as UseContractReadConfig< + typeof publicLockV13ABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__. + */ +export function usePublicLockV13Write( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], TFunctionName, TMode> + : UseContractWriteConfig & { + abi?: never + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"addLockManager"`. + */ +export function usePublicLockV13AddLockManager( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'addLockManager', TMode> & { + functionName?: 'addLockManager' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'addLockManager' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'addLockManager', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"approve"`. + */ +export function usePublicLockV13Approve( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'approve', TMode> & { + functionName?: 'approve' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'approve' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'approve', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"burn"`. + */ +export function usePublicLockV13Burn( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'burn', TMode> & { functionName?: 'burn' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'burn' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'burn', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"cancelAndRefund"`. + */ +export function usePublicLockV13CancelAndRefund( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'cancelAndRefund', TMode> & { + functionName?: 'cancelAndRefund' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'cancelAndRefund' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'cancelAndRefund', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"expireAndRefundFor"`. + */ +export function usePublicLockV13ExpireAndRefundFor( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'expireAndRefundFor', + TMode + > & { functionName?: 'expireAndRefundFor' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'expireAndRefundFor' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'expireAndRefundFor', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"extend"`. + */ +export function usePublicLockV13Extend( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'extend', TMode> & { + functionName?: 'extend' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'extend' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'extend', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"grantKeyExtension"`. + */ +export function usePublicLockV13GrantKeyExtension( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'grantKeyExtension', + TMode + > & { functionName?: 'grantKeyExtension' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'grantKeyExtension' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'grantKeyExtension', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"grantKeys"`. + */ +export function usePublicLockV13GrantKeys( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'grantKeys', TMode> & { + functionName?: 'grantKeys' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'grantKeys' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'grantKeys', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"grantRole"`. + */ +export function usePublicLockV13GrantRole( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'grantRole', TMode> & { + functionName?: 'grantRole' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'grantRole' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'grantRole', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"initialize"`. + */ +export function usePublicLockV13Initialize( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'initialize', TMode> & { + functionName?: 'initialize' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'initialize' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'initialize', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"lendKey"`. + */ +export function usePublicLockV13LendKey( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'lendKey', TMode> & { + functionName?: 'lendKey' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'lendKey' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'lendKey', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"mergeKeys"`. + */ +export function usePublicLockV13MergeKeys( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'mergeKeys', TMode> & { + functionName?: 'mergeKeys' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'mergeKeys' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'mergeKeys', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"migrate"`. + */ +export function usePublicLockV13Migrate( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'migrate', TMode> & { + functionName?: 'migrate' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'migrate' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'migrate', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"purchase"`. + */ +export function usePublicLockV13Purchase( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'purchase', TMode> & { + functionName?: 'purchase' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'purchase' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'purchase', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"renewMembershipFor"`. + */ +export function usePublicLockV13RenewMembershipFor( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'renewMembershipFor', + TMode + > & { functionName?: 'renewMembershipFor' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'renewMembershipFor' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'renewMembershipFor', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"renounceLockManager"`. + */ +export function usePublicLockV13RenounceLockManager( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'renounceLockManager', + TMode + > & { functionName?: 'renounceLockManager' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'renounceLockManager' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'renounceLockManager', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"renounceRole"`. + */ +export function usePublicLockV13RenounceRole( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'renounceRole', TMode> & { + functionName?: 'renounceRole' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'renounceRole' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'renounceRole', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"revokeRole"`. + */ +export function usePublicLockV13RevokeRole( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'revokeRole', TMode> & { + functionName?: 'revokeRole' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'revokeRole' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'revokeRole', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"safeTransferFrom"`. + */ +export function usePublicLockV13SafeTransferFrom( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'safeTransferFrom', TMode> & { + functionName?: 'safeTransferFrom' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'safeTransferFrom' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'safeTransferFrom', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setApprovalForAll"`. + */ +export function usePublicLockV13SetApprovalForAll( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'setApprovalForAll', + TMode + > & { functionName?: 'setApprovalForAll' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setApprovalForAll' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'setApprovalForAll', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setEventHooks"`. + */ +export function usePublicLockV13SetEventHooks( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setEventHooks', TMode> & { + functionName?: 'setEventHooks' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setEventHooks' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'setEventHooks', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setGasRefundValue"`. + */ +export function usePublicLockV13SetGasRefundValue( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'setGasRefundValue', + TMode + > & { functionName?: 'setGasRefundValue' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setGasRefundValue' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'setGasRefundValue', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setKeyManagerOf"`. + */ +export function usePublicLockV13SetKeyManagerOf( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setKeyManagerOf', TMode> & { + functionName?: 'setKeyManagerOf' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setKeyManagerOf' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'setKeyManagerOf', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setLockMetadata"`. + */ +export function usePublicLockV13SetLockMetadata( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setLockMetadata', TMode> & { + functionName?: 'setLockMetadata' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setLockMetadata' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'setLockMetadata', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setOwner"`. + */ +export function usePublicLockV13SetOwner( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setOwner', TMode> & { + functionName?: 'setOwner' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setOwner' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'setOwner', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setReferrerFee"`. + */ +export function usePublicLockV13SetReferrerFee( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'setReferrerFee', TMode> & { + functionName?: 'setReferrerFee' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'setReferrerFee' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'setReferrerFee', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"shareKey"`. + */ +export function usePublicLockV13ShareKey( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'shareKey', TMode> & { + functionName?: 'shareKey' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'shareKey' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'shareKey', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"transferFrom"`. + */ +export function usePublicLockV13TransferFrom( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'transferFrom', TMode> & { + functionName?: 'transferFrom' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'transferFrom' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'transferFrom', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"unlendKey"`. + */ +export function usePublicLockV13UnlendKey( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'unlendKey', TMode> & { + functionName?: 'unlendKey' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'unlendKey' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'unlendKey', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateKeyPricing"`. + */ +export function usePublicLockV13UpdateKeyPricing( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'updateKeyPricing', TMode> & { + functionName?: 'updateKeyPricing' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'updateKeyPricing' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'updateKeyPricing', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateLockConfig"`. + */ +export function usePublicLockV13UpdateLockConfig( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'updateLockConfig', TMode> & { + functionName?: 'updateLockConfig' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'updateLockConfig' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'updateLockConfig', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateRefundPenalty"`. + */ +export function usePublicLockV13UpdateRefundPenalty( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'updateRefundPenalty', + TMode + > & { functionName?: 'updateRefundPenalty' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'updateRefundPenalty' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'updateRefundPenalty', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateSchemaVersion"`. + */ +export function usePublicLockV13UpdateSchemaVersion( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'updateSchemaVersion', + TMode + > & { functionName?: 'updateSchemaVersion' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'updateSchemaVersion' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'updateSchemaVersion', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateTransferFee"`. + */ +export function usePublicLockV13UpdateTransferFee( + config: TMode extends 'prepared' + ? UseContractWriteConfig< + PrepareWriteContractResult['request']['abi'], + 'updateTransferFee', + TMode + > & { functionName?: 'updateTransferFee' } + : UseContractWriteConfig & { + abi?: never + functionName?: 'updateTransferFee' + } = {} as any +) { + return useContractWrite({ + abi: publicLockV13ABI, + functionName: 'updateTransferFee', + ...config, + } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"withdraw"`. + */ +export function usePublicLockV13Withdraw( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'withdraw', TMode> & { + functionName?: 'withdraw' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'withdraw' + } = {} as any +) { + return useContractWrite({ abi: publicLockV13ABI, functionName: 'withdraw', ...config } as any) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__. + */ +export function usePreparePublicLockV13Write( + config: Omit, 'abi'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, ...config } as UsePrepareContractWriteConfig) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"addLockManager"`. + */ +export function usePreparePublicLockV13AddLockManager( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'addLockManager', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'addLockManager' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"approve"`. + */ +export function usePreparePublicLockV13Approve( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'approve', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'approve' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"burn"`. + */ +export function usePreparePublicLockV13Burn( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'burn', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'burn' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"cancelAndRefund"`. + */ +export function usePreparePublicLockV13CancelAndRefund( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'cancelAndRefund', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'cancelAndRefund' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"expireAndRefundFor"`. + */ +export function usePreparePublicLockV13ExpireAndRefundFor( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'expireAndRefundFor', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'expireAndRefundFor' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"extend"`. + */ +export function usePreparePublicLockV13Extend( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'extend', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'extend' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"grantKeyExtension"`. + */ +export function usePreparePublicLockV13GrantKeyExtension( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'grantKeyExtension', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'grantKeyExtension' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"grantKeys"`. + */ +export function usePreparePublicLockV13GrantKeys( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'grantKeys', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'grantKeys' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"grantRole"`. + */ +export function usePreparePublicLockV13GrantRole( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'grantRole', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'grantRole' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"initialize"`. + */ +export function usePreparePublicLockV13Initialize( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'initialize', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'initialize' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"lendKey"`. + */ +export function usePreparePublicLockV13LendKey( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'lendKey', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'lendKey' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"mergeKeys"`. + */ +export function usePreparePublicLockV13MergeKeys( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'mergeKeys', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'mergeKeys' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"migrate"`. + */ +export function usePreparePublicLockV13Migrate( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'migrate', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'migrate' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"purchase"`. + */ +export function usePreparePublicLockV13Purchase( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'purchase', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'purchase' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"renewMembershipFor"`. + */ +export function usePreparePublicLockV13RenewMembershipFor( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'renewMembershipFor', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'renewMembershipFor' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"renounceLockManager"`. + */ +export function usePreparePublicLockV13RenounceLockManager( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'renounceLockManager', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'renounceLockManager' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"renounceRole"`. + */ +export function usePreparePublicLockV13RenounceRole( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'renounceRole', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'renounceRole' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"revokeRole"`. + */ +export function usePreparePublicLockV13RevokeRole( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'revokeRole', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'revokeRole' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"safeTransferFrom"`. + */ +export function usePreparePublicLockV13SafeTransferFrom( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'safeTransferFrom', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'safeTransferFrom' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setApprovalForAll"`. + */ +export function usePreparePublicLockV13SetApprovalForAll( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'setApprovalForAll', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'setApprovalForAll' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setEventHooks"`. + */ +export function usePreparePublicLockV13SetEventHooks( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'setEventHooks', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'setEventHooks' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setGasRefundValue"`. + */ +export function usePreparePublicLockV13SetGasRefundValue( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'setGasRefundValue', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'setGasRefundValue' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setKeyManagerOf"`. + */ +export function usePreparePublicLockV13SetKeyManagerOf( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'setKeyManagerOf', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'setKeyManagerOf' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setLockMetadata"`. + */ +export function usePreparePublicLockV13SetLockMetadata( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'setLockMetadata', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'setLockMetadata' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setOwner"`. + */ +export function usePreparePublicLockV13SetOwner( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'setOwner', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'setOwner' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"setReferrerFee"`. + */ +export function usePreparePublicLockV13SetReferrerFee( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'setReferrerFee', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'setReferrerFee' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"shareKey"`. + */ +export function usePreparePublicLockV13ShareKey( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'shareKey', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'shareKey' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"transferFrom"`. + */ +export function usePreparePublicLockV13TransferFrom( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'transferFrom', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'transferFrom' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"unlendKey"`. + */ +export function usePreparePublicLockV13UnlendKey( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'unlendKey', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'unlendKey' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateKeyPricing"`. + */ +export function usePreparePublicLockV13UpdateKeyPricing( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'updateKeyPricing', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'updateKeyPricing' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateLockConfig"`. + */ +export function usePreparePublicLockV13UpdateLockConfig( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'updateLockConfig', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'updateLockConfig' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateRefundPenalty"`. + */ +export function usePreparePublicLockV13UpdateRefundPenalty( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'updateRefundPenalty', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'updateRefundPenalty' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateSchemaVersion"`. + */ +export function usePreparePublicLockV13UpdateSchemaVersion( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'updateSchemaVersion', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'updateSchemaVersion' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"updateTransferFee"`. + */ +export function usePreparePublicLockV13UpdateTransferFee( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'updateTransferFee', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'updateTransferFee' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link publicLockV13ABI}__ and `functionName` set to `"withdraw"`. + */ +export function usePreparePublicLockV13Withdraw( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: publicLockV13ABI, functionName: 'withdraw', ...config } as UsePrepareContractWriteConfig< + typeof publicLockV13ABI, + 'withdraw' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__. + */ +export function usePublicLockV13Event( + config: Omit, 'abi'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"Approval"`. + */ +export function usePublicLockV13ApprovalEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'Approval', ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"ApprovalForAll"`. + */ +export function usePublicLockV13ApprovalForAllEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'ApprovalForAll', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'ApprovalForAll' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"CancelKey"`. + */ +export function usePublicLockV13CancelKeyEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'CancelKey', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'CancelKey' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"EventHooksUpdated"`. + */ +export function usePublicLockV13EventHooksUpdatedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'EventHooksUpdated', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'EventHooksUpdated' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"ExpirationChanged"`. + */ +export function usePublicLockV13ExpirationChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'ExpirationChanged', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'ExpirationChanged' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"ExpireKey"`. + */ +export function usePublicLockV13ExpireKeyEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'ExpireKey', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'ExpireKey' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"GasRefundValueChanged"`. + */ +export function usePublicLockV13GasRefundValueChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'GasRefundValueChanged', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'GasRefundValueChanged' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"GasRefunded"`. + */ +export function usePublicLockV13GasRefundedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'GasRefunded', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'GasRefunded' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"Initialized"`. + */ +export function usePublicLockV13InitializedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'Initialized', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'Initialized' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"KeyExtended"`. + */ +export function usePublicLockV13KeyExtendedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'KeyExtended', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'KeyExtended' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"KeyGranterAdded"`. + */ +export function usePublicLockV13KeyGranterAddedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'KeyGranterAdded', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'KeyGranterAdded' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"KeyGranterRemoved"`. + */ +export function usePublicLockV13KeyGranterRemovedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'KeyGranterRemoved', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'KeyGranterRemoved' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"KeyManagerChanged"`. + */ +export function usePublicLockV13KeyManagerChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'KeyManagerChanged', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'KeyManagerChanged' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"KeysMigrated"`. + */ +export function usePublicLockV13KeysMigratedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'KeysMigrated', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'KeysMigrated' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"LockConfig"`. + */ +export function usePublicLockV13LockConfigEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'LockConfig', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'LockConfig' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"LockManagerAdded"`. + */ +export function usePublicLockV13LockManagerAddedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'LockManagerAdded', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'LockManagerAdded' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"LockManagerRemoved"`. + */ +export function usePublicLockV13LockManagerRemovedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'LockManagerRemoved', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'LockManagerRemoved' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"LockMetadata"`. + */ +export function usePublicLockV13LockMetadataEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'LockMetadata', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'LockMetadata' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"OwnershipTransferred"`. + */ +export function usePublicLockV13OwnershipTransferredEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'OwnershipTransferred', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'OwnershipTransferred' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"PricingChanged"`. + */ +export function usePublicLockV13PricingChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'PricingChanged', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'PricingChanged' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"ReferrerFee"`. + */ +export function usePublicLockV13ReferrerFeeEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'ReferrerFee', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'ReferrerFee' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"RefundPenaltyChanged"`. + */ +export function usePublicLockV13RefundPenaltyChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'RefundPenaltyChanged', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'RefundPenaltyChanged' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"RoleAdminChanged"`. + */ +export function usePublicLockV13RoleAdminChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'RoleAdminChanged', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'RoleAdminChanged' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"RoleGranted"`. + */ +export function usePublicLockV13RoleGrantedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'RoleGranted', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'RoleGranted' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"RoleRevoked"`. + */ +export function usePublicLockV13RoleRevokedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'RoleRevoked', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'RoleRevoked' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"Transfer"`. + */ +export function usePublicLockV13TransferEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'Transfer', ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"TransferFeeChanged"`. + */ +export function usePublicLockV13TransferFeeChangedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'TransferFeeChanged', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'TransferFeeChanged' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"UnlockCallFailed"`. + */ +export function usePublicLockV13UnlockCallFailedEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'UnlockCallFailed', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'UnlockCallFailed' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link publicLockV13ABI}__ and `eventName` set to `"Withdrawal"`. + */ +export function usePublicLockV13WithdrawalEvent( + config: Omit, 'abi' | 'eventName'> = {} as any +) { + return useContractEvent({ abi: publicLockV13ABI, eventName: 'Withdrawal', ...config } as UseContractEventConfig< + typeof publicLockV13ABI, + 'Withdrawal' + >) +} diff --git a/integrations/unlock/hooks/use-deploy-lock.tsx b/integrations/unlock/hooks/use-deploy-lock.tsx deleted file mode 100644 index 18a5e193..00000000 --- a/integrations/unlock/hooks/use-deploy-lock.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { useState } from 'react' - -import { PublicLockV13, UnlockV12 } from '@unlock-protocol/contracts' -import { networks } from '@unlock-protocol/networks' -import { ethers } from 'ethers' -import { useAccount, useContractWrite, useNetwork, usePrepareContractWrite } from 'wagmi' - -export function useDeployLock() { - // eslint-disable-neeNetwork() - const { address } = useAccount() - const { chain } = useNetwork() - if (!address || !chain?.id) throw new Error('Wallet not connected') - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const networkConfig = networks[chain.id] - if (!networkConfig) throw new Error('Unsupported Chain') - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const unlockAddress = networkConfig.unlockAddress - - const lockInterface = new ethers.utils.Interface(PublicLockV13.abi) - const [calldata, setCalldata] = useState('') - const [unlockFunctionName, setUnlockFunctionName] = useState('') - - const { config } = usePrepareContractWrite({ - address: unlockAddress, // goerli unlock contract - abi: UnlockV12.abi, - functionName: unlockFunctionName, - args: [calldata, 12], // version 12 - }) - const { data, isLoading, isSuccess, write } = useContractWrite(config) - - async function deployLock(duration: number, price: string, supply: number, name: string) { - setUnlockFunctionName('createUpgradeableLockAtVersion') - setCalldata( - lockInterface.encodeFunctionData('initialize(address,uint256,address,uint256,uint256,string)', [ - address, - duration === 0 ? ethers.constants.MaxUint256 : duration * 60 * 60 * 24, - ethers.constants.AddressZero, // token address defaults to ETH, can be any ERC20 - ethers.utils.parseUnits(price, 18), // key price in ETH - supply === 0 ? ethers.constants.MaxUint256 : supply, - name, - ]) - ) - write?.() - } - - return { data, isLoading, isSuccess, deployLock } -} diff --git a/integrations/unlock/wagmi.config.ts b/integrations/unlock/wagmi.config.ts index ec72d6bd..0ae13759 100644 --- a/integrations/unlock/wagmi.config.ts +++ b/integrations/unlock/wagmi.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from '@wagmi/cli' +import { react } from '@wagmi/cli/plugins' import { publicLockV13Abi } from './abis/public-lock-v13-abi' import { unlockV12Abi } from './abis/unlock-v12-abi' @@ -15,5 +16,5 @@ export default defineConfig({ abi: publicLockV13Abi, }, ], - plugins: [], + plugins: [react()], }) From 4226f58e4ca7e6071e115d7067886b086555fabb Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 19:14:32 -0500 Subject: [PATCH 06/15] feat: filter supported networks --- app/(general)/integration/unlock/page.tsx | 23 +++++++++++++----- .../hooks/use-unlock-supported-networks.tsx | 24 +++++++++++++++++++ 2 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 integrations/unlock/hooks/use-unlock-supported-networks.tsx diff --git a/app/(general)/integration/unlock/page.tsx b/app/(general)/integration/unlock/page.tsx index ad15a3a0..e2e7b92c 100644 --- a/app/(general)/integration/unlock/page.tsx +++ b/app/(general)/integration/unlock/page.tsx @@ -1,3 +1,5 @@ +'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' @@ -5,8 +7,11 @@ 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 (
-

Create a Lock

- -

Created Locks

- -

Owned Keys

- + {isSupported ? ( + <> +

Create a Lock

+ +

Created Locks

+ +

Owned Keys

+ + + ) : ( +

Unsupported Network

+ )}
diff --git a/integrations/unlock/hooks/use-unlock-supported-networks.tsx b/integrations/unlock/hooks/use-unlock-supported-networks.tsx new file mode 100644 index 00000000..c89816c9 --- /dev/null +++ b/integrations/unlock/hooks/use-unlock-supported-networks.tsx @@ -0,0 +1,24 @@ +import { useEffect, useState } from 'react' + +import { networks } from '@unlock-protocol/networks' +import { NetworkConfigs } from '@unlock-protocol/paywall' +import { useNetwork } from 'wagmi' + +export default function useUnlockSuppertedNetworks() { + const [isSupported, setIsSupported] = useState(false) + const [unlockAddress, setUnlockAddress] = useState('') + const [subgraphEndpoint, setSupgraphEndpoint] = useState('') + + const { chain } = useNetwork() + const networkConfigs: NetworkConfigs = networks + + useEffect(() => { + if (chain && chain.id in networkConfigs) { + setIsSupported(true) + } else { + setIsSupported(false) + } + }, [chain]) + + return { isSupported, unlockAddress, subgraphEndpoint } +} From 499bbdad4a585b5f94d1e66515a5e61ce7f4915b Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 21:22:35 -0500 Subject: [PATCH 07/15] chore: typesafe supported networks hook --- .../hooks/use-unlock-supported-networks.tsx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/integrations/unlock/hooks/use-unlock-supported-networks.tsx b/integrations/unlock/hooks/use-unlock-supported-networks.tsx index c89816c9..cd15ced5 100644 --- a/integrations/unlock/hooks/use-unlock-supported-networks.tsx +++ b/integrations/unlock/hooks/use-unlock-supported-networks.tsx @@ -1,24 +1,29 @@ import { useEffect, useState } from 'react' import { networks } from '@unlock-protocol/networks' -import { NetworkConfigs } from '@unlock-protocol/paywall' import { useNetwork } from 'wagmi' +type UnlockNetworkConfig = { + [key: number]: { unlockAddress: string; subgraphEndpoint: string } +} + export default function useUnlockSuppertedNetworks() { const [isSupported, setIsSupported] = useState(false) - const [unlockAddress, setUnlockAddress] = useState('') - const [subgraphEndpoint, setSupgraphEndpoint] = useState('') + const [networkData, setNetworkData] = useState<{ unlockAddress: string; subgraphEndpoint: string }>({ unlockAddress: '', subgraphEndpoint: '' }) const { chain } = useNetwork() - const networkConfigs: NetworkConfigs = networks + + const unlockNwConfig: UnlockNetworkConfig = networks useEffect(() => { - if (chain && chain.id in networkConfigs) { + if (chain && chain.id in networks) { setIsSupported(true) - } else { - setIsSupported(false) + setNetworkData({ + unlockAddress: unlockNwConfig[chain.id].unlockAddress, + subgraphEndpoint: unlockNwConfig[chain.id].subgraphEndpoint, + }) } }, [chain]) - return { isSupported, unlockAddress, subgraphEndpoint } + return { isSupported, networkData } } From df4bcb77dffbb7674d21acdee7ca838180d2cf6f Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 21:46:59 -0500 Subject: [PATCH 08/15] chore: bugs with supported networks --- .../unlock/components/form-deploy-lock.tsx | 7 +++- .../hooks/use-unlock-supported-networks.tsx | 38 ++++++++++++++----- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/integrations/unlock/components/form-deploy-lock.tsx b/integrations/unlock/components/form-deploy-lock.tsx index 72b1f7da..3bc6026d 100644 --- a/integrations/unlock/components/form-deploy-lock.tsx +++ b/integrations/unlock/components/form-deploy-lock.tsx @@ -8,6 +8,7 @@ import { Button } from '@/components/ui/button' import { Switch } from '@/components/ui/switch' import { usePrepareUnlockV12CreateLock, useUnlockV12CreateLock } from '../generated/unlock-wagmi' +import useUnlockSuppertedNetworks from '../hooks/use-unlock-supported-networks' export default function FormDeployLock() { const [lockName, setLockName] = useState('test lock') @@ -19,8 +20,10 @@ export default function FormDeployLock() { const [unlimitedKeys, setUnlimitedKeys] = useState(false) const [unlimitedDuration, setUnlimitedDuration] = useState(false) + const { isSupported, networkData } = useUnlockSuppertedNetworks() + const { config } = usePrepareUnlockV12CreateLock({ - address: '0x627118a4fB747016911e5cDA82e2E77C531e8206', // goerli + address: networkData.unlockAddress, args: [ duration === 0 ? BigInt(ethers.constants.MaxUint256.toString()) : BigInt(duration * 60 * 60 * 24), ethers.constants.AddressZero, // token address defaults to ETH, can be any ERC20 @@ -33,7 +36,7 @@ export default function FormDeployLock() { const { write, isLoading, isSuccess } = useUnlockV12CreateLock(config) function handleDeploy() { - write?.() + isSupported && write?.() } function handleUnlimitedKeys(e: boolean) { diff --git a/integrations/unlock/hooks/use-unlock-supported-networks.tsx b/integrations/unlock/hooks/use-unlock-supported-networks.tsx index cd15ced5..deea2f06 100644 --- a/integrations/unlock/hooks/use-unlock-supported-networks.tsx +++ b/integrations/unlock/hooks/use-unlock-supported-networks.tsx @@ -1,27 +1,45 @@ import { useEffect, useState } from 'react' -import { networks } from '@unlock-protocol/networks' import { useNetwork } from 'wagmi' -type UnlockNetworkConfig = { - [key: number]: { unlockAddress: string; subgraphEndpoint: string } -} - export default function useUnlockSuppertedNetworks() { const [isSupported, setIsSupported] = useState(false) - const [networkData, setNetworkData] = useState<{ unlockAddress: string; subgraphEndpoint: string }>({ unlockAddress: '', subgraphEndpoint: '' }) + const [networkData, setNetworkData] = useState<{ unlockAddress: `0x${string}`; subgraphEndpoint: string }>({ + unlockAddress: '0x', + subgraphEndpoint: '', + }) const { chain } = useNetwork() - const unlockNwConfig: UnlockNetworkConfig = networks + const unlockNetworks: { [key: number]: { unlockAddress: `0x${string}`; subgraphEndpoint: string } } = { + 1: { + unlockAddress: '0xe79B93f8E22676774F2A8dAd469175ebd00029FA', + subgraphEndpoint: 'mainnet-v2', + }, + 10: { + unlockAddress: '0x99b1348a9129ac49c6de7F11245773dE2f51fB0c', + subgraphEndpoint: 'optimism-v2', + }, + 80001: { + unlockAddress: '0x1FF7e338d5E582138C46044dc238543Ce555C963', + subgraphEndpoint: 'mumbai-v2', + }, + 5: { + unlockAddress: '0x627118a4fB747016911e5cDA82e2E77C531e8206', + subgraphEndpoint: 'goerli-v2', + }, + } useEffect(() => { - if (chain && chain.id in networks) { + if (chain && chain.id in unlockNetworks) { + const id: number = chain.id setIsSupported(true) setNetworkData({ - unlockAddress: unlockNwConfig[chain.id].unlockAddress, - subgraphEndpoint: unlockNwConfig[chain.id].subgraphEndpoint, + unlockAddress: unlockNetworks[id].unlockAddress, + subgraphEndpoint: unlockNetworks[id].subgraphEndpoint, }) + } else { + setIsSupported(false) } }, [chain]) From 0faa5cb04a12777c200f8e4565d8ffe12d613b51 Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 5 Sep 2023 21:53:37 -0500 Subject: [PATCH 09/15] chore: updated readme --- app/(general)/integration/unlock/[lockId]/page.tsx | 2 +- integrations/unlock/README.md | 14 +++++++++++--- .../unlock/components/button-key-checkout.tsx | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/(general)/integration/unlock/[lockId]/page.tsx b/app/(general)/integration/unlock/[lockId]/page.tsx index 3a9527a7..89f73238 100644 --- a/app/(general)/integration/unlock/[lockId]/page.tsx +++ b/app/(general)/integration/unlock/[lockId]/page.tsx @@ -3,7 +3,7 @@ import LockStats from '@/integrations/unlock/components/lock-stats' export default function UnlockLockPage({ params }: { params: { lockId: string } }) { return ( -
+

Lock Stats

diff --git a/integrations/unlock/README.md b/integrations/unlock/README.md index 9c775355..b65acc66 100644 --- a/integrations/unlock/README.md +++ b/integrations/unlock/README.md @@ -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. @@ -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 diff --git a/integrations/unlock/components/button-key-checkout.tsx b/integrations/unlock/components/button-key-checkout.tsx index 80823adc..099d2782 100644 --- a/integrations/unlock/components/button-key-checkout.tsx +++ b/integrations/unlock/components/button-key-checkout.tsx @@ -28,5 +28,5 @@ export default function ButtonKeyCheckout({ lockId }: { lockId: string }) { } } - return
{}
+ return
{}
} From 34b075ef18cd88b9b1d78aaee409776b99be20ce Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 12 Sep 2023 18:43:28 -0500 Subject: [PATCH 10/15] chore: adjusted UI --- app/(general)/integration/unlock/page.tsx | 6 ++++-- integrations/unlock/components/form-deploy-lock.tsx | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/(general)/integration/unlock/page.tsx b/app/(general)/integration/unlock/page.tsx index e2e7b92c..5dd10e72 100644 --- a/app/(general)/integration/unlock/page.tsx +++ b/app/(general)/integration/unlock/page.tsx @@ -14,7 +14,7 @@ export default function UnlockIntegration() { return (
-
+
@@ -35,7 +35,9 @@ export default function UnlockIntegration() { - +
+ +
) diff --git a/integrations/unlock/components/form-deploy-lock.tsx b/integrations/unlock/components/form-deploy-lock.tsx index 3bc6026d..b88a8c24 100644 --- a/integrations/unlock/components/form-deploy-lock.tsx +++ b/integrations/unlock/components/form-deploy-lock.tsx @@ -63,13 +63,13 @@ export default function FormDeployLock() {
- setLockName(e.target.value)} /> + setLockName(e.target.value)} />
{unlimitedKeys ? ( - + ) : ( - setMaxKeys(Number(e.target.value))} /> + setMaxKeys(Number(e.target.value))} /> )}

unlimited:

From 66392560809ae7dccefd1803fe1087f687e73eaa Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 12 Sep 2023 18:45:10 -0500 Subject: [PATCH 11/15] chore: centered no locks and no keys found text --- integrations/unlock/components/user-keys.tsx | 2 +- integrations/unlock/components/user-locks.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integrations/unlock/components/user-keys.tsx b/integrations/unlock/components/user-keys.tsx index 8b7bd370..67ef2d56 100644 --- a/integrations/unlock/components/user-keys.tsx +++ b/integrations/unlock/components/user-keys.tsx @@ -34,7 +34,7 @@ export default function UserKeys() { ))}
) : ( -

No Keys Found

+

No Keys Found

)}
) diff --git a/integrations/unlock/components/user-locks.tsx b/integrations/unlock/components/user-locks.tsx index b7334ba6..0d5a830e 100644 --- a/integrations/unlock/components/user-locks.tsx +++ b/integrations/unlock/components/user-locks.tsx @@ -32,7 +32,7 @@ export default function UserLocks() { ))}
) : ( -

No Locks Found

+

No Locks Found

)}
) From 780dcc90b65a59c7a299e329ea36527aef72a2fb Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 12 Sep 2023 18:49:13 -0500 Subject: [PATCH 12/15] feat: key preview links to stats page --- integrations/unlock/components/key-preview.tsx | 13 ++++++++----- integrations/unlock/components/user-keys.tsx | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/integrations/unlock/components/key-preview.tsx b/integrations/unlock/components/key-preview.tsx index 5e5a7df4..f726492c 100644 --- a/integrations/unlock/components/key-preview.tsx +++ b/integrations/unlock/components/key-preview.tsx @@ -1,12 +1,15 @@ interface KeyPreviewProps { lockName: string | undefined | null + lockId: string } -export default function KeyPreview({ lockName }: KeyPreviewProps) { +export default function KeyPreview({ lockName, lockId }: KeyPreviewProps) { return ( -
-
-

{lockName}

+ +
+
+

{lockName}

+
-
+ ) } diff --git a/integrations/unlock/components/user-keys.tsx b/integrations/unlock/components/user-keys.tsx index 67ef2d56..c292554a 100644 --- a/integrations/unlock/components/user-keys.tsx +++ b/integrations/unlock/components/user-keys.tsx @@ -29,7 +29,7 @@ export default function UserKeys() {
{userKeys.keys.map((key) => (
- +
))}
From b30c6b1db92d424c6f9c388a2424decdb7bbe14f Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 12 Sep 2023 18:55:08 -0500 Subject: [PATCH 13/15] feat: more informational ui on paywall demo --- integrations/unlock/components/paywall-demo.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/integrations/unlock/components/paywall-demo.tsx b/integrations/unlock/components/paywall-demo.tsx index 4bc4d22f..b60fd992 100644 --- a/integrations/unlock/components/paywall-demo.tsx +++ b/integrations/unlock/components/paywall-demo.tsx @@ -59,9 +59,16 @@ export default function PaywallDemo() { return ( <>
-

Status: {unlockStatus}

- {unlockStatus === 'locked' && } - {unlockStatus === 'unlocked' &&

Access Granted!

} +

Status: {unlockStatus}

+ {unlockStatus === 'locked' && ( +
+

This webpage is currently locked by Unlock Protocol. Purchase a key below to unlock the page.

+ +
+ )} + {unlockStatus === 'unlocked' &&

Access Granted!

}
) From a6e9b6da9973d57d7769e98fabe7e75e75d9e3c1 Mon Sep 17 00:00:00 2001 From: TRBIV Date: Tue, 12 Sep 2023 19:00:41 -0500 Subject: [PATCH 14/15] feat: using transaction status component, added spacing for transaction status --- integrations/unlock/components/form-deploy-lock.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/unlock/components/form-deploy-lock.tsx b/integrations/unlock/components/form-deploy-lock.tsx index b88a8c24..4f62f0af 100644 --- a/integrations/unlock/components/form-deploy-lock.tsx +++ b/integrations/unlock/components/form-deploy-lock.tsx @@ -4,6 +4,7 @@ import { useState } from 'react' import { ethers } from 'ethers' +import { TransactionStatus } from '@/components/blockchain/transaction-status' import { Button } from '@/components/ui/button' import { Switch } from '@/components/ui/switch' @@ -33,7 +34,7 @@ export default function FormDeployLock() { '0x000000000000000000000000', ], }) - const { write, isLoading, isSuccess } = useUnlockV12CreateLock(config) + const { write, isLoading, isSuccess, isError } = useUnlockV12CreateLock(config) function handleDeploy() { isSupported && write?.() @@ -94,10 +95,9 @@ export default function FormDeployLock() { setKeyPrice(e.target.value)} />
-
+
- {isLoading &&

Deploying lock...

} - {isSuccess &&

Lock deployed!

} +
From 6a8b476e4f3baa592cf560e5b672194a99f04e34 Mon Sep 17 00:00:00 2001 From: TRBIV Date: Wed, 13 Sep 2023 01:30:56 -0500 Subject: [PATCH 15/15] feat: button disabled while transaction loading --- integrations/unlock/components/form-deploy-lock.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/integrations/unlock/components/form-deploy-lock.tsx b/integrations/unlock/components/form-deploy-lock.tsx index 4f62f0af..a7076cd6 100644 --- a/integrations/unlock/components/form-deploy-lock.tsx +++ b/integrations/unlock/components/form-deploy-lock.tsx @@ -96,7 +96,9 @@ export default function FormDeployLock() { setKeyPrice(e.target.value)} />
- +