Skip to content

Migrate to codex from dune#1066

Open
pedromcunha wants to merge 2 commits into
mainfrom
pedro/int2-409-eng-relaykit-migrate-from-dune-to-codex
Open

Migrate to codex from dune#1066
pedromcunha wants to merge 2 commits into
mainfrom
pedro/int2-409-eng-relaykit-migrate-from-dune-to-codex

Conversation

@pedromcunha

Copy link
Copy Markdown
Member

No description provided.

@pedromcunha pedromcunha requested a review from ted-palmer July 7, 2026 17:18
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
relay-sdk-demo Ready Ready Preview, Comment Jul 7, 2026 5:32pm

Request Review

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @pedromcunha's task in 3m 40s —— View job


Code Review — PR #1066: Migrate to codex from dune

Reviewed the full diff (16 files, +768/−576). The Dune→Codex migration is thorough and consistent — all duneConfig/useDuneBalances/isDuneBalance/useEclipseBalance references are removed with no dangling imports, the balanceMap keying is now consistently lowercased across useCodexBalances/useMultiWalletBalances and matches all consumer lookups (which also lowercase), and the aggressive periodic-refetch workaround is correctly dropped now that SVM balances come fresh from RPC.

1 note (no correctness/security blockers found):

  1. NOTE Correctness: Eclipse native balance now depends on an address assumption
    packages/ui/src/hooks/useCurrencyBalance.ts:111 + packages/ui/src/hooks/useSolanaBalance.ts:35 — the dedicated useEclipseBalance hook (which always called getBalance, i.e. native-only) is removed and Eclipse now flows through useSolanaBalance, which decides native vs SPL via currency === '11111111111111111111111111111111'. If Eclipse's native token (ETH) is represented in the token/chain config with anything other than that placeholder mint, isNative is false and the hook silently falls into the getTokenAccountsByOwner (SPL) path, returning 0 for the gas balance instead of the RPC getBalance value. Worth a quick manual check that the Eclipse native balance still renders correctly in the widget after this change, since it's the highest-risk behavioral shift in the PR. (Solana native uses the same placeholder, so SOL is unaffected.)

Everything else checks out: the Codex pagination loop is correctly bounded (MAX_BALANCES/PAGE_LIMIT, cursor break), the liquidity/isScam/removeScams spam heuristics are sound, native-SVM price merging handles the existing/new cases, BigInt parsing is guarded, and the demo graphql.ts proxy mirrors the previous Dune proxy's CORS/origin-allowlist and key-handling pattern. Removing the hardcoded Eclipse RPC fallback also aligns with the repo's "avoid fallback defaults on critical values" guideline.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @pedromcunha's task in 1m 31s —— View job


📝 Docs Drift Check — Confidence: HIGH

