@iamgame/wallet-sdk 0.1.2 → 0.1.4

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/index.cjs CHANGED
@@ -249,6 +249,9 @@ function getTelegram() {
249
249
  if (typeof window === "undefined") return void 0;
250
250
  return window.Telegram;
251
251
  }
252
+ function getTelegramWebApp() {
253
+ return getTelegram()?.WebApp ?? null;
254
+ }
252
255
  function getTelegramInitData() {
253
256
  const data = getTelegram()?.WebApp?.initData;
254
257
  if (!data || typeof data !== "string" || data.length === 0) return null;
@@ -391,6 +394,7 @@ function useSolvenAuth() {
391
394
  return {
392
395
  user: session?.user ?? null,
393
396
  status,
397
+ accessToken: session?.accessToken ?? null,
394
398
  connectExternal,
395
399
  connectTelegram,
396
400
  requestEmailOtp,
@@ -471,6 +475,13 @@ function useSolvenTransferIn() {
471
475
  const wallet = useSolvenWallet();
472
476
  return { destinationAddress: wallet?.address ?? null };
473
477
  }
478
+ function useIsTelegram() {
479
+ const [inTelegram, setInTelegram] = react.useState(false);
480
+ react.useEffect(() => {
481
+ setInTelegram(isTelegramMiniApp());
482
+ }, []);
483
+ return inTelegram;
484
+ }
474
485
 
475
486
  // ../../solven/sdk-client/src/wallet-adapter.ts
476
487
  function phantomAdapter() {
@@ -2185,6 +2196,31 @@ async function buildSplTransferIn(deps, opts) {
2185
2196
  tx.serialize({ requireAllSignatures: false, verifySignatures: false })
2186
2197
  ).toString("base64");
2187
2198
  }
2199
+ var detectors = [
2200
+ { platform: "telegram", detect: () => isTelegramMiniApp() }
2201
+ // Future hosts drop in here (or via registerPlatform), e.g.:
2202
+ // { platform: "mewe", detect: () => typeof window !== "undefined" && !!(window as { MeWe?: unknown }).MeWe },
2203
+ ];
2204
+ function registerPlatform(detector) {
2205
+ detectors.unshift(detector);
2206
+ }
2207
+ function detectPlatform() {
2208
+ if (typeof window === "undefined") return "web";
2209
+ for (const d of detectors) {
2210
+ try {
2211
+ if (d.detect()) return d.platform;
2212
+ } catch {
2213
+ }
2214
+ }
2215
+ return "web";
2216
+ }
2217
+ function usePlatform() {
2218
+ const [platform, setPlatform] = react.useState("web");
2219
+ react.useEffect(() => {
2220
+ setPlatform(detectPlatform());
2221
+ }, []);
2222
+ return platform;
2223
+ }
2188
2224
 
2189
2225
  // src/provider.tsx
2190
2226
  var IAMGameWalletProvider = SolvenProvider;
@@ -2201,14 +2237,19 @@ exports.WalletWithdraw = SolvenWithdraw;
2201
2237
  exports.backpackAdapter = backpackAdapter;
2202
2238
  exports.buildSolTransferIn = buildSolTransferIn;
2203
2239
  exports.buildSplTransferIn = buildSplTransferIn;
2240
+ exports.detectPlatform = detectPlatform;
2204
2241
  exports.getTelegramInitData = getTelegramInitData;
2242
+ exports.getTelegramWebApp = getTelegramWebApp;
2205
2243
  exports.inMemorySession = inMemorySession;
2206
2244
  exports.isTelegramMiniApp = isTelegramMiniApp;
2207
2245
  exports.listSupportedWallets = listSupportedWallets;
2208
2246
  exports.localStorageSession = localStorageSession;
2209
2247
  exports.notifyTelegramReady = notifyTelegramReady;
2210
2248
  exports.phantomAdapter = phantomAdapter;
2249
+ exports.registerPlatform = registerPlatform;
2211
2250
  exports.solflareAdapter = solflareAdapter;
2251
+ exports.useIsTelegram = useIsTelegram;
2252
+ exports.usePlatform = usePlatform;
2212
2253
  exports.useWallet = useSolvenWallet;
2213
2254
  exports.useWalletAuth = useSolvenAuth;
2214
2255
  exports.useWalletBalance = useSolvenBalance;
package/dist/index.d.cts CHANGED
@@ -261,6 +261,13 @@ interface IUseIAMGameAuth {
261
261
  connectExternal: (adapter: IExternalWalletAdapter) => Promise<void>;
262
262
  /** Run the Telegram TMA flow. Reads `window.Telegram.WebApp.initData` and posts to IAMGame. */
263
263
  connectTelegram: () => Promise<void>;
264
+ /**
265
+ * The current session's access token, or null when anonymous. Hand this to YOUR
266
+ * backend, which verifies it server-to-server (POST /v1/sessions/verify with your
267
+ * secret key) and mints its own app session. Never trust it as proof of identity
268
+ * on its own — it must be verified server-side.
269
+ */
270
+ accessToken: string | null;
264
271
  /** Email + OTP step 1: email a one-time code to the address. */
265
272
  requestEmailOtp: (email: string) => Promise<{
266
273
  expiresAt: string;
@@ -295,6 +302,13 @@ interface IUseIAMGameTransferIn {
295
302
  destinationAddress: string | null;
296
303
  }
297
304
  declare function useIAMGameTransferIn(): IUseIAMGameTransferIn;
305
+ /**
306
+ * True when the app is running inside a Telegram Mini App. SSR-safe: returns false
307
+ * on the server and during the first client render, then the real value after mount —
308
+ * so it never causes a hydration mismatch. For imperative checks use isTelegramMiniApp();
309
+ * for the WebApp object (haptics etc.) use getTelegramWebApp().
310
+ */
311
+ declare function useIsTelegram(): boolean;
298
312
 
299
313
  interface IAMGameLoginTheme {
300
314
  primary?: string;
@@ -490,13 +504,54 @@ declare function buildSolTransferIn(deps: TransferInDeps, opts: BuildSolTransfer
490
504
  */
491
505
  declare function buildSplTransferIn(deps: TransferInDeps, opts: BuildSplTransferOpts): Promise<string>;
492
506
 
507
+ /** Minimal shape of the Telegram WebApp object — enough for detection + common UI
508
+ * affordances (haptics, theme, buttons). It is the live Telegram object, so other
509
+ * fields exist at runtime; cast if you need them. */
510
+ interface TelegramWebApp {
511
+ initData?: string;
512
+ version?: string;
513
+ platform?: string;
514
+ colorScheme?: "light" | "dark";
515
+ ready?: () => void;
516
+ expand?: () => void;
517
+ close?: () => void;
518
+ HapticFeedback?: {
519
+ impactOccurred?: (style: "light" | "medium" | "heavy" | "rigid" | "soft") => void;
520
+ notificationOccurred?: (type: "error" | "success" | "warning") => void;
521
+ selectionChanged?: () => void;
522
+ };
523
+ [key: string]: unknown;
524
+ }
525
+ /** The live Telegram WebApp object when running inside Telegram, else null.
526
+ * Use it for haptics etc.: getTelegramWebApp()?.HapticFeedback?.impactOccurred("medium"). */
527
+ declare function getTelegramWebApp(): TelegramWebApp | null;
493
528
  declare function getTelegramInitData(): string | null;
494
529
  declare function isTelegramMiniApp(): boolean;
495
530
  declare function notifyTelegramReady(): void;
496
531
 
532
+ /** Known hosts. Kept an open string so a new platform (e.g. "mewe") works before a
533
+ * release — register a detector for it and it just flows through everywhere. */
534
+ type Platform = "web" | "telegram" | "mewe" | (string & {});
535
+ interface PlatformDetector {
536
+ platform: Platform;
537
+ /** True when the app is running inside this host. Runs only in the browser. */
538
+ detect: () => boolean;
539
+ }
540
+ /**
541
+ * Register a host detector the SDK doesn't know yet (checked before the built-ins).
542
+ * Call once at app start. This is the seam for launching on a new platform — no SDK
543
+ * release required.
544
+ */
545
+ declare function registerPlatform(detector: PlatformDetector): void;
546
+ /** The current host platform. "web" on the server and as the default. */
547
+ declare function detectPlatform(): Platform;
548
+ /** SSR-safe reactive platform: "web" on the server + first client render, then the
549
+ * real value after mount — so it never causes a hydration mismatch. */
550
+ declare function usePlatform(): Platform;
551
+
497
552
  interface IAMGameWalletProviderProps extends IAMGameClientOptions {
498
553
  children: React.ReactNode;
499
554
  }
500
555
  declare const IAMGameWalletProvider: React.FC<IAMGameWalletProviderProps>;
501
556
 
502
- export { type AuthMethod, type BuildSolTransferOpts, type BuildSplTransferOpts, type ComplianceModuleType, type ComplianceStatus, IAMGameClient as IAMGameWalletClient, type IAMGameClientOptions as IAMGameWalletClientOptions, IAMGameWalletProvider, type IAMGameWalletProviderProps, type IComplianceState, type IExportInitiateRequest, type IExportInitiateResponse, type IExportPreflightResponse, type IExternalWalletAdapter, type ISession, type ISessionStorage, type ISignActionRequest, type ISignActionResponse, type ISiwsChallenge, type ISiwsVerifyRequest, type ITelegramVerifyRequest, type ITokenBalance, type IUseIAMGameAuth as IUseWalletAuth, type IUseIAMGameExport as IUseWalletExport, type IUseIAMGameSign as IUseWalletSign, type IUseIAMGameTransferIn as IUseWalletTransferIn, type IUser, type IUserIdentity, type IWallet, type IWalletBalance, type IIAMGameErrorEnvelope as IWalletErrorEnvelope, type IWebhookEnvelope, type IWebhookSignatureHeader, type IWithdrawRequest, type IWithdrawResponse, type TransferInDeps, IAMGameAddress as WalletAddress, type IAMGameAddressProps as WalletAddressProps, type IAMGameAddressTheme as WalletAddressTheme, IAMGameBalance as WalletBalance, type IAMGameBalanceProps as WalletBalanceProps, type IAMGameBalanceTheme as WalletBalanceTheme, type WalletCustody, type WalletDescriptor, type IAMGameErrorCode as WalletErrorCode, IAMGameExport as WalletExport, type IAMGameExportProps as WalletExportProps, type IAMGameExportTheme as WalletExportTheme, type WalletId, IAMGameLogin as WalletLogin, IAMGameLoginModal as WalletLoginModal, type IAMGameLoginModalProps as WalletLoginModalProps, type IAMGameLoginProps as WalletLoginProps, type IAMGameLoginTheme as WalletLoginTheme, IAMGameSdkError as WalletSdkError, type WalletStatus, IAMGameWithdraw as WalletWithdraw, type IAMGameWithdrawProps as WalletWithdrawProps, type IAMGameWithdrawTheme as WalletWithdrawTheme, type WebhookEventType, backpackAdapter, buildSolTransferIn, buildSplTransferIn, getTelegramInitData, inMemorySession, isTelegramMiniApp, listSupportedWallets, localStorageSession, notifyTelegramReady, phantomAdapter, solflareAdapter, useIAMGameWallet as useWallet, useIAMGameAuth as useWalletAuth, useIAMGameBalance as useWalletBalance, useIAMGameExport as useWalletExport, useIAMGameSign as useWalletSign, useIAMGameTransferIn as useWalletTransferIn };
557
+ export { type AuthMethod, type BuildSolTransferOpts, type BuildSplTransferOpts, type ComplianceModuleType, type ComplianceStatus, IAMGameClient as IAMGameWalletClient, type IAMGameClientOptions as IAMGameWalletClientOptions, IAMGameWalletProvider, type IAMGameWalletProviderProps, type IComplianceState, type IExportInitiateRequest, type IExportInitiateResponse, type IExportPreflightResponse, type IExternalWalletAdapter, type ISession, type ISessionStorage, type ISignActionRequest, type ISignActionResponse, type ISiwsChallenge, type ISiwsVerifyRequest, type ITelegramVerifyRequest, type ITokenBalance, type IUseIAMGameAuth as IUseWalletAuth, type IUseIAMGameExport as IUseWalletExport, type IUseIAMGameSign as IUseWalletSign, type IUseIAMGameTransferIn as IUseWalletTransferIn, type IUser, type IUserIdentity, type IWallet, type IWalletBalance, type IIAMGameErrorEnvelope as IWalletErrorEnvelope, type IWebhookEnvelope, type IWebhookSignatureHeader, type IWithdrawRequest, type IWithdrawResponse, type Platform, type PlatformDetector, type TelegramWebApp, type TransferInDeps, IAMGameAddress as WalletAddress, type IAMGameAddressProps as WalletAddressProps, type IAMGameAddressTheme as WalletAddressTheme, IAMGameBalance as WalletBalance, type IAMGameBalanceProps as WalletBalanceProps, type IAMGameBalanceTheme as WalletBalanceTheme, type WalletCustody, type WalletDescriptor, type IAMGameErrorCode as WalletErrorCode, IAMGameExport as WalletExport, type IAMGameExportProps as WalletExportProps, type IAMGameExportTheme as WalletExportTheme, type WalletId, IAMGameLogin as WalletLogin, IAMGameLoginModal as WalletLoginModal, type IAMGameLoginModalProps as WalletLoginModalProps, type IAMGameLoginProps as WalletLoginProps, type IAMGameLoginTheme as WalletLoginTheme, IAMGameSdkError as WalletSdkError, type WalletStatus, IAMGameWithdraw as WalletWithdraw, type IAMGameWithdrawProps as WalletWithdrawProps, type IAMGameWithdrawTheme as WalletWithdrawTheme, type WebhookEventType, backpackAdapter, buildSolTransferIn, buildSplTransferIn, detectPlatform, getTelegramInitData, getTelegramWebApp, inMemorySession, isTelegramMiniApp, listSupportedWallets, localStorageSession, notifyTelegramReady, phantomAdapter, registerPlatform, solflareAdapter, useIsTelegram, usePlatform, useIAMGameWallet as useWallet, useIAMGameAuth as useWalletAuth, useIAMGameBalance as useWalletBalance, useIAMGameExport as useWalletExport, useIAMGameSign as useWalletSign, useIAMGameTransferIn as useWalletTransferIn };
package/dist/index.d.ts CHANGED
@@ -261,6 +261,13 @@ interface IUseIAMGameAuth {
261
261
  connectExternal: (adapter: IExternalWalletAdapter) => Promise<void>;
262
262
  /** Run the Telegram TMA flow. Reads `window.Telegram.WebApp.initData` and posts to IAMGame. */
263
263
  connectTelegram: () => Promise<void>;
264
+ /**
265
+ * The current session's access token, or null when anonymous. Hand this to YOUR
266
+ * backend, which verifies it server-to-server (POST /v1/sessions/verify with your
267
+ * secret key) and mints its own app session. Never trust it as proof of identity
268
+ * on its own — it must be verified server-side.
269
+ */
270
+ accessToken: string | null;
264
271
  /** Email + OTP step 1: email a one-time code to the address. */
265
272
  requestEmailOtp: (email: string) => Promise<{
266
273
  expiresAt: string;
@@ -295,6 +302,13 @@ interface IUseIAMGameTransferIn {
295
302
  destinationAddress: string | null;
296
303
  }
297
304
  declare function useIAMGameTransferIn(): IUseIAMGameTransferIn;
305
+ /**
306
+ * True when the app is running inside a Telegram Mini App. SSR-safe: returns false
307
+ * on the server and during the first client render, then the real value after mount —
308
+ * so it never causes a hydration mismatch. For imperative checks use isTelegramMiniApp();
309
+ * for the WebApp object (haptics etc.) use getTelegramWebApp().
310
+ */
311
+ declare function useIsTelegram(): boolean;
298
312
 
299
313
  interface IAMGameLoginTheme {
300
314
  primary?: string;
@@ -490,13 +504,54 @@ declare function buildSolTransferIn(deps: TransferInDeps, opts: BuildSolTransfer
490
504
  */
491
505
  declare function buildSplTransferIn(deps: TransferInDeps, opts: BuildSplTransferOpts): Promise<string>;
492
506
 
507
+ /** Minimal shape of the Telegram WebApp object — enough for detection + common UI
508
+ * affordances (haptics, theme, buttons). It is the live Telegram object, so other
509
+ * fields exist at runtime; cast if you need them. */
510
+ interface TelegramWebApp {
511
+ initData?: string;
512
+ version?: string;
513
+ platform?: string;
514
+ colorScheme?: "light" | "dark";
515
+ ready?: () => void;
516
+ expand?: () => void;
517
+ close?: () => void;
518
+ HapticFeedback?: {
519
+ impactOccurred?: (style: "light" | "medium" | "heavy" | "rigid" | "soft") => void;
520
+ notificationOccurred?: (type: "error" | "success" | "warning") => void;
521
+ selectionChanged?: () => void;
522
+ };
523
+ [key: string]: unknown;
524
+ }
525
+ /** The live Telegram WebApp object when running inside Telegram, else null.
526
+ * Use it for haptics etc.: getTelegramWebApp()?.HapticFeedback?.impactOccurred("medium"). */
527
+ declare function getTelegramWebApp(): TelegramWebApp | null;
493
528
  declare function getTelegramInitData(): string | null;
494
529
  declare function isTelegramMiniApp(): boolean;
495
530
  declare function notifyTelegramReady(): void;
496
531
 
532
+ /** Known hosts. Kept an open string so a new platform (e.g. "mewe") works before a
533
+ * release — register a detector for it and it just flows through everywhere. */
534
+ type Platform = "web" | "telegram" | "mewe" | (string & {});
535
+ interface PlatformDetector {
536
+ platform: Platform;
537
+ /** True when the app is running inside this host. Runs only in the browser. */
538
+ detect: () => boolean;
539
+ }
540
+ /**
541
+ * Register a host detector the SDK doesn't know yet (checked before the built-ins).
542
+ * Call once at app start. This is the seam for launching on a new platform — no SDK
543
+ * release required.
544
+ */
545
+ declare function registerPlatform(detector: PlatformDetector): void;
546
+ /** The current host platform. "web" on the server and as the default. */
547
+ declare function detectPlatform(): Platform;
548
+ /** SSR-safe reactive platform: "web" on the server + first client render, then the
549
+ * real value after mount — so it never causes a hydration mismatch. */
550
+ declare function usePlatform(): Platform;
551
+
497
552
  interface IAMGameWalletProviderProps extends IAMGameClientOptions {
498
553
  children: React.ReactNode;
499
554
  }
500
555
  declare const IAMGameWalletProvider: React.FC<IAMGameWalletProviderProps>;
501
556
 
502
- export { type AuthMethod, type BuildSolTransferOpts, type BuildSplTransferOpts, type ComplianceModuleType, type ComplianceStatus, IAMGameClient as IAMGameWalletClient, type IAMGameClientOptions as IAMGameWalletClientOptions, IAMGameWalletProvider, type IAMGameWalletProviderProps, type IComplianceState, type IExportInitiateRequest, type IExportInitiateResponse, type IExportPreflightResponse, type IExternalWalletAdapter, type ISession, type ISessionStorage, type ISignActionRequest, type ISignActionResponse, type ISiwsChallenge, type ISiwsVerifyRequest, type ITelegramVerifyRequest, type ITokenBalance, type IUseIAMGameAuth as IUseWalletAuth, type IUseIAMGameExport as IUseWalletExport, type IUseIAMGameSign as IUseWalletSign, type IUseIAMGameTransferIn as IUseWalletTransferIn, type IUser, type IUserIdentity, type IWallet, type IWalletBalance, type IIAMGameErrorEnvelope as IWalletErrorEnvelope, type IWebhookEnvelope, type IWebhookSignatureHeader, type IWithdrawRequest, type IWithdrawResponse, type TransferInDeps, IAMGameAddress as WalletAddress, type IAMGameAddressProps as WalletAddressProps, type IAMGameAddressTheme as WalletAddressTheme, IAMGameBalance as WalletBalance, type IAMGameBalanceProps as WalletBalanceProps, type IAMGameBalanceTheme as WalletBalanceTheme, type WalletCustody, type WalletDescriptor, type IAMGameErrorCode as WalletErrorCode, IAMGameExport as WalletExport, type IAMGameExportProps as WalletExportProps, type IAMGameExportTheme as WalletExportTheme, type WalletId, IAMGameLogin as WalletLogin, IAMGameLoginModal as WalletLoginModal, type IAMGameLoginModalProps as WalletLoginModalProps, type IAMGameLoginProps as WalletLoginProps, type IAMGameLoginTheme as WalletLoginTheme, IAMGameSdkError as WalletSdkError, type WalletStatus, IAMGameWithdraw as WalletWithdraw, type IAMGameWithdrawProps as WalletWithdrawProps, type IAMGameWithdrawTheme as WalletWithdrawTheme, type WebhookEventType, backpackAdapter, buildSolTransferIn, buildSplTransferIn, getTelegramInitData, inMemorySession, isTelegramMiniApp, listSupportedWallets, localStorageSession, notifyTelegramReady, phantomAdapter, solflareAdapter, useIAMGameWallet as useWallet, useIAMGameAuth as useWalletAuth, useIAMGameBalance as useWalletBalance, useIAMGameExport as useWalletExport, useIAMGameSign as useWalletSign, useIAMGameTransferIn as useWalletTransferIn };
557
+ export { type AuthMethod, type BuildSolTransferOpts, type BuildSplTransferOpts, type ComplianceModuleType, type ComplianceStatus, IAMGameClient as IAMGameWalletClient, type IAMGameClientOptions as IAMGameWalletClientOptions, IAMGameWalletProvider, type IAMGameWalletProviderProps, type IComplianceState, type IExportInitiateRequest, type IExportInitiateResponse, type IExportPreflightResponse, type IExternalWalletAdapter, type ISession, type ISessionStorage, type ISignActionRequest, type ISignActionResponse, type ISiwsChallenge, type ISiwsVerifyRequest, type ITelegramVerifyRequest, type ITokenBalance, type IUseIAMGameAuth as IUseWalletAuth, type IUseIAMGameExport as IUseWalletExport, type IUseIAMGameSign as IUseWalletSign, type IUseIAMGameTransferIn as IUseWalletTransferIn, type IUser, type IUserIdentity, type IWallet, type IWalletBalance, type IIAMGameErrorEnvelope as IWalletErrorEnvelope, type IWebhookEnvelope, type IWebhookSignatureHeader, type IWithdrawRequest, type IWithdrawResponse, type Platform, type PlatformDetector, type TelegramWebApp, type TransferInDeps, IAMGameAddress as WalletAddress, type IAMGameAddressProps as WalletAddressProps, type IAMGameAddressTheme as WalletAddressTheme, IAMGameBalance as WalletBalance, type IAMGameBalanceProps as WalletBalanceProps, type IAMGameBalanceTheme as WalletBalanceTheme, type WalletCustody, type WalletDescriptor, type IAMGameErrorCode as WalletErrorCode, IAMGameExport as WalletExport, type IAMGameExportProps as WalletExportProps, type IAMGameExportTheme as WalletExportTheme, type WalletId, IAMGameLogin as WalletLogin, IAMGameLoginModal as WalletLoginModal, type IAMGameLoginModalProps as WalletLoginModalProps, type IAMGameLoginProps as WalletLoginProps, type IAMGameLoginTheme as WalletLoginTheme, IAMGameSdkError as WalletSdkError, type WalletStatus, IAMGameWithdraw as WalletWithdraw, type IAMGameWithdrawProps as WalletWithdrawProps, type IAMGameWithdrawTheme as WalletWithdrawTheme, type WebhookEventType, backpackAdapter, buildSolTransferIn, buildSplTransferIn, detectPlatform, getTelegramInitData, getTelegramWebApp, inMemorySession, isTelegramMiniApp, listSupportedWallets, localStorageSession, notifyTelegramReady, phantomAdapter, registerPlatform, solflareAdapter, useIsTelegram, usePlatform, useIAMGameWallet as useWallet, useIAMGameAuth as useWalletAuth, useIAMGameBalance as useWalletBalance, useIAMGameExport as useWalletExport, useIAMGameSign as useWalletSign, useIAMGameTransferIn as useWalletTransferIn };
package/dist/index.js CHANGED
@@ -247,6 +247,9 @@ function getTelegram() {
247
247
  if (typeof window === "undefined") return void 0;
248
248
  return window.Telegram;
249
249
  }
250
+ function getTelegramWebApp() {
251
+ return getTelegram()?.WebApp ?? null;
252
+ }
250
253
  function getTelegramInitData() {
251
254
  const data = getTelegram()?.WebApp?.initData;
252
255
  if (!data || typeof data !== "string" || data.length === 0) return null;
@@ -389,6 +392,7 @@ function useSolvenAuth() {
389
392
  return {
390
393
  user: session?.user ?? null,
391
394
  status,
395
+ accessToken: session?.accessToken ?? null,
392
396
  connectExternal,
393
397
  connectTelegram,
394
398
  requestEmailOtp,
@@ -469,6 +473,13 @@ function useSolvenTransferIn() {
469
473
  const wallet = useSolvenWallet();
470
474
  return { destinationAddress: wallet?.address ?? null };
471
475
  }
476
+ function useIsTelegram() {
477
+ const [inTelegram, setInTelegram] = useState(false);
478
+ useEffect(() => {
479
+ setInTelegram(isTelegramMiniApp());
480
+ }, []);
481
+ return inTelegram;
482
+ }
472
483
 
473
484
  // ../../solven/sdk-client/src/wallet-adapter.ts
474
485
  function phantomAdapter() {
@@ -2183,8 +2194,33 @@ async function buildSplTransferIn(deps, opts) {
2183
2194
  tx.serialize({ requireAllSignatures: false, verifySignatures: false })
2184
2195
  ).toString("base64");
2185
2196
  }
2197
+ var detectors = [
2198
+ { platform: "telegram", detect: () => isTelegramMiniApp() }
2199
+ // Future hosts drop in here (or via registerPlatform), e.g.:
2200
+ // { platform: "mewe", detect: () => typeof window !== "undefined" && !!(window as { MeWe?: unknown }).MeWe },
2201
+ ];
2202
+ function registerPlatform(detector) {
2203
+ detectors.unshift(detector);
2204
+ }
2205
+ function detectPlatform() {
2206
+ if (typeof window === "undefined") return "web";
2207
+ for (const d of detectors) {
2208
+ try {
2209
+ if (d.detect()) return d.platform;
2210
+ } catch {
2211
+ }
2212
+ }
2213
+ return "web";
2214
+ }
2215
+ function usePlatform() {
2216
+ const [platform, setPlatform] = useState("web");
2217
+ useEffect(() => {
2218
+ setPlatform(detectPlatform());
2219
+ }, []);
2220
+ return platform;
2221
+ }
2186
2222
 
2187
2223
  // src/provider.tsx
2188
2224
  var IAMGameWalletProvider = SolvenProvider;
2189
2225
 
2190
- export { SolvenClient as IAMGameWalletClient, IAMGameWalletProvider, SolvenAddress as WalletAddress, SolvenBalance as WalletBalance, SolvenExport as WalletExport, SolvenLogin as WalletLogin, SolvenLoginModal as WalletLoginModal, SolvenSdkError as WalletSdkError, SolvenWithdraw as WalletWithdraw, backpackAdapter, buildSolTransferIn, buildSplTransferIn, getTelegramInitData, inMemorySession, isTelegramMiniApp, listSupportedWallets, localStorageSession, notifyTelegramReady, phantomAdapter, solflareAdapter, useSolvenWallet as useWallet, useSolvenAuth as useWalletAuth, useSolvenBalance as useWalletBalance, useSolvenExport as useWalletExport, useSolvenSign as useWalletSign, useSolvenTransferIn as useWalletTransferIn };
2226
+ export { SolvenClient as IAMGameWalletClient, IAMGameWalletProvider, SolvenAddress as WalletAddress, SolvenBalance as WalletBalance, SolvenExport as WalletExport, SolvenLogin as WalletLogin, SolvenLoginModal as WalletLoginModal, SolvenSdkError as WalletSdkError, SolvenWithdraw as WalletWithdraw, backpackAdapter, buildSolTransferIn, buildSplTransferIn, detectPlatform, getTelegramInitData, getTelegramWebApp, inMemorySession, isTelegramMiniApp, listSupportedWallets, localStorageSession, notifyTelegramReady, phantomAdapter, registerPlatform, solflareAdapter, useIsTelegram, usePlatform, useSolvenWallet as useWallet, useSolvenAuth as useWalletAuth, useSolvenBalance as useWalletBalance, useSolvenExport as useWalletExport, useSolvenSign as useWalletSign, useSolvenTransferIn as useWalletTransferIn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamgame/wallet-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "IAMGame Wallet browser SDK — Telegram & Solana wallet auth, balances, server-side signing, and key export. Drop-in React provider for game frontends.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://wallet.iamgame.com",