Repository navigation
Expand file tree
/
Copy pathPushChainProvider.tsx
More file actions
130 lines (115 loc) · 4.65 KB
/
Copy pathPushChainProvider.tsx
File metadata and controls
130 lines (115 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import {
PushUI,
PushUniversalWalletProvider,
type AppMetadata,
type ProviderConfigProps,
} from "@pushchain/ui-kit";
import { TICKETCHAIN_LOGO_BASE64 } from "../lib/logoData";
/**
* PushChainProviders Component
*
* This component wraps your entire application with Push Chain's Universal Wallet Provider.
* It configures the wallet connection options, network settings, and app metadata.
*
* Configuration Guide:
* - network: Choose between MAINNET, TESTNET, or DEV
* - login: Configure authentication methods (email, google, wallet)
* - modal: Customize the UI appearance and behavior
* - chainConfig: Add your custom RPC endpoints
* - appMetadata: Brand your app with logo, title, and description
*/
const PushChainProviders = ({ children }: { children: React.ReactNode }) => {
// Wallet configuration - customize these settings for your app
const walletConfig: ProviderConfigProps = {
// Network selection: MAINNET for production, TESTNET for development
network: PushUI.CONSTANTS.PUSH_NETWORK.TESTNET,
// Login options - enable/disable authentication methods
login: {
email: true, // Allow email authentication
google: true, // Allow Google OAuth
wallet: {
enabled: true, // Allow wallet connection (MetaMask, etc.)
},
appPreview: true, // Show app preview in login modal
},
// Modal UI customization
modal: {
// Layout: SPLIT (side-by-side) or STACKED (vertical)
loginLayout: PushUI.CONSTANTS.LOGIN.LAYOUT.SPLIT,
// Connected wallet display: HOVER (on hover) or FULL (always visible)
connectedLayout: PushUI.CONSTANTS.CONNECTED.LAYOUT.HOVER,
// Show app preview in modals
appPreview: true,
// Background interaction when modal is open: BLUR or NONE
connectedInteraction: PushUI.CONSTANTS.CONNECTED.INTERACTION.BLUR,
},
// Chain configuration - add your custom RPC endpoints here
chainConfig: {
rpcUrls: {
// Ethereum Sepolia testnet (for testing)
"eip155:11155111": [
"https://sepolia.gateway.tenderly.co/",
"https://rpc.sepolia.org",
],
// Solana Push Testnet (fee-locker lives on devnet)
"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": [
"https://api.devnet.solana.com",
],
// Solana Devnet (standard cluster id)
"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z": [
"https://api.devnet.solana.com",
],
},
},
};
// App metadata - customize with your app's branding
const appMetadata: AppMetadata = {
// Your app's logo URL (using base64 for better compatibility)
logoUrl: TICKETCHAIN_LOGO_BASE64,
// Your app's display name
title: "TicketChain",
// Brief description of your app (shown in wallet connection prompts)
description:
"TicketChain - A decentralized ticketing platform powered by Push Chain. Buy tickets with any token from any supported blockchain.",
};
return (
<PushUniversalWalletProvider
config={walletConfig}
app={appMetadata}
themeOverrides={{
// Black theme overrides
'--pw-core-bg-primary-color': '#0A0A0A',
'--pw-core-bg-secondary-color': '#1A1A1A',
'--pw-core-bg-tertiary-color': '#2D2D2D',
'--pw-core-text-primary-color': '#FFFFFF',
'--pw-core-text-secondary-color': '#A3A3A3',
'--pw-core-text-tertiary-color': '#737373',
// @ts-expect-error - Push Wallet types incomplete
'--pw-core-border-primary-color': '#404040',
'--pw-core-border-secondary-color': '#262626',
'--pw-core-btn-primary-bg-color': '#8B5CF6',
'--pw-core-btn-primary-text-color': '#FFFFFF',
'--pw-core-btn-secondary-bg-color': '#374151',
'--pw-core-btn-secondary-text-color': '#FFFFFF',
'--pw-core-btn-border-radius': '12px',
'--pw-core-font-family': 'Inter, -apple-system, BlinkMacSystemFont, sans-serif',
'--pw-core-shadow-sm': '0 1px 2px 0 rgba(0, 0, 0, 0.5)',
'--pw-core-shadow-md': '0 4px 6px -1px rgba(0, 0, 0, 0.6)',
'--pw-core-shadow-lg': '0 10px 15px -3px rgba(0, 0, 0, 0.7)',
'--pw-core-modal-bg-color': 'rgba(0, 0, 0, 0.8)',
'--pw-core-card-bg-color': '#1A1A1A',
'--pw-core-card-border-color': '#404040',
'--pw-core-input-bg-color': '#2D2D2D',
'--pw-core-input-border-color': '#404040',
'--pw-core-input-text-color': '#FFFFFF',
'--pw-core-success-color': '#10B981',
'--pw-core-error-color': '#EF4444',
'--pw-core-warning-color': '#F59E0B',
'--pw-core-info-color': '#3B82F6',
}}
>
{children}
</PushUniversalWalletProvider>
);
};
export { PushChainProviders };