What changed: The RelayKitProvider balance-provider option was renamed from duneConfig to codexConfig (with a new default base URL https://graph.codex.io and Codex-based docs). This is a breaking rename on a public UI provider option.

Docs impact: The RelayKitProvider reference and the UI installation examples still document/use duneConfig and Dune API keys, which no longer exist on the provider. Per the breaking-change playbook (§4.2), these pages are edited in place to the new shape.

Affected pages (paths inside relayprotocol/relay-docs):

  • references/relay-kit/ui/relay-kit-provider.mdx — update (Options table rows)
  • references/relay-kit/ui/installation.mdx — update (two code examples)

Draft:

> Replace section: `## Options`

## Options

| Option    | Description                                                                                                                                    | Required |
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| codexConfig.apiKey       | This key is used to fetch token balances to improve the general user experience and suggest relevant tokens to the user. If omitted the flow will continue to work but balances may be missing from the token selection flow. Refer to the [Codex docs](https://docs.codex.io) on how to get an API key. ||
| codexConfig.apiBaseUrl       | The base url for the Codex GraphQL API. If omitted, the default `https://graph.codex.io` is used. If you prefer to obfuscate and protect your API key, you can pass in a custom endpoint which will be used to fetch the data. In your proxy you can then add the API key and do any additional checks before sending to the Codex API. ||
| disablePoweredByReservoir | A boolean which disables the powered by Reservoir footer              ||
| appName | The name of your application, used in the ui to contextualize actions              ||
| appFees | An array of objects representing fees. Each object should contains a `recipient` wallet address and a `fee` in bps (e.g. 100 = 1%).      ||
| themeScheme | The overall theme color of the app, can be `light` or `dark`. Defaults to `light`. This changes the color scheme of icons and other ui elements, in addition to the theme passed in.       ||
> Replace: the `duneConfig` block inside the first `<RelayKitProvider options={{ ... }}>` example

			codexConfig: {
				apiKey: "YOUR_CODEX_KEY",
			},
> Replace: the `duneConfig` block inside the "Configuring Chains Dynamically" `<RelayKitProvider options={{ ... }}>` example

		  codexConfig: {
			apiKey: "YOUR_CODEX_KEY",
		  },

Needs human input:

  • The exported UI hooks changed (useDuneBalances removed; useCodexBalances + useSolanaBalance added), and the useCurrencyBalance return shape dropped the isDuneBalance field. These hooks live in relay-kit-ui but do not appear to have dedicated docs pages today, so no page edit is proposed. If these are intended to be publicly documented surfaces, a human should decide whether to add hook reference pages.

To publish as a draft PR in relayprotocol/relay-docs, reply on this PR with:

/publish-docs-pr

A separate workflow will open a draft PR attributed to you. Edit the draft freely before marking it ready for review.

@pedromcunha

Copy link
Copy Markdown
Member Author

/publish-docs-pr

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🚚 Docs Draft PR — starting publish to relayprotocol/relay-docs, requested by @pedromcunha. I'll post the PR link here when it's ready.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @pedromcunha's task in 1m 1s —— View job


Publishing docs draft to relayprotocol/relay-docs

  • Load the drift-check draft
  • Read docs style guide (_docs-repo/CLAUDE.md)
  • Materialize relay-kit-provider.mdx update
  • Materialize installation.mdx updates
  • Verify style-guide conformance
  • Emit publish summary

Materialized the drafted docs changes into the cloned relay-docs repo. A separate workflow step will open the draft PR attributed to @pedromcunha.

Files changed:

Path Action Change
references/relay-kit/ui/relay-kit-provider.mdx update Renamed duneConfig.apiKey / duneConfig.apiBaseUrl Options rows to codexConfig.*, pointed to the Codex docs, and documented the new https://graph.codex.io default base URL
references/relay-kit/ui/installation.mdx update Replaced both duneConfig/YOUR_DUNE_KEY code blocks (the primary example and the "Configuring Chains Dynamically" example) with codexConfig/YOUR_CODEX_KEY

Style-guide conformance: Both pages retain valid frontmatter (title/description/sidebarTitle), no H1 in body, no skipped heading levels, and root-relative internal links. Edits were surgical (per breaking-change playbook §4.2 — edit in place). The Options table's non-bold property-name convention was left as-is to stay consistent with the existing page.

Notes / flags for human review:

  • No SDK/UI changelog entry was added. Playbook §4.2 says breaking-change narratives belong in a per-surface changelog, but references/relay-kit/ui/changelog.mdx does not exist yet — creating it is out of scope for this drafted change and left for a human to decide.
  • The exported UI hook surface changed (useDuneBalances removed; useCodexBalances + useSolanaBalance added; useCurrencyBalance dropped isDuneBalance). These hooks have no dedicated docs pages today, so no page was edited — flagged in the original drift check for a human to decide whether they should be publicly documented.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Docs Draft PR opened: relayprotocol/relay-docs#358

@pedromcunha is assigned on the draft PR. Review and mark ready when it's good.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @pedromcunha's task in 3m 22s —— View job


Code Review — PR #1066: Migrate to codex from dune

  • Gather context (diff, commits)
  • Read changed files in full
  • Analyze correctness, security, error handling
  • Post review

Reviewed 16 files (+768/−576). The Dune→Codex migration is clean and internally consistent: no dangling dune/isDuneBalance/useEclipseBalance references remain (only CHANGELOG.md history), balanceMap keys are lowercased on both the producer (useCodexBalances/useMultiWalletBalances) and consumer (useEnhancedTokensList) sides, the pagination loop is correctly bounded (MAX_BALANCES/PAGE_LIMIT + cursor break), BigInt parsing is guarded, and the aggressive periodic-refetch workaround is appropriately dropped now that SVM balances come fresh from RPC.

Code Review — 2 note(s) found (no correctness/security blockers)

  1. NOTE Correctness: Eclipse native balance now assumes the placeholder mint
    packages/ui/src/hooks/useCurrencyBalance.ts:111, packages/ui/src/hooks/useSolanaBalance.ts:35 — the dedicated useEclipseBalance hook (which unconditionally called getBalance, i.e. native-only) is gone; Eclipse now flows through useSolanaBalance, which picks native vs SPL via currency === '11111111111111111111111111111111'. currency is fromToken.address (SwapWidgetRenderer.tsx:319/333). If Eclipse's native ETH is represented in the Relay token/chain config with anything other than that system-program placeholder, isNative is false, the hook takes the getTokenAccountsByOwner (SPL) path and returns 0 for the gas balance. Solana native uses the same placeholder so SOL is unaffected; still worth a quick manual check that the Eclipse gas balance renders correctly in the widget, as it's the highest-risk behavioral shift here.

  2. NOTE Eclipse native USD value may be dropped on address-case mismatch
    packages/ui/src/hooks/useCodexBalances.ts:685 / :820 — native SVM prices are keyed as ${networkId}:${address} when building the map and looked up with the same template. The Eclipse price token is the lowercased WETH address (0xc02aaa..., :576). If Codex's getTokenPrices echoes the address checksummed rather than as-sent, the lookup misses and Eclipse ETH shows no USD value (balance still displays; cosmetic only). Cheap to harden by lowercasing the EVM side of the key on both write and read. Solana's base58 price token is unaffected.

Everything else checks out: the native-SVM merge handles both the existing (overwrite amount with fresh RPC value) and new-entry cases, the liquidity/isScam spam heuristics are sound, the getEvmNetworkIds/getSvmNativeChains derivation is consistent between useCodexBalances and useMultiWalletBalances, and the demo graphql.ts proxy mirrors the prior Dune proxy's CORS/origin-allowlist + server-side key handling.
· pedro/int2-409-eng-relaykit-migrate-from-dune-to-codex

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @pedromcunha's task in 1m 15s —— View job


📝 Docs Drift Check — Confidence: HIGH

What changed: The RelayKitProvider balance-provider option was renamed from duneConfig to codexConfig ({ apiBaseUrl?, apiKey? }, new default base URL https://graph.codex.io), as part of migrating wallet-balance fetching from Dune to Codex. This is a breaking rename on a public UI provider option.

Docs impact: The RelayKitProvider reference and the UI installation examples still document/use duneConfig and Dune API keys, which no longer exist on the provider. Per the breaking-change playbook (§4.2), these pages are edited in place to the new shape.

Affected pages (paths inside relayprotocol/relay-docs):

  • references/relay-kit/ui/relay-kit-provider.mdx — update (Options table rows)
  • references/relay-kit/ui/installation.mdx — update (two code examples)

Draft:

> Replace section: `## Options`

## Options

| Option    | Description                                                                                                                                    | Required |
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| codexConfig.apiKey       | This key is used to fetch token balances to improve the general user experience and suggest relevant tokens to the user. If omitted the flow will continue to work but balances may be missing from the token selection flow. Refer to the [Codex docs](https://docs.codex.io) on how to get an API key. ||
| codexConfig.apiBaseUrl       | The base url for the Codex GraphQL API. If omitted, the default `https://graph.codex.io` is used. If you prefer to obfuscate and protect your API key, you can pass in a custom endpoint which will be used to fetch the data. In your proxy you can then add the API key and do any additional checks before sending to the Codex API. ||
| disablePoweredByReservoir | A boolean which disables the powered by Reservoir footer              ||
| appName | The name of your application, used in the ui to contextualize actions              ||
| appFees | An array of objects representing fees. Each object should contains a `recipient` wallet address and a `fee` in bps (e.g. 100 = 1%).      ||
| themeScheme | The overall theme color of the app, can be `light` or `dark`. Defaults to `light`. This changes the color scheme of icons and other ui elements, in addition to the theme passed in.       ||
> Replace: the `duneConfig` block inside the first `<RelayKitProvider options={{ ... }}>` example

			codexConfig: {
				apiKey: "YOUR_CODEX_KEY",
			},
> Replace: the `duneConfig` block inside the "Configuring Chains Dynamically" `<RelayKitProvider options={{ ... }}>` example

		  codexConfig: {
			apiKey: "YOUR_CODEX_KEY",
		  },

Needs human input:

  • The exported UI hooks changed (useDuneBalances removed; useCodexBalances + useSolanaBalance added), and useCurrencyBalance's return shape dropped the isDuneBalance field. These hooks live in relay-kit-ui but do not appear to have dedicated docs pages today, so no page edit is proposed. If these are intended to be publicly documented surfaces, a human should decide whether to add hook reference pages.
  • No UI changelog page exists yet (references/relay-kit/ui/changelog.mdx). Playbook §4.2 says breaking-change narratives belong in a per-surface changelog; creating that page is left for a human to decide.

To publish as a draft PR in relayprotocol/relay-docs, reply on this PR with:

/publish-docs-pr

A separate workflow will open a draft PR attributed to you. Edit the draft freely before marking it ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants