From 0ac6f8476a0bc3f5af5d577e4fe29b84afe77b12 Mon Sep 17 00:00:00 2001 From: Vitor Date: Mon, 7 Aug 2023 08:59:41 -0300 Subject: [PATCH 1/3] feat: initial commit --- .../integration/allo/api/hello-world/route.ts | 5 + app/(general)/integration/allo/layout.tsx | 58 +++ .../integration/allo/opengraph-image.tsx | 9 + app/(general)/integration/allo/page.tsx | 11 + .../integration/allo/twitter-image.tsx | 9 + app/(general)/page.tsx | 15 + data/turbo-integrations.ts | 8 + integrations/allo/README.md | 62 +++ integrations/allo/abis/starter-abi.ts | 285 +++++++++++++ integrations/allo/client/index.ts | 7 + .../allo/components/starter-header.tsx | 10 + integrations/allo/generated/starter-wagmi.ts | 381 ++++++++++++++++++ integrations/allo/hooks/use-starter.ts | 9 + integrations/allo/index.ts | 1 + integrations/allo/utils/types.ts | 6 + integrations/allo/wagmi.config.ts | 15 + lib/generated/blockchain.ts | 2 +- public/integrations/allo.jpeg | Bin 0 -> 9277 bytes 18 files changed, 892 insertions(+), 1 deletion(-) create mode 100644 app/(general)/integration/allo/api/hello-world/route.ts create mode 100644 app/(general)/integration/allo/layout.tsx create mode 100644 app/(general)/integration/allo/opengraph-image.tsx create mode 100644 app/(general)/integration/allo/page.tsx create mode 100644 app/(general)/integration/allo/twitter-image.tsx create mode 100644 integrations/allo/README.md create mode 100644 integrations/allo/abis/starter-abi.ts create mode 100644 integrations/allo/client/index.ts create mode 100644 integrations/allo/components/starter-header.tsx create mode 100644 integrations/allo/generated/starter-wagmi.ts create mode 100644 integrations/allo/hooks/use-starter.ts create mode 100644 integrations/allo/index.ts create mode 100644 integrations/allo/utils/types.ts create mode 100644 integrations/allo/wagmi.config.ts create mode 100644 public/integrations/allo.jpeg diff --git a/app/(general)/integration/allo/api/hello-world/route.ts b/app/(general)/integration/allo/api/hello-world/route.ts new file mode 100644 index 00000000..c310e819 --- /dev/null +++ b/app/(general)/integration/allo/api/hello-world/route.ts @@ -0,0 +1,5 @@ +export async function GET(request: Request) { + return new Response('Hello, TurboETH!', { + status: 200, + }) +} diff --git a/app/(general)/integration/allo/layout.tsx b/app/(general)/integration/allo/layout.tsx new file mode 100644 index 00000000..8c94e0a9 --- /dev/null +++ b/app/(general)/integration/allo/layout.tsx @@ -0,0 +1,58 @@ +'use client' +import { ReactNode } from 'react' + +import { motion } from 'framer-motion' +import Image from 'next/image' +import Balancer from 'react-wrap-balancer' + +import { IsDarkTheme } from '@/components/shared/is-dark-theme' +import { IsLightTheme } from '@/components/shared/is-light-theme' +import { LinkComponent } from '@/components/shared/link-component' +import { FADE_DOWN_ANIMATION_VARIANTS } from '@/config/design' +import { turboIntegrations } from '@/data/turbo-integrations' + +const integrationData = turboIntegrations.allo + +export default function LayoutIntegration({ children }: { children: ReactNode }) { + return ( + <> +
+ + + Starter logo + + + Starter logo + + + {integrationData.name} + + + {integrationData.description} + + + + Documentation + + + +
+ {children} + + ) +} diff --git a/app/(general)/integration/allo/opengraph-image.tsx b/app/(general)/integration/allo/opengraph-image.tsx new file mode 100644 index 00000000..935b53ae --- /dev/null +++ b/app/(general)/integration/allo/opengraph-image.tsx @@ -0,0 +1,9 @@ +import { IntegrationOgImage } from '@/components/ui/social/og-image-integrations' + +export const runtime = 'edge' +export const size = { + width: 1200, + height: 630, +} + +export default IntegrationOgImage('allo') diff --git a/app/(general)/integration/allo/page.tsx b/app/(general)/integration/allo/page.tsx new file mode 100644 index 00000000..7ec2bc8d --- /dev/null +++ b/app/(general)/integration/allo/page.tsx @@ -0,0 +1,11 @@ +import { WalletConnect } from '@/components/blockchain/wallet-connect' + +export default function PageIntegration() { + return ( +
+
+ +
+
+ ) +} diff --git a/app/(general)/integration/allo/twitter-image.tsx b/app/(general)/integration/allo/twitter-image.tsx new file mode 100644 index 00000000..dbca541e --- /dev/null +++ b/app/(general)/integration/allo/twitter-image.tsx @@ -0,0 +1,9 @@ +import Image from './opengraph-image' + +export const runtime = 'edge' +export const size = { + width: 1200, + height: 630, +} + +export default Image diff --git a/app/(general)/page.tsx b/app/(general)/page.tsx index 8cf8ac72..d6325a17 100644 --- a/app/(general)/page.tsx +++ b/app/(general)/page.tsx @@ -334,6 +334,21 @@ const features = [ ), }, + { + title: turboIntegrations.allo.name, + description: turboIntegrations.allo.description, + href: turboIntegrations.allo.href, + demo: ( +
+ + Allo logo + + + Allo logo + +
+ ), + }, { title: turboIntegrations.starter.name, description: turboIntegrations.starter.description, diff --git a/data/turbo-integrations.ts b/data/turbo-integrations.ts index 3f83c841..c2728630 100644 --- a/data/turbo-integrations.ts +++ b/data/turbo-integrations.ts @@ -88,6 +88,14 @@ export const turboIntegrations = { imgLight: '/integrations/connext.png', imgDark: '/integrations/connext.png', }, + allo: { + name: 'Allo Protocol', + href: '/integration/allo', + url: 'https://docs.allo.gitcoin.co/', + description: 'Allo Protocol is an open-source protocol that enables groups to efficiently and transparently allocate pooled capital.', + imgLight: '/integrations/allo.jpeg', + imgDark: '/integrations/allo.jpeg', + }, starter: { name: 'Starter Template', href: '/integration/starter', diff --git a/integrations/allo/README.md b/integrations/allo/README.md new file mode 100644 index 00000000..86d925d5 --- /dev/null +++ b/integrations/allo/README.md @@ -0,0 +1,62 @@ +# Starter TurboETH Integration + +Welcome to the Starter TurboETH Integration! This folder serves as a blueprint for creating new integrations in TurboETH. If you're looking to contribute a new integration, simply copy this directory, and also the starter page located at `app/integration/starter`, to begin your development. + +## Creating a new integration + +Below are the steps to create a new integration. + +1. Copy the integration folder template from `/integrations/starter` and add your integration code, adhering to the file structure patterns evident in this folder. + +2. Duplicate the integration page from `/app/(general)/integration/starter` and populate it with your integration pages' code. + +3. Locate any API endpoints associated with your integration in the `/api` folder within the page folder of your integration. An example API endpoint can be found at `/app/(general)/integration/starter/api/hello-world/route.ts`. These API endpoints should follow the new [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/router-handlers) patterns of Next.js 13. + +4. Enter the data related to your integration in `/data/turbo-integrations.ts`. Here, add a new object with the name, description, image, and URL of your integration. + +5. Update the OG image configuration of your integration page in the `opengraph-image.tsx` file. Do this by replacing the argument of the `IntegrationOgImage` function with the object key of your integration used in the previous step. + +## Understanding the Starter template + +Each component of the Starter TurboETH template is designed to help streamline your development process: + +- **abis/**: Put your contract's ABI here. Each ABI should be in its own TypeScript file. + +- **client/**: Any client initialization for your chosen module or SDK should be placed here. + +- **components/**: This is the home for your React components. 'Read' components, which display data from a contract, and 'write' components, that send transactions, should all be placed here. + +- **hooks/**: Place your custom React hooks in this folder. These hooks are intended to manage state updates and encapsulate the logic for interacting with Ethereum contracts. + +- **starter-wagmi.ts**: This is a generated file from [wagmi-cli](https://wagmi.sh/cli/getting-started). It includes hooks for your contracts . + +- **index.ts**: Consider this as the entry point for your integration. It should export all the hooks, components, and utility functions that your integration provides. + +- **wagmi.config.ts**: This file should hold the wagmi-cli configuration for your integration, which includes settings like compiler version and optimization. + +- **README.md**: Here, you should document your integration. Explain its purpose, its use, and any important information a new developer or user should know. + +Each of these elements plays a crucial role in making your integration functional and accessible. + +## File Structure + +``` +integrations/starter +├─ abis/ +│ ├─ starter-abi.ts +├─ client/ +│ ├─ index.ts +├─ components/ +│ ├─ starter-header.tsx +├─ generated/ +│ ├─ starter-wagmi.ts +├─ hooks/ +│ ├─ use-starter.ts +├─ utils/ +│ ├─ types.ts +├─ index.ts +├─ README.md +├─ wagmi.config.ts +``` + +By using this template, you'll create well-organized and understandable integrations that are easy for you and others to navigate. Happy coding! diff --git a/integrations/allo/abis/starter-abi.ts b/integrations/allo/abis/starter-abi.ts new file mode 100644 index 00000000..437c803c --- /dev/null +++ b/integrations/allo/abis/starter-abi.ts @@ -0,0 +1,285 @@ +/** + * Starter ABI placeholder based on ERC20. Replace with your own ABI. + */ +export const starterABI = [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_spender', + type: 'address', + }, + { + name: '_value', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + name: 'success', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_from', + type: 'address', + }, + { + name: '_to', + type: 'address', + }, + { + name: '_value', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + name: 'success', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '', + type: 'address', + }, + ], + name: 'balances', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [ + { + name: '', + type: 'uint8', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '', + type: 'address', + }, + { + name: '', + type: 'address', + }, + ], + name: 'allowed', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '_owner', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + name: 'balance', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_to', + type: 'address', + }, + { + name: '_value', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + name: 'success', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '_owner', + type: 'address', + }, + { + name: '_spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + name: 'remaining', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + name: '_initialAmount', + type: 'uint256', + }, + { + name: '_tokenName', + type: 'string', + }, + { + name: '_decimalUnits', + type: 'uint8', + }, + { + name: '_tokenSymbol', + type: 'string', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: '_from', + type: 'address', + }, + { + indexed: true, + name: '_to', + type: 'address', + }, + { + indexed: false, + name: '_value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: '_owner', + type: 'address', + }, + { + indexed: true, + name: '_spender', + type: 'address', + }, + { + indexed: false, + name: '_value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, +] as const diff --git a/integrations/allo/client/index.ts b/integrations/allo/client/index.ts new file mode 100644 index 00000000..56f42288 --- /dev/null +++ b/integrations/allo/client/index.ts @@ -0,0 +1,7 @@ +/** + * Placeholder client for starter. Replace with your own client. + */ +export const client = { + connect: async () => null, + disconnect: async () => null, +} diff --git a/integrations/allo/components/starter-header.tsx b/integrations/allo/components/starter-header.tsx new file mode 100644 index 00000000..5758a98a --- /dev/null +++ b/integrations/allo/components/starter-header.tsx @@ -0,0 +1,10 @@ +/** + * Starter component placeholder. Replace with your own component. + */ +export function StarterHeader() { + return ( +
+

Starter

+
+ ) +} diff --git a/integrations/allo/generated/starter-wagmi.ts b/integrations/allo/generated/starter-wagmi.ts new file mode 100644 index 00000000..948827a4 --- /dev/null +++ b/integrations/allo/generated/starter-wagmi.ts @@ -0,0 +1,381 @@ +// Generated by @wagmi/cli@1.1.0 on 6/19/2023 at 9:30:24 AM +import { + useContractRead, + UseContractReadConfig, + useContractWrite, + UseContractWriteConfig, + usePrepareContractWrite, + UsePrepareContractWriteConfig, + useContractEvent, + UseContractEventConfig, +} from 'wagmi' +import { ReadContractResult, WriteContractMode, PrepareWriteContractResult } from 'wagmi/actions' + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// starter +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const starterABI = [ + { constant: true, payable: false, stateMutability: 'view', type: 'function', inputs: [], name: 'name', outputs: [{ name: '', type: 'string' }] }, + { + constant: false, + payable: false, + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'approve', + outputs: [{ name: 'success', type: 'bool' }], + }, + { + constant: true, + payable: false, + stateMutability: 'view', + type: 'function', + inputs: [], + name: 'totalSupply', + outputs: [{ name: '', type: 'uint256' }], + }, + { + constant: false, + payable: false, + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_from', type: 'address' }, + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [{ name: 'success', type: 'bool' }], + }, + { + constant: true, + payable: false, + stateMutability: 'view', + type: 'function', + inputs: [{ name: '', type: 'address' }], + name: 'balances', + outputs: [{ name: '', type: 'uint256' }], + }, + { constant: true, payable: false, stateMutability: 'view', type: 'function', inputs: [], name: 'decimals', outputs: [{ name: '', type: 'uint8' }] }, + { + constant: true, + payable: false, + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '', type: 'address' }, + { name: '', type: 'address' }, + ], + name: 'allowed', + outputs: [{ name: '', type: 'uint256' }], + }, + { + constant: true, + payable: false, + stateMutability: 'view', + type: 'function', + inputs: [{ name: '_owner', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: 'balance', type: 'uint256' }], + }, + { constant: true, payable: false, stateMutability: 'view', type: 'function', inputs: [], name: 'symbol', outputs: [{ name: '', type: 'string' }] }, + { + constant: false, + payable: false, + stateMutability: 'nonpayable', + type: 'function', + inputs: [ + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transfer', + outputs: [{ name: 'success', type: 'bool' }], + }, + { + constant: true, + payable: false, + stateMutability: 'view', + type: 'function', + inputs: [ + { name: '_owner', type: 'address' }, + { name: '_spender', type: 'address' }, + ], + name: 'allowance', + outputs: [{ name: 'remaining', type: 'uint256' }], + }, + { + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + inputs: [ + { name: '_initialAmount', type: 'uint256' }, + { name: '_tokenName', type: 'string' }, + { name: '_decimalUnits', type: 'uint8' }, + { name: '_tokenSymbol', type: 'string' }, + ], + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: '_from', type: 'address', indexed: true }, + { name: '_to', type: 'address', indexed: true }, + { name: '_value', type: 'uint256', indexed: false }, + ], + name: 'Transfer', + }, + { + type: 'event', + anonymous: false, + inputs: [ + { name: '_owner', type: 'address', indexed: true }, + { name: '_spender', type: 'address', indexed: true }, + { name: '_value', type: 'uint256', indexed: false }, + ], + name: 'Approval', + }, +] as const + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// React +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__. + */ +export function useStarterRead>( + config: Omit, 'abi'> = {} as any +) { + return useContractRead({ abi: starterABI, ...config } as UseContractReadConfig) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"name"`. + */ +export function useStarterName>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'name', ...config } as UseContractReadConfig) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"totalSupply"`. + */ +export function useStarterTotalSupply>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'totalSupply', ...config } as UseContractReadConfig< + typeof starterABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"balances"`. + */ +export function useStarterBalances>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'balances', ...config } as UseContractReadConfig< + typeof starterABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"decimals"`. + */ +export function useStarterDecimals>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'decimals', ...config } as UseContractReadConfig< + typeof starterABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"allowed"`. + */ +export function useStarterAllowed>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'allowed', ...config } as UseContractReadConfig< + typeof starterABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"balanceOf"`. + */ +export function useStarterBalanceOf>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'balanceOf', ...config } as UseContractReadConfig< + typeof starterABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"symbol"`. + */ +export function useStarterSymbol>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'symbol', ...config } as UseContractReadConfig< + typeof starterABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractRead}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"allowance"`. + */ +export function useStarterAllowance>( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return useContractRead({ abi: starterABI, functionName: 'allowance', ...config } as UseContractReadConfig< + typeof starterABI, + TFunctionName, + TSelectData + >) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link starterABI}__. + */ +export function useStarterWrite( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], TFunctionName, TMode> + : UseContractWriteConfig & { + abi?: never + } = {} as any +) { + return useContractWrite({ abi: starterABI, ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"approve"`. + */ +export function useStarterApprove( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'approve', TMode> & { + functionName?: 'approve' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'approve' + } = {} as any +) { + return useContractWrite({ abi: starterABI, functionName: 'approve', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"transferFrom"`. + */ +export function useStarterTransferFrom( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'transferFrom', TMode> & { + functionName?: 'transferFrom' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'transferFrom' + } = {} as any +) { + return useContractWrite({ abi: starterABI, functionName: 'transferFrom', ...config } as any) +} + +/** + * Wraps __{@link useContractWrite}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"transfer"`. + */ +export function useStarterTransfer( + config: TMode extends 'prepared' + ? UseContractWriteConfig['request']['abi'], 'transfer', TMode> & { + functionName?: 'transfer' + } + : UseContractWriteConfig & { + abi?: never + functionName?: 'transfer' + } = {} as any +) { + return useContractWrite({ abi: starterABI, functionName: 'transfer', ...config } as any) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link starterABI}__. + */ +export function usePrepareStarterWrite( + config: Omit, 'abi'> = {} as any +) { + return usePrepareContractWrite({ abi: starterABI, ...config } as UsePrepareContractWriteConfig) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"approve"`. + */ +export function usePrepareStarterApprove( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: starterABI, functionName: 'approve', ...config } as UsePrepareContractWriteConfig< + typeof starterABI, + 'approve' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"transferFrom"`. + */ +export function usePrepareStarterTransferFrom( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: starterABI, functionName: 'transferFrom', ...config } as UsePrepareContractWriteConfig< + typeof starterABI, + 'transferFrom' + >) +} + +/** + * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link starterABI}__ and `functionName` set to `"transfer"`. + */ +export function usePrepareStarterTransfer( + config: Omit, 'abi' | 'functionName'> = {} as any +) { + return usePrepareContractWrite({ abi: starterABI, functionName: 'transfer', ...config } as UsePrepareContractWriteConfig< + typeof starterABI, + 'transfer' + >) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link starterABI}__. + */ +export function useStarterEvent(config: Omit, 'abi'> = {} as any) { + return useContractEvent({ abi: starterABI, ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link starterABI}__ and `eventName` set to `"Transfer"`. + */ +export function useStarterTransferEvent(config: Omit, 'abi' | 'eventName'> = {} as any) { + return useContractEvent({ abi: starterABI, eventName: 'Transfer', ...config } as UseContractEventConfig) +} + +/** + * Wraps __{@link useContractEvent}__ with `abi` set to __{@link starterABI}__ and `eventName` set to `"Approval"`. + */ +export function useStarterApprovalEvent(config: Omit, 'abi' | 'eventName'> = {} as any) { + return useContractEvent({ abi: starterABI, eventName: 'Approval', ...config } as UseContractEventConfig) +} diff --git a/integrations/allo/hooks/use-starter.ts b/integrations/allo/hooks/use-starter.ts new file mode 100644 index 00000000..eebfdff0 --- /dev/null +++ b/integrations/allo/hooks/use-starter.ts @@ -0,0 +1,9 @@ +import { useState } from 'react' + +/** + * Placeholder hook for starter. Replace with your own hook. + */ +export function useStarter() { + const [starter, setStarter] = useState() + return { starter, setStarter } +} diff --git a/integrations/allo/index.ts b/integrations/allo/index.ts new file mode 100644 index 00000000..b9cdb2f3 --- /dev/null +++ b/integrations/allo/index.ts @@ -0,0 +1 @@ +export const starter = {} diff --git a/integrations/allo/utils/types.ts b/integrations/allo/utils/types.ts new file mode 100644 index 00000000..c5f2183a --- /dev/null +++ b/integrations/allo/utils/types.ts @@ -0,0 +1,6 @@ +/** + * Placeholder for the starter type. Replace with your own types. + */ +export interface Starter { + title: string +} diff --git a/integrations/allo/wagmi.config.ts b/integrations/allo/wagmi.config.ts new file mode 100644 index 00000000..ef98fc62 --- /dev/null +++ b/integrations/allo/wagmi.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from '@wagmi/cli' +import { react } from '@wagmi/cli/plugins' + +import { starterABI } from './abis/starter-abi' + +export default defineConfig({ + out: './integrations/starter/generated/starter-wagmi.ts', + contracts: [ + { + name: 'starter', + abi: starterABI, + }, + ], + plugins: [react()], +}) diff --git a/lib/generated/blockchain.ts b/lib/generated/blockchain.ts index fc197dee..2f6e3cd4 100644 --- a/lib/generated/blockchain.ts +++ b/lib/generated/blockchain.ts @@ -1,4 +1,4 @@ -// Generated by @wagmi/cli@1.1.0 on 7/24/2023 at 3:53:22 PM +// Generated by @wagmi/cli@1.1.0 on 7/29/2023 at 11:33:28 AM import { useContractRead, UseContractReadConfig, diff --git a/public/integrations/allo.jpeg b/public/integrations/allo.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..4636d23f0dd11217d0dcfb370ed77760d6268851 GIT binary patch literal 9277 zcmc(E1wd8Jx9>h2N~v>bIW$U&bc=KfNJvNt9J*7b%b-IPq*F?|5m7)&>5vcvB&9(@ zkb3*Thx&c@{@=at{a?(6J!`L-^_#WUtXVUApOcZ3DFCJ@s~`(NAOHXXFW_VvEloj6 z>aME#Em;L6nbQWeC|jhR3pytN*x9=}tIJ8!>fF(#1^y_;NEb&5RaK=wSpOh*hfwGM zFu;z&`bXn`^@w9?=7Izj#0EPGA|0JwL0TN7RqnewqUb1)CPrEsn}T!}NMCgZ6$I&C z6yM~Go<-3XXY?M5cD}7H1psKcAWds=MqfqICTBFt7FwjGvmMyS7NjrR*}8!`oEDTN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ZewGZTf_^l#v!v2?@9vsv+mLUx~%byCZju4!aK{&!2lpG@tp8#zOY_u*4fr^S7Qm> f$&P|gL;pMaX~eY?p~CkBpgrw!=>KoDos9ku7sYL) literal 0 HcmV?d00001 From 207d7884875e038d98fed65a91df234b658945b2 Mon Sep 17 00:00:00 2001 From: Vitor Date: Mon, 14 Aug 2023 22:49:56 -0300 Subject: [PATCH 2/3] feat: add project registry components --- app/(general)/integration/allo/allo/page.tsx | 20 + .../integration/allo/api/hello-world/route.ts | 5 - app/(general)/integration/allo/layout.tsx | 14 + app/(general)/integration/allo/page.tsx | 10 +- .../integration/allo/registry/page.tsx | 25 + integrations/allo/abis/allo-abi.ts | 1279 ++++++++ integrations/allo/abis/index.ts | 2 + integrations/allo/abis/registry-abi.ts | 903 ++++++ integrations/allo/abis/starter-abi.ts | 285 -- integrations/allo/client/index.ts | 7 - .../allo/components/registry/index.ts | 3 + .../registry/registry-create-profile.tsx | 114 + .../registry-update-profile-metadata.tsx | 84 + .../registry/registry-update-profile-name.tsx | 68 + integrations/allo/generated/allo-wagmi.ts | 2785 +++++++++++++++++ integrations/allo/generated/starter-wagmi.ts | 381 --- .../{use-starter.ts => use-create-profile.ts} | 0 integrations/allo/hooks/use-nonce.ts | 15 + integrations/allo/utils/constants.ts | 2 + integrations/allo/wagmi.config.ts | 12 +- lib/generated/blockchain.ts | 2 +- 21 files changed, 5325 insertions(+), 691 deletions(-) create mode 100644 app/(general)/integration/allo/allo/page.tsx delete mode 100644 app/(general)/integration/allo/api/hello-world/route.ts create mode 100644 app/(general)/integration/allo/registry/page.tsx create mode 100644 integrations/allo/abis/allo-abi.ts create mode 100644 integrations/allo/abis/index.ts create mode 100644 integrations/allo/abis/registry-abi.ts delete mode 100644 integrations/allo/abis/starter-abi.ts delete mode 100644 integrations/allo/client/index.ts create mode 100644 integrations/allo/components/registry/index.ts create mode 100644 integrations/allo/components/registry/registry-create-profile.tsx create mode 100644 integrations/allo/components/registry/registry-update-profile-metadata.tsx create mode 100644 integrations/allo/components/registry/registry-update-profile-name.tsx create mode 100644 integrations/allo/generated/allo-wagmi.ts delete mode 100644 integrations/allo/generated/starter-wagmi.ts rename integrations/allo/hooks/{use-starter.ts => use-create-profile.ts} (100%) create mode 100644 integrations/allo/hooks/use-nonce.ts create mode 100644 integrations/allo/utils/constants.ts diff --git a/app/(general)/integration/allo/allo/page.tsx b/app/(general)/integration/allo/allo/page.tsx new file mode 100644 index 00000000..5d35410e --- /dev/null +++ b/app/(general)/integration/allo/allo/page.tsx @@ -0,0 +1,20 @@ +'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' + +export default function PageAllo() { + return ( +
+
+ +
+
+ + + +
+
+ ) +} diff --git a/app/(general)/integration/allo/api/hello-world/route.ts b/app/(general)/integration/allo/api/hello-world/route.ts deleted file mode 100644 index c310e819..00000000 --- a/app/(general)/integration/allo/api/hello-world/route.ts +++ /dev/null @@ -1,5 +0,0 @@ -export async function GET(request: Request) { - return new Response('Hello, TurboETH!', { - status: 200, - }) -} diff --git a/app/(general)/integration/allo/layout.tsx b/app/(general)/integration/allo/layout.tsx index 8c94e0a9..2fe44243 100644 --- a/app/(general)/integration/allo/layout.tsx +++ b/app/(general)/integration/allo/layout.tsx @@ -3,6 +3,7 @@ import { ReactNode } from 'react' import { motion } from 'framer-motion' import Image from 'next/image' +import { usePathname } from 'next/navigation' import Balancer from 'react-wrap-balancer' import { IsDarkTheme } from '@/components/shared/is-dark-theme' @@ -10,10 +11,15 @@ import { IsLightTheme } from '@/components/shared/is-light-theme' import { LinkComponent } from '@/components/shared/link-component' import { FADE_DOWN_ANIMATION_VARIANTS } from '@/config/design' import { turboIntegrations } from '@/data/turbo-integrations' +import { cn } from '@/lib/utils' const integrationData = turboIntegrations.allo +const registryPath = '/integration/allo/registry' +const alloPath = '/integration/allo/allo' export default function LayoutIntegration({ children }: { children: ReactNode }) { + const pathname = usePathname() + return ( <>
@@ -49,6 +55,14 @@ export default function LayoutIntegration({ children }: { children: ReactNode }) Documentation + + + + + + + +
diff --git a/app/(general)/integration/allo/page.tsx b/app/(general)/integration/allo/page.tsx index 7ec2bc8d..0a784207 100644 --- a/app/(general)/integration/allo/page.tsx +++ b/app/(general)/integration/allo/page.tsx @@ -1,11 +1,5 @@ -import { WalletConnect } from '@/components/blockchain/wallet-connect' +import { redirect } from 'next/navigation' export default function PageIntegration() { - return ( -
-
- -
-
- ) + redirect('/integration/allo/registry') } diff --git a/app/(general)/integration/allo/registry/page.tsx b/app/(general)/integration/allo/registry/page.tsx new file mode 100644 index 00000000..b441b682 --- /dev/null +++ b/app/(general)/integration/allo/registry/page.tsx @@ -0,0 +1,25 @@ +'use client' + +import { WalletConnect } from '@/components/blockchain/wallet-connect' +import { IsWalletConnected } from '@/components/shared/is-wallet-connected' +import { IsWalletDisconnected } from '@/components/shared/is-wallet-disconnected' +import { RegistryCreateProfile, RegistryUpdateProfileMetadata, RegistryUpdateProfileName } from '@/integrations/allo/components/registry' + +export default function PageRegistry() { + return ( +
+
+ +
+ + + +
+
+ + + +
+
+ ) +} diff --git a/integrations/allo/abis/allo-abi.ts b/integrations/allo/abis/allo-abi.ts new file mode 100644 index 00000000..649e48cf --- /dev/null +++ b/integrations/allo/abis/allo-abi.ts @@ -0,0 +1,1279 @@ +/** + * Allo ABI. + * source code: https://github.com/allo-protocol/allo-v2/blob/main/contracts/core/Allo.sol + */ +export const alloABI = [ + { + inputs: [], + name: 'AMOUNT_MISMATCH', + type: 'error', + }, + { + inputs: [], + name: 'INVALID_FEE', + type: 'error', + }, + { + inputs: [], + name: 'IS_APPROVED_STRATEGY', + type: 'error', + }, + { + inputs: [], + name: 'MISMATCH', + type: 'error', + }, + { + inputs: [], + name: 'NOT_APPROVED_STRATEGY', + type: 'error', + }, + { + inputs: [], + name: 'NOT_CONTRACT', + type: 'error', + }, + { + inputs: [], + name: 'NOT_ENOUGH_FUNDS', + type: 'error', + }, + { + inputs: [], + name: 'NewOwnerIsZeroAddress', + type: 'error', + }, + { + inputs: [], + name: 'NoHandoverRequest', + type: 'error', + }, + { + inputs: [], + name: 'UNAUTHORIZED', + type: 'error', + }, + { + inputs: [], + name: 'Unauthorized', + type: 'error', + }, + { + inputs: [], + name: 'ZERO_ADDRESS', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'poolId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'BaseFeePaid', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'baseFee', + type: 'uint256', + }, + ], + name: 'BaseFeeUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'feePercentage', + type: 'uint256', + }, + ], + name: 'FeePercentageUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint8', + name: 'version', + type: 'uint8', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pendingOwner', + type: 'address', + }, + ], + name: 'OwnershipHandoverCanceled', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pendingOwner', + type: 'address', + }, + ], + name: 'OwnershipHandoverRequested', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'oldOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'poolId', + type: 'uint256', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'contract IStrategy', + name: 'strategy', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + indexed: false, + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + ], + name: 'PoolCreated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'poolId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'fee', + type: 'uint256', + }, + ], + name: 'PoolFunded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'poolId', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + indexed: false, + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + ], + name: 'PoolMetadataUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'registry', + type: 'address', + }, + ], + name: 'RegistryUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'previousAdminRole', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'newAdminRole', + type: 'bytes32', + }, + ], + name: 'RoleAdminChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleGranted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleRevoked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'strategy', + type: 'address', + }, + ], + name: 'StrategyApproved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'strategy', + type: 'address', + }, + ], + name: 'StrategyRemoved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'treasury', + type: 'address', + }, + ], + name: 'TreasuryUpdated', + type: 'event', + }, + { + inputs: [], + name: 'DEFAULT_ADMIN_ROLE', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'FEE_DENOMINATOR', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NATIVE', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'address', + name: '_manager', + type: 'address', + }, + ], + name: 'addPoolManager', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + ], + name: 'addToCloneableStrategies', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_data', + type: 'bytes', + }, + ], + name: 'allocate', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256[]', + name: '_poolIds', + type: 'uint256[]', + }, + { + internalType: 'bytes[]', + name: '_datas', + type: 'bytes[]', + }, + ], + name: 'batchAllocate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256[]', + name: '_poolIds', + type: 'uint256[]', + }, + { + internalType: 'bytes[]', + name: '_data', + type: 'bytes[]', + }, + ], + name: 'batchRegisterRecipient', + outputs: [ + { + internalType: 'address[]', + name: '', + type: 'address[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'cancelOwnershipHandover', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pendingOwner', + type: 'address', + }, + ], + name: 'completeOwnershipHandover', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + { + internalType: 'bytes', + name: '_initStrategyData', + type: 'bytes', + }, + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: '_metadata', + type: 'tuple', + }, + { + internalType: 'address[]', + name: '_managers', + type: 'address[]', + }, + ], + name: 'createPool', + outputs: [ + { + internalType: 'uint256', + name: 'poolId', + type: 'uint256', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + { + internalType: 'bytes', + name: '_initStrategyData', + type: 'bytes', + }, + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: '_metadata', + type: 'tuple', + }, + { + internalType: 'address[]', + name: '_managers', + type: 'address[]', + }, + ], + name: 'createPoolWithCustomStrategy', + outputs: [ + { + internalType: 'uint256', + name: 'poolId', + type: 'uint256', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'address[]', + name: '_recipientIds', + type: 'address[]', + }, + { + internalType: 'bytes', + name: '_data', + type: 'bytes', + }, + ], + name: 'distribute', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'fundPool', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'getBaseFee', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getFeePercentage', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + ], + name: 'getPool', + outputs: [ + { + components: [ + { + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + { + internalType: 'contract IStrategy', + name: 'strategy', + type: 'address', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + { + internalType: 'bytes32', + name: 'managerRole', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'adminRole', + type: 'bytes32', + }, + ], + internalType: 'struct IAllo.Pool', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getRegistry', + outputs: [ + { + internalType: 'contract IRegistry', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + ], + name: 'getRoleAdmin', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + ], + name: 'getStrategy', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getTreasury', + outputs: [ + { + internalType: 'address payable', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'grantRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'hasRole', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_registry', + type: 'address', + }, + { + internalType: 'address payable', + name: '_treasury', + type: 'address', + }, + { + internalType: 'uint256', + name: '_feePercentage', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_baseFee', + type: 'uint256', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + ], + name: 'isCloneableStrategy', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'address', + name: '_address', + type: 'address', + }, + ], + name: 'isPoolAdmin', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'address', + name: '_address', + type: 'address', + }, + ], + name: 'isPoolManager', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: 'result', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pendingOwner', + type: 'address', + }, + ], + name: 'ownershipHandoverExpiresAt', + outputs: [ + { + internalType: 'uint256', + name: 'result', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'address', + name: '_recipient', + type: 'address', + }, + ], + name: 'recoverFunds', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_data', + type: 'bytes', + }, + ], + name: 'registerRecipient', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + ], + name: 'removeFromCloneableStrategies', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + internalType: 'address', + name: '_manager', + type: 'address', + }, + ], + name: 'removePoolManager', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'renounceRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'requestOwnershipHandover', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'revokeRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes4', + name: 'interfaceId', + type: 'bytes4', + }, + ], + name: 'supportsInterface', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_baseFee', + type: 'uint256', + }, + ], + name: 'updateBaseFee', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_feePercentage', + type: 'uint256', + }, + ], + name: 'updateFeePercentage', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_poolId', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: '_metadata', + type: 'tuple', + }, + ], + name: 'updatePoolMetadata', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_registry', + type: 'address', + }, + ], + name: 'updateRegistry', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address payable', + name: '_treasury', + type: 'address', + }, + ], + name: 'updateTreasury', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const diff --git a/integrations/allo/abis/index.ts b/integrations/allo/abis/index.ts new file mode 100644 index 00000000..25f18526 --- /dev/null +++ b/integrations/allo/abis/index.ts @@ -0,0 +1,2 @@ +export { alloABI } from './allo-abi' +export { registryABI } from './registry-abi' diff --git a/integrations/allo/abis/registry-abi.ts b/integrations/allo/abis/registry-abi.ts new file mode 100644 index 00000000..eb2a8b01 --- /dev/null +++ b/integrations/allo/abis/registry-abi.ts @@ -0,0 +1,903 @@ +/** + * Registry ABI. + * source code: https://github.com/allo-protocol/allo-v2/blob/main/contracts/core/Registry.sol + */ +export const registryABI = [ + { + inputs: [ + { + internalType: 'address', + name: '_owner', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [], + name: 'AMOUNT_MISMATCH', + type: 'error', + }, + { + inputs: [], + name: 'NONCE_NOT_AVAILABLE', + type: 'error', + }, + { + inputs: [], + name: 'NOT_PENDING_OWNER', + type: 'error', + }, + { + inputs: [], + name: 'UNAUTHORIZED', + type: 'error', + }, + { + inputs: [], + name: 'ZERO_ADDRESS', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + { + indexed: false, + internalType: 'string', + name: 'name', + type: 'string', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + indexed: false, + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + { + indexed: false, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'anchor', + type: 'address', + }, + ], + name: 'ProfileCreated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + indexed: false, + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + ], + name: 'ProfileMetadataUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'string', + name: 'name', + type: 'string', + }, + { + indexed: false, + internalType: 'address', + name: 'anchor', + type: 'address', + }, + ], + name: 'ProfileNameUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'ProfileOwnerUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'pendingOwner', + type: 'address', + }, + ], + name: 'ProfilePendingOwnerUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'previousAdminRole', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'newAdminRole', + type: 'bytes32', + }, + ], + name: 'RoleAdminChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleGranted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleRevoked', + type: 'event', + }, + { + inputs: [], + name: 'ALLO_OWNER', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'DEFAULT_ADMIN_ROLE', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NATIVE', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + ], + name: 'acceptProfileOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address[]', + name: '_members', + type: 'address[]', + }, + ], + name: 'addMembers', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'anchorToProfileId', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_nonce', + type: 'uint256', + }, + { + internalType: 'string', + name: '_name', + type: 'string', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: '_metadata', + type: 'tuple', + }, + { + internalType: 'address', + name: '_owner', + type: 'address', + }, + { + internalType: 'address[]', + name: '_members', + type: 'address[]', + }, + ], + name: 'createProfile', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_anchor', + type: 'address', + }, + ], + name: 'getProfileByAnchor', + outputs: [ + { + components: [ + { + internalType: 'bytes32', + name: 'id', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + { + internalType: 'string', + name: 'name', + type: 'string', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'anchor', + type: 'address', + }, + ], + internalType: 'struct IRegistry.Profile', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'profileId', + type: 'bytes32', + }, + ], + name: 'getProfileById', + outputs: [ + { + components: [ + { + internalType: 'bytes32', + name: 'id', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + { + internalType: 'string', + name: 'name', + type: 'string', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'anchor', + type: 'address', + }, + ], + internalType: 'struct IRegistry.Profile', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + ], + name: 'getRoleAdmin', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'grantRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'hasRole', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address', + name: '_member', + type: 'address', + }, + ], + name: 'isMemberOfProfile', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address', + name: '_owner', + type: 'address', + }, + ], + name: 'isOwnerOfProfile', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address', + name: '_account', + type: 'address', + }, + ], + name: 'isOwnerOrMemberOfProfile', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + name: 'profileIdToPendingOwner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + name: 'profilesById', + outputs: [ + { + internalType: 'bytes32', + name: 'id', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + { + internalType: 'string', + name: 'name', + type: 'string', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: 'metadata', + type: 'tuple', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'anchor', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'address', + name: '_recipient', + type: 'address', + }, + ], + name: 'recoverFunds', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address[]', + name: '_members', + type: 'address[]', + }, + ], + name: 'removeMembers', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'renounceRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'revokeRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes4', + name: 'interfaceId', + type: 'bytes4', + }, + ], + name: 'supportsInterface', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + components: [ + { + internalType: 'uint256', + name: 'protocol', + type: 'uint256', + }, + { + internalType: 'string', + name: 'pointer', + type: 'string', + }, + ], + internalType: 'struct Metadata', + name: '_metadata', + type: 'tuple', + }, + ], + name: 'updateProfileMetadata', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'string', + name: '_name', + type: 'string', + }, + ], + name: 'updateProfileName', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_profileId', + type: 'bytes32', + }, + { + internalType: 'address', + name: '_pendingOwner', + type: 'address', + }, + ], + name: 'updateProfilePendingOwner', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const diff --git a/integrations/allo/abis/starter-abi.ts b/integrations/allo/abis/starter-abi.ts deleted file mode 100644 index 437c803c..00000000 --- a/integrations/allo/abis/starter-abi.ts +++ /dev/null @@ -1,285 +0,0 @@ -/** - * Starter ABI placeholder based on ERC20. Replace with your own ABI. - */ -export const starterABI = [ - { - constant: true, - inputs: [], - name: 'name', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_spender', - type: 'address', - }, - { - name: '_value', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [ - { - name: 'success', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'totalSupply', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address', - }, - { - name: '_to', - type: 'address', - }, - { - name: '_value', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - name: 'success', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '', - type: 'address', - }, - ], - name: 'balances', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'decimals', - outputs: [ - { - name: '', - type: 'uint8', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '', - type: 'address', - }, - { - name: '', - type: 'address', - }, - ], - name: 'allowed', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_to', - type: 'address', - }, - { - name: '_value', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - name: 'success', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_spender', - type: 'address', - }, - ], - name: 'allowance', - outputs: [ - { - name: 'remaining', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - name: '_initialAmount', - type: 'uint256', - }, - { - name: '_tokenName', - type: 'string', - }, - { - name: '_decimalUnits', - type: 'uint8', - }, - { - name: '_tokenSymbol', - type: 'string', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_from', - type: 'address', - }, - { - indexed: true, - name: '_to', - type: 'address', - }, - { - indexed: false, - name: '_value', - type: 'uint256', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_owner', - type: 'address', - }, - { - indexed: true, - name: '_spender', - type: 'address', - }, - { - indexed: false, - name: '_value', - type: 'uint256', - }, - ], - name: 'Approval', - type: 'event', - }, -] as const diff --git a/integrations/allo/client/index.ts b/integrations/allo/client/index.ts deleted file mode 100644 index 56f42288..00000000 --- a/integrations/allo/client/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Placeholder client for starter. Replace with your own client. - */ -export const client = { - connect: async () => null, - disconnect: async () => null, -} diff --git a/integrations/allo/components/registry/index.ts b/integrations/allo/components/registry/index.ts new file mode 100644 index 00000000..0fb76258 --- /dev/null +++ b/integrations/allo/components/registry/index.ts @@ -0,0 +1,3 @@ +export { RegistryCreateProfile } from './registry-create-profile' +export { RegistryUpdateProfileName } from './registry-update-profile-name' +export { RegistryUpdateProfileMetadata } from './registry-update-profile-metadata' diff --git a/integrations/allo/components/registry/registry-create-profile.tsx b/integrations/allo/components/registry/registry-create-profile.tsx new file mode 100644 index 00000000..152e67f9 --- /dev/null +++ b/integrations/allo/components/registry/registry-create-profile.tsx @@ -0,0 +1,114 @@ +import { useMemo } from 'react' + +import { useForm } from 'react-hook-form' +import { useDebounce } from 'usehooks-ts' +import type { Address, BaseError } from 'viem' +import { encodePacked, keccak256 } from 'viem' +import { useAccount, useWaitForTransaction } from 'wagmi' + +import { ContractWriteButton } from '@/components/blockchain/contract-write-button' +import { TransactionStatus } from '@/components/blockchain/transaction-status' + +import { usePrepareRegistryCreateProfile, useRegistryCreateProfile } from '../../generated/allo-wagmi' +import { useNonce } from '../../hooks/use-nonce' +import { REGISTRY_ADDRESS } from '../../utils/constants' + +interface FormSchema { + name: string + protocol: string + pointer: string + members: string +} + +function parseAddresses(input: string | undefined): Address[] { + if (!input) return [] + // Split by comma, then map over the results and trim whitespace from each address + return input + .split(',') + .map((address) => address.trim() as Address) + .filter((address) => address.length > 0) +} + +export function RegistryCreateProfile() { + const { register, watch, handleSubmit, reset } = useForm({ + defaultValues: { + protocol: '1', + }, + }) + const { data: nonce } = useNonce() + const { address } = useAccount() + + const name = useDebounce(watch('name'), 500) + const protocol = useDebounce(watch('protocol'), 500) + const pointer = useDebounce(watch('pointer'), 500) + const members = useDebounce(watch('members'), 500) + + const profileId = useMemo( + () => (nonce && address ? keccak256(encodePacked(['uint256', 'address'], [BigInt(nonce), address])) : undefined), + [nonce, address] + ) + + const formattedMembers = useMemo(() => parseAddresses(members), [members]) + + const isValidInput = address && typeof nonce === 'number' && name && pointer && formattedMembers.length > 0 && Number(protocol) !== 0 + + const { config, error, isError } = usePrepareRegistryCreateProfile({ + address: REGISTRY_ADDRESS, + args: isValidInput + ? [ + BigInt(nonce), + name, + { + protocol: BigInt(Number(protocol)), + pointer, + }, + address, + formattedMembers, + ] + : undefined, + enabled: Boolean(isValidInput), + }) + + const { data, write, isLoading: isLoadingWrite } = useRegistryCreateProfile(config) + + const { isLoading: isLoadingTx, isSuccess } = useWaitForTransaction({ + hash: data?.hash, + onSuccess: () => { + reset() + }, + }) + + const onSubmit = () => { + write?.() + } + + return ( +
+
+ + + + + + + +