diff --git a/apps/example/.eslintrc.js b/apps/example/.eslintrc.js deleted file mode 100644 index 9df5b6be5..000000000 --- a/apps/example/.eslintrc.js +++ /dev/null @@ -1,13 +0,0 @@ -/** @type {import("eslint").Linter.Config} */ -module.exports = { - root: true, - extends: [ - "@ark-project/eslint-config/react-internal.js", - "next", - "next/core-web-vitals" - ], - parser: "@typescript-eslint/parser", - parserOptions: { - project: true - } -}; diff --git a/apps/example/CHANGELOG.md b/apps/example/CHANGELOG.md deleted file mode 100644 index 2bc612bca..000000000 --- a/apps/example/CHANGELOG.md +++ /dev/null @@ -1,146 +0,0 @@ -# example - -## 0.3.1 - -### Patch Changes - -- Updated dependencies [698bc6f] - - @ark-project/core@2.1.1 - - @ark-project/react@1.1.1 - -## 0.3.0 - -### Minor Changes - -- ca2d829: Added SDK React auction - -### Patch Changes - -- Updated dependencies [ca2d829] -- Updated dependencies [f0f672f] - - @ark-project/react@1.1.0 - - @ark-project/core@2.1.0 - -## 0.2.13 - -### Patch Changes - -- 36a7a4b: Update to support multiple network on the ark provider -- Updated dependencies [36a7a4b] - - @ark-project/react@1.0.3 - - @ark-project/core@2.0.2 - -## 0.2.12 - -### Patch Changes - -- Updated dependencies [e0306a2] - - @ark-project/core@2.0.1 - - @ark-project/react@1.0.2 - -## 0.2.11 - -### Patch Changes - -- Updated dependencies [87f1a94] - - @ark-project/react@1.0.1 - -## 0.2.10 - -### Patch Changes - -- 8b260b0: Using stricter types -- Updated dependencies [8b260b0] -- Updated dependencies [ca5fe10] -- Updated dependencies [7c82ab2] -- Updated dependencies [26f94ed] -- Updated dependencies [c001f31] - - @ark-project/react@1.0.0 - - @ark-project/core@2.0.0 - -## 0.2.9 - -### Patch Changes - -- Updated dependencies [9a718b3] - - @ark-project/core@1.1.4 - - @ark-project/react@0.6.4 - -## 0.2.8 - -### Patch Changes - -- Updated dependencies [d617ace] - - @ark-project/core@1.1.3 - - @ark-project/react@0.6.3 - -## 0.2.7 - -### Patch Changes - -- Updated dependencies [8440c35] -- Updated dependencies [7cdc78d] - - @ark-project/core@1.1.2 - - @ark-project/react@0.6.2 - -## 0.2.6 - -### Patch Changes - -- Updated dependencies [572c5f3] - - @ark-project/react@0.6.1 - -## 0.2.5 - -### Patch Changes - -- Updated dependencies [90fa414] - - @ark-project/react@0.6.0 - -## 0.2.4 - -### Patch Changes - -- Updated dependencies [5dcd498] - - @ark-project/react@0.5.0 - - @ark-project/core@1.1.1 - -## 0.2.3 - -### Patch Changes - -- Updated dependencies [32420dc] -- Updated dependencies [7482d04] -- Updated dependencies [32420dc] - - @ark-project/core@1.1.0 - - @ark-project/react@0.4.0 - -## 0.2.2 - -### Patch Changes - -- Updated dependencies [aad63d4] -- Updated dependencies [e573daa] - - @ark-project/core@1.0.0 - - @ark-project/react@0.3.1 - -## 0.2.1 - -### Patch Changes - -- Updated dependencies [d256f76] -- Updated dependencies [d256f76] - - @ark-project/react@0.3.0 - - @ark-project/core@0.3.0 - -## 0.2.0 - -### Minor Changes - -- db60f32: Update to align sdk with documentation & streamline params for hooks & base functions - -### Patch Changes - -- Updated dependencies [db60f32] - - @ark-project/react@0.2.0 - - @ark-project/core@0.2.0 diff --git a/apps/example/README.md b/apps/example/README.md deleted file mode 100644 index 4de24a3ab..000000000 --- a/apps/example/README.md +++ /dev/null @@ -1,36 +0,0 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-starknet`](https://github.com/apibara/starknet-react/tree/main/packages/create-starknet). - -## Getting Started - -First, run the development server: - -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/apps/example/components.json b/apps/example/components.json deleted file mode 100644 index bd2e230b3..000000000 --- a/apps/example/components.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema.json", - "style": "new-york", - "rsc": true, - "tsx": true, - "tailwind": { - "config": "tailwind.config.js", - "css": "app/globals.css", - "baseColor": "zinc", - "cssVariables": true - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils" - } -} \ No newline at end of file diff --git a/apps/example/next.config.js b/apps/example/next.config.js deleted file mode 100644 index 2aacd0fa1..000000000 --- a/apps/example/next.config.js +++ /dev/null @@ -1,14 +0,0 @@ -/** @type {import('next').NextConfig} */ - -const nextConfig = { - images: { - remotePatterns: [ - { - protocol: "https", - hostname: "**" - } - ] - } -}; - -module.exports = nextConfig; diff --git a/apps/example/package.json b/apps/example/package.json deleted file mode 100644 index b88a91b6e..000000000 --- a/apps/example/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@ark-project/demo", - "version": "0.3.1", - "private": true, - "scripts": { - "build": "next build", - "dev": "next dev", - "start": "next start", - "lint": "next lint", - "lint:fix": "next lint --fix", - "typecheck": "tsc --noEmit" - }, - "dependencies": { - "@ark-project/core": "workspace:*", - "@ark-project/react": "workspace:*", - "@hookform/resolvers": "^3.3.2", - "@radix-ui/react-avatar": "^1.0.4", - "@radix-ui/react-checkbox": "^1.0.4", - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-dropdown-menu": "^2.0.6", - "@radix-ui/react-icons": "^1.3.0", - "@radix-ui/react-label": "^2.0.2", - "@radix-ui/react-popover": "^1.0.7", - "@radix-ui/react-radio-group": "^1.1.3", - "@radix-ui/react-scroll-area": "^1.0.5", - "@radix-ui/react-select": "^2.0.0", - "@radix-ui/react-separator": "^1.0.3", - "@radix-ui/react-slot": "^1.0.2", - "@radix-ui/react-tabs": "^1.0.4", - "@radix-ui/react-toast": "^1.1.5", - "@radix-ui/react-tooltip": "^1.0.7", - "@starknet-react/chains": "^0.1.7", - "@starknet-react/core": "^2.8.1", - "@t3-oss/env-nextjs": "^0.8.0", - "@tanstack/react-table": "^8.11.7", - "class-variance-authority": "^0.7.0", - "clsx": "^2.1.0", - "cmdk": "^0.2.0", - "date-fns": "^3.3.1", - "get-starknet-core": "^3.3.0", - "moment": "^2.30.1", - "next": "14.0.2", - "next-themes": "^0.2.0", - "react": "^18", - "react-dom": "^18", - "react-hook-form": "^7.49.2", - "react-icons": "^5.0.1", - "react-query": "^3.39.3", - "react-resizable-panels": "^2.0.1", - "react-wrap-balancer": "^1.1.0", - "starknet": "^6.9.0", - "tailwind-merge": "^2.1.0", - "tailwindcss-animate": "^1.0.7", - "viem": "^2.12.1", - "zod": "^3.22.4" - }, - "devDependencies": { - "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", - "autoprefixer": "^10.0.1", - "eslint": "^8", - "eslint-config-next": "14.0.2", - "postcss": "^8", - "tailwindcss": "^3.4.1", - "typescript": "^5" - } -} diff --git a/apps/example/postcss.config.js b/apps/example/postcss.config.js deleted file mode 100644 index 12a703d90..000000000 --- a/apps/example/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; diff --git a/apps/example/public/01.png b/apps/example/public/01.png deleted file mode 100644 index 191df4742..000000000 Binary files a/apps/example/public/01.png and /dev/null differ diff --git a/apps/example/public/02.jpg b/apps/example/public/02.jpg deleted file mode 100644 index 567b25627..000000000 Binary files a/apps/example/public/02.jpg and /dev/null differ diff --git a/apps/example/public/03.png b/apps/example/public/03.png deleted file mode 100644 index 99686899a..000000000 Binary files a/apps/example/public/03.png and /dev/null differ diff --git a/apps/example/public/authentication-dark.png b/apps/example/public/authentication-dark.png deleted file mode 100644 index dbd1234fc..000000000 Binary files a/apps/example/public/authentication-dark.png and /dev/null differ diff --git a/apps/example/public/everai.jpg b/apps/example/public/everai.jpg deleted file mode 100644 index 68b9b742c..000000000 Binary files a/apps/example/public/everai.jpg and /dev/null differ diff --git a/apps/example/public/login.png b/apps/example/public/login.png deleted file mode 100644 index 597ee2c26..000000000 Binary files a/apps/example/public/login.png and /dev/null differ diff --git a/apps/example/public/missing.jpg b/apps/example/public/missing.jpg deleted file mode 100644 index 681e6f628..000000000 Binary files a/apps/example/public/missing.jpg and /dev/null differ diff --git a/apps/example/public/missing.png b/apps/example/public/missing.png deleted file mode 100644 index 5bc453dca..000000000 Binary files a/apps/example/public/missing.png and /dev/null differ diff --git a/apps/example/public/next.svg b/apps/example/public/next.svg deleted file mode 100644 index 5174b28c5..000000000 --- a/apps/example/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/example/public/vercel.svg b/apps/example/public/vercel.svg deleted file mode 100644 index d2f842227..000000000 --- a/apps/example/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/example/src/app/abi.ts b/apps/example/src/app/abi.ts deleted file mode 100644 index 394c24b9f..000000000 --- a/apps/example/src/app/abi.ts +++ /dev/null @@ -1,895 +0,0 @@ -export const abi = [ - { - name: "core::starknet::account::Call", - type: "struct", - members: [ - { - name: "to", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "selector", - type: "core::felt252" - }, - { - name: "calldata", - type: "core::array::Array::" - } - ] - }, - { - name: "__validate__", - type: "function", - inputs: [ - { - name: "calls", - type: "core::array::Array::" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "external" - }, - { - name: "core::array::Span::", - type: "struct", - members: [ - { - name: "snapshot", - type: "@core::array::Array::" - } - ] - }, - { - name: "__execute__", - type: "function", - inputs: [ - { - name: "calls", - type: "core::array::Array::" - } - ], - outputs: [ - { - type: "core::array::Array::>" - } - ], - state_mutability: "external" - }, - { - name: "is_valid_signature", - type: "function", - inputs: [ - { - name: "hash", - type: "core::felt252" - }, - { - name: "signature", - type: "core::array::Array::" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "ExecuteFromOutsideImpl", - type: "impl", - interface_name: "lib::outside_execution::IOutsideExecution" - }, - { - name: "lib::outside_execution::OutsideExecution", - type: "struct", - members: [ - { - name: "caller", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "nonce", - type: "core::felt252" - }, - { - name: "execute_after", - type: "core::integer::u64" - }, - { - name: "execute_before", - type: "core::integer::u64" - }, - { - name: "calls", - type: "core::array::Span::" - } - ] - }, - { - name: "core::bool", - type: "enum", - variants: [ - { - name: "False", - type: "()" - }, - { - name: "True", - type: "()" - } - ] - }, - { - name: "lib::outside_execution::IOutsideExecution", - type: "interface", - items: [ - { - name: "execute_from_outside", - type: "function", - inputs: [ - { - name: "outside_execution", - type: "lib::outside_execution::OutsideExecution" - }, - { - name: "signature", - type: "core::array::Array::" - } - ], - outputs: [ - { - type: "core::array::Array::>" - } - ], - state_mutability: "external" - }, - { - name: "is_valid_outside_execution_nonce", - type: "function", - inputs: [ - { - name: "nonce", - type: "core::felt252" - } - ], - outputs: [ - { - type: "core::bool" - } - ], - state_mutability: "view" - }, - { - name: "get_outside_execution_message_hash", - type: "function", - inputs: [ - { - name: "outside_execution", - type: "lib::outside_execution::OutsideExecution" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "UpgradeableImpl", - type: "impl", - interface_name: "lib::upgrade::IUpgradeable" - }, - { - name: "lib::upgrade::IUpgradeable", - type: "interface", - items: [ - { - name: "upgrade", - type: "function", - inputs: [ - { - name: "new_implementation", - type: "core::starknet::class_hash::ClassHash" - }, - { - name: "calldata", - type: "core::array::Array::" - } - ], - outputs: [ - { - type: "core::array::Array::" - } - ], - state_mutability: "external" - }, - { - name: "execute_after_upgrade", - type: "function", - inputs: [ - { - name: "data", - type: "core::array::Array::" - } - ], - outputs: [ - { - type: "core::array::Array::" - } - ], - state_mutability: "external" - } - ] - }, - { - name: "ArgentAccountImpl", - type: "impl", - interface_name: "account::interface::IArgentAccount" - }, - { - name: "account::escape::Escape", - type: "struct", - members: [ - { - name: "ready_at", - type: "core::integer::u64" - }, - { - name: "escape_type", - type: "core::felt252" - }, - { - name: "new_signer", - type: "core::felt252" - } - ] - }, - { - name: "lib::version::Version", - type: "struct", - members: [ - { - name: "major", - type: "core::integer::u8" - }, - { - name: "minor", - type: "core::integer::u8" - }, - { - name: "patch", - type: "core::integer::u8" - } - ] - }, - { - name: "account::escape::EscapeStatus", - type: "enum", - variants: [ - { - name: "None", - type: "()" - }, - { - name: "NotReady", - type: "()" - }, - { - name: "Ready", - type: "()" - }, - { - name: "Expired", - type: "()" - } - ] - }, - { - name: "account::interface::IArgentAccount", - type: "interface", - items: [ - { - name: "__validate_declare__", - type: "function", - inputs: [ - { - name: "class_hash", - type: "core::felt252" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "__validate_deploy__", - type: "function", - inputs: [ - { - name: "class_hash", - type: "core::felt252" - }, - { - name: "contract_address_salt", - type: "core::felt252" - }, - { - name: "owner", - type: "core::felt252" - }, - { - name: "guardian", - type: "core::felt252" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "change_owner", - type: "function", - inputs: [ - { - name: "new_owner", - type: "core::felt252" - }, - { - name: "signature_r", - type: "core::felt252" - }, - { - name: "signature_s", - type: "core::felt252" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "change_guardian", - type: "function", - inputs: [ - { - name: "new_guardian", - type: "core::felt252" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "change_guardian_backup", - type: "function", - inputs: [ - { - name: "new_guardian_backup", - type: "core::felt252" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "trigger_escape_owner", - type: "function", - inputs: [ - { - name: "new_owner", - type: "core::felt252" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "trigger_escape_guardian", - type: "function", - inputs: [ - { - name: "new_guardian", - type: "core::felt252" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "escape_owner", - type: "function", - inputs: [], - outputs: [], - state_mutability: "external" - }, - { - name: "escape_guardian", - type: "function", - inputs: [], - outputs: [], - state_mutability: "external" - }, - { - name: "cancel_escape", - type: "function", - inputs: [], - outputs: [], - state_mutability: "external" - }, - { - name: "get_owner", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "get_guardian", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "get_guardian_backup", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "get_escape", - type: "function", - inputs: [], - outputs: [ - { - type: "account::escape::Escape" - } - ], - state_mutability: "view" - }, - { - name: "get_version", - type: "function", - inputs: [], - outputs: [ - { - type: "lib::version::Version" - } - ], - state_mutability: "view" - }, - { - name: "get_name", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "get_guardian_escape_attempts", - type: "function", - inputs: [], - outputs: [ - { - type: "core::integer::u32" - } - ], - state_mutability: "view" - }, - { - name: "get_owner_escape_attempts", - type: "function", - inputs: [], - outputs: [ - { - type: "core::integer::u32" - } - ], - state_mutability: "view" - }, - { - name: "get_escape_and_status", - type: "function", - inputs: [], - outputs: [ - { - type: "(account::escape::Escape, account::escape::EscapeStatus)" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "Erc165Impl", - type: "impl", - interface_name: "lib::erc165::IErc165" - }, - { - name: "lib::erc165::IErc165", - type: "interface", - items: [ - { - name: "supports_interface", - type: "function", - inputs: [ - { - name: "interface_id", - type: "core::felt252" - } - ], - outputs: [ - { - type: "core::bool" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "OldArgentAccountImpl", - type: "impl", - interface_name: "account::interface::IDeprecatedArgentAccount" - }, - { - name: "account::interface::IDeprecatedArgentAccount", - type: "interface", - items: [ - { - name: "getVersion", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "getName", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "supportsInterface", - type: "function", - inputs: [ - { - name: "interface_id", - type: "core::felt252" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "isValidSignature", - type: "function", - inputs: [ - { - name: "hash", - type: "core::felt252" - }, - { - name: "signatures", - type: "core::array::Array::" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "constructor", - type: "constructor", - inputs: [ - { - name: "owner", - type: "core::felt252" - }, - { - name: "guardian", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::AccountCreated", - type: "event", - members: [ - { - kind: "key", - name: "owner", - type: "core::felt252" - }, - { - kind: "data", - name: "guardian", - type: "core::felt252" - } - ] - }, - { - name: "core::array::Span::>", - type: "struct", - members: [ - { - name: "snapshot", - type: "@core::array::Array::>" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::TransactionExecuted", - type: "event", - members: [ - { - kind: "key", - name: "hash", - type: "core::felt252" - }, - { - kind: "data", - name: "response", - type: "core::array::Span::>" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::EscapeOwnerTriggered", - type: "event", - members: [ - { - kind: "data", - name: "ready_at", - type: "core::integer::u64" - }, - { - kind: "data", - name: "new_owner", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::EscapeGuardianTriggered", - type: "event", - members: [ - { - kind: "data", - name: "ready_at", - type: "core::integer::u64" - }, - { - kind: "data", - name: "new_guardian", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::OwnerEscaped", - type: "event", - members: [ - { - kind: "data", - name: "new_owner", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::GuardianEscaped", - type: "event", - members: [ - { - kind: "data", - name: "new_guardian", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::EscapeCanceled", - type: "event", - members: [] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::OwnerChanged", - type: "event", - members: [ - { - kind: "data", - name: "new_owner", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::GuardianChanged", - type: "event", - members: [ - { - kind: "data", - name: "new_guardian", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::GuardianBackupChanged", - type: "event", - members: [ - { - kind: "data", - name: "new_guardian_backup", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::AccountUpgraded", - type: "event", - members: [ - { - kind: "data", - name: "new_implementation", - type: "core::starknet::class_hash::ClassHash" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::OwnerAdded", - type: "event", - members: [ - { - kind: "key", - name: "new_owner_guid", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "account::argent_account::ArgentAccount::OwnerRemoved", - type: "event", - members: [ - { - kind: "key", - name: "removed_owner_guid", - type: "core::felt252" - } - ] - }, - { - kind: "enum", - name: "account::argent_account::ArgentAccount::Event", - type: "event", - variants: [ - { - kind: "nested", - name: "AccountCreated", - type: "account::argent_account::ArgentAccount::AccountCreated" - }, - { - kind: "nested", - name: "TransactionExecuted", - type: "account::argent_account::ArgentAccount::TransactionExecuted" - }, - { - kind: "nested", - name: "EscapeOwnerTriggered", - type: "account::argent_account::ArgentAccount::EscapeOwnerTriggered" - }, - { - kind: "nested", - name: "EscapeGuardianTriggered", - type: "account::argent_account::ArgentAccount::EscapeGuardianTriggered" - }, - { - kind: "nested", - name: "OwnerEscaped", - type: "account::argent_account::ArgentAccount::OwnerEscaped" - }, - { - kind: "nested", - name: "GuardianEscaped", - type: "account::argent_account::ArgentAccount::GuardianEscaped" - }, - { - kind: "nested", - name: "EscapeCanceled", - type: "account::argent_account::ArgentAccount::EscapeCanceled" - }, - { - kind: "nested", - name: "OwnerChanged", - type: "account::argent_account::ArgentAccount::OwnerChanged" - }, - { - kind: "nested", - name: "GuardianChanged", - type: "account::argent_account::ArgentAccount::GuardianChanged" - }, - { - kind: "nested", - name: "GuardianBackupChanged", - type: "account::argent_account::ArgentAccount::GuardianBackupChanged" - }, - { - kind: "nested", - name: "AccountUpgraded", - type: "account::argent_account::ArgentAccount::AccountUpgraded" - }, - { - kind: "nested", - name: "OwnerAdded", - type: "account::argent_account::ArgentAccount::OwnerAdded" - }, - { - kind: "nested", - name: "OwnerRemoved", - type: "account::argent_account::ArgentAccount::OwnerRemoved" - } - ] - } -]; diff --git a/apps/example/src/app/examples/components/Account.tsx b/apps/example/src/app/examples/components/Account.tsx deleted file mode 100644 index deb3fbbc4..000000000 --- a/apps/example/src/app/examples/components/Account.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { useAccount } from "@starknet-react/core"; - -const Account = () => { - const { address, status } = useAccount(); - - if (status === "disconnected") return

