@farcaster/miniapp-sdk 0.1.7 → 0.1.9

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/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AddMiniApp, ComposeCast, Context, GetCapabilities, GetChains, ImpactOccurred, MiniAppNotificationDetails, NotificationOccurred, OpenMiniApp, Ready, SelectionChanged, SendToken, SetPrimaryButtonOptions, SignIn, SolanaWalletProvider, SwapToken, ViewCast, ViewProfile, ViewToken } from '@farcaster/miniapp-core';
1
+ import type { AddMiniApp, ComposeCast, Context, GetCapabilities, GetChains, ImpactOccurred, MiniAppNotificationDetails, NotificationOccurred, OpenMiniApp, Ready, RequestCameraAndMicrophoneAccess, SelectionChanged, SendToken, SetPrimaryButtonOptions, SignIn, SolanaWalletProvider, SwapToken, ViewCast, ViewProfile, ViewToken } from '@farcaster/miniapp-core';
2
2
  import type { EventEmitter } from 'eventemitter3';
3
3
  import type * as Provider from 'ox/Provider';
4
4
  import type { Back } from './back.ts';
@@ -40,7 +40,9 @@ export type MiniAppSDK = {
40
40
  quickAuth: QuickAuth;
41
41
  actions: {
42
42
  ready: (options?: Partial<Ready.ReadyOptions>) => Promise<void>;
43
- openUrl: (url: string) => Promise<void>;
43
+ openUrl: (url: string | {
44
+ url: string;
45
+ }) => Promise<void>;
44
46
  close: () => Promise<void>;
45
47
  setPrimaryButton: SetPrimaryButton;
46
48
  addFrame: AddMiniApp.AddMiniApp;
@@ -53,6 +55,7 @@ export type MiniAppSDK = {
53
55
  sendToken: SendToken.SendToken;
54
56
  swapToken: SwapToken.SwapToken;
55
57
  openMiniApp: OpenMiniApp.OpenMiniApp;
58
+ requestCameraAndMicrophoneAccess: RequestCameraAndMicrophoneAccess.RequestCameraAndMicrophoneAccess;
56
59
  };
57
60
  experimental: {
58
61
  getSolanaProvider: () => Promise<SolanaWalletProvider | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/miniapp-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "comlink": "^4.4.2",
24
24
  "eventemitter3": "^5.0.1",
25
25
  "ox": "^0.4.4",
26
- "@farcaster/miniapp-core": "0.3.6"
26
+ "@farcaster/miniapp-core": "0.3.8"
27
27
  },
28
28
  "scripts": {
29
29
  "clean": "rm -rf dist",
package/src/sdk.ts CHANGED
@@ -16,10 +16,10 @@ let cachedIsInMiniAppResult: boolean | null = null
16
16
  /**
17
17
  * Determines if the current environment is a MiniApp context.
18
18
  *
19
- * @param timeoutMs - Optional timeout in milliseconds (default: 50)
19
+ * @param timeoutMs - Optional timeout in milliseconds (default: 1000)
20
20
  * @returns Promise resolving to boolean indicating if in MiniApp context
21
21
  */
22
- async function isInMiniApp(timeoutMs = 50): Promise<boolean> {
22
+ async function isInMiniApp(timeoutMs = 1000): Promise<boolean> {
23
23
  // Return cached result if we've already determined we are in a MiniApp
24
24
  if (cachedIsInMiniAppResult === true) {
25
25
  return true
@@ -114,6 +114,8 @@ export const sdk: MiniAppSDK = {
114
114
  viewToken: miniAppHost.viewToken.bind(miniAppHost),
115
115
  sendToken: miniAppHost.sendToken.bind(miniAppHost),
116
116
  swapToken: miniAppHost.swapToken.bind(miniAppHost),
117
+ requestCameraAndMicrophoneAccess:
118
+ miniAppHost.requestCameraAndMicrophoneAccess.bind(miniAppHost),
117
119
  },
118
120
  experimental: {
119
121
  getSolanaProvider,
package/src/types.ts CHANGED
@@ -9,6 +9,7 @@ import type {
9
9
  NotificationOccurred,
10
10
  OpenMiniApp,
11
11
  Ready,
12
+ RequestCameraAndMicrophoneAccess,
12
13
  SelectionChanged,
13
14
  SendToken,
14
15
  SetPrimaryButtonOptions,
@@ -72,7 +73,7 @@ export type MiniAppSDK = {
72
73
  quickAuth: QuickAuth
73
74
  actions: {
74
75
  ready: (options?: Partial<Ready.ReadyOptions>) => Promise<void>
75
- openUrl: (url: string) => Promise<void>
76
+ openUrl: (url: string | { url: string }) => Promise<void>
76
77
  close: () => Promise<void>
77
78
  setPrimaryButton: SetPrimaryButton
78
79
  // Deprecated in favor of addMiniApp
@@ -88,6 +89,7 @@ export type MiniAppSDK = {
88
89
  sendToken: SendToken.SendToken
89
90
  swapToken: SwapToken.SwapToken
90
91
  openMiniApp: OpenMiniApp.OpenMiniApp
92
+ requestCameraAndMicrophoneAccess: RequestCameraAndMicrophoneAccess.RequestCameraAndMicrophoneAccess
91
93
  }
92
94
  experimental: {
93
95
  getSolanaProvider: () => Promise<SolanaWalletProvider | undefined>