diff --git a/README.md b/README.md index a827adf..dd8309d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,9 @@ This hackathon by Locus provided the exact infrastructure to solve this. So, I b 1. Contributors search for open bounties. 2. They open a PR linking the issue (e.g., `Fixes #123`, `Closes #123`). Bountic detects `pull_request.opened` and marks the PR as competing. 3. **For AI Agents / Web3 Users:** Contributors embed their Locus wallet address directly in the PR markdown using a hidden comment: - `` + `` + + The legacy `` tag is also supported for existing contributors. ### 3. Merge & Settle (Payout) 1. The maintainer merges the winning PR (`pull_request.closed`). @@ -136,4 +138,4 @@ LOCUS_WEBHOOK_SECRET= **3. Start the Development Server** ```bash npm run dev -``` \ No newline at end of file +``` diff --git a/lib/bounty/services/payout.ts b/lib/bounty/services/payout.ts index 3f40a1c..51d9056 100644 --- a/lib/bounty/services/payout.ts +++ b/lib/bounty/services/payout.ts @@ -4,8 +4,7 @@ import { getLocusServerClient } from "@/lib/clients/locus/server"; import { getSupabaseServiceClient } from "@/lib/clients/supabase/server"; import { getSupabaseServerEnv } from "@/lib/env/server"; import { getGithubInstallationClient, getGithubRepoInstallationId } from "@/lib/clients/github/server"; - -const BOUNTIC_ADDRESS_REGEX = //i; +import { BOUNTIC_ADDRESS_TAG_REGEX, LOCUS_WALLET_TAG_REGEX } from "@/lib/constants/bounty"; export type PayoutResult = { transactionId: string; @@ -17,7 +16,7 @@ export type PayoutResult = { function extractWalletFromPrBody(prBody: string | null): string | null { if (!prBody) return null; - const match = BOUNTIC_ADDRESS_REGEX.exec(prBody); + const match = BOUNTIC_ADDRESS_TAG_REGEX.exec(prBody) ?? LOCUS_WALLET_TAG_REGEX.exec(prBody); return match ? match[1] : null; } @@ -173,4 +172,4 @@ export async function resolveAndPayout(params: { amount: params.amount, issueId: params.issueId, }); -} \ No newline at end of file +} diff --git a/lib/bounty/services/wallet.ts b/lib/bounty/services/wallet.ts index 6669345..b6d4fd8 100644 --- a/lib/bounty/services/wallet.ts +++ b/lib/bounty/services/wallet.ts @@ -1,15 +1,16 @@ import "server-only"; import { getSupabaseServiceClient } from "@/lib/clients/supabase/server"; - -const LOCUS_WALLET_REGEX = //i; +import { BOUNTIC_ADDRESS_TAG_REGEX, LOCUS_WALLET_TAG_REGEX } from "@/lib/constants/bounty"; export async function resolveWalletAddress(params: { prDescription: string | null; prAuthorUsername: string; }): Promise { if (params.prDescription) { - const walletMatch = LOCUS_WALLET_REGEX.exec(params.prDescription); + const walletMatch = + BOUNTIC_ADDRESS_TAG_REGEX.exec(params.prDescription) ?? + LOCUS_WALLET_TAG_REGEX.exec(params.prDescription); if (walletMatch) { return walletMatch[1]; @@ -28,4 +29,4 @@ export async function resolveWalletAddress(params: { } return null; -} \ No newline at end of file +} diff --git a/lib/constants/bounty.ts b/lib/constants/bounty.ts index 59508b3..77031f4 100644 --- a/lib/constants/bounty.ts +++ b/lib/constants/bounty.ts @@ -9,3 +9,6 @@ export const BOUNTY_ISSUE_ID_REGEX = export const LOCUS_WALLET_TAG_REGEX = //i; + +export const BOUNTIC_ADDRESS_TAG_REGEX = + //i;