Disconnected

; - - return ( -
-

Account: {address}

-
- ); -}; - -export default Account; diff --git a/apps/example/src/app/examples/components/Cancel.tsx b/apps/example/src/app/examples/components/Cancel.tsx deleted file mode 100644 index c956ce927..000000000 --- a/apps/example/src/app/examples/components/Cancel.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import * as z from "zod"; - -import { useCancel } from "@ark-project/react"; - -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -export default function Cancel() { - const { account } = useAccount(); - const { cancel, status } = useCancel(); - - const formSchema = z.object({ - orderHash: z.string(), - tokenAddress: z - .string() - .startsWith("0x", { message: "Please enter a valid address" }) - .length(66, { message: "Please enter a valid address" }), - tokenId: z.string().regex(/^\d+$/, { message: "Token ID must be a number" }) - }); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - orderHash: undefined, - tokenAddress: - "0x01435498bf393da86b4733b9264a86b58a42b31f8d8b8ba309593e5c17847672", - tokenId: "12" - } - }); - - if (account === undefined) return; - - function onSubmit(values: z.infer) { - if (account === undefined) return; - const processedValues = { - ...values, - orderHash: BigInt(values.orderHash), - tokenId: BigInt(values.tokenId) - }; - cancel({ - starknetAccount: account, - ...processedValues - }); - } - - return ( - <> -
- - ( - - Order Hash - - - - - - )} - /> - ( - - Token Address - - - - - - )} - /> - ( - - Token Id - - - - - - )} - /> - - - -
status: {status?.toString()}
- - ); -} diff --git a/apps/example/src/app/examples/components/ConnectWallet.tsx b/apps/example/src/app/examples/components/ConnectWallet.tsx deleted file mode 100644 index df70e4b29..000000000 --- a/apps/example/src/app/examples/components/ConnectWallet.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { useConnect } from "@starknet-react/core"; - -import { Button } from "@/components/ui/Button"; - -export default function ConnectWallet() { - const { connectors, connect } = useConnect(); - - return ( -
- {connectors.map((connector) => { - return ( - - ); - })} -
- ); -} diff --git a/apps/example/src/app/examples/components/CreateAuction.tsx b/apps/example/src/app/examples/components/CreateAuction.tsx deleted file mode 100644 index a1003d037..000000000 --- a/apps/example/src/app/examples/components/CreateAuction.tsx +++ /dev/null @@ -1,178 +0,0 @@ -"use client"; - -import React, { useEffect } from "react"; - -import { env } from "@/env"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import { parseEther } from "viem"; -import * as z from "zod"; - -import { useCreateAuction } from "@ark-project/react"; - -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -import ConnectWallet from "./ConnectWallet"; - -interface Token { - token_id?: string; - contract_address?: string; -} - -interface OrderBookActionsProps { - currentToken?: Token; -} - -const formSchema = z.object({ - brokerId: z.string(), - tokenAddress: z - .string() - .startsWith("0x", { message: "Please enter a valid address" }) - .length(66, { message: "Please enter a valid address" }), - tokenId: z.string().regex(/^\d+$/, { message: "Token ID must be a number" }), - startAmount: z.string(), - endAmount: z.string() -}); - -const CreateAuction: React.FC = ({ currentToken }) => { - const { account } = useAccount(); - const { create, response, status } = useCreateAuction(); - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: currentToken?.contract_address, - tokenId: currentToken?.token_id, - startAmount: "0.01", - endAmount: "0.05" - } - }); - - useEffect(() => { - if (!currentToken) { - return; - } - - form.reset({ - ...form.getValues(), - tokenAddress: currentToken.contract_address, - tokenId: currentToken.token_id - }); - }, [currentToken, form]); - - async function onSubmit(values: z.infer) { - if (!account) { - return; - } - - await create({ - starknetAccount: account, - ...values, - tokenId: BigInt(values.tokenId), - startAmount: parseEther(values.startAmount), - endAmount: parseEther(values.endAmount) - }); - } - - if (!account) { - return ; - } - - return ( - <> -
- - ( - - Broker Id - - - - - - )} - /> - ( - - Token Address - - - - - - )} - /> - ( - - Token Id - - - - - - )} - /> - ( - - Start Amount - - - - - - )} - /> - ( - - End Amount - - - - - - )} - /> - - - -
response: {response?.toString()}
- - ); -}; - -export default CreateAuction; diff --git a/apps/example/src/app/examples/components/CreateListing.tsx b/apps/example/src/app/examples/components/CreateListing.tsx deleted file mode 100644 index 29505ae3b..000000000 --- a/apps/example/src/app/examples/components/CreateListing.tsx +++ /dev/null @@ -1,159 +0,0 @@ -"use client"; - -import React, { useEffect } from "react"; - -import { env } from "@/env"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import { parseEther } from "viem"; -import * as z from "zod"; - -import { useCreateListing } from "@ark-project/react"; - -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -interface Token { - token_id?: string; - contract_address?: string; -} - -interface OrderBookActionsProps { - currentToken?: Token; -} - -const CreateListing: React.FC = ({ currentToken }) => { - const { account } = useAccount(); - const { response, createListing, status } = useCreateListing(); - - const formSchema = z.object({ - brokerId: z.string(), - tokenAddress: z - .string() - .startsWith("0x", { message: "Please enter a valid address" }) - .length(66, { message: "Please enter a valid address" }), - tokenId: z - .string() - .regex(/^\d+$/, { message: "Token ID must be a number" }), - startAmount: z.string() - }); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: currentToken?.contract_address, - tokenId: currentToken?.token_id, - startAmount: "0.1" - } - }); - - useEffect(() => { - if (currentToken) { - form.reset({ - ...form.getValues(), - tokenAddress: currentToken.contract_address, - tokenId: currentToken.token_id - }); - } - }, [currentToken, form]); - - if (account === undefined) return; - - function onSubmit(values: z.infer) { - if (account === undefined) return; - const processedValues = { - ...values, - tokenId: BigInt(values.tokenId), - startAmount: parseEther("0.1") - }; - createListing({ - starknetAccount: account, - ...processedValues - }); - } - - return ( - <> -
- - ( - - Broker Id - - - - - - )} - /> - ( - - Token Address - - - - - - )} - /> - ( - - Token Id - - - - - - )} - /> - ( - - Start Amount - - - - - - )} - /> - - - -
response: {response?.toString()}
- - ); -}; - -export default CreateListing; diff --git a/apps/example/src/app/examples/components/CreateOffer.tsx b/apps/example/src/app/examples/components/CreateOffer.tsx deleted file mode 100644 index cc72e714c..000000000 --- a/apps/example/src/app/examples/components/CreateOffer.tsx +++ /dev/null @@ -1,166 +0,0 @@ -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import { parseEther } from "viem"; -import * as z from "zod"; - -import { useCreateOffer } from "@ark-project/react"; - -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -export default function CreateOffer() { - const { account } = useAccount(); - const { response, createOffer, status } = useCreateOffer(); - - const formSchema = z.object({ - brokerId: z.string(), - currencyAddress: z.string(), - tokenAddress: z - .string() - .startsWith("0x", { message: "Please enter a valid address" }) - .length(66, { message: "Please enter a valid address" }), - tokenId: z - .string() - .regex(/^\d+$/, { message: "Token ID must be a number" }), - startAmount: z.string() - }); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - brokerId: "123", - tokenAddress: - "0x01435498bf393da86b4733b9264a86b58a42b31f8d8b8ba309593e5c17847672", - tokenId: "12", - startAmount: "0.1" - } - }); - - if (account === undefined) return; - - function onSubmit(values: z.infer) { - if (account === undefined) return; - const processedValues = { - ...values, - tokenId: BigInt(values.tokenId), - startAmount: parseEther(values.startAmount) - }; - createOffer({ - starknetAccount: account, - ...processedValues - }); - } - - return ( - <> -
- - ( - - Broker Id - - - - - A referral ID to collect fees from trades initiated through - this referral. - - - - )} - /> - ( - - Token Address - - - - - Token Address of the token user want to buy - - - - )} - /> - ( - - Token Id - - - - - token id of the token user want to buy - - - - )} - /> - ( - - Start Amount - - - - - value send to the function should be in wei - - - - )} - /> - ( - - Currency address - - - - - default: - 0x04d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f - - - - )} - /> - - - -
response: {response?.toString()}
- - ); -} diff --git a/apps/example/src/app/examples/components/FulfillAuction.tsx b/apps/example/src/app/examples/components/FulfillAuction.tsx deleted file mode 100644 index 8f4aeacfa..000000000 --- a/apps/example/src/app/examples/components/FulfillAuction.tsx +++ /dev/null @@ -1,165 +0,0 @@ -import { env } from "@/env"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import * as z from "zod"; - -import { useFulfillAuction } from "@ark-project/react"; - -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -import ConnectWallet from "./ConnectWallet"; - -const formSchema = z.object({ - orderHash: z.string(), - relatedOrderHash: z.string(), - startAmount: z.string(), - brokerId: z.string(), - tokenAddress: z - .string() - .startsWith("0x", { message: "Please enter a valid address" }) - .length(66, { message: "Please enter a valid address" }), - tokenId: z.string().regex(/^\d+$/, { message: "Token ID must be a number" }) -}); - -export default function FulfillAuction() { - const { account } = useAccount(); - const { fulfill, status } = useFulfillAuction(); - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - startAmount: "0.042", - orderHash: undefined, - relatedOrderHash: undefined, - tokenAddress: - "0x01435498bf393da86b4733b9264a86b58a42b31f8d8b8ba309593e5c17847672", - tokenId: "12", - brokerId: env.NEXT_PUBLIC_BROKER_ID - } - }); - - function onSubmit(values: z.infer) { - if (!account) { - return; - } - - const processedValues = { - ...values, - tokenId: parseInt(values.tokenId, 10) - }; - - fulfill({ - starknetAccount: account, - ...processedValues - }); - } - - if (!account) { - if (!account) { - return ; - } - } - - return ( -
- - ( - - Order Hash - - - - - - )} - /> - ( - - Related Order Hash - - - - - - )} - /> - ( - - Broker Id - - - - - - )} - /> - ( - - Token Address - - - - - - )} - /> - ( - - Token Id - - - - - - )} - /> - ( - - Start amount - - - - - - )} - /> - - - - ); -} diff --git a/apps/example/src/app/examples/components/FulfillListing.tsx b/apps/example/src/app/examples/components/FulfillListing.tsx deleted file mode 100644 index 715955e1c..000000000 --- a/apps/example/src/app/examples/components/FulfillListing.tsx +++ /dev/null @@ -1,144 +0,0 @@ -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import * as z from "zod"; - -import { useFulfillListing } from "@ark-project/react"; - -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -export default function FulfillListing() { - const { account } = useAccount(); - const { fulfillListing, status } = useFulfillListing(); - - const formSchema = z.object({ - orderHash: z.string(), - startAmount: z.string(), - brokerId: z.number(), - tokenAddress: z - .string() - .startsWith("0x", { message: "Please enter a valid address" }) - .length(66, { message: "Please enter a valid address" }), - tokenId: z.string().regex(/^\d+$/, { message: "Token ID must be a number" }) - }); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - startAmount: "0.1", - orderHash: undefined, - tokenAddress: - "0x01435498bf393da86b4733b9264a86b58a42b31f8d8b8ba309593e5c17847672", - tokenId: "12", - brokerId: 123 - } - }); - - if (account === undefined) return; - - function onSubmit(values: z.infer) { - if (account === undefined) return; - const processedValues = { - ...values, - tokenId: parseInt(values.tokenId, 10) - }; - fulfillListing({ - starknetAccount: account, - ...processedValues - }); - } - - return ( - <> -
- - ( - - Order Hash - - - - - - )} - /> - ( - - Token Address - - - - - - )} - /> - ( - - Token Id - - - - - - )} - /> - ( - - Broker Id - - - - - - )} - /> - ( - - Start amount - - - - - - )} - /> - - - - - ); -} diff --git a/apps/example/src/app/examples/components/FulfillOffer.tsx b/apps/example/src/app/examples/components/FulfillOffer.tsx deleted file mode 100644 index 295c699d5..000000000 --- a/apps/example/src/app/examples/components/FulfillOffer.tsx +++ /dev/null @@ -1,131 +0,0 @@ -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import * as z from "zod"; - -import { useFulfillOffer } from "@ark-project/react"; - -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -export default function FulfillOffer() { - const { account } = useAccount(); - const { fulfillOffer, status } = useFulfillOffer(); - - const formSchema = z.object({ - orderHash: z.string(), - tokenAddress: z - .string() - .startsWith("0x", { message: "Please enter a valid address" }) - .length(66, { message: "Please enter a valid address" }), - tokenId: z - .string() - .regex(/^\d+$/, { message: "Token ID must be a number" }), - brokerId: z.number() - }); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - orderHash: undefined, - tokenAddress: - "0x01435498bf393da86b4733b9264a86b58a42b31f8d8b8ba309593e5c17847672", - tokenId: "12", - brokerId: 123 - } - }); - - if (account === undefined) return; - - function onSubmit(values: z.infer) { - if (account === undefined) return; - const processedValues = { - ...values, - token_id: parseInt(values.tokenId, 10) - }; - fulfillOffer({ - starknetAccount: account, - ...processedValues - }); - } - - return ( - <> -
- - ( - - Order Hash - - - - - - )} - /> - ( - - Token Address - - - - - - )} - /> - ( - - Token Id - - - - - - )} - /> - ( - - Broker Id - - - - - - )} - /> - - - - - ); -} diff --git a/apps/example/src/app/examples/components/SdkExamples.tsx b/apps/example/src/app/examples/components/SdkExamples.tsx deleted file mode 100644 index d70dc6ac0..000000000 --- a/apps/example/src/app/examples/components/SdkExamples.tsx +++ /dev/null @@ -1,92 +0,0 @@ -import React from "react"; - -import Tab from "@/components/ui/tab-card"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; - -import Cancel from "./Cancel"; -import CreateAuction from "./CreateAuction"; -import CreateListing from "./CreateListing"; -import CreateOffer from "./CreateOffer"; -import FulfillAuction from "./FulfillAuction"; -import FulfillListing from "./FulfillListing"; -import FulfillOffer from "./FulfillOffer"; - -const SdkExamples = () => { - return ( -
- - - useCreateListing - useCreateAuction - useCreateOffer - - - - - - - - - - - - - - - - - - - - useCancel - useFulfillListing - useFulfillAuction - useFulfillOffer - - - - - - - - - - - - - - - - - - - - - - -
- ); -}; - -export default SdkExamples; diff --git a/apps/example/src/app/examples/page.tsx b/apps/example/src/app/examples/page.tsx deleted file mode 100644 index 99080274c..000000000 --- a/apps/example/src/app/examples/page.tsx +++ /dev/null @@ -1,53 +0,0 @@ -"use client"; - -import Link from "next/link"; - -import { cn } from "@/lib/utils"; -import { Announcement } from "@/components/announcement"; -import { - PageActions, - PageHeader, - PageHeaderDescription, - PageHeaderHeading -} from "@/components/page-header"; -import { buttonVariants } from "@/components/ui/Button"; - -import SdkExamples from "./components/SdkExamples"; - -export default function Home() { - return ( - <> - - - - Ark Project: SDK hooks Examples - - Examples - - { - "Here, you'll find comprehensive examples for creating listing and offer orders, canceling orders, and fulfilling transactions. These forms are designed to demonstrate both mandatory and optional data required to effectively utilize our React SDK hooks for all these actions." - } - - - - Documentation - - - SDK Examples - - - - - - ); -} diff --git a/apps/example/src/app/favicon.ico b/apps/example/src/app/favicon.ico deleted file mode 100644 index 718d6fea4..000000000 Binary files a/apps/example/src/app/favicon.ico and /dev/null differ diff --git a/apps/example/src/app/globals.css b/apps/example/src/app/globals.css deleted file mode 100644 index 400478606..000000000 --- a/apps/example/src/app/globals.css +++ /dev/null @@ -1,59 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@layer base { - :root { - --background: 0 0% 100%; - --foreground: 240 10% 3.9%; - --card: 0 0% 100%; - --card-foreground: 240 10% 3.9%; - --popover: 0 0% 100%; - --popover-foreground: 240 10% 3.9%; - --primary: 240 5.9% 10%; - --primary-foreground: 0 0% 98%; - --secondary: 240 4.8% 95.9%; - --secondary-foreground: 240 5.9% 10%; - --muted: 240 4.8% 95.9%; - --muted-foreground: 240 3.8% 46.1%; - --accent: 240 4.8% 95.9%; - --accent-foreground: 240 5.9% 10%; - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 0 0% 98%; - --border: 240 5.9% 90%; - --input: 240 5.9% 90%; - --ring: 240 5.9% 10%; - --radius: 0.5rem; - } - - .dark { - --background: 240 10% 3.9%; - --foreground: 0 0% 98%; - --card: 240 10% 3.9%; - --card-foreground: 0 0% 98%; - --popover: 240 10% 3.9%; - --popover-foreground: 0 0% 98%; - --primary: 0 0% 98%; - --primary-foreground: 240 5.9% 10%; - --secondary: 240 3.7% 15.9%; - --secondary-foreground: 0 0% 98%; - --muted: 240 3.7% 15.9%; - --muted-foreground: 240 5% 64.9%; - --accent: 240 3.7% 15.9%; - --accent-foreground: 0 0% 98%; - --destructive: 0 62.8% 30.6%; - --destructive-foreground: 0 0% 98%; - --border: 240 3.7% 15.9%; - --input: 240 3.7% 15.9%; - --ring: 240 4.9% 83.9%; - } -} - -@layer base { - * { - @apply border-border; - } - body { - @apply bg-background text-foreground; - } -} diff --git a/apps/example/src/app/layout.tsx b/apps/example/src/app/layout.tsx deleted file mode 100644 index 2baa8a543..000000000 --- a/apps/example/src/app/layout.tsx +++ /dev/null @@ -1,73 +0,0 @@ -"use client"; - -import React from "react"; - -import { Inter as FontSans } from "next/font/google"; - -import { networks } from "@ark-project/core"; -import { ArkProvider } from "@ark-project/react"; - -import { MainNav } from "@/components/main-nav"; -import { ModeToggle } from "@/components/mode-toggle"; -import { StarknetProvider } from "@/components/starknet-provider"; -import { ThemeProvider } from "@/components/theme-provider"; -import { UserNav } from "@/components/user-nav"; - -import "./globals.css"; - -import { cn } from "@/lib/utils"; - -export const fontSans = FontSans({ - subsets: ["latin"], - variable: "--font-sans" -}); - -export default function RootLayout({ - children -}: { - children: React.ReactNode; -}) { - const config = { - starknetNetwork: networks.mainnet, - arkchainNetwork: networks.mainnet - }; - - return ( - - - - - -
-
-
-
- -
- - -
-
-
-
-
- {children} -
-
-
-
-
- - - ); -} diff --git a/apps/example/src/app/marketplace/activity/page.tsx b/apps/example/src/app/marketplace/activity/page.tsx deleted file mode 100644 index 34c89aafb..000000000 --- a/apps/example/src/app/marketplace/activity/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -"use client"; - -export default function CollectionActivity() { - return
Collection Activity
; -} diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/accept-best-offer.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/accept-best-offer.tsx deleted file mode 100644 index b255b5a8e..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/accept-best-offer.tsx +++ /dev/null @@ -1,81 +0,0 @@ -"use client"; - -import React from "react"; - -import { env } from "@/env"; -import { TokenMarketData } from "@/types"; -import { ReloadIcon } from "@radix-ui/react-icons"; -import { useAccount } from "@starknet-react/core"; -import { formatEther } from "viem"; - -import { useFulfillAuction, useFulfillOffer } from "@ark-project/react"; - -import { Token } from "@/types/schema"; -import { areAddressesEqual } from "@/lib/utils"; -import { Button } from "@/components/ui/Button"; -import { Separator } from "@/components/ui/separator"; - -interface BuyOrderProps { - token: Token; - tokenMarketData: TokenMarketData; - isAuction: boolean; -} - -const AcceptBestOffer: React.FC = ({ - token, - tokenMarketData, - isAuction -}) => { - const { address, account } = useAccount(); - const { fulfill: fulfillAuction, status: statusAuction } = - useFulfillAuction(); - const { fulfillOffer, status } = useFulfillOffer(); - const isOwner = areAddressesEqual(token.owner, address); - - if (!account || !isOwner || !tokenMarketData?.has_offer) { - return null; - } - - const handleClick = async () => { - try { - if (isAuction) { - await fulfillAuction({ - starknetAccount: account, - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: token.contract_address, - tokenId: token.token_id, - orderHash: tokenMarketData.top_bid.order_hash, - relatedOrderHash: tokenMarketData.order_hash - }); - } else { - await fulfillOffer({ - starknetAccount: account, - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: token.contract_address, - tokenId: token.token_id, - orderHash: tokenMarketData.top_bid.order_hash - }); - } - } catch (error) { - console.log("Error accepting offer"); - } - }; - - const isLoading = status === "loading" || statusAuction === "loading"; - - return ( - - ); -}; - -export default AcceptBestOffer; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/accept-offer.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/accept-offer.tsx deleted file mode 100644 index f6883480e..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/accept-offer.tsx +++ /dev/null @@ -1,71 +0,0 @@ -"use client"; - -import React from "react"; - -import { env } from "@/env"; -import { TokenMarketData } from "@/types"; -import { ReloadIcon } from "@radix-ui/react-icons"; -import { useAccount } from "@starknet-react/core"; - -import { useFulfillAuction, useFulfillOffer } from "@ark-project/react"; - -import { Offer, Token } from "@/types/schema"; -import { areAddressesEqual } from "@/lib/utils"; -import { Button } from "@/components/ui/Button"; - -interface AcceptOfferProps { - token: Token; - tokenMarketData: TokenMarketData; - offer: Offer; - isAuction: boolean; -} - -const AcceptOffer: React.FC = ({ - token, - tokenMarketData, - offer, - isAuction -}) => { - const { address, account } = useAccount(); - const { fulfillOffer, status } = useFulfillOffer(); - const { fulfill: fulfillAuction, status: statusAuction } = - useFulfillAuction(); - const isOwner = areAddressesEqual(token.owner, address); - const isListed = tokenMarketData?.is_listed; - - if (!account || !isOwner) { - return null; - } - - const handleClick = async () => { - if (isListed && isAuction) { - await fulfillAuction({ - starknetAccount: account, - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: token.contract_address, - tokenId: token.token_id, - orderHash: tokenMarketData.order_hash, - relatedOrderHash: offer.order_hash, - startAmount: offer.offer_amount - }); - } else { - await fulfillOffer({ - starknetAccount: account, - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: token.contract_address, - tokenId: token.token_id, - orderHash: offer.order_hash - }); - } - }; - - const isLoading = status === "loading" || statusAuction === "loading"; - - return ( - - ); -}; - -export default AcceptOffer; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/asset-infos.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/asset-infos.tsx deleted file mode 100644 index faa8f2490..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/asset-infos.tsx +++ /dev/null @@ -1,70 +0,0 @@ -"use client"; - -import React from "react"; - -import { TokenMarketData } from "@/types"; -import { useAccount } from "@starknet-react/core"; -import { SiEthereum } from "react-icons/si"; -import { formatEther } from "viem"; - -import { Token } from "@/types/schema"; -import { areAddressesEqual, shortAddress } from "@/lib/utils"; -import { TableCell, TableHead } from "@/components/ui/table"; - -interface AssetInfosProps { - token: Token; - tokenMarketData?: TokenMarketData; -} - -const AssetInfos: React.FC = ({ token, tokenMarketData }) => { - const { address } = useAccount(); - const owner = areAddressesEqual(token.owner, address) - ? "You" - : shortAddress(token.owner); - - return ( -
- - - - Price - Last Sale - Top Bid - Collection Floor - Owner - ID - - - - - - {tokenMarketData && tokenMarketData.start_amount ? ( -
- {formatEther(BigInt(tokenMarketData?.start_amount))} - -
- ) : ( - "-" - )} -
- - {tokenMarketData && tokenMarketData.last_price - ? `${formatEther(BigInt(tokenMarketData.last_price))} ETH` - : "-"} - - - {tokenMarketData?.top_bid?.amount - ? `${formatEther(BigInt(tokenMarketData?.top_bid?.amount))} ETH` - : "-"} - - - - {owner} - {token.token_id} - - -
-
- ); -}; - -export default AssetInfos; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/asset.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/asset.tsx deleted file mode 100644 index d256d1ace..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/asset.tsx +++ /dev/null @@ -1,144 +0,0 @@ -"use client"; - -import React from "react"; - -import { useAccount } from "@starknet-react/core"; -import Image from "next/image"; -import Link from "next/link"; -import { RiTwitterXLine } from "react-icons/ri"; -import { SiOpensea } from "react-icons/si"; -import { useQuery } from "react-query"; - -import { useOrderType } from "@ark-project/react"; - -import { areAddressesEqual } from "@/lib/utils"; - -import { getTokenData, getTokenMarketData } from "../data"; -import AssetsInfos from "./asset-infos"; -import BestOffer from "./best-offer"; -import CreateListing from "./create-listing"; -import Listing from "./listing"; -import Activity from "./token-activity"; -import TokenMedia from "./token-media"; -import TokenOffers from "./token-offers"; - -interface AssetProps { - collection: any; - params: any; -} - -const Asset: React.FC = ({ params }) => { - const { address } = useAccount(); - const { data: tokenMarketData }: any = useQuery( - "tokenMarketData", - () => - getTokenMarketData({ - contract_address: params.contract_address, - token_id: params.token_id - }), - { - refetchInterval: 10000 - } - ); - - const { - data: tokenData, - isLoading, - error - }: any = useQuery( - "tokenMetadata", - () => getTokenData(params.contract_address, params.token_id), - { - refetchInterval: 10000 - } - ); - - const type = useOrderType({ - orderHash: tokenMarketData?.order_hash - }); - - if (isLoading) { - return
Loading...
; - } - - if (error) { - return
Error
; - } - - const token = tokenData.result; - const isOwner = areAddressesEqual(token.owner, address); - const isAuction = type === "AUCTION"; - - return ( -
-
-
-
Duo #{token.token_id}
-
- -
- everai -

EveraiDuo

-
- -
- - - - - - -
-
-
-
- -
-
-
- - {tokenMarketData?.is_listed ? ( - - ) : ( - <> - - {isOwner && ( - <> - - - )} - - )} - - -
-
- ); -}; - -export default Asset; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/best-offer.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/best-offer.tsx deleted file mode 100644 index 83fd86131..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/best-offer.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { TokenMarketData } from "@/types"; -import { formatEther } from "viem"; - -import { Token } from "@/types/schema"; - -import CreateOffer from "./create-offer"; - -type BestOfferProps = { - token: Token; - tokenMarketData: TokenMarketData; - isOwner: boolean; -}; - -export function BestOffer({ token, tokenMarketData, isOwner }: BestOfferProps) { - return ( -
-
-
Best offer
-
- {tokenMarketData?.top_bid.amount - ? formatEther(BigInt(tokenMarketData.top_bid.amount)) - : "-"}{" "} - ETH -
-
- {isOwner || ( - - )} -
- ); -} - -export default BestOffer; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/buy-now.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/buy-now.tsx deleted file mode 100644 index 4adbc6121..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/buy-now.tsx +++ /dev/null @@ -1,70 +0,0 @@ -"use client"; - -import React from "react"; - -import { env } from "@/env"; -import { TokenMarketData } from "@/types"; -import { useAccount } from "@starknet-react/core"; -import { SiEthereum } from "react-icons/si"; -import { formatEther } from "viem"; - -import { useFulfillListing } from "@ark-project/react"; - -import { Token } from "@/types/schema"; -import { areAddressesEqual } from "@/lib/utils"; -import { Button } from "@/components/ui/Button"; -import { Separator } from "@/components/ui/separator"; - -interface BuyOrderProps { - token: Token; - tokenMarketData: TokenMarketData; -} - -const BuyNow: React.FC = ({ token, tokenMarketData }) => { - const { fulfillListing, status } = useFulfillListing(); - const { address, account } = useAccount(); - const isOwner = address && areAddressesEqual(token.owner, address); - - if ( - !account || - isOwner || - !tokenMarketData?.is_listed || - tokenMarketData?.status === "FULFILLED" - ) { - return null; - } - - return ( - - ); -}; - -export default BuyNow; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/cancel-listing.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/cancel-listing.tsx deleted file mode 100644 index cefe9497f..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/cancel-listing.tsx +++ /dev/null @@ -1,54 +0,0 @@ -"use client"; - -import React from "react"; - -import { TokenMarketData } from "@/types"; -import { ReloadIcon } from "@radix-ui/react-icons"; -import { useAccount } from "@starknet-react/core"; - -import { useCancel } from "@ark-project/react"; - -import { Token } from "@/types/schema"; -import { areAddressesEqual } from "@/lib/utils"; -import { Button } from "@/components/ui/Button"; - -interface CancelListingProps { - token: Token; - tokenMarketData: TokenMarketData; -} - -const CancelListing: React.FC = ({ - token, - tokenMarketData -}) => { - const { account, address } = useAccount(); - const { cancel, status } = useCancel(); - const isOwner = areAddressesEqual(token.owner, address); - - if (!account || !isOwner || !tokenMarketData?.is_listed) { - return; - } - - const handleClick = async () => { - await cancel({ - starknetAccount: account, - orderHash: BigInt(tokenMarketData.order_hash), - tokenAddress: token.contract_address, - tokenId: BigInt(token.token_id) - }); - }; - - const isDisabled = ["loading", "cancelling"].includes(status); - - return ( - - ); -}; - -export default CancelListing; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/cancel-offer.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/cancel-offer.tsx deleted file mode 100644 index 759fe0570..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/cancel-offer.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client"; - -import React, { useEffect } from "react"; - -import { ReloadIcon } from "@radix-ui/react-icons"; -import { useAccount } from "@starknet-react/core"; - -import { useCancel } from "@ark-project/react"; - -import { Token } from "@/types/schema"; -import { Button } from "@/components/ui/Button"; -import { toast } from "@/components/ui/use-toast"; - -interface CancelOfferProps { - token: Token; - offer: any; -} - -const CancelOffer: React.FC = ({ token, offer }) => { - const { account } = useAccount(); - const { cancel, status } = useCancel(); - - useEffect(() => { - if (status === "error") { - toast({ - title: "Oops", - description: "An error occurred while cancelling the offer" - }); - } - }, [status]); - - const handleClick = async () => { - if (!account) { - return; - } - - await cancel({ - starknetAccount: account, - tokenAddress: token.contract_address, - tokenId: BigInt(token.token_id), - orderHash: offer.order_hash - }); - }; - - if (!account || status === "success") { - return; - } - - const isLoading = ["loading", "cancelling"].includes(status); - - return ( - - ); -}; - -export default CancelOffer; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-bid.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-bid.tsx deleted file mode 100644 index 3a319331a..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-bid.tsx +++ /dev/null @@ -1,170 +0,0 @@ -"use client"; - -import { useEffect, useState } from "react"; - -import { env } from "@/env"; -import { TokenMarketData } from "@/types"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { ReloadIcon } from "@radix-ui/react-icons"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import { formatEther, parseEther } from "viem"; -import * as z from "zod"; - -import { useConfig, useCreateOffer } from "@ark-project/react"; - -import { Token } from "@/types/schema"; -import { areAddressesEqual } from "@/lib/utils"; -import { Button } from "@/components/ui/Button"; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, - DialogTrigger -} from "@/components/ui/dialog"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -import TokenMedia from "./token-media"; - -interface CreateOfferProps { - token: Token; - tokenMarketData: TokenMarketData; -} - -export default function CreateBid({ - token, - tokenMarketData -}: CreateOfferProps) { - const [isOpen, setIsOpen] = useState(false); - const config = useConfig(); - const { account, address } = useAccount(); - const { response, createOffer, status } = useCreateOffer(); - const isOwner = address && areAddressesEqual(token.owner, address); - const formSchema = z.object({ - startAmount: z.string() - }); - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - startAmount: formatEther(BigInt(tokenMarketData.start_amount)) - } - }); - - useEffect(() => { - form.reset(); - }, [form, isOpen]); - - useEffect(() => { - if (response) { - setIsOpen(false); - } - }, [response]); - - async function onSubmit(values: z.infer) { - if (!account || !config) { - return; - } - - const tokenIdNumber = parseInt(token.token_id, 10); - - if (isNaN(tokenIdNumber)) { - console.error("Invalid token ID"); - return; - } - - const processedValues = { - brokerId: env.NEXT_PUBLIC_BROKER_ID, - currencyAddress: config.starknetCurrencyContract, - tokenAddress: token.contract_address, - tokenId: BigInt(token.token_id), - startAmount: parseEther(values.startAmount) - }; - - await createOffer({ - starknetAccount: account, - ...processedValues - }); - } - - if (!account || isOwner) { - return; - } - - const isDisabled = form.formState.isSubmitting || status === "loading"; - const price = formatEther(BigInt(tokenMarketData.start_amount)); - const reservePrice = formatEther(BigInt(tokenMarketData.end_amount)); - - return ( - - - - - - - Place a bid - -
-
- -
-
-
Duo #{token.token_id}
-
Everai
-
-
-
-
{price} ETH
-
- Reserve {reservePrice} ETH -
-
-
-
- - ( - - Price - - - - - )} - /> - - - - -
- - //
- // {status === "loading" && "Transaction in progress..."} - // {status === "error" && "Error"} - // {status === "success" && "Transaction successful"} - //
- // {!!response && status === "success" && ( - //

