@one_deploy/sdk 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,16 +22,22 @@ export interface OneConfig {
22
22
  thirdwebClientId?: string;
23
23
  }
24
24
 
25
+ // Default configuration values
26
+ const DEFAULT_ENGINE_URL = 'https://api.one23.io';
27
+ const DEFAULT_CLIENT_ID = 'one_pk_e8f647bfa643fdcfaa3a23f760488e49be09f929296eed4a6c399d437d907f60';
28
+
25
29
  let config: OneConfig | null = null;
26
30
 
27
- export function initOneSDK(options: OneConfig): void {
28
- if (!options.oneEngineUrl) {
29
- throw new Error('oneEngineUrl is required');
30
- }
31
- if (!options.oneClientId) {
32
- throw new Error('oneClientId is required');
33
- }
34
- config = options;
31
+ export function initOneSDK(options: Partial<OneConfig>): void {
32
+ // Use defaults if not provided
33
+ const engineUrl = options.oneEngineUrl || DEFAULT_ENGINE_URL;
34
+ const clientId = options.oneClientId || DEFAULT_CLIENT_ID;
35
+
36
+ config = {
37
+ ...options,
38
+ oneEngineUrl: engineUrl,
39
+ oneClientId: clientId,
40
+ } as OneConfig;
35
41
  }
36
42
 
37
43
  export function getConfig(): OneConfig {
@@ -46,7 +52,7 @@ export function isInitialized(): boolean {
46
52
  }
47
53
 
48
54
  export function getEngineUrl(): string {
49
- return config?.oneEngineUrl || process.env.NEXT_PUBLIC_ONE_ENGINE_URL || 'http://localhost:4000/api';
55
+ return config?.oneEngineUrl || process.env.NEXT_PUBLIC_ONE_ENGINE_URL || DEFAULT_ENGINE_URL;
50
56
  }
51
57
 
52
58
  // ===== Chain Data (Fetched from Engine) =====