Skip to content

Commit

Permalink
Merge branch 'master' into ka.magicV2
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtisassad committed Nov 20, 2024
2 parents 808a75b + 5792901 commit 84ce500
Show file tree
Hide file tree
Showing 3,570 changed files with 14,317 additions and 79,785 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/2_feature_command.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ labels: command, enhancement, needs estimate
title: 🟦 <Command Name>
---

# Description
## Description
<!-- A clear and concise description of the feature. -->

## Stakeholders
<!-- The main points of contact for questions relating to the scope of the feature. -->
| Product | Engineering |
| --------- | ----------- |
| @Jane | @John |
| Jane | John |

## Model
<!-- A screenshot or reference to the slice of the model in context. -->
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/2_feature_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ labels: policy, enhancement, needs estimate
title: 🟪 <Policy Name>
---

# Description
## Description
<!-- A clear and concise description of the feature. -->

## Stakeholders
<!-- The main points of contact for questions relating to the scope of the feature. -->
| Product | Engineering |
| --------- | ----------- |
| @Jane | @John |
| Jane | John |

## Model
<!-- A screenshot or reference to the slice of the model in context. -->
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/2_feature_projection.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ labels: projection, enhancement, needs estimate
title: 🟩 <Projection Name>
---

# Description
## Description
<!-- A clear and concise description of the feature. -->

## Stakeholders
<!-- The main points of contact for questions relating to the scope of the feature. -->
| Product | Engineering |
| --------- | ----------- |
| @Jane | @John |
| Jane | John |

## Model
<!-- A screenshot or reference to the slice of the model in context. -->
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/2_feature_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ labels: query, enhancement, needs estimate
title: 🟩 <Query Name>
---

# Description
## Description
<!-- A clear and concise description of the feature. -->

## Stakeholders
<!-- The main points of contact for questions relating to the scope of the feature. -->
| Product | Engineering |
| --------- | ----------- |
| @Jane | @John |
| Jane | John |

## Model
<!-- A screenshot or reference to the slice of the model in context. -->
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ env:
NODE_ENV: 'test'
ROLLBAR_ENV: 'GitHubCI'
TEST_WITHOUT_LOGS: 'true'
ALLOWED_EVENTS: 'ChainEventCreated,SnapshotProposalCreated,ThreadCreated,ThreadUpvoted,SubscriptionPreferencesUpdated,CommentCreated,UserMentioned'
PRIVATE_KEY: 'web3-pk'
USES_DOCKER_PGSQL: true
PORT: 8080
Expand Down Expand Up @@ -452,4 +451,4 @@ jobs:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
parallel-finished: true
68 changes: 68 additions & 0 deletions .github/workflows/Versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Update Client SDK Version

env:
APP_ENV: CI
ALCHEMY_PRIVATE_APP_KEY: ${{ secrets.ALCHEMY_PRIVATE_APP_KEY }}
ALCHEMY_PUBLIC_APP_KEY: ${{ secrets.ALCHEMY_PUBLIC_APP_KEY }}
FEDERATION_POSTGRES_DB_URL: postgresql://commonwealth:edgeware@localhost/common_test

on:
pull_request:
branches:
- production

jobs:
bump_version:
name: 'Bump Api Client Version'
runs-on: ubuntu-latest

services:
postgres:
image: hicommonwealth/cw_postgres:latest
env:
POSTGRES_USER: commonwealth
POSTGRES_DB: common_test
POSTGRES_PASSWORD: edgeware
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.SERVICE_PERSON_ACCESS_TOKEN }}

- uses: ./.github/actions/setup
with:
node-version: 20

- name: Bump external API version if necessary
run: pnpm -F commonwealth validate-external-api-version

- name: Check if version was updated
run: |
if git diff --name-only | grep -q packages/commonwealth/server/external-api-config.json; then
echo "version_updated=true" >> $GITHUB_ENV
else
echo "version_updated=false" >> $GITHUB_ENV
fi
- name: Commit and Push
if: env.version_updated == 'true'
uses: EndBug/add-and-commit@v9
with:
add: 'packages/commonwealth/server/external-api-config.json'
push: true

# May need to add a `repo` scoped personal access token
# if we want to run checks for this new push
# https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-536204092
# with:
# token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ redis-data
**/yarn.lock
*coverage
**/*.dump.sql
**/*.dump.sql.gz
**/*.dump.sql.gz
external-production-openapi.json
external-openapi.json
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
**/eth/artifacts
**/.eslintrc.js
pnpm-lock.yaml
external-api-config.json
9 changes: 2 additions & 7 deletions common_knowledge/Database-ERD.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ erDiagram
CommunityStakes }|..|| Communities : CommunityStakes_community_id_fkey
Notifications }|..|| Communities : Notifications_community_id_fkey
ContestActions }|..|| Threads : ContestActions_threads_fkey
ContestTopics }|..|| Topics : ContestTopics_topics_fkey
Topics }|..|| Communities : Topics_community_id_fkey
Templates }|..|| Communities : Templates_created_for_community_fkey
Groups }|..|| Communities : Groups_chain_id_fkey
Expand All @@ -62,7 +62,7 @@ erDiagram
SsoTokens }|..|| Addresses : SsoTokens_address_id_fkey
StarredCommunities }|..|| Communities : Starredcommunities_community_id_fkey
StarredCommunities }|..|| Users : Starredcommunities_user_id_fkey
ContestTopics }|..|| ContestManagers : ContestTopics_contestmanagers_fkey
Reactions }|..|| Addresses : Reactions_address_id_fkey
Templates }|..|| ContractAbis : Templates_contractabi_id_fkey
Templates }|..|| Communities : Templates_community_id_fkey
Expand Down Expand Up @@ -521,11 +521,6 @@ erDiagram
timestamp-with-time-zone created_at
timestamp-with-time-zone updated_at
}
ContestTopics {
character-varying(255) contest_address PK
integer topic_id PK
timestamp-with-time-zone created_at
}
Users {
character-varying(255) email
timestamp-with-time-zone created_at
Expand Down
13 changes: 6 additions & 7 deletions common_knowledge/Farcaster-Contests.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ FLAG_FARCASTER_CONTEST=true
NEYNAR_API_KEY=
NEYNAR_REPLY_WEBHOOK_URL=https://YOUR_NGROK_DOMAIN/api/integration/farcaster/ReplyCastCreated
FARCASTER_ACTION_URL=https://YOUR_NGROK_DOMAIN/api/integration/farcaster/CastUpvoteAction
FARCASTER_NGROK_DOMAIN=https://YOUR_NGROK_DOMAIN
```

The `ALLOWED_EVENTS` env var contains a comma-seperated list of outbox events. Add these to the list:

`FarcasterCastCreated,FarcasterReplyCastCreated,FarcasterVoteCreated`
Note: `FARCASTER_NGROK_DOMAIN` should only be used locally– not on QA or production.

## Run local services

Expand All @@ -61,10 +60,10 @@ Farcaster allows users to add a custom “action” to their account, which can
- Paste URL into browser, you’ll see the Warpcast page, then click `Add Action`

## How to test the Farcaster/Contests integration
- For testing, you can use any contest that has an associated Topic.
- First, post a farcaster contest URL on Warpcast. It has this format: `https://YOUR_DOMAIN/api/integration/farcaster/contests/CONTEST_ADDRESS/contestCard`
- Fill in your ngrok domain and contest address
- Upon posting, it should trigger the `CastCreated` webhook and associate the Cast (message) with the contest. It’ll also create a new programatic webhook for `CastReplyCreated`.
- Create a Farcaster Contest with a funding token (e.g. CMN on Base Sepolia `0x429ae85883f82203D736e8fc203A455990745ca1`)
- Copy the Farcaster Contest URL. It should have this format: `https://YOUR_DOMAIN/api/integration/farcaster/contests/CONTEST_ADDRESS/contestCard`
- Post a the URL to WarpCast
- it should trigger the `CastCreated` webhook and associate the Cast (message) with the contest. It’ll also create a new programatic webhook for `CastReplyCreated`.
- Then, add a reply message to the contest cast.
- This should trigger the `CastReplyCreated` webhook, which will create onchain content.
- Finally, perform the custom Upvote action on your reply message (icon with 4 squares).
Expand Down
12 changes: 6 additions & 6 deletions common_knowledge/Package-Scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,31 +299,31 @@ See `test-unit`.

### test-api

Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration/api`
Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/integration/api`

Description: Runs all tests in the /api subfolder of the /integration directory.

### test-integration

Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/integration`
Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/integration`

Description: Runs all tests in the /test/integration folder (includes API tests).

### test-devnet:evm

Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/evm`
Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/devnet/evm`

Description: Runs all tests in our `/devnet/evm` folder.

### test-devnet:cosmos

Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run ./test/devnet/cosmos`
Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run ./test/devnet/cosmos`

Description: Runs all tests in our `/devnet/cosmos` folder.

### test-select

Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false run`
Definition: `NODE_ENV=test vitest --config ../../vite.config.ts run`

Description: Append a path to run specific test files or folders.

Expand All @@ -335,7 +335,7 @@ Description: Tests all .spec files within the `./test/unit` sub-directory of tes

### test-select:watch

Definition: `INIT_TEST_DB=true NODE_ENV=test vitest --config ../../vite.config.ts --fileParallelism=false`
Definition: `NODE_ENV=test vitest --config ../../vite.config.ts`

Description: Watches for changes to any .spec files within the given path and automatically runs test when they are updated.

Expand Down
3 changes: 0 additions & 3 deletions libs/adapters/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const {
R2_ACCESS_KEY_ID,
R2_SECRET_ACCESS_KEY,
R2_ACCOUNT_ID,
GENERATE_PRODUCTION_SDK,
} = process.env;

export const config = configure(
Expand Down Expand Up @@ -87,7 +86,6 @@ export const config = configure(
SECRET_ACCESS_KEY: R2_SECRET_ACCESS_KEY,
},
},
GENERATE_PRODUCTION_SDK: GENERATE_PRODUCTION_SDK === 'true',
},
z.object({
CACHE: z.object({
Expand Down Expand Up @@ -326,6 +324,5 @@ export const config = configure(
);
}),
}),
GENERATE_PRODUCTION_SDK: z.boolean(),
}),
);
8 changes: 6 additions & 2 deletions libs/adapters/src/express/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ import { ZodSchema } from 'zod';
* @returns express command handler
*/
export const command =
<Input extends ZodSchema, Output extends ZodSchema, AuthContext>(
md: Metadata<Input, Output, AuthContext>,
<
Input extends ZodSchema,
Output extends ZodSchema,
Context extends ZodSchema,
>(
md: Metadata<Input, Output, Context>,
): RequestHandler =>
async (req: Request, res: Response, next: NextFunction) => {
try {
Expand Down
8 changes: 6 additions & 2 deletions libs/adapters/src/express/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import { ZodSchema, z } from 'zod';
* @returns express query handler
*/
export const query =
<Input extends ZodSchema, Output extends ZodSchema, AuthContext>(
md: Metadata<Input, Output, AuthContext>,
<
Input extends ZodSchema,
Output extends ZodSchema,
Context extends ZodSchema,
>(
md: Metadata<Input, Output, Context>,
): RequestHandler =>
async (
req: Request,
Expand Down
8 changes: 4 additions & 4 deletions libs/adapters/src/trpc/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ const trpcerror = (error: unknown): TRPCError => {
export const command = <
Input extends ZodSchema,
Output extends ZodSchema,
AuthContext,
Context extends ZodSchema,
>(
factory: () => Metadata<Input, Output, AuthContext>,
factory: () => Metadata<Input, Output, Context>,
tag: Tag,
track?: Track<Input, Output>,
commit?: Commit<Input, Output>,
Expand Down Expand Up @@ -101,9 +101,9 @@ export const command = <
export const query = <
Input extends ZodSchema,
Output extends ZodSchema,
AuthContext,
Context extends ZodSchema,
>(
factory: () => Metadata<Input, Output, AuthContext>,
factory: () => Metadata<Input, Output, Context>,
tag: Tag,
options?: {
forceSecure?: boolean;
Expand Down
1 change: 1 addition & 0 deletions libs/adapters/src/trpc/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export enum Tag {
SuperAdmin = 'SuperAdmin',
DiscordBot = 'DiscordBot',
Token = 'Token',
Contest = 'Contest',
}

export type Commit<Input extends ZodSchema, Output extends ZodSchema> = (
Expand Down
Loading

0 comments on commit 84ce500

Please sign in to comment.