order_hash: {response?.toString()}

- // )} - //
- // - ); -} diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-listing.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-listing.tsx deleted file mode 100644 index 218cf5655..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-listing.tsx +++ /dev/null @@ -1,250 +0,0 @@ -"use client"; - -import React from "react"; - -import { env } from "@/env"; -import { TokenMarketData } from "@/types"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useAccount } from "@starknet-react/core"; -import moment from "moment"; -import { useForm } from "react-hook-form"; -import { parseEther } from "viem"; -import * as z from "zod"; - -import { useCreateAuction, useCreateListing } from "@ark-project/react"; - -import { Token } from "@/types/schema"; -import { Button } from "@/components/ui/Button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue -} from "@/components/ui/select"; - -interface OrderBookActionsProps { - token?: Token; - tokenMarketData?: TokenMarketData; -} - -const FIXED = "fixed"; -const AUCTION = "auction"; - -const formSchema = z.object({ - startAmount: z.string({ - invalid_type_error: "Please enter a valid amount" - }), - endAmount: z - .string({ - invalid_type_error: "Please enter a valid amount" - }) - .optional(), - duration: z.string(), - type: z.enum([FIXED, AUCTION]) -}); -// .refine( -// (data) => -// data.type === AUCTION ? data.endAmount > data.startAmount : true, -// { -// message: "Reserve price must be greater than starting price", -// path: ["endAmount"] -// } -// ); - -const CreateListing: React.FC = ({ token }) => { - const { account } = useAccount(); - const { createListing, status } = useCreateListing(); - const { create: createAuction, status: statusAuction } = useCreateAuction(); - - const form = useForm>({ - resolver: zodResolver(formSchema), - mode: "onBlur", - defaultValues: { - type: FIXED, - startAmount: "0.1", - duration: "1" - } - }); - - async function onSubmit(values: z.infer) { - if (account === undefined || !token?.contract_address || !token?.token_id) { - console.error("Account, token address, or token ID is missing"); - return; - } - - const tokenId = parseInt(token.token_id, 10); - - if (isNaN(tokenId)) { - console.error("Invalid tokenId"); - return; - } - - const processedValues = { - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: token?.contract_address, - tokenId: BigInt(token.token_id), - startAmount: parseEther(values.startAmount), - endAmount: values.endAmount ? parseEther(values.endAmount) : BigInt(0), - endDate: moment().add(values.duration, "hours").unix() - }; - - try { - if (values.type === AUCTION) { - await createAuction({ - starknetAccount: account, - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: token.contract_address, - tokenId: processedValues.tokenId, - endDate: processedValues.endDate, - startAmount: processedValues.startAmount, - endAmount: processedValues.endAmount - }); - } else { - await createListing({ - starknetAccount: account, - brokerId: env.NEXT_PUBLIC_BROKER_ID, - tokenAddress: token.contract_address, - tokenId: processedValues.tokenId, - endDate: processedValues.endDate, - startAmount: processedValues.startAmount - }); - } - } catch (error) { - console.error("error: create listing failed", error); - } - } - - const isLoading = status === "loading" || statusAuction === "loading"; - const isAuction = form.getValues("type") === AUCTION; - const duration = form.watch("duration"); - const expiredAt = moment().add(duration, "hours").format("LLLL"); - - return ( -
-
List for sale
-
- - ( - - Choose a type of sale - - - - - Fixed price - - The item is listed at the price you set. - - - - - - - - - - Sell to highest bidder - - - The item is listed for auction. - - - - - - - - - - - )} - /> - ( - - Starting Price - - - - - - )} - /> - {isAuction && ( - ( - - Reserve Price - - - - - - )} - /> - )} - ( - -
- Duration -
Expires {expiredAt}
-
- - -
- )} - /> - - - -
- ); -}; - -export default CreateListing; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-offer.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-offer.tsx deleted file mode 100644 index f38019335..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/create-offer.tsx +++ /dev/null @@ -1,153 +0,0 @@ -"use client"; - -import { useEffect, useState } from "react"; - -import { env } from "@/env"; -import { TokenMarketData } from "@/types"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { ReloadIcon } from "@radix-ui/react-icons"; -import { useAccount } from "@starknet-react/core"; -import { useForm } from "react-hook-form"; -import { formatEther, parseEther } from "viem"; -import * as z from "zod"; - -import { useConfig, useCreateOffer } from "@ark-project/react"; - -import { Token } from "@/types/schema"; -import { areAddressesEqual } from "@/lib/utils"; -import { Button } from "@/components/ui/Button"; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, - DialogTrigger -} from "@/components/ui/dialog"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; - -import TokenMedia from "./token-media"; - -interface CreateOfferProps { - token: Token; - tokenMarketData: TokenMarketData; -} - -export default function CreateOffer({ - token, - tokenMarketData -}: CreateOfferProps) { - const [isOpen, setIsOpen] = useState(false); - const config = useConfig(); - const { account, address } = useAccount(); - const { response, createOffer, status } = useCreateOffer(); - const isOwner = address && areAddressesEqual(token.owner, address); - const formSchema = z.object({ - startAmount: z.string() - }); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - startAmount: "" - } - }); - - useEffect(() => { - form.reset(); - }, [form, isOpen]); - - useEffect(() => { - if (response) { - setIsOpen(false); - } - }, [response]); - - async function onSubmit(values: z.infer) { - if (!account) { - return; - } - - const processedValues = { - brokerId: env.NEXT_PUBLIC_BROKER_ID, - currencyAddress: config?.starknetCurrencyContract, - tokenAddress: token.contract_address, - tokenId: BigInt(token.token_id), - startAmount: parseEther(values.startAmount) - }; - - await createOffer({ - starknetAccount: account, - ...processedValues - }); - } - - if (!account || isOwner) { - return; - } - - const isDisabled = form.formState.isSubmitting || status === "loading"; - - return ( - - - - - - - Make offer - -
-
- -
-
-
Duo #{token.token_id}
-
Everai
-
-
-
-
- {tokenMarketData?.is_listed - ? formatEther(BigInt(tokenMarketData.start_amount)) - : "-"}{" "} - ETH -
-
-
-
- - ( - - Price - - - - - )} - /> - - - - -
- ); -} diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/listing.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/listing.tsx deleted file mode 100644 index d695605a7..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/listing.tsx +++ /dev/null @@ -1,79 +0,0 @@ -"use client"; - -import React from "react"; - -import { TokenMarketData } from "@/types"; -import { ClockIcon } from "@radix-ui/react-icons"; -import moment from "moment"; -import { formatEther } from "viem"; - -import { useOrderType } from "@ark-project/react"; - -import { Token } from "@/types/schema"; - -import AcceptOffer from "./accept-best-offer"; -import FulfillListing from "./buy-now"; -import CancelListing from "./cancel-listing"; -import CreateBid from "./create-bid"; -import CreateOffer from "./create-offer"; - -interface ListingProps { - token: Token; - tokenMarketData: TokenMarketData; - isOwner: boolean; -} - -const Listing: React.FC = ({ token, tokenMarketData }) => { - const type = useOrderType({ - orderHash: BigInt(tokenMarketData?.order_hash) - }); - - const price = formatEther(BigInt(tokenMarketData.start_amount)); - const reservePrice = formatEther(BigInt(tokenMarketData.end_amount)); - - if (!type) { - return null; - } - - const isAuction = type === "AUCTION"; - - return ( -
-
- -
- Sale ends {moment.unix(tokenMarketData.end_date).format("LLLL")} -
-
- -
-
- {isAuction ? ( - <> -
Minimum bid {price} ETH
-
- Reserve bid {reservePrice} ETH -
- - - ) : ( - <> -
Current Price
-
{price} ETH
- -
- - -
- - )} -
-
- ); -}; - -export default Listing; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-activity.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-activity.tsx deleted file mode 100644 index 8f6c10f97..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-activity.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import React from "react"; - -import { env } from "@/env"; -import { useQuery } from "react-query"; -import { formatEther } from "viem"; - -import { timeSince } from "@/lib/utils"; -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow -} from "@/components/ui/table"; - -export async function getTokenActivity({ - contract_address, - token_id -}: { - contract_address: string; - token_id: string; -}) { - const response = await fetch( - `${env.NEXT_PUBLIC_ORDERBOOK_API_URL}/token/${contract_address}/${token_id}/history` - ); - if (!response.ok) { - return null; - } - return response.json(); -} - -interface ActivityProps { - params: any; -} - -const Activity: React.FC = ({ params }) => { - const { data, error, isLoading } = useQuery( - "tokenActivityData", - () => - getTokenActivity({ - contract_address: params.contract_address, - token_id: params.token_id - }), - { - refetchInterval: 10000 - } - ); - - if (isLoading) { - return
Loading...
; - } - if (error) { - throw error; - } - - return ( -
-
-

- Item activity -

-

- All the token events and transactions -

-
-
- {!data || !data.history || data.history.length === 0 ? ( -
- No activity available -
- ) : ( - - - - Event - Type - Price - From - To - Date - - - - {data && - data.history && - data.history.map((activity: any) => ( - - {activity.order_status} - {activity.event_type} - - {activity.amount - ? `${formatEther(BigInt(activity.amount))} ETH` - : "-"} - - - {activity.previous_owner ? ( - <> - {activity.previous_owner.slice(0, 6)}... - {activity.previous_owner.slice(-4)} - - ) : ( - "-" - )} - - - {activity.new_owner ? ( - <> - {activity.new_owner.slice(0, 6)}... - {activity.new_owner.slice(-4)} - - ) : ( - "-" - )} - - - {timeSince(activity.event_timestamp)} - - - ))} - -
- )} -
-
- ); -}; - -export default Activity; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-media.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-media.tsx deleted file mode 100644 index b739a6a5c..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-media.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Token } from "@/types/schema"; -import Media from "@/components/media"; - -export function TokenMedia({ token }: { token: Token }) { - return ( - - ); -} - -export default TokenMedia; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-offers.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-offers.tsx deleted file mode 100644 index 65ace5b30..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/components/token-offers.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import React from "react"; - -import { TokenMarketData } from "@/types"; -import { useAccount } from "@starknet-react/core"; -import { useQuery } from "react-query"; -import { formatEther, hexToNumber } from "viem"; - -import { Token } from "@/types/schema"; -import { - areAddressesEqual, - getRoundedRemainingTime, - shortAddress -} from "@/lib/utils"; -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow -} from "@/components/ui/table"; - -import { getTokenOffers } from "../data"; -import AcceptOffer from "./accept-offer"; -import CancelOffer from "./cancel-offer"; - -interface TokenOffersProps { - token: Token; - tokenMarketData: TokenMarketData; - isAuction: boolean; -} - -const TokenOffers: React.FC = ({ - token, - tokenMarketData, - isAuction -}) => { - const { - data: tokenOffers, - error: tokenOffersError, - isLoading: tokenOffersIsLoading - }: any = useQuery( - "tokenOffers", - () => - getTokenOffers({ - contract_address: token.contract_address, - token_id: token.token_id - }), - { - refetchInterval: 10000 - } - ); - const { address, account } = useAccount(); - const isOwner = address && areAddressesEqual(token.owner, address); - - if (!account) { - return null; - } - - return ( -
-
-

Offers

-

- View and accept offers for this item -

-
-
- {tokenOffersError || - !tokenOffers || - !tokenOffers.offers || - tokenOffers.offers.length === 0 ? ( -
- No offers available -
- ) : ( - <> - {tokenOffersIsLoading ? ( -
- Loading... -
- ) : ( - - - - Price - Quantity - Expiration - From - - - - - {tokenOffers.offers.map((offer: any) => ( - - - {`${formatEther(BigInt(offer.offer_amount))} ETH`} - - {hexToNumber(offer.offer_quantity)} - - in {getRoundedRemainingTime(offer.end_date)} - - - {areAddressesEqual(address, offer.offer_maker) - ? "You" - : shortAddress(offer.offer_maker)} - - - <> - {isOwner && ( - - )} - {areAddressesEqual(offer.offer_maker, address) && ( - - )} - - - - ))} - -
- )} - - )} -
-
- ); -}; - -export default TokenOffers; diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/data.ts b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/data.ts deleted file mode 100644 index e3afbdfca..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/data.ts +++ /dev/null @@ -1,68 +0,0 @@ -// import { TokenMarketData } from "@/types"; -import { env } from "@/env"; - -export async function getTokenData(contract_address: string, token_id: string) { - const response = await fetch( - `${env.NEXT_PUBLIC_NFT_API_URL}/v1/tokens/${contract_address}/${token_id}`, - { - headers: { - "x-api-key": env.NEXT_PUBLIC_NFT_API_KEY - } - } - ); - if (!response.ok) { - throw new Error("Failed to fetch data"); - } - return response.json(); -} - -export async function getTokenMarketData({ - contract_address, - token_id -}: { - contract_address: string; - token_id: string; -}) { - const response = await fetch( - `${env.NEXT_PUBLIC_ORDERBOOK_API_URL}/token/${contract_address}/${token_id}` - ); - if (!response.ok) { - return null; - } - return response.json(); -} - -export async function getTokenOffers({ - contract_address, - token_id -}: { - contract_address: string; - token_id: string; -}) { - const response = await fetch( - `${env.NEXT_PUBLIC_ORDERBOOK_API_URL}/token/${contract_address}/${token_id}/offers` - ); - if (!response.ok) { - return null; - } - return response.json(); -} - -export async function getCollectionMetadata(contract_address: string) { - const response = await fetch( - `${env.NEXT_PUBLIC_NFT_API_URL}/v1/contracts/${contract_address}`, - { - headers: { - "x-api-key": env.NEXT_PUBLIC_NFT_API_KEY - } - } - ); - - if (!response.ok) { - throw new Error("Failed to fetch data"); - } - - const data = await response.json(); - - return data; -} diff --git a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/page.tsx b/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/page.tsx deleted file mode 100644 index 604d69415..000000000 --- a/apps/example/src/app/marketplace/assets/[contract_address]/[token_id]/page.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import Asset from "./components/asset"; -import { getCollectionMetadata } from "./data"; - -export default async function Token({ - params -}: { - params: { contract_address: string; token_id: string }; -}) { - const { result: collection } = await getCollectionMetadata( - params.contract_address - ); - - return ; -} diff --git a/apps/example/src/app/marketplace/components/main-nav.tsx b/apps/example/src/app/marketplace/components/main-nav.tsx deleted file mode 100644 index 3527cd41c..000000000 --- a/apps/example/src/app/marketplace/components/main-nav.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from "react"; - -import Link from "next/link"; - -import { cn } from "@/lib/utils"; - -export function MainNav({ - className, - ...props -}: React.HTMLAttributes) { - return ( - - ); -} diff --git a/apps/example/src/app/marketplace/components/user-nav.tsx b/apps/example/src/app/marketplace/components/user-nav.tsx deleted file mode 100644 index 48cef994f..000000000 --- a/apps/example/src/app/marketplace/components/user-nav.tsx +++ /dev/null @@ -1,58 +0,0 @@ -"use client"; - -import { useAccount, useDisconnect } from "@starknet-react/core"; -import Link from "next/link"; - -import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; -import { Button } from "@/components/ui/Button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuShortcut, - DropdownMenuTrigger -} from "@/components/ui/dropdown-menu"; - -export function UserNav() { - const { disconnect } = useDisconnect(); - const account = useAccount(); - return ( - - - - - - -
-

ArkProject

-

- {account.address} -

-
-
- - - - - Portfolio - ⇧⌘P - - - - - disconnect()}> - Log out - ⇧⌘Q - -
-
- ); -} diff --git a/apps/example/src/app/marketplace/explore/components/columns.tsx b/apps/example/src/app/marketplace/explore/components/columns.tsx deleted file mode 100644 index dd9108b39..000000000 --- a/apps/example/src/app/marketplace/explore/components/columns.tsx +++ /dev/null @@ -1,176 +0,0 @@ -"use client"; - -import { useAccount } from "@starknet-react/core"; -import { ColumnDef } from "@tanstack/react-table"; -import Image from "next/image"; -import { SiEthereum } from "react-icons/si"; -import { formatEther, parseEther } from "viem"; - -import { areAddressesEqual, timeSince, truncateString } from "@/lib/utils"; - -// import { statuses } from "../data/data"; -import { Token } from "../../../../types/schema"; -import { DataTableColumnHeader } from "./data-table-column-header"; - -export const columns: ColumnDef[] = [ - { - accessorKey: "metadata", - header: ({ column }) => ( - - ), - cell: ({ row }) => { - const metadata = row.getValue("metadata") as Token["metadata"]; - const url = metadata?.normalized?.image; - const imageUrl = url ? url.replace(/\.mp4$/, ".jpg") : "/missing.jpg"; - return ( -
- {metadata?.normalized?.name -
- ); - } - }, - { - accessorKey: "token_id", - header: ({ column }) => ( - - ), - cell: ({ row }) => ( -
#{row.getValue("token_id")}
- ), - enableSorting: false, - enableHiding: false - }, - { - accessorKey: "start_amount", - header: ({ column }) => ( - - ), - cell: ({ row }) => { - if ( - row.getValue("start_amount") === undefined || - row.getValue("start_amount") === null - ) { - return
-
; - } else { - const price = parseEther(row.getValue("start_amount")); - return ( -
- {price} - -
- ); - } - } - }, - { - accessorKey: "last_price", - header: ({ column }) => ( - - ), - cell: () => { - // to do get last sell price when available in the API - return ( -
- - - {/* 0.77 - */} -
- ); - }, - filterFn: (row, id, value) => { - return value.includes(row.getValue(id)); - } - }, - { - accessorKey: "owner", - header: ({ column }) => ( - - ), - cell: ({ row }) => { - // eslint-disable-next-line react-hooks/rules-of-hooks - const { address } = useAccount(); - const tokenOwner = row.getValue("owner") as string; - const owner = - address && areAddressesEqual(tokenOwner, address) - ? "You" - : truncateString(tokenOwner, 8); - return ( -
{truncateString(owner, 8)}
- ); - }, - filterFn: (row, id, value) => { - return value.includes(row.getValue(id)); - } - }, - { - accessorKey: "top_bid", - header: ({ column }) => ( - - ), - cell: ({ row }) => { - const topBid = row.getValue("top_bid") as - | { amount: string; order_hash: string } - | undefined; - - if (!topBid || topBid.amount === undefined || topBid.amount === null) { - return
-
; - } - return ( -
- {formatEther(BigInt(topBid.amount))} - -
- ); - }, - filterFn: (row, id, value) => { - return value.includes(row.getValue(id)); - } - }, - { - accessorKey: "listed_timestamp", - header: ({ column }) => ( - - ), - cell: ({ row }) => { - const listedTimeStamp = row.getValue("listed_timestamp") as number; - if (listedTimeStamp === undefined) { - return
-
; - } - return ( -
- {timeSince(listedTimeStamp)} -
- ); - } - }, - { - accessorKey: "is_listed", - header: ({ column }) => ( - - ), - cell: ({ row }) => { - return ( -
- {row.getValue("is_listed") ? "Listed" : "Unlisted"} -
- ); - }, - filterFn: (row) => { - return row.getValue("is_listed"); - } - } -]; diff --git a/apps/example/src/app/marketplace/explore/components/data-table-column-header.tsx b/apps/example/src/app/marketplace/explore/components/data-table-column-header.tsx deleted file mode 100644 index 0a2988608..000000000 --- a/apps/example/src/app/marketplace/explore/components/data-table-column-header.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; - -import { Column } from "@tanstack/react-table"; - -import { cn } from "@/lib/utils"; - -interface DataTableColumnHeaderProps - extends React.HTMLAttributes { - column: Column; - title: string; -} - -export function DataTableColumnHeader({ - column, - title, - className -}: DataTableColumnHeaderProps) { - if (!column.getCanSort()) { - return
{title}
; - } - - return ( -
- {title} -
- ); -} diff --git a/apps/example/src/app/marketplace/explore/components/data-table-faceted-filter.tsx b/apps/example/src/app/marketplace/explore/components/data-table-faceted-filter.tsx deleted file mode 100644 index 58d03c375..000000000 --- a/apps/example/src/app/marketplace/explore/components/data-table-faceted-filter.tsx +++ /dev/null @@ -1,148 +0,0 @@ -import * as React from "react"; - -import { CheckIcon, PlusCircledIcon } from "@radix-ui/react-icons"; -import { Column } from "@tanstack/react-table"; - -import { cn } from "@/lib/utils"; -import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/Button"; -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList, - CommandSeparator -} from "@/components/ui/command"; -import { - Popover, - PopoverContent, - PopoverTrigger -} from "@/components/ui/popover"; -import { Separator } from "@/components/ui/separator"; - -interface DataTableFacetedFilterProps { - column?: Column; - title?: string; - options: { - label: string; - value: string; - icon?: React.ComponentType<{ className?: string }>; - }[]; -} - -export function DataTableFacetedFilter({ - column, - title, - options -}: DataTableFacetedFilterProps) { - const facets = column?.getFacetedUniqueValues(); - const selectedValues = new Set(column?.getFilterValue() as string[]); - - return ( - - - - - - - - - No results found. - - {options.map((option) => { - const isSelected = selectedValues.has(option.value); - return ( - { - if (isSelected) { - selectedValues.delete(option.value); - } else { - selectedValues.add(option.value); - } - const filterValues = Array.from(selectedValues); - column?.setFilterValue( - filterValues.length ? filterValues : undefined - ); - }} - > -
- -
- {option.icon && ( - - )} - {option.label} - {facets?.get(option.value) && ( - - {facets.get(option.value)} - - )} -
- ); - })} -
- {selectedValues.size > 0 && ( - <> - - - column?.setFilterValue(undefined)} - className="justify-center text-center" - > - Clear filters - - - - )} -
-
-
-
- ); -} diff --git a/apps/example/src/app/marketplace/explore/components/data-table-pagination.tsx b/apps/example/src/app/marketplace/explore/components/data-table-pagination.tsx deleted file mode 100644 index 583db54db..000000000 --- a/apps/example/src/app/marketplace/explore/components/data-table-pagination.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { - ChevronLeftIcon, - ChevronRightIcon, - DoubleArrowLeftIcon, - DoubleArrowRightIcon -} from "@radix-ui/react-icons"; -import { Table } from "@tanstack/react-table"; - -import { Button } from "@/components/ui/Button"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue -} from "@/components/ui/select"; - -interface DataTablePaginationProps { - table: Table; -} - -export function DataTablePagination({ - table -}: DataTablePaginationProps) { - return ( -
-
- {table.getFilteredSelectedRowModel().rows.length} of{" "} - {table.getFilteredRowModel().rows.length} row(s) selected. -
-
-
-

Rows per page

- -
-
- Page {table.getState().pagination.pageIndex + 1} of{" "} - {table.getPageCount()} -
-
- - - - -
-
-
- ); -} diff --git a/apps/example/src/app/marketplace/explore/components/data-table-toolbar.tsx b/apps/example/src/app/marketplace/explore/components/data-table-toolbar.tsx deleted file mode 100644 index cd42f1151..000000000 --- a/apps/example/src/app/marketplace/explore/components/data-table-toolbar.tsx +++ /dev/null @@ -1,51 +0,0 @@ -"use client"; - -import { Cross2Icon } from "@radix-ui/react-icons"; -import { Table } from "@tanstack/react-table"; - -import { Button } from "@/components/ui/Button"; - -import { DataTableFacetedFilter } from "./data-table-faceted-filter"; - -interface DataTableToolbarProps { - table: Table; -} - -export function DataTableToolbar({ - table -}: DataTableToolbarProps) { - const isFiltered = table.getState().columnFilters.length > 0; - - return ( -
-
- {table.getColumn("is_listed") && ( - - )} - {isFiltered && ( - - )} -
-
- ); -} diff --git a/apps/example/src/app/marketplace/explore/components/data-table.tsx b/apps/example/src/app/marketplace/explore/components/data-table.tsx deleted file mode 100644 index 3d921b406..000000000 --- a/apps/example/src/app/marketplace/explore/components/data-table.tsx +++ /dev/null @@ -1,138 +0,0 @@ -"use client"; - -import * as React from "react"; - -import { - ColumnDef, - ColumnFiltersState, - flexRender, - getCoreRowModel, - getFacetedRowModel, - getFacetedUniqueValues, - getFilteredRowModel, - getPaginationRowModel, - getSortedRowModel, - SortingState, - useReactTable, - VisibilityState -} from "@tanstack/react-table"; -import { useRouter } from "next/navigation"; - -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow -} from "@/components/ui/table"; - -import { Token } from "../../../../types/schema"; -import { DataTablePagination } from "../components/data-table-pagination"; -import { DataTableToolbar } from "../components/data-table-toolbar"; - -interface DataTableProps { - columns: ColumnDef[]; - data: TData[]; -} - -export function DataTable({ - columns, - data -}: DataTableProps) { - const [rowSelection, setRowSelection] = React.useState({}); - const [columnVisibility, setColumnVisibility] = - React.useState({}); - const [columnFilters, setColumnFilters] = React.useState( - [] - ); - const [sorting, setSorting] = React.useState([]); - const router = useRouter(); - - const table = useReactTable({ - data, - columns, - state: { - sorting, - columnVisibility, - rowSelection, - columnFilters - }, - enableRowSelection: true, - onRowSelectionChange: setRowSelection, - onSortingChange: setSorting, - onColumnFiltersChange: setColumnFilters, - onColumnVisibilityChange: setColumnVisibility, - getCoreRowModel: getCoreRowModel(), - getFilteredRowModel: getFilteredRowModel(), - getPaginationRowModel: getPaginationRowModel(), - getSortedRowModel: getSortedRowModel(), - getFacetedRowModel: getFacetedRowModel(), - getFacetedUniqueValues: getFacetedUniqueValues() - }); - - return ( -
- -
- - - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => { - return ( - - {header.isPlaceholder - ? null - : flexRender( - header.column.columnDef.header, - header.getContext() - )} - - ); - })} - - ))} - - - {table.getRowModel().rows?.length ? ( - table.getRowModel().rows.map((row) => { - const token = row.original as Token; - return ( - - router.push( - `/marketplace/assets/${token?.contract_address}/${token?.token_id}` - ) - } - key={token.token_id} - className="cursor-pointer hover:slate-50" - > - {row.getVisibleCells().map((cell) => ( - - {flexRender( - cell.column.columnDef.cell, - cell.getContext() - )} - - ))} - - ); - }) - ) : ( - - - No results. - - - )} - -
-
- -
- ); -} diff --git a/apps/example/src/app/marketplace/explore/components/explore.tsx b/apps/example/src/app/marketplace/explore/components/explore.tsx deleted file mode 100644 index e11b12309..000000000 --- a/apps/example/src/app/marketplace/explore/components/explore.tsx +++ /dev/null @@ -1,75 +0,0 @@ -"use client"; - -import React from "react"; - -import { env } from "@/env"; -import { useQuery } from "react-query"; - -import { mergeTokenData } from "../utils"; -import { columns } from "./columns"; -import { DataTable } from "./data-table"; - -const fetchCollection = async () => { - const response = await fetch( - `${env.NEXT_PUBLIC_NFT_API_URL}/v1/tokens/0x32d99485b22f2e58c8a0206d3b3bb259997ff0db70cffd25585d7dd9a5b0546`, - { - headers: { - "x-api-key": env.NEXT_PUBLIC_NFT_API_KEY - } - } - ); - - if (!response.ok) { - throw new Error("Network response was not ok"); - } - - return response.json(); -}; - -async function fetchCollectionMarket() { - const response = await fetch( - `${env.NEXT_PUBLIC_ORDERBOOK_API_URL}/tokens/collection/0x032d99485b22f2e58c8a0206d3b3bb259997ff0db70cffd25585d7dd9a5b0546` - ); - if (!response.ok) { - throw new Error("Failed to fetch data"); - } - return response.json(); -} - -const Explore = () => { - const { - data: collectionData, - error: collectionDataError, - isError: collectionDataIsError, - isLoading: collectionDataIsLoading - }: any = useQuery("tokens", fetchCollection); - - const { - data: collectionMarketData, - error: collectionMarketError, - isLoading: collectionMarketIsLoading - }: any = useQuery("collectionMarket", fetchCollectionMarket); - - if (collectionDataIsLoading || collectionMarketIsLoading) { - return
Loading...
; - } - - if (collectionDataIsError || collectionDataError || collectionMarketError) { - return ( -
- Error missing data:{" "} - {collectionDataError - ? collectionDataError.message - : collectionMarketError} -
- ); - } - - const tokenWithMarketData = mergeTokenData( - collectionData.result, - collectionMarketData - ); - return ; -}; - -export default Explore; diff --git a/apps/example/src/app/marketplace/explore/utils/index.ts b/apps/example/src/app/marketplace/explore/utils/index.ts deleted file mode 100644 index 9b7c605bd..000000000 --- a/apps/example/src/app/marketplace/explore/utils/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Token, TokenWithMarketData } from "../../../../types/schema"; - -export function mergeTokenData( - tokensWithMetadata: Token[], - tokensWithMarketData: TokenWithMarketData[] -): Token[] { - const tokenMap = new Map(); - - tokensWithMetadata.forEach((token) => { - tokenMap.set(token.token_id_hex, { ...token, is_listed: false }); - }); - - tokensWithMarketData.forEach((marketToken) => { - const existingToken = tokenMap.get(marketToken.token_id); - if (existingToken) { - const { start_date, end_date, ...marketDataWithoutTokenId } = marketToken; - - tokenMap.set(marketToken.token_id, { - ...existingToken, - ...marketDataWithoutTokenId, - start_date: start_date, - end_date: end_date - }); - } - }); - - return Array.from(tokenMap.values()); -} diff --git a/apps/example/src/app/marketplace/layout.tsx b/apps/example/src/app/marketplace/layout.tsx deleted file mode 100644 index d6240b022..000000000 --- a/apps/example/src/app/marketplace/layout.tsx +++ /dev/null @@ -1,80 +0,0 @@ -"use client"; - -import React from "react"; - -import Link from "next/link"; -import { QueryClient, QueryClientProvider } from "react-query"; - -import { cn } from "@/lib/utils"; -import { Announcement } from "@/components/announcement"; -import AuthSwitcher from "@/components/authSwitcher"; -import { - PageActions, - PageHeader, - PageHeaderDescription, - PageHeaderHeading -} from "@/components/page-header"; -import { buttonVariants } from "@/components/ui/Button"; -import { Toaster } from "@/components/ui/toaster"; - -import { MainNav } from "./components/main-nav"; -import { UserNav } from "./components/user-nav"; - -interface ExamplesLayoutProps { - children: React.ReactNode; -} - -export default function ExamplesLayout({ children }: ExamplesLayoutProps) { - const queryClient = new QueryClient(); - return ( - -
- - - - Mini marketplace example - - Examples - - Mint, Explore, check your portfolio, list, buys, bid and sell NFTs. - - - - Get Started - - - Components - - - -
-
- -
-
-
- -
- -
-
-
- {children} -
-
-
-
-
- -
- ); -} diff --git a/apps/example/src/app/marketplace/mint/abi.ts b/apps/example/src/app/marketplace/mint/abi.ts deleted file mode 100644 index 2a2c4747d..000000000 --- a/apps/example/src/app/marketplace/mint/abi.ts +++ /dev/null @@ -1,601 +0,0 @@ -export const ABI = [ - { - name: "ImplFreeMint", - type: "impl", - interface_name: "ark_tokens::erc721::IFreeMint" - }, - { - name: "ark_tokens::erc721::IFreeMint", - type: "interface", - items: [ - { - name: "mint", - type: "function", - inputs: [ - { - name: "recipient", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "token_uri", - type: "core::felt252" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "get_current_token_id", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "ERC721Impl", - type: "impl", - interface_name: "openzeppelin::token::erc721::interface::IERC721" - }, - { - name: "core::integer::u256", - type: "struct", - members: [ - { - name: "low", - type: "core::integer::u128" - }, - { - name: "high", - type: "core::integer::u128" - } - ] - }, - { - name: "core::array::Span::", - type: "struct", - members: [ - { - name: "snapshot", - type: "@core::array::Array::" - } - ] - }, - { - name: "core::bool", - type: "enum", - variants: [ - { - name: "False", - type: "()" - }, - { - name: "True", - type: "()" - } - ] - }, - { - name: "openzeppelin::token::erc721::interface::IERC721", - type: "interface", - items: [ - { - name: "balance_of", - type: "function", - inputs: [ - { - name: "account", - type: "core::starknet::contract_address::ContractAddress" - } - ], - outputs: [ - { - type: "core::integer::u256" - } - ], - state_mutability: "view" - }, - { - name: "owner_of", - type: "function", - inputs: [ - { - name: "token_id", - type: "core::integer::u256" - } - ], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress" - } - ], - state_mutability: "view" - }, - { - name: "safe_transfer_from", - type: "function", - inputs: [ - { - name: "from", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "to", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "token_id", - type: "core::integer::u256" - }, - { - name: "data", - type: "core::array::Span::" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "transfer_from", - type: "function", - inputs: [ - { - name: "from", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "to", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "token_id", - type: "core::integer::u256" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "approve", - type: "function", - inputs: [ - { - name: "to", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "token_id", - type: "core::integer::u256" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "set_approval_for_all", - type: "function", - inputs: [ - { - name: "operator", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "approved", - type: "core::bool" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "get_approved", - type: "function", - inputs: [ - { - name: "token_id", - type: "core::integer::u256" - } - ], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress" - } - ], - state_mutability: "view" - }, - { - name: "is_approved_for_all", - type: "function", - inputs: [ - { - name: "owner", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "operator", - type: "core::starknet::contract_address::ContractAddress" - } - ], - outputs: [ - { - type: "core::bool" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "ERC721MetadataImpl", - type: "impl", - interface_name: "openzeppelin::token::erc721::interface::IERC721Metadata" - }, - { - name: "openzeppelin::token::erc721::interface::IERC721Metadata", - type: "interface", - items: [ - { - name: "name", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "symbol", - type: "function", - inputs: [], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - }, - { - name: "token_uri", - type: "function", - inputs: [ - { - name: "token_id", - type: "core::integer::u256" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "ERC721CamelOnly", - type: "impl", - interface_name: "openzeppelin::token::erc721::interface::IERC721CamelOnly" - }, - { - name: "openzeppelin::token::erc721::interface::IERC721CamelOnly", - type: "interface", - items: [ - { - name: "balanceOf", - type: "function", - inputs: [ - { - name: "account", - type: "core::starknet::contract_address::ContractAddress" - } - ], - outputs: [ - { - type: "core::integer::u256" - } - ], - state_mutability: "view" - }, - { - name: "ownerOf", - type: "function", - inputs: [ - { - name: "tokenId", - type: "core::integer::u256" - } - ], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress" - } - ], - state_mutability: "view" - }, - { - name: "safeTransferFrom", - type: "function", - inputs: [ - { - name: "from", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "to", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "tokenId", - type: "core::integer::u256" - }, - { - name: "data", - type: "core::array::Span::" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "transferFrom", - type: "function", - inputs: [ - { - name: "from", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "to", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "tokenId", - type: "core::integer::u256" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "setApprovalForAll", - type: "function", - inputs: [ - { - name: "operator", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "approved", - type: "core::bool" - } - ], - outputs: [], - state_mutability: "external" - }, - { - name: "getApproved", - type: "function", - inputs: [ - { - name: "tokenId", - type: "core::integer::u256" - } - ], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress" - } - ], - state_mutability: "view" - }, - { - name: "isApprovedForAll", - type: "function", - inputs: [ - { - name: "owner", - type: "core::starknet::contract_address::ContractAddress" - }, - { - name: "operator", - type: "core::starknet::contract_address::ContractAddress" - } - ], - outputs: [ - { - type: "core::bool" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "ERC721MetadataCamelOnly", - type: "impl", - interface_name: - "openzeppelin::token::erc721::interface::IERC721MetadataCamelOnly" - }, - { - name: "openzeppelin::token::erc721::interface::IERC721MetadataCamelOnly", - type: "interface", - items: [ - { - name: "tokenURI", - type: "function", - inputs: [ - { - name: "tokenId", - type: "core::integer::u256" - } - ], - outputs: [ - { - type: "core::felt252" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "SRC5Impl", - type: "impl", - interface_name: "openzeppelin::introspection::interface::ISRC5" - }, - { - name: "openzeppelin::introspection::interface::ISRC5", - type: "interface", - items: [ - { - name: "supports_interface", - type: "function", - inputs: [ - { - name: "interface_id", - type: "core::felt252" - } - ], - outputs: [ - { - type: "core::bool" - } - ], - state_mutability: "view" - } - ] - }, - { - name: "constructor", - type: "constructor", - inputs: [ - { - name: "name", - type: "core::felt252" - }, - { - name: "symbol", - type: "core::felt252" - } - ] - }, - { - kind: "struct", - name: "openzeppelin::token::erc721::erc721::ERC721Component::Transfer", - type: "event", - members: [ - { - kind: "key", - name: "from", - type: "core::starknet::contract_address::ContractAddress" - }, - { - kind: "key", - name: "to", - type: "core::starknet::contract_address::ContractAddress" - }, - { - kind: "key", - name: "token_id", - type: "core::integer::u256" - } - ] - }, - { - kind: "struct", - name: "openzeppelin::token::erc721::erc721::ERC721Component::Approval", - type: "event", - members: [ - { - kind: "key", - name: "owner", - type: "core::starknet::contract_address::ContractAddress" - }, - { - kind: "key", - name: "approved", - type: "core::starknet::contract_address::ContractAddress" - }, - { - kind: "key", - name: "token_id", - type: "core::integer::u256" - } - ] - }, - { - kind: "struct", - name: "openzeppelin::token::erc721::erc721::ERC721Component::ApprovalForAll", - type: "event", - members: [ - { - kind: "key", - name: "owner", - type: "core::starknet::contract_address::ContractAddress" - }, - { - kind: "key", - name: "operator", - type: "core::starknet::contract_address::ContractAddress" - }, - { - kind: "data", - name: "approved", - type: "core::bool" - } - ] - }, - { - kind: "enum", - name: "openzeppelin::token::erc721::erc721::ERC721Component::Event", - type: "event", - variants: [ - { - kind: "nested", - name: "Transfer", - type: "openzeppelin::token::erc721::erc721::ERC721Component::Transfer" - }, - { - kind: "nested", - name: "Approval", - type: "openzeppelin::token::erc721::erc721::ERC721Component::Approval" - }, - { - kind: "nested", - name: "ApprovalForAll", - type: "openzeppelin::token::erc721::erc721::ERC721Component::ApprovalForAll" - } - ] - }, - { - kind: "enum", - name: "openzeppelin::introspection::src5::SRC5Component::Event", - type: "event", - variants: [] - }, - { - kind: "enum", - name: "ark_tokens::erc721::FreeMintNFT::Event", - type: "event", - variants: [ - { - kind: "flat", - name: "ERC721Event", - type: "openzeppelin::token::erc721::erc721::ERC721Component::Event" - }, - { - kind: "flat", - name: "SRC5Event", - type: "openzeppelin::introspection::src5::SRC5Component::Event" - } - ] - } -]; diff --git a/apps/example/src/app/marketplace/mint/everai.abi.json b/apps/example/src/app/marketplace/mint/everai.abi.json deleted file mode 100644 index 4bc5e7159..000000000 --- a/apps/example/src/app/marketplace/mint/everai.abi.json +++ /dev/null @@ -1,600 +0,0 @@ -[ - { - "name": "ImplFreeMint", - "type": "impl", - "interface_name": "ark_tokens::erc721::IFreeMint" - }, - { - "name": "ark_tokens::erc721::IFreeMint", - "type": "interface", - "items": [ - { - "name": "mint", - "type": "function", - "inputs": [ - { - "name": "recipient", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "token_uri", - "type": "core::felt252" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_current_token_id", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "ERC721Impl", - "type": "impl", - "interface_name": "openzeppelin::token::erc721::interface::IERC721" - }, - { - "name": "core::integer::u256", - "type": "struct", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "core::bool", - "type": "enum", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "name": "openzeppelin::token::erc721::interface::IERC721", - "type": "interface", - "items": [ - { - "name": "balance_of", - "type": "function", - "inputs": [ - { - "name": "account", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "owner_of", - "type": "function", - "inputs": [ - { - "name": "token_id", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "safe_transfer_from", - "type": "function", - "inputs": [ - { - "name": "from", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "token_id", - "type": "core::integer::u256" - }, - { - "name": "data", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "transfer_from", - "type": "function", - "inputs": [ - { - "name": "from", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "token_id", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "approve", - "type": "function", - "inputs": [ - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "token_id", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_approval_for_all", - "type": "function", - "inputs": [ - { - "name": "operator", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "approved", - "type": "core::bool" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_approved", - "type": "function", - "inputs": [ - { - "name": "token_id", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "is_approved_for_all", - "type": "function", - "inputs": [ - { - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "operator", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "ERC721MetadataImpl", - "type": "impl", - "interface_name": "openzeppelin::token::erc721::interface::IERC721Metadata" - }, - { - "name": "openzeppelin::token::erc721::interface::IERC721Metadata", - "type": "interface", - "items": [ - { - "name": "name", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "symbol", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "token_uri", - "type": "function", - "inputs": [ - { - "name": "token_id", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "ERC721CamelOnly", - "type": "impl", - "interface_name": "openzeppelin::token::erc721::interface::IERC721CamelOnly" - }, - { - "name": "openzeppelin::token::erc721::interface::IERC721CamelOnly", - "type": "interface", - "items": [ - { - "name": "balanceOf", - "type": "function", - "inputs": [ - { - "name": "account", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "ownerOf", - "type": "function", - "inputs": [ - { - "name": "tokenId", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "safeTransferFrom", - "type": "function", - "inputs": [ - { - "name": "from", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "tokenId", - "type": "core::integer::u256" - }, - { - "name": "data", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "transferFrom", - "type": "function", - "inputs": [ - { - "name": "from", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "tokenId", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "setApprovalForAll", - "type": "function", - "inputs": [ - { - "name": "operator", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "approved", - "type": "core::bool" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "getApproved", - "type": "function", - "inputs": [ - { - "name": "tokenId", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "isApprovedForAll", - "type": "function", - "inputs": [ - { - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "operator", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "ERC721MetadataCamelOnly", - "type": "impl", - "interface_name": "openzeppelin::token::erc721::interface::IERC721MetadataCamelOnly" - }, - { - "name": "openzeppelin::token::erc721::interface::IERC721MetadataCamelOnly", - "type": "interface", - "items": [ - { - "name": "tokenURI", - "type": "function", - "inputs": [ - { - "name": "tokenId", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "SRC5Impl", - "type": "impl", - "interface_name": "openzeppelin::introspection::interface::ISRC5" - }, - { - "name": "openzeppelin::introspection::interface::ISRC5", - "type": "interface", - "items": [ - { - "name": "supports_interface", - "type": "function", - "inputs": [ - { - "name": "interface_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "constructor", - "type": "constructor", - "inputs": [ - { - "name": "name", - "type": "core::felt252" - }, - { - "name": "symbol", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "openzeppelin::token::erc721::erc721::ERC721Component::Transfer", - "type": "event", - "members": [ - { - "kind": "key", - "name": "from", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "token_id", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "openzeppelin::token::erc721::erc721::ERC721Component::Approval", - "type": "event", - "members": [ - { - "kind": "key", - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "approved", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "token_id", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "openzeppelin::token::erc721::erc721::ERC721Component::ApprovalForAll", - "type": "event", - "members": [ - { - "kind": "key", - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "operator", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "approved", - "type": "core::bool" - } - ] - }, - { - "kind": "enum", - "name": "openzeppelin::token::erc721::erc721::ERC721Component::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "Transfer", - "type": "openzeppelin::token::erc721::erc721::ERC721Component::Transfer" - }, - { - "kind": "nested", - "name": "Approval", - "type": "openzeppelin::token::erc721::erc721::ERC721Component::Approval" - }, - { - "kind": "nested", - "name": "ApprovalForAll", - "type": "openzeppelin::token::erc721::erc721::ERC721Component::ApprovalForAll" - } - ] - }, - { - "kind": "enum", - "name": "openzeppelin::introspection::src5::SRC5Component::Event", - "type": "event", - "variants": [] - }, - { - "kind": "enum", - "name": "ark_tokens::erc721::FreeMintNFT::Event", - "type": "event", - "variants": [ - { - "kind": "flat", - "name": "ERC721Event", - "type": "openzeppelin::token::erc721::erc721::ERC721Component::Event" - }, - { - "kind": "flat", - "name": "SRC5Event", - "type": "openzeppelin::introspection::src5::SRC5Component::Event" - } - ] - } -] diff --git a/apps/example/src/app/marketplace/mint/page.tsx b/apps/example/src/app/marketplace/mint/page.tsx deleted file mode 100644 index b8f3ee7eb..000000000 --- a/apps/example/src/app/marketplace/mint/page.tsx +++ /dev/null @@ -1,143 +0,0 @@ -"use client"; - -import { useEffect, useMemo, useState } from "react"; - -import { env } from "@/env"; -import { - useAccount, - useContract, - useContractRead, - useContractWrite, - useWaitForTransaction -} from "@starknet-react/core"; -import Image from "next/image"; - -import { Button } from "@/components/ui/Button"; -import { - Card, - CardContent, - CardFooter, - CardHeader, - CardTitle -} from "@/components/ui/card"; - -import { ABI } from "./abi"; - -type TokenMetadata = { - image: string; - name: string; - attributes: Array<{ - trait_type: string; - value: string; - }>; -}; - -export default function Home() { - const { address } = useAccount(); - const [tokenId, setTokenId] = useState(null); - const [tokenMetadata, setTokenMetadata] = useState( - null - ); - - const { contract } = useContract({ - abi: ABI, - address: env.NEXT_PUBLIC_STARKNET_NFT_CONTRACT - }); - const { data, isError, isLoading, error } = useContractRead({ - functionName: "get_current_token_id", - abi: ABI, - address: env.NEXT_PUBLIC_STARKNET_NFT_CONTRACT, - watch: true - }); - - const calls = useMemo(() => { - if (!address || !contract) return []; - return contract.populateTransaction["mint"]!( - address, - `https://api.everai.xyz/m/${tokenId}` - ); - }, [contract, address, tokenId]); - - const { - writeAsync, - data: writeData, - isPending - } = useContractWrite({ - calls - }); - - const { isLoading: transactionIsLoading } = useWaitForTransaction({ - hash: writeData?.transaction_hash, - watch: true - }); - - const renderMedia = (url: string) => { - const extension = url.split(".").pop(); - if (extension === "mp4") { - return ( - - ); - } else { - return ( - {tokenMetadata - ); - } - }; - - useEffect(() => { - const fetchData = async () => { - if (!isLoading && !isError && data !== null && data !== undefined) { - let currentTokenId = Number(data); - setTokenId(currentTokenId); - try { - const response = await fetch( - `https://api.everai.xyz/m/${currentTokenId}` - ); - if (!response.ok) { - throw new Error("Network response was not ok"); - } - const jsonData = await response.json(); - console.log(jsonData); - setTokenMetadata(jsonData); - } catch (error) { - console.error("Fetch error:", error); - } - } - }; - fetchData(); - }, [isError, isLoading, error, data]); - - return ( -
- - - Next Mint - - {tokenMetadata && ( - - {renderMedia(tokenMetadata.image)} - Current token ID: {tokenId} - - )} - - {transactionIsLoading ? ( -
Transaction in progress
- ) : ( - - )} -
-
-
- ); -} diff --git a/apps/example/src/app/marketplace/page.tsx b/apps/example/src/app/marketplace/page.tsx deleted file mode 100644 index 3fade5800..000000000 --- a/apps/example/src/app/marketplace/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import Explore from "./explore/components/explore"; - -export default async function ExplorePage() { - return ; -} diff --git a/apps/example/src/app/marketplace/portfolio/components/Portfolio.tsx b/apps/example/src/app/marketplace/portfolio/components/Portfolio.tsx deleted file mode 100644 index 27bd3a4fa..000000000 --- a/apps/example/src/app/marketplace/portfolio/components/Portfolio.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React, { useEffect, useState } from "react"; - -import { env } from "@/env"; -import { useAccount } from "@starknet-react/core"; -import Link from "next/link"; - -import { Token } from "@/types/schema"; -import Media from "@/components/media"; -import { ScrollArea } from "@/components/ui/scroll-area"; - -const Portfolio: React.FC = () => { - const [tokens, setTokens] = useState([]); - const { address } = useAccount(); - useEffect(() => { - const fetchData = async () => { - if (!address) { - return; - } - try { - const response = await fetch( - `${env.NEXT_PUBLIC_NFT_API_URL}/v1/owners/${address}/tokens`, - { - headers: { - "x-api-key": env.NEXT_PUBLIC_NFT_API_KEY - } - } - ); - - if (!response.ok) { - throw new Error("Network response was not ok"); - } - - const data = await response.json(); - setTokens(data.result); - } catch (error) { - console.error("Error fetching data: ", error); - } - }; - fetchData(); - }, [address]); - - return ( - -
- {tokens.map((token: Token, index) => ( - -
-
-
- {token.metadata && - token.metadata.normalized && - token.metadata.normalized.image ? ( - - ) : ( - - )} -
-
-

- {token.metadata && token.metadata.normalized - ? token.metadata.normalized.name - : token.token_id} -

-

- {token.contract_address} -

-
-
-
- - ))} -
-
- ); -}; - -export default Portfolio; diff --git a/apps/example/src/app/marketplace/portfolio/page.tsx b/apps/example/src/app/marketplace/portfolio/page.tsx deleted file mode 100644 index f4d3427d5..000000000 --- a/apps/example/src/app/marketplace/portfolio/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -"use client"; - -import PortFolio from "./components/Portfolio"; - -export default function Home() { - return ; -} diff --git a/apps/example/src/app/page.tsx b/apps/example/src/app/page.tsx deleted file mode 100644 index ca5201f8f..000000000 --- a/apps/example/src/app/page.tsx +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import Image from "next/image"; -import Link from "next/link"; - -import { cn } from "@/lib/utils"; -import { Announcement } from "@/components/announcement"; -import { - PageActions, - PageHeader, - PageHeaderDescription, - PageHeaderHeading -} from "@/components/page-header"; -import { buttonVariants } from "@/components/ui/Button"; - -export default function Home() { - return ( - <> - - - - Ark Project: React SDK Demo - - Examples - - Explore key features of the Ark Project with our React SDK demo. - Create, manage, and fulfill orders, mint testnet NFTs, and delve into - various transactions. Experience our SDK and API in a user-friendly - environment. - - - - Documentation - - - SDK Examples - - - - illustration - - ); -} diff --git a/apps/example/src/components/announcement.tsx b/apps/example/src/components/announcement.tsx deleted file mode 100644 index 419816207..000000000 --- a/apps/example/src/components/announcement.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { ArrowRightIcon } from "@radix-ui/react-icons"; -import Link from "next/link"; - -import { Separator } from "@/components/ui/separator"; - -export function Announcement() { - return ( - - 🎉 {" "} - New components and more. - New hooks, updates and more. - - - ); -} diff --git a/apps/example/src/components/authSwitcher.tsx b/apps/example/src/components/authSwitcher.tsx deleted file mode 100644 index 93e252139..000000000 --- a/apps/example/src/components/authSwitcher.tsx +++ /dev/null @@ -1,17 +0,0 @@ -"use client"; - -import React from "react"; - -import { useAccount } from "@starknet-react/core"; - -import Authentification from "@/components/authentification"; - -function AuthSwitcher(props: React.PropsWithChildren) { - const { account } = useAccount(); - if (account === undefined) return ; - - const { children } = props; - return
{children}
; -} - -export default AuthSwitcher; diff --git a/apps/example/src/components/authentification.tsx b/apps/example/src/components/authentification.tsx deleted file mode 100644 index 9164c2321..000000000 --- a/apps/example/src/components/authentification.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import React from "react"; - -import { useConnect } from "@starknet-react/core"; -import Image from "next/image"; - -import { Button } from "@/components/ui/Button"; - -function ConnectWallet() { - const { connectors, connect } = useConnect(); - return ( -
- {connectors.map((connector) => { - return ( - - ); - })} -
- ); -} - -const Authentification = () => { - return ( - <> -
- Authentication -
-
-
-
-
- - - -
ArkProject SDK
-
-
-
-

- “This SDK integrates the Ark Project core library for - efficient ArkProject transactions on ArkChain, enabling React - developers to access core functionalities with ease.” -

-
Ark Project
-
-
-
-
-
-
-

- Connect your wallet -

-

- Choose a starknet wallet to start with -

- -
-
-
-
- - ); -}; - -export default Authentification; diff --git a/apps/example/src/components/main-nav.tsx b/apps/example/src/components/main-nav.tsx deleted file mode 100644 index 22f9a1d5e..000000000 --- a/apps/example/src/components/main-nav.tsx +++ /dev/null @@ -1,72 +0,0 @@ -"use client"; - -import React from "react"; - -import Link from "next/link"; - -import { cn } from "@/lib/utils"; - -export function MainNav({ - className, - ...props -}: React.HTMLAttributes) { - return ( - - ); -} diff --git a/apps/example/src/components/media.tsx b/apps/example/src/components/media.tsx deleted file mode 100644 index fb96047d9..000000000 --- a/apps/example/src/components/media.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from "react"; - -type MediaProps = { - url: string; - name: string; -}; - -const Media = ({ url, name }: MediaProps) => { - const extension = url.split(".").pop(); - const imageUrl = url.replace(/\.mp4$/, ".jpg"); // Replace .mp4 with .jpg - - return extension === "mp4" ? ( - - ) : ( - // eslint-disable-next-line @next/next/no-img-element - {name - ); -}; - -export default Media; diff --git a/apps/example/src/components/mode-toggle.tsx b/apps/example/src/components/mode-toggle.tsx deleted file mode 100644 index 8af7f1a0a..000000000 --- a/apps/example/src/components/mode-toggle.tsx +++ /dev/null @@ -1,40 +0,0 @@ -"use client"; - -import * as React from "react"; - -import { MoonIcon, SunIcon } from "@radix-ui/react-icons"; -import { useTheme } from "next-themes"; - -import { Button } from "@/components/ui/Button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger -} from "@/components/ui/dropdown-menu"; - -export function ModeToggle() { - const { setTheme } = useTheme(); - return ( - - - - - - setTheme("light")}> - Light - - setTheme("dark")}> - Dark - - setTheme("system")}> - System - - - - ); -} diff --git a/apps/example/src/components/page-header.tsx b/apps/example/src/components/page-header.tsx deleted file mode 100644 index 018bdd2c3..000000000 --- a/apps/example/src/components/page-header.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import React from "react"; - -import Balance from "react-wrap-balancer"; - -import { cn } from "@/lib/utils"; - -function PageHeader({ - className, - children, - ...props -}: React.HTMLAttributes) { - return ( -
- {children} -
- ); -} - -function PageHeaderHeading({ - className, - ...props -}: React.HTMLAttributes) { - return ( -

- ); -} - -function PageHeaderDescription({ - className, - ...props -}: React.HTMLAttributes) { - return ( - - ); -} - -function PageActions({ - className, - ...props -}: React.HTMLAttributes) { - return ( -
- ); -} - -export { PageHeader, PageHeaderHeading, PageHeaderDescription, PageActions }; diff --git a/apps/example/src/components/recent-sales.tsx b/apps/example/src/components/recent-sales.tsx deleted file mode 100644 index c1448399b..000000000 --- a/apps/example/src/components/recent-sales.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; - -export function RecentSales() { - return ( -
-
- - - OM - -
-

Olivia Martin

-

- olivia.martin@email.com -

-
-
+$1,999.00
-
-
- - - JL - -
-

Jackson Lee

-

jackson.lee@email.com

-
-
+$39.00
-
-
- - - IN - -
-

Isabella Nguyen

-

- isabella.nguyen@email.com -

-
-
+$299.00
-
-
- - - WK - -
-

William Kim

-

will@email.com

-
-
+$99.00
-
-
- - - SD - -
-

Sofia Davis

-

sofia.davis@email.com

-
-
+$39.00
-
-
- ); -} diff --git a/apps/example/src/components/starknet-provider.tsx b/apps/example/src/components/starknet-provider.tsx deleted file mode 100644 index 621cf38cc..000000000 --- a/apps/example/src/components/starknet-provider.tsx +++ /dev/null @@ -1,44 +0,0 @@ -"use client"; - -import { ReactNode } from "react"; -import * as React from "react"; - -import { mainnet, sepolia } from "@starknet-react/chains"; -import { - argent, - braavos, - jsonRpcProvider, - StarknetConfig, - useInjectedConnectors, - voyager -} from "@starknet-react/core"; - -function rpc() { - return { - nodeUrl: `https://starknet-mainnet.public.blastapi.io/rpc/v0_6` - }; -} - -export function StarknetProvider({ children }: { children: ReactNode }) { - const provider = jsonRpcProvider({ rpc }); - const { connectors } = useInjectedConnectors({ - // Show these connectors if the user has no connector installed. - recommended: [argent(), braavos()], - // Hide recommended connectors if the user has any connector installed. - includeRecommended: "onlyIfNoConnectors", - // Randomize the order of the connectors. - order: "alphabetical" - }); - - return ( - - {children} - - ); -} diff --git a/apps/example/src/components/theme-provider.tsx b/apps/example/src/components/theme-provider.tsx deleted file mode 100644 index 37a6774d3..000000000 --- a/apps/example/src/components/theme-provider.tsx +++ /dev/null @@ -1,10 +0,0 @@ -"use client"; - -import * as React from "react"; - -import { ThemeProvider as NextThemesProvider } from "next-themes"; -import { type ThemeProviderProps } from "next-themes/dist/types"; - -export function ThemeProvider({ children, ...props }: ThemeProviderProps) { - return {children}; -} diff --git a/apps/example/src/components/ui/Button.tsx b/apps/example/src/components/ui/Button.tsx deleted file mode 100644 index cf025583e..000000000 --- a/apps/example/src/components/ui/Button.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import * as React from "react"; - -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/lib/utils"; - -const buttonVariants = cva( - "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", - { - variants: { - variant: { - default: - "bg-primary text-primary-foreground shadow hover:bg-primary/90", - destructive: - "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90", - outline: - "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground", - secondary: - "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline" - }, - size: { - default: "h-9 px-4 py-2", - sm: "h-8 rounded-md px-3 text-xs", - lg: "h-10 rounded-md px-8", - icon: "h-9 w-9" - } - }, - defaultVariants: { - variant: "default", - size: "default" - } - } -); - -export interface ButtonProps - extends React.ButtonHTMLAttributes, - VariantProps { - asChild?: boolean; -} - -const Button = React.forwardRef( - ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button"; - return ( - - ); - } -); -Button.displayName = "Button"; - -export { Button, buttonVariants }; diff --git a/apps/example/src/components/ui/avatar.tsx b/apps/example/src/components/ui/avatar.tsx deleted file mode 100644 index f012f6f6e..000000000 --- a/apps/example/src/components/ui/avatar.tsx +++ /dev/null @@ -1,51 +0,0 @@ -"use client"; - -import * as React from "react"; - -import * as AvatarPrimitive from "@radix-ui/react-avatar"; - -import { cn } from "@/lib/utils"; - -const Avatar = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -Avatar.displayName = AvatarPrimitive.Root.displayName; - -const AvatarImage = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AvatarImage.displayName = AvatarPrimitive.Image.displayName; - -const AvatarFallback = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; - -export { Avatar, AvatarImage, AvatarFallback }; diff --git a/apps/example/src/components/ui/badge.tsx b/apps/example/src/components/ui/badge.tsx deleted file mode 100644 index e11d72054..000000000 --- a/apps/example/src/components/ui/badge.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import * as React from "react"; - -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/lib/utils"; - -const badgeVariants = cva( - "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", - { - variants: { - variant: { - default: - "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80", - secondary: - "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", - destructive: - "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80", - outline: "text-foreground" - } - }, - defaultVariants: { - variant: "default" - } - } -); - -export interface BadgeProps - extends React.HTMLAttributes, - VariantProps {} - -function Badge({ className, variant, ...props }: BadgeProps) { - return ( -
- ); -} - -export { Badge, badgeVariants }; diff --git a/apps/example/src/components/ui/card.tsx b/apps/example/src/components/ui/card.tsx deleted file mode 100644 index d0c5b41c7..000000000 --- a/apps/example/src/components/ui/card.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import * as React from "react"; - -import { cn } from "@/lib/utils"; - -const Card = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)); -Card.displayName = "Card"; - -const CardHeader = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)); -CardHeader.displayName = "CardHeader"; - -const CardTitle = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); -CardTitle.displayName = "CardTitle"; - -const CardDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); -CardDescription.displayName = "CardDescription"; - -const CardContent = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); -CardContent.displayName = "CardContent"; - -const CardFooter = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)); -CardFooter.displayName = "CardFooter"; - -export { - Card, - CardHeader, - CardFooter, - CardTitle, - CardDescription, - CardContent -}; diff --git a/apps/example/src/components/ui/checkbox.tsx b/apps/example/src/components/ui/checkbox.tsx deleted file mode 100644 index a6784a74c..000000000 --- a/apps/example/src/components/ui/checkbox.tsx +++ /dev/null @@ -1,31 +0,0 @@ -"use client"; - -import * as React from "react"; - -import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; -import { CheckIcon } from "@radix-ui/react-icons"; - -import { cn } from "@/lib/utils"; - -const Checkbox = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - - - -)); -Checkbox.displayName = CheckboxPrimitive.Root.displayName; - -export { Checkbox }; diff --git a/apps/example/src/components/ui/command.tsx b/apps/example/src/components/ui/command.tsx deleted file mode 100644 index 881498476..000000000 --- a/apps/example/src/components/ui/command.tsx +++ /dev/null @@ -1,156 +0,0 @@ -"use client"; - -import * as React from "react"; - -import { type DialogProps } from "@radix-ui/react-dialog"; -import { MagnifyingGlassIcon } from "@radix-ui/react-icons"; -import { Command as CommandPrimitive } from "cmdk"; - -import { cn } from "@/lib/utils"; -import { Dialog, DialogContent } from "@/components/ui/dialog"; - -const Command = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -Command.displayName = CommandPrimitive.displayName; - -interface CommandDialogProps extends DialogProps {} - -const CommandDialog = ({ children, ...props }: CommandDialogProps) => { - return ( - - - - {children} - - - - ); -}; - -const CommandInput = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( -
- - -
-)); - -CommandInput.displayName = CommandPrimitive.Input.displayName; - -const CommandList = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -CommandList.displayName = CommandPrimitive.List.displayName; - -const CommandEmpty = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->((props, ref) => ( - -)); - -CommandEmpty.displayName = CommandPrimitive.Empty.displayName; - -const CommandGroup = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -CommandGroup.displayName = CommandPrimitive.Group.displayName; - -const CommandSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -CommandSeparator.displayName = CommandPrimitive.Separator.displayName; - -const CommandItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -CommandItem.displayName = CommandPrimitive.Item.displayName; - -const CommandShortcut = ({ - className, - ...props -}: React.HTMLAttributes) => { - return ( - - ); -}; -CommandShortcut.displayName = "CommandShortcut"; - -export { - Command, - CommandDialog, - CommandInput, - CommandList, - CommandEmpty, - CommandGroup, - CommandItem, - CommandShortcut, - CommandSeparator -}; diff --git a/apps/example/src/components/ui/dialog.tsx b/apps/example/src/components/ui/dialog.tsx deleted file mode 100644 index 947a0aa0a..000000000 --- a/apps/example/src/components/ui/dialog.tsx +++ /dev/null @@ -1,123 +0,0 @@ -"use client"; - -import * as React from "react"; - -import * as DialogPrimitive from "@radix-ui/react-dialog"; -import { Cross2Icon } from "@radix-ui/react-icons"; - -import { cn } from "@/lib/utils"; - -const Dialog = DialogPrimitive.Root; - -const DialogTrigger = DialogPrimitive.Trigger; - -const DialogPortal = DialogPrimitive.Portal; - -const DialogClose = DialogPrimitive.Close; - -const DialogOverlay = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; - -const DialogContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - {children} - - - Close - - - -)); -DialogContent.displayName = DialogPrimitive.Content.displayName; - -const DialogHeader = ({ - className, - ...props -}: React.HTMLAttributes) => ( -
-); -DialogHeader.displayName = "DialogHeader"; - -const DialogFooter = ({ - className, - ...props -}: React.HTMLAttributes) => ( -
-); -DialogFooter.displayName = "DialogFooter"; - -const DialogTitle = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DialogTitle.displayName = DialogPrimitive.Title.displayName; - -const DialogDescription = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DialogDescription.displayName = DialogPrimitive.Description.displayName; - -export { - Dialog, - DialogPortal, - DialogOverlay, - DialogTrigger, - DialogClose, - DialogContent, - DialogHeader, - DialogFooter, - DialogTitle, - DialogDescription -}; diff --git a/apps/example/src/components/ui/dropdown-menu.tsx b/apps/example/src/components/ui/dropdown-menu.tsx deleted file mode 100644 index 1ee34a840..000000000 --- a/apps/example/src/components/ui/dropdown-menu.tsx +++ /dev/null @@ -1,206 +0,0 @@ -"use client"; - -import * as React from "react"; - -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; -import { - CheckIcon, - ChevronRightIcon, - DotFilledIcon -} from "@radix-ui/react-icons"; - -import { cn } from "@/lib/utils"; - -const DropdownMenu = DropdownMenuPrimitive.Root; - -const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; - -const DropdownMenuGroup = DropdownMenuPrimitive.Group; - -const DropdownMenuPortal = DropdownMenuPrimitive.Portal; - -const DropdownMenuSub = DropdownMenuPrimitive.Sub; - -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; - -const DropdownMenuSubTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean; - } ->(({ className, inset, children, ...props }, ref) => ( - - {children} - - -)); -DropdownMenuSubTrigger.displayName = - DropdownMenuPrimitive.SubTrigger.displayName; - -const DropdownMenuSubContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DropdownMenuSubContent.displayName = - DropdownMenuPrimitive.SubContent.displayName; - -const DropdownMenuContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, sideOffset = 4, ...props }, ref) => ( - - - -)); -DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; - -const DropdownMenuItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean; - } ->(({ className, inset, ...props }, ref) => ( - -)); -DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; - -const DropdownMenuCheckboxItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => ( - - - - - - - {children} - -)); -DropdownMenuCheckboxItem.displayName = - DropdownMenuPrimitive.CheckboxItem.displayName; - -const DropdownMenuRadioItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - - - - {children} - -)); -DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName; - -const DropdownMenuLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean; - } ->(({ className, inset, ...props }, ref) => ( - -)); -DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName; - -const DropdownMenuSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName; - -const DropdownMenuShortcut = ({ - className, - ...props -}: React.HTMLAttributes) => { - return ( - - ); -}; -DropdownMenuShortcut.displayName = "DropdownMenuShortcut"; - -export { - DropdownMenu, - DropdownMenuTrigger, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuShortcut, - DropdownMenuGroup, - DropdownMenuPortal, - DropdownMenuSub, - DropdownMenuSubContent, - DropdownMenuSubTrigger, - DropdownMenuRadioGroup -}; diff --git a/apps/example/src/components/ui/form.tsx b/apps/example/src/components/ui/form.tsx deleted file mode 100644 index 231063079..000000000 --- a/apps/example/src/components/ui/form.tsx +++ /dev/null @@ -1,178 +0,0 @@ -import * as React from "react"; - -import * as LabelPrimitive from "@radix-ui/react-label"; -import { Slot } from "@radix-ui/react-slot"; -import { - Controller, - ControllerProps, - FieldPath, - FieldValues, - FormProvider, - useFormContext -} from "react-hook-form"; - -import { cn } from "@/lib/utils"; -import { Label } from "@/components/ui/label"; - -const Form = FormProvider; - -type FormFieldContextValue< - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath -> = { - name: TName; -}; - -const FormFieldContext = React.createContext( - {} as FormFieldContextValue -); - -const FormField = < - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath ->({ - ...props -}: ControllerProps) => { - return ( - - - - ); -}; - -const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext); - const itemContext = React.useContext(FormItemContext); - const { getFieldState, formState } = useFormContext(); - - const fieldState = getFieldState(fieldContext.name, formState); - - if (!fieldContext) { - throw new Error("useFormField should be used within "); - } - - const { id } = itemContext; - - return { - id, - name: fieldContext.name, - formItemId: `${id}-form-item`, - formDescriptionId: `${id}-form-item-description`, - formMessageId: `${id}-form-item-message`, - ...fieldState - }; -}; - -type FormItemContextValue = { - id: string; -}; - -const FormItemContext = React.createContext( - {} as FormItemContextValue -); - -const FormItem = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => { - const id = React.useId(); - - return ( - -
- - ); -}); -FormItem.displayName = "FormItem"; - -const FormLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField(); - - return ( -