Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/builder-code.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Base Builder Code (ERC-8021) attribution for PlotLink transactions.
*
* Appends a Builder Code suffix to transaction calldata so Base indexers
* can attribute onchain activity back to PlotLink.
*
* Register at base.dev and set NEXT_PUBLIC_BUILDER_CODE in env vars.
*/

import { Attribution } from "ox/erc8021";

const BUILDER_CODE = process.env.NEXT_PUBLIC_BUILDER_CODE ?? "";

/**
* Pre-computed ERC-8021 data suffix for the configured Builder Code.
* Returns undefined if Builder Code is not configured (attribution disabled).
*/
export const DATA_SUFFIX: `0x${string}` | undefined = BUILDER_CODE
? Attribution.toDataSuffix({ codes: [BUILDER_CODE] })
: undefined;
2 changes: 2 additions & 0 deletions lib/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { base, baseSepolia } from "wagmi/chains";
import { injected } from "wagmi/connectors";
import { farcasterMiniApp } from "@farcaster/miniapp-wagmi-connector";
import { createFallbackTransport } from "./rpc";
import { DATA_SUFFIX } from "./builder-code";

const IS_MAINNET = process.env.NEXT_PUBLIC_CHAIN_ID === "8453";

Expand All @@ -14,6 +15,7 @@ export const config = createConfig({
[baseSepolia.id]: IS_MAINNET ? http() : createFallbackTransport(),
},
ssr: true,
...(DATA_SUFFIX ? { dataSuffix: DATA_SUFFIX } : {}),
});

declare module "wagmi" {
Expand Down
154 changes: 96 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@supabase/supabase-js": "^2.99.1",
"@tanstack/react-query": "^5.90.21",
"next": "16.1.6",
"ox": "^0.14.8",
"react": "19.2.3",
"react-dom": "19.2.3",
"viem": "^2.47.2",
Expand Down
Loading