@chipi-stack/nextjs 0.1.0 → 1.0.0
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.
- package/dist/cjs/app-router/client/ChipiProvider.js +1 -6
- package/dist/cjs/app-router/client/ChipiProvider.js.map +1 -1
- package/dist/cjs/app-router/server/ChipiProvider.js +1 -1
- package/dist/cjs/app-router/server/ChipiProvider.js.map +1 -1
- package/dist/cjs/client/ChipiClientWrapper.js +1 -6
- package/dist/cjs/client/ChipiClientWrapper.js.map +1 -1
- package/dist/cjs/client/ChipiProvider.js +1 -6
- package/dist/cjs/client/ChipiProvider.js.map +1 -1
- package/dist/cjs/hooks.d.ts +1 -1
- package/dist/cjs/hooks.js +2 -8
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/server/ChipiServerSDK.d.ts +4 -21
- package/dist/cjs/server/ChipiServerSDK.js +16 -32
- package/dist/cjs/server/ChipiServerSDK.js.map +1 -1
- package/dist/esm/app-router/client/ChipiProvider.js +1 -6
- package/dist/esm/app-router/client/ChipiProvider.js.map +1 -1
- package/dist/esm/app-router/server/ChipiProvider.js +1 -1
- package/dist/esm/app-router/server/ChipiProvider.js.map +1 -1
- package/dist/esm/client/ChipiClientWrapper.js +1 -6
- package/dist/esm/client/ChipiClientWrapper.js.map +1 -1
- package/dist/esm/client/ChipiProvider.js +1 -6
- package/dist/esm/client/ChipiProvider.js.map +1 -1
- package/dist/esm/hooks.js +3 -9
- package/dist/esm/hooks.js.map +1 -1
- package/dist/esm/server/ChipiServerSDK.js +16 -32
- package/dist/esm/server/ChipiServerSDK.js.map +1 -1
- package/dist/hooks.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/server/ChipiServerSDK.d.mts +4 -21
- package/package.json +17 -17
|
@@ -51,12 +51,7 @@ const createDefaultQueryClient = () => new import_react_query.QueryClient({
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
mutations: {
|
|
54
|
-
retry:
|
|
55
|
-
if (error?.status >= 400 && error?.status < 500) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return failureCount < 1;
|
|
59
|
-
}
|
|
54
|
+
retry: false
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/app-router/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as ReactChipiProvider } from '@chipi-stack/chipi-react';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry:
|
|
1
|
+
{"version":3,"sources":["../../../../src/app-router/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as ReactChipiProvider } from '@chipi-stack/chipi-react';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side Chipi Provider for Next.js App Router\n * \n * This is the client component version that handles client-side functionality.\n * It wraps children with QueryClient and the React Chipi provider.\n * \n * Since this component is marked with 'use client', it's safe to import\n * from @chipi-stack/chipi-react directly as it will never run on the server.\n */\nexport function ChipiProvider({ \n children, \n apiPublicKey,\n environment = 'production'\n}: ChipiProviderProps) {\n // Create QueryClient\n const queryClient = React.useMemo(() => createDefaultQueryClient(), []);\n\n // Create config\n const config = React.useMemo(() => ({\n apiPublicKey,\n environment,\n }), [apiPublicKey, environment]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <ReactChipiProvider config={config}>\n {children}\n </ReactChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0DM;AAxDN,mBAAkB;AAClB,yBAAiD;AACjD,yBAAoD;AASpD,MAAM,2BAA2B,MAC/B,IAAI,+BAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAWI,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAAuB;AAErB,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAGtE,QAAM,SAAS,aAAAA,QAAM,QAAQ,OAAO;AAAA,IAClC;AAAA,IACA;AAAA,EACF,IAAI,CAAC,cAAc,WAAW,CAAC;AAE/B,SACE,4CAAC,0CAAoB,QAAQ,aAC3B,sDAAC,mBAAAC,eAAA,EAAmB,QACjB,UACH,GACF;AAEJ;","names":["React","ReactChipiProvider"]}
|
|
@@ -28,7 +28,7 @@ async function ChipiProvider({ children }) {
|
|
|
28
28
|
const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;
|
|
29
29
|
const secretKey = process.env.CHIPI_SECRET_KEY;
|
|
30
30
|
let environment = "production";
|
|
31
|
-
console.log("process.env.
|
|
31
|
+
console.log("process.env.NEXT_PUBLIC_CHIPI_ENV2", process.env.NEXT_PUBLIC_CHIPI_ENV);
|
|
32
32
|
if (process.env.NEXT_PUBLIC_CHIPI_ENV === "development") {
|
|
33
33
|
environment = "development";
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from 'react';\nimport { createChipiServer } from '../../server/createChipiServer';\nimport { ChipiProvider as ChipiClientProvider } from '../client/ChipiProvider';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n * \n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\"\n console.log(\"process.env.
|
|
1
|
+
{"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from 'react';\nimport { createChipiServer } from '../../server/createChipiServer';\nimport { ChipiProvider as ChipiClientProvider } from '../client/ChipiProvider';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n * \n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\"\n console.log(\"process.env.NEXT_PUBLIC_CHIPI_ENV2\", process.env.NEXT_PUBLIC_CHIPI_ENV)\n if (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\") {\n environment = \"development\"\n }\n\n console.log(\"environment\", environment)\n // Validate required environment variables\n if (!apiPublicKey) {\n throw new Error(\n 'Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file.'\n );\n }\n\n if (!secretKey) {\n throw new Error(\n 'Missing CHIPI_SECRET_KEY environment variable. Server-side features will not work properly.'\n );\n }\n\n // Initialize server SDK (this runs on server only)\n createChipiServer({\n secretKey,\n apiPublicKey,\n environment,\n debug: environment === 'development',\n });\n\n // Return the client provider which will hydrate on the client\n // Note: This works because ChipiClientProvider is marked with 'use client'\n return (\n <ChipiClientProvider apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiDI;AAhDJ,+BAAkC;AAClC,2BAAqD;AAYrD,eAAsB,cAAc,EAAE,SAAS,GAAuB;AAEpE,QAAM,eAAe,QAAQ,IAAI;AACjC,QAAM,YAAY,QAAQ,IAAI;AAC9B,MAAI,cAAc;AAClB,UAAQ,IAAI,sCAAsC,QAAQ,IAAI,qBAAqB;AACnF,MAAI,QAAQ,IAAI,0BAA0B,eAAe;AACvD,kBAAc;AAAA,EAChB;AAEA,UAAQ,IAAI,eAAe,WAAW;AAEtC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,kDAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,gBAAgB;AAAA,EACzB,CAAC;AAID,SACE,4CAAC,qBAAAA,eAAA,EAAoB,cAA4B,aAC9C,UACH;AAEJ;","names":["ChipiClientProvider"]}
|
|
@@ -51,12 +51,7 @@ const createDefaultQueryClient = () => new import_react_query.QueryClient({
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
mutations: {
|
|
54
|
-
retry:
|
|
55
|
-
if (error?.status >= 400 && error?.status < 500) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return failureCount < 1;
|
|
59
|
-
}
|
|
54
|
+
retry: false
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/ChipiClientWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\ninterface ChipiClientWrapperProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry:
|
|
1
|
+
{"version":3,"sources":["../../../src/client/ChipiClientWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\ninterface ChipiClientWrapperProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side wrapper for Chipi SDK in Next.js\n * This component runs on the client and receives the API key as a prop\n */\nexport function ChipiClientWrapper({ \n children, \n apiPublicKey,\n environment = 'development'\n}: ChipiClientWrapperProps) {\n // Create QueryClient\n const queryClient = React.useMemo(() => createDefaultQueryClient(), []);\n\n // Create config\n const config = React.useMemo((): ChipiSDKConfig => ({\n apiPublicKey,\n environment,\n }), [apiPublicKey, environment]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDM;AApDN,mBAAkB;AAClB,yBAAiD;AACjD,yBAAmD;AAUnD,MAAM,2BAA2B,MAC/B,IAAI,+BAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAMI,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAA4B;AAE1B,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAGtE,QAAM,SAAS,aAAAA,QAAM,QAAQ,OAAuB;AAAA,IAClD;AAAA,IACA;AAAA,EACF,IAAI,CAAC,cAAc,WAAW,CAAC;AAE/B,SACE,4CAAC,0CAAoB,QAAQ,aAC3B,sDAAC,mBAAAC,eAAA,EAAkB,QAChB,UACH,GACF;AAEJ;","names":["React","BaseChipiProvider"]}
|
|
@@ -51,12 +51,7 @@ const createDefaultQueryClient = () => new import_react_query.QueryClient({
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
mutations: {
|
|
54
|
-
retry:
|
|
55
|
-
if (error?.status >= 400 && error?.status < 500) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return failureCount < 1;
|
|
59
|
-
}
|
|
54
|
+
retry: false
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n /**\n * Custom QueryClient instance for React Query\n * If not provided, a default one will be created\n */\n queryClient?: QueryClient;\n}\n\n// Default QueryClient configuration\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry:
|
|
1
|
+
{"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n /**\n * Custom QueryClient instance for React Query\n * If not provided, a default one will be created\n */\n queryClient?: QueryClient;\n}\n\n// Default QueryClient configuration\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side Chipi Provider for Next.js applications\n * \n * This provider wraps the base ChipiProvider with React Query\n * and provides Next.js-specific optimizations.\n * \n * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'\n * instead of this client-only provider.\n * \n * @example\n * ```tsx\n * // Advanced usage - client-only provider\n * 'use client';\n * \n * import { ChipiClientProvider } from '@chipi-stack/nextjs';\n * \n * export function ClientProviders({ children }: { children: React.ReactNode }) {\n * return (\n * <ChipiClientProvider \n * config={{ \n * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n * environment: 'production'\n * }}\n * >\n * {children}\n * </ChipiClientProvider>\n * );\n * }\n * ```\n */\nexport function ChipiProvider({ \n children, \n config: userConfig,\n queryClient \n}: ChipiProviderProps) {\n // Automatically get configuration from environment variables\n // Siento que esta madre no se usa\n const config = React.useMemo(() => {\n const envConfig: ChipiSDKConfig = {\n apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n environment: (process.env.NEXT_PUBLIC_CHIPI_ENV === 'development' ? 'development' : 'production') as 'development' | 'production',\n };\n \n // Merge with user-provided config\n return { ...envConfig, ...userConfig };\n }, [userConfig]);\n\n // Create or use provided QueryClient\n const client = React.useMemo(\n () => queryClient || createDefaultQueryClient(),\n [queryClient]\n );\n\n // Validate required configuration\n if (!config.apiPublicKey) {\n throw new Error(\n 'Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file.'\n );\n }\n\n return (\n <QueryClientProvider client={client}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuGM;AArGN,mBAAkB;AAClB,yBAAiD;AACjD,yBAAmD;AAiBnD,MAAM,2BAA2B,MAC/B,IAAI,+BAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAgCI,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,QAAQ;AAAA,EACR;AACF,GAAuB;AAGrB,QAAM,SAAS,aAAAA,QAAM,QAAQ,MAAM;AACjC,UAAM,YAA4B;AAAA,MAChC,cAAc,QAAQ,IAAI;AAAA,MAC1B,aAAc,QAAQ,IAAI,0BAA0B,gBAAgB,gBAAgB;AAAA,IACtF;AAGA,WAAO,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACvC,GAAG,CAAC,UAAU,CAAC;AAGf,QAAM,SAAS,aAAAA,QAAM;AAAA,IACnB,MAAM,eAAe,yBAAyB;AAAA,IAC9C,CAAC,WAAW;AAAA,EACd;AAGA,MAAI,CAAC,OAAO,cAAc;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SACE,4CAAC,0CAAoB,QACnB,sDAAC,mBAAAC,eAAA,EAAkB,QAChB,UACH,GACF;AAEJ;","names":["React","BaseChipiProvider"]}
|
package/dist/cjs/hooks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction,
|
|
1
|
+
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
|
package/dist/cjs/hooks.js
CHANGED
|
@@ -24,12 +24,9 @@ __export(hooks_exports, {
|
|
|
24
24
|
useChipiContext: () => import_chipi_react.useChipiContext,
|
|
25
25
|
useCreateWallet: () => import_chipi_react.useCreateWallet,
|
|
26
26
|
useExecuteTransaction: () => import_chipi_react.useExecuteTransaction,
|
|
27
|
-
|
|
28
|
-
useSkuTransactions: () => import_chipi_react.useSkuTransactions,
|
|
29
|
-
useSkus: () => import_chipi_react.useSkus,
|
|
27
|
+
useRecordSendTransaction: () => import_chipi_react.useRecordSendTransaction,
|
|
30
28
|
useStakeVesuUsdc: () => import_chipi_react.useStakeVesuUsdc,
|
|
31
29
|
useTransfer: () => import_chipi_react.useTransfer,
|
|
32
|
-
useWallets: () => import_chipi_react.useWallets,
|
|
33
30
|
useWithdrawVesuUsdc: () => import_chipi_react.useWithdrawVesuUsdc
|
|
34
31
|
});
|
|
35
32
|
module.exports = __toCommonJS(hooks_exports);
|
|
@@ -41,12 +38,9 @@ var import_chipi_react = require("@chipi-stack/chipi-react");
|
|
|
41
38
|
useChipiContext,
|
|
42
39
|
useCreateWallet,
|
|
43
40
|
useExecuteTransaction,
|
|
44
|
-
|
|
45
|
-
useSkuTransactions,
|
|
46
|
-
useSkus,
|
|
41
|
+
useRecordSendTransaction,
|
|
47
42
|
useStakeVesuUsdc,
|
|
48
43
|
useTransfer,
|
|
49
|
-
useWallets,
|
|
50
44
|
useWithdrawVesuUsdc
|
|
51
45
|
});
|
|
52
46
|
//# sourceMappingURL=hooks.js.map
|
package/dist/cjs/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["\"use client\";\n\n// Client-side hooks for Next.js Chipi SDK\n// These are re-exported from @chipi-stack/chipi-react for convenience\n// This file is marked as 'use client' to ensure it only runs on the client\n\nexport {\n // Context hook\n useChipiContext,\n\n // Wallet hooks\n useCreateWallet,\n\n // Transaction hooks\n useApprove,\n useTransfer,\n useExecuteTransaction,\n\n // SKU hooks\n\n // Specialized transaction hooks\n useStakeVesuUsdc,\n useWithdrawVesuUsdc,\n useCallAnyContract,\n\n // Record send transaction hook\n useRecordSendTransaction,\n} from \"@chipi-stack/chipi-react\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,yBAqBO;","names":[]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServerComponentsServerModuleTypes } from './components.server.js';
|
|
2
2
|
export { ChipiProvider as ChipiClientProvider } from './app-router/client/ChipiProvider.js';
|
|
3
|
-
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction,
|
|
3
|
+
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
|
|
4
4
|
export * from '@chipi-stack/types';
|
|
5
5
|
import './app-router/server/ChipiProvider.js';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _chipi_stack_types from '@chipi-stack/types';
|
|
2
|
-
import { ChipiSDK } from '@chipi-stack/backend';
|
|
2
|
+
import { ChipiSDK, CreateWalletParams } from '@chipi-stack/backend';
|
|
3
3
|
import { ChipiServerConfig } from './types.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -22,9 +22,9 @@ declare class ChipiServerSDK extends ChipiSDK {
|
|
|
22
22
|
/**
|
|
23
23
|
* Server-side wallet creation with enhanced security
|
|
24
24
|
*/
|
|
25
|
-
createServerWallet(params: {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
createServerWallet({ params, bearerToken, }: {
|
|
26
|
+
params: CreateWalletParams;
|
|
27
|
+
bearerToken: string;
|
|
28
28
|
}): Promise<_chipi_stack_types.CreateWalletResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* Server-side transaction execution with enhanced logging
|
|
@@ -36,23 +36,6 @@ declare class ChipiServerSDK extends ChipiSDK {
|
|
|
36
36
|
calls: any[];
|
|
37
37
|
reason?: string;
|
|
38
38
|
}): Promise<string>;
|
|
39
|
-
/**
|
|
40
|
-
* Server-side SKU purchase with enhanced tracking
|
|
41
|
-
*/
|
|
42
|
-
purchaseSkuForUser(params: {
|
|
43
|
-
userId: string;
|
|
44
|
-
skuId: string;
|
|
45
|
-
walletAddress: string;
|
|
46
|
-
chain: any;
|
|
47
|
-
chainToken: any;
|
|
48
|
-
mxnAmount: number;
|
|
49
|
-
reference: string;
|
|
50
|
-
transactionHash: string;
|
|
51
|
-
metadata?: Record<string, any>;
|
|
52
|
-
}): Promise<{
|
|
53
|
-
sku: _chipi_stack_types.Sku;
|
|
54
|
-
transaction: _chipi_stack_types.SkuTransaction;
|
|
55
|
-
}>;
|
|
56
39
|
}
|
|
57
40
|
|
|
58
41
|
export { ChipiServerSDK };
|
|
@@ -27,10 +27,14 @@ class ChipiServerSDK extends import_backend.ChipiSDK {
|
|
|
27
27
|
constructor(config) {
|
|
28
28
|
super(config);
|
|
29
29
|
if (!config.secretKey) {
|
|
30
|
-
throw new import_shared.ChipiAuthError(
|
|
30
|
+
throw new import_shared.ChipiAuthError(
|
|
31
|
+
"Secret key is required for server-side operations"
|
|
32
|
+
);
|
|
31
33
|
}
|
|
32
34
|
if (!config.secretKey.startsWith("sk_")) {
|
|
33
|
-
throw new import_shared.ChipiAuthError(
|
|
35
|
+
throw new import_shared.ChipiAuthError(
|
|
36
|
+
'Invalid secret key format. Secret key should start with "sk_"'
|
|
37
|
+
);
|
|
34
38
|
}
|
|
35
39
|
this.secretKey = config.secretKey;
|
|
36
40
|
this.debug = config.debug || false;
|
|
@@ -61,14 +65,19 @@ class ChipiServerSDK extends import_backend.ChipiSDK {
|
|
|
61
65
|
/**
|
|
62
66
|
* Server-side wallet creation with enhanced security
|
|
63
67
|
*/
|
|
64
|
-
async createServerWallet(
|
|
68
|
+
async createServerWallet({
|
|
69
|
+
params,
|
|
70
|
+
bearerToken
|
|
71
|
+
}) {
|
|
65
72
|
if (this.debug) {
|
|
66
|
-
console.log(
|
|
73
|
+
console.log(
|
|
74
|
+
"[ChipiServerSDK] Creating server wallet for user:",
|
|
75
|
+
params.externalUserId
|
|
76
|
+
);
|
|
67
77
|
}
|
|
68
78
|
return this.createWallet({
|
|
69
|
-
|
|
70
|
-
bearerToken
|
|
71
|
-
// Server-side operations might not need bearer token
|
|
79
|
+
params,
|
|
80
|
+
bearerToken
|
|
72
81
|
});
|
|
73
82
|
}
|
|
74
83
|
/**
|
|
@@ -90,31 +99,6 @@ class ChipiServerSDK extends import_backend.ChipiSDK {
|
|
|
90
99
|
// Server-side operations might not need bearer token
|
|
91
100
|
});
|
|
92
101
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Server-side SKU purchase with enhanced tracking
|
|
95
|
-
*/
|
|
96
|
-
async purchaseSkuForUser(params) {
|
|
97
|
-
if (this.debug) {
|
|
98
|
-
console.log("[ChipiServerSDK] Processing SKU purchase:", {
|
|
99
|
-
userId: params.userId,
|
|
100
|
-
skuId: params.skuId,
|
|
101
|
-
amount: params.mxnAmount
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
const result = await this.skus.purchaseSku({
|
|
105
|
-
skuId: params.skuId,
|
|
106
|
-
walletAddress: params.walletAddress,
|
|
107
|
-
chain: params.chain,
|
|
108
|
-
chainToken: params.chainToken,
|
|
109
|
-
mxnAmount: params.mxnAmount,
|
|
110
|
-
reference: params.reference,
|
|
111
|
-
transactionHash: params.transactionHash
|
|
112
|
-
});
|
|
113
|
-
if (this.debug) {
|
|
114
|
-
console.log("[ChipiServerSDK] SKU purchase completed:", result.transaction.id);
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
102
|
}
|
|
119
103
|
// Annotate the CommonJS export names for ESM import in node:
|
|
120
104
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/ChipiServerSDK.ts"],"sourcesContent":["import { ChipiSDK } from
|
|
1
|
+
{"version":3,"sources":["../../../src/server/ChipiServerSDK.ts"],"sourcesContent":["import { ChipiSDK, CreateWalletParams } from \"@chipi-stack/backend\";\nimport { ChipiAuthError } from \"@chipi-stack/shared\";\nimport type { ChipiServerConfig } from \"./types\";\n\n/**\n * Server-side Chipi SDK with enhanced capabilities\n * Includes secret key for server-side operations\n */\nexport class ChipiServerSDK extends ChipiSDK {\n private secretKey: string;\n private debug: boolean;\n\n constructor(config: ChipiServerConfig) {\n super(config);\n\n if (!config.secretKey) {\n throw new ChipiAuthError(\n \"Secret key is required for server-side operations\"\n );\n }\n\n if (!config.secretKey.startsWith(\"sk_\")) {\n throw new ChipiAuthError(\n 'Invalid secret key format. Secret key should start with \"sk_\"'\n );\n }\n\n this.secretKey = config.secretKey;\n this.debug = config.debug || false;\n\n if (this.debug) {\n console.log(\"[ChipiServerSDK] Initialized with secret key\");\n }\n }\n\n /**\n * Get the secret key for server-side operations\n * WARNING: Never expose this to the client\n */\n getSecretKey(): string {\n return this.secretKey;\n }\n\n /**\n * Verify API key ownership using secret key\n */\n async verifyApiKey(publicKey: string): Promise<boolean> {\n try {\n // This would make a server-side API call to verify the key pair\n // For now, basic validation\n return publicKey.startsWith(\"pk_\") && this.secretKey.startsWith(\"sk_\");\n } catch (error) {\n if (this.debug) {\n console.error(\"[ChipiServerSDK] API key verification failed:\", error);\n }\n return false;\n }\n }\n\n /**\n * Server-side wallet creation with enhanced security\n */\n async createServerWallet({\n params,\n bearerToken,\n }: {\n params: CreateWalletParams;\n bearerToken: string;\n }) {\n if (this.debug) {\n console.log(\n \"[ChipiServerSDK] Creating server wallet for user:\",\n params.externalUserId\n );\n }\n\n // Server-side wallet creation logic would go here\n // This could include additional security checks, logging, etc.\n\n return this.createWallet({\n params,\n bearerToken,\n });\n }\n\n /**\n * Server-side transaction execution with enhanced logging\n */\n async executeServerTransaction(params: {\n userId: string;\n encryptKey: string;\n wallet: any;\n calls: any[];\n reason?: string;\n }) {\n if (this.debug) {\n console.log(\"[ChipiServerSDK] Executing server transaction:\", {\n userId: params.userId,\n callsCount: params.calls.length,\n reason: params.reason,\n });\n }\n\n // Additional server-side validation could go here\n\n return this.executeTransaction({\n encryptKey: params.encryptKey,\n wallet: params.wallet,\n calls: params.calls,\n bearerToken: \"\", // Server-side operations might not need bearer token\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA6C;AAC7C,oBAA+B;AAOxB,MAAM,uBAAuB,wBAAS;AAAA,EAI3C,YAAY,QAA2B;AACrC,UAAM,MAAM;AAEZ,QAAI,CAAC,OAAO,WAAW;AACrB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,OAAO,UAAU,WAAW,KAAK,GAAG;AACvC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,SAAK,YAAY,OAAO;AACxB,SAAK,QAAQ,OAAO,SAAS;AAE7B,QAAI,KAAK,OAAO;AACd,cAAQ,IAAI,8CAA8C;AAAA,IAC5D;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,eAAuB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa,WAAqC;AACtD,QAAI;AAGF,aAAO,UAAU,WAAW,KAAK,KAAK,KAAK,UAAU,WAAW,KAAK;AAAA,IACvE,SAAS,OAAO;AACd,UAAI,KAAK,OAAO;AACd,gBAAQ,MAAM,iDAAiD,KAAK;AAAA,MACtE;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF,GAGG;AACD,QAAI,KAAK,OAAO;AACd,cAAQ;AAAA,QACN;AAAA,QACA,OAAO;AAAA,MACT;AAAA,IACF;AAKA,WAAO,KAAK,aAAa;AAAA,MACvB;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,yBAAyB,QAM5B;AACD,QAAI,KAAK,OAAO;AACd,cAAQ,IAAI,kDAAkD;AAAA,QAC5D,QAAQ,OAAO;AAAA,QACf,YAAY,OAAO,MAAM;AAAA,QACzB,QAAQ,OAAO;AAAA,MACjB,CAAC;AAAA,IACH;AAIA,WAAO,KAAK,mBAAmB;AAAA,MAC7B,YAAY,OAAO;AAAA,MACnB,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,aAAa;AAAA;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -18,12 +18,7 @@ const createDefaultQueryClient = () => new QueryClient({
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
mutations: {
|
|
21
|
-
retry:
|
|
22
|
-
if (error?.status >= 400 && error?.status < 500) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
return failureCount < 1;
|
|
26
|
-
}
|
|
21
|
+
retry: false
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/app-router/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as ReactChipiProvider } from '@chipi-stack/chipi-react';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry:
|
|
1
|
+
{"version":3,"sources":["../../../../src/app-router/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as ReactChipiProvider } from '@chipi-stack/chipi-react';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side Chipi Provider for Next.js App Router\n * \n * This is the client component version that handles client-side functionality.\n * It wraps children with QueryClient and the React Chipi provider.\n * \n * Since this component is marked with 'use client', it's safe to import\n * from @chipi-stack/chipi-react directly as it will never run on the server.\n */\nexport function ChipiProvider({ \n children, \n apiPublicKey,\n environment = 'production'\n}: ChipiProviderProps) {\n // Create QueryClient\n const queryClient = React.useMemo(() => createDefaultQueryClient(), []);\n\n // Create config\n const config = React.useMemo(() => ({\n apiPublicKey,\n environment,\n }), [apiPublicKey, environment]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <ReactChipiProvider config={config}>\n {children}\n </ReactChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AA0DM;AAxDN,OAAO,WAAW;AAClB,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB,0BAA0B;AASpD,MAAM,2BAA2B,MAC/B,IAAI,YAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAWI,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAAuB;AAErB,QAAM,cAAc,MAAM,QAAQ,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAGtE,QAAM,SAAS,MAAM,QAAQ,OAAO;AAAA,IAClC;AAAA,IACA;AAAA,EACF,IAAI,CAAC,cAAc,WAAW,CAAC;AAE/B,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,sBAAmB,QACjB,UACH,GACF;AAEJ;","names":[]}
|
|
@@ -5,7 +5,7 @@ async function ChipiProvider({ children }) {
|
|
|
5
5
|
const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;
|
|
6
6
|
const secretKey = process.env.CHIPI_SECRET_KEY;
|
|
7
7
|
let environment = "production";
|
|
8
|
-
console.log("process.env.
|
|
8
|
+
console.log("process.env.NEXT_PUBLIC_CHIPI_ENV2", process.env.NEXT_PUBLIC_CHIPI_ENV);
|
|
9
9
|
if (process.env.NEXT_PUBLIC_CHIPI_ENV === "development") {
|
|
10
10
|
environment = "development";
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from 'react';\nimport { createChipiServer } from '../../server/createChipiServer';\nimport { ChipiProvider as ChipiClientProvider } from '../client/ChipiProvider';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n * \n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\"\n console.log(\"process.env.
|
|
1
|
+
{"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from 'react';\nimport { createChipiServer } from '../../server/createChipiServer';\nimport { ChipiProvider as ChipiClientProvider } from '../client/ChipiProvider';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n * \n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\"\n console.log(\"process.env.NEXT_PUBLIC_CHIPI_ENV2\", process.env.NEXT_PUBLIC_CHIPI_ENV)\n if (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\") {\n environment = \"development\"\n }\n\n console.log(\"environment\", environment)\n // Validate required environment variables\n if (!apiPublicKey) {\n throw new Error(\n 'Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file.'\n );\n }\n\n if (!secretKey) {\n throw new Error(\n 'Missing CHIPI_SECRET_KEY environment variable. Server-side features will not work properly.'\n );\n }\n\n // Initialize server SDK (this runs on server only)\n createChipiServer({\n secretKey,\n apiPublicKey,\n environment,\n debug: environment === 'development',\n });\n\n // Return the client provider which will hydrate on the client\n // Note: This works because ChipiClientProvider is marked with 'use client'\n return (\n <ChipiClientProvider apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientProvider>\n );\n}\n"],"mappings":"AAiDI;AAhDJ,SAAS,yBAAyB;AAClC,SAAS,iBAAiB,2BAA2B;AAYrD,eAAsB,cAAc,EAAE,SAAS,GAAuB;AAEpE,QAAM,eAAe,QAAQ,IAAI;AACjC,QAAM,YAAY,QAAQ,IAAI;AAC9B,MAAI,cAAc;AAClB,UAAQ,IAAI,sCAAsC,QAAQ,IAAI,qBAAqB;AACnF,MAAI,QAAQ,IAAI,0BAA0B,eAAe;AACvD,kBAAc;AAAA,EAChB;AAEA,UAAQ,IAAI,eAAe,WAAW;AAEtC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,oBAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,gBAAgB;AAAA,EACzB,CAAC;AAID,SACE,oBAAC,uBAAoB,cAA4B,aAC9C,UACH;AAEJ;","names":[]}
|
|
@@ -18,12 +18,7 @@ const createDefaultQueryClient = () => new QueryClient({
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
mutations: {
|
|
21
|
-
retry:
|
|
22
|
-
if (error?.status >= 400 && error?.status < 500) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
return failureCount < 1;
|
|
26
|
-
}
|
|
21
|
+
retry: false
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/ChipiClientWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\ninterface ChipiClientWrapperProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry:
|
|
1
|
+
{"version":3,"sources":["../../../src/client/ChipiClientWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\ninterface ChipiClientWrapperProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side wrapper for Chipi SDK in Next.js\n * This component runs on the client and receives the API key as a prop\n */\nexport function ChipiClientWrapper({ \n children, \n apiPublicKey,\n environment = 'development'\n}: ChipiClientWrapperProps) {\n // Create QueryClient\n const queryClient = React.useMemo(() => createDefaultQueryClient(), []);\n\n // Create config\n const config = React.useMemo((): ChipiSDKConfig => ({\n apiPublicKey,\n environment,\n }), [apiPublicKey, environment]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAsDM;AApDN,OAAO,WAAW;AAClB,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB,yBAAyB;AAUnD,MAAM,2BAA2B,MAC/B,IAAI,YAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAMI,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAA4B;AAE1B,QAAM,cAAc,MAAM,QAAQ,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAGtE,QAAM,SAAS,MAAM,QAAQ,OAAuB;AAAA,IAClD;AAAA,IACA;AAAA,EACF,IAAI,CAAC,cAAc,WAAW,CAAC;AAE/B,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,qBAAkB,QAChB,UACH,GACF;AAEJ;","names":[]}
|
|
@@ -18,12 +18,7 @@ const createDefaultQueryClient = () => new QueryClient({
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
mutations: {
|
|
21
|
-
retry:
|
|
22
|
-
if (error?.status >= 400 && error?.status < 500) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
return failureCount < 1;
|
|
26
|
-
}
|
|
21
|
+
retry: false
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n /**\n * Custom QueryClient instance for React Query\n * If not provided, a default one will be created\n */\n queryClient?: QueryClient;\n}\n\n// Default QueryClient configuration\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry:
|
|
1
|
+
{"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n /**\n * Custom QueryClient instance for React Query\n * If not provided, a default one will be created\n */\n queryClient?: QueryClient;\n}\n\n// Default QueryClient configuration\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side Chipi Provider for Next.js applications\n * \n * This provider wraps the base ChipiProvider with React Query\n * and provides Next.js-specific optimizations.\n * \n * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'\n * instead of this client-only provider.\n * \n * @example\n * ```tsx\n * // Advanced usage - client-only provider\n * 'use client';\n * \n * import { ChipiClientProvider } from '@chipi-stack/nextjs';\n * \n * export function ClientProviders({ children }: { children: React.ReactNode }) {\n * return (\n * <ChipiClientProvider \n * config={{ \n * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n * environment: 'production'\n * }}\n * >\n * {children}\n * </ChipiClientProvider>\n * );\n * }\n * ```\n */\nexport function ChipiProvider({ \n children, \n config: userConfig,\n queryClient \n}: ChipiProviderProps) {\n // Automatically get configuration from environment variables\n // Siento que esta madre no se usa\n const config = React.useMemo(() => {\n const envConfig: ChipiSDKConfig = {\n apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n environment: (process.env.NEXT_PUBLIC_CHIPI_ENV === 'development' ? 'development' : 'production') as 'development' | 'production',\n };\n \n // Merge with user-provided config\n return { ...envConfig, ...userConfig };\n }, [userConfig]);\n\n // Create or use provided QueryClient\n const client = React.useMemo(\n () => queryClient || createDefaultQueryClient(),\n [queryClient]\n );\n\n // Validate required configuration\n if (!config.apiPublicKey) {\n throw new Error(\n 'Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file.'\n );\n }\n\n return (\n <QueryClientProvider client={client}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAuGM;AArGN,OAAO,WAAW;AAClB,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB,yBAAyB;AAiBnD,MAAM,2BAA2B,MAC/B,IAAI,YAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAgCI,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,QAAQ;AAAA,EACR;AACF,GAAuB;AAGrB,QAAM,SAAS,MAAM,QAAQ,MAAM;AACjC,UAAM,YAA4B;AAAA,MAChC,cAAc,QAAQ,IAAI;AAAA,MAC1B,aAAc,QAAQ,IAAI,0BAA0B,gBAAgB,gBAAgB;AAAA,IACtF;AAGA,WAAO,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACvC,GAAG,CAAC,UAAU,CAAC;AAGf,QAAM,SAAS,MAAM;AAAA,IACnB,MAAM,eAAe,yBAAyB;AAAA,IAC9C,CAAC,WAAW;AAAA,EACd;AAGA,MAAI,CAAC,OAAO,cAAc;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SACE,oBAAC,uBAAoB,QACnB,8BAAC,qBAAkB,QAChB,UACH,GACF;AAEJ;","names":[]}
|
package/dist/esm/hooks.js
CHANGED
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
useChipiContext,
|
|
4
4
|
useCreateWallet,
|
|
5
|
-
useWallets,
|
|
6
5
|
useApprove,
|
|
7
6
|
useTransfer,
|
|
8
7
|
useExecuteTransaction,
|
|
9
|
-
useSkus,
|
|
10
|
-
useSkuTransactions,
|
|
11
|
-
usePurchaseSku,
|
|
12
8
|
useStakeVesuUsdc,
|
|
13
9
|
useWithdrawVesuUsdc,
|
|
14
|
-
useCallAnyContract
|
|
10
|
+
useCallAnyContract,
|
|
11
|
+
useRecordSendTransaction
|
|
15
12
|
} from "@chipi-stack/chipi-react";
|
|
16
13
|
export {
|
|
17
14
|
useApprove,
|
|
@@ -19,12 +16,9 @@ export {
|
|
|
19
16
|
useChipiContext,
|
|
20
17
|
useCreateWallet,
|
|
21
18
|
useExecuteTransaction,
|
|
22
|
-
|
|
23
|
-
useSkuTransactions,
|
|
24
|
-
useSkus,
|
|
19
|
+
useRecordSendTransaction,
|
|
25
20
|
useStakeVesuUsdc,
|
|
26
21
|
useTransfer,
|
|
27
|
-
useWallets,
|
|
28
22
|
useWithdrawVesuUsdc
|
|
29
23
|
};
|
|
30
24
|
//# sourceMappingURL=hooks.js.map
|
package/dist/esm/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["\"use client\";\n\n// Client-side hooks for Next.js Chipi SDK\n// These are re-exported from @chipi-stack/chipi-react for convenience\n// This file is marked as 'use client' to ensure it only runs on the client\n\nexport {\n // Context hook\n useChipiContext,\n\n // Wallet hooks\n useCreateWallet,\n\n // Transaction hooks\n useApprove,\n useTransfer,\n useExecuteTransaction,\n\n // SKU hooks\n\n // Specialized transaction hooks\n useStakeVesuUsdc,\n useWithdrawVesuUsdc,\n useCallAnyContract,\n\n // Record send transaction hook\n useRecordSendTransaction,\n} from \"@chipi-stack/chipi-react\";\n"],"mappings":";AAMA;AAAA,EAEE;AAAA,EAGA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;","names":[]}
|
|
@@ -4,10 +4,14 @@ class ChipiServerSDK extends ChipiSDK {
|
|
|
4
4
|
constructor(config) {
|
|
5
5
|
super(config);
|
|
6
6
|
if (!config.secretKey) {
|
|
7
|
-
throw new ChipiAuthError(
|
|
7
|
+
throw new ChipiAuthError(
|
|
8
|
+
"Secret key is required for server-side operations"
|
|
9
|
+
);
|
|
8
10
|
}
|
|
9
11
|
if (!config.secretKey.startsWith("sk_")) {
|
|
10
|
-
throw new ChipiAuthError(
|
|
12
|
+
throw new ChipiAuthError(
|
|
13
|
+
'Invalid secret key format. Secret key should start with "sk_"'
|
|
14
|
+
);
|
|
11
15
|
}
|
|
12
16
|
this.secretKey = config.secretKey;
|
|
13
17
|
this.debug = config.debug || false;
|
|
@@ -38,14 +42,19 @@ class ChipiServerSDK extends ChipiSDK {
|
|
|
38
42
|
/**
|
|
39
43
|
* Server-side wallet creation with enhanced security
|
|
40
44
|
*/
|
|
41
|
-
async createServerWallet(
|
|
45
|
+
async createServerWallet({
|
|
46
|
+
params,
|
|
47
|
+
bearerToken
|
|
48
|
+
}) {
|
|
42
49
|
if (this.debug) {
|
|
43
|
-
console.log(
|
|
50
|
+
console.log(
|
|
51
|
+
"[ChipiServerSDK] Creating server wallet for user:",
|
|
52
|
+
params.externalUserId
|
|
53
|
+
);
|
|
44
54
|
}
|
|
45
55
|
return this.createWallet({
|
|
46
|
-
|
|
47
|
-
bearerToken
|
|
48
|
-
// Server-side operations might not need bearer token
|
|
56
|
+
params,
|
|
57
|
+
bearerToken
|
|
49
58
|
});
|
|
50
59
|
}
|
|
51
60
|
/**
|
|
@@ -67,31 +76,6 @@ class ChipiServerSDK extends ChipiSDK {
|
|
|
67
76
|
// Server-side operations might not need bearer token
|
|
68
77
|
});
|
|
69
78
|
}
|
|
70
|
-
/**
|
|
71
|
-
* Server-side SKU purchase with enhanced tracking
|
|
72
|
-
*/
|
|
73
|
-
async purchaseSkuForUser(params) {
|
|
74
|
-
if (this.debug) {
|
|
75
|
-
console.log("[ChipiServerSDK] Processing SKU purchase:", {
|
|
76
|
-
userId: params.userId,
|
|
77
|
-
skuId: params.skuId,
|
|
78
|
-
amount: params.mxnAmount
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
const result = await this.skus.purchaseSku({
|
|
82
|
-
skuId: params.skuId,
|
|
83
|
-
walletAddress: params.walletAddress,
|
|
84
|
-
chain: params.chain,
|
|
85
|
-
chainToken: params.chainToken,
|
|
86
|
-
mxnAmount: params.mxnAmount,
|
|
87
|
-
reference: params.reference,
|
|
88
|
-
transactionHash: params.transactionHash
|
|
89
|
-
});
|
|
90
|
-
if (this.debug) {
|
|
91
|
-
console.log("[ChipiServerSDK] SKU purchase completed:", result.transaction.id);
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
79
|
}
|
|
96
80
|
export {
|
|
97
81
|
ChipiServerSDK
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/ChipiServerSDK.ts"],"sourcesContent":["import { ChipiSDK } from
|
|
1
|
+
{"version":3,"sources":["../../../src/server/ChipiServerSDK.ts"],"sourcesContent":["import { ChipiSDK, CreateWalletParams } from \"@chipi-stack/backend\";\nimport { ChipiAuthError } from \"@chipi-stack/shared\";\nimport type { ChipiServerConfig } from \"./types\";\n\n/**\n * Server-side Chipi SDK with enhanced capabilities\n * Includes secret key for server-side operations\n */\nexport class ChipiServerSDK extends ChipiSDK {\n private secretKey: string;\n private debug: boolean;\n\n constructor(config: ChipiServerConfig) {\n super(config);\n\n if (!config.secretKey) {\n throw new ChipiAuthError(\n \"Secret key is required for server-side operations\"\n );\n }\n\n if (!config.secretKey.startsWith(\"sk_\")) {\n throw new ChipiAuthError(\n 'Invalid secret key format. Secret key should start with \"sk_\"'\n );\n }\n\n this.secretKey = config.secretKey;\n this.debug = config.debug || false;\n\n if (this.debug) {\n console.log(\"[ChipiServerSDK] Initialized with secret key\");\n }\n }\n\n /**\n * Get the secret key for server-side operations\n * WARNING: Never expose this to the client\n */\n getSecretKey(): string {\n return this.secretKey;\n }\n\n /**\n * Verify API key ownership using secret key\n */\n async verifyApiKey(publicKey: string): Promise<boolean> {\n try {\n // This would make a server-side API call to verify the key pair\n // For now, basic validation\n return publicKey.startsWith(\"pk_\") && this.secretKey.startsWith(\"sk_\");\n } catch (error) {\n if (this.debug) {\n console.error(\"[ChipiServerSDK] API key verification failed:\", error);\n }\n return false;\n }\n }\n\n /**\n * Server-side wallet creation with enhanced security\n */\n async createServerWallet({\n params,\n bearerToken,\n }: {\n params: CreateWalletParams;\n bearerToken: string;\n }) {\n if (this.debug) {\n console.log(\n \"[ChipiServerSDK] Creating server wallet for user:\",\n params.externalUserId\n );\n }\n\n // Server-side wallet creation logic would go here\n // This could include additional security checks, logging, etc.\n\n return this.createWallet({\n params,\n bearerToken,\n });\n }\n\n /**\n * Server-side transaction execution with enhanced logging\n */\n async executeServerTransaction(params: {\n userId: string;\n encryptKey: string;\n wallet: any;\n calls: any[];\n reason?: string;\n }) {\n if (this.debug) {\n console.log(\"[ChipiServerSDK] Executing server transaction:\", {\n userId: params.userId,\n callsCount: params.calls.length,\n reason: params.reason,\n });\n }\n\n // Additional server-side validation could go here\n\n return this.executeTransaction({\n encryptKey: params.encryptKey,\n wallet: params.wallet,\n calls: params.calls,\n bearerToken: \"\", // Server-side operations might not need bearer token\n });\n }\n}\n"],"mappings":"AAAA,SAAS,gBAAoC;AAC7C,SAAS,sBAAsB;AAOxB,MAAM,uBAAuB,SAAS;AAAA,EAI3C,YAAY,QAA2B;AACrC,UAAM,MAAM;AAEZ,QAAI,CAAC,OAAO,WAAW;AACrB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,OAAO,UAAU,WAAW,KAAK,GAAG;AACvC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,SAAK,YAAY,OAAO;AACxB,SAAK,QAAQ,OAAO,SAAS;AAE7B,QAAI,KAAK,OAAO;AACd,cAAQ,IAAI,8CAA8C;AAAA,IAC5D;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,eAAuB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa,WAAqC;AACtD,QAAI;AAGF,aAAO,UAAU,WAAW,KAAK,KAAK,KAAK,UAAU,WAAW,KAAK;AAAA,IACvE,SAAS,OAAO;AACd,UAAI,KAAK,OAAO;AACd,gBAAQ,MAAM,iDAAiD,KAAK;AAAA,MACtE;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF,GAGG;AACD,QAAI,KAAK,OAAO;AACd,cAAQ;AAAA,QACN;AAAA,QACA,OAAO;AAAA,MACT;AAAA,IACF;AAKA,WAAO,KAAK,aAAa;AAAA,MACvB;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,yBAAyB,QAM5B;AACD,QAAI,KAAK,OAAO;AACd,cAAQ,IAAI,kDAAkD;AAAA,QAC5D,QAAQ,OAAO;AAAA,QACf,YAAY,OAAO,MAAM;AAAA,QACzB,QAAQ,OAAO;AAAA,MACjB,CAAC;AAAA,IACH;AAIA,WAAO,KAAK,mBAAmB;AAAA,MAC7B,YAAY,OAAO;AAAA,MACnB,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,aAAa;AAAA;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction,
|
|
1
|
+
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServerComponentsServerModuleTypes } from './components.server.mjs';
|
|
2
2
|
export { ChipiProvider as ChipiClientProvider } from './app-router/client/ChipiProvider.mjs';
|
|
3
|
-
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction,
|
|
3
|
+
export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
|
|
4
4
|
export * from '@chipi-stack/types';
|
|
5
5
|
import './app-router/server/ChipiProvider.mjs';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _chipi_stack_types from '@chipi-stack/types';
|
|
2
|
-
import { ChipiSDK } from '@chipi-stack/backend';
|
|
2
|
+
import { ChipiSDK, CreateWalletParams } from '@chipi-stack/backend';
|
|
3
3
|
import { ChipiServerConfig } from './types.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -22,9 +22,9 @@ declare class ChipiServerSDK extends ChipiSDK {
|
|
|
22
22
|
/**
|
|
23
23
|
* Server-side wallet creation with enhanced security
|
|
24
24
|
*/
|
|
25
|
-
createServerWallet(params: {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
createServerWallet({ params, bearerToken, }: {
|
|
26
|
+
params: CreateWalletParams;
|
|
27
|
+
bearerToken: string;
|
|
28
28
|
}): Promise<_chipi_stack_types.CreateWalletResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* Server-side transaction execution with enhanced logging
|
|
@@ -36,23 +36,6 @@ declare class ChipiServerSDK extends ChipiSDK {
|
|
|
36
36
|
calls: any[];
|
|
37
37
|
reason?: string;
|
|
38
38
|
}): Promise<string>;
|
|
39
|
-
/**
|
|
40
|
-
* Server-side SKU purchase with enhanced tracking
|
|
41
|
-
*/
|
|
42
|
-
purchaseSkuForUser(params: {
|
|
43
|
-
userId: string;
|
|
44
|
-
skuId: string;
|
|
45
|
-
walletAddress: string;
|
|
46
|
-
chain: any;
|
|
47
|
-
chainToken: any;
|
|
48
|
-
mxnAmount: number;
|
|
49
|
-
reference: string;
|
|
50
|
-
transactionHash: string;
|
|
51
|
-
metadata?: Record<string, any>;
|
|
52
|
-
}): Promise<{
|
|
53
|
-
sku: _chipi_stack_types.Sku;
|
|
54
|
-
transaction: _chipi_stack_types.SkuTransaction;
|
|
55
|
-
}>;
|
|
56
39
|
}
|
|
57
40
|
|
|
58
41
|
export { ChipiServerSDK };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chipi-stack/nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Chipi SDK for Next.js applications with server-side support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chipi",
|
|
@@ -58,16 +58,6 @@
|
|
|
58
58
|
"files": [
|
|
59
59
|
"dist"
|
|
60
60
|
],
|
|
61
|
-
"scripts": {
|
|
62
|
-
"build": "tsup",
|
|
63
|
-
"clean": "rimraf ./dist",
|
|
64
|
-
"dev": "tsup --watch",
|
|
65
|
-
"dev:publish": "pnpm dev --env.publish",
|
|
66
|
-
"format": "prettier --write src/**/*.{ts,tsx}",
|
|
67
|
-
"format:check": "prettier --check src/**/*.{ts,tsx}",
|
|
68
|
-
"lint": "eslint src",
|
|
69
|
-
"typecheck": "tsc --noEmit"
|
|
70
|
-
},
|
|
71
61
|
"devDependencies": {
|
|
72
62
|
"@types/node": "^22.15.15",
|
|
73
63
|
"@types/react": "^18.3.0",
|
|
@@ -82,11 +72,11 @@
|
|
|
82
72
|
"typescript": "^5.7.3"
|
|
83
73
|
},
|
|
84
74
|
"dependencies": {
|
|
85
|
-
"@
|
|
86
|
-
"@chipi-stack/
|
|
87
|
-
"@chipi-stack/
|
|
88
|
-
"@chipi-stack/
|
|
89
|
-
"@
|
|
75
|
+
"@tanstack/react-query": "^5.85.0",
|
|
76
|
+
"@chipi-stack/backend": "^1.0.0",
|
|
77
|
+
"@chipi-stack/chipi-react": "^1.0.0",
|
|
78
|
+
"@chipi-stack/shared": "^1.0.0",
|
|
79
|
+
"@chipi-stack/types": "^1.0.0"
|
|
90
80
|
},
|
|
91
81
|
"peerDependencies": {
|
|
92
82
|
"next": ">=13.0.0",
|
|
@@ -98,5 +88,15 @@
|
|
|
98
88
|
},
|
|
99
89
|
"publishConfig": {
|
|
100
90
|
"access": "public"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"build": "tsup",
|
|
94
|
+
"clean": "rimraf ./dist",
|
|
95
|
+
"dev": "tsup --watch",
|
|
96
|
+
"dev:publish": "pnpm dev --env.publish",
|
|
97
|
+
"format": "prettier --write src/**/*.{ts,tsx}",
|
|
98
|
+
"format:check": "prettier --check src/**/*.{ts,tsx}",
|
|
99
|
+
"lint": "eslint src",
|
|
100
|
+
"typecheck": "tsc --noEmit"
|
|
101
101
|
}
|
|
102
|
-
}
|
|
102
|
+
}
|