Skip to content

Commit 319c10a

Browse files
committed
fix(registry-backend): rebase onto main post-api changes
1 parent ca1270d commit 319c10a

6 files changed

Lines changed: 17 additions & 44 deletions

File tree

packages/apps/registry-backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@lit-protocol/vincent-ability-relay-link": "2.0.0",
2828
"@lit-protocol/vincent-app-sdk": "2.7.0",
2929
"@lit-protocol/vincent-contracts-sdk": "8.1.0",
30-
"@lit-protocol/vincent-registry-sdk": "6.0.0",
30+
"@lit-protocol/vincent-registry-sdk": "workspace:*",
3131
"@t3-oss/env-core": "^0.13.6",
3232
"@zerodev/ecdsa-validator": "^5.4.9",
3333
"@zerodev/permissions": "^5.6.2",

packages/apps/registry-backend/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ export const env = createEnv({
3838
SMART_ACCOUNT_CHAIN_RPC_URL: z.string(),
3939
SMART_ACCOUNT_CHAIN_ID: z.coerce.number(),
4040
ZERODEV_PROJECT_ID: z.string(),
41+
SPONSOR_WITHDRAW_GAS: BooleanOrBooleanStringSchema.default(false),
4142
},
4243
});

packages/apps/registry-backend/src/lib/completeWithdraw.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import type {
99
SignedWithdrawal,
1010
} from '@lit-protocol/vincent-registry-sdk';
1111

12-
import { getChainForNetwork, getBundlerUrlForNetwork } from './utils/chainConfig';
12+
import { getChainForNetwork } from './utils/chainConfig';
13+
import { getZerodevBundlerRpcUrl } from './getZerodevBundlerRpcUrl';
1314

1415
const POLL_INTERVAL_MS = 3000;
1516
const MAX_POLL_ATTEMPTS = 5; // 5 attempts * 3 seconds = 15s max wait
@@ -24,8 +25,8 @@ async function submitWithdrawal(withdrawal: SignedWithdrawal): Promise<{
2425
userOpHash: string;
2526
}> {
2627
const { network, userOp, signature } = withdrawal;
27-
const { chain } = getChainForNetwork(network);
28-
const bundlerUrl = getBundlerUrlForNetwork(network);
28+
const { chain, chainId } = getChainForNetwork(network);
29+
const bundlerUrl = getZerodevBundlerRpcUrl(chainId);
2930

3031
const publicClient = createPublicClient({
3132
chain,

packages/apps/registry-backend/src/lib/requestWithdraw.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ import type { AlchemyTokenInfo } from './utils/alchemy';
2929

3030
import { env } from '../env';
3131
import { fetchTokenBalances } from './utils/alchemy';
32-
import {
33-
SUPPORTED_NETWORKS,
34-
getChainForNetwork,
35-
getRpcUrlForNetwork,
36-
getBundlerUrlForNetwork,
37-
} from './utils/chainConfig';
32+
import { SUPPORTED_NETWORKS, getChainForNetwork, getRpcUrlForNetwork } from './utils/chainConfig';
33+
import { getZerodevBundlerRpcUrl } from './getZerodevBundlerRpcUrl';
3834

3935
const entryPoint = getEntryPoint('0.7');
4036
const kernelVersion = KERNEL_V3_3;
@@ -176,9 +172,9 @@ export async function requestWithdraw(
176172

177173
const sponsorWithdrawalGas = env.SPONSOR_WITHDRAW_GAS;
178174

179-
// ZeroDev bundler URL is always required for ERC-4337 operations
180-
if (!env.ZERODEV_BUNDLER_URL) {
181-
throw new Error('ZERODEV_BUNDLER_URL is required for withdrawal operations');
175+
// ZeroDev project ID is always required for ERC-4337 operations
176+
if (!env.ZERODEV_PROJECT_ID) {
177+
throw new Error('ZERODEV_PROJECT_ID is required for withdrawal operations');
182178
}
183179

184180
// Group assets by network
@@ -215,9 +211,9 @@ export async function requestWithdraw(
215211
}
216212

217213
try {
218-
const { chain } = getChainForNetwork(network);
214+
const { chain, chainId } = getChainForNetwork(network);
219215
const networkRpcUrl = getRpcUrlForNetwork(network);
220-
const bundlerUrl = getBundlerUrlForNetwork(network);
216+
const bundlerUrl = getZerodevBundlerRpcUrl(chainId);
221217

222218
const publicClient = createPublicClient({
223219
chain,

packages/apps/registry-backend/src/lib/utils/chainConfig.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ export function getRpcUrlForNetwork(network: string): string {
4242
return `https://${config.alchemySubdomain}.g.alchemy.com/v2/${env.ALCHEMY_API_KEY}`;
4343
}
4444

45-
/**
46-
* Returns the ZeroDev bundler URL for a given network.
47-
* Appends the chain ID to the base ZERODEV_BUNDLER_URL.
48-
*/
49-
export function getBundlerUrlForNetwork(network: string): string {
50-
if (!env.ZERODEV_BUNDLER_URL) {
51-
throw new Error('ZERODEV_BUNDLER_URL is required for bundler operations');
52-
}
53-
const config = getChainForNetwork(network);
54-
return `${env.ZERODEV_BUNDLER_URL}/chain/${config.chainId}`;
55-
}
56-
5745
/**
5846
* Returns the appropriate chain configuration based on IS_DEVELOPMENT.
5947
* - Production: Base mainnet (chain ID 8453)
@@ -65,13 +53,13 @@ export function getBaseChain() {
6553

6654
/**
6755
* Creates a viem public client configured for the appropriate Base network.
68-
* Uses BASE_RPC_URL from environment (should point to Base Sepolia in development).
56+
* Uses SMART_ACCOUNT_CHAIN_RPC_URL from environment.
6957
*/
7058
export function getBasePublicClient() {
7159
const chain = getBaseChain();
7260
return createPublicClient({
7361
chain,
74-
transport: http(env.BASE_RPC_URL),
62+
transport: http(env.SMART_ACCOUNT_CHAIN_RPC_URL),
7563
});
7664
}
7765

pnpm-lock.yaml

Lines changed: 2 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)