Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 462e848

Browse files
authored
fix: Paymaster Proxy URL (#513)
1 parent 9508542 commit 462e848

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

template/web/.env.local.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
22
NEXT_PRIVATE_RPC_URL="GET_FROM_COINBASE_DEVELOPER_PLATFORM" # See https://www.coinbase.com/developer-platform/products/base-node?utm_source=boat
33
NEXT_PRIVATE_PAYMASTER_URL="GET_FROM_COINBASE_DEVELOPER_PLATFORM" # See https://www.coinbase.com/developer-platform/products/base-node?utm_source=boat
44
NEXT_PUBLIC_PRIVY_ID="GET_FROM_PRIVY"
5-
ENVIRONMENT=localhost
5+
NEXT_PUBLIC_ENVIRONMENT=localhost

template/web/.env.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=GA_TEST_1234567890
22
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=TEST_1234567890
33
NEXT_PRIVATE_RPC_URL=https://sepolia.base.org
4-
ENVIRONMENT=localhost
5-
NEXT_PUBLIC_PAYMASTER_URL=TEST_https://api.developer.coinbase.com/rpc/v1/
4+
NEXT_PUBLIC_ENVIRONMENT=localhost
5+
NEXT_PUBLIC_PAYMASTER_URL=TEST_https://api.developer.coinbase.com/rpc/v1/

template/web/app/paymaster-bundler/_components/PaymasterBundlerDemo.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import isLocal from '../../../src/utils/isLocal';
66
import { usePaymasterBundlerContract } from '../_contracts/usePaymasterBundlerContract';
77
import { CallStatus } from './CallStatus';
88

9-
// Use the local API URL to target the Paymaster directly without a proxy
10-
// if running on localhost, otherwise use the Paymaster Proxy.
11-
const paymasterURL = process.env.NEXT_PUBLIC_PAYMASTER_URL;
9+
// Target the Paymaster directly without a proxy if running on localhost.
10+
// Use the Paymaster Proxy when deployed.
1211
const isLocalEnv = isLocal();
13-
const defaultUrl = isLocalEnv ? paymasterURL : `${document.location.origin}/api/paymaster-proxy`;
12+
const defaultUrl = isLocalEnv
13+
? process.env.NEXT_PUBLIC_PAYMASTER_URL
14+
: `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}/api/paymaster-proxy`;
1415

1516
export default function PaymasterBundlerDemo() {
1617
const { address } = useAccount();

template/web/src/store/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export enum Environment {
1111
}
1212

1313
export enum EnvironmentKeys {
14-
environment = 'ENVIRONMENT',
14+
environment = 'NEXT_PUBLIC_ENVIRONMENT',
1515
}
1616

1717
export function getCurrentEnvironment(): Environment {

template/web/src/store/test/environment.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('environment', () => {
1212

1313
describe('EnvironmentKeys', () => {
1414
it('should have the correct values', () => {
15-
expect(EnvironmentKeys.environment).toEqual('ENVIRONMENT');
15+
expect(EnvironmentKeys.environment).toEqual('NEXT_PUBLIC_ENVIRONMENT');
1616
});
1717
});
1818

0 commit comments

Comments
 (0)