diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index e6538b795..000000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -/dist -/.vercel -/src/**/*.scss -/.yarn diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index cec6b0835..000000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - env: { - browser: true, - es2021: true, - node: true, - }, - extends: ['standard', 'prettier'], - parserOptions: { - ecmaVersion: 13, - sourceType: 'module', - }, - ignorePatterns: ['src/**/*.scss'], - rules: {}, -} diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 11fa51e13..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Bug report -description: Create a report to help us improve -title: '[BUG] ' -labels: [bug] -body: - - type: textarea - id: subject - attributes: - label: Problem subject - description: Use one of the following boxes. If none of them apply, please specify. - placeholder: | - - [ ] Contracts - - [ ] Tests - - [ ] Documentation - - [ ] Other (please specify) - validations: - required: false - - type: textarea - id: description - attributes: - label: Description - description: Please write what problem/bug you are experiencing or want to report. - validations: - required: true - - type: textarea - id: expectedbhv - attributes: - label: Expected behavior/contents - description: Please write here the expected behavior/contents - validations: - required: true - - type: textarea - id: actualbhv - attributes: - label: Actual behavior/contents - description: Please write here the actual behavior/contents - validations: - required: false - - type: checkboxes - id: coc - attributes: - label: Code of Conduct - description: By submitting this issue, I confirm I've read and complied with the [CoC](https://github.com/dev-protocol/community/blob/main/CODE_OF_CONDUCT.md) 🖖 - options: - - label: I agree to follow this project's Code of Conduct - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 957325d31..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,8 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: E-mail contact - url: mailto:hi@devprotocol.xyz - about: Feel free to mail us regarding any issue or something related to Dev Protocol. - - name: Discord community - url: https://discord.gg/VwJp4KM - about: Contact us via our Discord community. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index b89e4f7ab..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Feature request -description: Suggest features, propose improvements, discuss new ideas. -title: '[FEATURE] ' -labels: [enhancement] -body: - - type: markdown - attributes: - value: Provide a general summary of the issue in the title above - - type: textarea - id: description - attributes: - label: Detailed description - description: Provide a detailed description of the change or addition you are proposing - validations: - required: true - - type: textarea - id: context - attributes: - label: Context - description: | - Why is this change important to you? How would you use it? - How can it benefit other users? - validations: - required: true - - type: textarea - id: possibleimpl - attributes: - label: Possible implementation - description: Not obligatory, but suggest an idea for implementing addition or change - validations: - required: false - - type: textarea - id: extrainformation - attributes: - label: Additional information - description: Is there anything else we should know about this feature? - validations: - required: false - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/dev-protocol/community/blob/main/CODE_OF_CONDUCT.md) - options: - - label: I agree to follow this project's Code of Conduct - required: true diff --git a/.github/ISSUE_TEMPLATE/other.yml b/.github/ISSUE_TEMPLATE/other.yml deleted file mode 100644 index d8ac8e29b..000000000 --- a/.github/ISSUE_TEMPLATE/other.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Other -description: Use this for any other issues. PLEASE do not create blank issues -title: '[OTHER]' -labels: ['awaiting triage'] -body: - - type: markdown - attributes: - value: '# Other issue' - - type: textarea - id: issuedescription - attributes: - label: What would you like to share? - description: Provide a clear and concise explanation of your issue. - validations: - required: true - - type: textarea - id: extrainfo - attributes: - label: Additional information - description: Is there anything else we should know about this issue? - validations: - required: false - - type: checkboxes - id: consent - attributes: - label: Would you like to work on this issue? - options: - - label: Yes, I want to work on this issue! - required: false - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/dev-protocol/community/blob/main/CODE_OF_CONDUCT.md) - options: - - label: I agree to follow this project's Code of Conduct - required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 6b982e4e2..000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,25 +0,0 @@ -#### Description of the change - - - - - -#### Screenshots - - - -#### Checklist - -**I agree to the following :-** - -- [ ] Added description of the change -- [ ] I've read the [contributing guidelines](https://github.com/WebXDAO/devprotocol.xyz/blob/main/CONTRIBUTING.md) -- [ ] Search previous suggestions before making a new PR, as yours may be a duplicate. -- [ ] I acknowledge that all my contributions will be made under the project's license. - -Notes (**optional**): diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml deleted file mode 100644 index 6f1bd03a1..000000000 --- a/.github/workflows/deploy-preview.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Deploy - Preview - -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - -on: - workflow_run: - workflows: ['Build'] - branches: [main] - types: - - completed - -jobs: - Deploy: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: use yarn - run: corepack enable - - - name: Install Vercel CLI - run: npm install --global vercel@latest - - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Project Artifacts - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy - id: deploy - run: | - output=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}) - echo "::set-output name=url::$output" - shell: bash - - - name: Alias Prerelease - run: vercel alias ${{ steps.deploy.outputs.url }} prerelease.clubs.place --token=${{ secrets.VERCEL_TOKEN }} --scope devprtcl - - - name: Alias Wildcare Prerelease - run: vercel alias ${{ steps.deploy.outputs.url }} *.prerelease.clubs.place --token=${{ secrets.VERCEL_TOKEN }} --scope devprtcl diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index cd640971a..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Deploy - Live - -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - -on: - release: - types: [published] - -jobs: - Check: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] - outputs: - isPrerelease: ${{ steps.check.outputs.isPrerelease }} - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: use yarn - run: corepack enable - - - name: Install Vercel CLI - run: npm install --global vercel@latest - - name: Check if pre-release - id: check - run: | - IS_PRERELEASE=$(curl --silent --show-error \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}" \ - | jq '.prerelease') - echo "::set-output name=isPrerelease::$IS_PRERELEASE" - - Deploy: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] - needs: Check - if: needs.Check.outputs.isPrerelease != 'true' - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: use yarn - run: corepack enable - - - name: Install Vercel CLI - run: npm install --global vercel@latest - - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 18545181c..000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Stale issues - -on: - schedule: - - cron: '30 1 * * *' - -jobs: - stale: - runs-on: ubuntu-latest - - steps: - - uses: actions/stale@main - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' - days-before-stale: 60 - days-before-close: 7 diff --git a/.preview/config.ts b/.preview/config.ts new file mode 100644 index 000000000..bdc7a8fa2 --- /dev/null +++ b/.preview/config.ts @@ -0,0 +1,23 @@ +import { encode } from '@devprotocol/clubs-core' + +export default () => + encode({ + name: 'Debug', + twitterHandle: '@debug', + description: '', + url: '', + propertyAddress: '', + chainId: 137, + rpcUrl: 'https://polygon-rpc.com/', + adminRolePoints: 50, + plugins: [ + { + id: 'example-theme', + options: [], + }, + { + id: 'devprotocol:clubs:plugin:clubs-payments', + options: [], + }, + ], + }) diff --git a/.preview/plugins.ts b/.preview/plugins.ts new file mode 100644 index 000000000..5feea4357 --- /dev/null +++ b/.preview/plugins.ts @@ -0,0 +1,4 @@ +import theme from './theme' +import thisPlugin from '../src/index' + +export default [theme, thisPlugin] diff --git a/.preview/preview.ssr/astro.config.mjs b/.preview/preview.ssr/astro.config.mjs new file mode 100644 index 000000000..d657c8a01 --- /dev/null +++ b/.preview/preview.ssr/astro.config.mjs @@ -0,0 +1,13 @@ +import { defineConfig } from 'astro/config' +import clubs from '@devprotocol/clubs-core' +import vue from '@astrojs/vue' +import svelte from '@astrojs/svelte' +import tailwind from '@astrojs/tailwind' +import { config } from 'dotenv' + +config({ path: './.env' }) + +export default defineConfig({ + output: 'server', + integrations: [clubs(), vue(), svelte(), tailwind()], +}) diff --git a/.preview/preview.ssr/src/env.d.ts b/.preview/preview.ssr/src/env.d.ts new file mode 100644 index 000000000..e118f9d7b --- /dev/null +++ b/.preview/preview.ssr/src/env.d.ts @@ -0,0 +1,6 @@ +/// + +declare module '*.astro' { + import type { AstroComponentFactory } from 'astro/dist/runtime/server' + export default InstanceType +} diff --git a/.preview/preview.ssr/src/pages/[...page].astro b/.preview/preview.ssr/src/pages/[...page].astro new file mode 100644 index 000000000..94047ba6e --- /dev/null +++ b/.preview/preview.ssr/src/pages/[...page].astro @@ -0,0 +1,39 @@ +--- +import type { InferGetStaticPropsType } from 'astro' +import { + type ClubsFunctionFactoryOptions, + type ClubsFunctionPageFactoryResult, + type ClubsGetStaticPathsItem, + pageFactory, + routerFactory, +} from '@devprotocol/clubs-core' +import type { UndefinedOr } from '@devprotocol/util-ts' +import config from '../../../config' +import plugins from '../../../plugins' + +const { page } = Astro.params +const options = { + config, + plugins, +} satisfies ClubsFunctionFactoryOptions + +const { getStaticPaths } = pageFactory( + options, +) as ClubsFunctionPageFactoryResult + +const router = routerFactory(await getStaticPaths(), (p) => p.params.page) +const path = router(page) as UndefinedOr< + ClubsGetStaticPathsItem> +> + +const Content = path?.props.component +const Layout = path?.props.layout +--- + +{ + Layout && Content && ( + + + + ) +} diff --git a/.preview/preview.ssr/src/pages/admin/[...page].astro b/.preview/preview.ssr/src/pages/admin/[...page].astro new file mode 100644 index 000000000..2db79c512 --- /dev/null +++ b/.preview/preview.ssr/src/pages/admin/[...page].astro @@ -0,0 +1,53 @@ +--- +import type { InferGetStaticPropsType } from 'astro' +import { + type ClubsFunctionAdminFactoryResult, + type ClubsFunctionFactoryOptions, + type ClubsGetStaticPathsItem, + adminFactory, + routerFactory, +} from '@devprotocol/clubs-core' +import type { UndefinedOr } from '@devprotocol/util-ts' +import { Admin } from '@devprotocol/clubs-core/layouts' +import config from '../../../../config' +import plugins from '../../../../plugins' + +const { page } = Astro.params +const options = { + config, + plugins, +} satisfies ClubsFunctionFactoryOptions + +const { getStaticPaths } = adminFactory( + options, +) as ClubsFunctionAdminFactoryResult + +const router = routerFactory(await getStaticPaths(), (p) => p.params.page) +const path = router(page) as UndefinedOr< + ClubsGetStaticPathsItem> +> + +const Content = path?.props.component +--- + +{ + Content && ( + + + + ) +} + + diff --git a/.preview/preview.ssr/src/pages/api/[...path].ts b/.preview/preview.ssr/src/pages/api/[...path].ts new file mode 100644 index 000000000..0fffce28b --- /dev/null +++ b/.preview/preview.ssr/src/pages/api/[...path].ts @@ -0,0 +1,8 @@ +import { apiFactory } from '@devprotocol/clubs-core' +import config from '../../../../config' +import plugins from '../../../../plugins' + +export const { ALL } = apiFactory({ + config, + plugins, +}) diff --git a/.preview/theme/Default.astro b/.preview/theme/Default.astro new file mode 100644 index 000000000..c588cde75 --- /dev/null +++ b/.preview/theme/Default.astro @@ -0,0 +1,17 @@ +--- +import '@devprotocol/clubs-core/styles' +--- + + + + + + + + + +
+ +
+ + diff --git a/.preview/theme/index.ts b/.preview/theme/index.ts new file mode 100644 index 000000000..a7a277447 --- /dev/null +++ b/.preview/theme/index.ts @@ -0,0 +1,34 @@ +import { + type ClubsFunctionGetAdminPaths, + type ClubsFunctionGetPagePaths, + type ClubsFunctionGetLayout, + type ClubsFunctionThemePlugin, + ClubsPluginCategory, + type ClubsThemePluginMeta, +} from '@devprotocol/clubs-core' +import { default as Default } from './Default.astro' + +export const getPagePaths = (async () => []) satisfies ClubsFunctionGetPagePaths + +export const getAdminPaths = + (async () => []) satisfies ClubsFunctionGetAdminPaths + +export const getLayout = (async () => ({ + layout: Default, +})) satisfies ClubsFunctionGetLayout + +export const meta = { + id: 'example-theme', + displayName: 'Example theme', + category: ClubsPluginCategory.Theme, + theme: { + previewImage: 'https://dummyimage.com/600x400/000/fff', + }, +} satisfies ClubsThemePluginMeta + +export default { + getPagePaths, + getAdminPaths, + getLayout, + meta, +} satisfies ClubsFunctionThemePlugin diff --git a/astro.config.mjs b/astro.config.mjs deleted file mode 100644 index fcfd2cdbb..000000000 --- a/astro.config.mjs +++ /dev/null @@ -1,82 +0,0 @@ -import { config } from 'dotenv' -import { defineConfig } from 'astro/config' -import clubs from '@devprotocol/clubs-core' -import vercel from '@astrojs/vercel/serverless' -import tailwind from '@astrojs/tailwind' -import lit from '@astrojs/lit' -import vue from '@astrojs/vue' -import react from '@astrojs/react' -import svelte from '@astrojs/svelte' -// import commonjs from '@rollup/plugin-commonjs' - -import builtInApiPaths from './built-in-api-paths' - -config() - -const singleMode = ((i) => (i > -1 ? process.argv[i + 1] : undefined))( - process.argv.findIndex((a) => a === '--club'), -) - -// https://astro.build/config -export default defineConfig({ - site: process.env.PUBLIC_SITE_URL, - server: { - port: 3000, - }, - output: 'server', - adapter: vercel(), - integrations: [ - clubs(), - { - name: 'clubs:multi-tenant', - hooks: { - 'astro:server:setup': ({ server }) => { - server.middlewares.use((req, _, next) => { - if ( - req.headers.accept?.includes('text/html') || - (req.url.startsWith('/api/') && - builtInApiPaths.every((p) => !req.url.startsWith(p))) - ) { - const host = req.headers.host.split('.') - - if (host.length > 1 || singleMode) { - req.url = `/sites_/${singleMode ?? host[0]}${req.url}` - } - } - - next() - }) - }, - }, - }, - lit(), - vue(), - react(), - tailwind({ applyBaseStyles: false }), - svelte(), - ], - vite: { - ssr: { noExternal: ['path-to-regexp'] }, - build: { sourcemap: true }, - plugins: [ - // commonjs({ - // requireReturnsDefault: (id) => { - // return id.includes('qrcode') - // }, - // }), - ], - server: { - hmr: { - timeout: 360000, - }, - }, - resolve: { - alias: { - 'three/examples/jsm/controls/OrbitControls': - '/node_modules/three/examples/jsm/controls/OrbitControls', - '@crossmint/client-sdk-react-ui/package.json': - '/node_modules/@crossmint/client-sdk-react-ui/package.json', - }, - }, - }, -}) diff --git a/built-in-api-paths.js b/built-in-api-paths.js deleted file mode 100644 index 027d8ba2c..000000000 --- a/built-in-api-paths.js +++ /dev/null @@ -1,20 +0,0 @@ -export default [ - '/api/verifySiteName', - '/api/updateDraftConfig', - '/api/updateConfig', - '/api/superuser', - '/api/stats', - '/api/profile', - '/api/plugins', - '/api/mock', - '/api/hasCreationLimitReached', - '/api/fetchClubs', - '/api/encrypt', - '/api/decrypt', - '/api/cron', - '/api/config', - '/api/clubs', - '/api/authenticate', - '/api/assets', - '/api/addDaoToDraft', -] diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..e375d050d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,43 @@ +import eslint from '@eslint/js' +import tseslint from 'typescript-eslint' +import prettier from 'eslint-config-prettier' +import functional from 'eslint-plugin-functional' +import globals from 'globals' + +export default tseslint.config( + { + files: ['**/*.{ts,tsx,mts}'], + extends: [ + eslint.configs.recommended, + ...tseslint.configs.recommended, + functional.configs.recommended, + prettier, + ], + languageOptions: { + parser: tseslint.parser, + parserOptions: { + projectService: true, + }, + globals: { ...globals.browser, ...globals.node }, + }, + rules: { + 'functional/prefer-immutable-types': 'warn', + 'no-unused-vars': 'off', + 'functional/functional-parameters': 'warn', + 'functional/no-expression-statements': [ + 'error', + { + ignoreCodePattern: ['^console.'], + }, + ], + }, + }, + { + files: ['**/*.test.ts', '**/*.{js,mjs,cjs}'], + extends: [functional.configs.off], + rules: { + '@typescript-eslint/no-explicit-any': 'off', + }, + }, + { ignores: ['dist', '.yarn'] }, +) diff --git a/middleware.ts b/middleware.ts deleted file mode 100644 index ee2f1e9c7..000000000 --- a/middleware.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { rewrite, next } from '@vercel/edge' -import builtInApiPaths from './built-in-api-paths' - -const hosts = (process.env.HOSTS ?? 'clubs.place') - .split(',') - .map((x) => x.trim()) - .sort((a, b) => (a.split('.').length < b.split('.').length ? 0 : -1)) - -export const config = { - matcher: ['/((?!_astro).*)'], -} - -const redirects = [ - ...hosts.map((host) => ({ - host, - matchers: [ - '/', - new RegExp( - '^/(starter|ticketing|plugins|dev-tokens|blog|post|pricing)(|/.*)$', - ), - ], - destination: 'https://www.clubs.place', - })), - { - host: 'temples.clubs.stakes.social', - matchers: undefined, - destination: 'https://temples.clubs.place', - }, - { - host: 'kougenji.clubs.stakes.social', - matchers: undefined, - destination: 'https://kougenji.clubs.place', - }, -] - -export default function middleware(req: Request) { - const url = new URL(req.url) - - const matchToRedirects = redirects.find( - ({ host, matchers }) => - host === url.host && - (matchers - ? matchers.some((matcher) => - typeof matcher === 'string' - ? matcher === url.pathname - : matcher.test(url.pathname), - ) - : true), - ) - - if (matchToRedirects) { - return Response.redirect( - new URL( - `${url.pathname}${url.search ? url.search : ''}`, - matchToRedirects.destination, - ), - ) - } - - const hostnames = url.host.split('.') ?? [] - const [tenant] = hostnames - const api = url.pathname.startsWith('/api/') - const html = - !api && - (req.headers.get('accept')?.includes('text/html') || - url.pathname - .split('/') - .slice(-1) - .every((p) => !/\..+$/.test(p))) - const bInApi = builtInApiPaths.some((p) => url.pathname.startsWith(p)) - const pInApi = api && !bInApi - - const primaryHost = - hosts.find((h) => url.host === h) ?? hosts.find((h) => url.host.endsWith(h)) - - if ((html || pInApi) && primaryHost && url.host !== primaryHost) { - const destination = new URL(url.href) - destination.pathname = `/sites_/${tenant}${url.pathname}` - destination.host = primaryHost - console.log({ destination: destination.toString() }) - return rewrite(destination) - } - - if (primaryHost) { - const destination = new URL(url.href) - destination.host = primaryHost - console.log({ destination: destination.toString() }) - return rewrite(destination) - } - - return next() -} diff --git a/package.json b/package.json index 7f2bc70ca..9f996406d 100644 --- a/package.json +++ b/package.json @@ -1,139 +1,72 @@ { - "name": "clubs", - "version": "0.24.0-beta.14", - "private": true, + "name": "@devprotocol/clubs-plugin-payments", + "version": "0.0.1", "type": "module", "scripts": { - "dev": "astro dev", - "test": "vitest run", - "start": "astro dev", - "build": "astro build", - "preview": "astro preview", - "lint": "yarn lint:eslint && yarn lint:prettier", - "lint:eslint": "eslint --fix \"**/*.{js,mjs,cjs}\"", - "lint:prettier": "prettier --cache -w \"**/*.{js,mjs,cjs,ts,tsx,tsm,astro,vue,svelte}\"", - "typecheck": "astro check && tsc --noEmit && svelte-check && vue-tsc --noEmit --p tsconfig.vue.json", + "test": "vitest", + "preview": "astro --root .preview/preview.ssr dev", + "build": "rollup -c", + "prebuild": "rimraf dist", + "lint": "yarn lint:eslint && yarn lint:format", + "lint:eslint": "eslint . --fix", + "lint:format": "prettier --write '**/*.{ts,js,tsx,jsx,astro,vue,svelte,json,md,yml}'", + "prepack": "yarn test && yarn build", "prepare": "husky", - "populate": "node ./scripts/populate/index.mjs", - "flushDb": "node ./scripts/flushDb.mjs", - "upgradeDb": "node ./scripts/upgrade.mjs", - "genApiPaths": "node ./scripts/generate-built-in-api-paths.mjs", - "copy": "node ./scripts/copy.mjs", - "migratePosts": "node ./scripts/upgrade-posts-v2.mjs" + "typecheck": "astro check && tsc --noEmit && svelte-check && vue-tsc --noEmit --p tsconfig.vue.json" }, "devDependencies": { - "@repeaterjs/repeater": "^3.0.5", - "@rollup/plugin-commonjs": "^26.0.0", - "@types/bad-words": "^3.0.3", - "@types/dompurify": "^3.0.2", + "@astrojs/check": "0.9.4", + "@astrojs/svelte": "5.7.2", + "@astrojs/tailwind": "5.1.1", + "@astrojs/vue": "4.5.2", + "@devprotocol/clubs-core": "3.21.1", + "@eslint/js": "^9.13.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/dotenv": "8.2.0", - "@types/human-number": "^1.0.2", - "@types/marked": "^6.0.0", + "@types/eslint__js": "^8.42.3", + "@types/jsonwebtoken": "^9.0.7", "@types/node": "^20.5.9", "@types/ramda": "0.30.2", "@types/react": "18.3.11", "@types/react-dom": "18.3.0", - "@types/textfit": "^2.4.5", - "@types/three": "0.161.2", "@types/uuid": "^10.0.0", + "astro": "4.16.1", "dotenv": "16.4.5", - "eslint": "8.57.1", - "eslint-config-prettier": "9.1.0", - "eslint-config-standard": "17.1.0", - "eslint-plugin-import": "2.31.0", - "eslint-plugin-n": "17.11.1", - "eslint-plugin-prettier": "5.2.1", - "eslint-plugin-promise": "7.1.0", - "fs-extra": "^11.1.1", - "glob": "^11.0.0", + "eslint": "^9.13.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-functional": "^7.1.0", + "ethers": "6.13.3", + "globals": "^15.11.0", "husky": "9.1.6", "prettier": "3.3.3", "prettier-plugin-astro": "0.14.1", "prettier-plugin-svelte": "3.2.7", "prettier-plugin-tailwindcss": "0.6.8", + "rollup": "^4.24.2", + "svelte": "4.2.19", "svelte-check": "^4.0.0", - "type-fest": "4.26.1", + "tailwindcss": "^3.3.3", "typescript": "5.5.4", - "vitest": "^1.0.0", + "typescript-eslint": "^8.11.0", + "vitest": "1.0.0", + "vue": "3.4.38", "vue-tsc": "^2.0.0" }, "dependencies": { - "@astrojs/check": "0.9.4", - "@astrojs/lit": "4.3.0", - "@astrojs/prefetch": "0.4.1", - "@astrojs/react": "3.6.2", - "@astrojs/svelte": "5.7.2", - "@astrojs/tailwind": "5.1.1", - "@astrojs/vercel": "7.8.1", - "@astrojs/vue": "4.5.2", - "@crossmint/client-sdk-base": "^1.0.1-alpha.6", - "@crossmint/client-sdk-react-ui": "^1.0.1-alpha.6", - "@devprotocol/clubs-core": "3.21.1", - "@devprotocol/clubs-plugin-awesome-onboarding": "0.5.1", - "@devprotocol/clubs-plugin-passport": "^0.1.0-beta.17", - "@devprotocol/clubs-plugin-posts": "0.20.17", - "@devprotocol/clubs-plugin-posts-voting": "0.8.8", "@devprotocol/dev-kit": "8.7.0", - "@devprotocol/hashi": "2.3.4", - "@devprotocol/huddle01-clubs-plugin": "0.1.7", - "@devprotocol/khaos-core": "^1.6.0", - "@devprotocol/khaos-kit": "^1.4.0", "@devprotocol/util-ts": "4.0.0", - "@kazu80/clubs-plugin-links": "1.0.1", - "@metamask/detect-provider": "2.0.0", - "@nanostores/react": "^0.7.2", - "@redis/json": "1.0.7", - "@sendgrid/mail": "8.1.3", - "@tailwindcss/aspect-ratio": "0.4.2", - "@tailwindcss/typography": "^0.5.10", - "@vercel/edge": "^1.1.1", - "@vue/composition-api": "1.7.2", - "@wagmi/core": "^1.4.1", - "@web3modal/wagmi": "3.5.7", - "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "4.16.1", - "autoprefixer": "10.4.20", - "bad-words": "^3.0.4", "bignumber.js": "9.1.2", - "boring-avatars-esm": "^1.10.1-1", "cross-fetch": "^4.0.0", "crypto-hash": "^3.0.0", - "dayjs": "^1.11.9", - "dompurify": "^3.0.5", - "ethers": "6.13.3", - "fast-average-color": "^9.4.0", - "firebase": "^10.3.1", - "firebase-admin": "^12.0.0", - "hex-rgb": "^5.0.0", - "human-number": "^2.0.4", - "js-base64": "^3.7.7", "jsonwebtoken": "^9.0.2", - "marked": "10.0.0", - "nanoid": "^5.0.5", - "nanostores": "^0.11.0", - "p-queue": "^8.0.0", - "postcss": "8.4.47", "ramda": "0.30.1", - "react": "18.3.1", - "react-dom": "18.3.1", - "redis": "4.7.0", - "rxjs": "7.8.1", - "sass": "1.77.8", - "svelte": "4.2.19", - "svelte-awesome-color-picker": "^3.1.4", - "svelte-modals": "^1.3.0", - "swiper": "11.1.14", - "swr": "^2.2.5", - "tailwindcss": "^3.3.3", - "textfit": "^2.4.0", - "three": "0.161.0", - "truncate-eth-address": "1.0.2", - "uuid": "^10.0.0", - "viem": "1.21.4", - "vue": "3.4.38", - "web3modal": "1.9.12" + "redis": "4.7.0" + }, + "peerDependencies": { + "@devprotocol/clubs-core": "^3.0.0", + "ethers": "^6.0.0" }, - "repository": "https://github.com/dev-protocol/clubs.git", + "repository": "https://github.com/dev-protocol/clubs-plugin-payments.git", "author": "", "license": "PolyForm Perimeter License 1.0.0", "packageManager": "yarn@4.5.0" diff --git a/postcss.config.cjs b/postcss.config.cjs deleted file mode 100644 index 4193e8ab5..000000000 --- a/postcss.config.cjs +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - plugins: [require('tailwindcss'), require('autoprefixer')], -} diff --git a/public/LightBlueGradient.png b/public/LightBlueGradient.png deleted file mode 100644 index 2eeaaea12..000000000 Binary files a/public/LightBlueGradient.png and /dev/null differ diff --git a/public/WhitePurpleAbstract.png b/public/WhitePurpleAbstract.png deleted file mode 100644 index fcfd897a0..000000000 Binary files a/public/WhitePurpleAbstract.png and /dev/null differ diff --git a/public/assets/bg-wizard.jpg b/public/assets/bg-wizard.jpg deleted file mode 100644 index bba2e390a..000000000 Binary files a/public/assets/bg-wizard.jpg and /dev/null differ diff --git a/public/assets/texture.jpg b/public/assets/texture.jpg deleted file mode 100644 index b088ff929..000000000 Binary files a/public/assets/texture.jpg and /dev/null differ diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index c2a49f4fb..000000000 --- a/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Allow: / diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 000000000..2cff58755 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,39 @@ +import { dirname, relative, resolve } from 'path' +import typescript from '@rollup/plugin-typescript' + +const dir = 'dist' + +const useSrc = ({ dir: _dir, ext } = {}) => ({ + name: 'local:useSrc', + resolveId(source, importer) { + if (ext.some((e) => source.endsWith(e))) { + const from = _dir ?? dirname(importer) + const importerDir = dirname(importer) + const original = resolve(importerDir, source) + const relativePath = relative(from, original) + return { + id: relativePath, + external: true, + } + } + }, +}) + +export default [ + { + input: 'src/index.ts', + output: [ + { + dir, + format: 'es', + }, + ], + plugins: [ + typescript(), + useSrc({ + ext: ['.astro', '.svelte', '.vue', '.scss', '.css', '.png', '.jpg'], + dir, + }), + ], + }, +] diff --git a/scripts/config-paid-features.mjs b/scripts/config-paid-features.mjs deleted file mode 100644 index fe9eaecb2..000000000 --- a/scripts/config-paid-features.mjs +++ /dev/null @@ -1,50 +0,0 @@ -/** - * ```bash - * node ./scripts/config-paid-features.mjs --club xxx - * ``` - */ - -import { upgrade } from './lib.upgrade.mjs' - -const KEY = ((i) => (i > -1 ? process.argv[i + 1] : undefined))( - process.argv.findIndex((a) => a === '--club'), -) - -console.log({ KEY }) - -const ID = { - CLUBSPAYMENTS: 'devprotocol:clubs:plugin:clubs-payments', - AWESOME_ONBOARDING: 'devprotocol:clubs:plugin:awesome-onboarding', - INVITATIONS: 'devprotocol:clubs:plugin:invitations', - ACHIEVEMENTS: 'devprotocol:clubs:plugin:achievements', -} - -const PLUGINS = Object.values(ID) - -const getOptions = (plugins) => (id) => - plugins.find(({ id: _id }) => id === _id)?.options || [] - -const app = () => { - upgrade((config) => { - const upgradedConfig = { ...config } - - /** - * Write upgrading script here - */ - - const options = getOptions(upgradedConfig.plugins) - upgradedConfig.plugins = [ - ...upgradedConfig.plugins.filter(({ id }) => - PLUGINS.every((x) => x !== id), - ), - { id: ID.CLUBSPAYMENTS, options: options(ID.CLUBSPAYMENTS) }, - { id: ID.AWESOME_ONBOARDING, options: options(ID.AWESOME_ONBOARDING) }, - { id: ID.INVITATIONS, options: options(ID.INVITATIONS) }, - { id: ID.ACHIEVEMENTS, options: options(ID.ACHIEVEMENTS) }, - ] - - return upgradedConfig - }, KEY) -} - -app() diff --git a/scripts/copy.mjs b/scripts/copy.mjs deleted file mode 100644 index af728192b..000000000 --- a/scripts/copy.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import fetch from 'cross-fetch' - -dotenv.config() - -const KEY = ((i) => (i > -1 ? process.argv[i + 1] : undefined))( - process.argv.findIndex((a) => a === '--club'), -) - -console.log({ KEY }) - -/** - * With running `yarn copy --club CLUB_TENANT_ID`, this script copies the ClubsConfiguration from the production environment. - */ -const app = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - const source = await fetch(`https://clubs.place/api/config/${KEY}`).then( - (data) => data.json(), - ) - console.log({ source }) - - await client.set(KEY, source.content) - console.log('Copied from production:', KEY) - - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error upgrading db: ', error) - } -} - -app() diff --git a/scripts/create-achievement.mjs b/scripts/create-achievement.mjs deleted file mode 100644 index b09a74e57..000000000 --- a/scripts/create-achievement.mjs +++ /dev/null @@ -1,67 +0,0 @@ -const KEY = 'test-mizu' -const SIGNATURE = - '0x79d3d8f3a524712e160a409b666c41f724cab196441a60e44abe6e8ed36c676f1bb6b69a85dbcd005274894e3488ae496d604745ac80a0e9f99086fe893826f91b' -const MESSAGE = `Create a new invitation` - -const main = async () => { - const res = await fetch( - `http://localhost:3000/sites_/${KEY}/api/devprotocol:clubs:plugin:achievements/achievements`, - { - method: 'POST', - body: JSON.stringify({ - achievement: { - contract: '0xAA821D4397B6253BF5d42a9e6B6AaE6B5C52723d', - conditions: { - recipients: [ - '0x57E21bd98612DE0Bd1723F4bf81A944eF7BfF526', - '0x3996D2AF9aa5bA6d38d569d5CD3894A201139e6D', - ], - }, - metadata: { - name: 'Debug', - description: 'debug', - image: 'https://i.imgur.com/xqJLFEE.png', - numberAttributes: [ - { - trait_type: 'NUM1', - display_type: 'number', - value: 0, - }, - { - trait_type: 'NUM2', - display_type: 'number', - value: 1, - }, - ], - stringAttributes: [ - { - trait_type: 'STR1', - value: 'X', - }, - { - trait_type: 'STR2', - value: 'Y', - }, - ], - }, - }, - signature: SIGNATURE, - message: MESSAGE, - }), - }, - ) - - const json = await res.json() - - if (res.status !== 200) { - console.log('failed json is: ', json) - throw new Error('Failed to create an invitation') - } - - console.log(`response is: `, json) -} - -main() - -// FBBXIh-xOF -// V-Diagh_-G diff --git a/scripts/create-invitation.mjs b/scripts/create-invitation.mjs deleted file mode 100644 index 4e3f66854..000000000 --- a/scripts/create-invitation.mjs +++ /dev/null @@ -1,41 +0,0 @@ -const KEY = 'pizza' -const MEMBERSHIP_PAYLOAD = new Uint8Array([ - 47, 255, 181, 254, 85, 225, 124, 168, -]) -const RECIPIENT = '0x95655AAe7F5079ac99d640F5b3633156b41E7108' -const SIGNATURE = - '0x79d3d8f3a524712e160a409b666c41f724cab196441a60e44abe6e8ed36c676f1bb6b69a85dbcd005274894e3488ae496d604745ac80a0e9f99086fe893826f91b' -const MESSAGE = `Create a new invitation` - -const main = async () => { - const res = await fetch( - `http://localhost:3000/sites_/${KEY}/api/devprotocol:clubs:plugin:invitations/invitations`, - { - method: 'POST', - body: JSON.stringify({ - membership: { - payload: MEMBERSHIP_PAYLOAD.toString(), - }, - conditions: { - recipients: [RECIPIENT], - }, - signature: SIGNATURE, - message: MESSAGE, - }), - }, - ) - - const json = await res.json() - - if (res.status !== 200) { - console.log('failed json is: ', json) - throw new Error('Failed to create an invitation') - } - - console.log(`new invitation id is: `, json.id) -} - -main() - -// FBBXIh-xOF -// V-Diagh_-G diff --git a/scripts/fill-clubs-documents.mjs b/scripts/fill-clubs-documents.mjs deleted file mode 100644 index bb15f4f16..000000000 --- a/scripts/fill-clubs-documents.mjs +++ /dev/null @@ -1,121 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { decode } from '@devprotocol/clubs-core' -import { Contract, isAddress, JsonRpcProvider, ZeroAddress } from 'ethers' -import { whenDefined } from '@devprotocol/util-ts' -import { scanOnlyClubs } from './lib.scanOnlyClubs.mjs' -import { always, tryCatch } from 'ramda' - -dotenv.config() - -const author = async (propertyAddress, rpcUrl) => { - return tryCatch( - (addr, rpc) => - new Contract( - addr, - ['function author() view returns(string)'], - new JsonRpcProvider(rpc), - ).author(), - always(undefined), - )(propertyAddress, rpcUrl) -} - -const app = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - // Run only when the key structure is changed - // // Remove all existing clubs documents first - // for await (const key of client.scanIterator({ - // MATCH: 'doc::clubs:clubs::*', - // COUNT: 1000, - // })) { - // if (key.startsWith('doc::clubs:clubs::')) { - // await client.del(key) - // console.log('Remove:', key) - // } else { - // console.log('Skip', key) - // continue - // } - // } - - let allClubs = [] - - // Fetch all clubs by existing enumrable key-value pairs - for await (const key of client.scanIterator({ - MATCH: 'id::*', - COUNT: 1000, - })) { - if (key.startsWith('id::')) { - const raw = await client.get(key) - const value = JSON.parse(raw) // Array<{ name: string, created: string }> - const id = key.replace('id::', '') - const valueWithId = value.map((v) => ({ ...v, id })) - allClubs = [...allClubs, ...valueWithId] - console.log('Get:', key) - } else { - console.log('Skip', key) - continue - } - } - - console.log({ allClubs }) - - for await (const key of scanOnlyClubs(client)) { - if (key.includes(':')) { - // This is not a ClubsConfiguration - console.log('Skip', key) - continue - } - - const encodedConfig = await client.get(key) - const decodedConfig = decode(encodedConfig) - const existingData = allClubs.filter((club) => club.name === key) - const ownerAddress = await (async (club) => { - const fromRedis = whenDefined(club, (c) => c.id) - const fromOnChain = !fromRedis - ? decodedConfig.propertyAddress && - decodedConfig.propertyAddress !== ZeroAddress - ? await author( - decodedConfig.propertyAddress, - decodedConfig.rpcUrl, - ).catch(always(undefined)) - : undefined - : undefined - return fromRedis || fromOnChain - })(existingData.find((x) => isAddress(x.id))) - const owner = existingData - ? { - address: ownerAddress, - firebaseUid: existingData.find((x) => !isAddress(x.id))?.id, - } - : undefined - const firstRecord = existingData - .sort((a, b) => (new Date(a.created) > new Date(b.created) ? 0 : -1)) - .at(0) - const value = { - id: key, - propertyAddress: decodedConfig.propertyAddress, - owner, - created_at: firstRecord ? new Date(firstRecord.created).getTime() : 0, - } - console.log(key, value) - await client.json.set(`doc::clubs:clubs::${key}`, '$', value) - - console.log('Set:', key) - } - - console.log('DB Upgraded') - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error upgrading db: ', error) - } -} - -app() diff --git a/scripts/flushDb.mjs b/scripts/flushDb.mjs deleted file mode 100644 index 6e0ff88cc..000000000 --- a/scripts/flushDb.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' - -dotenv.config() - -const flushDb = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - await client.flushAll() - - console.log('DB Flushed') - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error flushing db: ', error) - } -} - -flushDb() diff --git a/scripts/generate-built-in-api-paths.mjs b/scripts/generate-built-in-api-paths.mjs deleted file mode 100644 index e6a3cc09b..000000000 --- a/scripts/generate-built-in-api-paths.mjs +++ /dev/null @@ -1,56 +0,0 @@ -import { glob } from 'glob' -import { outputFileSync } from 'fs-extra/esm' -import { execSync } from 'child_process' - -const paths = await glob('src/pages/api/**/*') -console.log({ paths }) -/** - * `paths` will be like... - * [ - 'src/pages/api/verifySiteName', - 'src/pages/api/updateDraftConfig.ts', - 'src/pages/api/updateConfig.ts', - 'src/pages/api/stats.ts', - 'src/pages/api/profile', - 'src/pages/api/plugins', - 'src/pages/api/mock', - 'src/pages/api/hasCreationLimitReached', - 'src/pages/api/fetchClubs.ts', - 'src/pages/api/encrypt.ts', - 'src/pages/api/decrypt.ts', - 'src/pages/api/addDaoToDraft.ts', - 'src/pages/api/verifySiteName/[...site].ts', - 'src/pages/api/profile/index.ts', - 'src/pages/api/profile/[id].ts', - 'src/pages/api/plugins/installablePlugins.ts', - 'src/pages/api/plugins/index.ts', - 'src/pages/api/plugins/addPluginToClub.ts', - 'src/pages/api/mock/access-control.ts', - 'src/pages/api/hasCreationLimitReached/util.ts', - 'src/pages/api/hasCreationLimitReached/[...identifier].ts' - ] - */ - -const firstPaths = Array.from( - // Exclude duplicates with Set - new Set( - paths - // Remove src/pages/api/ - .map((path) => path.replace('src/pages/api/', '')) - // Remove extensions - .map((path) => path.replace(/\.(.+)$/, '')) - // Remove deep paths - .map((path) => path.split('/')[0]), - ), -) -console.log({ firstPaths }) - -const builtInApiPaths = firstPaths.map((path) => `/api/${path}`) -console.log({ builtInApiPaths }) - -outputFileSync( - 'built-in-api-paths.js', - `export default ${JSON.stringify(builtInApiPaths)}`, -) - -execSync('npx prettier -w built-in-api-paths.js') diff --git a/scripts/lib.scanOnlyClubs.mjs b/scripts/lib.scanOnlyClubs.mjs deleted file mode 100644 index 96bad1714..000000000 --- a/scripts/lib.scanOnlyClubs.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import { Repeater } from '@repeaterjs/repeater' -// eslint-disable-next-line no-unused-vars -import { createClient } from 'redis' - -const SINGLE_LETTER = '[a-z0-9\\-]' -const genMatch = (length) => - Array.from({ length }, (_, i) => i).reduce((p) => `${p}${SINGLE_LETTER}`, '') - -/** - * @param {ReturnType} redis redis client - */ -export const scanOnlyClubs = (redis) => { - const patterns = Array.from({ length: 42 }, (_, i) => i).map((_, i) => - genMatch(i + 1), - ) - - const iterators = patterns.map((MATCH) => { - return redis.scanIterator({ - MATCH, - COUNT: 1000, - }) - }) - - return Repeater.merge(iterators) -} diff --git a/scripts/lib.upgrade.mjs b/scripts/lib.upgrade.mjs deleted file mode 100644 index d2b291803..000000000 --- a/scripts/lib.upgrade.mjs +++ /dev/null @@ -1,37 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { decode, encode } from '@devprotocol/clubs-core' - -dotenv.config() - -/** - * @param {(config: import('@devprotocol/clubs-core').ClubsConfiguration) => import('@devprotocol/clubs-core').ClubsConfiguration} impl - * @param {string} key - */ -export const upgrade = async (impl, key) => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - const encodedConfig = await client.get(key) - const upgradedConfig = impl(decode(encodedConfig)) - const nextConfig = encode(upgradedConfig) - - if (encodedConfig === nextConfig) { - console.log('Up-to-date', key) - } else { - await client.set(key, nextConfig) - console.log('Upgraded:', key) - console.log('DB Upgraded') - } - - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error upgrading db: ', error) - } -} diff --git a/scripts/patch_incorrect_gatewayAddress.mjs b/scripts/patch_incorrect_gatewayAddress.mjs deleted file mode 100644 index 6b4c49a5d..000000000 --- a/scripts/patch_incorrect_gatewayAddress.mjs +++ /dev/null @@ -1,92 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { decode, encode } from '@devprotocol/clubs-core' -import { scanOnlyClubs } from './lib.scanOnlyClubs.mjs' - -dotenv.config() - -const TARGETS = [ - { - p: '0xf6C0794ac7bF5c7d546e03254e7A4E1DCE8526c1', - g: '0x8Cdd33D7C33fDE255Fd044cBEE4D09aab494Ce0e', - }, - { - p: '0xcAB63Dc00590f5447530760f213dEc046f2c566e', - g: '0xE6d7194F927a01c1682D5f10aEF0E7162c0C5834', - }, - { - p: '0x033524b9fB308510f4A27C01385bb5Ce90c226aA', - g: '0xC3bE5a7B26be6379222c39d137232e89B9c9e8Ab', - }, -] - -const upgrade = (key, config) => { - const deocdedConfig = decode(config) - const upgradedConfig = { ...deocdedConfig } - - const T = TARGETS.find((t) => t.p === upgradedConfig.propertyAddress) - if (T) { - console.log(key, 'IS HIT') - console.log(key, `'s old value is:`, config) - - upgradedConfig.plugins = upgradedConfig.plugins.map((plugin) => { - return plugin.name === 'memberships' - ? { - ...plugin, - options: plugin.options.map((pluginOptions) => - pluginOptions.key === 'memberships' - ? { - ...pluginOptions, - value: pluginOptions.value.map((pluginOptionValue) => ({ - ...pluginOptionValue, - fee: { - percentage: 0, - beneficiary: T.g, - }, - })), - } - : pluginOptions, - ), - } - : plugin - }) - } - return encode(upgradedConfig) -} - -const app = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - for await (const key of scanOnlyClubs(client)) { - if (key.startsWith('id::')) { - // This is not a ClubsConfiguration - console.log('Skipped:', key) - continue - } - - const encodedConfig = await client.get(key) - const upgradedConfig = upgrade(key, encodedConfig) - if (encodedConfig === upgradedConfig) { - continue - } - - console.log('Detect:', key) - await client.set(key, upgradedConfig) - console.log('Upgraded:', key) - } - - console.log('DB Upgraded') - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error upgrading db: ', error) - } -} - -app() diff --git a/scripts/populate/aggre-demo-std-2.mjs b/scripts/populate/aggre-demo-std-2.mjs deleted file mode 100644 index 1ad5cc32c..000000000 --- a/scripts/populate/aggre-demo-std-2.mjs +++ /dev/null @@ -1,95 +0,0 @@ -import { encode, decode } from '@devprotocol/clubs-core' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -const KEY = 'aggre-demo-std-2' - -const populate = async (client) => { - const base = decode(await client.get(KEY)) - await client.set( - KEY, - encode({ - ...base, - rpcUrl: - 'https://polygon-mumbai.g.alchemy.com/v2/sOgoydFGM3-T4emXVlgtyyrZyAstO036', - plugins: [ - ...base.plugins.filter( - (plg) => plg.id !== 'devprotocol:clubs:plugin:tickets', - ), - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { - erc721Enumerable: - '0xe0af15141ABd0B31Fb15e250971936Fe8837230a', - name: 'Debug SBT ticket', - uses: [ - { - id: 'one-time-cafe-access', - name: 'Coupon ABC', - description: - 'Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', - duration: '40 minutes', - within: '12 months', - availability: [ - { - type: 'weekday-time', - weekday: 1, - start: '9 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 2, - start: '9 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 3, - start: '9 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 4, - start: '9 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '9 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - ], - }, - ], - }, - ], - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/anijinja.mjs b/scripts/populate/anijinja.mjs deleted file mode 100644 index a861446dd..000000000 --- a/scripts/populate/anijinja.mjs +++ /dev/null @@ -1,103 +0,0 @@ -import { encode, decode } from '@devprotocol/clubs-core' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -const KEY = 'anijinja' - -const populate = async (client) => { - const config = decode(await client.get(KEY)) - await client.set( - KEY, - encode({ - ...config, - plugins: [ - ...config.plugins.filter( - ({ id }) => - id !== 'devprotocol:clubs:plugin:clubs-payments' && - id !== 'devprotocol:clubs:plugin:pay-by-card', - ), - { - id: 'devprotocol:clubs:plugin:clubs-payments', - enable: true, - options: [ - { - key: 'override', - value: [ - { - id: 'fantasy', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0xcafac4d96b5abdd14bc82e1bb67f7c80d0ed170527510bef42b636f38f5262ac', - price: { - yen: 1500, - }, - }, - { - id: 'mecha', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x634864bc5ea9d288635de2c924d5936041ffea7149df086d526ff093d0c3db72', - price: { - yen: 1500, - }, - }, - { - id: 'action', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x489683382ccd954c6cb0ab516a99079d303342211f82011fe84ccaa301ed7b1e', - price: { - yen: 1500, - }, - }, - { - id: 'sci-fi', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x631a97eea2dece26c8b6e7ea8914d08d71393f165c4f59ccd9c5d11c5fa05788', - price: { - yen: 1500, - }, - }, - { - id: 'school-life', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0xb25f6e8b8cbdc16e5707f08fba03bc3bde1d475caa276382c0fe23662d8d6bac', - price: { - yen: 1500, - }, - }, - { - id: 'mystery', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x307fee8397487ecbd4ce545f2d663e9d20c989dfed94a693c4d4457773a39372', - price: { - yen: 1500, - }, - }, - ], - }, - ], - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/constants/cryptocafe.mjs b/scripts/populate/constants/cryptocafe.mjs deleted file mode 100644 index 9e425a3d9..000000000 --- a/scripts/populate/constants/cryptocafe.mjs +++ /dev/null @@ -1,92 +0,0 @@ -import fs from 'fs-extra' -import { toBytes32 } from '../utils/toBytes32.mjs' - -export const cryptocafeAccessControl$1 = { - url: 'https://clubs-userland-cryptocafe.vercel.app/api/access-control/airtable/tblJQKBASg0lawpk3/fldW3gZ4LhCXGg5nf', - description: fs.readFileSync( - './src/assets/accessControl.cryptocafe.description$1.md', - 'utf-8', - ), -} -export const cryptocafeAccessControl$2 = { - url: encodeURI( - 'https://clubs-userland-cryptocafe.vercel.app/api/access-control/airtable/tbliLoymN2sNRSDkQ/flddMiDmClyRnxwhb?additional-conditions=["fldmOuSsUw8CG34sd","送信"]', - ), - description: fs.readFileSync( - './src/assets/accessControl.cryptocafe.description$2.md', - 'utf-8', - ), -} - -export const cryptoCafeMemberships = [ - { - id: 'cafe-visitor', - name: 'Cafe Visitor', - description: `Get one-time access to our cafe (Any weekday.)\n\nWi-Fi, coffee\n\n---\n\n月〜金のカフェタイム利用\n\nWi-Fi、コーヒー飲み放題`, - price: 19, - currency: 'MATIC', - imageSrc: 'https://i.imgur.com/4Qc8iDc.png', - payload: toBytes32('cafe-visitor'), - fee: { - percentage: 0.95, - beneficiary: '0x76119972c0C0F3183378423DCa039e55D9824050', - }, - accessControl: cryptocafeAccessControl$1, - }, - { - id: 'bar-visitor', - name: 'Bar Visitor', - description: `One-time access to our bar (Tuesday or Friday.)\n\nWi-Fi, complimentary drink\n\n---\n\n火・金のバータイム利用\n\nWi-Fi、コーヒー飲み放題、ドリンク1杯無料`, - price: 19, - currency: 'MATIC', - imageSrc: 'https://i.imgur.com/PaxWOh8.png', - payload: toBytes32('bar-visitor'), - fee: { - percentage: 0.95, - beneficiary: '0x76119972c0C0F3183378423DCa039e55D9824050', - }, - accessControl: cryptocafeAccessControl$1, - }, - { - id: 'one-day', - name: 'One Day', - description: `A full day access to our cafe & bar (Tuesday or Friday)\n\nWi-Fi, coffee, complimentary drink\n\n---\n\n火・金のみ利用可能な1日券\n\nWi-Fi、コーヒー飲み放題、ドリンク1杯無料`, - price: 29, - currency: 'MATIC', - imageSrc: 'https://i.imgur.com/0IJMz2K.png', - payload: toBytes32('one-day'), - fee: { - percentage: 0.95, - beneficiary: '0x76119972c0C0F3183378423DCa039e55D9824050', - }, - accessControl: cryptocafeAccessControl$1, - }, - { - id: 'friend-pass', - name: 'Friend Pass', - description: `Enjoy a month of unlimited cafe and bar visits for you and a friend.\n\nWi-Fi, coffee, complimentary drink, 1 free guest, special event\n\n---\n\n1ヶ月間の1日利用(バーは火・金)\n\nWi-Fi、コーヒー飲み放題、ゲスト1人無料、ドリンク1杯無料、スペシャルイベント招待`, - price: 448, - currency: 'MATIC', - imageSrc: 'https://i.imgur.com/KzMhSgw.png', - payload: toBytes32('friend-pass'), - fee: { - percentage: 0.95, - beneficiary: '0x76119972c0C0F3183378423DCa039e55D9824050', - }, - accessControl: cryptocafeAccessControl$2, - }, - { - id: 'best-friend-pass', - name: 'Best Friend Pass', - description: `Enjoy three month of unlimited cafe and bar visits for you and a friend.\n\nWi-Fi, coffee, a complimentary drink,1 bottle corkage free,1 free guest, gifts, special event\n\n---\n\n3ヶ月間のフリーパス(バーは火・金)\n\nWi-Fi、コーヒー飲み放題、ゲスト1人無料、特別ギフト、ドリンク1杯無料、持ち込み1本無料、スペシャルイベント招待`, - price: 1095, - currency: 'MATIC', - imageSrc: 'https://i.imgur.com/v43yiqe.png', - payload: toBytes32('best-friend-pass'), - fee: { - percentage: 0.95, - beneficiary: '0x76119972c0C0F3183378423DCa039e55D9824050', - }, - accessControl: cryptocafeAccessControl$2, - }, -] diff --git a/scripts/populate/constants/tanadao.mjs b/scripts/populate/constants/tanadao.mjs deleted file mode 100644 index 5409944ec..000000000 --- a/scripts/populate/constants/tanadao.mjs +++ /dev/null @@ -1,71 +0,0 @@ -const taxRate = 0.1 -const taxIncluded = (price) => price + price * taxRate - -export const override = [ - { - // 賛助会員 普通 - id: '----', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x007408bcd687ed9e07f48c0656773384c996f8e4ada7576a3c81d3d147166bb2', - price: { - yen: taxIncluded(3_000), - }, - }, - { - // 賛助会員 法人 - id: '--------', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0xa0b3487e4bf288af6f386ce9dc2bf0ac7adbd6114d415b34a045c1206b57d267', - price: { - yen: taxIncluded(10_000), - }, - }, - { - // 特別栽培米 小口 - id: '----------------3', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x779bccd239a972ce7837227e7c087c4ef6021f16fd0bbc909f328024a64fcd50', - price: { - yen: taxIncluded(10_000), - }, - }, - { - // 特別栽培米 標準 - id: '---------------', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x53fc50b3d0edf574480c9cd48e1c8493e04593e3a2e9c66f773562dfd8371967', - price: { - yen: taxIncluded(35_000), - }, - }, - { - // 農薬不使用米 小口 - id: '--------------', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0xb8e9750d7406859c235c5c5a511fd24577ead49a123e0d62a6dc47f9e9489014', - price: { - yen: taxIncluded(10_000), - }, - }, - { - // 農薬不使用米 標準 - id: '-------------', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x549145c48b05874e36ee3e4aeb7861cc214d23865c43f0c71e4efa909ee57208', - price: { - yen: taxIncluded(35_000), - }, - }, -] diff --git a/scripts/populate/cryptocafe-debug.mjs b/scripts/populate/cryptocafe-debug.mjs deleted file mode 100644 index f015b324d..000000000 --- a/scripts/populate/cryptocafe-debug.mjs +++ /dev/null @@ -1,59 +0,0 @@ -import { encode, decode } from '@devprotocol/clubs-core' -import { cryptoCafeMemberships } from './constants/cryptocafe.mjs' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -const KEY = 'cryptocafe-debug' - -const populate = async (client) => { - const cryptocafeConfig = decode(await client.get('cryptocafe')) - await client.set( - KEY, - encode({ - ...cryptocafeConfig, - url: 'https://cryptocafe.prerelease.clubs.place', - propertyAddress: '0xE59fEDaBB0F79b0EC605737805a9125cd8d87B1f', - chainId: 80001, // Polygon: 137 // Mumbai: 80001 - rpcUrl: - 'https://polygon-mumbai.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920', // Polygon: https://polygon-mainnet.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920 // Mumbai: https://polygon-mumbai.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920 - plugins: cryptocafeConfig.plugins.map((plugin) => - plugin.id === 'devprotocol:clubs:simple-memberships' - ? { - ...plugin, - options: [ - { - key: 'memberships', - value: cryptoCafeMemberships.map((membership) => ({ - ...membership, - price: membership.price / 100_000, - })), - }, - ], - } - : plugin.id === 'devprotocol:clubs:plugin:tickets' - ? { - ...plugin, - options: [ - { - key: 'tickets', - value: plugin.options - .find((p) => p.key === 'tickets') - .value.map((v) => ({ ...v, webhooks: undefined })), - }, - ], - } - : plugin, - ), - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/cryptocafe.mjs b/scripts/populate/cryptocafe.mjs deleted file mode 100644 index 062579949..000000000 --- a/scripts/populate/cryptocafe.mjs +++ /dev/null @@ -1,508 +0,0 @@ -import dotenv from 'dotenv' -import { encodeIfValid } from './validators/cryptocafe.mjs' -import fs from 'fs-extra' -import jsonwebtoken from 'jsonwebtoken' -import { cryptoCafeMemberships } from './constants/cryptocafe.mjs' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -dotenv.config() - -const KEY = 'cryptocafe' - -const { SALT } = process.env - -const populate = async (client) => { - const ticketWebhook = jsonwebtoken.sign( - `https://clubs-userland-cryptocafe.vercel.app/api/webhooks/tickets/${ - process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY ?? 'XYZ' - }/dest/airtable/tblPinFQ8dUbrhzPn`, - SALT, - ) - await client.set( - KEY, - encodeIfValid({ - name: 'Crypto Cafe & Bar', - twitterHandle: '', - description: `Daytime co-working, nighttime vibing.`, - url: 'https://cryptocafe.clubs.place', - propertyAddress: '0xF1AA1fC5a248bDCF531E45447916d49d54212AdE', - chainId: 137, // Polygon: 137 // Mumbai: 80001 - rpcUrl: - 'https://polygon-mainnet.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920', // Polygon: https://polygon-mainnet.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920 // Mumbai: https://polygon-mumbai.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920 - adminRolePoints: 50, - options: [ - { - key: 'ogp', - value: { image: 'https://i.imgur.com/IqkJqwc.jpg' }, - }, - { - key: 'navigationLinks', - value: [ - { - display: 'Tickets', - path: '/tickets', - }, - ], - }, - { - key: 'avatarImgSrc', - value: 'https://i.imgur.com/8wc0qH5.png', - }, - ], - plugins: [ - { - name: 'admin', - options: [], - id: 'clubs-core:admin', - }, - { - id: 'devprotocol:clubs:plugin:clubs-payments', - name: 'fiat', - enable: true, - options: [ - { - key: 'override', - value: [ - { - id: cryptoCafeMemberships[0].id, - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: cryptoCafeMemberships[0].payload, - price: { - yen: 2000, - }, - }, - { - id: cryptoCafeMemberships[1].id, - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: cryptoCafeMemberships[1].payload, - price: { - yen: 2000, - }, - }, - { - id: cryptoCafeMemberships[2].id, - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: cryptoCafeMemberships[2].payload, - price: { - yen: 3000, - }, - }, - { - id: cryptoCafeMemberships[3].id, - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: cryptoCafeMemberships[3].payload, - price: { - yen: 45000, - }, - }, - { - id: cryptoCafeMemberships[4].id, - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: cryptoCafeMemberships[4].payload, - price: { - yen: 110000, - }, - }, - ], - }, - { - key: 'webhooks', - value: { - fulfillment: { - encrypted: jsonwebtoken.sign( - 'https://veritrans.clubs.place/api/mock/logger', - SALT, - ), - }, - }, - }, - ], - }, - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { - // Cafe Visitor - payload: cryptoCafeMemberships[0].payload, - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: cryptoCafeMemberships[0].name, - uses: [ - { - id: 'one-time-cafe-access', - name: 'One-time access (Any weekday)', - description: cryptoCafeMemberships[0].description, - duration: '1 days', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 1, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 2, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 3, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 4, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - { - // Bar Visitor - payload: cryptoCafeMemberships[1].payload, - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: cryptoCafeMemberships[1].name, - uses: [ - { - id: 'one-time-bar-access', - name: 'One-time access (Tuesday or Friday)', - description: cryptoCafeMemberships[1].description, - duration: '1 days', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 2, - start: '18 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '18 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - { - id: 'complimentary-drink', - name: 'Complimentary drink', - description: 'ドリンク 1 杯無料', - dependsOn: 'one-time-bar-access', - refreshCycle: '1 days', - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - { - // One Day - payload: cryptoCafeMemberships[2].payload, - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: cryptoCafeMemberships[2].name, - uses: [ - { - id: 'one-day-access', - name: 'Full day access to our cafe & bar (Tuesday or Friday)', - description: cryptoCafeMemberships[2].description, - duration: '1 days', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 2, - start: '10 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '10 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - { - id: 'complimentary-drink', - name: 'Complimentary drink', - description: 'ドリンク 1 杯無料', - dependsOn: 'one-day-access', - refreshCycle: '1 days', - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - { - // Friend Pass - payload: cryptoCafeMemberships[3].payload, - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: cryptoCafeMemberships[3].name, - uses: [ - { - id: 'one-month-access', - name: 'One month access', - description: cryptoCafeMemberships[3].description, - duration: '1 months', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 1, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 2, - start: '10 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 3, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 4, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '10 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - { - id: 'invite-guest', - name: 'Invite 1 guest', - description: 'ゲスト 1 人無料', - dependsOn: 'one-month-access', - refreshCycle: '1 days', - }, - { - id: 'complimentary-drink', - name: 'Complimentary drink', - description: 'ドリンク 1 杯無料', - dependsOn: 'one-month-access', - refreshCycle: '1 days', - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - { - // Best Friend Pass - payload: cryptoCafeMemberships[4].payload, - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: cryptoCafeMemberships[4].name, - uses: [ - { - id: '3-months-access', - name: '3 months access', - description: cryptoCafeMemberships[4].description, - duration: '3 months', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 1, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 2, - start: '10 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 3, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 4, - start: '10 hour', - end: '18 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '10 hour', - end: '22 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - { - id: 'invite-guest', - name: 'Invite 1 guest', - description: 'ゲスト 1 人無料', - dependsOn: '3-months-access', - refreshCycle: '1 days', - }, - { - id: 'complimentary-drink', - name: 'Complimentary drink', - description: 'ドリンク 1 杯無料', - dependsOn: '3-months-access', - refreshCycle: '1 days', - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - ], - }, - { - key: 'banId', - value: [214, 215], - }, - ], - }, - { - id: 'devprotocol:clubs:simple-memberships', - name: 'memberships', - enable: true, - options: [ - { - key: 'memberships', - value: cryptoCafeMemberships, - }, - ], - }, - { - id: 'devprotocol:clubs:theme-1', - name: 'defaultTheme', - enable: true, - options: [ - { - key: 'globalConfig', - value: { - bg: 'rgba(29, 36, 38, 1)', - }, - }, - { - key: 'homeConfig', - value: { - hero: { - image: 'https://i.imgur.com/xp2uJYe.jpg', - }, - description: `Daytime co-working, nighttime vibing.`, - body: fs.readFileSync( - './src/assets/homeConfig.cryptocafe.body.md', - 'utf-8', - ), - }, - }, - ], - }, - { - id: 'devprotocol:clubs:plugin:me', - name: 'me', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:plugin:join', - name: 'join', - enable: true, - options: [], - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/custom-clubs.mjs b/scripts/populate/custom-clubs.mjs deleted file mode 100644 index bd04a9fd6..000000000 --- a/scripts/populate/custom-clubs.mjs +++ /dev/null @@ -1,112 +0,0 @@ -import { encode } from '@devprotocol/clubs-core' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -const KEY = 'clubsname' - -const populate = async (client) => { - await client.set( - KEY, - encode({ - name: 'testing-clubs-on-shubham-machine', - twitterHandle: '@doesntmatter', - description: '', - url: 'https://clubsname.clubs.place', - propertyAddress: 'propertyAdd', - adminRolePoints: 0, - chainId: 80001, - rpcUrl: '', - options: [ - { - key: 'ogp', - value: { image: '' }, - }, - { - key: 'navigationLinks', - value: [ - { - display: 'Join', - path: '/join', - }, - { - display: 'Collections', - path: '/collections', - }, - ], - }, - { - key: 'socialLinks', - value: [ - { - display: 'YouTube', - path: 'https://www.youtube.com/user/suiundo/', - }, - ], - }, - { - key: 'avatarImgSrc', - value: 'https://i.imgur.com/jDel1t9.png', - }, - ], - plugins: [ - { - id: 'clubs-core:admin', - name: 'admin', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:theme-1', - name: 'defaultTheme', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:plugin:me', - name: 'me', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:clubsx:marketplace', - name: 'marketplace', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:plugin:members', - name: 'members', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:plugin:quests', - name: 'quests', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:simple-memberships', - name: 'memberships', - enable: true, - options: [ - { - key: 'memberships', - value: [], - }, - ], - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/hotel.mjs b/scripts/populate/hotel.mjs deleted file mode 100644 index 9ba75184d..000000000 --- a/scripts/populate/hotel.mjs +++ /dev/null @@ -1,320 +0,0 @@ -import { encode, decode } from '@devprotocol/clubs-core' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' -import jsonwebtoken from 'jsonwebtoken' - -const KEY = 'hotel' - -const { SALT } = process.env - -const populate = async (client) => { - const base = decode(await client.get(KEY)) - const ticketWebhook = jsonwebtoken.sign( - `https://clubs-userland-clubs-hotel.vercel.app/api/webhooks/tickets/template/dest/airtable/tblZ5FcVPljelkViF`, - SALT, - ) - - await client.set( - KEY, - encode({ - ...base, - plugins: [ - ...base.plugins.filter( - ({ id }) => - id !== 'devprotocol:clubs:plugin:clubs-payments' && - id !== 'devprotocol:clubs:plugin:tickets', - ), - { - id: 'devprotocol:clubs:plugin:clubs-payments', - name: 'fiat', - enable: true, - options: [ - { - key: 'override', - value: [ - { - id: '----------2', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x98358cf2bb54ee7a29f874ca838f268c2a2c8dd7f419e7dd8023d97d643e907b', - price: { - yen: 3500, - }, - }, - { - id: '---------', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x4ceadd28ce51f2e255a42171ec6d6b44942a5556eddddc1478693f0ea1c7ad7b', - price: { - yen: 1200, - }, - }, - { - id: '-------1----2', - importFrom: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - payload: - '0x0589b5a6b000a6f19d9d41f5a2a90b7db9f4428d8b9210d7163328e0989c7bd0', - price: { - yen: 30000, - }, - }, - ], - }, - ], - }, - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { - payload: - '0x98358cf2bb54ee7a29f874ca838f268c2a2c8dd7f419e7dd8023d97d643e907b', - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: 'モーニングチケット', - uses: [ - { - id: 'morning', - name: 'モーニングチケット', - description: - '季節の食材を用いたサラダ、こだわりのパンやスイーツをお好きなだけお楽しみ頂けます。', - duration: '1 days', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 1, - start: '7 hour', - end: '10 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 2, - start: '7 hour', - end: '10 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 3, - start: '7 hour', - end: '10 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 4, - start: '7 hour', - end: '10 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '7 hour', - end: '10 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 6, - start: '7 hour', - end: '11 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 7, - start: '7 hour', - end: '11 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - { - payload: - '0x4ceadd28ce51f2e255a42171ec6d6b44942a5556eddddc1478693f0ea1c7ad7b', - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: '名物ラテアート☕️', - uses: [ - { - id: 'latte-art', - name: '名物ラテアート☕️', - description: - '見た目も楽しめる、大人気のラテアートです。ペットの写真を見せて頂ければ、カスタマイズも出来ます🐶🐱🦜', - duration: '1 days', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 1, - start: '11 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 2, - start: '11 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 3, - start: '11 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 4, - start: '11 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '11 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 6, - start: '11 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 7, - start: '11 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - { - payload: - '0x0589b5a6b000a6f19d9d41f5a2a90b7db9f4428d8b9210d7163328e0989c7bd0', - importedFrom: { - plugin: 'devprotocol:clubs:simple-memberships', - key: 'memberships', - }, - name: 'ラウンジ会員《1週間》', - uses: [ - { - id: 'one-week-access', - name: 'ラウンジ会員《1週間》', - description: - 'ホテル1階にあるラウンジを1週間、ご利用頂けます。お飲み物や軽食をご用意しておりますので、長期滞在中のお仕事やリフレッシュの場としてお過ごしください。', - duration: '1 weeks', - within: '1 months', - availability: [ - { - type: 'weekday-time', - weekday: 1, - start: '7 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 2, - start: '7 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 3, - start: '7 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 4, - start: '7 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 5, - start: '7 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 6, - start: '7 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - { - type: 'weekday-time', - weekday: 7, - start: '7 hour', - end: '21 hour', - tz: 'Asia/Tokyo', - }, - ], - refreshCycle: undefined, - }, - ], - webhooks: { - used: { - encrypted: ticketWebhook, - }, - }, - }, - ], - }, - ], - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/index.mjs b/scripts/populate/index.mjs deleted file mode 100644 index 961b73945..000000000 --- a/scripts/populate/index.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import { db } from './utils/db.mjs' - -const action = async () => { - const client = await db() - - const scripts = await Promise.all([ - import('./cryptocafe.mjs'), - import('./cryptocafe-debug.mjs'), - import('./kougenji.mjs'), - import('./temples.mjs'), - import('./testing-for-dashboard-2.mjs'), - import('./tanadao.mjs'), - ]) - - await Promise.all(scripts.map((script) => script.default(client))) - - await client.quit() -} - -action() diff --git a/scripts/populate/kougenji.mjs b/scripts/populate/kougenji.mjs deleted file mode 100644 index 27b961113..000000000 --- a/scripts/populate/kougenji.mjs +++ /dev/null @@ -1,454 +0,0 @@ -import { encode } from '@devprotocol/clubs-core' -import { toBytes32 } from './utils/toBytes32.mjs' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -const KEY = 'kougenji' - -const kougenjiProducts = [ - { - id: '1', - name: 'Kougenji Celestial Maiden #1', - description: `光源寺に特別参拝でき、修復後の天女のNFTを受け取ることができます. - Holders of this NFT are invited to a special visit at Kougenji, and can receive the restored celestial maiden NFT.`, - price: 0.6, - currency: 'ETH', - imageSrc: - 'https://bafybeifmshinu5cjv5gddsburhwmwaut2awoxkl4bsmhzqwxsl7pgx5bbi.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Celestial Maiden #1'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '2', - name: 'Kougenji Celestial Maiden #2', - description: `修復後の天女のNFTを受け取ることができます. - Holders of this NFT can receive restored celestial maiden NFT.`, - price: 0.5, - currency: 'ETH', - imageSrc: - 'https://bafybeifmshinu5cjv5gddsburhwmwaut2awoxkl4bsmhzqwxsl7pgx5bbi.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Celestial Maiden #2'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '3', - name: 'Kougenji Celestial Maiden #3', - description: `光源寺ご住職による水晶ブレスレットを受け取ることができます(日本国内のみ). - Holders of this NFT can receive a crystal bracelet made by the chief priest of Kougenji.`, - price: 0.4, - currency: 'ETH', - imageSrc: - 'https://bafybeifmshinu5cjv5gddsburhwmwaut2awoxkl4bsmhzqwxsl7pgx5bbi.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Celestial Maiden #3'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '4', - name: 'Kougenji Flower #1', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeidfjmpcx44mpovv4vlozzmvfj42axgnqrl6veda72hocfa5ajmaye.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #1'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '5', - name: 'Kougenji Flower #2', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeibbzgcfmvgpj64j5msdtdtmnis7unfgy3ir2biyymhbmlzy3mvupm.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #2'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '6', - name: 'Kougenji Flower #3', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeibpzdt6zs3bwbox74fd6weodc6fmsu56omt6yldal6pz55s2ws7aa.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #3'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '7', - name: 'Kougenji Flower #4', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeifliopehpndnbg3wafphf3anrwaosjpgg5myjx23p3osf7efsjaum.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #4'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '8', - name: 'Kougenji Flower #5', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeidbqxysseou3va5rgxzykesoclt7s5vjsju74ihnyihjshz4enjpq.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #5'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '9', - name: 'Kougenji Flower #6', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeigpdw6tcb72wkmjayeco7ckummtashcr2m7jhdcnq6b2uyvqebrvi.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #6'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '10', - name: 'Kougenji Flower #7', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeigd4e5waigihewlkyzcvv4zkhf6gxx63wrklhp23hsmhgc3wptkum.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #7'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '11', - name: 'Kougenji Flower #8', - description: `天井絵シリーズを3枚集めた方はオンラインでの読経、5枚集めた方は光源寺での読経に参加できます。 - If you collect 3 flower NFTs, you can join an online sutra chanting. If you collect 5 flower NFTs, you can join a sutra chanting event at Kougenji.`, - price: 0.06, - currency: 'ETH', - imageSrc: - 'https://bafybeifqremnvait2bzpwx2g3biwy5uaghfxrlqivouyirc7b2pbwqj2iy.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji Flower #8'), - fee: { - percentage: 0.95, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, - { - id: '12', - name: 'Kougenji DAO', - description: `御住職によるオンライン法話やお話し会に参加できます(2,3ヶ月に1回開催予定). - Holders of this NFT are allowed to join online preach or round-table talk by the head priest (to be scheduled once in a few months).`, - price: 0.09, - currency: 'ETH', - imageSrc: - 'https://bafybeifq5zh2rpnw5meyrjcyekyjfps5tsvfv5f62zjiqiahvut6w2btc4.ipfs.nftstorage.link/', - imageAlt: 'lorem ipsum', - payload: toBytes32('Kougenji DAO'), - fee: { - percentage: 0.5, - beneficiary: '0x2d69c991782ac67218dc0167af6f7c91498587c1', - }, - }, -] - -const populate = async (client) => { - await client.set( - KEY, - encode({ - name: 'Kougenji', - twitterHandle: '@templesdao', - description: '', - url: 'https://kougenji.clubs.place', - propertyAddress: '0x23d67953FE2e61e9fAc78447526D9358cD05d40d', // Polygon: 0x23d67953FE2e61e9fAc78447526D9358cD05d40d // Mumbai: 0x70a8B9a4B2d407a542c205adBbEA38289c3285eB - chainId: 137, // Polygon: 137 // Mumbai: 80001 - rpcUrl: - 'https://polygon-mainnet.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920', // Polygon: https://polygon-mainnet.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920 // Mumbai: https://polygon-mumbai.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920 - adminRolePoints: 0, - options: [ - { - key: 'ogp', - value: { image: 'https://i.imgur.com/I6Yr0V7.jpg' }, - }, - { - key: 'navigationLinks', - value: [ - // { - // display: 'ETH での支援', - // path: '/nft', - // }, - { - display: '特典について', - path: 'https://sites.google.com/view/kougenjidao/%E3%83%9B%E3%83%BC%E3%83%A0/%E3%81%94%E6%94%AF%E6%8F%B4%E3%81%AE%E7%89%B9%E5%85%B8', - }, - { - display: '光源寺 DAO への参加', - path: 'https://guild.xyz/temples-dao', - }, - ], - }, - { - key: 'footerLinks', - value: [ - { - display: 'About', - path: 'https://sites.google.com/view/kougenjidao', - }, - { - display: 'Terms & Conditions', - path: 'https://kougenjidao.notion.site/5558b9a7d5b74453a2cf8c3640f63b5a', - }, - { - display: 'Privacy Policy', - path: 'https://kougenjidao.notion.site/1d8d0410286443d4b7742549960eb588', - }, - { - display: 'Act on specified commercial transactions', - path: 'https://kougenjidao.notion.site/edd00237c45c4f01a006ad17264e676e', - }, - ], - }, - { - key: 'avatarImgSrc', - value: 'https://i.imgur.com/453nyAX.jpg', - }, - ], - plugins: [ - { - id: 'devprotocol:clubs:plugin:pay-by-card', - name: 'fiat', - enable: false, - options: [ - { - key: 'products', - value: kougenjiProducts, // Polygon: kougenjiProducts // Mumbai: kougenjiProductsMumbai - }, - { - key: 'priceOverrides', - value: [ - { - id: '1', - price: 100_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/4gw14A6Jh1LEaZicMP', - }, - { - id: '2', - price: 80_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/fZebJe8RpfCu1oI8wA', - }, - { - id: '3', - price: 70_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/00g4gM2t1dumaZifZ3', - }, - { - id: '4', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/eVabJe9VtgGyd7q006', - }, - { - id: '5', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/eVabJe5Fd3TMc3m5kr', - }, - { - id: '6', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/eVa14A5Fdbmed7q7sA', - }, - { - id: '7', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/3cs3cI4B99e6d7q6ox', - }, - { - id: '8', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/eVadRmc3B0HA3wQ4gq', - }, - { - id: '9', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/cN2dRmffN2PI8Ra28j', - }, - { - id: '10', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/bIYbJeffN4XQ2sMaEQ', - }, - { - id: '11', - price: 10_000, - currency: 'YEN', - purchaseLink: 'https://buy.stripe.com/8wM28E1oX1LE9Ve00d', - }, - ], - }, - { - key: 'hero', - value: { - coverImgSrc: 'https://i.imgur.com/I6Yr0V7.jpg', - title: '光源寺/ Kougenji', - description: [ - `光源寺の天女絵修復プロジェクトでのご支援金は、天女の表具欄間彩色修復等に使われます。支援者の方は光源寺のDiscordチャンネルに参加し、修復状況(写真等)を見ることができます。また、NFTの種類により様々な特典をご用意しております。`, - `The funds raised for Kougenji will be used to restore the celestial maiden paper picture frame on the decorative transom and other cultural assets within the temple. Supporters are allowed to join Kougenji's Discord channel for the latest news and updates about the restoration (photos, etc.). We also plan to provide a variety of perks according to the types of NFT you'll purchase.`, - ], - }, - }, - { - key: 'title', - value: undefined, - }, - // { - // key: 'slug', - // value: [], - // }, - ], - }, - { - id: 'devprotocol:clubs:plugin:me', - name: 'me', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:plugin:buy', - name: 'buy', - enable: true, - options: [ - { - key: 'products', - value: kougenjiProducts, // Polygon: kougenjiProducts // Mumbai: kougenjiProductsMumbai - }, - ], - }, - { - id: 'devprotocol:clubs:plugin:nft', - name: 'nft', - enable: true, - options: [ - { - key: 'products', - value: kougenjiProducts, // Polygon: kougenjiProducts // Mumbai: kougenjiProductsMumbai - }, - { - key: 'coverImgSrc', - value: 'https://i.imgur.com/I6Yr0V7.jpg', - }, - { - key: 'title', - value: '光源寺/ Kougenji', - }, - { - key: 'description', - value: [ - `光源寺の天女絵修復プロジェクトでのご支援金は、天女の表具欄間彩色修復等に使われます。支援者の方は光源寺のDiscordチャンネルに参加し、修復状況(写真等)を見ることができます。また、NFTの種類により様々な特典をご用意しております。`, - `The funds raised for Kougenji will be used to restore the celestial maiden paper picture frame on the decorative transom and other cultural assets within the temple. Supporters are allowed to join Kougenji's Discord channel for the latest news and updates about the restoration (photos, etc.). We also plan to provide a variety of perks according to the types of NFT you'll purchase.`, - ], - }, - { - key: 'slug', - value: [], - }, - ], - }, - { - id: 'devprotocol:clubs:gated-contact-form', - name: 'message', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:theme-1', - name: 'defaultTheme', - enable: true, - options: [ - { - key: 'globalConfig', - value: { - bg: 'rgba(29, 36, 38, 1)', - }, - }, - { - key: 'homeConfig', - value: { - hero: { - image: 'https://i.imgur.com/I6Yr0V7.jpg', - }, - description: `The funds raised for Kougenji will be used to restore the celestial maiden paper picture frame on the decorative transom and other cultural assets within the temple. Supporters are allowed to join Kougenji's Discord channel for the latest news and updates about the restoration (photos, etc.). We also plan to provide a variety of perks according to the types of NFT you'll purchase.`, - }, - }, - ], - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/tanadao.mjs b/scripts/populate/tanadao.mjs deleted file mode 100644 index 535904e6a..000000000 --- a/scripts/populate/tanadao.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import { decode } from '@devprotocol/clubs-core' -import { override } from './constants/tanadao.mjs' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' -import { encodeIfValid } from './validators/tanadao.mjs' - -const KEY = 'tanadao' - -const populate = async (client) => { - const srcConfig = decode(await client.get(KEY)) - await client.set( - KEY, - encodeIfValid({ - ...srcConfig, - plugins: srcConfig.plugins.map((plugin) => - plugin.id === 'devprotocol:clubs:plugin:clubs-payments' - ? { - ...plugin, - options: [ - { - key: 'override', - value: override, - }, - ], - } - : plugin, - ), - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/temples.mjs b/scripts/populate/temples.mjs deleted file mode 100644 index bd4bda4ea..000000000 --- a/scripts/populate/temples.mjs +++ /dev/null @@ -1,219 +0,0 @@ -import { encode } from '@devprotocol/clubs-core' -import fs from 'fs-extra' -import { toBytes32 } from './utils/toBytes32.mjs' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -const KEY = 'temples' - -const tiers = [ - { - title: 'Tier 3', - id: 'tier-3', - badgeImageDescription: `"Yasuragi dan Renge (a Buddhist altar, lotus)" embossed gilt lacquer work with inlaid mother-of-pearl`, - }, - { - title: 'Tier 2', - id: 'tier-2', - badgeImageDescription: `"Yasuragi dan Koki (a Buddhist altar, brightness)" embossed gilt lacquer work`, - }, - { - title: 'Tier 1', - id: 'tier-1', - badgeImageDescription: `Sojiij Head Monastry : Nioh statue (statues of the two Deva kings)`, - }, - { - title: 'Super', - id: 'super', - badgeImageDescription: `Gokokuji= Head Monastry : Nyoirin Kannon statue (Cintāmaṇicakra statue)`, - }, -] - -const guild = { - key: 'guildUrl', - value: 'https://guild.xyz/temples-dao', -} -const populate = async (client) => { - await client.set( - KEY, - encode({ - name: '寺DAO', - twitterHandle: '@templesdao', - description: 'DAO that makes the next 1000 years', - url: 'https://temples.clubs.place', - propertyAddress: '0x541f7914ed2a4a8b477edc711fa349a77983f3ad', - adminRolePoints: 0, - chainId: 1, - rpcUrl: 'https://mainnet.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920', - options: [ - { - key: 'ogp', - value: { image: 'https://i.imgur.com/lcyO9Bn.jpg' }, - }, - { - key: 'navigationLinks', - value: [ - { - display: 'Kougenji', - path: 'https://kougenji.clubs.place', - }, - { - display: 'Community', - path: '/community', - }, - ], - }, - { - key: 'socialLinks', - value: [ - { - display: 'YouTube', - path: 'https://www.youtube.com/user/suiundo/', - }, - ], - }, - { - key: 'avatarImgSrc', - value: 'https://i.imgur.com/jDel1t9.png', - }, - ], - plugins: [ - { - id: 'clubs-core:admin', - name: 'admin', - enable: true, - options: [], - }, - { - id: 'devprotocol:clubs:theme-1', - name: 'defaultTheme', - enable: true, - options: [ - { - key: 'globalConfig', - value: { - bg: 'rgba(68, 59, 45, 1)', - backgroundGradient: [ - 'rgba(255, 201, 119, 0.2)', - 'rgba(255, 201, 119, 0)', - ], - }, - }, - { - key: 'homeConfig', - value: { - hero: { - image: 'https://i.imgur.com/oNf7FsR.jpg', - }, - description: `寺DAOでは、寺院建築、荘厳仏具に携わる工芸士、職人の伝統的技術を伝え、後世に残すことを目的とした支援を行っております。`, - body: fs.readFileSync( - './src/assets/homeConfig.temples.body.md', - 'utf-8', - ), - }, - }, - ], - }, - { - id: 'devprotocol:clubs:plugin:join-legacy', - name: 'join', - enable: true, - options: [ - { - key: 'tiers', - value: tiers, - }, - ], - }, - { - id: 'devprotocol:clubs:plugin:community', - name: 'community', - enable: true, - options: [guild], - }, - { - id: 'devprotocol:clubs:simple-memberships', - name: 'memberships', - enable: true, - options: [ - { - key: 'memberships', - value: [ - { - id: 'tier-3', - name: 'Tier 3', - description: `蒔絵師による作品/ やすらぎ壇「蓮華」\n\n**特典** - 限定ECサイト(低額商品)での購入権、非公開YouTube動画、月1回のコミュニティアワーやメンバー限定クエストへの参加などサポーター限定の情報`, - imageSrc: - 'https://bafybeiav46h6zegh4e7zfdcgk6xjpg6if2kdxtvp3ejtyicvpgc2iucpim.ipfs.nftstorage.link', - payload: undefined, - fee: undefined, - deprecated: true, - }, - { - id: 'tier-2', - name: 'Tier 2', - description: `蒔絵師による作品/ やすらぎ壇 「光輝」\n\n**特典** - Tier 3 + オークションへの参加権、特級品の購入権など(オンラインでの特典)`, - imageSrc: - 'https://bafybeic3d2otapykfdp3ktqbdonn4ylrove5ccs5vv2udydwbgudstrcwu.ipfs.nftstorage.link', - payload: undefined, - fee: undefined, - deprecated: true, - }, - { - id: 'tier-1', - name: 'Tier 1', - description: `大本山 總持寺 仁王像(總持寺型仁王像)\n\n**特典** - Tier 2 + 特別な場所を訪れたり、物理的な体験をすることができる権利(最大年2回まで)`, - imageSrc: - 'https://bafybeib745w7vjcsh37mepaluvbmqrbjq4gax46oirkmrjeqeh55gjiyzi.ipfs.nftstorage.link', - payload: undefined, - fee: undefined, - deprecated: true, - }, - { - id: 'super', - name: 'Super', - description: `大本山護国寺 如意輪観世音菩薩像\n\n**特典** - Tier 1 + オーダーメード権利(通常お寺様からのオーダー依頼で作る職人にご希望の商品を作製して貰える権利。内容は要相談)`, - imageSrc: - 'https://bafybeiagvn4exdbwokm4g6t6a2s3xvl2fu7zutvlf6sgwd4fjrdrc23hsu.ipfs.nftstorage.link', - payload: undefined, - fee: undefined, - deprecated: true, - }, - { - id: 'tier-4-1', - name: 'Tier 4 #1', - description: `林檎天井絵\n\n**特典** - 寺DAODiscordへの参加権\n月1回のコミュニティアワーやメンバー限定クエストへ参加できます`, - imageSrc: - 'https://bafybeigis7fdpwizu34v5iwjvc2lcdk4g75keqa3xe72jekldmhjopahnu.ipfs.nftstorage.link', - payload: toBytes32('林檎天井絵'), - fee: undefined, - deprecated: true, - }, - { - id: 'tier-4-2', - name: 'Tier 4 #2', - description: `蓮華一本立木華\n\n**特典** - 寺DAODiscordへの参加権\n月1回のコミュニティアワーやメンバー限定クエストへ参加できます`, - imageSrc: - 'https://bafybeihrh7haq3yadt6nfltynv6ukgovm4hgfhd6o7zpkaf33cjl6tuoau.ipfs.nftstorage.link', - payload: toBytes32('蓮華一本立木華'), - fee: undefined, - deprecated: true, - }, - ], - }, - ], - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/testing-for-dashboard-2.mjs b/scripts/populate/testing-for-dashboard-2.mjs deleted file mode 100644 index 34d8d28e4..000000000 --- a/scripts/populate/testing-for-dashboard-2.mjs +++ /dev/null @@ -1,282 +0,0 @@ -import { encode } from '@devprotocol/clubs-core' -import { db } from './utils/db.mjs' -import { whenCalledDirectly } from './utils/whenCalledDirectly.mjs' - -const KEY = 'testing-for-dashboard-2' - -const populate = async (client) => { - await client.set( - KEY, - encode({ - name: 'testing-for-dashboard-2', - twitterHandle: '', - description: '', - url: 'https://testing-for-dashboard-2.clubs.place', - propertyAddress: '0x39d16ecd8506AAe3935492334c14E3163D0d2658', - adminRolePoints: 50, - chainId: 80001, - rpcUrl: - 'https://polygon-mumbai.infura.io/v3/fa1acbd68f5c4484b1082e1cf876b920', - options: [ - { - key: 'navigationLinks', - value: [ - { - display: 'Join', - path: '/join', - }, - { - display: 'Community', - path: '/community', - }, - ], - }, - { - key: 'avatarImgSrc', - value: '', - }, - { - key: '__draft', - value: { - isInDraft: false, - address: '0x6B2eBFe3FE5c5B84746105421de93Df383b222E8', - category: 'DISCORD', - }, - }, - ], - plugins: [ - { - name: 'admin', - options: [], - id: 'clubs-core:admin', - }, - { - name: 'defaultTheme', - options: [ - { - key: 'globalConfig', - value: { - bg: 'rgba(29, 36, 38, 1)', - ink: 'rgba(255, 255, 255, 1)', - }, - }, - { - key: 'homeConfig', - value: { - hero: { - image: 'https://i.imgur.com/hyqFcB6.png', - }, - description: - 'I create art in Canada using flowers and light refraction. Recently, I have focused on creating online artworks that allow user interaction through JavaScript.', - body: "### Hi, I'm Alice!\n\nhttps://www.youtube.com/watch?v=WgDAezl1RrQ\n\nThe YouTube link you place will automatically display embedded. Try it! YouTube video can be a great help in making your activities briefly known.\n\nWant to use images in your description? Then try writing it like the following. You can see how the image will display later on the [Preview] page.\n\n![](https://images.unsplash.com/photo-1674420628423-bf7a338af32d)\n", - }, - }, - ], - id: 'devprotocol:clubs:theme-1', - }, - { - name: 'join', - options: [], - id: 'devprotocol:clubs:plugin:join', - }, - { - name: 'me', - options: [], - id: 'devprotocol:clubs:plugin:me', - }, - { - name: 'community', - options: [], - id: 'devprotocol:clubs:plugin:community', - }, - { - name: 'quests', - options: [], - id: 'devprotocol:clubs:plugin:quests', - }, - { - name: 'members', - options: [], - id: 'devprotocol:clubs:plugin:members', - }, - { - name: 'memberships', - options: [ - { - key: 'memberships', - value: [ - { - id: 'preset-casual', - name: 'Casual', - imageSrc: 'https://i.imgur.com/80cN1P3.png', - currency: 'ETH', - price: 0.003, - description: 'lorem ipsum', - payload: { - 0: 191, - 1: 182, - 2: 237, - 3: 44, - 4: 84, - 5: 235, - 6: 16, - 7: 196, - }, - }, - { - id: 'preset-team', - name: 'Awesome-band Contributor', - imageSrc: 'https://i.imgur.com/YaNNZ2F.png', - currency: 'ETH', - price: 0.001, - description: 'Testing', - payload: { - 0: 112, - 1: 167, - 2: 76, - 3: 158, - 4: 207, - 5: 193, - 6: 220, - 7: 197, - }, - }, - ], - }, - ], - id: 'devprotocol:clubs:simple-memberships', - }, - { - name: 'message', - options: [], - id: 'devprotocol:clubs:gated-contact-form', - }, - { - name: 'marketplace', - options: [], - id: 'devprotocol:clubs:clubsx:marketplace', - }, - { - id: 'devprotocol:clubs:clubsx:marketplace', - options: [], - }, - { - name: 'collections', - options: [ - { - key: 'collections', - value: [ - { - id: 'preset-collections', - name: 'Preset Collections', - imageSrc: 'https://i.ibb.co/RbxFzn8/img.jpg', - startTime: 1692954574, - isTimeLimitedCollection: true, - endTime: 1693472969, - description: 'This is test collections', - memberships: [ - { - id: 'preset-casual', - name: 'Testing-Collection-1', - imageSrc: 'https://i.imgur.com/80cN1P3.png', - currency: 'ETH', - price: 0.003, - description: 'lorem ipsum', - payload: { - 0: 191, - 1: 182, - 2: 237, - 3: 44, - 4: 84, - 5: 235, - 6: 16, - 7: 196, - }, - }, - { - id: 'preset-team', - name: 'Testing-Collection-2', - imageSrc: 'https://i.ibb.co/Kyjr50C/Image.png', - currency: 'ETH', - price: 0.001, - description: 'Testing', - payload: { - 0: 112, - 1: 167, - 2: 76, - 3: 158, - 4: 207, - 5: 193, - 6: 220, - 7: 197, - }, - }, - ], - }, - { - id: 'preset-collections-1', - name: 'Preset Collections 2', - imageSrc: 'https://i.ibb.co/RbxFzn8/img.jpg', - startTime: 1692954574, - isTimeLimitedCollection: false, - description: 'This is test collections', - memberships: [ - { - id: 'preset-casual', - name: 'Testing-Collection-1', - imageSrc: 'https://i.imgur.com/80cN1P3.png', - currency: 'ETH', - price: 0.003, - description: 'lorem ipsum', - payload: { - 0: 191, - 1: 182, - 2: 237, - 3: 44, - 4: 84, - 5: 235, - 6: 16, - 7: 196, - }, - memberCount: 100, - }, - { - id: 'preset-team', - name: 'Testing-Collection-2', - imageSrc: 'https://i.ibb.co/Kyjr50C/Image.png', - currency: 'ETH', - price: 0.001, - description: 'Testing', - payload: { - 0: 112, - 1: 167, - 2: 76, - 3: 158, - 4: 207, - 5: 193, - 6: 220, - 7: 197, - }, - memberCount: 100, - }, - ], - }, - ], - }, - ], - id: 'devprotocol:clubs:collections', - }, - ], - }), - ) - - console.log('set', KEY) -} - -whenCalledDirectly(async () => { - const client = await db() - await populate(client) - await client.quit() -}) - -export default populate diff --git a/scripts/populate/utils/db.mjs b/scripts/populate/utils/db.mjs deleted file mode 100644 index 1d059bb95..000000000 --- a/scripts/populate/utils/db.mjs +++ /dev/null @@ -1,14 +0,0 @@ -import dotenv from 'dotenv' -import { createClient } from 'redis' - -dotenv.config() - -export const db = async () => { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - return client -} diff --git a/scripts/populate/utils/toBytes32.mjs b/scripts/populate/utils/toBytes32.mjs deleted file mode 100644 index b06e3a2b6..000000000 --- a/scripts/populate/utils/toBytes32.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import { keccak256, toUtf8Bytes } from 'ethers' - -export const toBytes32 = (str) => keccak256(toUtf8Bytes(str)) diff --git a/scripts/populate/utils/whenCalledDirectly.mjs b/scripts/populate/utils/whenCalledDirectly.mjs deleted file mode 100644 index 0eeeada05..000000000 --- a/scripts/populate/utils/whenCalledDirectly.mjs +++ /dev/null @@ -1,5 +0,0 @@ -export const whenCalledDirectly = async (handler) => { - if (process.argv.includes('scripts/populate/index.mjs') === false) { - await handler() - } -} diff --git a/scripts/populate/validators/cryptocafe.mjs b/scripts/populate/validators/cryptocafe.mjs deleted file mode 100644 index 3fb0ef25a..000000000 --- a/scripts/populate/validators/cryptocafe.mjs +++ /dev/null @@ -1,41 +0,0 @@ -import { validatorFactory } from './validatorFactory.mjs' -import jsonwebtoken from 'jsonwebtoken' - -export const validator = (config) => { - const { CRYPTOCAFE_TICKET_WEBHOOK_KEY, SALT } = process.env - - /** - * Tickets must be having webhook URL - */ - const testForTicketsWebhook = (() => { - const ticketsConfig = config.plugins.find( - ({ id }) => id === 'devprotocol:clubs:plugin:tickets', - ) - - const expectedWebhookUrl = jsonwebtoken.sign( - `https://clubs-userland-cryptocafe.vercel.app/api/webhooks/tickets/${CRYPTOCAFE_TICKET_WEBHOOK_KEY}/dest/airtable/tblPinFQ8dUbrhzPn`, - SALT || '.', - ) - const ticketsOption = ticketsConfig.options.find( - ({ key }) => key === 'tickets', - ).value - const isRequiredEnvsAreSet = - typeof CRYPTOCAFE_TICKET_WEBHOOK_KEY === 'string' && - typeof SALT === 'string' && - CRYPTOCAFE_TICKET_WEBHOOK_KEY !== '' && - SALT !== '' - const allTicketsHaveWebhook = ticketsOption.every( - (opts) => opts.webhooks.used.encrypted === expectedWebhookUrl, - ) - - return isRequiredEnvsAreSet && allTicketsHaveWebhook - ? true - : isRequiredEnvsAreSet - ? new Error('Tickets must be having webhook URL') - : new Error('CRYPTOCAFE_TICKET_WEBHOOK_KEY and SALT must be set') - })() - - return testForTicketsWebhook -} - -export const encodeIfValid = validatorFactory(validator) diff --git a/scripts/populate/validators/cryptocafe.test.mjs b/scripts/populate/validators/cryptocafe.test.mjs deleted file mode 100644 index 260ed22b9..000000000 --- a/scripts/populate/validators/cryptocafe.test.mjs +++ /dev/null @@ -1,213 +0,0 @@ -import { expect, it } from 'vitest' -import { validator } from './cryptocafe.mjs' -import jsonwebtoken from 'jsonwebtoken' - -it('validator returns true when the config has correct values', () => { - process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY = 'X' - process.env.SALT = 'X' - - const expectedWebhookUrl = jsonwebtoken.sign( - `https://clubs-userland-cryptocafe.vercel.app/api/webhooks/tickets/X/dest/airtable/tblPinFQ8dUbrhzPn`, - 'X', - ) - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [{ webhooks: { used: { encrypted: expectedWebhookUrl } } }], - }, - ], - }, - ], - }) - - expect(res).toBe(true) -}) - -it('validator returns error when the config has not webhook URL for each tickets', () => { - process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY = 'X' - process.env.SALT = 'X' - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [{ webhooks: { used: { encrypted: undefined } } }], - }, - ], - }, - ], - }) - - expect(res).toEqual(new Error('Tickets must be having webhook URL')) -}) - -it('validator returns error when the config has incorrect webhook URL for each tickets', () => { - process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY = 'X' - process.env.SALT = 'X' - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { webhooks: { used: { encrypted: 'http://example.com' } } }, - ], - }, - ], - }, - ], - }) - - expect(res).toEqual(new Error('Tickets must be having webhook URL')) -}) - -it('validator returns error when CRYPTOCAFE_TICKET_WEBHOOK_KEY is not set', () => { - delete process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY - process.env.SALT = 'X' - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { - webhooks: { - used: { - encrypted: jsonwebtoken.sign( - `https://clubs-userland-cryptocafe.vercel.app/api/webhooks/tickets/undefined/dest/airtable/tblPinFQ8dUbrhzPn`, - 'X', - ), - }, - }, - }, - ], - }, - ], - }, - ], - }) - - expect(res).toEqual( - new Error('CRYPTOCAFE_TICKET_WEBHOOK_KEY and SALT must be set'), - ) -}) - -it('validator returns error when SALT is not set', () => { - process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY = 'X' - delete process.env.SALT - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { - webhooks: { - used: { - encrypted: jsonwebtoken.sign( - `https://clubs-userland-cryptocafe.vercel.app/api/webhooks/tickets/undefined/dest/airtable/tblPinFQ8dUbrhzPn`, - '.', - ), - }, - }, - }, - ], - }, - ], - }, - ], - }) - - expect(res).toEqual( - new Error('CRYPTOCAFE_TICKET_WEBHOOK_KEY and SALT must be set'), - ) -}) - -it('validator returns error when CRYPTOCAFE_TICKET_WEBHOOK_KEY is empty', () => { - process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY = '' - process.env.SALT = 'X' - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { - webhooks: { - used: { - encrypted: jsonwebtoken.sign( - `https://clubs-userland-cryptocafe.vercel.app/api/webhooks/tickets//dest/airtable/tblPinFQ8dUbrhzPn`, - 'X', - ), - }, - }, - }, - ], - }, - ], - }, - ], - }) - - expect(res).toEqual( - new Error('CRYPTOCAFE_TICKET_WEBHOOK_KEY and SALT must be set'), - ) -}) - -it('validator returns error when SALT is empty', () => { - process.env.CRYPTOCAFE_TICKET_WEBHOOK_KEY = 'X' - process.env.SALT = '' - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:tickets', - options: [ - { - key: 'tickets', - value: [ - { - webhooks: { - used: { - encrypted: jsonwebtoken.sign( - `https://clubs-userland-cryptocafe.vercel.app/api/webhooks/tickets/X/dest/airtable/tblPinFQ8dUbrhzPn`, - '.', - ), - }, - }, - }, - ], - }, - ], - }, - ], - }) - - expect(res).toEqual( - new Error('CRYPTOCAFE_TICKET_WEBHOOK_KEY and SALT must be set'), - ) -}) - -it.skip( - 'encodeIfValid is a function that returned by validatorFactory encapsulate validator', -) diff --git a/scripts/populate/validators/tanadao.mjs b/scripts/populate/validators/tanadao.mjs deleted file mode 100644 index 0ae1c8b44..000000000 --- a/scripts/populate/validators/tanadao.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import { encode } from '@devprotocol/clubs-core' -import { override } from '../constants/tanadao.mjs' -import { validatorFactory } from './validatorFactory.mjs' - -export const validator = (config) => { - const testForClubsPayments = (() => { - const plugin = config.plugins.find( - ({ id }) => id === 'devprotocol:clubs:plugin:clubs-payments', - ) - - const expectedOptions = [ - { - key: 'override', - value: override, - }, - ] - - const pluginHasExpectedOptions = - encode(plugin.options) === encode(expectedOptions) - return pluginHasExpectedOptions - ? true - : new Error('Clubs Payments options does not have the expected options.') - })() - - return testForClubsPayments -} - -export const encodeIfValid = validatorFactory(validator) diff --git a/scripts/populate/validators/tanadao.test.mjs b/scripts/populate/validators/tanadao.test.mjs deleted file mode 100644 index 4874ddf50..000000000 --- a/scripts/populate/validators/tanadao.test.mjs +++ /dev/null @@ -1,47 +0,0 @@ -import { expect, it } from 'vitest' -import { validator } from './tanadao.mjs' -import { override } from '../constants/tanadao.mjs' - -it('validator returns true when the config has correct values', () => { - const expectedOptions = [ - { - key: 'override', - value: override, - }, - ] - - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:clubs-payments', - options: expectedOptions, - }, - ], - }) - - expect(res).toBe(true) -}) - -it('validator returns error when the config has not correct values', () => { - const res = validator({ - plugins: [ - { - id: 'devprotocol:clubs:plugin:clubs-payments', - options: [ - { - key: 'override', - value: [...override, override[0]], - }, - ], - }, - ], - }) - - expect(res).toEqual( - new Error('Clubs Payments options does not have the expected options.'), - ) -}) - -it.skip( - 'encodeIfValid is a function that returned by validatorFactory encapsulate validator', -) diff --git a/scripts/populate/validators/validatorFactory.mjs b/scripts/populate/validators/validatorFactory.mjs deleted file mode 100644 index 9cc89b93e..000000000 --- a/scripts/populate/validators/validatorFactory.mjs +++ /dev/null @@ -1,21 +0,0 @@ -import { encode } from '@devprotocol/clubs-core' - -export const validatorFactory = (validator) => (config) => { - const originalConfig = encode(config) - const result = validator(config) - const encodedConfig = encode(config) - - if (originalConfig === encodedConfig && result === true) { - return encodedConfig - } - - if (result !== true && !(result instanceof Error)) { - throw new Error('Validator result must be true or Error') - } - - if (originalConfig !== encodedConfig) { - throw new Error('Validator is not allowed to change config') - } - - throw new Error(result.message) -} diff --git a/scripts/populate/validators/validatorFactory.test.mjs b/scripts/populate/validators/validatorFactory.test.mjs deleted file mode 100644 index 347aaa539..000000000 --- a/scripts/populate/validators/validatorFactory.test.mjs +++ /dev/null @@ -1,49 +0,0 @@ -import { expect, it } from 'vitest' -import { validatorFactory } from './validatorFactory.mjs' -import { encode } from '@devprotocol/clubs-core' - -it('validatorFactory returns a curryed function that takes config and returns encoded config', () => { - const validator = validatorFactory((config) => { - expect(config.name).toBe('test') - return true - }) - - expect(validator({ name: 'test' })).toEqual(encode({ name: 'test' })) -}) - -it('created function throws an Error when the handler returns a value other than true', () => { - const validator = validatorFactory(() => { - return false - }) - expect(() => validator({ name: 'test' })).toThrowError( - 'Validator result must be true or Error', - ) -}) - -it('created function throws an Error when the handler returns a value other than Error', () => { - const validator = validatorFactory(() => { - return undefined - }) - expect(() => validator({ name: 'test' })).toThrowError( - 'Validator result must be true or Error', - ) -}) - -it('created function bypasses/throws an Error if the handler returns Error', () => { - const validator = validatorFactory(() => { - return new Error('TEST') - }) - - expect(() => validator({ name: 'test' })).toThrowError('TEST') -}) - -it('created function throws an Error when the config will be changed in validation flow', () => { - const validator = validatorFactory((config) => { - config.name = 'changed' - return true - }) - - expect(() => validator({ name: 'test' })).toThrowError( - 'Validator is not allowed to change config', - ) -}) diff --git a/scripts/query.mjs b/scripts/query.mjs deleted file mode 100644 index b9d70087e..000000000 --- a/scripts/query.mjs +++ /dev/null @@ -1,29 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { scanOnlyClubs } from './lib.scanOnlyClubs.mjs' -// import { decode, encode } from '@devprotocol/clubs-core' - -dotenv.config() - -const app = async () => { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - let count = 0 - for await (const key of scanOnlyClubs(client)) { - if (/^[a-z]+::/i.test(key)) { - // This key is not a tenant. - continue - } - - count++ - console.log({ key, count }) - } - await client.quit() -} - -app() diff --git a/scripts/redis-info.mjs b/scripts/redis-info.mjs deleted file mode 100644 index 679d9b637..000000000 --- a/scripts/redis-info.mjs +++ /dev/null @@ -1,74 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' - -dotenv.config() - -/** - * This was made with the intention to give some transparency - * to the max connections issue we have been facing. - * - * Specifically, if you scroll to the "Clients" section in the log after running, - * it will tell the number of connected_clients, and maxclients - */ -const main = async () => { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - - await client.connect() - - let connections = 0 - - setInterval(async () => { - const info = await client.info('clients') - // console.log('connections: ', info) - const lines = info.split('\n') - const connectedClientsLine = lines.find((line) => - line.startsWith('connected_clients:'), - ) - /** - * Parse the number of connected clients - */ - if (connectedClientsLine) { - const connectedClients = +connectedClientsLine.split(':')[1] - - /** - * Only log when the number of connections has changed - * so we don't jam up the console - */ - if (connections !== connectedClients) { - connections = connectedClients - - // get the time in the local timezone - const now = new Date().toLocaleString() - - console.log(`${now}: connected_clients: ${connectedClients}`) - } - } - }, 1000) - - // Handle Ctrl+C - process.on('SIGINT', async () => { - console.log('Received SIGINT. Shutting down...') - // client.quit(() => { - // process.exit(); - // }); - - if ( - client.status === 'ready' || - client.status === 'connect' || - client.status === 'reconnecting' - ) { - const success = await client.quit() - console.log('client quit? ', success) - } else { - console.log('client already closed') - } - - process.exit() - }) -} - -main() diff --git a/scripts/redis-kill-connections.mjs b/scripts/redis-kill-connections.mjs deleted file mode 100644 index 1c35af7c2..000000000 --- a/scripts/redis-kill-connections.mjs +++ /dev/null @@ -1,42 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' - -dotenv.config() - -/** - * When we need to manually kill all connections to Redis - */ -const main = async () => { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - - await client.connect() - - // Get a list of all clients - - const clientsList = await client.sendCommand(['CLIENT', 'LIST']) // Use an array of RedisCommandArguments - - // // Parse the clients list and get the IDs of all clients - const clientIds = clientsList - .split('\n') - .filter((line) => line) - .map((line) => { - const match = line.match(/id=(\d+)/) - return match ? match[1] : null - }) - .filter((id) => id !== null) - - console.log('clientIds: ', clientIds) - - // // Disconnect each client - for (const id of clientIds) { - await client.sendCommand(['CLIENT', 'KILL', 'ID', id]) - } - - await client.quit() -} - -main() diff --git a/scripts/send/index.mjs b/scripts/send/index.mjs deleted file mode 100644 index 12be983ab..000000000 --- a/scripts/send/index.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import fetch from 'cross-fetch' -import PQueue from 'p-queue' -import dotenv from 'dotenv' -import options from './options.mjs' - -dotenv.config() - -const queue = new PQueue({ concurrency: 1, interval: 10 * 1000 }) - -const run = async () => { - const result = await queue.addAll( - options.map( - ({ requestId, rpcUrl, chainId, args }) => - () => - fetch( - 'https://send.devprotocol.xyz/api/send-transactions/SwapTokensAndStakeDev', - { - method: 'POST', - headers: { - Authorization: `Bearer ${process.env.SEND_DEVPROTOCOL_API_KEY}`, - }, - body: JSON.stringify({ requestId, rpcUrl, chainId, args }), - }, - ) - .then((res) => { - console.log({ res, args }) - return res - }) - .catch((err) => new Error(err)), - ), - ) - - console.log({ result }) -} - -run() diff --git a/scripts/send/options.mjs b/scripts/send/options.mjs deleted file mode 100644 index 79a3bc83e..000000000 --- a/scripts/send/options.mjs +++ /dev/null @@ -1,46 +0,0 @@ -import { ZeroAddress, parseUnits, randomBytes, uuidV4 } from 'ethers' - -/** - * Define the base options. Please rewrite the common parameters as necessary. - */ -const base = { - rpcUrl: 'https://polygon-bor.publicnode.com', - chainId: 137, - args: { - to: '', - property: '', - payload: '0x0', - gatewayAddress: '', - amounts: { - token: ZeroAddress, - input: parseUnits('1', 18).toString(), - fee: parseUnits('0.9', 18).toString(), - }, - }, -} - -/** - * Define the destination list. - */ -const dest = [ZeroAddress, ZeroAddress, ZeroAddress] - -/** - * Utility functions. - */ -const createId = () => { - const id = uuidV4(randomBytes(8)) - return (key) => `${id}-${key}` -} -const id = createId() - -/** - * Export all the options. - */ -export default dest.map((to, i) => ({ - ...base, - args: { - ...base.args, - to, - }, - requestId: id(i), -})) diff --git a/scripts/ticket.mjs b/scripts/ticket.mjs deleted file mode 100644 index 485d238ad..000000000 --- a/scripts/ticket.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import dotenv from 'dotenv' -import { bytes32Hex, decode, encode } from '@devprotocol/clubs-core' -import { isAddress } from 'ethers' -import { createClient } from 'redis' - -dotenv.config() - -const PROPERTY_ADDRESS = '0xF1AA1fC5a248bDCF531E45447916d49d54212AdE' -const PAYLOAD_OR_CONTRACT = - '0x396997483c76a2c9a30d9800f563c27dc0faeb0c69195989c866806bde5637bd' -const BENEFIT_ID = 'one-time-cafe-access' -const DATE = new Date('2024-04-05T10:00:00+09:00') -const TOKEN_ID = 414 - -const app = async () => { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - const key = `devprotocol:clubs:plugin:tickets:history:${PROPERTY_ADDRESS}:${isAddress(PAYLOAD_OR_CONTRACT) ? `addr:${PAYLOAD_OR_CONTRACT}` : bytes32Hex(PAYLOAD_OR_CONTRACT)}#${TOKEN_ID}` - const existingData = await client.get(key) - - /** @type Record */ - const histories = existingData ? decode(existingData) : {} - const nextHistory = { - ...histories, - [BENEFIT_ID]: { - datetime: DATE, - }, - } - - await client.set(key, encode(nextHistory)) - await client.quit() - console.log('Set', nextHistory) -} - -app() diff --git a/scripts/upgrade-alchemy.mjs b/scripts/upgrade-alchemy.mjs deleted file mode 100644 index 967521e05..000000000 --- a/scripts/upgrade-alchemy.mjs +++ /dev/null @@ -1,65 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { decode, encode } from '@devprotocol/clubs-core' -import { scanOnlyClubs } from './lib.scanOnlyClubs.mjs' - -dotenv.config() - -const upgrade = (key, config) => { - const deocdedConfig = decode(config) - const upgradedConfig = { ...deocdedConfig } - - if (upgradedConfig.rpcUrl?.includes('infura')) { - upgradedConfig.rpcUrl = `https://${ - upgradedConfig.chainId === 1 - ? 'eth-mainnet.g.alchemy.com' - : upgradedConfig.chainId === 137 - ? 'polygon-mainnet.g.alchemy.com' - : upgradedConfig.chainId === 80002 - ? 'polygon-amoy.g.alchemy.com' - : upgradedConfig.chainId === 42161 - ? 'arb-mainnet.g.alchemy.com' - : 'eth-mainnet.g.alchemy.com' - }/v2/${process.env.PUBLIC_ALCHEMY_KEY}` - } - - return encode(upgradedConfig) -} - -const app = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - for await (const key of scanOnlyClubs(client)) { - if (key.includes(':')) { - // This is not a ClubsConfiguration - console.log('Skipped:', key) - continue - } - - const encodedConfig = await client.get(key) - const upgradedConfig = upgrade(key, encodedConfig) - if (encodedConfig === upgradedConfig) { - console.log('Up-to-date', key) - continue - } - - console.log('Detect:', key) - await client.set(key, upgradedConfig) - console.log('Upgraded:', key) - } - - console.log('DB Upgraded') - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error upgrading db: ', error) - } -} - -app() diff --git a/scripts/upgrade-posts-v2.mjs b/scripts/upgrade-posts-v2.mjs deleted file mode 100644 index 969164cc0..000000000 --- a/scripts/upgrade-posts-v2.mjs +++ /dev/null @@ -1,217 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { decode, encode } from '@devprotocol/clubs-core' -import { v5 as uuidv5 } from 'uuid' -import { toUtf8Bytes } from 'ethers' -import { scanOnlyClubs } from './lib.scanOnlyClubs.mjs' - -dotenv.config() - -let isIndexCreated = false - -const upgradeConfig = (decodedConfig, feeds) => { - const upgradedConfig = { - ...decodedConfig, - plugins: decodedConfig.plugins.map((plugin) => { - /** - * Find the posts plugin - */ - if (plugin.id === 'devprotocol:clubs:plugin:posts') { - /** - * Find the feeds option and replace it with the new one - */ - const options = plugin.options.map((option) => { - if (option.key === 'feeds') { - return { - key: 'feeds', - value: feeds, - } - } - return option - }) - - return { ...plugin, options } - } - return plugin - }), - } - - return encode(upgradedConfig) -} - -const main = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - /** - * Drop the indexes - */ - const indexes = [ - 'idx::devprotocol:clubs:plugin:posts::post', - 'idx::devprotocol:clubs:plugin:posts::comment', - 'idx::devprotocol:clubs:plugin:posts::reaction', - 'idx::devprotocol:clubs:plugin:posts::option', - ] - - await Promise.all( - indexes.map(async (index) => { - try { - await client.ft.info(index) - // If the above line doesn't throw an error, the index exists, so we can drop it - await client.ft.dropIndex(index) - } catch (error) { - // If the index doesn't exist, an error will be thrown and we can ignore it - console.log( - `Index ${index} does not exist or other error occurred: ${error.message}`, - ) - } - }), - ) - - /** - * Loop through the redis keys - */ - for await (const key of scanOnlyClubs(client)) { - if (key.includes(':')) { - // This is not a ClubsConfiguration - continue - } - - /** - * Fetch the encoded config associated with the key - */ - - const encodedConfig = await client.get(key) - const decodedConfig = decode(encodedConfig) - - /** - * Find the posts plugin - */ - const pluginPost = decodedConfig.plugins.find( - (plugin) => plugin.id === 'devprotocol:clubs:plugin:posts', - ) - - /** Club doesn't have Posts installed, continue */ - if (!pluginPost) { - console.log('Skipped: no post plugin', key) - continue - } - - /** - * Find the feeds option - **/ - const feeds = pluginPost.options.find((option) => option.key === 'feeds') - - /** Club doesn't have Posts installed, continue */ - if (!feeds) { - console.log('Skipped: no feeds found', key) - continue - } - - /** - * We add the new feed value for copying the posts content - */ - const scope = uuidv5( - toUtf8Bytes('default-2'), - uuidv5(decodedConfig.url, uuidv5.URL), - ) - const appendedFeeds = [ - ...feeds.value.filter((feed) => feed.database.key !== scope), - { - id: 'default-2', - slug: 'posts', - database: { - type: 'documents:redis', - key: scope, - }, - }, - ] - - /** - * Create a new config - */ - const addedFeedValueConfig = upgradeConfig(decodedConfig, appendedFeeds) - - /** - * Save the upgraded config - */ - await client.set(key, addedFeedValueConfig) - console.log('Upgraded', key) - - /** - * Create required indexes - * This API can be called repeatedly, but it has no effect after the first call, so call it only once. - */ - if (isIndexCreated === false) { - const res1 = await fetch( - `http://localhost:3000/sites_/${key}/api/devprotocol:clubs:plugin:posts/indexing/documents:redis`, - { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - }, - ) - - if (!res1.ok) { - console.log('status is: ', res1.status) - console.log('status text is: ', res1.statusText) - console.log('Failed to create indexes', key) - console.log('----') - continue - } - isIndexCreated = true - } - - /** - * Copy posts content - */ - const oldId = 'default' - const newId = 'default-2' - const copyUrl = `http://localhost:3000/sites_/${key}/api/devprotocol:clubs:plugin:posts/${oldId}/copy/to/${newId}` - console.log('Copying posts content', key, copyUrl) - - const res2 = await fetch(copyUrl, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - }) - - if (!res2.ok) { - console.log('status is: ', res2.status) - console.log('status text is: ', res2.statusText) - console.log('Failed to copy posts content', key) - console.log('----') - continue - } - - /** - * Remove the prior feed value - */ - const removedFeeds = appendedFeeds.map((feed) => - feed.id === oldId ? { ...feed, slug: '_old_default_feed' } : feed, - ) - const upgradedConfig = upgradeConfig(decodedConfig, removedFeeds) - - /** - * Set the upgraded config - */ - await client.set(key, upgradedConfig) - console.log('Upgraded', key) - } - - console.log('DB Upgraded') - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.log(error) - } -} - -main() diff --git a/scripts/upgrade-posts-without-encoded.mjs b/scripts/upgrade-posts-without-encoded.mjs deleted file mode 100644 index b3e5f3bbc..000000000 --- a/scripts/upgrade-posts-without-encoded.mjs +++ /dev/null @@ -1,112 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { decode, encode } from '@devprotocol/clubs-core' -import { scanOnlyClubs } from './lib.scanOnlyClubs.mjs' - -dotenv.config() - -const FEEDS = 'feeds' -const ENCODED_REDIS = 'encoded:redis' - -const upgrade = (key, config) => { - const deocdedConfig = decode(config) - const upgradedConfig = { ...deocdedConfig } - - upgradedConfig.plugins = upgradedConfig.plugins.map((plugin) => { - if ( - plugin.id === 'devprotocol:clubs:plugin:posts' && - plugin.options.some( - (opt) => - opt.key === FEEDS && - opt.value.some((feed) => feed.database.type === ENCODED_REDIS), - ) - ) { - const feeds = plugin.options?.find((opt) => opt.key === FEEDS) ?? { - key: FEEDS, - value: [], - } - - const oldFeeds = { - key: '_old_feeds_', - value: feeds.value.filter( - (feed) => feed.database.type === ENCODED_REDIS, - ), - } - - // Filter out the feeds with type 'encoded:redis' - feeds.value = feeds.value.filter( - (feed) => feed.database.type !== ENCODED_REDIS, - ) - - feeds.value = - // If there is only one feed, set the id 'default' to the feed - feeds.value.length === 1 - ? feeds.value.map((feed) => ({ ...feed, id: 'default' })) - : feeds.value - - const next = { - ...plugin, - options: [ - ...plugin.options.filter((opt) => opt.key !== FEEDS), - feeds, - oldFeeds, - ], - } - - console.log(key, next) - return next - } - - // No changes - return plugin - }) - - return encode(upgradedConfig) -} - -const app = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - const allChanges = new Set() - for await (const key of scanOnlyClubs(client)) { - if (key.includes(':')) { - // This is not a ClubsConfiguration - // console.log('Skip', key) - continue - } - - console.log('◆ Run', key) - - client.get(key).then(async (encodedConfig) => { - const upgradedConfig = upgrade(key, encodedConfig) - if (encodedConfig === upgradedConfig) { - console.log('No changes', key) - return - } - - console.log('🔷 Detect changes', key) - - await client.set(key, upgradedConfig) - console.log('Upgraded:', key) - - allChanges.add(key) - }) - } - - console.log('All changes:', Array.from(allChanges)) - - console.log('DB Upgraded') - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error upgrading db: ', error) - } -} - -app() diff --git a/scripts/upgrade-single.mjs b/scripts/upgrade-single.mjs deleted file mode 100644 index e662bbdf9..000000000 --- a/scripts/upgrade-single.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import dotenv from 'dotenv' -import { upgrade } from './lib.upgrade.mjs' - -dotenv.config() - -const KEY = 'xxx' - -const app = () => { - upgrade((config) => { - const upgradedConfig = { ...config } - - /** - * Write upgrading script here - */ - - return upgradedConfig - }, KEY) -} - -app() diff --git a/scripts/upgrade.mjs b/scripts/upgrade.mjs deleted file mode 100644 index 7ecf9be7b..000000000 --- a/scripts/upgrade.mjs +++ /dev/null @@ -1,116 +0,0 @@ -import { createClient } from 'redis' -import dotenv from 'dotenv' -import { decode, encode } from '@devprotocol/clubs-core' -import { scanOnlyClubs } from './lib.scanOnlyClubs.mjs' - -dotenv.config() - -const upgrade = (key, config) => { - const deocdedConfig = decode(config) - const upgradedConfig = { ...deocdedConfig } - - if (upgradedConfig.url.includes('')) { - console.log(key, 'has on `url`') - - upgradedConfig.url = `https://${key}.clubs.place` - } - - upgradedConfig.plugins = upgradedConfig.plugins.map((plg) => { - if (plg.id) { - // no need to upgrade - return plg - } - return plg.name === 'admin' - ? { ...plg, id: 'clubs-core:admin' } - : plg.name === 'defaultTheme' - ? { ...plg, id: 'devprotocol:clubs:theme-1' } - : plg.name === 'join' - ? { ...plg, id: 'devprotocol:clubs:plugin:join' } - : plg.name === 'me' - ? { ...plg, id: 'devprotocol:clubs:plugin:me' } - : plg.name === 'community' - ? { ...plg, id: 'devprotocol:clubs:plugin:community' } - : plg.name === 'quests' - ? { ...plg, id: 'devprotocol:clubs:plugin:quests' } - : plg.name === 'members' - ? { ...plg, id: 'devprotocol:clubs:plugin:members' } - : plg.name === 'memberships' - ? { ...plg, id: 'devprotocol:clubs:simple-memberships' } - : plg.name === 'message' - ? { ...plg, id: 'devprotocol:clubs:gated-contact-form' } - : plg.name === 'marketplace' - ? { ...plg, id: 'devprotocol:clubs:clubsx:marketplace' } - : plg.name === 'perks' - ? { ...plg, id: 'devprotocol:clubs:plugin:perks' } - : plg.name === 'fiat' - ? { - ...plg, - id: 'devprotocol:clubs:plugin:pay-by-card', - } - : plg.name === 'buy' - ? { ...plg, id: 'devprotocol:clubs:plugin:buy' } - : plg.name === 'nft' - ? { ...plg, id: 'devprotocol:clubs:plugin:nft' } - : (() => { - console.error( - key, - plg.name, - 'This plugin does not have a suitable upgrade script', - ) - return plg - })() - }) - - if ( - upgradedConfig.plugins.every( - (p) => p.id !== 'devprotocol:clubs:clubsx:marketplace', - ) - ) { - console.log(key, 'has not marketplace on `plugins`') - - upgradedConfig.plugins = [ - ...upgradedConfig.plugins, - { id: 'devprotocol:clubs:clubsx:marketplace', options: [] }, - ] - } - - return encode(upgradedConfig) -} - -const app = async () => { - try { - const client = createClient({ - url: process.env.REDIS_URL, - username: process.env.REDIS_USERNAME ?? '', - password: process.env.REDIS_PASSWORD ?? '', - }) - await client.connect() - - for await (const key of scanOnlyClubs(client)) { - if (key.includes(':')) { - // This is not a ClubsConfiguration - console.log('Skipped:', key) - continue - } - - const encodedConfig = await client.get(key) - const upgradedConfig = upgrade(key, encodedConfig) - if (encodedConfig === upgradedConfig) { - console.log('Up-to-date', key) - continue - } - - console.log('Detect:', key) - await client.set(key, upgradedConfig) - console.log('Upgraded:', key) - } - - console.log('DB Upgraded') - await client.quit() - console.log('Closed the DB connection') - } catch (error) { - console.error('error upgrading db: ', error) - } -} - -app() diff --git a/src/plugins/clubs-payments/Id.astro b/src/Id.astro similarity index 100% rename from src/plugins/clubs-payments/Id.astro rename to src/Id.astro diff --git a/src/plugins/clubs-payments/TransactionForm.svelte b/src/TransactionForm.svelte similarity index 100% rename from src/plugins/clubs-payments/TransactionForm.svelte rename to src/TransactionForm.svelte diff --git a/src/plugins/clubs-payments/api/fulfillment.test.ts b/src/api/fulfillment.test.ts similarity index 99% rename from src/plugins/clubs-payments/api/fulfillment.test.ts rename to src/api/fulfillment.test.ts index af6ca7a15..5d25cb1ca 100644 --- a/src/plugins/clubs-payments/api/fulfillment.test.ts +++ b/src/api/fulfillment.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { expect, describe, it, vi, afterEach, type Mock } from 'vitest' import { abi, post, type RequestBody } from './fulfillment' import type { APIContext } from 'astro' @@ -11,7 +12,6 @@ import { generateFulFillmentParamsId } from '../utils/gen-key' import { sha512 } from 'crypto-hash' import { Status, createRequestBody } from '../utils/webhooks' import type { PartialDeep } from 'type-fest' -import { beforeEach } from 'node:test' const redisData = new Map() const POP_SERVER_KEY = '!@#' diff --git a/src/plugins/clubs-payments/api/fulfillment.ts b/src/api/fulfillment.ts similarity index 100% rename from src/plugins/clubs-payments/api/fulfillment.ts rename to src/api/fulfillment.ts diff --git a/src/plugins/clubs-payments/api/payment-key.ts b/src/api/payment-key.ts similarity index 99% rename from src/plugins/clubs-payments/api/payment-key.ts rename to src/api/payment-key.ts index 85d33dc6b..4734c0395 100644 --- a/src/plugins/clubs-payments/api/payment-key.ts +++ b/src/api/payment-key.ts @@ -15,7 +15,7 @@ import { whenNotError, whenNotErrorAll } from '@devprotocol/util-ts' import { createClient } from 'redis' import { generateFulFillmentParamsId } from '../utils/gen-key' import { bytes32Hex, getTokenAddress } from '@devprotocol/clubs-core' -import { replaceWithFwdHost } from '@fixtures/url' +import { replaceWithFwdHost } from '../fixtures/url' const { POP_SERVER_KEY, REDIS_URL, REDIS_USERNAME, REDIS_PASSWORD } = import.meta.env diff --git a/src/assets/Article1.png b/src/assets/Article1.png deleted file mode 100644 index acf9202ad..000000000 Binary files a/src/assets/Article1.png and /dev/null differ diff --git a/src/assets/Article2.png b/src/assets/Article2.png deleted file mode 100644 index 1502ed705..000000000 Binary files a/src/assets/Article2.png and /dev/null differ diff --git a/src/assets/Article3.png b/src/assets/Article3.png deleted file mode 100644 index f3f0c6eab..000000000 Binary files a/src/assets/Article3.png and /dev/null differ diff --git a/src/assets/CaseStudyMedia1.png b/src/assets/CaseStudyMedia1.png deleted file mode 100644 index f65b22c2b..000000000 Binary files a/src/assets/CaseStudyMedia1.png and /dev/null differ diff --git a/src/assets/CaseStudyMedia2.png b/src/assets/CaseStudyMedia2.png deleted file mode 100644 index ee5ab7e05..000000000 Binary files a/src/assets/CaseStudyMedia2.png and /dev/null differ diff --git a/src/assets/CaseStudyMedia3.png b/src/assets/CaseStudyMedia3.png deleted file mode 100644 index 579908fc3..000000000 Binary files a/src/assets/CaseStudyMedia3.png and /dev/null differ diff --git a/src/assets/DevProtocol_b_Brandmark_rgb_01.svg b/src/assets/DevProtocol_b_Brandmark_rgb_01.svg deleted file mode 100644 index 902c6f72c..000000000 --- a/src/assets/DevProtocol_b_Brandmark_rgb_01.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/ETH.svg b/src/assets/ETH.svg deleted file mode 100644 index 789111d18..000000000 --- a/src/assets/ETH.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/assets/Grade.png b/src/assets/Grade.png deleted file mode 100644 index d2a763bfb..000000000 Binary files a/src/assets/Grade.png and /dev/null differ diff --git a/src/assets/Hero.png b/src/assets/Hero.png deleted file mode 100644 index 021fab325..000000000 Binary files a/src/assets/Hero.png and /dev/null differ diff --git a/src/assets/Instant-Memberships-Payment-Type.svg b/src/assets/Instant-Memberships-Payment-Type.svg deleted file mode 100644 index ee3a500ef..000000000 --- a/src/assets/Instant-Memberships-Payment-Type.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/MATIC.svg b/src/assets/MATIC.svg deleted file mode 100644 index a5bb6124f..000000000 --- a/src/assets/MATIC.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - diff --git a/src/assets/OGP.png b/src/assets/OGP.png deleted file mode 100644 index a34e12733..000000000 Binary files a/src/assets/OGP.png and /dev/null differ diff --git a/src/assets/Plugins/Feeds.svg b/src/assets/Plugins/Feeds.svg deleted file mode 100644 index 30db53f04..000000000 --- a/src/assets/Plugins/Feeds.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/Stake-Memberships-Payment-Type.svg b/src/assets/Stake-Memberships-Payment-Type.svg deleted file mode 100644 index f7630a058..000000000 --- a/src/assets/Stake-Memberships-Payment-Type.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/Step-1.png b/src/assets/Step-1.png deleted file mode 100644 index 27aca8b43..000000000 Binary files a/src/assets/Step-1.png and /dev/null differ diff --git a/src/assets/Step-2.png b/src/assets/Step-2.png deleted file mode 100644 index 4d0dc4841..000000000 Binary files a/src/assets/Step-2.png and /dev/null differ diff --git a/src/assets/Step-3.png b/src/assets/Step-3.png deleted file mode 100644 index e775c3201..000000000 Binary files a/src/assets/Step-3.png and /dev/null differ diff --git a/src/assets/USDC.svg b/src/assets/USDC.svg deleted file mode 100644 index 5dfea926e..000000000 --- a/src/assets/USDC.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/assets/X.svg b/src/assets/X.svg deleted file mode 100644 index deb6013a5..000000000 --- a/src/assets/X.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/assets/accessControl.cryptocafe.description$1.md b/src/assets/accessControl.cryptocafe.description$1.md deleted file mode 100644 index aca68075d..000000000 --- a/src/assets/accessControl.cryptocafe.description$1.md +++ /dev/null @@ -1,3 +0,0 @@ -1. Please fill out [this form](https://airtable.com/appIMm1OL6Bf1o8Tg/shrnXUjSU5mQf4YMP): 以下のフォームに必要な情報をご記入ください: - -2. Reload this page! diff --git a/src/assets/accessControl.cryptocafe.description$2.md b/src/assets/accessControl.cryptocafe.description$2.md deleted file mode 100644 index a45164c89..000000000 --- a/src/assets/accessControl.cryptocafe.description$2.md +++ /dev/null @@ -1,3 +0,0 @@ -1. Please fill out [this form](https://airtable.com/appIMm1OL6Bf1o8Tg/shrjuJBqTkPWb4U4M): 以下のフォームに必要な情報をご記入ください: - -2. You will be notified by email when you are approved, so please wait for it. 3営業日以内にメールにて購入リンクをお送りいたします。 diff --git a/src/assets/artifacts/101.png b/src/assets/artifacts/101.png deleted file mode 100644 index 3b4d28894..000000000 Binary files a/src/assets/artifacts/101.png and /dev/null differ diff --git a/src/assets/artifacts/108.png b/src/assets/artifacts/108.png deleted file mode 100644 index ea8e3a37f..000000000 Binary files a/src/assets/artifacts/108.png and /dev/null differ diff --git a/src/assets/artifacts/12.png b/src/assets/artifacts/12.png deleted file mode 100644 index 50c112712..000000000 Binary files a/src/assets/artifacts/12.png and /dev/null differ diff --git a/src/assets/artifacts/125.png b/src/assets/artifacts/125.png deleted file mode 100644 index 8af7b13a7..000000000 Binary files a/src/assets/artifacts/125.png and /dev/null differ diff --git a/src/assets/artifacts/259.png b/src/assets/artifacts/259.png deleted file mode 100644 index 93a610a7f..000000000 Binary files a/src/assets/artifacts/259.png and /dev/null differ diff --git a/src/assets/artifacts/40.png b/src/assets/artifacts/40.png deleted file mode 100644 index a5c22badf..000000000 Binary files a/src/assets/artifacts/40.png and /dev/null differ diff --git a/src/assets/artifacts/89.png b/src/assets/artifacts/89.png deleted file mode 100644 index 1aaa36925..000000000 Binary files a/src/assets/artifacts/89.png and /dev/null differ diff --git a/src/assets/artifacts/92.png b/src/assets/artifacts/92.png deleted file mode 100644 index 30e5bfb4c..000000000 Binary files a/src/assets/artifacts/92.png and /dev/null differ diff --git a/src/assets/avatar.png b/src/assets/avatar.png deleted file mode 100644 index 93e160a6e..000000000 Binary files a/src/assets/avatar.png and /dev/null differ diff --git a/src/assets/avator.svg b/src/assets/avator.svg deleted file mode 100644 index 648d18d2d..000000000 --- a/src/assets/avator.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/assets/badge1.png b/src/assets/badge1.png deleted file mode 100644 index 0a984aa07..000000000 Binary files a/src/assets/badge1.png and /dev/null differ diff --git a/src/assets/badge2.png b/src/assets/badge2.png deleted file mode 100644 index 1e87def42..000000000 Binary files a/src/assets/badge2.png and /dev/null differ diff --git a/src/assets/badge3.png b/src/assets/badge3.png deleted file mode 100644 index 84c327551..000000000 Binary files a/src/assets/badge3.png and /dev/null differ diff --git a/src/assets/banner_clubs.png b/src/assets/banner_clubs.png deleted file mode 100644 index c4bf08f3e..000000000 Binary files a/src/assets/banner_clubs.png and /dev/null differ diff --git a/src/assets/brands/discord--black.svg b/src/assets/brands/discord--black.svg deleted file mode 100644 index 4b7477340..000000000 --- a/src/assets/brands/discord--black.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/brands/medium--black.svg b/src/assets/brands/medium--black.svg deleted file mode 100644 index b0b00c717..000000000 --- a/src/assets/brands/medium--black.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/brands/twitter--black.svg b/src/assets/brands/twitter--black.svg deleted file mode 100644 index a0cd1a4cf..000000000 --- a/src/assets/brands/twitter--black.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/src/assets/closeIcon.svg b/src/assets/closeIcon.svg deleted file mode 100644 index 9028ba2de..000000000 --- a/src/assets/closeIcon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/cover-1.jpg b/src/assets/cover-1.jpg deleted file mode 100644 index f9ee9c1e6..000000000 Binary files a/src/assets/cover-1.jpg and /dev/null differ diff --git a/src/assets/cover-2.jpg b/src/assets/cover-2.jpg deleted file mode 100644 index 30b11a17c..000000000 Binary files a/src/assets/cover-2.jpg and /dev/null differ diff --git a/src/assets/cover-3.jpg b/src/assets/cover-3.jpg deleted file mode 100644 index 5b8c412b7..000000000 Binary files a/src/assets/cover-3.jpg and /dev/null differ diff --git a/src/assets/default-plugin-icon.jpg b/src/assets/default-plugin-icon.jpg deleted file mode 100644 index 017968977..000000000 Binary files a/src/assets/default-plugin-icon.jpg and /dev/null differ diff --git a/src/assets/devlogo.svg b/src/assets/devlogo.svg deleted file mode 100644 index affb8a11a..000000000 --- a/src/assets/devlogo.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/assets/devtoken.png b/src/assets/devtoken.png deleted file mode 100644 index 7929b3f32..000000000 Binary files a/src/assets/devtoken.png and /dev/null differ diff --git a/src/assets/devtoken.svg b/src/assets/devtoken.svg deleted file mode 100644 index d48222e57..000000000 --- a/src/assets/devtoken.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/assets/emoji-red-heart.png b/src/assets/emoji-red-heart.png deleted file mode 100644 index 12644aba0..000000000 Binary files a/src/assets/emoji-red-heart.png and /dev/null differ diff --git a/src/assets/gt6zfoja.png b/src/assets/gt6zfoja.png deleted file mode 100644 index 51e71373d..000000000 Binary files a/src/assets/gt6zfoja.png and /dev/null differ diff --git a/src/assets/home-config-default-hero-img.svg b/src/assets/home-config-default-hero-img.svg deleted file mode 100644 index 84ccff833..000000000 --- a/src/assets/home-config-default-hero-img.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/assets/homeConfig.body.md b/src/assets/homeConfig.body.md deleted file mode 100644 index 4a35cb89d..000000000 --- a/src/assets/homeConfig.body.md +++ /dev/null @@ -1,9 +0,0 @@ -### Hi, I'm Alice! - -https://www.youtube.com/watch?v=WgDAezl1RrQ - -The YouTube link you place will automatically display embedded. Try it! YouTube video can be a great help in making your activities briefly known. - -Want to use images in your description? Then try writing it like the following. You can see how the image will display later on the [Preview] page. - -![](https://images.unsplash.com/photo-1674420628423-bf7a338af32d) diff --git a/src/assets/homeConfig.cryptocafe.body.md b/src/assets/homeConfig.cryptocafe.body.md deleted file mode 100644 index 239e43f51..000000000 --- a/src/assets/homeConfig.cryptocafe.body.md +++ /dev/null @@ -1,34 +0,0 @@ -The Crypto Cafe & Bar is an NFT membership-only place in Ebisu, Tokyo - A place to work, grab a drink, and rub elbows with innovators, founders, crypto enthusiasts, or anyone else curious about our vibe. - -Follow us on Twitter to keep up to date on the latest events and news: https://twitter.com/CryptoCafenBar - -We hope to see you here soon! #WGMI - ---- - -Crypto Cafe & Barは恵比寿にある会員制のCafe & Barです。コワーキング利用や、イノベーターや起業家、Cyrptoを愛するコミュニティメンバーとお酒を飲んだり交流する場としてお過ごしください。 - -X (Twitter) をフォローして最新のニュースやイベント情報をゲットしてください。https://twitter.com/CryptoCafenBar - -Crypto Cafe & Barでお会いできるのを楽しみにしています! - -![web](https://i.imgur.com/jGcR09i.png) - -## Access - -〒150-0022 東京都渋谷区恵比寿南3-5-7 デジタルゲートビル2階 - -DG Bldg 2F, 3-5-7 Ebisu Minami, Shibuya-ku, Tokyo 150-0022, Japan - - - -## Info - -| | | -| ---- | ---------------------------------- | -| Cafe | 月ー金 (Mon. - Fri.) 10:00 - 18:00 | -| Bar | 火・金 (Tue. & Fri.) 18:00 - 22:00 | - -## Website - -[リンク](https://cryptocafe.bar/) diff --git a/src/assets/homeConfig.kougenji.body.md b/src/assets/homeConfig.kougenji.body.md deleted file mode 100644 index 9deae82f8..000000000 --- a/src/assets/homeConfig.kougenji.body.md +++ /dev/null @@ -1,35 +0,0 @@ -## Receive NFTs, authentic art pieces by traditional artisans and more. - -### Get NFTs, and redeem authentic art pieces by real traditional craftsmanship. - -
- -Makie lacquer-work plate - -![40 Makie lacquer-work plate](https://i.imgur.com/m5HQXhz.png) - -Transformable panel - -![92 Transformable panel](https://i.imgur.com/UStVM2Y.png) - -Metal panel, moon and autumn grasses - -![89 Metal panel, moon and autumn grasses](https://i.imgur.com/XQqkt1f.png) - -Lotus petal dish flower in the moon - -![12 Lotus petal dish flower in the moon](https://i.imgur.com/60ALfQp.png) - -Virupaksa (Buddhist deity) - -![125 Virupaksa (Buddhist deity)](https://i.imgur.com/1yoKPeb.png) - -Meditation Room - -![101 Meditation Room](https://i.imgur.com/JMHaZVn.png) - -The Light Beyond, Ryunosuke Akutagawa, The Spider's Thread - -![108 The Light Beyond, Ryunosuke Akutagawa, The Spider's Thread](https://i.imgur.com/BePYk2f.png) - -
diff --git a/src/assets/homeConfig.temples.body.md b/src/assets/homeConfig.temples.body.md deleted file mode 100644 index d286e79d8..000000000 --- a/src/assets/homeConfig.temples.body.md +++ /dev/null @@ -1,5 +0,0 @@ -# Temples DAO has been moved - -Temples DAO moved to https://templesdao.clubs.place. - -Temples DAO は https://templesdao.clubs.place に移転しました。 diff --git a/src/assets/instagram.svg b/src/assets/instagram.svg deleted file mode 100644 index 0f7d60545..000000000 --- a/src/assets/instagram.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/key.png b/src/assets/key.png deleted file mode 100644 index 06ada2ef0..000000000 Binary files a/src/assets/key.png and /dev/null differ diff --git a/src/assets/og.png b/src/assets/og.png deleted file mode 100644 index 397131109..000000000 Binary files a/src/assets/og.png and /dev/null differ diff --git a/src/assets/owt3cn75.png b/src/assets/owt3cn75.png deleted file mode 100644 index 246e2e7a1..000000000 Binary files a/src/assets/owt3cn75.png and /dev/null differ diff --git a/src/assets/polygon-logo.svg b/src/assets/polygon-logo.svg deleted file mode 100644 index 258922c0f..000000000 --- a/src/assets/polygon-logo.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/assets/preview-overview-chart.png b/src/assets/preview-overview-chart.png deleted file mode 100644 index 885682e01..000000000 Binary files a/src/assets/preview-overview-chart.png and /dev/null differ diff --git a/src/assets/quests.png b/src/assets/quests.png deleted file mode 100644 index 95eae6066..000000000 Binary files a/src/assets/quests.png and /dev/null differ diff --git a/src/assets/starter-kits.png b/src/assets/starter-kits.png deleted file mode 100644 index 7d1894f34..000000000 Binary files a/src/assets/starter-kits.png and /dev/null differ diff --git a/src/assets/step-check.svg b/src/assets/step-check.svg deleted file mode 100644 index fc5bf593d..000000000 --- a/src/assets/step-check.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/step-rounded-square.svg b/src/assets/step-rounded-square.svg deleted file mode 100644 index 3e34a5273..000000000 --- a/src/assets/step-rounded-square.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/tiktok.svg b/src/assets/tiktok.svg deleted file mode 100644 index b9d72d3c9..000000000 --- a/src/assets/tiktok.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/assets/twitch.svg b/src/assets/twitch.svg deleted file mode 100644 index 5e81483c5..000000000 --- a/src/assets/twitch.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/assets/white-arrow-right.svg b/src/assets/white-arrow-right.svg deleted file mode 100644 index b17ae720a..000000000 --- a/src/assets/white-arrow-right.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/youtube.svg b/src/assets/youtube.svg deleted file mode 100644 index 7d86db8de..000000000 --- a/src/assets/youtube.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/components/Account/Account.vue b/src/components/Account/Account.vue deleted file mode 100644 index 586b130ab..000000000 --- a/src/components/Account/Account.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - diff --git a/src/components/AddNavigationLink/AddNavigationLink.astro b/src/components/AddNavigationLink/AddNavigationLink.astro deleted file mode 100644 index cc3d2d125..000000000 --- a/src/components/AddNavigationLink/AddNavigationLink.astro +++ /dev/null @@ -1,23 +0,0 @@ ---- -import type { - ClubsConfiguration, - ClubsPropsAdminPages, -} from '@devprotocol/clubs-core' -import AddNavigationLink_ from './AddNavigationLink.svelte' -import type { NavLink } from '@constants/navLink' - -const { forAddNavigationLink } = Astro.props as ClubsPropsAdminPages & { - forAddNavigationLink: { - config: ClubsConfiguration - label: string - link: NavLink - } -} ---- - - diff --git a/src/components/AddNavigationLink/AddNavigationLink.svelte b/src/components/AddNavigationLink/AddNavigationLink.svelte deleted file mode 100644 index 86685196a..000000000 --- a/src/components/AddNavigationLink/AddNavigationLink.svelte +++ /dev/null @@ -1,65 +0,0 @@ - - -{#if hasMenu === false} -
- -
-{/if} diff --git a/src/components/AddPluginButton/AddPluginButton.vue b/src/components/AddPluginButton/AddPluginButton.vue deleted file mode 100644 index 1d07ccca7..000000000 --- a/src/components/AddPluginButton/AddPluginButton.vue +++ /dev/null @@ -1,132 +0,0 @@ - - - diff --git a/src/components/Admin/Resources.astro b/src/components/Admin/Resources.astro deleted file mode 100644 index 1cccff793..000000000 --- a/src/components/Admin/Resources.astro +++ /dev/null @@ -1,60 +0,0 @@ ---- -import Bell from '@components/Icons/bell-alert.astro' -import Chat from '@components/Icons/chat-bubble-oval-left-ellipsis.astro' -import Book from '@components/Icons/book-open.astro' -import Code from '@components/Icons/code-bracket.astro' -import Question from '@components/Icons/question-mark-circle.astro' - -const data = [ - { - label: `What's new`, - link: 'https://developers.clubs.place/posts', - icon: Bell, - }, - { - label: 'Guide', - link: 'https://app.charmverse.io/clubs-help-center/clubs-help-center-22949386729043408', - icon: Book, - }, - { - label: 'News', - link: 'https://www.clubs.place/news', - icon: Chat, - }, - { - label: 'Support', - link: 'https://discord.gg/TFBZGM9jf3', - icon: Question, - }, - { - label: 'Developer', - link: 'https://docs.devprotocol.xyz/concepts/', - icon: Code, - }, -] ---- - - diff --git a/src/components/Tmp/AdminAirtable.vue b/src/components/AdminAirtable.vue similarity index 100% rename from src/components/Tmp/AdminAirtable.vue rename to src/components/AdminAirtable.vue diff --git a/src/components/AdminHomeForm/AdminHomeForm.svelte b/src/components/AdminHomeForm/AdminHomeForm.svelte deleted file mode 100644 index 319b3b0c8..000000000 --- a/src/components/AdminHomeForm/AdminHomeForm.svelte +++ /dev/null @@ -1,258 +0,0 @@ - - -
update(e)}> -
-
- Hero - -
- - -
- -
- - -
-
- -
- What We Do - -
- - -
- - {#each homeConfig.whatWeDo.images as image, i} -
-
- - {#if image.image && image.image != ''} - - {:else} - - onFileSelected(i, e, true)} - /> - {/if} -
- -
- - -
- - {#if i === homeConfig.whatWeDo.images.length - 1} - - {/if} -
- {/each} - -
- Perks - -
- - -
- -
- - -
- - {#each homeConfig.perks.images as perkImage, i} -
-
- - {#if perkImage.image && perkImage.image != ''} - - {:else} - - onFileSelected(i, e, false)} - /> - {/if} -
- -
- - -
-
- - {#if i === homeConfig.perks.images.length - 1} - - {/if} - {/each} -
- -
- Quote - -
- - -
-
-
-
-
diff --git a/src/components/AdminMembershipsForm/AdminMembershipsAdditionForm.svelte b/src/components/AdminMembershipsForm/AdminMembershipsAdditionForm.svelte deleted file mode 100644 index eff8b6ebc..000000000 --- a/src/components/AdminMembershipsForm/AdminMembershipsAdditionForm.svelte +++ /dev/null @@ -1,994 +0,0 @@ - - -
- - {#if loading} -

.

- {/if} - {#if !loading && noOfPositions > 0} -

- ⚠️ {i18n('MembershipInUse')} -

- {/if} -
update()} class="grid gap-16"> -
- -
- - - - -
- {i18n('Image')} - - -

- * JPEG, PNG, GIF, TIFF and animated PNG -

- * {i18n('RecommendedImageSize')} - -

- - - - - - - - {i18n('UseGoogleSlidesTemplate')} - - -

-
- - -
- {i18n('Price')} -
- - -
- {#if isUnpriced(membership)} -
-

- * {i18n('UnpricedCannotBeBought')}, - {i18n('AvailableInviteOnly')} -

-
- {/if} - {#if isPriced(membership)} -
- - -
-

- * - {@html i18n('ChoosingUSDC')} - {@html i18n('CreditCardPlugin')} -

- {#if invalidPriceMsg !== ''} -

* {invalidPriceMsg}

- {/if} - {/if} -
- - {#if isPriced(membership)} - -
- {i18n('EarningModel')} -
- - -
- {#if membershipPaymentType !== 'custom'} - - {/if} - {#if membershipPaymentType === 'custom'} - - {/if} -
-
- {#if membership.currency === 'DEV'} -

- * {i18n('DEVEarningModelDisabled')} -

- {/if} - {#if invalidFeeMsg !== ''} -

* {invalidFeeMsg}

- {/if} -
- - -
-
-
-
-
-

- {BigNumber( - membership.price * (membership.fee?.percentage || 0), - ) - .dp(5) - .toString()} - {membership.currency} ({BigNumber( - (membership.fee?.percentage || 0) * 100, - ) - .dp(3) - .toString()}%) - {i18n('WillEarnAtOnce')} - {BigNumber( - membership.price * (1 - (membership.fee?.percentage || 0)), - ) - .dp(5) - .toString()} ({BigNumber( - (1 - (membership.fee?.percentage || 0)) * 100, - ) - .dp(3) - .toString()}%) - - {i18n('WillBeStaked')} -

-

- * {i18n('WhatIsStaking')} -

-
- {/if} -
- - -
-

Preview

-
- -
-
-
- - -